PAGE ONE

Locations 256 to 511 are called page one and have a very important use. They make up the stack for the OS, BASIC, and DOS (see RUNSTK at locations 142 and 143 for an explanation of what a stack is). On powerup (and on SYSTEM RESET), the stack pointer is set to 511. Each time a machine language JSR or PHA (PusH Accumulator on stack) instruction is executed, data is put on the stack and the pointer moved downward accordingly. When an RTS or PLA (PuLl Accumulator from stack) is executed, the corresponding data is pulled off the stack and the pointer moved back up. Since the stack pointer (which is a special location built into the main part of the computer) is just one byte, if you try and move it below location 256 it will wrap back around to location 511 and vice versa.


Return to Table of Contents | Previous Chapter | Next Chapter