Routines

27144: Make character speak


Used by several routines

E Message number
H Character number (183-209)

27144 2E0B LD L,11 Store the message number in byte 11 of the character's buffer
27146 73 LD (HL),E

This entry point is used by the routine at 61440:
27147 2E10 LD L,16
27149 0605 LD B,5
27151 3600 LD (HL),0 Clear bytes 12-16 of the character's buffer
27153 2D DEC L
27154 10FB DJNZ 27151
27156 5E LD E,(HL) E=message number
27157 16FE LD D,254 Pick up the address of the message and place it in bytes 11 and 12 of the character's buffer
27159 1A LD A,(DE)
27160 77 LD (HL),A
27161 14 INC D
27162 1A LD A,(DE)
27163 2C INC L
27164 77 LD (HL),A
27165 3AF87F LD A,(32760)
27168 2E09 LD L,9 Place address 27165 into bytes 9 and 10 of the character's buffer
27170 361D LD (HL),29
27172 A7 AND A Is anyone else speaking at the moment?
27173 C0 RET NZ Return if so
27174 362E LD (HL),46 Put address 27182 in buffer
27176 CD4E69 CALL 26958 Print speech bubble unless character is off-screen
27179 D0 RET NC Return unless character is off-screen
27180 1817 JR 27205
27182 E5 PUSH HL
27183 CDE168 CALL 26849 Update SRB so that speech bubble is not corrupted
27186 E1 POP HL
27187 300D JR NC,27202 Jump if the character has finished speaking
27189 D9 EXX Point HL' at the end of the buffer which will contain the speech text graphic data
27190 213F5B LD HL,23359
27193 D9 EXX
27194 0602 LD B,2 We scroll the message two letters at a time
27196 CDCE66 CALL 26318 Collect in A the next character code from the message
27199 A7 AND A Has the message finished?
27200 2006 JR NZ,27208 Jump if not
27202 CD1E69 CALL 26910 Update SRB to get rid of speech bubble
27205 C39063 JP 25488 Make this routine relinquish control of the character
27208 C5 PUSH BC
27209 CDE669 CALL 27110 Place character set graphic into message buffer
27212 C1 POP BC
27213 10ED DJNZ 27196 Jump back until two more letters have been rolled into the buffer
27215 2E1D LD L,29
27217 CBBE RES 7,(HL)
27219 3AF87F LD A,(32760) Now A=LSB of address of SRB byte corresponding to top line of speech bubble
27222 D608 SUB 8
27224 6F LD L,A
27225 0F RRCA
27226 0F RRCA
27227 E618 AND 24
27229 C644 ADD A,68
27231 67 LD H,A
27232 7D LD A,L
27233 87 ADD A,A
27234 87 ADD A,A
27235 87 ADD A,A
27236 6F LD L,A
27237 00 NOP
27238 2C INC L HL=display file address of start of top pixel line of text
27239 11025B LD DE,23298 The speech text graphic data is stored here
27242 EB EX DE,HL
27243 CD776A CALL 27255 Print the top 4 pixel lines of the text inside the speech bubble
27246 C620 ADD A,32
27248 5F LD E,A
27249 3805 JR C,27256
27251 7A LD A,D
27252 D608 SUB 8
27254 57 LD D,A
27255 7B LD A,E
27256 0604 LD B,4 4 pixel lines at a time
27258 C5 PUSH BC
27259 010600 LD BC,6 6 character squares inside the speech bubble
27262 EDB0 LDIR Copy a line of 6 pixels to the screen
27264 2C INC L
27265 2C INC L
27266 5F LD E,A
27267 14 INC D
27268 C1 POP BC
27269 10F3 DJNZ 27258 Jump back until all 4 pixel lines in this half have been copied
27271 C9 RET