Prev: 27143 Up: Map Next: 27272
27144: Make a character speak
The address of this interruptible subcommand routine is placed into bytes 9 and 10 of the character's buffer by the routine at 61533, 61555, 61696, 62032 or 62815.
Input
E Message number
H Character number (200-204, 208)
27144 LD L,11 Store the message number in byte 11 of the character's buffer
27146 LD (HL),E
The address of this entry point is placed into bytes 9 and 10 of EINSTEIN's buffer by the routine at 61440.
27147 LD L,16 Clear bytes 12-16 of the character's buffer, thus removing the addresses of any old (sub)(sub)messages
27149 LD B,5
27151 LD (HL),0
27153 DEC L
27154 DJNZ 27151
27156 LD E,(HL) E=message number
27157 LD D,254 Pick up the address of the message and place it into bytes 11 and 12 of the character's buffer
27159 LD A,(DE)
27160 LD (HL),A
27161 INC D
27162 LD A,(DE)
27163 INC L
27164 LD (HL),A
If somebody else is already speaking, this entry point is used while this character waits his turn to speak.
27165 LD A,(32760) 32760 holds the LSB of the SRB address corresponding to the lip of the speech bubble (or 0 if there is no bubble on-screen)
27168 LD L,9 Place the address of the entry point at 27165 into bytes 9 and 10 of the character's buffer
27170 LD (HL),29
27172 AND A Is anyone else speaking at the moment?
27173 RET NZ Return if so
27174 LD (HL),46 Place the address of the entry point at 27182 into bytes 9 and 10 of the character's buffer
27176 CALL 26958 Print the speech bubble if the character's head is on-screen
27179 RET NC Return if the character's head is on-screen
27180 JR 27205 Otherwise make this routine relinquish control of the character
This entry point is used while the character is speaking.
27182 PUSH HL
27183 CALL 26849 Update the SRB so that the speech bubble is not corrupted
27186 POP HL
27187 JR NC,27202 Jump if the speech bubble is no longer on-screen
27189 EXX Point HL' at the end of the buffer (at 23296) which will contain the speech text graphic data
27190 LD HL,23359
27193 EXX
27194 LD B,2 We scroll the message two letters at a time
27196 CALL 26318 Collect in A the next character code from the message
27199 AND A Has the message finished?
27200 JR NZ,27208 Jump if not
The message has finished, or the speech bubble has been scrolled off the screen. Either way, the character has finished speaking.
27202 CALL 26910 Update the SRB to get rid of the speech bubble
27205 JP 25488 Terminate this interruptible subcommand
The character has not finished speaking.
27208 PUSH BC
27209 CALL 27110 Roll the font character bitmap into the message buffer
27212 POP BC
27213 DJNZ 27196 Jump back until two more letters have been rolled into the buffer
27215 LD L,29 Reset the walk/run bit in byte 29 of the character's buffer to make sure he speaks slowly
27217 RES 7,(HL)
27219 LD A,(32760) Now A=LSB of the address of the SRB byte corresponding to the top line of the speech bubble
27222 SUB 8
27224 LD L,A Set HL to the display file address of the start of the top pixel line of text
27225 RRCA
27226 RRCA
27227 AND 24
27229 ADD A,68
27231 LD H,A
27232 LD A,L
27233 ADD A,A
27234 ADD A,A
27235 ADD A,A
27236 LD L,A
27237 NOP
27238 INC L
27239 LD DE,23298 The speech text graphic data is stored in the 64-byte buffer at 23296
27242 EX DE,HL
27243 CALL 27255 Print the top 4 pixel rows of the text inside the speech bubble
27246 ADD A,32 Set DE to the display file address of the start of the 5th pixel row of text
27248 LD E,A
27249 JR C,27256
27251 LD A,D
27252 SUB 8
27254 LD D,A
27255 LD A,E Save the LSB of the base display file address
27256 LD B,4 4 pixel lines at a time
27258 PUSH BC
27259 LD BC,6 There are 6 character squares inside the speech bubble
27262 LDIR Copy a row of 6 bytes to the screen
27264 INC L Move HL to the start of the next row of pixel data in the message buffer
27265 INC L
27266 LD E,A Restore the LSB of the base display file address
27267 INC D Next pixel row down
27268 POP BC
27269 DJNZ 27258 Jump back until all 4 pixel rows in this half have been copied to the screen
27271 RET
Prev: 27143 Up: Map Next: 27272