Prev: 57565 Up: Map Next: 57582
57573: Sign Extend A
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.
SignExtendA 57573 LD L,A Make the number the low byte.
57574 XOR A Start with a high byte of zero.
57575 BIT 7,L Jump to SignExtendA_Set if the number is not negative.
57577 JR Z,SignExtendA_Set
57579 CPL Use 255 for the high byte if the number is negative.
SignExtendA_Set 57580 LD H,A Set the high byte.
57581 RET Return.
View the equivalent code in;
Prev: 57565 Up: Map Next: 57582