Prev: 27124 Up: Map Next: 27153
27134: Action: Subtract From Flag
Subtracts A from flag B, sticking at 0 instead of wrapping.
Input
A Amount
B Flag number
SubtractFromFlag 27134 CALL FlagAddress Call FlagAddress.
27137 LD (23444),A Write the amount to *SubtractScratch.
27140 LD A,(HL) Fetch the flag.
27141 PUSH HL Stash the flag pointer on the stack.
27142 LD HL,23444 Point HL at SubtractScratch.
27145 AND A Subtract the amount.
27146 SUB (HL)
27147 JR NC,SubtractFlag_Store The difference sticks at 0.
27149 XOR A
Store the difference.
SubtractFlag_Store 27150 POP HL Restore the flag pointer from the stack.
27151 LD (HL),A Store it.
27152 RET Return.
Prev: 27124 Up: Map Next: 27153