I'm trying to understand what each register in the z80 does and how it can be used.
I made the following table and wondered if anyone could point out any errors/or updates that could be made to it.
Code: Select all
Label Size (bit) Note
A 8 Accumulator. Used for all the calculations. (can be used with F)
F 8 Flags register. Used to determine if result is positive, negative or zero. (can be used with A)
B 8 Bit counter Used together as a 16bit counter
C 8 Used when you want to interface with hardware ports
D 8 Used together to hold the address of a memory destination
E 8
H 8 General 16 bit register used for most things. Usually holds the origin address.
L 8
I 8 Interrupt register. 0,1 or 2 (normally set to 1)
IX 16 Index register. Used similar to HL but slower Made up of IXH(High) and IXL(Low)
IY 16 Index register. Holds the location of the system flags. Made up of IYH(High) and IYL(Low)
SP 16 Stack Pointer.
PC 16 Program Counter. Points to the currently executed instruction.
R 8 Memory refresh. Best not to write to it. Can read from safely. Only goes up to 128
Shadow Registers A’, B’, C’, D’, E’, H’, L’ and F’ also exist. To change between AF and AF’ the EX AF,AF’ is used. To swap the other registers EXX is used.