Prev: 33781 Up: Map Next: 33873
33838: Print: Percentage Digit
Used by the routine at GameOver_Start.
Turns one decimal digit of the score into ASCII, counting up from '0'.
Converts e.g. "0075" into "7.5" in ASCII for display purposes.
PercentageAscii 33838 LD A,47 Start the quotient digit one below '0'.
PercentageAscii_Loop 33840 INC A Count the digit up by one.
33841 AND A Clear carry for the subtraction.
33842 SBC HL,DE Subtract the power of ten in DE from HL.
33844 JR NC,PercentageAscii_Loop Jump back to PercentageAscii_Loop to count another digit unless the subtraction went below zero.
33846 ADD HL,DE Add the power of ten back to leave the remainder.
33847 CP 48 Compare against 48 (ASCII "0") to set flags for the return.
33849 RET Return.
Reached through the special-key table at 33393, dispatched from Command_MatchASpecialKey.
33850 LD A,4 Set the border to 4 (green).
33852 OUT (254),A
33854 CALL DebounceAnyKey Call DebounceAnyKey to debounce keyboard.
Wait_ForKey 33857 XOR A Read from the keyboard port.
33858 IN A,(254)
33860 AND %00011111 Keep bits 0-4, one for each key in the half-row. XOR A then IN A,(254) reads every half-row at once, and a pressed key reads as a reset bit.
33862 CP 31 Loop back to Wait_ForKey while a key is being pressed.
33864 JR NZ,Wait_ForKey
33866 LD A,7 Set the border to 7 (white).
33868 OUT (254),A
33870 JP CommandDispatchAControl Jump back to CommandDispatchAControl to dispatch a control.
Prev: 33781 Up: Map Next: 33873