In the addressing mode section, the author missed out on a good opportunity to explain the Zero Page more completely.
Chuck Peddle intended the Z-page to act as 128 "registers" with each one potentially acting as a pointer, with an offset into RAM.
STA ($ZP), X
The address is formed by taking $ZP and $ZP+1 little endian style, then adding X to it.
ZP = $00
+1 = $C0
X = $10
A = $FE
The contents of A ($FE) would be written to $C000 + $10, which is $C010.
Zero page, is really core to writing bigger code on the chip successfully, and without using self-modifying code.
However, self modifying code can be considerably faster and many of us went right to it when trying to push a lot of pixels on our graphics screens!
Basically, one would take absolute indexed, and modify the address bytes in a loop.
STA $C010, X
That address gets modified, say stepping 40 bytes at a time so that the X register could index to any byte in a scanline and the address points to the left most "0" byte of a given scanline. For real speed, one could put a few of these instructions in a loop, and modify them in various ways to get a lot of writes to the screen in fewer cycles than it would take to update the Z page pointer.
Chuck Peddle intended the Z-page to act as 128 "registers" with each one potentially acting as a pointer, with an offset into RAM.
STA ($ZP), X
The address is formed by taking $ZP and $ZP+1 little endian style, then adding X to it.
ZP = $00 +1 = $C0 X = $10 A = $FE
The contents of A ($FE) would be written to $C000 + $10, which is $C010.
Zero page, is really core to writing bigger code on the chip successfully, and without using self-modifying code.
However, self modifying code can be considerably faster and many of us went right to it when trying to push a lot of pixels on our graphics screens!
Basically, one would take absolute indexed, and modify the address bytes in a loop.
STA $C010, X
That address gets modified, say stepping 40 bytes at a time so that the X register could index to any byte in a scanline and the address points to the left most "0" byte of a given scanline. For real speed, one could put a few of these instructions in a loop, and modify them in various ways to get a lot of writes to the screen in fewer cycles than it would take to update the Z page pointer.
Fun times!