| Routines

27497: Print the score, lines total or hi-score (2)

Continues from the routine at 29613. Prepares the buffer at 58123 with the graphic data for the digits whose character codes are stored at 58112, then copies the graphic data to the screen at the location specified by DE.
Input
DE | Display file address
27497 | PUSH DE | Save the display file address
27498 | LD HL,58143 | Clear the 21-byte buffer at 58123, which will hold the graphic data for the number to be printed (21 bytes = 7 pixel rows, 3 bytes per row)
27501 | LD B,21
27503 | LD (HL),0
27505 | DEC L
27506 | DJNZ 27503
27508 | LD L,B | HL=58112 (where the ASCII codes of the digits are stored)
27509 | LD A,(HL) | Pick up the ASCII code of the next digit
27510 | AND A | Have we done all the digits?
27511 | JR Z,27552 | Jump if so
27513 | LD E,A | E=ASCII code for the digit (48-57)
27514 | LD D,215 | Point DE at the appropriate entry in the table of font character bitmap widths at 55072
27516 | INC HL | Point HL at the next digit and save this address for later
27517 | PUSH HL
27518 | LD A,(DE) | A=width of the font character bitmap (in pixels)
27519 | LD C,A | Copy this to C
27520 | INC D | Point DE at the next bitmap pixel column
27521 | LD A,(DE) | A=next pixel column of bitmap data for this digit
27522 | LD L,31 | Point HL at the last byte of the graphic data buffer
27524 | LD B,7 | There are 7 rows of pixels in the buffer
27526 | RRCA | Skip the bottom row of pixels in the bitmap data
27527 | RRCA | Roll a pixel column into the buffer
27528 | RL (HL)
27530 | DEC HL
27531 | RL (HL)
27533 | DEC HL
27534 | RL (HL)
27536 | DEC HL
27537 | DJNZ 27527
27539 | DEC C | Next pixel column
27540 | JP M,27548 | Jump if we've done them all (plus a blank column)
27543 | JR NZ,27520 | Jump back until all the pixel columns of the bitmap for the digit have been done
27545 | XOR A | Then jump back to add a blank pixel column
27546 | JR 27522
27548 | POP HL | HL=address of the next digit
27549 | NOP |
27550 | JR 27509 | Jump back to deal with this digit
The graphic data for the digits has been rolled into the buffer at 58123. Now we copy the buffer to the screen.
27552 | LD L,11 | HL=58123 (start address of the buffer)
27554 | LD BC,2047 | B=7 (number of pixel rows), C=255
27557 | POP DE | DE=appropriate display file address
27558 | LD A,E |
27559 | LDI | Copy three bytes (one pixel row) from the buffer to the screen
27561 | LDI
27563 | LDI
27565 | LD E,A | Point DE at the start of the next row down
27566 | INC D
27567 | DJNZ 27559 | Jump back until all 7 pixel rows are done
27569 | RET |