![]() |
Routines |
D | y-coordinate of point requiring refresh |
E | x-coordinate of point requiring refresh |
26380 | LD A,(32767) | A=leftmost column of 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 play area at far right of 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=column of screen corresponding to 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 screen containing 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 n,(HL) | Set the appropriate bit in the SRB byte for the leftmost character square that needs refreshing |
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 m,(HL) | Set the appropriate bit in the SRB byte for the rightmost character square that needs refreshing |
26450 | EX DE,HL | Restore the original contents of HL |
26451 | POP DE | Restore the coordinates to DE |
26452 | RET |