Prev: 81BA Up: Map Next: 8227
81F3: Drawing routine (decorative border and intro sequence background)
Used by the routines at 7C03 and 7F25.
Input
HL Screen display address position to draw at
DE Start address for graphics to be drawn
Number of character columns to draw stored at 8BAF. Number of character rows at 8BB0.
81F3 LD C,H Copy high byte of display address position to C register
81F4 LD A,($8BAF) Copy counter for number of columns to draw into working buffer
81F7 LD ($8BB1),A
81FA LD H,C Get high byte of display address
Screen drawing loop for a row of graphics (1 character row, multiple columns):
81FB LD B,$08 8 pixel rows to draw
81FD LD A,(DE) Get graphics byte
81FE LD (HL),A ...copy it to the screeen
81FF INC H Increment high byte of display address to move down one pixel
8200 INC DE Increment graphics address pointer ready for next graphics byte
8201 DJNZ $81FD Repeat for 8 pixel rows
8203 INC L Move right one character position on screen
8204 LD A,($8BB1) Retrieve, decrement and re-store the column counter
8207 DEC A
8208 LD ($8BB1),A
820B JR NZ,$81FA Keep drawing until all columns are done
Calculate the screen display address for the next (character) row:
820D LD A,($8BAF) Get the total number of columns drawn
8210 LD B,A Store in B register
8211 LD A,$21 Subtract from 33 - this gives us the offset for the low byte screen display position for the next row down
8213 SUB B
8214 DEC L L was incremented earlier before the 'column finished check', so move it back to its previous position.
8215 ADD A,L ...and add it so it's in the correct column position to draw the next row.
8216 LD L,A
8217 JR NC,$821D Check to see if this has caused us to go past a 'third-of-screen' boundary
8219 LD A,C If so, modify the high byte of the stored screen address accordingly
821A ADD A,$08
821C LD C,A
Continue to draw rows of graphics:
821D LD A,($8BB0) Get the number of rows to draw
8220 DEC A Reduce by one
8221 LD ($8BB0),A ...and re-store
8224 JR NZ,$81F4 All rows finished? If not, continue to draw the graphics.
8226 RET
Prev: 81BA Up: Map Next: 8227