Prev: 49926 Up: Map Next: 50045
49942: Update Screen Display
Used by the routine at ProcessScreenCharacter.
Copies the picture up one character row when the screen is being updated.
Input
HL Screen position
C Column count
UpdateScreenDisplay 49942 LD A,(49448) Call 50148 if the screen flags is zero.
49945 AND A
49946 CALL Z,50148
49949 PUSH BC Save the registers and point HL at the second character row of the screen (16416).
49950 PUSH HL
49951 PUSH DE
49952 LD HL,16416
49955 LD DE,16384 Point the row copy at the top of the screen.
49958 LD BC,17 Take a length of 17 entries.
49961 LD A,(49448) Go to UpdateScreenDisplay_Loop with A=32 if the flag at 49448 is zero (otherwise use 16).
49964 AND A
49965 LD A,32
49967 JR Z,UpdateScreenDisplay_Loop
49969 LD A,16 Use 16 for the display.
UpdateScreenDisplay_Loop 49971 PUSH HL Save HL, DE and BC, and take a count of 8.
49972 PUSH DE
49973 PUSH BC
49974 LD C,8
UpdateScreenDisplay_KeepRowDestination 49976 PUSH HL Keep the row, the destination and the count while this pixel line is copied.
49977 PUSH DE
49978 PUSH BC
49979 LD C,A
49980 LDIR Copy one row of the character being drawn onto the screen.
49982 POP BC Jump back to UpdateScreenDisplay_KeepRowDestination while the count is not finished.
49983 POP DE
49984 POP HL
49985 INC H
49986 INC D
49987 DEC C
49988 JR NZ,UpdateScreenDisplay_KeepRowDestination
49990 POP BC Restore the screen registers from the stack.
49991 POP DE
49992 POP HL
49993 PUSH AF And call AdvanceScreenPosition to advance the screen position.
49994 CALL AdvanceScreenPosition
49997 CALL AdvanceScreenPosition Call AdvanceScreenPosition to advance screen position.
50000 POP AF
50001 DEC C Jump back to UpdateScreenDisplay_Loop while the count is not finished.
50002 JR NZ,UpdateScreenDisplay_Loop
50004 CP 16 Go to UpdateScreenDisplay_Next if it is 16.
50006 JR Z,UpdateScreenDisplay_Next
50008 LD HL,22560 Point at the second and first attribute rows, ready to scroll the attributes up one row.
50011 LD DE,22528
50014 LD BC,544 Take 544 bytes, seventeen attribute rows.
50017 LDIR Scroll the attributes up one row.
UpdateScreenDisplay_Next 50019 LD A,(49448) Set B to 36 and jump to UpdateScreenDisplay_FillSpaces if the screen flag at 49448 is zero.
50022 AND A
50023 LD B,36
50025 JR Z,UpdateScreenDisplay_FillSpaces
50027 LD B,18 Count 18.
UpdateScreenDisplay_FillSpaces 50029 LD HL,20512 Point HL at the screen address 20512 set C to 2 and take a space.
50032 LD C,2
50034 LD A,32
UpdateScreenDisplay_0 50036 CALL PrintCharacter Call PrintCharacter to print a space.
50039 DJNZ UpdateScreenDisplay_0 Count the next entry and repeat from UpdateScreenDisplay_0.
50041 POP DE Restore the saved source, the saved pointer and the saved count from the stack.
50042 POP HL
50043 POP BC
50044 RET Return.
Prev: 49926 Up: Map Next: 50045