Prev: AF36 Up: Map Next: B00B
AFDA: Routine at AFDA
Used by the routines at Game_Over, Print_HighScore, Start_1UP_Game and AF36.
Populate_Score_Buffer AFDA LD DE,$B024 Point to Score_Buffer.
Score_Buffer_Loop AFDD LD A,(HL) Stores the contents of HL in the accumulator.
AFDE RRCA Move bits 4 and 5 into bits 0 and 1.
AFDF RRCA
AFE0 RRCA
AFE1 RRCA
AFE2 CALL Convert_ASCII Call Convert_ASCII.
AFE5 LD A,(HL) Stores the contents of HL in the accumulator.
AFE6 CALL Convert_ASCII Call Convert_ASCII.
AFE9 DEC HL Decrease HL by one.
AFEA DJNZ Score_Buffer_Loop Decrease counter by one and loop back to Score_Buffer_Loop until counter is zero.
AFEC RET Return.
Writes "00" to the end of the score.
Write_00 AFED LD A,$30 A="0" (ASCII zero for display).
AFEF LD (DE),A Write "0" to DE, increment DE by 1, write "0" to DE, increment DE by 1.
AFF0 INC DE
AFF1 LD (DE),A
AFF2 INC DE
This entry point is used by the routines at Game_Over and Start_1UP_Game.
Zero_To_Space AFF3 XOR A Writes 00 to DE (used as a terminator).
AFF4 LD (DE),A
AFF5 LD HL,$B024 Point to Score_Buffer.
AFF8 LD B,$07 Set a counter of 07.
Zero AFFA LD A,(HL) Fetch the score character.
AFFB CP $30 If it is not ASCII "0" then return.
AFFD RET NZ
AFFE LD (HL),$20 Overwrite the character with 20 (ASCII space for display).
B000 INC HL Move onto next character.
Zero_Loop B001 DJNZ Zero Decrease counter by one and loop back to Zero until counter is zero.
B003 RET Return.
Convert a single number into ASCII ready for printing to the screen.
Convert_ASCII B004 AND $0F Store the ASCII representation of the number at DE (it adds ASCII "0") so for example 1 ends up being 1 + 30 = 31 (e.g. "1" in ASCII).
B006 ADD A,$30
B008 LD (DE),A
B009 INC DE Then increase DE by one for the next digit.
B00A RET Return.
Prev: AF36 Up: Map Next: B00B