Prev: 64361 Up: Map Next: 64456
64367: Scroll a region of the display file up a pixel row
Used by the routine at 64354.
Input
HL Address to jump to at the end of this routine (instruction at 64453)
64367 LD (64454),HL Modify jump (at 64453) destination to address stored in HL
64370 LD A,(23406) Load y-coordinate of top of region to scroll (pixels) into C...
64373 LD C,A ...
64374 LD DE,65140 Point DE at table of display file addresses of start of each pixel row
64377 LD H,0 Load HL with double y-coordinate of top of region to scroll...
64379 LD L,A ...(as entries in table at 26240 are two bytes wide)...
64380 ADD HL,HL ...
64381 ADD HL,DE ...and add to DE as offset in HL
64382 LD E,(HL) Load display file address of pixel row of interest into DE...
64383 INC HL ...
64384 LD D,(HL) ...
64385 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)
64386 LD A,(23407) Load y-coordinate of bottom of region to scroll (pixels) into A...
64389 SUB C ...and subtract C to get height of region to scroll (pixels)
64390 EX AF,AF' Swap AF and AF' (A' now holds height of region to scroll in pixels)
64391 LD A,(23404) Load C with x-coordinate of left edge of region to scroll (characters)...
64394 LD C,A ...
64395 LD A,L Add this x-coordinate value as offset (via OR) to HL...
64396 OR C ...
64397 LD L,A ...
64398 LD A,(23405) Load A with x-coordinate of right edge of region to scroll (characters)
64401 SUB C Subtract C...
64402 INC A ...and add one to get width (characters) of region to scroll
64403 LD B,0 Load BC with width of region to scroll (characters)...
64405 LD C,A ...
64406 PUSH BC Store BC (width of region to scroll in characters)
64407 PUSH HL Store HL (current position in display file, at left edge of top pixel row in region to scroll)
64408 LD DE,23296 Point DE at 23296
64411 LDIR Copy BC bytes of data from HL to DE
64413 POP HL Restore HL (current position in display file, at left edge of top pixel row in region to scroll)
64414 POP BC Restore BC (width of region to scroll in characters)
64415 EXX Swap all registers (B' = width of region to scroll in characters)
64416 EX AF,AF' Swap AF and AF' (A now holds height of region to scroll in pixels)
64417 JP Z,64452 If height of region to scroll in pixels is zero then skip ahead to 64452
64420 LD B,A Load B with height of region to scroll in pixels
64421 EXX Swap all registers (B = width of region to scroll, B' = remaining number of pixel rows to scroll)
64422 LD A,H Load D and A with H plus 1 and E with L...
64423 INC A ...
64424 LD D,A ...
64425 LD E,L ...
64426 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 64442
64428 JP NZ,64442
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
64431 LD A,E Move DE on by 32 bytes to move up one character row (eight rows of pixels)...
64432 ADD A,32 ...
64434 LD E,A ...
64435 JP C,64442 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 64442 else move up by a third
64438 LD A,D
64439 SUB 8
64441 LD D,A
64442 EX DE,HL Swap DE (now points to start of upper pixel row) and HL (now points to start of lower pixel row)
64443 PUSH HL Store HL (pointer to lower pixel row)
64444 PUSH BC Store BC (B = width of region to scroll, in characters)
64445 LDIR Copy row of bitmap data up a row from HL to DE
64447 POP BC Restore BC (B = width of region to scroll, in characters)
64448 POP HL Store HL (pointer to upper pixel row)
64449 EXX Swap all registers (B = remaining number of pixel rows to scroll, B' = width of region to scroll)
64450 DJNZ 64421 Loop back to 64421 to copy next row of pixels up
64452 EXX Swap all registers
The operand of the instruction at 64453 is the address to jump to upon completion of this routine. This is modified by the instruction at 64367, set to the value in HL at the start of this routine. The only value this is set to is 64360 (return).
64453 JP 64360 Jump to address that was in HL at start of this routine
Prev: 64361 Up: Map Next: 64456