Search code examples
assemblyz80

Whatis the difference in this case between doing dw and db?


value db 0h, 10h

value dw 10h

Are they the same? What is the difference?

If I used, for example,

ld A, (value)

What would happen in both cases?


Solution

  • value db 0h, 10h
    

    the machine code produced is (hexa bytes): 00 10

    value dw 10h
    

    the machine code produced is (hexa bytes): 10 00 (because Z80 is little-endian CPU)

    ld A, (value) will load A with value: in first case 0, and second 16.