Prev: D002 Up: Map Next: D023
D01B: Negate HL
Used by the routines at HandlePointer and CheckOverlap.
Makes HL negative.
Input
HL The word
Output
HL The negative of the word
Invert both bytes, then add one.
NegateHL D01B LD A,L Invert the low byte.
D01C CPL
D01D LD L,A
D01E LD A,H Invert the high byte.
D01F CPL
D020 LD H,A
D021 INC HL Add one.
D022 RET Return.
View the equivalent code in;
Prev: D002 Up: Map Next: D023