Prev: 64367 Up: Map Next: 64548
64456: Scroll a region of the display file down a pixel row
Used by the routine at 64361.
Input
HL Address to jump to at the end of this routine (instruction at 64545)
64456 LD (64546),HL Modify jump (at 64546) destination to address stored in HL
64459 LD A,(23407) Load y-coordinate of bottom of region to scroll (pixels) into A and C...
64462 LD C,A ...
64463 LD DE,65140 Point DE at table of display file addresses of start of each pixel row
64466 LD H,0 Load HL with double y-coordinate of bottom of region to scroll...
64468 LD L,A ...(as entries in table at 26240 are two bytes wide)...
64469 ADD HL,HL ...
64470 ADD HL,DE ...and add to DE as offset in HL
64471 LD E,(HL) Load display file address of pixel row of interest into DE...
64472 INC HL ...
64473 LD D,(HL) ...
64474 EX DE,HL Swap HL (now display file address of start of A-th pixel row) and DE (now points to entry in table at 65140)
64475 LD A,(23406) Load y-coordinate of top of region to scroll (pixels) into B...
64478 LD B,A ...
64479 LD A,C Load y-coordinate of bottom of region to scroll into A...
64480 SUB B ...and subtract B to get height of region to scroll (pixels)
64481 EX AF,AF' Swap AF and AF' (A' now holds height of region to scroll in pixels)
64482 LD A,(23404) Load C with x-coordinate of left edge of region to scroll (characters)...
64485 LD C,A ...
64486 LD A,L Add this x-coordinate value as offset (via OR) to HL...
64487 OR C ...
64488 LD L,A ...
64489 LD A,(23405) Load A with x-coordinate of right edge of region to scroll (characters)
64492 SUB C Subtract C...
64493 INC A ...and add one to get width (characters) of region to scroll
64494 LD B,0 Load BC with width of region to scroll (characters)...
64496 LD C,A ...
64497 PUSH BC Store BC (width of region to scroll in characters)
64498 PUSH HL Store HL (current position in display file, at left edge of bottom pixel row in region to scroll)
64499 LD DE,23296 Point DE at 23296
64502 LDIR Copy BC bytes of data from HL to DE
64504 POP HL Restore HL (current position in display file, at left edge of bottom pixel row in region to scroll)
64505 POP BC Restore BC (width of region to scroll in characters)
64506 EXX Swap all registers (B' = width of region to scroll in characters)
64507 EX AF,AF' Swap AF and AF' (A now holds height of region to scroll in pixels)
64508 JP Z,64544 If height of region to scroll in pixels is zero then skip ahead to 64544
64511 LD B,A Load B with height of region to scroll in pixels
64512 EXX Swap all registers (B = width of region to scroll, B' = remaining number of pixel rows to scroll)
64513 LD A,H Load D and A with H minus 1 and E with L...
64514 DEC A ...
64515 LD E,L ...
64516 LD D,A ...
64517 CPL Invert all bits in A
64518 AND 7 If any of three least significant bits in A are set (i.e. at least one of the three least significant bits in H were also set) then skip ahead to 64534
64520 JP NZ,64534
At least one of the three least significant bits of H are set, meaning we could be at the top of a third of the display
64523 LD A,E Move DE back by 32 bytes to move up one character row (eight rows of pixels)...
64524 SUB 32 ...
64526 LD E,A ...
64527 JP C,64534 If E hasn't gone under zero (i.e. we haven't moved 32 bytes back from the top character row of a third) then skip ahead to 64534 else move down by a third
64530 LD A,D
64531 ADD A,8
64533 LD D,A
64534 EX DE,HL Swap DE (now points to start of lower pixel row) and HL (now points to start of upper pixel row)
64535 PUSH HL Store HL (pointer to upper pixel row)
64536 PUSH BC Store BC (B = width of region to scroll, in characters)
64537 LDIR Copy row of bitmap data down a row from HL to DE
64539 POP BC Restore BC (B = width of region to scroll, in characters)
64540 POP HL Store HL (pointer to upper pixel row)
64541 EXX Swap all registers (B = remaining number of pixel rows to scroll, B' = width of region to scroll)
64542 DJNZ 64512 Loop back to 64512 to copy next row of pixels down
64544 EXX Swap all registers
The operand of the instruction at 64545 is the address to jump to upon completion of this routine. This is modified by the instruction at 64456, set to the value in HL at the start of this routine. The only value this is set to is 64360 (return).
64545 JP 64360 Jump to address that was in HL at start of this routine
Prev: 64367 Up: Map Next: 64548