Zeropage

from Wikipedia, the free encyclopedia

The zeropage (literally "page zero") is a part of the address space of a CPU for which a more compact representation of addresses or certain addressing modes exist in the first place. It does not represent an alternative address space such as B. on the Zilog Z8 or the Sharp SC61860 .

6502

For the microprocessor MOS Technology 6502 (whose variant 6510 was built into the well-known Commodore 64 ) the zeropage consists of the first 256 bytes of the main memory, in which the C64 RAM and IO ports are located.

This zeropage is of great importance for the machine programs of this processor because some addressing modes can only be used in or with this area. Two consecutive bytes in the zeropage can represent any address up to 64 KByte (from Hex 0000 to Hex FFFF). This is used in what is known as indirect addressing , in that it is interpreted as the base address for access to another memory location.

Examples:

Der Assemblerbefehl LDA ($FE),Y bedeutet:

  Lies den Wert der beiden Speicheradressen Hex FE und Hex FF aus und bilde daraus
  eine absolute Speicheradresse, dann addiere den Inhalt des Y-Registers dazu,
  und fülle den Akkumulator mit dem Inhalt der so gebildeten absoluten Adresse.
  („indirekt-indizierte“ Adressierung mit dem Y-Register)

Der Assemblerbefehl LDA ($F0,X) bedeutet:

  Addiere den Inhalt des X-Registers zum Hex-Wert F0 und bilde daraus eine Adresse
  (in der Zeropage), dann lies den Inhalt dieser und der darauf folgenden Adresse,
  bilde daraus eine absolute Speicheradresse, und fülle den Akkumulator mit dem
  Inhalt der so gebildeten absoluten Adresse.
  („indiziert-indirekte“ Adressierung mit dem X-Register)

If the values ​​of Hex FE or Hex FF (or the values ​​in the jump target table from Hex F0) change in the zeropage, then the absolute (or effective ) address that is read out changes. With this type of processor, this so-called indirect addressing can only be carried out via zeropage. The zeropage acts like a register bank with 128 16-bit index registers.

Other processors

In other microprocessors, too, those memory areas that are physically at the beginning of the memory often have a special meaning, but also completely different, such as e.g. B. the specified location for reset and interrupt vectors (with the Motorola 68000 ) or the program part that was jumped to during the reset (with the Zilog Z80 ) etc. With these processors, this memory area is not necessarily referred to as zeropage.