Prev: 35121 Up: Map Next: 35151
35143: Negate HL
Makes HL negative.
Input
HL The word
Output
HL The negative of the word
Invert both bytes, then add one.
NegateHL 35143 LD A,L Invert the low byte.
35144 CPL
35145 LD L,A
35146 LD A,H Invert the high byte.
35147 CPL
35148 LD H,A
35149 INC HL Add one.
35150 RET Return.
View the equivalent code in;
Prev: 35121 Up: Map Next: 35151