Routines

26380: Update SRB for blackboard


Used by routines at 26513 and 26639

D y-coordinate of point requiring refresh
E x-coordinate of point requiring refresh

26380 3AFF7F LD A,(32767) A=column of play area at far left of screen
26383 D602 SUB 2
26385 3802 JR C,26389
26387 BB CP E
26388 D0 RET NC Return if the point requiring refresh is off-screen to the left
26389 C621 ADD A,33 A=column of play area at far right of screen
26391 BB CP E
26392 D8 RET C Return if the point requiring refresh is off-screen to the right
26393 D5 PUSH DE
26394 D620 SUB 32
26396 2F CPL
26397 83 ADD A,E
26398 CB7F BIT 7,A
26400 2801 JR Z,26403
26402 3C INC A
26403 07 RLCA
26404 07 RLCA
26405 07 RLCA
26406 5F LD E,A
26407 E638 AND 56
26409 2F CPL
26410 3D DEC A
26411 323D67 LD (26429),A
26414 F5 PUSH AF
26415 7B LD A,E
26416 07 RLCA
26417 07 RLCA
26418 E603 AND 3
26420 82 ADD A,D
26421 82 ADD A,D
26422 82 ADD A,D
26423 82 ADD A,D
26424 5F LD E,A
26425 167F LD D,127
26427 EB EX DE,HL HL=appropriate byte of SRB
26428 CBx SET n,(HL) n=((26429)–198)/8
26430 F1 POP AF
26431 C638 ADD A,56
26433 3808 JR C,26443 Jump if we've just set bit 0 of an SRB byte
26435 2C INC L Next SRB byte
26436 7D LD A,L Does this SRB byte correspond to the first byte of the next row of the screen?
26437 E603 AND 3
26439 2809 JR Z,26450 If so, skip it
26441 3EFE LD A,254 Otherwise set bit 7 in this SRB byte
26443 F6C0 OR 192
26445 325167 LD (26449),A
26448 CBx SET m,(HL) m=((26449)–198)/8=(n–1)%8
26450 EB EX DE,HL
26451 D1 POP DE
26452 C9 RET