![]() |
Routines |
Prev: 26941 | Up: Map | Next: 27109 |
Used by the routine at 27144. Returns with the carry flag set if the character about to speak is off-screen.
|
||||
26958 | LD A,(32767) | B=leftmost column of the play area on screen | ||
26961 | LD B,A | |||
26962 | LD L,1 | Byte 1 holds the character's x-coordinate | ||
26964 | LD A,(HL) | A=x-coordinate of the character's head (and therefore of the speech bubble lip when it's printed) | ||
26965 | INC A | |||
26966 | SUB B | Return with the carry flag set if the character's head is off-screen to the left | ||
26967 | RET C | |||
26968 | CP 32 | Return with the carry flag set if the character's head is off-screen to the right | ||
26970 | CCF | |||
26971 | RET C | |||
26972 | LD C,A | 0<=C<=31 (screen x-coordinate of the character's head) | ||
26973 | AND 7 | Point DE at an entry in the 8-byte table at 57720, whose contents are (128, 64, 32, 16, 8, 4, 2, 1) | ||
26975 | ADD A,120 | |||
26977 | LD E,A | |||
26978 | LD D,225 | |||
26980 | 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 32761 | ||
26981 | LD (32761),A | |||
26984 | LD A,C | A=screen column for lip of speech bubble (0-31) | ||
26985 | RRCA | Set E to 0, 1, 2 or 3 (quarter of the screen in which the bubble will be printed) | ||
26986 | RRCA | |||
26987 | RRCA | |||
26988 | AND 3 | |||
26990 | LD E,A | |||
26991 | LD A,H | A=number of the character about to speak | ||
26992 | INC L | L=2, which byte holds the character's y-coordinate | ||
26993 | CP 208 | A=0 for EINSTEIN, -1 for a teacher | ||
26995 | SBC A,A | |||
26996 | ADD A,(HL) | A=y-coordinate of the lip of the speech bubble | ||
26997 | PUSH HL | |||
26998 | 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 32760 | ||
26999 | ADD A,A | |||
27000 | LD L,A | |||
27001 | ADD A,E | |||
27002 | LD (32760),A | |||
27005 | LD A,B | Put the current column of the play area at the far left of the screen into 32762 for later use by the routine at 26849 | ||
27006 | LD (32762),A | |||
27009 | LD H,11 | HL=attribute file address for the lip of the speech bubble | ||
27011 | ADD HL,HL | |||
27012 | ADD HL,HL | |||
27013 | ADD HL,HL | |||
27014 | LD A,L | |||
27015 | ADD A,C | |||
27016 | LD L,A | |||
27017 | LD DE,39136 | 39136: Lip UDG | ||
27020 | CALL 26941 | Print the lip of the speech bubble | ||
27023 | LD BC,65504 | BC=-32 | ||
27026 | ADD HL,BC | Up a line | ||
27027 | PUSH HL | Store this attribute file address | ||
27028 | LD A,L | HL=attribute file address for the top left corner of the speech bubble | ||
27029 | AND 248 | |||
27031 | LD L,A | |||
27032 | ADD HL,BC | |||
27033 | LD DE,39392 | 39392: Top left corner UDG | ||
27036 | CALL 26941 | Print the top left corner of the speech bubble | ||
27039 | LD C,6 | There are 6 UDGs in the top middle section of the speech bubble | ||
27041 | LD DE,39648 | 39648: Top-middle section UDG | ||
27044 | INC L | |||
27045 | CALL 26941 | Print a top-middle section UDG | ||
27048 | DEC C | |||
27049 | JR NZ,27041 | Jump back until all of the top middle section has been printed | ||
27051 | LD DE,39904 | 39904: Top right corner UDG | ||
27054 | INC L | |||
27055 | CALL 26941 | Print the top right corner of the speech bubble | ||
27058 | LD C,25 | HL=attribute file address for bottom left corner of speech bubble | ||
27060 | ADD HL,BC | |||
27061 | LD DE,40160 | 40160: Bottom left corner UDG | ||
27064 | CALL 26941 | Print the bottom left corner of the speech bubble | ||
27067 | LD C,6 | There are 6 UDGs in the bottom middle section of the speech bubble | ||
27069 | LD DE,40416 | 40416: Bottom-middle section UDG | ||
27072 | INC L | |||
27073 | CALL 26941 | Print a bottom-middle section UDG | ||
27076 | DEC C | |||
27077 | JR NZ,27069 | Jump back until all of the bottom middle section has been printed | ||
27079 | INC L | |||
27080 | LD DE,40672 | 40672: Bottom right corner UDG | ||
27083 | CALL 26941 | Print the bottom right corner of the speech bubble | ||
27086 | POP HL | Retrieve the attribute file address for the spot above the lip of the speech bubble | ||
27087 | LD A,H | Set HL to the address of the bottom pixel line of the character square above the lip | ||
27088 | AND 11 | |||
27090 | ADD A,A | |||
27091 | ADD A,A | |||
27092 | ADD A,A | |||
27093 | ADD A,7 | |||
27095 | LD H,A | |||
27096 | LD (HL),66 | 'Open' the part above the lip (previously closed by a middle section UDG) | ||
27098 | LD HL,23360 | Clear the 64 bytes from 23296 to 23359 (which will be used as a buffer for the speech text graphic data by the routine at 27144) | ||
27101 | DEC L | |||
27102 | LD (HL),0 | |||
27104 | JR NZ,27101 | |||
27106 | POP HL | Restore the character number to H | ||
27107 | AND A | Return with the carry flag reset to signal that the speech bubble has been printed | ||
27108 | RET |
Prev: 26941 | Up: Map | Next: 27109 |