Prev: 0DD9 Up: Map Next: 0E44
0DFE: THE 'SCROLLING' SUBROUTINE
Used by the routine at PO_SCR.
The number of lines of the display that are to be scrolled has to be held on entry to the main subroutine in the B register.
Input
Output
CL_SC_ALL 0DFE LD B,$17 The entry point after 'scroll?'
This entry point is used by the routine at PO_SCR.
The main entry point - from above and when scrolling for INPUT...AT.
CL_SCROLL 0E00 CALL CL_ADDR Find the starting address of the line.
0E03 LD C,$08 There are eight pixel lines to a complete line.
Now enter the main scrolling loop. The B register holds the number of the top line to be scrolled, the HL register pair the starting address in the display area of this line and the C register the pixel line counter.
CL_SCR_1 0E05 PUSH BC Save both counters.
0E06 PUSH HL Save the starting address.
0E07 LD A,B Jump forward unless dealing at the present moment with a 'third' of the display.
0E08 AND $07
0E0A LD A,B
0E0B JR NZ,CL_SCR_3
The pixel lines of the top lines of the 'thirds' of the display have to be moved across the 2K boundaries. (Each 'third' is 2K.)
CL_SCR_2 0E0D EX DE,HL The result of this manipulation is to leave HL unchanged and DE pointing to the required destination.
0E0E LD HL,$F8E0
0E11 ADD HL,DE
0E12 EX DE,HL
0E13 LD BC,$0020 There are +20 characters.
0E16 DEC A Decrease the counter as one line is being dealt with.
0E17 LDIR Now move the thirty two bytes.
The pixel lines within the 'thirds' can now be scrolled. The A register holds, on the first pass, +01 to +07, +09 to +0F, or +11 to +17.
CL_SCR_3 0E19 EX DE,HL Again DE is made to point to the required destination, this time only thirty two locations away.
0E1A LD HL,$FFE0
0E1D ADD HL,DE
0E1E EX DE,HL
0E1F LD B,A Save the line number in B.
0E20 AND $07 Now find how many characters there are remaining in the 'third'.
0E22 RRCA
0E23 RRCA
0E24 RRCA
0E25 LD C,A Pass the 'character total' to the C register.
0E26 LD A,B Fetch the line number.
0E27 LD B,$00 BC holds the 'character total' and a pixel line from each of the characters is 'scrolled'.
0E29 LDIR
0E2B LD B,$07 Now prepare to increment the address to jump across a 'third' boundary.
0E2D ADD HL,BC Increase HL by +0700.
0E2E AND $F8 Jump back if there are any 'thirds' left to consider.
0E30 JR NZ,CL_SCR_2
Now find if the loop has been used eight times - once for each pixel line.
0E32 POP HL Fetch the original address.
0E33 INC H Address the next pixel line.
0E34 POP BC Fetch the counters.
0E35 DEC C Decrease the pixel line counter and jump back unless eight lines have been moved.
0E36 JR NZ,CL_SCR_1
Next the attribute bytes are scrolled. Note that the B register still holds the number of lines to be scrolled and the C register holds zero.
0E38 CALL CL_ATTR The required address in the attribute area and the number of characters in B lines are found.
0E3B LD HL,$FFE0 The displacement for all the attribute bytes is thirty two locations away.
0E3E ADD HL,DE
0E3F EX DE,HL
0E40 LDIR The attribute bytes are 'scrolled'.
It remains now to clear the bottom line of the display.
0E42 LD B,$01 The B register is loaded with +01 and CL_LINE is entered.
Prev: 0DD9 Up: Map Next: 0E44