Prev: 38356 Up: Map Next: 38486
38417: Blank an area of the display file
We write zeroes to the display file in order to blank out a region, for example the interior of a window. The top-left and bottom-right coordinates of the area to be blanked by this routine are stored at 23493 - 23496).
Used by the routine at 36987.
38417 LD BC,(23493) Load B with y-coordinate of top edge and C with x-coordinate of left edge
38421 LD HL,(36488) Load HL with current virtual text cursor location...
38424 PUSH HL ...and store on the stack
38425 CALL 36551 Set virtual cursor location (bitmap area)
38428 LD A,(23495) Load A with x-coordinate of right-edge
38431 SUB C Subtract x-coordinate of left-edge...
38432 INC A ...and add one to obtain width
38433 LD D,A Store width in D
38434 LD A,(23496) Load A with y-coordinate of bottom
38437 SUB B Subtract y-coordinate of top-edge...
38438 INC A ...and add one to obtain height
38439 LD E,A Store height in E
38440 PUSH DE Copy width and height...
38441 POP BC ...into BC
38442 PUSH HL Store (initial) HL on stack
38443 LD A,B Copy width into A
38444 EX AF,AF' Exchange AF register (preserve width)
38445 PUSH BC Store width and height on stack
38446 PUSH HL Store (current) HL on stack
38447 XOR A Set A to zero
38448 LD B,8 Set B to 8
38450 LD (HL),A Write zero to current display file address
38451 INC H Move down one pixel row (by adding 256 bytes to current display file address)
38452 DJNZ 38450 Repeat for other 7 pixel rows
38454 POP HL Recover previous (current) value of HL (start of previous character block)...
38455 INC HL ...and increase to obtain next block
38456 POP BC Restore width and height...
38457 DJNZ 38445 ...reduce width by one and loop back to clear next block (until remaining width = 0)
38459 POP HL Recover (initial) value of HL
38460 DEC C Reduce remaining height by one...
38461 JR Z,38481 ...and if it is now zero, then exit loop...
38463 LD A,32 ...else...
38465 ADD A,L ...add 32 (screen width) to current display file pointer to move down to next character row...
38466 LD L,A ...
Here we check whether moving down a character row is valid, i.e. that we're not moving down one row from the bottom row of one of the three thirds of the bitmap area, which would actually wrap back up to the second pixel row of the top character row of the current third.
38467 JP NC,38474 If moving down a character row is valid then skip ahead to 38474
38470 LD A,8 We need to move down from the bottom character row of one third of the screen to the top character row of the third below so...
38472 ADD A,H ...increase HL accordingly...
38473 LD H,A ...
38474 EX AF,AF' Swap AF register
38475 LD B,A Recover width (stored earlier, at instr. 38444) into B
38476 EX AF,AF' Preserve width again
38477 PUSH HL Store current display file address on stack...
38478 JP 38445 ...and loop back to 38445 to write another row of zeroes
38481 POP HL Restore virtual bitmap cursor location...
38482 LD (36488),HL ...and store
38485 RET Return
Prev: 38356 Up: Map Next: 38486