Prev: 56396 Up: Map Next: 56439
56403: Draw/erase graphics - re-calculate screen display address 1 pixel line down
Used by the routine at 56385.
Input
HL Screen display address +1 for the byte that has just been drawn or erased
After drawing (56396) or erasing (56385) 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
56403 DEC HL Move back left one character square
56404 EX DE,HL
56405 POP HL HL now back to the graphic address pointer
This entry point is used by the routine at 56309.
56406 LD A,D Get high byte of screen address
56407 INC A ...and increment (move down 1 pixel row)
56408 AND 7 Are we crossing into a new character row (8th pixel row)?
56410 JR Z,56415
56412 INC D If not, increment screen display address pointer (move down 1 pixel row)
56413 JR 56429
56415 LD A,D Otherwise, adjust high byte to the correct screen address
56416 AND 248 Reset the low 3 bits (pixel row number) to zero
56418 LD D,A
56419 LD A,E Get the low byte of the screen address
56420 ADD A,32 Increment column by 32 to move down to next screen row
56422 LD E,A
56423 JR NC,56429 Crossing a 1/3 screen boundary? ...If not, skip next 3 instructions
56425 LD A,D ...If so, adjust high byte of screen address accordingly
56426 ADD A,8
56428 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:
56429 LD A,D
56430 CP 80 Are we into the last 3rd of the screen (encroaching onto )
56432 DEC C (Decrement number of tile bytes to print at this point)
56433 JR NC,56442 Jump to 56442 if into last 3rd of screen (out of bounds)
56435 JR NZ,56355 Bytes left to draw in the tile - continue to draw next tile byte
56437 JR 56446
Prev: 56396 Up: Map Next: 56439