Prev: 7301 Up: Map Next: 7349
7302: Slide a message character into the speech bubble text window (2)
Continues from the routine at 740A. Returns with the carry flag set if the speech bubble is off-screen.
Input
A ASCII code of the character
7302 LD E,A E=ASCII code of the character from the message being spoken
7303 LD A,($7F64) Copy the speech bubble lip x-coordinate from 7F64 to A
7306 AND $78 A=x-coordinate of the right edge of the text window within the speech bubble
7308 ADD A,$06
730A LD HL,$7F00 7F00 holds the leftmost column of the skool on screen (0-64)
730D SUB (HL) Return with the carry flag set if the speech bubble is off-screen to the left
730E RET C
730F CP $20 Return with the carry flag set if the speech bubble is off-screen to the right
7311 CCF
7312 RET C
The speech bubble is on screen.
7313 LD C,A C=screen x-coordinate of the right edge of the text window within the speech bubble (6, 14, 22 or 30)
7314 LD A,($7F65) A=y-coordinate of the speech bubble lip
7317 SUB $9A D=screen y-coordinate of the top row of the speech bubble (0-17)
7319 LD D,A
731A RRCA Set HL to the display file address corresponding to the top right edge of the text window within the speech bubble
731B RRCA
731C RRCA
731D AND $E0
731F ADD A,C
7320 LD L,A
7321 LD A,D
7322 AND $18
7324 ADD A,$44
7326 LD H,A
7327 LD D,$D9 C=width (in pixels) of the message character bitmap
7329 LD A,(DE)
732A LD C,A
Now we enter a loop to slide the pixel columns of the message character bitmap into the text window of the speech bubble.
732B INC D A=next pixel column of the message character bitmap
732C LD A,(DE)
732D CALL $7333 Slide this into the speech bubble text window
7330 DEC C Next pixel column
7331 JR NZ,$732B Jump back until all pixel columns are done
7333 PUSH HL Store the display file address temporarily
7334 CALL $7DD8 Slide the top four pixel rows of the text window one pixel to the left
7337 LD B,A Store the message character pixel column in B temporarily
7338 LD A,L Set HL to the display file address corresponding to the fifth pixel row down from the top right edge of the text window within the speech bubble
7339 ADD A,$20
733B LD L,A
733C JR C,$7342
733E LD A,H
733F SUB $08
7341 LD H,A
7342 LD A,B Restore the message character pixel column to A
7343 CALL $7DD8 Slide the bottom four pixel rows of the text window one pixel to the left
7346 POP HL Restore the display file address to HL
7347 XOR A Reset the carry flag
7348 RET
Prev: 7301 Up: Map Next: 7349