Search code examples
assemblyendiannessmachine-codez80

Load to 16bit register, least significant bit in first or second register?


I am programming in Z80 assembly; I'm confused about endianness.

Regarding the following instruction:

LD HL,d16

Will the bytes 21 FF DF result in H = FF and L = DF or H = DF and L = FF?


Solution

  • Z80 datasheet, p.54 (page #74 in the PDF):

    In all extended immediate or extended addressing modes, the low order byte always appears first after the Op Code.

    So when the instruction opcode is 21 FF DF, LSB = FF.