Category:Z80 Assembly: Difference between revisions

Line 17:
* D and E can be used as the 16-bit pair DE, or separately. Together they often form the destination address for block transfer operations like <code>LDIR</code> (essentially the equivalent of memcpy in the C programming language.)
 
* H and L can be used as the 16-bit pair HL, or separately. Together they often form the source address for block transfer operations like <code>LDIR</code>. In addition, HL can do many things that the other register pairs cannot. The tricky part of the Z80 language is knowing what each register can and can't do.
 
The tricky part of the Z80 language is knowing what each register can and can't do.
 
*IX and IY are your index registers. They are slower to work with and not as easy to use as other commands, because of the way they work behind the scenes. (What actually happens is a prefix is applied to any instruction involving HL, and that prefix turns the instruction into one involving IX or IY instead.) The half-registers are IXH, IXL, IYH, and IYL. The Game Boy doesn't have these.
Line 23 ⟶ 25:
*I is the interrupt register, and R is the memory refresh register. They have their uses on occasion but are best left alone for the most part. The Game Boy doesn't even have them.
 
There is an alternative set of registers for AF, BC, DE and HL. These are accessed using the <code>EX AF, AF'</code> and <code>EXX</code> instructions.
 
==Flags==