| Routines

63512: Scroll the display file left or right one column

Used by the routine at 63561. Returns with the column of the play area that was at the far left of the screen before this routine was called in A.
Input
DE | 16384 or 16415
63512 | LD B,0 | BC will be used as the counter for the LDIR/LDDR instruction at 63526; initialise the MSB to 0
63514 | EXX |
63515 | LD C,21 | There are 21 rows to scroll (the bottom 3 rows of the screen are fixed)
63517 | LD B,8 | 8 pixel lines per row of the screen
63519 | EXX |
63520 | LD H,D | Copy the display file address from DE to HL
63521 | LD L,E
63522 | INC L | This instruction is set to INC L if we're scrolling to the left, or DEC L if we're scrolling to the right (see 63561)
63523 | LD A,E | Save the LSB of the display file address in A briefly
63524 | LD C,31 | 31 bytes to shift per pixel line
63526 | LDIR | This instruction is set to LDIR if we're shifting to the left, or LDDR if we're shifting to the right (see 63561)
63528 | LD E,A | Restore the LSB of the display file address to E
63529 | INC D | Point DE at the first (or last) byte of the next pixel line in this row
63530 | EXX |
63531 | DJNZ 63519 | Shift the remaining pixel lines in this row
63533 | EXX |
63534 | LD A,E | Set E to the LSB of the display file address for the first (or last) byte of the first pixel line in the next row down
63535 | ADD A,32
63537 | LD E,A
63538 | JR C,63544 | Jump if we just finished shifting the eighth or sixteenth row
63540 | LD A,D | Adjust D appropriately in the case where we haven't finished with the current 8-row third of the screen
63541 | SUB 8
63543 | LD D,A
63544 | EXX |
63545 | DEC C | Next row
63546 | JR NZ,63517 | Jump back until all 21 rows have been shifted
63548 | EXX |
63549 | LD A,(32767) | A=column of the play area (that was) at the far left of the screen
63552 | RET |