![]() |
Routines |
| Prev: 34657 | Up: Map | Next: 34761 |
|
Used by the routine at PrintWriteACharacterToTheScreen.
Scrolls the text window up by one line.
|
||||
| ScrollLine | 34667 | PUSH AF | Save AF, BC, HL and DE, and point HL at screen line 16416. | |
| 34668 | PUSH BC | |||
| 34669 | PUSH HL | |||
| 34670 | PUSH DE | |||
|
Set up the initial values.
|
||||
| 34671 | LD HL,16416 | |||
| 34674 | LD DE,16384 | Point DE at the display file. | ||
| 34677 | LD A,17 | Load 17 for the scroll. | ||
| 34679 | LD B,0 | Start the pass count at zero. | ||
| ScrollLine_Loop | 34681 | PUSH HL | Save the screen pointers and count 8 pixel rows. | |
| 34682 | PUSH DE | |||
| 34683 | LD C,8 | |||
| ScrollLine_Line | 34685 | PUSH HL | Save the row addresses and the pixel count, and set the byte count to 32. | |
| 34686 | PUSH DE | |||
| 34687 | PUSH BC | |||
| 34688 | LD C,32 | |||
| 34690 | LDIR | Copy the row up one. | ||
| 34692 | POP BC | Increment the MSB of HL and DE by one to point to the next line down. | ||
| 34693 | POP DE | |||
| 34694 | POP HL | |||
| 34695 | INC H | |||
| 34696 | INC D | |||
| 34697 | DEC C | Drop one pixel row. | ||
| 34698 | JR NZ,ScrollLine_Line | Jump back to ScrollLine_Line unless the whole line is moved (i.e. C is now zero). | ||
| 34700 | POP DE | Restore the saved screen pointers from the stack and set BC to 32, one screen row. | ||
| 34701 | POP HL | |||
| 34702 | LD C,32 | |||
| 34704 | ADD HL,BC | Step one screen row, 32 bytes. | ||
| 34705 | EX DE,HL | Swap the two screen pointers. | ||
| 34706 | ADD HL,BC | Step the other pointer one screen row, 32 bytes. | ||
| 34707 | EX DE,HL | Swap the two screen pointers. | ||
| 34708 | PUSH AF | Save AF and use D as the next byte. | ||
| 34709 | LD A,D | |||
| 34710 | AND %00000111 | Keep the selected bits. | ||
| 34712 | JR Z,ScrollLine_SkipDE | Skip to ScrollLine_SkipDE if zero. | ||
|
Handle changing the target between each screen buffer area.
|
||||
| 34714 | LD A,D | Take the high byte of DE. | ||
| 34715 | ADD A,7 | Add 7 onto it. | ||
| 34717 | LD D,A | Store the row address past the screen-third gap. | ||
| ScrollLine_SkipDE | 34718 | LD A,H | Take the high byte of the screen address. | |
| 34719 | AND %00000111 | Keep the selected bits. | ||
| 34721 | JR Z,ScrollLine_SkipHL | Skip to ScrollLine_SkipHL if zero. | ||
|
Handle changing the source between each screen buffer area.
|
||||
| 34723 | LD A,H | Take the high byte of the screen address. | ||
| 34724 | ADD A,7 | Add 7 onto it. | ||
| 34726 | LD H,A | Store the other row address past the screen-third gap. | ||
| ScrollLine_SkipHL | 34727 | POP AF | Restore the line counter and drop one line. | |
| 34728 | DEC A | |||
| 34729 | JR NZ,ScrollLine_Loop | Loop back to ScrollLine_Loop until the line counter is zero. | ||
|
Handle the attributes.
|
||||
| 34731 | LD HL,22560 | Move the attributes up one character block. | ||
| 34734 | LD DE,22528 | |||
| 34737 | LD BC,544 | |||
| 34740 | LDIR | |||
|
This creates the indent.
|
||||
| 34742 | LD B,42 | Set a counter for 042 spaces. | ||
| 34744 | LD HL,20512 | Set the target screen location to 20512. | ||
| 34747 | LD C,1 | One column of the scrolled line. | ||
| 34749 | LD A,32 | Use the character ' '. | ||
| ScrollLine_Spacing | 34751 | CALL Print_ProportionalCharacter | Call Print_ProportionalCharacter to draw this character with the game's font. | |
| 34754 | DJNZ ScrollLine_Spacing | Decrease counter by one and loop back to ScrollLine_Spacing until counter is zero. | ||
|
Housekeeping and return.
|
||||
| 34756 | POP DE | Restore DE, HL, BC and AF from the stack. | ||
| 34757 | POP HL | |||
| 34758 | POP BC | |||
| 34759 | POP AF | |||
| 34760 | RET | Return. | ||
| Prev: 34657 | Up: Map | Next: 34761 |