Prev: CE7B Up: Map Next: CEAB
CE85: Copy the screen buffer to the screen
Used by the routines at OBJECT_DONE, GAME_ENDED and DISPLAY_MENU.
All 192 rows of 32 bytes from BUFFER. The buffer runs the other way up from the display -- its first row is the bottom line of the screen -- because the game's pixel y counts up from the bottom; so the copy starts at the display's bottom-left byte and works up a line at a time. Used on the first turn in a room (OBJECT_DONE) and for the text screens (DISPLAY_MENU, GAME_ENDED). Knight Lore's update_screen clears the buffer as it copies; this one, like Pentagram's, leaves it as it is.
SHOW_BUFFER CE85 LD HL,BUFFER From the buffer's first row to the display's bottom line; 192 rows
CE88 LD DE,$57E0
CE8B LD BC,$C020
SHOW_BUFFER_0 CE8E PUSH BC A row of 32 bytes; HL runs on to the next row by itself
CE8F PUSH DE
CE90 LD B,$00
CE92 LDIR
CE94 POP DE
CE95 DEC D Up a display line, unless that crossed a character row
CE96 LD A,D
CE97 CPL
CE98 AND $07
CE9A JR NZ,SHOW_BUFFER_1
CE9C LD A,E Crossing a character row: back 32 in E, and back into this third unless that borrowed
CE9D SUB $20
CE9F LD E,A
CEA0 JR C,SHOW_BUFFER_1
CEA2 LD A,D
CEA3 ADD A,$08
CEA5 LD D,A
SHOW_BUFFER_1 CEA6 POP BC The next row
CEA7 DEC B
CEA8 JR NZ,SHOW_BUFFER_0
CEAA RET
Prev: CE7B Up: Map Next: CEAB