Prev: 8931 Up: Map Next: 894F
8947: Negate HL
Makes HL negative.
Input
HL The word
Output
HL The negative of the word
Invert both bytes, then add one.
NegateHL 8947 LD A,L Invert the low byte.
8948 CPL
8949 LD L,A
894A LD A,H Invert the high byte.
894B CPL
894C LD H,A
894D INC HL Add one.
894E RET Return.
View the equivalent code in;
Prev: 8931 Up: Map Next: 894F