Prev: C306 Up: Map Next: C37D
C316: 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 C316 LD A,($C128) Call C3E4 if the screen flags is zero.
C319 AND A
C31A CALL Z,$C3E4
C31D PUSH BC Save the registers and point HL at the second character row of the screen (4020).
C31E PUSH HL
C31F PUSH DE
C320 LD HL,$4020
C323 LD DE,$4000 Point the row copy at the top of the screen.
C326 LD BC,$0011 Take a length of 11 entries.
C329 LD A,($C128) Go to UpdateScreenDisplay_Loop with A=20 if the flag at C128 is zero (otherwise use 10).
C32C AND A
C32D LD A,$20
C32F JR Z,UpdateScreenDisplay_Loop
C331 LD A,$10 Use 10 for the display.
UpdateScreenDisplay_Loop C333 PUSH HL Save HL, DE and BC, and take a count of 08.
C334 PUSH DE
C335 PUSH BC
C336 LD C,$08
UpdateScreenDisplay_KeepRowDestination C338 PUSH HL Keep the row, the destination and the count while this pixel line is copied.
C339 PUSH DE
C33A PUSH BC
C33B LD C,A
C33C LDIR Copy one row of the character being drawn onto the screen.
C33E POP BC Jump back to UpdateScreenDisplay_KeepRowDestination while the count is not finished.
C33F POP DE
C340 POP HL
C341 INC H
C342 INC D
C343 DEC C
C344 JR NZ,UpdateScreenDisplay_KeepRowDestination
C346 POP BC Restore the screen registers from the stack.
C347 POP DE
C348 POP HL
C349 PUSH AF And call AdvanceScreenPosition to advance the screen position.
C34A CALL AdvanceScreenPosition
C34D CALL AdvanceScreenPosition Call AdvanceScreenPosition to advance screen position.
C350 POP AF
C351 DEC C Jump back to UpdateScreenDisplay_Loop while the count is not finished.
C352 JR NZ,UpdateScreenDisplay_Loop
C354 CP $10 Go to UpdateScreenDisplay_Next if it is 10.
C356 JR Z,UpdateScreenDisplay_Next
C358 LD HL,$5820 Point at the second and first attribute rows, ready to scroll the attributes up one row.
C35B LD DE,$5800
C35E LD BC,$0220 Take 0220 bytes, seventeen attribute rows.
C361 LDIR Scroll the attributes up one row.
UpdateScreenDisplay_Next C363 LD A,($C128) Set B to 24 and jump to UpdateScreenDisplay_FillSpaces if the screen flag at C128 is zero.
C366 AND A
C367 LD B,$24
C369 JR Z,UpdateScreenDisplay_FillSpaces
C36B LD B,$12 Count 12.
UpdateScreenDisplay_FillSpaces C36D LD HL,$5020 Point HL at the screen address 5020 set C to 02 and take a space.
C370 LD C,$02
C372 LD A,$20
UpdateScreenDisplay_0 C374 CALL PrintCharacter Call PrintCharacter to print a space.
C377 DJNZ UpdateScreenDisplay_0 Count the next entry and repeat from UpdateScreenDisplay_0.
C379 POP DE Restore the saved source, the saved pointer and the saved count from the stack.
C37A POP HL
C37B POP BC
C37C RET Return.
Prev: C306 Up: Map Next: C37D