Prev: $108A Up: Map Next: $1129
$108B: Get the next character of a message being spoken or written
This corresponds to $70D2 in the ZX Spectrum version.
Used by the routines at $1129 and $246B.
Output
A Code of the next character
$108B LDY #$00 Prepare Y for indexed addressing.
$108D LDA $AF Is there a submessage address at $AE?
$108F BEQ $10A2 Branch if not.
$1091 LDA ($AE),Y Pick up the next character from the submessage.
$1093 INC $AE Increment the submessage address at $AE.
$1095 BNE $1099
$1097 INC $AF
$1099 CMP #$00 Is the submessage finished?
$109B BEQ $10A0 Branch if so.
$109D JMP $1128 Otherwise return.
$10A0 STY $AF Clear the submessage address from $AE.
$10A2 LDA ($AC),Y Pick up the next character from the message.
$10A4 INC $AC Increment the message address at $AC.
$10A6 BNE $10AA
$10A8 INC $AD
$10AA CMP #$80 Is the character code $80 or greater?
$10AC BCS $10B2 Branch if so.
$10AE CMP #$20 Is the character code between $20 and $7F?
$10B0 BCS $1128 Return if so.
$10B2 CMP #$10 Is the character code less than $10?
$10B4 BCC $1128 Return if so.
$10B6 PHA Save the character code ($11-$1F, $80-$FF) temporarily.
$10B7 CMP #$80 Is the character code $80 or greater?
$10B9 BCS $10EE Branch if so.
$10BB CMP #$18 Is the character code between $18 and $1F?
$10BD BCS $10CA Branch if so.
$10BF LDA #$47 The character names are stored at intervals of $0E from $4780 onwards. Store this base address at $1D.
$10C1 STA $1E
$10C3 LDA #$80
$10C5 STA $1D
$10C7 JMP $10D6 Jump forward.
$10CA LDA #$47 Store $47F0 (Please Sir - I cannot tell a lie . .) at $1D.
$10CC STA $1E
$10CE LDA #$F0
$10D0 STA $1D
$10D2 PLA Restore the character code ($18-$1F) to A.
$10D3 JMP $111D Jump forward with submessage address $47F0 at $1D.
$10D6 PLA Restore the character code ($11-$17) to A.
$10D7 AND #$EF Clear bit 4.
$10D9 ASL A Multiply A by 14.
$10DA STA $57
$10DC ASL A
$10DD STA $56
$10DF ASL A
$10E0 CLC
$10E1 ADC $56
$10E3 CLC
$10E4 ADC $57
$10E6 CLC Add A to the address stored at $1D.
$10E7 ADC $1D
$10E9 STA $1D
$10EB JMP $111D Jump forward with this character name submessage address at $1D.
$10EE LDA #$4D Initialise the MSB of the submessage address to $4D.
$10F0 STA $1E
$10F2 PLA Restore the character code ($80-$FF) to A.
$10F3 AND #$7F Clear bit 7.
$10F5 CMP #$16 Is the character code now less than $16?
$10F7 BCC $1113 Branch if so with the MSB equal to $4D.
$10F9 INC $1E Set the MSB of the submessage address to $4E if the character code is between $16 and $2A, $4F if the character code is between $2B and $3F, $50 if the character code is between $40 and $55, $51 if the character code is between $56 and $6A, or $52 if the character code is greater than $6B.
$10FB CMP #$2B
$10FD BCC $1113
$10FF INC $1E
$1101 CMP #$40
$1103 BCC $1113
$1105 INC $1E
$1107 CMP #$56
$1109 BCC $1113
$110B INC $1E
$110D CMP #$6B
$110F BCC $1113
$1111 INC $1E
$1113 ASL A Multiply A by 12. The result is the LSB of the submessage address.
$1114 ASL A
$1115 STA $57
$1117 ASL A
$1118 CLC
$1119 ADC $57
$111B STA $1D Store the LSB at $1D.
$111D LDA $1D Copy the submessage address from $1D to $AE.
$111F STA $AE
$1121 LDA $1E
$1123 STA $AF
$1125 JMP $1091 Jump back to pick up the first character from the submessage.
$1128 RTS
Prev: $108A Up: Map Next: $1129