| Routines

7432: Remove the speech bubble

Used by the routines at 799A and 7ED6.
Input
H | Number of the character who is speaking (0x98-0xA9)
7432 | PUSH HL | Save the character number
7433 | CALL $72D2 | Is the speech bubble off-screen?
7436 | JR C,$7477 | Jump if so
7438 | CALL $7427 | Update the SRB for the part of the screen hidden by the speech bubble
First, restore the original attribute bytes for the area of the screen occupied by the speech bubble.
743B | LD DE,($7F64) | Copy the speech bubble lip coordinates from 7F64 to DE
743F | CALL $7087 | Update the SRB for the part of the screen hidden by the lip
7442 | LD HL,$7F00 | 7F00 holds the leftmost column of the skool on screen (0-64)
7445 | LD A,E | E=screen x-coordinate of the speech bubble lip (0-31)
7446 | SUB (HL)
7447 | LD E,A
7448 | LD A,D | A=screen y-coordinate of the speech bubble lip (2-17)
7449 | SUB $98
744B | RRCA | Set DE to the attribute file address corresponding to the lip of the speech bubble
744C | RRCA
744D | RRCA
744E | LD D,A
744F | AND $E0
7451 | ADD A,E
7452 | LD E,A
7453 | LD A,D
7454 | AND $03
7456 | ADD A,$58
7458 | LD D,A
7459 | LD L,$67 | Pick up the attribute byte for the part of screen hidden by the speech bubble lip from 7F67 and restore it to the attribute file
745B | LD A,(HL)
745C | LD (DE),A
745D | EX DE,HL | Point DE at the attribute file address corresponding to the top left corner of the speech bubble
745E | LD BC,$FFC0
7461 | ADD HL,BC
7462 | LD A,L
7463 | AND $F8
7465 | LD L,A
7466 | EX DE,HL
7467 | LD BC,$0008 | Restore the attribute bytes of the part of the screen overwritten by the top row of the speech bubble (stored at 7F78 by the routine at 734E)
746A | LD L,$78
746C | LDIR
746E | LD C,$18 | Point DE at the attribute file address corresponding to the bottom left corner of the speech bubble
7470 | EX DE,HL
7471 | ADD HL,BC
7472 | EX DE,HL
7473 | LD C,$08 | Restore the attribute bytes of the part of the screen overwritten by the bottom row of the speech bubble (stored at 7F80 by the routine at 734E)
7475 | LDIR
Next, restore the skool UDG references and attribute bytes for the area of the skool occupied by the speech bubble.
7477 | LD DE,($7F64) | Copy the speech bubble lip coordinates from 7F64 to DE
747B | LD HL,$7F66 | Pick up the UDG reference for the part of the skool occupied by the speech bubble lip and restore it
747E | LD A,(HL)
747F | INC L
7480 | LD (DE),A
7481 | SET 7,E | Pick up the attribute byte for the part of the skool occupied by the speech bubble lip and restore it
7483 | LD A,(HL)
7484 | INC L
7485 | LD (DE),A
7486 | LD A,E | DE=coordinates of the top left corner of the speech bubble
7487 | AND $78
7489 | DEC D
748A | DEC D
748B | LD E,A
748C | LD BC,$0008 | Restore the UDG references of the part of the skool overwritten by the top row of the speech bubble (stored at 7F68 by the routine at 734E)
748F | LDIR
7491 | INC D | Restore the UDG references of the part of the skool overwritten by the bottom row of the speech bubble (stored at 7F70 by the routine at 734E)
7492 | LD C,$08
7494 | LD E,A
7495 | LDIR
7497 | ADD A,$80 | Point DE at the skool graphic data attribute byte corresponding to the top-left corner of the speech bubble
7499 | LD E,A
749A | DEC D
749B | LD C,$08 | Restore the attribute bytes of the part of the skool overwritten by the top row of the speech bubble (stored at 7F78 by the routine at 734E)
749D | LDIR
749F | INC D | Restore the attribute bytes of the part of the skool overwritten by the bottom row of the speech bubble (stored at 7F80 by the routine at 734E)
74A0 | LD C,$08
74A2 | LD E,A
74A3 | LDIR
Finally, clear the speech bubble lip coordinates (at 7F64) to indicate that no one is speaking.
74A5 | LD ($7F64),BC | Set the speech bubble lip coordinates at to (0,0)
74A9 | POP HL | Restore the speaker's character number to H
74AA | XOR A |
74AB | RET |