Prev: DC4C Up: Map Next: DC77
DC53: Draw/erase graphics - re-calculate screen display address 1 pixel line down
Used by the routine at DC41.
Input
HL Screen display address +1 for the byte that has just been drawn or erased
After drawing (DC4C) or erasing (DC41) the screen graphic byte, this routine calculates the next screen address (1 pixel line lower) before continuing to draw/erase the graphic bytes of the tile
DC53 DEC HL Move back left one character square
DC54 EX DE,HL
DC55 POP HL HL now back to the graphic address pointer
This entry point is used by the routine at DBF5.
DC56 LD A,D Get high byte of screen address
DC57 INC A ...and increment (move down 1 pixel row)
DC58 AND $07 Are we crossing into a new character row (8th pixel row)?
DC5A JR Z,$DC5F
DC5C INC D If not, increment screen display address pointer (move down 1 pixel row)
DC5D JR $DC6D
DC5F LD A,D Otherwise, adjust high byte to the correct screen address
DC60 AND $F8 Reset the low 3 bits (pixel row number) to zero
DC62 LD D,A
DC63 LD A,E Get the low byte of the screen address
DC64 ADD A,$20 Increment column by 32 to move down to next screen row
DC66 LD E,A
DC67 JR NC,$DC6D Crossing a 1/3 screen boundary? ...If not, skip next 3 instructions
DC69 LD A,D ...If so, adjust high byte of screen address accordingly
DC6A ADD A,$08
DC6C LD D,A Store correct screen address high byte back in D register
Check if encroaching out of bounds into bottom third of screen, where the scroll status panel is:
DC6D LD A,D
DC6E CP $50 Are we into the last 3rd of the screen (encroaching onto )
DC70 DEC C (Decrement number of tile bytes to print at this point)
DC71 JR NC,$DC7A Jump to DC7A if into last 3rd of screen (out of bounds)
DC73 JR NZ,$DC23 Bytes left to draw in the tile - continue to draw next tile byte
DC75 JR $DC7E
Prev: DC4C Up: Map Next: DC77