Prev: 53275 Up: Map Next: 53292
53283: Sign Extend A To HL
Used by the routine at MoveObject.
Makes a signed number into a signed word.
Input
A The number
Output
HL The word
Put the number in the low byte. The high byte is zero, or 255 if the number is negative.
SignExtendAToHL 53283 LD L,A Make the number the low byte.
53284 XOR A Start with a high byte of zero.
53285 BIT 7,L Jump to SignExtendAToHL_Set if the number is not negative.
53287 JR Z,SignExtendAToHL_Set
53289 CPL Make the high byte 255.
SignExtendAToHL_Set 53290 LD H,A Set the high byte.
53291 RET Return.
View the equivalent code in;
Prev: 53275 Up: Map Next: 53292