Prev: 33210 Up: Map Next: 33319
33267: Drawing routine (decorative border and intro sequence background)
Used by the routines at 31747 and 32549.
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 35759. Number of character rows at 35760.
33267 LD C,H Copy high byte of display address position to C register
33268 LD A,(35759) Copy counter for number of columns to draw into working buffer
33271 LD (35761),A
33274 LD H,C Get high byte of display address
Screen drawing loop for a row of graphics (1 character row, multiple columns):
33275 LD B,8 8 pixel rows to draw
33277 LD A,(DE) Get graphics byte
33278 LD (HL),A ...copy it to the screeen
33279 INC H Increment high byte of display address to move down one pixel
33280 INC DE Increment graphics address pointer ready for next graphics byte
33281 DJNZ 33277 Repeat for 8 pixel rows
33283 INC L Move right one character position on screen
33284 LD A,(35761) Retrieve, decrement and re-store the column counter
33287 DEC A
33288 LD (35761),A
33291 JR NZ,33274 Keep drawing until all columns are done
Calculate the screen display address for the next (character) row:
33293 LD A,(35759) Get the total number of columns drawn
33296 LD B,A Store in B register
33297 LD A,33 Subtract from 33 - this gives us the offset for the low byte screen display position for the next row down
33299 SUB B
33300 DEC L L was incremented earlier before the 'column finished check', so move it back to its previous position.
33301 ADD A,L ...and add it so it's in the correct column position to draw the next row.
33302 LD L,A
33303 JR NC,33309 Check to see if this has caused us to go past a 'third-of-screen' boundary
33305 LD A,C If so, modify the high byte of the stored screen address accordingly
33306 ADD A,8
33308 LD C,A
Continue to draw rows of graphics:
33309 LD A,(35760) Get the number of rows to draw
33312 DEC A Reduce by one
33313 LD (35760),A ...and re-store
33316 JR NZ,33268 All rows finished? If not, continue to draw the graphics.
33318 RET
Prev: 33210 Up: Map Next: 33319