Steve Wozniak's ingenious design of the Woz Monitor is a testament to the art of efficient programming in the face of severe memory constraints. Let's delve into the intricacies and compromises that made this 256-byte wonder possible.
The stack pointer is not initialized, allowing the stack to float anywhere in page $01. This saves bytes but requires caution when using page $01 for code.
Wozniak exploits the PIA's post-reset state to initialize it without explicitly selecting DDR registers, saving precious bytes.
Only uppercase ASCII is supported, with bit 7 always set, diverging from standard ASCII but saving on comparison logic.
Errors simply reset the input buffer and print a backslash, eschewing detailed error messages to save space.
The code is structured top-down, optimizing for execution but potentially sacrificing readability.
Results from one operation are cleverly reused in unrelated parts of the code, saving initialization bytes but increasing code interdependency.
Characters below ASCII '.' are treated as blanks, allowing for flexible but potentially error-prone input.
NMI and IRQ vectors are set but not used, saving space while allowing for future expansion.
Despite these compromises, Wozniak's code is a masterpiece of efficiency, using only 254 of the available 256 bytes. This leaves 2 bytes free, a remarkable achievement given the monitor's functionality.