Prev: 25233 Up: Map Next: 25296
25248: Update the display
Used by the routines at 20956, 28160, 62094 and 63210. Goes through the screen refresh buffer (SRB) and for every set bit found, updates the corresponding character square on-screen.
25248 CALL 26849 Update the SRB so that speech bubbles are not corrupted by moving characters
25251 LD B,84 21 screen rows, 4 bytes (32 bits) per row
25253 LD A,(HL) Pick up a byte from the screen refresh buffer
25254 AND A Anything need updating in this particular 8-tile segment?
25255 JR Z,25292 Jump if not
25257 PUSH BC Save the SRB byte counter
25258 LD A,L For this particular byte of the SRB, compute the corresponding screen row number (0-20) in D
25259 AND 252
25261 RRCA
25262 RRCA
25263 LD D,A
25264 LD A,L Also for this particular SRB byte, compute the column of the screen (0, 8, 16 or 24) corresponding to bit 7
25265 AND 3
25267 ADD A,A
25268 ADD A,A
25269 ADD A,A
25270 DEC A
25271 LD E,A
25272 INC E
25273 SLA (HL) Does a character square need printing?
25275 JR C,25281 Jump if so
25277 JR NZ,25272 Jump back if there are still non-zero bits left in this SRB byte
25279 JR 25291 Jump forward to consider the next SRB byte
We found a set bit in the current SRB byte. Print the corresponding character square.
25281 PUSH HL Save the SRB pointer
25282 PUSH DE Save the screen (row,column) pointer
25283 EX DE,HL Switch the screen (row,column) pointer to HL
25284 CALL 24684 Print the character square at this row and column
25287 POP DE Restore the screen (row,column) pointer to DE
25288 POP HL Restore the SRB pointer to HL
25289 JR 25272 Examine the next bit of the current SRB byte
There are no set bits remaining in the current SRB byte. Move to the next SRB byte.
25291 POP BC Restore the SRB byte counter to B
25292 INC L Point HL at the next SRB byte
25293 DJNZ 25253 Jump back until all 84 SRB bytes have been dealt with
25295 RET
Prev: 25233 Up: Map Next: 25296