Routines |
Prev: 693D | Up: Map | Next: 69E5 |
Used by the routine at 6A08. Returns with the carry flag set if the character about to speak is off-screen.
|
||||||||
694E | LD A,($7FFF) | B=leftmost column of the play area on screen | ||||||
6951 | LD B,A | |||||||
6952 | LD L,$01 | Byte 0x01 holds the character's x-coordinate | ||||||
6954 | LD A,(HL) | A=x-coordinate of the character's head (and therefore of the speech bubble lip when it's printed) | ||||||
6955 | INC A | |||||||
6956 | SUB B | Return with the carry flag set if the character's head is off-screen to the left | ||||||
6957 | RET C | |||||||
6958 | CP $20 | Return with the carry flag set if the character's head is off-screen to the right | ||||||
695A | CCF | |||||||
695B | RET C | |||||||
695C | LD C,A | 0<=C<=31 (screen x-coordinate of the character's head) | ||||||
695D | AND $07 | Point DE at an entry in the 8-byte table at E178, whose contents are (0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01) | ||||||
695F | ADD A,$78 | |||||||
6961 | LD E,A | |||||||
6962 | LD D,$E1 | |||||||
6964 | LD A,(DE) | The bit set in A corresponds to the bit that needs to be set in the SRB byte for the lip of the speech bubble; store it in 7FF9 | ||||||
6965 | LD ($7FF9),A | |||||||
6968 | LD A,C | A=screen column for lip of speech bubble (0-31) | ||||||
6969 | RRCA | Set E to 0, 1, 2 or 3 (quarter of the screen in which the bubble will be printed) | ||||||
696A | RRCA | |||||||
696B | RRCA | |||||||
696C | AND $03 | |||||||
696E | LD E,A | |||||||
696F | LD A,H | A=number of the character about to speak | ||||||
6970 | INC L | L=2, which byte holds the character's y-coordinate | ||||||
6971 | CP $D0 | A=0 for EINSTEIN, -1 for a teacher | ||||||
6973 | SBC A,A | |||||||
6974 | ADD A,(HL) | A=y-coordinate of the lip of the speech bubble | ||||||
6975 | PUSH HL | |||||||
6976 | ADD A,A | Compute the LSB of the address of the SRB byte corresponding to the location of the speech bubble lip and store it in 7FF8 | ||||||
6977 | ADD A,A | |||||||
6978 | LD L,A | |||||||
6979 | ADD A,E | |||||||
697A | LD ($7FF8),A | |||||||
697D | LD A,B | Put the current column of the play area at the far left of the screen into 7FFA for later use by the routine at 68E1 | ||||||
697E | LD ($7FFA),A | |||||||
6981 | LD H,$0B | HL=attribute file address for the lip of the speech bubble | ||||||
6983 | ADD HL,HL | |||||||
6984 | ADD HL,HL | |||||||
6985 | ADD HL,HL | |||||||
6986 | LD A,L | |||||||
6987 | ADD A,C | |||||||
6988 | LD L,A | |||||||
6989 | LD DE,$98E0 | 98E0: Lip UDG | ||||||
698C | CALL $693D | Print the lip of the speech bubble | ||||||
698F | LD BC,$FFE0 | BC=-32 | ||||||
6992 | ADD HL,BC | Up a line | ||||||
6993 | PUSH HL | Store this attribute file address | ||||||
6994 | LD A,L | HL=attribute file address for the top left corner of the speech bubble | ||||||
6995 | AND $F8 | |||||||
6997 | LD L,A | |||||||
6998 | ADD HL,BC | |||||||
6999 | LD DE,$99E0 | 99E0: Top left corner UDG | ||||||
699C | CALL $693D | Print the top left corner of the speech bubble | ||||||
699F | LD C,$06 | There are 6 UDGs in the top middle section of the speech bubble | ||||||
69A1 | LD DE,$9AE0 | 9AE0: Top-middle section UDG | ||||||
69A4 | INC L | |||||||
69A5 | CALL $693D | Print a top-middle section UDG | ||||||
69A8 | DEC C | |||||||
69A9 | JR NZ,$69A1 | Jump back until all of the top middle section has been printed | ||||||
69AB | LD DE,$9BE0 | 9BE0: Top right corner UDG | ||||||
69AE | INC L | |||||||
69AF | CALL $693D | Print the top right corner of the speech bubble | ||||||
69B2 | LD C,$19 | HL=attribute file address for bottom left corner of speech bubble | ||||||
69B4 | ADD HL,BC | |||||||
69B5 | LD DE,$9CE0 | 9CE0: Bottom left corner UDG | ||||||
69B8 | CALL $693D | Print the bottom left corner of the speech bubble | ||||||
69BB | LD C,$06 | There are 6 UDGs in the bottom middle section of the speech bubble | ||||||
69BD | LD DE,$9DE0 | 9DE0: Bottom-middle section UDG | ||||||
69C0 | INC L | |||||||
69C1 | CALL $693D | Print a bottom-middle section UDG | ||||||
69C4 | DEC C | |||||||
69C5 | JR NZ,$69BD | Jump back until all of the bottom middle section has been printed | ||||||
69C7 | INC L | |||||||
69C8 | LD DE,$9EE0 | 9EE0: Bottom right corner UDG | ||||||
69CB | CALL $693D | Print the bottom right corner of the speech bubble | ||||||
69CE | POP HL | Retrieve the attribute file address for the spot above the lip of the speech bubble | ||||||
69CF | LD A,H | Set HL to the address of the bottom pixel line of the character square above the lip | ||||||
69D0 | AND $0B | |||||||
69D2 | ADD A,A | |||||||
69D3 | ADD A,A | |||||||
69D4 | ADD A,A | |||||||
69D5 | ADD A,$07 | |||||||
69D7 | LD H,A | |||||||
69D8 | LD (HL),$42 | 'Open' the part above the lip (previously closed by a middle section UDG) | ||||||
69DA | LD HL,$5B40 | Clear the first 64 bytes at 5B00 (which will be used as a buffer for the speech text graphic data by the routine at 6A08) | ||||||
69DD | DEC L | |||||||
69DE | LD (HL),$00 | |||||||
69E0 | JR NZ,$69DD | |||||||
69E2 | POP HL | Restore the character number to H | ||||||
69E3 | AND A | Return with the carry flag reset to signal that the speech bubble has been printed | ||||||
69E4 | RET |
Prev: 693D | Up: Map | Next: 69E5 |