Zero page

memory page starting at address zero

Uses your system voice; voice and rate in settings.

Q191975Snapshot

≈ 3 min read

Names in other languages

  • EnglishZero page
  • DeutschZeropage
  • 中文第零分頁

Article bodies are English and are not machine-translated. A name in another language is not a translation of the article.

The zero page or base page is the block of memory at the very beginning of a computer's address space; that is, the page whose starting address is zero. The size of a page depends on the context, and the significance of zero page memory versus higher addressed memory is highly dependent on machine architecture.

For example, the Motorola 6800 and MOS Technology 6502 processor families treat the first 256 bytes of memory specially, whereas many other processors do not. Unlike more modern hardware, in the 1970s computer RAM speed was similar to that of CPUs. Thus it made sense to have few registers and use the main memory as an extended pool of extra registers.

In machines with a relatively wide 16-bit address bus and comparatively narrow 8-bit data bus, calculating an address in memory could take several cycles. The zero page's one-byte address was smaller and therefore faster to read and calculate than other locations, making the zero page useful for high-performance code.

Zero page addressing now has mostly historical significance, since the developments in integrated circuit technology have made adding more registers to a CPU less expensive and CPU operations much faster than RAM accesses. LDA $12 ; zero page addressing LDA $0012 ; absolute addressing In 6502 assembly language, the above two instructions both accomplish the same thing: they load the value of memory location $12 into the .A (accumulator) register ( $ is Motorola/MOS Technology assembly language notation for a hexadecimal number).

However, the first instruction is only two bytes long and requires three clock cycles to complete. The second instruction is three bytes in length and requires four clock cycles to execute. This difference in execution time could become significant in repetitive code.

Some processors, such as the Motorola 6809 and the aforementioned WDC 65C816, implement a “direct page register” ( DP ) that tells the processor the starting address in RAM of what is considered to be zero page. In this context, zero page addressing is notional; the actual access would not be to the physical zero page if DP is loaded with some address other than $00 (or $0000 in the case of the 65C816).

Text derived from https://en.wikipedia.org/w/index.php?oldid=1323008045 under CC BY-SA 4.0; modifications have been made.

Sources cited in this revision

4 named source(s) extracted from the cited revision. A source with no author is shown by its publication; nothing is invented.