Prev: E0DD Up: Map Next: E0EE
E0E5: 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 FF if the number is negative.
SignExtendA E0E5 LD L,A Make the number the low byte.
E0E6 XOR A Start with a high byte of zero.
E0E7 BIT 7,L Jump to SignExtendA_Set if the number is not negative.
E0E9 JR Z,SignExtendA_Set
E0EB CPL Use FF for the high byte if the number is negative.
SignExtendA_Set E0EC LD H,A Set the high byte.
E0ED RET Return.
View the equivalent code in;
Prev: E0DD Up: Map Next: E0EE