Prev: 59861 Up: Map Next: 60082
60032: Update the display
Used by the routines at 30822, 30989, 60539, 61483, 61630 and 64338. Goes through the screen refresh buffer (SRB) and for every set bit found, updates the corresponding character square on-screen.
60032 LD B,80 20 screen rows, 4 bytes (32 bits) per row
60034 LD HL,32528 Point HL at the start of the portion of the screen refresh buffer that corresponds to the visible part of the play area
60037 LD A,(HL) Pick up a byte from the screen refresh buffer
60038 AND A Does anything need updating in this particular 8-tile segment?
60039 JR Z,60078 Jump if not
60041 PUSH BC Save the SRB byte counter
60042 LD A,L For this particular byte of the SRB, compute the corresponding screen row number (0-19) in D
60043 SUB 16
60045 AND 252
60047 RRCA
60048 RRCA
60049 LD D,A
60050 LD A,L Also for this particular SRB byte, compute the column of the screen (0, 8, 16 or 24) corresponding to bit 7
60051 AND 3
60053 ADD A,A
60054 ADD A,A
60055 ADD A,A
60056 DEC A Initialise E, which will hold the screen column number of the character square to be checked
60057 LD E,A
60058 INC E Set DE to the screen coordinates of the next character square to be checked
60059 SLA (HL) Does this character square need updating?
60061 JR C,60067 Jump if so
60063 JR NZ,60058 Jump back if there are still non-zero bits left in this SRB byte
60065 JR 60077 Jump forward to consider the next SRB byte
We found a set bit in the current SRB byte. Print the corresponding character square.
60067 PUSH HL Save the SRB pointer
60068 PUSH DE Save the screen (row,column) pointer
60069 EX DE,HL Switch the screen (row,column) pointer to HL
60070 CALL 59148 Print the character square at this row and column
60073 POP DE Restore the screen (row,column) pointer to DE
60074 POP HL Restore the SRB pointer to HL
60075 JR 60058 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.
60077 POP BC Restore the SRB byte counter to B
60078 INC L Point HL at the next SRB byte
60079 DJNZ 60037 Jump back until all 80 SRB bytes have been dealt with
60081 RET
Prev: 59861 Up: Map Next: 60082