Prev: 55470 Up: Map Next: 55651
55559: Scroll a region of the display file down a pixel row
Used by the routines at 55436 and 55442.
Input
HL Address to jump to at the end of this routine (instruction at 55648)
55559 LD (55649),HL Modify jump (at 55649) destination to address stored in HL
55562 LD A,(23492) Load y-coordinate of bottom of region to scroll (pixels) into A and C...
55565 LD C,A ...
55566 LD DE,26240 Point DE at table of display file addresses of start of each pixel row
55569 LD H,0 Load HL with double y-coordinate of bottom of region to scroll...
55571 LD L,A ...(as entries in table at 26240 are two bytes wide)...
55572 ADD HL,HL ...
55573 ADD HL,DE ...and add to DE as offset in HL
55574 LD E,(HL) Load display file address of pixel row of interest into DE...
55575 INC HL ...
55576 LD D,(HL) ...
55577 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 26240)
55578 LD A,(23491) Load y-coordinate of top of region to scroll (pixels) into B...
55581 LD B,A ...
55582 LD A,C Load y-coordinate of bottom of region to scroll into A...
55583 SUB B ...and subtract B to get height of region to scroll (pixels)
55584 EX AF,AF' Swap AF and AF' (A' now holds height of region to scroll in pixels)
55585 LD A,(23489) Load C with x-coordinate of left edge of region to scroll (characters)...
55588 LD C,A ...
55589 LD A,L Add this x-coordinate value as offset (via OR) to HL...
55590 OR C ...
55591 LD L,A ...
55592 LD A,(23490) Load A with x-coordinate of right edge of region to scroll (characters)
55595 SUB C Subtract C...
55596 INC A ...and add one to get width (characters) of region to scroll
55597 LD B,0 Load BC with width of region to scroll (characters)...
55599 LD C,A ...
55600 PUSH BC Store BC (width of region to scroll in characters)
55601 PUSH HL Store HL (current position in display file, at left edge of bottom pixel row in region to scroll)
55602 LD DE,23296 Point DE at 23296
55605 LDIR Copy BC bytes of data from HL to DE
55607 POP HL Restore HL (current position in display file, at left edge of bottom pixel row in region to scroll)
55608 POP BC Restore BC (width of region to scroll in characters)
55609 EXX Swap all registers (B' = width of region to scroll in characters)
55610 EX AF,AF' Swap AF and AF' (A now holds height of region to scroll in pixels)
55611 JP Z,55647 If height of region to scroll in pixels is zero then skip ahead to 55647
55614 LD B,A Load B with height of region to scroll in pixels
55615 EXX Swap all registers (B = width of region to scroll, B' = remaining number of pixel rows to scroll)
55616 LD A,H Load D and A with H minus 1 and E with L...
55617 DEC A ...
55618 LD E,L ...
55619 LD D,A ...
55620 CPL Invert all bits in A
55621 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 55637
55623 JP NZ,55637
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
55626 LD A,E Move DE back by 32 bytes to move up one character row (eight rows of pixels)...
55627 SUB 32 ...
55629 LD E,A ...
55630 JP C,55637 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 55637 else move down by a third
55633 LD A,D
55634 ADD A,8
55636 LD D,A
55637 EX DE,HL Swap DE (now points to start of lower pixel row) and HL (now points to start of upper pixel row)
55638 PUSH HL Store HL (pointer to upper pixel row)
55639 PUSH BC Store BC (B = width of region to scroll, in characters)
55640 LDIR Copy row of bitmap data down a row from HL to DE
55642 POP BC Restore BC (B = width of region to scroll, in characters)
55643 POP HL Store HL (pointer to upper pixel row)
55644 EXX Swap all registers (B = remaining number of pixel rows to scroll, B' = width of region to scroll)
55645 DJNZ 55615 Loop back to 55615 to copy next row of pixels down
55647 EXX Swap all registers
The operand of the instruction at 55648 is the address to jump to upon completion of this routine. This is modified by the instruction at 55559, set to the value in HL at the start of this routine. The possible values are 55407 (return) or 55448 (restore copied bitmap data from bottom to top of region to scroll, then return).
55648 JP 55407 Jump to address that was in HL at start of this routine
Prev: 55470 Up: Map Next: 55651