Zeropage
From C64-Wiki
| | This article is under construction and classified as "work in progress" !!! |
The first 256 Bytes of the C64 memory map (0-255 or $0000-$00ff) are called zeropage: Besides faster fetching and storing from/to these addresses, the 65xx CPUs (including the 6510 in your beloved breadbox) offer the indirect-indexed addressing mode which only work on zeropage addresses.
The two very first addresses in both zeropage and the entire address space of the C64, are "hardwired" in the CPU to internal registers for use with the 6510's on-chip port: Reading and writing to these registers does not affect the attached RAM chips, and there is no direct way to access addresses 0 and 1 in RAM rather than the internal port registers (but some cunning hardware trickery with the VIC-chip will allow you to do so). This leaves 254 "normal", usable zeropage addresses, and thus potentially 254/2=127 index registers for use with indirect-indexed addressing.
This is also part of the reason why there are so few internal registers in 65xx CPUs compared to other CPUs of the day (1970s design): Why waste precious space on the CPU chip itself, when external RAM (including the zeropage area) runs at the same speed as the CPU itself, and thus provides a whopping 127 16-bit index registers...!
Those zeropage addresses are useful and important in programming the C64 – so useful that the internal KERNAL and BASIC system ROMs make use of most of them, leaving only a handful that are completelty "safe" for machine language programmers to use for their own purposes, without risking a system crash...!