Prev: 29441 Up: Map Next: 29513
29442: Slide a message character into the speech bubble text window (2)
Continues from the routine at 29706. Returns with the carry flag set if the speech bubble is off-screen.
Input
A ASCII code of the character
29442 LD E,A E=ASCII code of the character from the message being spoken
29443 LD A,(32612) Copy the speech bubble lip x-coordinate from 32612 to A
29446 AND 120 A=x-coordinate of the right edge of the text window within the speech bubble
29448 ADD A,6
29450 LD HL,32512 32512 holds the leftmost column of the skool on screen (0-64)
29453 SUB (HL) Return with the carry flag set if the speech bubble is off-screen to the left
29454 RET C
29455 CP 32 Return with the carry flag set if the speech bubble is off-screen to the right
29457 CCF
29458 RET C
The speech bubble is on screen.
29459 LD C,A C=screen x-coordinate of the right edge of the text window within the speech bubble (6, 14, 22 or 30)
29460 LD A,(32613) A=y-coordinate of the speech bubble lip
29463 SUB 154 D=screen y-coordinate of the top row of the speech bubble (0-17)
29465 LD D,A
29466 RRCA Set HL to the display file address corresponding to the top right edge of the text window within the speech bubble
29467 RRCA
29468 RRCA
29469 AND 224
29471 ADD A,C
29472 LD L,A
29473 LD A,D
29474 AND 24
29476 ADD A,68
29478 LD H,A
29479 LD D,217 C=width (in pixels) of the message character bitmap
29481 LD A,(DE)
29482 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.
29483 INC D A=next pixel column of the message character bitmap
29484 LD A,(DE)
29485 CALL 29491 Slide this into the speech bubble text window
29488 DEC C Next pixel column
29489 JR NZ,29483 Jump back until all pixel columns are done
29491 PUSH HL Store the display file address temporarily
29492 CALL 32216 Slide the top four pixel rows of the text window one pixel to the left
29495 LD B,A Store the message character pixel column in B temporarily
29496 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
29497 ADD A,32
29499 LD L,A
29500 JR C,29506
29502 LD A,H
29503 SUB 8
29505 LD H,A
29506 LD A,B Restore the message character pixel column to A
29507 CALL 32216 Slide the bottom four pixel rows of the text window one pixel to the left
29510 POP HL Restore the display file address to HL
29511 XOR A Reset the carry flag
29512 RET
Prev: 29441 Up: Map Next: 29513