Prev: 81F3 Up: Map Next: 825F
8227: Drawing routine used for intro sequence graphics
Used by the routines at 7E21 and 7F25.
Input
HL Screen display address to draw at
8227 LD C,H Store screen display address high byte in C register
8228 LD A,($8BAF) Get number of columns to draw
822B LD ($8BB1),A Store as a counter
822E LD H,C Retrieve screen display address from C register
822F LD B,$08 8 pixel lines to draw
8231 LD DE,($7CC4) Retrieve address pointing to graphics to draw
Draw a series of character column graphics:
8235 LD A,(DE) ...get graphics byte
8236 LD (HL),A ...and copy it to the screen
8237 INC H Increment screen display position (move down one pixel line)
8238 INC DE ...and move to next graphic byte
8239 DJNZ $8235 Repeat until 8 pixel lines printed
823B INC L Move right 1 square on screen
823C LD A,($8BB1) Retrieve the graphic column counter
823F DEC A ...Decrement it...
8240 LD ($8BB1),A ...And re-store it...
8243 JR NZ,$822E Keep drawing until column counter = 0
Recalculate screen display address for next character row of graphics:
8245 LD A,($8BAF) Retrieve column counter
8248 LD B,A
8249 LD A,$21 Subtract from 33 to get next line offset position
824B SUB B
824C DEC L L was incremented before finishing earlier so move back a space
824D ADD A,L Add the offset so we're at the correct position for the next character row
824E LD L,A
824F JR NC,$8255 Check that we're not crossing a 1/3 screen boundary
8251 LD A,C Crossing a 1/3 screen boundary, so
8252 ADD A,$08 Amend the screen display address by adding 8
8254 LD C,A ...and store byte in C for retrieval later
Check if any more graphics need drawing:
8255 LD A,($8BB0) Retrieve row counter
8258 DEC A Decrement and re-store it
8259 LD ($8BB0),A
825C JR NZ,$8228 Continue drawing until counter = 0
825E RET
Prev: 81F3 Up: Map Next: 825F