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) The bottom row.
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
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 MASKABLE INTERRUPT and scroll once the frame counter has moved.
25980 LD A,(23673)
25983 OR A
25984 JR Z,ScrollWindow_Wait
ScrollWindow_Row 25986 LD HL,25948 Count this scroll.
25989 INC (HL)
25990 LD A,(23447) The bottom row is the first one to move.
ScrollWindow_Up 25993 CALL RowAddress Address of that character row.
25996 PUSH DE Keep this row.
25997 INC A Address of the row below it.
25998 CALL RowAddress
26001 EX DE,HL That address is the destination.
26002 POP DE
26003 LD B,8 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, 32 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.
ScrollWindow_Pause 26030 PUSH AF A description in progress blanks the pause row instead.
26031 LD A,(24966)
26034 OR A
26035 JR Z,ScrollWindow_More
26037 POP AF The blank line is at 20576 while the description is paused.
26038 LD HL,20576
26041 JR ScrollWindow_Clear Clear that line.
ScrollWindow_More 26043 POP AF Keep copying while the window has not been reached.
26044 JR ScrollWindow_Up
ScrollWindow_Bottom 26046 LD HL,20704 The ordinary blank line is at 20704.
ScrollWindow_Clear 26049 PUSH HL The cleared row is copied onto itself, one byte on.
26050 POP DE
26051 INC DE
26052 LD B,8 Eight pixel rows.
ScrollWindow_Wipe 26054 PUSH DE Save the row.
26055 PUSH HL
26056 PUSH BC
26057 LD (HL),0 Write a zero and copy it across the row.
26059 LD BC,31
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.
26080 JR ScrollWindow_Cursor Home there.
ScrollWindow_Home 26082 LD HL,20704 Otherwise the cursor sits on 20704.
ScrollWindow_Cursor 26085 LD (23431),HL Store the print address.
26088 XOR A Column 0.
26089 LD (23434),A
26092 RET Return.
Prev: 25946 Up: Map Next: 26093