Prev: 44854 Up: Map Next: 45067
45018: Routine at AFDA
Used by the routines at Game_Over, Print_HighScore, Start_1UP_Game and 44854.
Populate_Score_Buffer 45018 LD DE,45092 Point to Score_Buffer.
Score_Buffer_Loop 45021 LD A,(HL) Stores the contents of HL in the accumulator.
45022 RRCA Move bits 4 and 5 into bits 0 and 1.
45023 RRCA
45024 RRCA
45025 RRCA
45026 CALL Convert_ASCII Call Convert_ASCII.
45029 LD A,(HL) Stores the contents of HL in the accumulator.
45030 CALL Convert_ASCII Call Convert_ASCII.
45033 DEC HL Decrease HL by one.
45034 DJNZ Score_Buffer_Loop Decrease counter by one and loop back to Score_Buffer_Loop until counter is zero.
45036 RET Return.
Writes "00" to the end of the score.
Write_00 45037 LD A,48 A="0" (ASCII zero for display).
45039 LD (DE),A Write "0" to DE, increment DE by 1, write "0" to DE, increment DE by 1.
45040 INC DE
45041 LD (DE),A
45042 INC DE
This entry point is used by the routines at Game_Over and Start_1UP_Game.
Zero_To_Space 45043 XOR A Writes 0 to DE (used as a terminator).
45044 LD (DE),A
45045 LD HL,45092 Point to Score_Buffer.
45048 LD B,7 Set a counter of 7.
Zero 45050 LD A,(HL) Fetch the score character.
45051 CP 48 If it is not ASCII "0" then return.
45053 RET NZ
45054 LD (HL),32 Overwrite the character with 32 (ASCII space for display).
45056 INC HL Move onto next character.
Zero_Loop 45057 DJNZ Zero Decrease counter by one and loop back to Zero until counter is zero.
45059 RET Return.
Convert a single number into ASCII ready for printing to the screen.
Convert_ASCII 45060 AND 15 Store the ASCII representation of the number at DE (it adds ASCII "0") so for example 1 ends up being 1 + 48 = 49 (e.g. "1" in ASCII).
45062 ADD A,48
45064 LD (DE),A
45065 INC DE Then increase DE by one for the next digit.
45066 RET Return.
Prev: 44854 Up: Map Next: 45067