Prev: 25946 Up: Map Next: 26093
25950: Scroll Text Window
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 25950 LD A,(23447) Copy BottomRow into B.
25953 LD B,A
25954 LD A,22 Blank lines left are 22 minus that row.
25956 SUB B
25957 LD B,A
25958 LD A,(25948) Fewer scrolls than blank lines means scroll now.
25961 CP B
25962 JR C,ScrollWindow_Row
25964 LD HL,(25946) Otherwise copy the repeat delay into the frame counter, FRAMES.
25967 LD (23672),HL
Wait for a key or the delay.
ScrollWindow_Wait 25970 LD A,(23556) A key releases the pause.
25973 CP 255
25975 JR NZ,ScrollWindow_Row
25977 CALL 82 Call the RET at the end of MASK_INT.
25980 LD A,(23673) Jump to ScrollWindow_Wait until FRAMES has moved.
25983 OR A
25984 JR Z,ScrollWindow_Wait
Scroll the window up one character.
ScrollWindow_Row 25986 LD HL,25948 Point HL at RowsScrolled.
25989 INC (HL) Count this scroll.
25990 LD A,(23447) Fetch BottomRow.
Copy one character row onto the row above.
ScrollWindow_Up 25993 CALL RowAddress Call RowAddress.
25996 PUSH DE Keep this row.
25997 INC A The next character row.
25998 CALL RowAddress Call RowAddress.
26001 EX DE,HL That address is the destination.
26002 POP DE
26003 LD B,8 Count the 8 pixel rows of this character.
Copy eight pixel rows.
ScrollWindow_Pixels 26005 PUSH HL Save the row pair.
26006 PUSH BC
26007 PUSH DE
26008 LD BC,32 Copy one pixel row, 0032 bytes.
26011 LDIR
26013 POP DE Restore the row pair from the stack.
26014 POP BC
26015 POP HL
26016 INC H The next pixel row.
26017 INC D
26018 DJNZ ScrollWindow_Pixels All eight pixel rows.
26020 CP 19 Row 19 is the pause row.
26022 JR Z,ScrollWindow_Pause
26024 CP 23 Row 23 is the bottom of the window.
26026 JR NZ,ScrollWindow_Up
26028 JR ScrollWindow_Bottom Otherwise the blank line is the bottom row.
Blank the pause row during a description.
ScrollWindow_Pause 26030 PUSH AF Stash AF on the stack.
26031 LD A,(24966) Jump to ScrollWindow_More if a description is not in progress.
26034 OR A
26035 JR Z,ScrollWindow_More
26037 POP AF Restore AF from the stack.
26038 LD HL,20576 The blank line is at 20576 (screen buffer).
26041 JR ScrollWindow_Clear Clear that line.
Keep copying rows.
ScrollWindow_More 26043 POP AF Restore AF from the stack.
26044 JR ScrollWindow_Up Jump to ScrollWindow_Up.
Blank the bottom of the window.
ScrollWindow_Bottom 26046 LD HL,20704 The ordinary blank line is at 20704 (screen buffer).
Clear the vacated row.
ScrollWindow_Clear 26049 PUSH HL Copy HL to DE (using the stack).
26050 POP DE
26051 INC DE Advance the destination.
26052 LD B,8 Count the 8 pixel rows to blank.
Wipe eight pixel rows.
ScrollWindow_Wipe 26054 PUSH DE Save the row.
26055 PUSH HL
26056 PUSH BC
26057 LD (HL),0 Write a zero.
26059 LD BC,31 Copy it across the rest of the row.
26062 LDIR
26064 POP BC Restore the row from the stack.
26065 POP HL
26066 POP DE
26067 INC H The next pixel row.
26068 INC D
26069 DJNZ ScrollWindow_Wipe All eight.
26071 LD A,(24966) A paused description leaves the cursor on the pause row.
26074 OR A
26075 JR Z,ScrollWindow_Home
26077 LD HL,20576 That row is 20576 (screen buffer).
26080 JR ScrollWindow_Cursor Home there.
Home the cursor after the scroll.
ScrollWindow_Home 26082 LD HL,20704 Otherwise the cursor sits on 20704 (screen buffer).
Store the print address.
ScrollWindow_Cursor 26085 LD (23431),HL Write HL to *PrintAddress.
26088 XOR A Write 0 to PrintColumn.
26089 LD (23434),A
26092 RET Return.
Prev: 25946 Up: Map Next: 26093