Routines
 Prev: 27008 Up: Map Next: 27082
27026: Update the display
 Used by the routines at 25856, 26471, 32470 and 46312. Goes through the screen refresh buffer (SRB) and for every set bit found, updates the corresponding character square on-screen. 27026 LD HL,32524 Point HL at the first byte of the SRB 27029 LD B,84 B will count the bytes in the screen refresh buffer 27031 LD A,(HL) Pick up an SRB byte 27032 AND A Any character squares in this segment need refreshing? 27033 JR Z,27078 Jump if not 27035 PUSH BC Save the SRB byte counter 27036 LD A,L D=y-coordinate of the segment of 8 character squares to which this SRB byte corresponds 27037 AND 124 27039 RRCA 27040 RRCA 27041 ADD A,149 27043 LD D,A 27044 LD A,L E=x-coordinate of the leftmost character square in the segment 27045 AND 3 27047 RLCA 27048 RLCA 27049 RLCA 27050 LD E,A 27051 LD A,(32512) 27054 ADD A,E 27055 LD E,A 27056 DEC E Here we enter a loop to check each SRB byte for set bits. 27057 PUSH HL Save the pointer to the SRB byte 27058 INC E Set DE to the coordinates of the next character square in the current segment 27059 RR (HL) Push an SRB bit into the carry flag, and 0 into bit 7 of the SRB byte 27061 JR C,27067 Refresh the corresponding character square if the bit was set 27063 JR NZ,27058 Jump back until all set bits in the SRB byte have been checked 27065 JR 27076 Move to the next SRB byte We have found a set bit in the current SRB byte. Refresh the corresponding tile on screen. 27067 PUSH DE 27068 CALL 24843 Print the character square at (E,D) 27071 POP DE 27072 POP HL Restore the pointer to the SRB byte 27073 AND A Clear the carry flag so that bit 7 of the SRB byte will be reset, and jump back to check the next bit 27074 JR 27057 There are no set bits remaining in the current SRB byte. Move on to the next. 27076 POP HL Restore the pointer to the SRB byte 27077 POP BC Restore the SRB byte counter to B 27078 INC L Move to the next byte in the screen refresh buffer 27079 DJNZ 27031 Jump back until every byte in the SRB has been checked 27081 RET
 Prev: 27008 Up: Map Next: 27082