Prev: 52859 Up: Map Next: 52907
52869: Update Screen
Used by the routines at RunGame, GameOver and DisplayTextList.
Copies the screen buffer to the screen. The buffer holds the lines of the screen from the bottom up, 32 bytes to a line, so the lines are copied from the bottom of the screen to the top.
Before After UpdateScreen
update-screen-before update-screen-after
Copy from ScreenBuffer to the last line of the bitmap.
UpdateScreen 52869 LD HL,53760 Point HL at ScreenBuffer.
52872 LD DE,22496 Point DE at 22496 (in the screen buffer).
52875 LD BC,49184 Set BC to 49184.
UpdateScreen_Line 52878 PUSH BC Stash BC and DE on the stack.
52879 PUSH DE
52880 LD B,0 Set B to 0.
52882 LDIR Copy C bytes from HL to DE.
52884 POP DE Restore DE from the stack.
52885 DEC D Decrement D.
52886 LD A,D Fetch D and invert it.
52887 CPL
52888 AND %00000111 Keep bits 0 to 2.
52890 JR NZ,UpdateScreen_Next Jump to UpdateScreen_Next if it is not zero.
52892 LD A,E Subtract 32 from E.
52893 SUB 32
52895 LD E,A
52896 JR C,UpdateScreen_Next Jump to UpdateScreen_Next if carry is set.
52898 LD A,D Add 8 to D.
52899 ADD A,8
52901 LD D,A
UpdateScreen_Next 52902 POP BC Restore BC from the stack.
52903 DEC B Decrement B.
52904 JR NZ,UpdateScreen_Line Jump to UpdateScreen_Line until B is zero.
52906 RET Return.
View the equivalent code in;
Prev: 52859 Up: Map Next: 52907