![]() |
Routines |
| Prev: 655A | Up: Map | Next: 65ED |
|
Used by the routine at PlotCharacter.
Moves every pixel row of the text window up by one character and clears the bottom row. During a description the picture is left where it is.
|
||||
|
A short delay, taken from RepeatTimer, lets the player read before the next scroll.
|
||||
| ScrollWindow | 655E | LD A,($5B97) | The bottom row. | |
| 6561 | LD B,A | |||
| 6562 | LD A,$16 | Blank lines left are 16 minus that row. | ||
| 6564 | SUB B | |||
| 6565 | LD B,A | |||
| 6566 | LD A,($655C) | Fewer scrolls than blank lines means scroll now. | ||
| 6569 | CP B | |||
| 656A | JR C,ScrollWindow_Row | |||
| 656C | LD HL,($655A) | Otherwise copy the repeat delay into the frame counter, FRAMES. | ||
| 656F | LD ($5C78),HL | |||
| ScrollWindow_Wait | 6572 | LD A,($5C04) | A key releases the pause. | |
| 6575 | CP $FF | |||
| 6577 | JR NZ,ScrollWindow_Row | |||
| 6579 | CALL $0052 | Call the RET at the end of MASKABLE INTERRUPT and scroll once the frame counter has moved. | ||
| 657C | LD A,($5C79) | |||
| 657F | OR A | |||
| 6580 | JR Z,ScrollWindow_Wait | |||
| ScrollWindow_Row | 6582 | LD HL,$655C | Count this scroll. | |
| 6585 | INC (HL) | |||
| 6586 | LD A,($5B97) | The bottom row is the first one to move. | ||
| ScrollWindow_Up | 6589 | CALL RowAddress | Address of that character row. | |
| 658C | PUSH DE | Keep this row. | ||
| 658D | INC A | Address of the row below it. | ||
| 658E | CALL RowAddress | |||
| 6591 | EX DE,HL | That address is the destination. | ||
| 6592 | POP DE | |||
| 6593 | LD B,$08 | Eight pixel rows. | ||
| ScrollWindow_Pixels | 6595 | PUSH HL | Save the row pair. | |
| 6596 | PUSH BC | |||
| 6597 | PUSH DE | |||
| 6598 | LD BC,$0020 | Copy one pixel row, 20 bytes. | ||
| 659B | LDIR | |||
| 659D | POP DE | Restore the row pair from the stack. | ||
| 659E | POP BC | |||
| 659F | POP HL | |||
| 65A0 | INC H | The next pixel row. | ||
| 65A1 | INC D | |||
| 65A2 | DJNZ ScrollWindow_Pixels | All eight pixel rows. | ||
| 65A4 | CP $13 | Row 13 is the pause row. | ||
| 65A6 | JR Z,ScrollWindow_Pause | |||
| 65A8 | CP $17 | Row 17 is the bottom of the window. | ||
| 65AA | JR NZ,ScrollWindow_Up | |||
| 65AC | JR ScrollWindow_Bottom | Otherwise the blank line is the bottom row. | ||
| ScrollWindow_Pause | 65AE | PUSH AF | A description in progress blanks the pause row instead. | |
| 65AF | LD A,($6186) | |||
| 65B2 | OR A | |||
| 65B3 | JR Z,ScrollWindow_More | |||
| 65B5 | POP AF | The blank line is at 5060 while the description is paused. | ||
| 65B6 | LD HL,$5060 | |||
| 65B9 | JR ScrollWindow_Clear | Clear that line. | ||
| ScrollWindow_More | 65BB | POP AF | Keep copying while the window has not been reached. | |
| 65BC | JR ScrollWindow_Up | |||
| ScrollWindow_Bottom | 65BE | LD HL,$50E0 | The ordinary blank line is at 50E0. | |
| ScrollWindow_Clear | 65C1 | PUSH HL | The cleared row is copied onto itself, one byte on. | |
| 65C2 | POP DE | |||
| 65C3 | INC DE | |||
| 65C4 | LD B,$08 | Eight pixel rows. | ||
| ScrollWindow_Wipe | 65C6 | PUSH DE | Save the row. | |
| 65C7 | PUSH HL | |||
| 65C8 | PUSH BC | |||
| 65C9 | LD (HL),$00 | Write a zero and copy it across the row. | ||
| 65CB | LD BC,$001F | |||
| 65CE | LDIR | |||
| 65D0 | POP BC | Restore the row from the stack. | ||
| 65D1 | POP HL | |||
| 65D2 | POP DE | |||
| 65D3 | INC H | The next pixel row. | ||
| 65D4 | INC D | |||
| 65D5 | DJNZ ScrollWindow_Wipe | All eight. | ||
| 65D7 | LD A,($6186) | A paused description leaves the cursor on the pause row. | ||
| 65DA | OR A | |||
| 65DB | JR Z,ScrollWindow_Home | |||
| 65DD | LD HL,$5060 | That row is 5060. | ||
| 65E0 | JR ScrollWindow_Cursor | Home there. | ||
| ScrollWindow_Home | 65E2 | LD HL,$50E0 | Otherwise the cursor sits on 50E0. | |
| ScrollWindow_Cursor | 65E5 | LD ($5B87),HL | Store the print address. | |
| 65E8 | XOR A | Column 0. | ||
| 65E9 | LD ($5B8A),A | |||
| 65EC | RET | Return. | ||
| Prev: 655A | Up: Map | Next: 65ED |