Prev: 7349 Up: Map Next: 7400
734E: Print the speech bubble
Used by the routine at 7986. Returns with the carry flag set if the character about to speak is off-screen. Returns with the zero flag reset if somebody else is speaking at the moment.
Input
H Number of the character about to speak (0x98-0xA9)
734E LD A,($7F00) A=leftmost column of the skool on screen (0-64)
7351 LD B,A
7352 LD L,$62 Byte 0x62 of a character's buffer holds his x-coordinate
7354 LD A,(HL) Pick this up in A
7355 INC A Return with the carry flag set if the character is off-screen to the left
7356 LD E,A
7357 SUB B
7358 RET C
7359 CP $20 Return with the carry flag set if the character is off-screen to the right
735B CCF
735C RET C
735D LD C,A C=screen x-coordinate (0-31) of the spot above the character's head (where the speech bubble lip will be)
735E LD A,($7F65) A=current speech bubble lip x-coordinate (if any)
7361 AND A Is somebody else speaking at the moment?
7362 RET NZ Return with the zero flag reset if so
The character is on-screen and no one else is speaking at the moment.
7363 LD L,$60
7365 LD A,H A=character number (0x98-0xA9)
7366 INC L L=0x61
7367 CP $A7 Set the carry flag unless EINSTEIN is the speaker
7369 SBC A,A A=0x00 if EINSTEIN is speaking, 0xFF otherwise
736A ADD A,(HL) D=y if EINSTEIN is speaking, y-1 otherwise (where y is the speaker's y-coordinate)
736B LD D,A
736C LD ($7F64),DE Store the speech bubble lip coordinates at 7F64
7370 SUB $98 Get the attribute file address of the speech bubble lip in BC
7372 RRCA
7373 RRCA
7374 RRCA
7375 LD B,A
7376 AND $E0
7378 ADD A,C
7379 LD C,A
737A LD A,B
737B AND $03
737D ADD A,$58
737F LD B,A
7380 LD A,(DE) A=UDG reference of the character square under the speech bubble lip
7381 LD ($7F66),A Store this in 7F66
7384 LD A,$EF 0xEF=UDG reference for the speech bubble lip
7386 LD (DE),A Replace the skool UDG with the speech bubble lip UDG
7387 SET 7,E Pick up the skool attribute byte of the character square under the speech bubble lip and store it in 7F67
7389 LD A,(DE)
738A LD ($7F67),A
738D LD A,$38 0x38=PAPER 7: INK 0
738F LD (DE),A Replace the skool attribute byte
7390 LD (BC),A Set the new attribute on-screen
The skool UDG reference and attribute byte for the location of the speech bubble lip have been adjusted. Now for the speech bubble itself.
7391 LD A,E Get the x-coordinate of the left edge of the speech bubble in E
7392 AND $78
7394 LD E,A
7395 DEC D The speech bubble is two character squares high
7396 DEC D
7397 PUSH HL
7398 LD HL,$FFC0 Set HL to the attribute file address for the top-left corner of the speech bubble
739B ADD HL,BC
739C LD A,L
739D AND $F8
739F LD L,A
73A0 LD B,$08 Fill in the top row of 8 character squares with the speech bubble attribute (0x38=PAPER 7: INK 0)
73A2 LD (HL),$38
73A4 INC HL
73A5 DJNZ $73A2
73A7 LD C,$18 Set HL to the attribute file address for the bottom-left corner of the speech bubble
73A9 ADD HL,BC
73AA LD B,$08 Fill in the bottom row of 8 character squares with the speech bubble attribute (0x38=PAPER 7: INK 0)
73AC LD (HL),$38
73AE INC L
73AF DJNZ $73AC
73B1 LD HL,$7F68 Store the UDG references for the part of the skool that will be overwritten by the top row of the speech bubble at 7F68
73B4 EX DE,HL
73B5 LD A,L
73B6 LD C,$08
73B8 LDIR
73BA LD L,A Replace the 8 UDG references for the part of the skool that will be overwritten by the top row of the speech bubble with the appropriate speech bubble UDG references (0xF0-0xF7)
73BB LD BC,$08F0
73BE LD (HL),C
73BF INC L
73C0 INC C
73C1 DJNZ $73BE
73C3 LD L,A Store the UDG references for the part of the skool that will be overwritten by the bottom row of the speech bubble at 7F70
73C4 INC H
73C5 LD C,$08
73C7 LDIR
73C9 LD L,A Replace the 8 UDG references for the part of the skool that will be overwritten by the bottom row of the speech bubble with the appropriate speech bubble UDG references (0xF8-0xFF)
73CA LD BC,$08F8
73CD LD (HL),C
73CE INC L
73CF INC C
73D0 DJNZ $73CD
73D2 ADD A,$80 Store the 8 attribute bytes for the part of the skool that will be overwritten by the top row of the speech bubble at 7F78
73D4 LD L,A
73D5 LD C,$08
73D7 DEC H
73D8 LDIR
73DA LD L,A Replace the 8 attribute bytes for the part of the skool that will be overwritten by the top row of the speech bubble with the appropriate speech bubble attribute byte (C=0x38=PAPER 7: INK 0)
73DB LD BC,$0838
73DE LD (HL),C
73DF INC L
73E0 DJNZ $73DE
73E2 LD L,A Store the 8 attribute bytes for the part of the skool that will be overwritten by the bottom row of the speech bubble at 7F80
73E3 LD C,$08
73E5 INC H
73E6 LDIR
73E8 LD L,A Replace the 8 attribute bytes for the part of the skool that will be overwritten by the bottom row of the speech bubble with the appropriate speech bubble attribute byte (C=0x38=PAPER 7: INK 0)
73E9 LD BC,$0838
73EC LD (HL),C
73ED INC L
73EE DJNZ $73EC
73F0 LD DE,($7F64) Copy the speech bubble lip coordinates from 7F64 to DE
73F4 CALL $7087 Update the SRB for the lip of speech bubble
73F7 CALL $F4FA Open the lip of the speech bubble
73FA CALL $7427 Update the SRB for the speech bubble
73FD POP HL
73FE INC A Set the zero flag
73FF RET Return with the zero flag set to indicate success
Prev: 7349 Up: Map Next: 7400