| The Hobbit (v1.0) | Routines |
| Prev: 7754 | Up: Map | Next: 77BC |
|
Scrolls the top 17 character rows of the screen ($4000 onwards, down to $5020) up by one character row, pixel line by pixel line, taking care of the Spectrum's awkward screen layout at the boundaries between the thirds of the screen. The attributes of those rows are scrolled too (so that a picture's colours move with it). Finally the bottom row of the story window at $5020 is cleared by printing 42 spaces in the 6-pixel font.
|
||||
| 775E | PUSH AF | Save the registers this uses | ||
| 775F | PUSH BC | |||
| 7760 | PUSH HL | |||
| 7761 | PUSH DE | |||
| 7762 | LD HL,$4020 | HL = the second pixel row of the story window... | ||
| 7765 | LD DE,$4000 | ...DE = the first, where it is moving to | ||
| 7768 | LD A,$11 | 17 character rows make up the whole story window | ||
| 776A | LD B,$00 | |||
| 776C | PUSH HL | Save the row addresses | ||
| 776D | PUSH DE | |||
| 776E | LD C,$08 | Eight pixel lines per character row | ||
| 7770 | PUSH HL | Save this pixel line's addresses | ||
| 7771 | PUSH DE | |||
| 7772 | PUSH BC | |||
| 7773 | LD C,$20 | 32 bytes per pixel line | ||
| 7775 | LDIR | Copy it up | ||
| 7777 | POP BC | Restore the counters | ||
| 7778 | POP DE | |||
| 7779 | POP HL | |||
| 777A | INC H | Move down to the next pixel line | ||
| 777B | INC D | |||
| 777C | DEC C | One fewer pixel line to do | ||
| 777D | JR NZ,$7770 | |||
| 777F | POP DE | Restore the row addresses | ||
| 7780 | POP HL | |||
| 7781 | LD C,$20 | Move both addresses on to the next character row | ||
| 7783 | ADD HL,BC | |||
| 7784 | EX DE,HL | |||
| 7785 | ADD HL,BC | |||
| 7786 | EX DE,HL | |||
| 7787 | PUSH AF | The screen's odd memory layout means a plain add sometimes lands in the wrong third of the screen, so check and correct that: | ||
| 7788 | LD A,D | |||
| 7789 | AND $07 | |||
| 778B | JR Z,$7791 | DE is already fine as it is... | ||
| 778D | LD A,D | |||
| 778E | ADD A,$07 | ...otherwise nudge it on to the next third | ||
| 7790 | LD D,A | |||
| 7791 | LD A,H | Do the same correction for HL | ||
| 7792 | AND $07 | |||
| 7794 | JR Z,$779A | |||
| 7796 | LD A,H | |||
| 7797 | ADD A,$07 | |||
| 7799 | LD H,A | |||
| 779A | POP AF | Restore AF | ||
| 779B | DEC A | One fewer character row to do | ||
| 779C | JR NZ,$776C | |||
| 779E | LD HL,$5820 | The attributes need to move up one row too... | ||
| 77A1 | LD DE,$5800 | |||
| 77A4 | LD BC,$0220 | |||
| 77A7 | LDIR | ...so that a picture's colours scroll along with it | ||
| 77A9 | LD B,$2A | The bottom row is now empty: clear it with 42 spaces, a full line of the 6-pixel font | ||
| 77AB | LD HL,$5020 | |||
| 77AE | LD C,$01 | |||
| 77B0 | LD A,$20 | |||
| 77B2 | CALL $77BC | |||
| 77B5 | DJNZ $77B2 | |||
| 77B7 | POP DE | Restore the saved registers | ||
| 77B8 | POP HL | |||
| 77B9 | POP BC | |||
| 77BA | POP AF | |||
| 77BB | RET | |||
| Prev: 7754 | Up: Map | Next: 77BC |