I am fairly new to the Z80 and machine code, so please don't assume I know anything.
Basically, what I want to know is this: If you load register H
with a value (I'll call it y
), will HL
then be 0xy0
? e.g. if H
was loaded with 0xAF
would HL
be 0xAF00
?
And would the same be true for loading L
with y
?
Thanks in advance.
The H and L 8-bit registers can be treated independently. Loading a value in H, will not affect the value in L, and vice versa. The two registers H and L can also be treated as a 16-bit register pair. The following source FIRST STEPS IN MACHINE CODE describes this.
two single register transfers, e.g.
LD H, B
LD L, C
to copy BC into HL.
and
You can, if you wish, load a register pair directly with a single instruction, rather than use two instructions. From last time, you will recall that the H and L, B and C, and D and E registers can be paired such that they effectively can hold any number between 0 and 65535 (00 to FFFF hex). C, E, and L form the low byte of the pair, while B, D, and H are the high bytes.