BYTE SCROLL ROUTINE |
|||
---|---|---|---|
(Left) |
LD HL,22527 | 21FF57 | Last screen address |
LD BC,192 | 01C000 | number of lines Save this value |
|
loop |
PUSH BC | C5 | Calculate the first |
LD BC.-31 | 01E1FF | address of the line. |
|
ADD HL,BC | 09 | Save byte 'A' |
|
LD A,(HL) | 7E* | Put address into DE |
|
LD D,H | 54 | ||
LD E,L | 5D | Next address |
|
INC HL | 23 | 32 columns -1 |
|
LD BC,31 | 011F00 | scroll left |
|
LDIR | EDB0 | Set to column 32 |
|
DEC HL | 2B | wrap-around |
|
LD (HL),A | 77* | Set HL to start |
|
LD BC,-32 | 01E0FF | of the next line. |
|
ADD HL,BC | 09 | Recover the line |
|
POP BC | C1 | counter. |
|
DEC BC | 0B | Decrement counter |
|
LD A,B | 78 | Check if zero |
|
OR C | B1 | ||
JR NZ to loop | 20E6 | Continue if not zero |
|
LD BC,24 | 011800 | 24 Attribute lines |
|
LD DE,22528 | 110058 | First attribute address |
|
LD HL,22529 | 210158 | Second attribute address |
|
loop2 |
LD A,(DE) | 1A* | Store attribute |
PUSH BC | C5 | Store line counter |
|
LD BC,31 | 011F00 | ||
LDIR | EDB0 | Scroll left |
|
DEC HL | 2B | Set HL to last byte |
|
LD (HL),A | 77* | wrap-around |
|
INC DE | 13 | ||
INC HL | 23 | Set HL and DE to |
|
INC HL | 23 | the next line. |
|
POP BC | C1 | Recover line counter |
|
DEC BC | 0B | Decrement counter |
|
LD A,B | 78 | Check if zero |
|
OR C | B1 | ||
JR NZ to loop2 | 20EE | Go back if not zero |
|
RET | C9 | Else return to BASIC. |
|
The scroll right routine is very similar to the scroll left program, so it will not be repeated here. |