Prev: 26378 Up: Map Next: 26453
26380: Update the SRB for a blackboard
Used by the routines at 26513 and 26639. Updates the screen refresh buffer (SRB) so that the character squares at (E,D) and (E+1,D) are marked dirty. Two character squares in a row are marked dirty to ensure that blackboard contents are properly displayed (characters written on a blackboard may cross character square boundaries).
Input
D y-coordinate of the play area
E x-coordinate of the play area
26380 LD A,(32767) A=leftmost column of the play area on screen
26383 SUB 2
26385 JR C,26389 Jump if the far left wall of the boys' skool is on-screen
26387 CP E Is the leftmost point requiring refresh off-screen to the left by at least two character squares?
26388 RET NC Return if so (nothing to do)
26389 ADD A,33 A=column of the play area at the far right of the screen
26391 CP E Is the leftmost point requiring refresh off-screen to the right?
26392 RET C Return if so (nothing to do)
26393 PUSH DE Save the coordinates for now
26394 SUB 32 A=screen x-coordinate corresponding to the play area x-coordinate in E (-1, 0-31)
26396 CPL
26397 ADD A,E
26398 BIT 7,A Is the leftmost point requiring refresh on-screen?
26400 JR Z,26403 Jump if so
26402 INC A A=0
26403 RLCA A=8x (x=column of the screen containing the first character square to be refreshed)
26404 RLCA
26405 RLCA
26406 LD E,A Store this in E temporarily
26407 AND 56 Set the instruction at 26428 below to SET n,(HL) where n is the appropriate bit in the SRB byte
26409 CPL
26410 DEC A
26411 LD (26429),A
26414 PUSH AF
26415 LD A,E A=8x again
26416 RLCA Point HL at the appropriate byte of the SRB
26417 RLCA
26418 AND 3
26420 ADD A,D
26421 ADD A,D
26422 ADD A,D
26423 ADD A,D
26424 LD E,A
26425 LD D,127
26427 EX DE,HL
26428 SET 0,(HL) Set the appropriate bit in the SRB byte for the leftmost character square that needs refreshing; this instruction is modified earlier in this routine to set the required bit
26430 POP AF
26431 ADD A,56
26433 JR C,26443 Jump unless we've just set bit 0 of an SRB byte
26435 INC L Next SRB byte
26436 LD A,L Does this SRB byte correspond to the first byte of the next row of the screen?
26437 AND 3
26439 JR Z,26450 If so, skip it
26441 LD A,254 Otherwise set bit 7 in this SRB byte
26443 OR 192
26445 LD (26449),A Set the instruction at 26448 below to SET m,(HL) where m is the appropriate bit in the SRB byte
26448 SET 0,(HL) Set the appropriate bit in the SRB byte for the rightmost character square that needs refreshing; this instruction is modified immediately before execution to set the required bit
26450 EX DE,HL Restore the original contents of HL
26451 POP DE Restore the play area coordinates to DE
26452 RET
Prev: 26378 Up: Map Next: 26453