Prev: 57540 Up: Map Next: 57573
57565: Negate HL
Used by the routines at CheckPlayerCollision and FindDirectionToPlayer.
Makes HL negative.
Input
HL The word
Output
HL The negative of the word
Invert both bytes, then add one.
NegateHL 57565 LD A,L Invert the low byte.
57566 CPL
57567 LD L,A
57568 LD A,H Invert the high byte.
57569 CPL
57570 LD H,A
57571 INC HL Add one.
57572 RET Return.
View the equivalent code in;
Prev: 57540 Up: Map Next: 57573