| Routines

24576: Scroll the screen right one column

Used by the routine at 25810.
24576 | EXX |
24577 | LD HL,22558 | Point HL' and DE' at the rightmost end of the top row of attribute bytes on the screen
24580 | LD DE,22559
24583 | LD BC,31 | We need to scroll 31 attribute bytes at a time
24586 | EXX |
24587 | LD HL,16414 | Point HL and DE at the rightmost end of the top row of pixels on the screen
24590 | LD DE,16415
24593 | LD BC,31 | We need to scroll 31 display file bytes at a time
24596 | LD A,21 | There are 21 rows of character squares to scroll
24598 | EX AF,AF' |
24599 | LD A,8 | Each row of character squares contains 8 rows of pixels
24601 | PUSH HL |
24602 | PUSH DE |
24603 | LDDR | Scroll a row of pixels right one column
24605 | POP DE |
24606 | POP HL |
24607 | LD C,31 | BC=31
24609 | INC H | Point HL and DE at the next row of pixels
24610 | INC D
24611 | DEC A | Next row in this block of 8x32
24612 | JR NZ,24601 | Jump back until this 8x32 pixel block has been scrolled
24614 | EXX |
24615 | LDDR | Scroll a row of attribute bytes right one column
24617 | LD C,63 | Point HL' and DE' at the rightmost end of the next row of attribute bytes on the screen
24619 | ADD HL,BC
24620 | EX DE,HL
24621 | ADD HL,BC
24622 | EX DE,HL
24623 | LD C,31 | BC'=31
24625 | EXX |
24626 | LD A,32 | Point HL and DE at the rightmost end of the top row of the next 8x32 block of pixels
24628 | ADD A,E
24629 | LD E,A
24630 | LD A,32
24632 | ADD A,L
24633 | LD L,A
24634 | EX AF,AF' |
24635 | DEC A | Next row of character squares
24636 | JR Z,24654 | Exit this loop if all 21 rows have been scrolled right
24638 | CP 13 | Have we reached the middle third of the screen?
24640 | JR Z,24598 | Jump if so
24642 | CP 5 | Have we reached the bottom third of the screen?
24644 | JR Z,24598 | Jump if so
24646 | EX AF,AF' |
24647 | LD A,H | Point HL and DE at the rightmost end of the top row of the next 8x32 block of pixels
24648 | SUB 8
24650 | LD H,A
24651 | LD D,A
24652 | JR 24599 | Jump back to deal with the next row of character squares
The 21 rows of character squares have been scrolled one place to the right. Now the leftmost column needs to be filled.
24654 | EXX |
24655 | LD HL,22528 | Point HL' and DE' at the attribute file and display file addresses for the top left of the screen, and set BC'=32; however, these values are not used
24658 | LD DE,16384
24661 | INC C
24662 | EXX |
24663 | LD A,(32512) | A=leftmost column of the skool on-screen (0-64)
24666 | DEC A | We are scrolling one column right
24667 | LD (32512),A
This entry point is used by the routine at 24731 with A holding the x-coordinate of the rightmost column of the skool on-screen (31-95).
24670 | LD E,A | E=X (x-coordinate of the far left or far right column of the skool currently on-screen)
24671 | LD D,152 | D=Y (this is the y-coordinate of the top row of the screen)
24673 | LD B,21 | There are 21 rows on the screen
24675 | PUSH DE |
24676 | PUSH BC |
24677 | CALL 24843 | Print the character square at (X,Y)
24680 | POP BC |
24681 | POP DE |
24682 | LD A,H | Point HL at the attribute file address corresponding to the skool coordinates (X,Y)
24683 | RRCA
24684 | RRCA
24685 | RRCA
24686 | ADD A,79
24688 | LD H,A
24689 | SET 7,E | Point DE at the attribute byte for the skool coordinates (X,Y)
24691 | LD A,(DE) | Pick the attribute byte up in A
24692 | RES 7,E | Restore the skool coordinates (X,Y) to DE
24694 | LD (HL),A | Poke the attribute byte onto the screen
24695 | INC D | Next row (Y) of the screen
24696 | DJNZ 24675 | Jump back until all 21 rows are done
24698 | RET |