Prev: 7240 Up: Map Next: 7288
7282: Compare HL with DE
A 16-bit comparison: compares H with D and, if they are equal, L with E. Returns with Z set if HL=DE, and the carry flag set if HL is less than DE. A is corrupted.
Input
HL First number
DE Second number
Output
F Z set if equal, carry set if HL<DE
7282 LD A,H A = HL's high byte
7283 SUB D Subtract DE's high byte
7284 RET NZ Different: HL and DE are not equal (the carry flag also shows which is bigger)
7285 LD A,L Same high byte: now compare the low bytes
7286 SUB E
7287 RET
Prev: 7240 Up: Map Next: 7288