Prev: E9D5 Up: Map Next: EAB2
EA80: Update the display
Used by the routines at 7866, 790D, EC7B, F02B, F0BE and FB52. Goes through the screen refresh buffer (SRB) and for every set bit found, updates the corresponding character square on-screen.
EA80 LD B,$50 20 screen rows, 4 bytes (32 bits) per row
EA82 LD HL,$7F10 Point HL at the start of the portion of the screen refresh buffer that corresponds to the visible part of the play area
EA85 LD A,(HL) Pick up a byte from the screen refresh buffer
EA86 AND A Does anything need updating in this particular 8-tile segment?
EA87 JR Z,$EAAE Jump if not
EA89 PUSH BC Save the SRB byte counter
EA8A LD A,L For this particular byte of the SRB, compute the corresponding screen row number (0-19) in D
EA8B SUB $10
EA8D AND $FC
EA8F RRCA
EA90 RRCA
EA91 LD D,A
EA92 LD A,L Also for this particular SRB byte, compute the column of the screen (0, 8, 16 or 24) corresponding to bit 7
EA93 AND $03
EA95 ADD A,A
EA96 ADD A,A
EA97 ADD A,A
EA98 DEC A Initialise E, which will hold the screen column number of the character square to be checked
EA99 LD E,A
EA9A INC E Set DE to the screen coordinates of the next character square to be checked
EA9B SLA (HL) Does this character square need updating?
EA9D JR C,$EAA3 Jump if so
EA9F JR NZ,$EA9A Jump back if there are still non-zero bits left in this SRB byte
EAA1 JR $EAAD Jump forward to consider the next SRB byte
We found a set bit in the current SRB byte. Print the corresponding character square.
EAA3 PUSH HL Save the SRB pointer
EAA4 PUSH DE Save the screen (row,column) pointer
EAA5 EX DE,HL Switch the screen (row,column) pointer to HL
EAA6 CALL $E70C Print the character square at this row and column
EAA9 POP DE Restore the screen (row,column) pointer to DE
EAAA POP HL Restore the SRB pointer to HL
EAAB JR $EA9A 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.
EAAD POP BC Restore the SRB byte counter to B
EAAE INC L Point HL at the next SRB byte
EAAF DJNZ $EA85 Jump back until all 80 SRB bytes have been dealt with
EAB1 RET
Prev: E9D5 Up: Map Next: EAB2