![]() |
Routines |
| Prev: 8761 | Up: Map | Next: 87C9 |
|
Used by the routine at PrintWriteACharacterToTheScreen.
Scrolls the text window up by one line.
|
||||
| ScrollLine | 876B | PUSH AF | Save AF, BC, HL and DE, and point HL at screen line 4020. | |
| 876C | PUSH BC | |||
| 876D | PUSH HL | |||
| 876E | PUSH DE | |||
|
Set up the initial values.
|
||||
| 876F | LD HL,$4020 | |||
| 8772 | LD DE,$4000 | Point DE at the display file. | ||
| 8775 | LD A,$11 | Load 11 for the scroll. | ||
| 8777 | LD B,$00 | Start the pass count at zero. | ||
| ScrollLine_Loop | 8779 | PUSH HL | Save the screen pointers and count 08 pixel rows. | |
| 877A | PUSH DE | |||
| 877B | LD C,$08 | |||
| ScrollLine_Line | 877D | PUSH HL | Save the row addresses and the pixel count, and set the byte count to 20. | |
| 877E | PUSH DE | |||
| 877F | PUSH BC | |||
| 8780 | LD C,$20 | |||
| 8782 | LDIR | Copy the row up one. | ||
| 8784 | POP BC | Increment the MSB of HL and DE by one to point to the next line down. | ||
| 8785 | POP DE | |||
| 8786 | POP HL | |||
| 8787 | INC H | |||
| 8788 | INC D | |||
| 8789 | DEC C | Drop one pixel row. | ||
| 878A | JR NZ,ScrollLine_Line | Jump back to ScrollLine_Line unless the whole line is moved (i.e. C is now zero). | ||
| 878C | POP DE | Restore the saved screen pointers from the stack and set BC to 20, one screen row. | ||
| 878D | POP HL | |||
| 878E | LD C,$20 | |||
| 8790 | ADD HL,BC | Step one screen row, 20 bytes. | ||
| 8791 | EX DE,HL | Swap the two screen pointers. | ||
| 8792 | ADD HL,BC | Step the other pointer one screen row, 20 bytes. | ||
| 8793 | EX DE,HL | Swap the two screen pointers. | ||
| 8794 | PUSH AF | Save AF and use D as the next byte. | ||
| 8795 | LD A,D | |||
| 8796 | AND %00000111 | Keep the selected bits. | ||
| 8798 | JR Z,ScrollLine_SkipDE | Skip to ScrollLine_SkipDE if zero. | ||
|
Handle changing the target between each screen buffer area.
|
||||
| 879A | LD A,D | Take the high byte of DE. | ||
| 879B | ADD A,$07 | Add 07 onto it. | ||
| 879D | LD D,A | Store the row address past the screen-third gap. | ||
| ScrollLine_SkipDE | 879E | LD A,H | Take the high byte of the screen address. | |
| 879F | AND %00000111 | Keep the selected bits. | ||
| 87A1 | JR Z,ScrollLine_SkipHL | Skip to ScrollLine_SkipHL if zero. | ||
|
Handle changing the source between each screen buffer area.
|
||||
| 87A3 | LD A,H | Take the high byte of the screen address. | ||
| 87A4 | ADD A,$07 | Add 07 onto it. | ||
| 87A6 | LD H,A | Store the other row address past the screen-third gap. | ||
| ScrollLine_SkipHL | 87A7 | POP AF | Restore the line counter and drop one line. | |
| 87A8 | DEC A | |||
| 87A9 | JR NZ,ScrollLine_Loop | Loop back to ScrollLine_Loop until the line counter is zero. | ||
|
Handle the attributes.
|
||||
| 87AB | LD HL,$5820 | Move the attributes up one character block. | ||
| 87AE | LD DE,$5800 | |||
| 87B1 | LD BC,$0220 | |||
| 87B4 | LDIR | |||
|
This creates the indent.
|
||||
| 87B6 | LD B,$2A | Set a counter for $2A spaces. | ||
| 87B8 | LD HL,$5020 | Set the target screen location to $5020. | ||
| 87BB | LD C,$01 | One column of the scrolled line. | ||
| 87BD | LD A,$20 | Use the character ' '. | ||
| ScrollLine_Spacing | 87BF | CALL Print_ProportionalCharacter | Call Print_ProportionalCharacter to draw this character with the game's font. | |
| 87C2 | DJNZ ScrollLine_Spacing | Decrease counter by one and loop back to ScrollLine_Spacing until counter is zero. | ||
|
Housekeeping and return.
|
||||
| 87C4 | POP DE | Restore DE, HL, BC and AF from the stack. | ||
| 87C5 | POP HL | |||
| 87C6 | POP BC | |||
| 87C7 | POP AF | |||
| 87C8 | RET | Return. | ||
| Prev: 8761 | Up: Map | Next: 87C9 |