| Routines

6AE4: Copy a graphic buffer to the screen

Used by the routines at 6B46 (to print a message box above a character's head, or to print the lesson), 7414 (to restore the area of the screen overwritten by a message box) and F5BE (to print the Back to Skool logo and the Score/Lines/Hi-Sc box).
Input
DE | Attribute file address
HL | Graphic buffer address
6AE4 | PUSH DE | Save the attribute file address temporarily
6AE5 | LD A,$03 | There are 3 rows of character squares
6AE7 | LD BC,$0008 | There are 8 character squares in each row
6AEA | LDIR | Copy one row of attribute bytes to the screen
6AEC | LD C,$18 | Point DE at the start of the next row down
6AEE | EX DE,HL
6AEF | ADD HL,BC
6AF0 | EX DE,HL
6AF1 | DEC A |
6AF2 | JR NZ,$6AE7 | Jump back to copy the remaining attributes to the screen
The attribute bytes have been copied to the screen. Now for the graphic bytes.
6AF4 | POP DE | Restore the attribute file address to DE
6AF5 | LD A,D | Set DE to the appropriate display file address
6AF6 | SUB $50
6AF8 | ADD A,A
6AF9 | ADD A,A
6AFA | ADD A,A
6AFB | LD D,A
6AFC | LD C,$03 | There are 3 rows of character squares
6AFE | LD A,$08 | There are 8 rows of pixels per character square
6B00 | PUSH BC | Save the character square row counter
6B01 | PUSH DE |
6B02 | LD C,$08 | There are 8 bytes in each row of pixels
6B04 | LDIR | Copy one row of pixels to the screen
6B06 | POP DE |
6B07 | INC D | Point to the display file address of the next pixel row
6B08 | DEC A |
6B09 | JR NZ,$6B01 | Jump back to fill in the remaining pixel rows for this row of character squares
6B0B | LD A,E | Set DE to the start address of the first pixel row in the next row of character squares
6B0C | ADD A,$20
6B0E | LD E,A
6B0F | JR C,$6B15
6B11 | LD A,D
6B12 | SUB $08
6B14 | LD D,A
6B15 | POP BC | Restore the character square row counter to C
6B16 | DEC C |
6B17 | JR NZ,$6AFE | Jump back to fill in the remaining rows of character squares
6B19 | RET |