Special variables: Difference between revisions

m
(→‎{{header|6502 Assembly}}: removed hardware vector table since they're constant at runtime.)
Line 11:
 
=={{header|6502 Assembly}}==
The first 256 bytes of the CPU's address space are collectively known as "zero page RAM" and are common to all 6502 computers (except the custom 6502-based Hu6280 used in the PC Engine/TurboGrafx16.) This section of RAM is faster to load from, as the instructions that use it only take one byte to represent the memory address rather than two. On some implementations, certain zero-page RAM addresses are special, such as address $00 on Commodore 64 (which supposedly controls bankthe memory management switchingunit) and address $FF on Easy6502 (which contains the last keyboard input). In addition to loading faster, only the zero page can used indexed indirect addressing modes (the only exception being <code>JMP</code>, which CANNOT jump indirectly using zero page unless you pad it with a high byte of 00.)
 
The 16-bit 65816 and the Motorola 6809 (which are very similar to the 6502) call the zero page the "direct page" because it can be relocated on those systems. They have a dedicated register which tells the CPU where the direct page actually is. Like on the 6502, it's only 256 bytes in size. This allows the programmer to improve their program's performance by moving the direct page to wherever the majority of the loading will be taking place. Your code may cause problems if you load from the "wrong" direct page, however, so be careful!
1,489

edits