![]() |
Routines |
DE | lines, score or high score |
HL | display file address |
30278 | PUSH HL | Save the display file address |
30279 | LD HL,55583 | Blank out the 32-byte buffer at 55552-55583 |
30282 | XOR A | |
30283 | LD B,31 | |
30285 | LD (HL),A | |
30286 | DEC L | |
30287 | DJNZ 30285 | |
30289 | LD A,48 | 48 is the ASCII code for '0' |
30291 | LD BC,55536 | BC=-10000 |
30294 | EX DE,HL | HL=the number, DE=55552 |
30295 | ADD HL,BC | Subtract 10000 |
30296 | JR C,30325 | Jump if the number is < 10000 |
30298 | SBC HL,BC | Add the 10000 back on |
30300 | LD BC,64536 | BC=-1000 |
30303 | ADD HL,BC | Subtract 1000 |
30304 | JR C,30338 | Jump if the number is < 1000 |
30306 | SBC HL,BC | Add the 1000 back on |
30308 | LD BC,65436 | BC=-100 |
30311 | ADD HL,BC | Subtract 100 |
30312 | JR C,30351 | Jump if the number is < 100 |
30314 | SBC HL,BC | Add the 100 back on |
30316 | LD C,246 | BC=-10 |
30318 | ADD HL,BC | Subtract 10 |
30319 | JR C,30363 | Jump if the number is < 10 |
30321 | SBC HL,BC | Add the 10 back on |
30323 | JR 30371 |
30325 | INC A | Perform trial subtractions of 10000 and get the ASCII code for the 10000s digit in A |
30326 | ADD HL,BC | |
30327 | JR C,30325 | |
30329 | SBC HL,BC | Undo the last trial subtraction |
30331 | LD BC,64536 | BC=-1000 |
30334 | LD (DE),A | Store the ASCII code for the 10000s digit |
30335 | LD A,47 | |
30337 | INC E | Move along in the buffer |
30338 | INC A | Perform trial subtractions of 1000 and get the ASCII code for the 1000s digit in A |
30339 | ADD HL,BC | |
30340 | JR C,30338 | |
30342 | SBC HL,BC | Undo the last trial subtraction |
30344 | LD BC,65436 | BC=-100 |
30347 | LD (DE),A | Store the ASCII code for the 1000s digit |
30348 | LD A,47 | |
30350 | INC E | Move along in the buffer |
30351 | INC A | Perform trial subtractions of 100 and get the ASCII code for the 100s digit in A |
30352 | ADD HL,BC | |
30353 | JR C,30351 | |
30355 | SBC HL,BC | Undo the last trial subtraction |
30357 | LD (DE),A | Store the ASCII code for the 100s digit |
30358 | INC E | Move along in the buffer |
30359 | LD C,246 | BC=-10 |
30361 | LD A,47 | |
30363 | INC A | Perform trial subtractions of 10 and get the ASCII code for the 10s digit in A |
30364 | ADD HL,BC | |
30365 | JR C,30363 | |
30367 | SBC HL,BC | Undo the last trial subtraction |
30369 | LD (DE),A | Store the ASCII code for the 10s digit |
30370 | INC E | Move along in the buffer |
30371 | LD A,L | Get the ASCII code for the units digit in A |
30372 | ADD A,48 | |
30374 | LD (DE),A | Store the ASCII code for the units digit |
30375 | XOR A | |
30376 | INC E | Move along in the buffer |
30377 | LD (DE),A | Mark the end of the number string with a 0 byte |
30378 | LD E,0 | DE=55552 (first character in the number string) |
30380 | LD A,(DE) | Pick up a character from the number string |
30381 | AND A | Have we reached the end of the string? |
30382 | JR NZ,30386 | Jump if not |
30384 | POP HL | Restore the display file address to HL |
30385 | RET | |
30386 | INC E | Move to the next character in the number string |
30387 | EXX | |
30388 | LD L,A | L'=ASCII code for a digit of the number (48-57) |
30389 | LD H,217 | Point HL' at the start of the font data for this digit |
30391 | LD B,(HL) | Pick up the pixel width in B' |
30392 | INC B | Add 1 for left padding |
30393 | XOR A | An empty byte for left padding |
30394 | INC H | Point HL' at the next bitmap byte |
30395 | EXX | |
30396 | CALL 30258 | Slide the bitmap byte into the buffer |
30399 | EXX | |
30400 | LD A,(HL) | Pick up the next bitmap byte |
30401 | DJNZ 30394 | Jump back until all bitmap bytes are done |
30403 | EXX | |
30404 | JR 30380 | Jump back to collect the next digit |