Prev: F80D Up: Map Next: F841
F818: Scroll the display file left or right one column
Used by the routine at F849. 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 4000 or 401F
F818 LD B,$00 BC will be used as the counter for the LDIR/LDDR instruction at F826; initialise the MSB to 0
F81A EXX
F81B LD C,$15 There are 21 rows to scroll (the bottom 3 rows of the screen are fixed)
F81D LD B,$08 8 pixel lines per row of the screen
F81F EXX
F820 LD H,D Copy the display file address from DE to HL
F821 LD L,E
F822 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 F849)
F823 LD A,E Save the LSB of the display file address in A briefly
F824 LD C,$1F 31 bytes to shift per pixel line
F826 LDIR This instruction is set to LDIR if we're shifting to the left, or LDDR if we're shifting to the right (see F849)
F828 LD E,A Restore the LSB of the display file address to E
F829 INC D Point DE at the first (or last) byte of the next pixel line in this row
F82A EXX
F82B DJNZ $F81F Shift the remaining pixel lines in this row
F82D EXX
F82E 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
F82F ADD A,$20
F831 LD E,A
F832 JR C,$F838 Jump if we just finished shifting the eighth or sixteenth row
F834 LD A,D Adjust D appropriately in the case where we haven't finished with the current 8-row third of the screen
F835 SUB $08
F837 LD D,A
F838 EXX
F839 DEC C Next row
F83A JR NZ,$F81D Jump back until all 21 rows have been shifted
F83C EXX
F83D LD A,($7FFF) A=column of the play area (that was) at the far left of the screen
F840 RET
Prev: F80D Up: Map Next: F841