Routines |
Prev: 55455 | Up: Map | Next: 55559 |
|
||||||||
55470 | LD (55557),HL | Modify jump (at 55556) destination to address stored in HL | ||||||
55473 | LD A,(23491) | Load y-coordinate of top of region to scroll (pixels) into C... | ||||||
55476 | LD C,A | ... | ||||||
55477 | LD DE,26240 | Point DE at table of display file addresses of start of each pixel row | ||||||
55480 | LD H,0 | Load HL with double y-coordinate of top of region to scroll... | ||||||
55482 | LD L,A | ...(as entries in table at 26240 are two bytes wide)... | ||||||
55483 | ADD HL,HL | ... | ||||||
55484 | ADD HL,DE | ...and add to DE as offset in HL | ||||||
55485 | LD E,(HL) | Load display file address of pixel row of interest into DE... | ||||||
55486 | INC HL | ... | ||||||
55487 | LD D,(HL) | ... | ||||||
55488 | 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) | ||||||
55489 | LD A,(23492) | Load y-coordinate of bottom of region to scroll (pixels) into A... | ||||||
55492 | SUB C | ...and subtract C to get height of region to scroll (pixels) | ||||||
55493 | EX AF,AF' | Swap AF and AF' (A' now holds height of region to scroll in pixels) | ||||||
55494 | LD A,(23489) | Load C with x-coordinate of left edge of region to scroll (characters)... | ||||||
55497 | LD C,A | ... | ||||||
55498 | LD A,L | Add this x-coordinate value as offset (via OR) to HL... | ||||||
55499 | OR C | ... | ||||||
55500 | LD L,A | ... | ||||||
55501 | LD A,(23490) | Load A with x-coordinate of right edge of region to scroll (characters) | ||||||
55504 | SUB C | Subtract C... | ||||||
55505 | INC A | ...and add one to get width (characters) of region to scroll | ||||||
55506 | LD B,0 | Load BC with width of region to scroll (characters)... | ||||||
55508 | LD C,A | ... | ||||||
55509 | PUSH BC | Store BC (width of region to scroll in characters) | ||||||
55510 | PUSH HL | Store HL (current position in display file, at left edge of top pixel row in region to scroll) | ||||||
55511 | LD DE,23296 | Point DE at 23296 | ||||||
55514 | LDIR | Copy BC bytes of data from HL to DE | ||||||
55516 | POP HL | Restore HL (current position in display file, at left edge of top pixel row in region to scroll) | ||||||
55517 | POP BC | Restore BC (width of region to scroll in characters) | ||||||
55518 | EXX | Swap all registers (B' = width of region to scroll in characters) | ||||||
55519 | EX AF,AF' | Swap AF and AF' (A now holds height of region to scroll in pixels) | ||||||
55520 | JP Z,55555 | If height of region to scroll in pixels is zero then skip ahead to 55555 | ||||||
55523 | LD B,A | Load B with height of region to scroll in pixels | ||||||
55524 | EXX | Swap all registers (B = width of region to scroll, B' = remaining number of pixel rows to scroll) | ||||||
55525 | LD A,H | Load D and A with H plus 1 and E with L... | ||||||
55526 | INC A | ... | ||||||
55527 | LD D,A | ... | ||||||
55528 | LD E,L | ... | ||||||
55529 | 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 55545 | ||||||
55531 | JP NZ,55545 | |||||||
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
|
||||||||
55534 | LD A,E | Move DE on by 32 bytes to move up one character row (eight rows of pixels)... | ||||||
55535 | ADD A,32 | ... | ||||||
55537 | LD E,A | ... | ||||||
55538 | JP C,55545 | If L hasn't gone over 256 (i.e. we haven't moved 32 bytes on from the top pixel row of the bottom character row of a third) then skip ahead to 55545 else move up by a third | ||||||
55541 | LD A,D | |||||||
55542 | SUB 8 | |||||||
55544 | LD D,A | |||||||
55545 | EX DE,HL | Swap DE (now points to start of upper pixel row) and HL (now points to start of lower pixel row) | ||||||
55546 | PUSH HL | Store HL (pointer to lower pixel row) | ||||||
55547 | PUSH BC | Store BC (B = width of region to scroll, in characters) | ||||||
55548 | LDIR | Copy row of bitmap data up a row from HL to DE | ||||||
55550 | POP BC | Restore BC (B = width of region to scroll, in characters) | ||||||
55551 | POP HL | Store HL (pointer to upper pixel row) | ||||||
55552 | EXX | Swap all registers (B = remaining number of pixel rows to scroll, B' = width of region to scroll) | ||||||
55553 | DJNZ 55524 | Loop back to 55524 to copy next row of pixels up | ||||||
55555 | EXX | Swap all registers | ||||||
The operand of the instruction at 55556 is the address to jump to upon completion of this routine. This is modified by the instruction at 55470, set to the value in HL at the start of this routine. The possible values are 55407 (return) or 55414 (restore copied bitmap data from top to bottom of region to scroll, then return).
|
||||||||
55556 | JP 55407 | Jump to address that was in HL at start of this routine |
Prev: 55455 | Up: Map | Next: 55559 |