; *****************************************************
; * Disassembled ROM of the Magic Voice Speech Module *
; *****************************************************

; WARNING: This disassembly is distributed in the hope that it will be useful.
;          It may contain errors and is provided "as is" without warranty of any kind.
;          The entire risk as to the quality and correctness of the disassembly is with you.

; Disassembly by Stefan Uhlmann 2006-2013
; Last change: 3. Feb 2013 , 17:52:21
; Download at: http://www.stefan-uhlmann.de/cbm/MVM/
; Filename:   Disassembled_ROM_of_the_Magic_Voice_Speech_Module.zip
;           = Disassembled_ROM_of_the_Magic_Voice_Speech_Module.txt

; Notes:
; ------

; A) Use ??? Assembler: currently text only!

; B) This disassembly file contains EVERY BIT that is in the 16K-EPROM (EXROM) of the Magic Voice Module
;    but additional some more bytes, because the module switches between C64-ROM, C64-RAM and EXROM (Eprom)

; C) Comments like "Eprom: $XXXX" indicate the corresponding address of the binary file (raw eprom data)

; D) Since the software of the Magic Voice Speech Module is very similar (practically identical) to the
;    firmware rom of the Commodore V364, you will find comments like "V364: $XXXX" to indicate the corresponding
;    address of the V364. Comments like "V364-Eprom: $XXXX" indicate the corresponding address of the
;    binary file (raw eprom data)

; E) Other (unfinished) disassemblies:
;    - Magic Voice: Richard Atkinson, http://www.atkinsoft.com
;    - V364: Attila Grosz, http://yape.homeserver.hu


; Hints:
; ------

; - Programm starts after Reset at $FFD3
;   copies programcode from $FF36-$FFD2 to $0200-$029C (157 bytes)
; - Programm continues at $021A
;   copies $A000-$BFFF from EPROM to RAM at $A000-$BFFF, 8KB
;   copies $E000-$FFFF from EPROM to RAM at $E000-$FFFF, 8KB
;   copies $AE62-$B461 from RAM   to RAM at $C000-$C5FF (Magic Voice Code)
; - Jump to beginning of Magic Voice code at $C000


; Subroutines:
; ------------

; A001 - INIT_VOICE_SYNTHESIZER
; A03E - SAY_ROMDATA
; A059 - SAY_RAMDATA
; A125 - HANDLE_EOS_OR_DIR_INTERRUPT
; A149 - WRITE_COMMAND_TO_VOICE_SYNTHESIZER
; A154 - CONVERT_SPEECHDATA_TO_T6721
; A166 - SET_ADRESSLINES_FOR_EXROM
; A185 - READ_BYTE_FROM_MEMORY_AND_INC_POINTER_FBFC
; A1B6 - READ_SYNTHESIZER_STATUS
; A1D8 - WRITE_SPEECHDATA_TO_VOICE_SYNTHESIZER
; A1FF - INIT_SPEECHDATA_BUFFER_T6721
; (A21E - Subroutine A154 - CONVERT_SPEECHDATA_TO_T6721 continued)
; A3AF - FETCH_UNPACKED_PARAMETER

; C018 - COMPLETION_CODE
; C01B - SRESET
; C039 - SPSTAT
; C047 - MAGIC_VOICE_NMI
; C07E - SPEED
; C082 - SAYIT
; C085 - SAYRAM
; C09F - SIGNAL
; C0A3 - SETTAB
; C0AA - TURN_OFF_INTERRUPTS_AND_BASIC
; C0C7 - TURN_ON_BASIC

; 0200 - COPY_EPROM_TO_RAM
; 021A - INITIALIZE_SPEECHMODULE_AND_C64


; Other Routines:
; ---------------

; C0DC - STARTUP
; C111 - Magic Voice, BASIC Character dispatch Routine
; C1E6 - Magic Voice, BASIC_COMMAND_SAY
; C22F - Magic Voice, BASIC_GET_WORDNUMBER_FROM_WORDSTRING
; C279 - Magic Voice, BASIC Tokenise Routine
; C358 - Magic Voice, BASIC LIST Routine
; C38E - Magic Voice, BASIC Token evaluation

; FFD3 - RESET_VECTOR
; FFF9 - NMI_AND_IRQ_VECTOR

; Memory:
; -------

; C3C6 .. C3E3 - Data/Variables
; C3E4 .. C3EF - SPEECHDATA_BUFFER_RAW
; C3F0 .. C3FF - SPEECHDATA_BUFFER_T6721


; Data Tables:
; ------------

; A3EC .. A3FF -                          20 Bytes
; A400 .. A44F - JSR + Data , 3 +  77 =   80 Bytes , Call FETCH_UNPACKED_PARAMETER
; A450 .. A471 - JSR + Data , 3 +  31 =   34 Bytes , Call FETCH_UNPACKED_PARAMETER
; A472 .. A492 - JSR + Data , 3 +  30 =   33 Bytes , Call FETCH_UNPACKED_PARAMETER
; A493 .. A4AF - JSR + Data , 3 +  26 =   29 Bytes , Call FETCH_UNPACKED_PARAMETER
; A4B0 .. A584 - JSR + Data , 3 + 210 =  213 Bytes , Call FETCH_UNPACKED_PARAMETER
; A585 .. AE11 -                        2189 Bytes
; AE12 .. AE61 -                          80 Bytes

; B240 .. - Speech Data Table Header
; B244 .. - Speech Data Look-Up Table
; B41A .. - Speech Word Tokens
; B5F2 .. - Speech Data


; $00 6510 Data Direction Register (xx101111)
; Bit=1: Output, Bit=0: Input, x=Don't Care

; $01 6510 On-Chip Port - [-/-][-/-][Cass Motor][Cass Switch][Cass DOut][/CHAREN][/HIRAM][/LORAM]
; BIT  IN/OUT  Function
;  0    OUT     /LORAM Signal (0=Switch BASIC ROM Out)
;  1    OUT     /HIRAM Signal (0=Switch KERNEL ROM Out)
;  2    OUT     /CHAREN Signal (O=Swith Char. ROM In)
;  3    OUT     Cassette Data Output Line
;  4    IN      Cassette Switch Sense: 1 = Switch Closed
;  5    OUT     Cassette Motor Control O = ON, 1 = OFF
;  6    x       Undefined
;  7    x       Undefined
; Default: Dez 55 = 00110111

; BIT: Bit7 = Neg.-Flag , Bit6 = Ovl.-Flag , #$0 = Zero-Flag


; ************************
; * START of Disassembly *
; ************************

; ------------
; Eprom: $0000

A000    EA          NOP                 ; No Operation


; ----------------------------------------
; $A001 Subroutine: INIT_VOICE_SYNTHESIZER
; ----------------------------------------
; FUNCTION:
;  This routine initializes the voice synthesizer
; 
; INPUT:
;  nothing
;
; OUTPUT:
;  nothing
;
; DESTROYS:
;
;
; CALLS:
;  - $A149 , WRITE_COMMAND_TO_VOICE_SYNTHESIZER
;  - $A166 , SET_ADRESSLINES_FOR_EXROM
;  - $A1D8 , WRITE_SPEECHDATA_TO_VOICE_SYNTHESIZER
;
; CALLED FROM:
; - $C222 , in Sub $C1E6 - Magic Voice, BASIC_COMMAND_SAY
;
; INFO:

                    ; wait until /EOS is high
.Branch_A001
A001    2C 80 DF    BIT $DF80           ; 6525 Port A - IN:[DIR][/EOS][/GAME] OUT:[SI][D3][D2][D1][D0]       <------
A004    50 FB       BVC .Branch_A001    ; Branch if /EOS is (still) low, max. one frame length (wait)        >------

A006    A0 00       LDY #$00            ; %0000 0000, and Y=0 as counter
A008    8C 80 DF    STY $DF80           ; 6525 Port A - IN:[DIR][/EOS][/GAME] OUT:[SI][D3][D2][D1][D0]

                    ; Loop, write 9 Nibbles (Stop/Reset, Speed, Condition 1 and 2)
.Branch0_A00B
A00B    B9 E3 A3    LDA $A3E3,Y         ; Instructions and Data for the Voice Synthesizer          <------
A00E    29 0F       AND #$0F            ; %0000 1111 Mask Nibble (for safety only)                        |
A010    20 49 A1    JSR .Jump0_A149     ; Call WRITE_COMMAND_TO_VOICE_SYNTHESIZER                         |
A013    C8          INY                 ; Y = Y + 1                                                       |
A014    C0 09       CPY #$09            ; Compare Y=9                                                     |
A016    D0 F3       BNE .Branch0_A00B   ; Loop, write 9 Nibbles                                    >------

                    ;
A018    84 FD       STY $FD             ; $FD = Y = 9
A01A    A0 00       LDY #$00            ; Y = 0
A01C    20 66 A1    JSR .Jump1_A166     ; Call SET_ADRESSLINES_FOR_EXROM
A01F    20 D8 A1    JSR .Jump2_A1D8     ; Call WRITE_SPEECHDATA_TO_VOICE_SYNTHESIZER

                    ;
A022    AD 81 DF    LDA $DF81           ; 6525 Port B - IN:[/EXROM] OUT:[?][?][/WR][D3][D2][D1][D0]  , Read Data
A025    29 0F       AND #$0F            ; %0000 1111 -> 0000 xxxx
A027    09 30       ORA #$30            ; %0011 0000 -> 0011 xxxx  EXROM
A029    AA          TAX                 ; Transfer A to X                                            , Save in X

                    ; This command starts the speech(synth)
A02A    A9 01       LDA #$01            ; A = 1, #$01 = START
A02C    20 49 A1    JSR .Jump0_A149     ; Call WRITE_COMMAND_TO_VOICE_SYNTHESIZER

                    ; 
A02F    A9 00       LDA #$00            ; A=0, %0000 0000
A031    8D 82 DF    STA $DF82           ; 6525 Handshake and Interrupt Latches - OUT:[/EXROM][?][/NMI] IN:[-][DIR][EOS][-][-]
A034    8D E3 C3    STA $C3E3           ; $C3E3 = #$00
A037    AD 87 DF    LDA $DF87           ; 6525 Active Interrupt Register - [-][-][-][0][DIR][EOS][0][0]

A03A    8E 81 DF    STX $DF81           ; 6525 Port B - IN:[/EXROM] OUT:[?][?][/WR][D3][D2][D1][D0] , Write Data
A03D    60          RTS                 ; Return
        ;_______________________________


; -----------------------------
; $A03E Subroutine: SAY_ROMDATA
; -----------------------------
; FUNCTION:
;  If the Word-Number is greater than 255 (=located in the user's program space)
;  the Flags EXROM (Bit 7) and ??? (Bit 6) in the Counting Semaphore are set.
; 
; INPUT:
;  $BE = Word-Number MSB (Bit7 may be set or not)
;
; OUTPUT:
;  $BE = Word-Number MSB (Bit7 cleared if it was set)
;  $C3E2 = Word No. > 255 then %0011 0000 or %1011 0000
;
; DESTROYS:
;
; CALLS:
;
; CALLED FROM:
;  - $C096 , in Sub $C085 - SAYRAM - Say A Word From RAM
;  - $C206 , in Sub $C1E6 - Magic Voice, BASIC_COMMAND_SAY
;
; INFO:
;  $BE is the MSB of the Word-Number, Bit7 may be 0 or 1, after this Subroutine Bit7 in $BE is always cleared
;  If Bit7 was 1 then A=#$30 (48Dez), If Bit7 was 0 then A=#$B0 (176Dez = 48Dez with Bit7=1)
;  Words number 0 through 255 are words which are in the speech module.
;  Words number 256 through 4095 are interpreted as located in the user's program space.

A03E    A9 30       LDA #$30            ; A=48 , %0011 0000
A040    A4 BE       LDY $BE             ; Word-Number MSB
A042    F0 14       BEQ .Branch1_A058   ; 0? If Word-Number is <= 255 Then -> Return                         >------
;                                                                                                                   |
A044    30 02       BMI .Branch2_A048   ; Bit7=1?                                                       >------     |
A046    09 80       ORA #$80            ; A: %1000 0000 -> 1011 0000                                           |    |
;                                                                                                              |    |
.Branch2_A048       ;                                                                                          |    |
A048    8D E2 C3    STA $C3E2           ; , = #$30 or #$B0 if Word-Number MSB with Bit7=1 was not set   <------     |
;                                                                                                                   |
A04B    AD DB C3    LDA $C3DB           ; %1100 0000 -> 11xx xxxx                                                   |
A04E    09 C0       ORA #$C0            ; Set Flags EXROM and ???                                                   |
A050    8D DB C3    STA $C3DB           ;                         in Counting Semaphore                             |
                                        ; Flags are cleared after END_OF_SPEECH                                     |
;                                                                                                                   |
A053    98          TYA                 ; Transfer Y to A (Y was loaded with Word-Number MSB)                       |
A054    29 7F       AND #$7F            ; %0111 1111 -> 0xxx xxxx                                                   |
A056    85 BE       STA $BE             ; Word-Number MSB, always Clear Bit 7                                       |
;                                                                                                                   |
.Branch1_A058       ;                                                                                               |
A058    60          RTS                 ; Return                                                             <------
        ;_______________________________


; -----------------------------
; $A059 Subroutine: SAY_RAMDATA
; -----------------------------
; FUNCTION:
;  Copies the Pointer to the Utterance Look Up Table Address (ROM or RAM) to $FB/$FC Active Utterance Look Up Table Address
;  Reads first byte of speechdata (synthesizer conditions) and initializes the SPEECHDATA_BUFFER_T6721
;
; INPUT:
;  $BE = Word-Number MSB
;
; OUTPUT:
;  
; DESTROYS:
;  
; CALLS:
;  - , SET_ADRESSLINES_FOR_EXROM
;  - , READ_BYTE_FROM_MEMORY_AND_INC_POINTER_FBFC
;  - , READ_SYNTHESIZER_STATUS
;  - , INIT_SPEECHDATA_BUFFER_T6721
;
; CALLED FROM:
;  - $C099 , in Sub $C085 - SAYRAM - Say A Word From RAM
;  - $C209 , in Sub $C1E6 - Magic Voice, BASIC_COMMAND_SAY
;
; INFO:
;  This Routine is not for "RAM" only and will be called after SAY_ROMDATA

                    ; after SAY_ROMDATA the value of $BE is <> 0
A059    A4 BE       LDY $BE             ; Word-Number MSB
A05B    D0 0B       BNE .Branch3_A068   ; <>0? If Word-Number is > 255 Then Say a word from RAM    >------
;                                                                                                         |
                    ; Say a word from ROM (default vocabulary)                                            |
                    ; Load Address $B240 to $FB/$FC , Start of Speech Data Table (ROM)                    |
A05D    A9 40       LDA #$40            ; A=#$40 , ROM Utterance Look Up Table Address LSB                |
A05F    85 FB       STA $FB             ; Active Utterance Look Up Table Address LSB                      |
A061    A9 B2       LDA #$B2            ; A=#$B2 , ROM Utterance Look Up Table Address MSB                |
A063    85 FC       STA $FC             ; Active Utterance Look Up Table Address MSB                      |
A065    4C 74 A0    JMP .Jump3_A074     ; Jump , Increment WORD-pointer                                   |  >------
;                                                                                                         |         |
                    ; Say a word from RAM (VOC, custom vocabulary)                                        |         |
                    ; Load VOC Address to $FB/$FC , Start of Speech Data Table (RAM)                      |         |
.Branch3_A068       ;                                                                                     |         |
A068    C6 BE       DEC $BE             ; $BE=$BE-1, Word-Number MSB                               <------          |
;                                                                                                                   |
A06A    AD CE C3    LDA $C3CE           ; RAM Utterance Look Up Table Address LSB                                   |
A06D    85 FB       STA $FB             ; Active Utterance Look Up Table Address LSB                                |
A06F    AD CF C3    LDA $C3CF           ; RAM Utterance Look Up Table Address MSB                                   |
A072    85 FC       STA $FC             ; Active Utterance Look Up Table Address MSB                                |
;                                                                                                                   |
                    ; here $FB/$FC = Start-Address of the Active Utterance Look Up Table                            |
                    ;                can be either ROM (default) or RAM (custom)                                    |
; V364: $8043                                                                                                       |
.Jump3_A074         ;                                                                                               |
                    ; Increment WORD-pointer (1st Byte)                                                             |
A074    E6 BD       INC $BD             ; $BD=$BD+1 , Word-Number LSB                                        <------
A076    D0 02       BNE .Branch4_A07A   ;                                                     >------
;                                                                                                    |
A078    E6 BE       INC $BE             ; $BE=$BE+1 , Word-Number MSB                                |
;                                                                                                    |
.Branch4_A07A       ;                                                                                |
                    ; Increment WORD-pointer (2nd Byte)                                              |
A07A    E6 BD       INC $BD             ; $BD=$BD+1 , Word-Number LSB                         <------
A07C    D0 02       BNE .Branch5_A080   ;                                                     >------
;                                                                                                    |
A07E    E6 BE       INC $BE             ; $BE=$BE+1 , Word-Number MSB                                |
;                                                                                                    |
.Branch5_A080       ;                                                                                |
                    ; Shift word pointer left 1 place , *2                                           |
A080    06 BD       ASL $BD             ; Arithmetic Shift Left > Carry , Word-Number LSB     <------
A082    26 BE       ROL $BE             ; Rotate Left with Carry        , Word-Number MSB

A084    20 66 A1    JSR .Jump1_A166     ; Call SET_ADRESSLINES_FOR_EXROM

A087    20 85 A1    JSR .Jump4_A185     ; Call READ_BYTE_FROM_MEMORY_AND_INC_POINTER_FBFC
                                        ; ((read voice data lookup offset 1.Byte , incr. $ pointers))
A08A    48          PHA                 ; Push A
A08B    20 85 A1    JSR .Jump4_A185     ; Call READ_BYTE_FROM_MEMORY_AND_INC_POINTER_FBFC
                                        ; ((read voice data lookup offset 2.Byte , incr. $ pointers))
A08E    38          SEC                 ; Set Carry
A08F    E5 BD       SBC $BD             ; Sub , Word-Number LSB
A091    D0 01       BNE .Branch6_A094   ;                                      >------
;                                                                                     |
A093    18          CLC                 ; Clear Carry                                 |
;                                                                                     |
.Branch6_A094       ;                                                                 |
A094    68          PLA                 ; Pull A                               <------
A095    E5 BE       SBC $BE             ; Sub , Word-Number MSB
A097    B0 05       BCS .Branch7_A09E   ;                                                     >------
                                        ;                                                            |
A099    20 B6 A1    JSR .Jump5_A1B6     ; Call READ_SYNTHESIZER_STATUS                               |
A09C    38          SEC                 ; Set Carry                                                  |
A09D    60          RTS                 ; Return                                                     |
        ;_______________________________                                                             |
;                                                                                                    |
;                                                                                                    |
;                                                                                                    |
.Branch7_A09E       ;                                                                                |
A09E    20 85 A1    JSR .Jump4_A185     ; Call READ_BYTE_FROM_MEMORY_AND_INC_POINTER_FBFC     <------
A0A1    8D DE C3    STA $C3DE           ;
A0A4    20 85 A1    JSR .Jump4_A185     ; Call READ_BYTE_FROM_MEMORY_AND_INC_POINTER_FBFC
A0A7    8D DD C3    STA $C3DD           ;

A0AA    20 B6 A1    JSR .Jump5_A1B6     ; Call READ_SYNTHESIZER_STATUS
A0AD    38          SEC                 ; Set Carry
A0AE    A5 FB       LDA $FB             ; Table LSB
A0B0    E9 04       SBC #$04            ; Sub 4 = Reset Pointer FBFC back to previous value
A0B2    48          PHA                 ; Push A
A0B3    B0 02       BCS .Branch8_A0B7   ; Branch on Carry Set                  >------
A0B5    C6 FC       DEC $FC             ; $FC = $FC - 1 , Table MSB                   |
;                                                                                     |
.Branch8_A0B7       ;                                                                 |
A0B7    18          CLC                 ; Clear Carry                          <------
A0B8    6D DD C3    ADC $C3DD           ; Add
A0BB    8D DD C3    STA $C3DD           ; Store

A0BE    A5 FC       LDA $FC             ; A = $FC , Table MSB
A0C0    6D DE C3    ADC $C3DE           ; Add
A0C3    8D DE C3    STA $C3DE           ; Store

A0C6    68          PLA                 ; Pull A
A0C7    18          CLC                 ; Clear Carry
A0C8    65 BD       ADC $BD             ; Add , Word-Number LSB
A0CA    85 FB       STA $FB             ; Store , Table LSB

A0CC    A5 FC       LDA $FC             ; A = $FC , Table MSB
A0CE    65 BE       ADC $BE             ; Add , Word-Number MSB
A0D0    85 FC       STA $FC             ; Store , Table MSB

A0D2    20 66 A1    JSR .Jump1_A166     ; Call SET_ADRESSLINES_FOR_EXROM
A0D5    20 85 A1    JSR .Jump4_A185     ; Call READ_BYTE_FROM_MEMORY_AND_INC_POINTER_FBFC
A0D8    8D D8 C3    STA $C3D8           ; Store in $C3D8 ,  save A , =
A0DB    20 85 A1    JSR .Jump4_A185     ; Call READ_BYTE_FROM_MEMORY_AND_INC_POINTER_FBFC
A0DE    48          PHA                 ; Push A ,          save A , =
A0DF    20 B6 A1    JSR .Jump5_A1B6     ; Call READ_SYNTHESIZER_STATUS

A0E2    68          PLA                 ; Pull A,           restore A , =
A0E3    18          CLC                 ; Clear Carry
A0E4    65 FB       ADC $FB             ; Add , Table LSB
A0E6    48          PHA                 ; Push A,  save A

A0E7    AD D8 C3    LDA $C3D8           ; Load from $C3D8 , restore A , =
A0EA    65 FC       ADC $FC             ; Add , Table MSB
A0EC    85 FC       STA $FC             ; Store , Table MSB

A0EE    68          PLA                 ; Pull A
A0EF    E6 BD       INC $BD             ; $BD = $BD + 1 , Word-Number LSB
A0F1    D0 02       BNE .Branch9_A0F5   ;                                      >------
;                                                                                     |
A0F3    E6 BE       INC $BE             ; $BE = $BE + 1 , Word-Number MSB             |
;                                                                                     |
.Branch9_A0F5       ;                                                                 |
A0F5    18          CLC                 ; Clear Carry                          <------
A0F6    E5 BD       SBC $BD             ; Sub , Word-Number LSB
A0F8    85 FB       STA $FB             ; Store , Table LSB

A0FA    A5 FC       LDA $FC             ; A=$FC , Table MSB
A0FC    E5 BE       SBC $BE             ; Sub , Word-Number MSB
A0FE    85 FC       STA $FC             ; Store , Table MSB
A100    20 66 A1    JSR .Jump1_A166     ; Call SET_ADRESSLINES_FOR_EXROM
A103    D0 06       BNE .Branch10_A10B  ;                                                                                        >------
;                                                                                                                                       |
                    ; select memory access                                                                                              |
A105    A5 01       LDA $01             ; 6510 On-Chip Port - [-][-][Cass Motor][Cass Switch][Cass DOut][/CHAREN][/HIRAM][/LORAM]       |
A107    49 03       EOR #$03            ; %0000 0011 -> xxxx xxNN                                                                       |
A109    85 01       STA $01             ; 6510 On-Chip Port - [-][-][Cass Motor][Cass Switch][Cass DOut][/CHAREN][/HIRAM][/LORAM]       |
;                                                                                                                                       |
.Branch10_A10B      ;                                                                                                                   |
                    ; Read 1st byte from Speechdata:                                                                                    |
                    ; Read synthesizing condition 1 (Bit 4..5) and condition 2 (Bit 0..3) , compressed Data (Bit6) and ??? (Bit7)       |
A10B    20 85 A1    JSR .Jump4_A185     ; Call READ_BYTE_FROM_MEMORY_AND_INC_POINTER_FBFC                                        <------
A10E    8D EB A3    STA $A3EB           ; Store Parameter for synthesizing CONDITION 2 (Low-Nibble)
                                        ; Example $4A:
                                        ;               D3 = Bits/Frame,    D2 = Frame length, D1 = Repeat,               D0 = Filter stages
                                        ; #$A = %1010 =      96 bits/frame,      20 ms/frame,       Repeat not available,      10 Filter stages
                                        ;
A111    4A          LSR                 ; Logical Shift Right , /2 , Example $4A: %0100 1010 -> %0001 0010
A112    4A          LSR                 ; we need 2 Bits only, because in Condition 1 is D0 and D1 always 0
A113    29 FC       AND #$FC            ; %1111 1100 -> xxxx xx00 , make D0 and D1 to zero, -> %0001 0000
A115    8D E9 A3    STA $A3E9           ; Store Parameter for synthesizing CONDITION 1 (Low-Nibble) , $10
                                        ;
                                        ;              D3 = Sound source shape, D2 = Loss effect calculation, D1 = 0, D0 = 0
                                        ;       %0000 =     Shape is Pitch,          no calculation
                                        ;
                                        ; Accu = %0001 0000
A118    29 30       AND #$30            ;        %0011 0000 -> 00xx 0000 = %0001 0000
A11A    8D D7 C3    STA $C3D7           ; set Bit D4 (compressed Data) and D5 (?) accordingly
A11D    20 FF A1    JSR .Jump6_A1FF     ; Call INIT_SPEECHDATA_BUFFER_T6721
A120    20 B6 A1    JSR .Jump5_A1B6     ; Call READ_SYNTHESIZER_STATUS
A123    18          CLC                 ; Clear Carry
A124    60          RTS                 ; Return
        ;_______________________________


; ---------------------------------------------
; $A125 Subroutine: HANDLE_EOS_OR_DIR_INTERRUPT
; ---------------------------------------------
; FUNCTION:
;  This routine is called when an interrupt has been detected and the source was from the magic voice module.
;  In case of EOS-Signal (End of Speech): Restores NMI-Vector and sends STOP-command to T6721A
;  In case of DIR-Signal (Data in Ready): Writes further speechdata to T6721A
;
; INPUT:
;
; OUTPUT:
;
; DESTROYS:
;
; CALLS:
;  nothing
;
; CALLED FROM:
;  - $C059 , in Sub $C047 - MAGIC_VOICE_NMI (Interrupt Service Routine) if EOS (End Of Speech) or DIR (Data In Ready)
;
; INFO:

A125    A0 00       LDY #$00            ; %0000 0000 , Y=0
A127    AD 87 DF    LDA $DF87           ; 6525 Active Interrupt Register - [-][-][-][0][DIR][EOS][0][0]
A12A    29 0C       AND #$0C            ; %0000 1100 , we have DIR or EOS only
A12C    C9 08       CMP #$08            ; %0000 1000 , DIR (Data In Ready), FIFO needs more data
A12E    F0 0B       BEQ .Branch11_A13B  ;                                                                    >------
;                                                                                                                   |
                    ; if EOS (End Of Speech)                                                                        |
A130    A9 3F       LDA #$3F            ; %0011 1111 -> 00xx xxxx                                                   |
A132    2D DB C3    AND $C3DB           ; Clear Flags EXROM and ???                                                 |
A135    8D DB C3    STA $C3DB           ;                           in Counting Semaphore                           |
A138    4C 28 C0    JMP .Jump7_C028     ; Jump , Reload original NMI vector ,                                       |
                                        ;        Entry in $C01B = SRESET - Reset The Speech System/Stop Talking     |
;                                                                                                                   |
.Branch11_A13B      ;                                                                                               |
                    ; if DIR (Data In Ready)                                                                        |
A13B    AD DB C3    LDA $C3DB           ; Counting Semaphore                                                 <------
A13E    30 06       BMI .Branch12_A146  ; if EXROM (Bit7=1?) ( -> Jump WRITE_SPEECHDATA_TO_VOICE_SYNTHESIZER )                   >------
;                                                                                                                                       |
                    ; no EXROM                                                                                                          |
A140    A5 01       LDA $01             ; 6510 On-Chip Port - [-][-][Cass Motor][Cass Switch][Cass DOut][/CHAREN][/HIRAM][/LORAM]       |
A142    49 03       EOR #$03            ; %0000 0011 -> xxxx xxNN                                                                       |
A144    85 01       STA $01             ; 6510 On-Chip Port - [-][-][Cass Motor][Cass Switch][Cass DOut][/CHAREN][/HIRAM][/LORAM]       |
;                                                                                                                                       |
.Branch12_A146      ;                                                                                                                   |
A146    4C D8 A1    JMP .Jump2_A1D8     ; Jump WRITE_SPEECHDATA_TO_VOICE_SYNTHESIZER                                             <------


; ----------------------------------------------------
; $A149 Subroutine: WRITE_COMMAND_TO_VOICE_SYNTHESIZER
; ----------------------------------------------------
; FUNCTION:
;  This subroutine writes a command to the Voice Synthesizer.
;  The command is in the Low-Nibble of the Accu
;  If the command is a more than one nibble instruction, it needs to be called respectively
;
; INPUT:
;  Accu Low-Nibble = Command
;
; OUTPUT:
;  nothing
;
; DESTROYS:
;  A
;
; CALLS:
;  nothing
;
; CALLED FROM:
;  - $A010 , in Sub $A0001 - INIT_VOICE_SYNTHESIZER
;  - $A02C , in Sub $A0001 - INIT_VOICE_SYNTHESIZER
;
; INFO:

; V364: $8114
.Jump0_A149
A149    09 20       ORA #$20            ; %0010 0000 -> xx1x xxxx , ?=High , /WR=Low
A14B    8D 81 DF    STA $DF81           ; 6525 Port B - IN:[/EXROM] OUT:[?][?][/WR][D3][D2][D1][D0]
A14E    09 30       ORA #$30            ; %0011 0000 -> xx11 xxxx , ?=High , /WR=High
A150    8D 81 DF    STA $DF81           ; 6525 Port B - IN:[/EXROM] OUT:[?][?][/WR][D3][D2][D1][D0]
A153    60          RTS                 ; Return
        ;_______________________________


; ---------------------------------------------
; $A154 Subroutine: CONVERT_SPEECHDATA_TO_T6721
; ---------------------------------------------
; FUNCTION:
;  Fills the SPEECHDATA_BUFFER_T6721 at C3F0 with the (synthesizer conditions (already done in SAY_RAMDATA via INIT_SPEECHDATA_BUFFER_T6721) and) decompressed Speechdata
;
; INPUT:
;    $BD = Pointer to SPEECHDATA_BUFFER_T6721
;      Y = (used if uncompressed Data)
;  $C3D7 =   Bit4 = compressed Data
;            Bit5 = ?
; OUTPUT:
;  $BD = $BD + 1
;
; DESTROYS:
;
; CALLS:
;
; CALLED FROM:
;  - $A1E7 in Sub $A1D8 , WRITE_SPEECHDATA_TO_VOICE_SYNTHESIZER
;
; INFO:

; V364: $811D
.Jump_A154
A154    AD D7 C3    LDA $C3D7           ; synth. cond. ? compressed data?
A157    F0 07       BEQ .Branch13_A160  ; if =#$00                                                 >------
                                        ;                                                                 |
A159    E6 BD       INC $BD             ; $BD = $BD + 1 , Next Byte                                       |
A15B    D0 08       BNE .Branch14_A165  ; > Return                                                        |  >------
                                        ;                                                                 |         |
A15D    4C 1E A2    JMP .Jump8_A21E     ; Jump continue (do a lot of FETCH_UNPACKED_PARAMETER)            |         |                      >------
                    ;                                                                                     |         |                             |
.Branch13_A160      ;                                                                                     |         |                             |
A160    20 85 A1    JSR .Jump4_A185     ; Call READ_BYTE_FROM_MEMORY_AND_INC_POINTER_FBFC          <------          |                             |
A163    91 BD       STA ($BD),Y         ; store A (with Y = #$00) in SPEECHDATA_BUFFER_T6721                        |                             |
                    ;                                                                                               |                             |
.Branch14_A165      ;                                                                                               |                             |
A165    60          RTS                 ; Return                                                             <------                              |
        ;_______________________________                                                                                                        to A21E


; -------------------------------------------
; $A166 Subroutine: SET_ADRESSLINES_FOR_EXROM
; -------------------------------------------
; FUNCTION:
; This function is called before a speechdata byte is read from memory
; If the speechdata is from the EXROM, it sets Adresslines CA12 to CA15
;
; INPUT:
;  $FC = High-Nibble = CA12..15
;  $C3DB = Counting Semaphore
;  $C3E2 = ?? wordnumber + Bit 7 ?? has been set depending on Bit 7 in Word-No. MSB
;
; OUTPUT:
;  A = 
;  Y = 0
;  $FC
;
; DESTROYS:
;
; CALLS:
;
; CALLED FROM:
;  - $A01C , in Sub $A001 - INIT_VOICE_SYNTHESIZER
;  - $A084 , in Sub $A059 - SAY_RAMDATA
;  - $A0D2 , in Sub $A059 - SAY_RAMDATA
;  - $A100 , in Sub $A059 - SAY_RAMDATA
;  - $A2C2 , from .Jump8_A21E continued Subroutine $A154 CONVERT_SPEECHDATA_TO_T6721
;  - $A2DD , from .Jump8_A21E continued Subroutine $A154 CONVERT_SPEECHDATA_TO_T6721
;
; INFO:
;  Returns always with Y=0
;
;  writes to T6721A Command-Register

.Jump1_A166
A166    2C DB C3    BIT $C3DB           ; Counting Semaphore , Bit7 = Neg.-Flag , Bit6 = Ovl.-Flag , #$0 = Zero-Flag
A169    10 17       BPL .Branch_A182    ; Branch on Plus (Bit7=0) -> Return                                            >------
;                                                                                                                             |
                    ; EXROM                                                                                                   |
A16B    A0 00       LDY #$00            ; Y = 0                                                                               |
A16D    A5 FC       LDA $FC             ; Table MSB                                                                           |
A16F    4A          LSR                 ; Logical Shift Right                                                                 |
A170    4A          LSR                 ; Move High-Nibble to Low (D4-D7 to D0-D3)                                            |
A171    4A          LSR                 ;                                                                                     |
A172    4A          LSR                 ;                                                                                     |
A173    09 30       ORA #$30            ; %0011 0000 -> 0011 xxxx , /WR=High , Set D5 -> 74LS257 switches CA12..15            |
A175    8D 81 DF    STA $DF81           ; 6525 Port B - IN:[/EXROM] OUT:[?][?][/WR][D3][D2][D1][D0]                           |
;                                                                                                                             |
A178    A5 FC       LDA $FC             ; Table MSB                                                                           |
A17A    29 0F       AND #$0F            ; %0000 1111 -> 0000 xxxx                                                             |
A17C    0D E2 C3    ORA $C3E2           ; Bit7 was set to 1 if Bit 7 in MSB of Word No. was 0                                 |
A17F    85 FC       STA $FC             ; Table MSB                                                                           |
A181    60          RTS                 ; Return                                                                              |
        ;_______________________________                                                                                      |
;                                                                                                                             |
.Branch_A182		;                                                                                                         |
A182    A0 00       LDY #$00            ; Y = 0 , allows to branch (eg BNE) after calling this subroutine              <------
A184    60          RTS                 ; Return
        ;_______________________________


; ------------------------------------------------------------
; $A185 Subroutine: READ_BYTE_FROM_MEMORY_AND_INC_POINTER_FBFC
; ------------------------------------------------------------
; FUNCTION:
;
; INPUT:
;  $FB/FC = pointer to Data (adress), Active Utterance Look Up Table Address, 
;  $C3DB = Counting Semaphore , NOTE: Bit x of the counting semaphore is information for EXROM
;  $C3E2 = 
;
; OUTPUT:
;  A = Byte at adress ($FBFC), e.g. Lookup Table, but mostly Speechdata Byte
;  X = 
;  Y = 0
;
; DESTROYS:
;  A, X, Y
;
; CALLS:
;  nothing
;
; CALLED FROM:
;  - $A087 , read voice data lookup offset 1.Byte
;  - $A08B , read voice data lookup offset 2.Byte
;  - $A09E , STA $C3DE
;  - $A0A4 , STA $C3DD
;  - $A0D5 , STA $C3D8 -> $FC
;  - $A0DB , ADC $FB
;  - $A10B , STA $A3EB , Synth, Conditions
;  - $A160 , STA ($BD),Y
;  - $A2C9 , STA ($A7),Y (11 times)
;  - $A3C3 , Loop FETCH_UNPACKED_PARAMETER
;
; INFO:


.Jump4_A185
A185    A0 00       LDY #$00            ; Y = 0
A187    AD 81 DF    LDA $DF81           ; 6525 Port B - IN:[/EXROM] OUT:[?][?][/WR][D3][D2][D1][D0]
A18A    AA          TAX                 ; Transfer A to X
A18B    2C DB C3    BIT $C3DB           ; Counting Semaphore , Bit7 = Neg.-Flag , Bit6 = Ovl.-Flag , #$0 = Zero-Flag
A18E    10 05       BPL .Branch_A195    ; Branch on Plus (Bit7=0) , if not EXROM                   >------
;                                                                                                         |
                    ; EXROM                                                                               |
A190    29 1F       AND #$1F            ; %0001 1111 -> 000x xxxx , Clear Bit 5 and 6                     |
A192    8D 81 DF    STA $DF81           ; 6525 Port B - IN:[/EXROM] OUT:[?][?][/WR][D3][D2][D1][D0]       |
;                                                                                                         |
.Branch_A195        ;                                                                                     |
                    ; no EXROM                                                                            |
A195    B1 FB       LDA ($FB),Y         ; Table LSB, Read Byte from Memory (RAM or ROM)            <------
                    ; X was the original value of $DF81
A197    8E 81 DF    STX $DF81           ; 6525 Port B - IN:[/EXROM] OUT:[?][?][/WR][D3][D2][D1][D0]

                    ; Pointer $FB/$FC + 1
A19A    E6 FB       INC $FB             ; $FB = $FB + 1 , Table LSB
A19C    D0 17       BNE .Branch15_A1B5  ; -> Return                                                                    >------
;                                                                                                                             |
                    ; LSB overflow, INC MSB                                                                                   |
A19E    E6 FC       INC $FC             ; $FC = $FC + 1 , Table MSB                                                           |
;                                                                                                                             |
A1A0    2C DB C3    BIT $C3DB           ; Counting Semaphore , Bit7 = Neg.-Flag , Bit6 = Ovl.-Flag , #$0 = Zero-Flag          |
A1A3    10 10       BPL .Branch15_A1B5  ; Branch on Plus (Bit7=0) , if not EXROM -> Return                             >------+
;                                                                                                                             |
                    ; EXROM                                                                                                   |
A1A5    48          PHA                 ; Push A , save A                                                                     |
A1A6    A9 30       LDA #$30            ; %0011 0000                                                                          |
A1A8    25 FC       AND $FC             ; Table MSB , -> 00xx 0000 (Bit 12, 13)                                               |
A1AA    D0 08       BNE .Branch16_A1B4  ; ROM adress is ...                                                  >------          |
;                                                                                                                   |         |
A1AC    AD E2 C3    LDA $C3E2           ;                                                                           |         |
A1AF    85 FC       STA $FC             ; Table MSB                                                                 |         |
A1B1    EE 81 DF    INC $DF81           ; 6525 Port B - IN:[/EXROM] OUT:[?][?][/WR][D3][D2][D1][D0]                 |         |
;                                                                                                                   |         |
.Branch16_A1B4      ;                                                                                               |         |
A1B4    68          PLA                 ; Pull A , restore A                                                 <------          |
;                                                                                                                             |
.Branch15_A1B5      ;                                                                                                         |
A1B5    60          RTS                 ; Return                                                                       <------
        ;_______________________________


; -----------------------------------------
; $A1B6 Subroutine: READ_SYNTHESIZER_STATUS (or last Adresslines?)
; -----------------------------------------
; FUNCTION:
; If Counting Semaphore Bit7 = 1 (EXROM), then store Synthesizer Status in High-Nibble of $FC, else return
; 
; INPUT:
;  $FC =
;  $C3DB = Counting Semaphore
;
; OUTPUT:
;  $FC = Low-Nibble is unchanged
         High-Nibble contains D0..D3 of Port B
;        D0 = EOS (End of Speech)
;        D1 = Power Down
;        D2 = Rom Data Error
;        D3 = Command Error
;
; DESTROYS:
;
; CALLS:
;
; CALLED FROM:
;  - $A099 , in Sub $A059 - SAY_RAMDATA
;  - $A0AA , in Sub $A059 - SAY_RAMDATA
;  - $A0DF , in Sub $A059 - SAY_RAMDATA
;  - $A120 , in Sub $A059 - SAY_RAMDATA
;  - $A2A3 , .Jump8_A21E
;
; INFO:

.Jump5_A1B6
A1B6    2C DB C3    BIT $C3DB           ; Counting Semaphore , Bit7 = Neg.-Flag , Bit6 = Ovl.-Flag , 0 = Zero-Flag
A1B9    10 11       BPL .Branch_A1CC    ; Branch on Plus (Bit7=0) , if not EXROM -> Return                             >------
                                        ;                                                                                     |
                    ; clear High-Nibble of $FC                                                                                |
A1BB    A5 FC       LDA $FC             ; Table MSB                                                                           |
A1BD    29 0F       AND #$0F            ; %0000 1111 -> 0000 xxxx , 4095                                                      |
A1BF    85 FC       STA $FC             ; Table MSB                                                                           |
                                        ;                                                                                     |
                    ; Read Nibble from T6721A and store in High-Nibble of $FC                                                 |
                    ; the Value is the last one that was written to the (6525) 6721 ???                                       |
A1C1    AD 81 DF    LDA $DF81           ; 6525 Port B - IN:[/EXROM] OUT:[?][?][/WR][D3][D2][D1][D0]                           |
A1C4    0A          ASL                 ; Arithmetic Shift Left > Carry                                                       |
A1C5    0A          ASL                 ;                                                                                     |
A1C6    0A          ASL                 ;                                                                                     |
A1C7    0A          ASL                 ;                                                                                     |
A1C8    05 FC       ORA $FC             ; Status (D0..D3) of Port B stored in High-Nibble of $FC                              |
A1CA    85 FC       STA $FC             ;                                                                                     |
                    ;                                                                                                         |
.Branch_A1CC        ;                                                                                                         |
A1CC    60          RTS                 ; Return                                                                       <------
        ;_______________________________



; ------------------------------------------------------------------------
; $A1CD = continued Subroutine $A1D8 WRITE_SPEECHDATA_TO_VOICE_SYNTHESIZER
; ------------------------------------------------------------------------

                    ; Loop A1FC
.Jump_A1CD
A1CD    AD 80 DF    LDA $DF80           ; 6525 Port A - IN:[DIR][/EOS][/GAME] OUT:[SI][D3][D2][D1][D0]                           <------
A1D0    30 01       BMI .Branch17_A1D3  ; Branch if DIR (Data In Ready) , continue ...             >------                              |
A1D2    60          RTS                 ; Return                                                          |                             |
        ;_______________________________                                                                  |                             |
                                                                                                          |                             |
                                                                                                          |                             |
.Branch17_A1D3      ;                                                                                     |                             |
                    ; if DIR (Data In Ready)                                                              |                             |
A1D3    A9 F7       LDA #$F7            ; %1111 0111  , Clear DIR Interrupt                        <------                              |
A1D5    8D 82 DF    STA $DF82           ; 6525 Handshake and Interrupt Latches                                                          |
                                        ; OUT:[/EXROM][?][/NMI] IN:[-][DIR][EOS][-][-]                                                  |
;                                                                                                                                       |
;                                                                                                                                       |
; -------------------------------------------------------                                                                               |
; $A1D8 Subroutine: WRITE_SPEECHDATA_TO_VOICE_SYNTHESIZER                                                                               |
; -------------------------------------------------------                                                                               |
; FUNCTION:
;  Reads Speechdata from Memory, if compressed, uncompresses and fills SPEECHDATA_BUFFER_T6721
;  Reads the unpacked Speechdata from the SPEECHDATA_BUFFER_T6721 and feeds the FIFO (T6721)
;
; INPUT:
;    Y = Index to 
;  $FD = Nibblecounter
;  $BD = Pointer to SPEECHDATA_BUFFER_T6721
;
; OUTPUT:
;
; DESTROYS:
;
; CALLS:
;  - $A154 , CONVERT_SPEECHDATA_TO_T6721
;
; CALLED FROM:
;  - $A01F , INIT_VOICE_SYNTHESIZER ($FD=9)                                                                                             |
;  - $A146 , via JMP from HANDLE_EOS_OR_DIR_INTERRUPT , if DIR (Data In Ready)                                                          |
;
; INFO:
;
                    ;                                                                                                                   |
.Jump2_A1D8         ;                                                                                                                   |
A1D8    A5 FD       LDA $FD             ; Nibblecounter                                                                                 |
A1DA    D0 0B       BNE .Branch18_A1E7  ;                                                          >------                              |
                                        ;                                                                 |                             |
                    ; Loop                                                                                |                             |
                    ; get High-Nibble                                                                     |                             |
.Branch19_A1DC                                                                                            |                             |
A1DC    E6 FD       INC $FD             ; $FD = $FD + 1                                                   |  <------                    |
A1DE    B1 BD       LDA ($BD),Y         ; Read unpacked speechbyte from SPEECHDATA_BUFFER_T6721           |         |                   |
A1E0    4A          LSR                 ; Logical Shift Right                                             |         |                   |
A1E1    4A          LSR                 ; Move High-Nibble to Low (D4-D7 to D0-D3)                        |         |                   |
A1E2    4A          LSR                 ;                                                                 |         |                   |
A1E3    4A          LSR                 ;                                                                 |         |                   |
A1E4    4C F4 A1    JMP .Jump9_A1F4     ; Jump , Write Speech Data Nibble                                 |         |  >------          |
                                        ;                                                                 |         |         |         |
                    ; get Low-Nibble                                                                      |         |         |         |
.Branch18_A1E7      ;                                                                                     |         |         |         |
A1E7    20 54 A1    JSR .Jump_A154      ; Call CONVERT_SPEECHDATA_TO_T6721, ($BD=$BD+1, Next Byte) <------          |         |         |
A1EA    A5 FD       LDA $FD             ;                                                                           |         |         |
A1EC    F0 EE       BEQ .Branch19_A1DC  ; Loop (next High Nibble)                                            >------          |         |
                                        ;                                                                                     |         |
A1EE    84 FD       STY $FD             ; $FD = Y                                                                             |         |
A1F0    B1 BD       LDA ($BD),Y         ; Read unpacked speechbyte from SPEECHDATA_BUFFER_T6721                               |         |
A1F2    29 0F       AND #$0F            ; %0000 1111 > 0000 xxxx , Mask Low-Nibble                                            |         |
                                        ;                                                                                     |         |
                    ; Write Speech Data Nibble                                                                                |         |
.Jump9_A1F4         ;                                                                                                         |         |
A1F4    8D 80 DF    STA $DF80           ; 6525 Port A - IN:[DIR][/EOS][/GAME] OUT:[SI][D3][D2][D1][D0]                 <------          |
A1F7    09 10       ORA #$10            ; %0001 0000 , SI=High (Shift in to FIFO)                                                       |
A1F9    8D 80 DF    STA $DF80           ; 6525 Port A - IN:[DIR][/EOS][/GAME] OUT:[SI][D3][D2][D1][D0]                                  |
A1FC    4C CD A1    JMP .Jump_A1CD      ; Jump A1CD , Loop or Return                                                             >------
        ;_______________________________


; ----------------------------------------------
; $A1FF Subroutine: INIT_SPEECHDATA_BUFFER_T6721
; ----------------------------------------------
; FUNCTION:
;  Initialises some variables used to fill the SPEECHDATA_BUFFER_T6721 at $C3F0
;  and also clears the first entry in the buffer (last adressbyte) with #$00
; 
; INPUT:
;  nothing
;
; OUTPUT:
;  Variables and Pointer
;   $C3D0 = #$00
;   $C3D2 = #$FF
;   $C3D5/$C3D6 points to $0040
;
;  Pointer and Buffer
;   $BD/$BE points to $C3FE , End of SPEECHDATA_BUFFER_T6721 - 1
;   $C3FF = #$00            , End of SPEECHDATA_BUFFER_T6721
;
; DESTROYS:
;
; CALLS:
;  nothing
;
; CALLED FROM:
;  - $A11D , in Sub SAY_RAMDATA
;
; INFO:

; V364: $813B
.Jump6_A1FF
A1FF    A0 FF       LDY #$FF            ; Y = 255
A201    8C D2 C3    STY $C3D2           ; #$FF
A204    C8          INY                 ; Y = Y + 1 -> Y = 0
A205    8C D0 C3    STY $C3D0           ; #$00
A208    8C D6 C3    STY $C3D6           ; #$00..
A20B    A9 40       LDA #$40            ; #$..40
A20D    8D D5 C3    STA $C3D5           ; > $C3D5/$C3D6 points to $0040 , $003F-0040 Current DATA Line number

                    ; 
A210    A9 C3       LDA #$C3            ; Address MSB $C3..
A212    85 BE       STA $BE             ; #$C3
A214    A9 FF       LDA #$FF            ; Address LSB $..FF
A216    85 BD       STA $BD             ; > $BD/$BE points to $C3FF , End of SPEECHDATA_BUFFER_T6721

A218    98          TYA                 ; Transfer Y to A , A=0 , Y=0
A219    91 BD       STA ($BD),Y         ; $C3FF = #$00
A21B    C6 BD       DEC $BD             ; $BD = $BD - 1 (Addresspointer LSB)
A21D    60          RTS                 ; Return
        ;_______________________________


; --------------------------------------------------------------
; $A21E = continued Subroutine $A154 CONVERT_SPEECHDATA_TO_T6721
; --------------------------------------------------------------
; FUNCTION:
;  This is the conversion from the compressed Speechdata stored in C64-Memory (EPROM or RAM)
;  to decompressed data, ready to feed into the T6721.
;  Data will be read from RAM or ROM and after conversion its stored to the SPEECHDATA_BUFFER_T6721 at $C3F0
;  $A7/$A8 (big datatable)
;
; INPUT:
;  X = 
;
; OUTPUT:
;
; DESTROYS:
;
; CALLS:
;  - FETCH_UNPACKED_PARAMETER
;  - READ_BYTE_FROM_MEMORY_AND_INC_POINTER_FBFC
;
; CALLED FROM:
;  - this is part of $A154 - CONVERT_SPEECHDATA_TO_T6721, see there
;
; INFO:
;
;                                                                                                                         from A15D
; V364: $815A       ;                                                                                                         |
.Jump8_A21E         ;                                                                                                         |
                    ; Save X to Stack                                                                                         |
A21E    8A          TXA                 ; Transfer X to A                                                              <------
A21F    48          PHA                 ; Push A, = save X

A220    20 00 A4    JSR .Jump_A400      ; Call $A400 ( -> Call FETCH_UNPACKED_PARAMETER ) (destroys X)
A223    D0 16       BNE .Branch20_A23B  ; ...                                                      >------
;                                                                                                         |
					; Initialise Loop                                                                     |
A225    A0 0F       LDY #$0F            ; Y=15 , Counter                                                  |
A227    A9 F0       LDA #$F0            ; Address LSB = $F0                                               |
A229    85 BD       STA $BD             ; > $BD/$BE points to $C3F0 , Begin of SPEECHDATA_BUFFER_T6721    |
A22B    85 FD       STA $FD             ; Nibblecounter, #$F0 , 15 , 240                                  |
A22D    A9 FF       LDA #$FF            ; %1111 1111                                                      |
;                                                                                                         |
                    ; Loop A22F                                                                           |
.Branch21_A22F      ;                                                                                     |
A22F    91 BD       STA ($BD),Y         ; fill SPEECHDATA_BUFFER_T6721 with #$FF    <------               |
A231    88          DEY                 ; Y = Y - 1 , 15 .. 1 , 15 bytes                   |              |
A232    D0 FB       BNE .Branch21_A22F  ; Loop A22F                                 >------               |
;                                                                                                         |
A234    A9 80       LDA #$80            ; %1000 0000                                                      |
A236    91 BD       STA ($BD),Y         ; Y=0 , Byte at $C3F0                                             |
;                                                                                                         |
                    ; Restore X from stack                                                                |
A238    68          PLA                 ; Pull A, = restore X                                             |
A239    AA          TAX                 ; Transfer A to X                                                 |
;                                                                                                         |
A23A    60          RTS                 ; Return                                                          |
        ;_______________________________                                                                  |
                                                                                                          |
                    ; ...                                                                                 |
; V364: $818C                                                                                             |
.Branch20_A23B                                                                                            |
A23B    48          PHA                 ; Push A                                                   <------
A23C    4D D2 C3    EOR $C3D2           ; is #$FF at first -> #$00
A23F    8D D2 C3    STA $C3D2           ;
A242    68          PLA                 ; Pull A
A243    0A          ASL                 ; Arithmetic Shift Left > Carry
A244    0A          ASL                 ;
A245    30 0D       BMI .Branch22_A254  ; Bit7=1?                                                            >------
A247    B0 03       BCS .Branch23_A24C  ;                                      >------                              |
A249    4C EF A2    JMP .Jump10_A2EF    ; -> Fetches                                  |                             |  >------
;                                                                                     |                             |         |
; V364: $819D                                                                         |                             |         |
.Branch23_A24C      ;                                                                 |                             |         |
A24C    48          PHA                 ; Push A                               <------                              |         |
A24D    2C D2 C3    BIT $C3D2           ;                                                                           |         |
A250    70 2B       BVS .Branch_A27D    ; Bit 6 = 1                                                >------          |         |
A252    50 0C       BVC .Branch_A260    ; Bit 6 = 0                                 >------               |         |         |
;                                                                                          |              |         |         |
; V364: $81A5                                                                              |              |         |         |
.Branch22_A254      ;                                                                      |              |         |         |
A254    48          PHA                 ; Push A                                           |              |  <------          |
A255    2C D2 C3    BIT $C3D2           ;                                                  |              |                   |
A258    70 1D       BVS .Branch_A277    ; Bit 6 = 1                                        |  >------     |                   |
;                                                                                          |         |    |                   |
A25A    20 93 A4    JSR .Jump11_A493    ; Call $A493 ( -> Call FETCH_UNPACKED_PARAMETER )  |         |    |                   |
A25D    8D D4 C3    STA $C3D4           ;                                                  |         |    |                   |
;                                                                                          |         |    |                   |
; V364: $81B1;                                                                             |         |    |                   |
.Branch_A260        ;                                                                      |         |    |                   |
A260    A9 AE       LDA #$AE            ; A=174                                     <------          |    |                   |
A262    85 A8       STA $A8             ; $A8=174                                                    |    |                   |
A264    AD D4 C3    LDA $C3D4           ;                                                            |    |                   |
A267    0A          ASL                 ; Arithmetic Shift Left > Carry                              |    |                   |
A268    0A          ASL                 ;                                                            |    |                   |
A269    18          CLC                 ; Clear Carry                                                |    |                   |
A26A    6D D4 C3    ADC $C3D4           ; Add                                                        |    |                   |
A26D    69 12       ADC #$12            ; Add 18                                                     |    |                   |
A26F    85 A7       STA $A7             ;                                                            |    |                   |
A271    90 7B       BCC .Branch24_A2EE  ; -> Fetches                                                 |    |       >------     |  
;                                                                                                    |    |              |    |
; V364: $81C4       ;                                                                                |    |              |    |
A273    E6 A8       INC $A8             ; $A8 = $A8 + 1                                              |    |              |    |
A275    D0 77       BNE .Branch24_A2EE  ; -> Fetches                                                 |    |       >------+    | 
;                                                                                                    |    |              |    |
; V364: $81C8       ;                                                                                |    |              |    |
.Branch_A277        ;                                                                                |    |              |    |
A277    20 B0 A4    JSR .Jump_A4B0      ; Call $A4B0 ( -> Call FETCH_UNPACKED_PARAMETER )     <------     |              |    |
A27A    8D D3 C3    STA $C3D3           ;                                                                 |              |    |
;                                                                                                         |              |    |
; V364: $81CE       ;                                                                                     |              |    |
.Branch_A27D        ;                                                                                     |              |    |
A27D    A9 00       LDA #$00            ; A = 0                                                    <------               |    |
A27F    85 A8       STA $A8             ; $A8 = 0                                                                        |    |
A281    AD D3 C3    LDA $C3D3           ;                                                                                |    |
A284    0A          ASL                 ; Arithmetic Shift Left > Carry                                                  |    |
A285    26 A8       ROL $A8             ; Rotate Left with Carry                                                         |    |
A287    0A          ASL                 ; Arithmetic Shift Left > Carry                                                  |    |
A288    26 A8       ROL $A8             ; Rotate Left with Carry                                                         |    |
A28A    18          CLC                 ; Clear Carry                                                                    |    |
A28B    6D D3 C3    ADC $C3D3           ; Add                                                                            |    |
A28E    90 02       BCC .Branch25_A292  ;                                                     >------                    |    |
;                                                                                                    |                   |    |
A290    E6 A8       INC $A8             ; $A8 = $A8 + 1                                              |                   |    |
;                                                                                                    |                   |    |
.Branch25_A292      ;                                                                                |                   |    |
A292    0A          ASL                 ; Arithmetic Shift Left > Carry                       <------                    |    |
A293    26 A8       ROL $A8             ; Rotate Left with Carry                                                         |    |
A295    18          CLC                 ; Clear Carry                                                                    |    |
A296    6D D3 C3    ADC $C3D3           ; Add                                                                            |    |
A299    90 02       BCC .Branch26_A29D  ;                                                     >------                    |    |
;                                                                                                    |                   |    |
A29B    E6 A8       INC $A8             ; $A8 = $A8 + 1                                              |                   |    |
;                                                                                                    |                   |    |
.Branch26_A29D      ;                                                                                |                   |    |
A29D    2C D2 C3    BIT $C3D2           ;                                                     <------                    |    |
A2A0    30 41       BMI .Branch27_A2E3  ; Bit7=1?                                             >------                    |    |
;                                                                                                    |                   |    |
A2A2    A8          TAY                 ; Transfer A to Y                                            |                   |    |
A2A3    20 B6 A1    JSR .Jump5_A1B6     ; Call READ_SYNTHESIZER_STATUS                               |                   |    |
A2A6    A5 FB       LDA $FB             ; Load Active Utterance Look Up Table Address ...            |                   |    |
A2A8    48          PHA                 ;  Push A                                                    |                   |    |
A2A9    A5 FC       LDA $FC             ; ... and save to stack                                      |                   |    |
A2AB    48          PHA                 ;  Push A                                                    |                   |    |
A2AC    98          TYA                 ; Transfer Y to A                                            |                   |    |
A2AD    18          CLC                 ; Clear Carry                                                |                   |    |
A2AE    6D DD C3    ADC $C3DD           ; Add                                                        |                   |    |
A2B1    85 FB       STA $FB             ;                                                            |                   |    |
;                                                                                                    |                   |    |
A2B3    AD DE C3    LDA $C3DE           ;                                                            |                   |    |
A2B6    65 A8       ADC $A8             ; Add                                                        |                   |    |
A2B8    85 FC       STA $FC             ;                                                            |                   |    |
;                                                                                                    |                   |    |
A2BA    A9 C3       LDA #$C3            ; load Address $C3E4                                         |                   |    |
A2BC    85 A8       STA $A8             ;                    and store in $A7/$A8                    |                   |    |
A2BE    A9 E4       LDA #$E4            ;                                                            |                   |    |
A2C0    85 A7       STA $A7             ; > $A7/$A8 points to $C3E4 , Storage of 12 Bytes (96 Bit)   |                   |    |
;                                                                                                    |                   |    |
A2C2    20 66 A1    JSR .Jump1_A166     ; Call SET_ADRESSLINES_FOR_EXROM                             |                   |    |
A2C5    A0 00       LDY #$00            ; Y = 0                                                      |                   |    |
;                                                                                                    |                   |    |
;                                                                                                    |                   |    |
                    ; Store 10 Bytes (80 Bit) at $C3E4                                               |                   |    |
                    ; each got from Sub at $A185 READ_BYTE_FROM_MEMORY_AND_INC_POINTER_FBFC          |                   |    |
                    ; Loop A2C7                                                                      |                   |    |
.Branch28_A2C7      ;                                                                                |                   |    |
A2C7    98          TYA                 ; Transfer Y to A                                <------     |                   |    |
A2C8    48          PHA                 ; Push A , save Y to stack                              |    |                   |    |
;                                                                                               |    |                   |    |
A2C9    20 85 A1    JSR .Jump4_A185     ; Call READ_BYTE_FROM_MEMORY_AND_INC_POINTER_FBFC       |    |                   |    |
A2CC    AA          TAX                 ; Transfer A to X , save result in X                    |    |                   |    |
;                                                                                               |    |                   |    |
A2CD    68          PLA                 ; Pull A                                                |    |                   |    |
A2CE    A8          TAY                 ; Transfer A to Y , restore Y from stack                |    |                   |    |
;                                                                                               |    |                   |    |
A2CF    8A          TXA                 ; Transfer X to A , result from JSR .Jump4_A185         |    |                   |    |
A2D0    91 A7       STA ($A7),Y         ; Store                                                 |    |                   |    |
A2D2    C8          INY                 ; Y=Y+1                                                 |    |                   |    |
A2D3    C0 0B       CPY #$0B            ; 11                                                    |    |                   |    |
A2D5    D0 F0       BNE .Branch28_A2C7  ; Loop A2C7                                      >------     |                   |    |
;                                                                                                    |                   |    |
A2D7    68          PLA                 ; Pull A                                                     |                   |    |
A2D8    85 FC       STA $FC             ;                                                            |                   |    |
A2DA    68          PLA                 ; Pull A                                                     |                   |    |
A2DB    85 FB       STA $FB             ;                                                            |                   |    |
A2DD    20 66 A1    JSR .Jump1_A166     ; Call SET_ADRESSLINES_FOR_EXROM                             |                   |    |
A2E0    4C EE A2    JMP .Branch24_A2EE  ; Jump -> Fetches                                            |            >------+    |
;                                                                                                    |                   |    |
;                                                                                                    |                   |    |
; **************************************************************                                     |                   |    |
;                                                                                                    |                   |    |
                    ; Startadress within Datatable at $A585 (the big one)                            |                   |    |
.Branch27_A2E3      ;                                                                                |                   |    |
A2E3    18          CLC                 ; $A7 = Acc. + #$85                                   <------                    |    |
A2E4    69 85       ADC #$85            ;                                                                                |    |
A2E6    85 A7       STA $A7             ;                                                                                |    |
A2E8    A9 A5       LDA #$A5            ; $A8 = $A8 + #$A5                                                               |    |
A2EA    65 A8       ADC $A8             ;                                                                                |    |
A2EC    85 A8       STA $A8             ; > $A7/$A8 points to position in Datatable at $A585                             |    |
;                                                                                                                        |    |
; *****                                                                                                                  |    |
;                   "Fetches"                                                                                            |    |
;                   ---------                                                                                            |    |
.Branch24_A2EE      ;                                                                                                    |    |
A2EE    68          PLA                 ; Pull A                                                                  <------     |
;                                                                                                                             |
;                                                                                                                             |
.Jump10_A2EF        ;                                                                                                         |
A2EF    0A          ASL                 ; Arithmetic Shift Left > Carry                                                <------
A2F0    10 0C       BPL .Branch_A2FE    ;                                                >------
;                                                                                               |
A2F2    48          PHA                 ; Push A                                                |
A2F3    20 50 A4    JSR .Jump_A450      ; Call $A450 ( -> Call FETCH_UNPACKED_PARAMETER )       |
A2F6    18          CLC                 ; Clear Carry                                           |
A2F7    6D D5 C3    ADC $C3D5           ; Add                                                   |
A2FA    8D D5 C3    STA $C3D5           ;                                                       |
A2FD    68          PLA                 ; Pull A                                                |
;                                                                                               |
                    ;                                                                           |
.Branch_A2FE        ;                                                                           |
A2FE    0A          ASL                 ; Arithmetic Shift Left > Carry                  <------
A2FF    10 0E       BPL .Branch_A30F    ;                                                >------
;                                                                                               |
A301    48          PHA                 ; Push A                                                |
A302    20 50 A4    JSR .Jump_A450      ; Call $A450 ( -> Call FETCH_UNPACKED_PARAMETER )       |
A305    18          CLC                 ; Clear Carry                                           |
A306    ED D5 C3    SBC $C3D5           ; Sub                                                   |
A309    49 FF       EOR #$FF            ; NEG                                                   |
A30B    8D D5 C3    STA $C3D5           ;                                                       |
A30E    68          PLA                 ; Pull A                                                |
;                                                                                               |
                    ;                                                                           |
.Branch_A30F        ;                                                                           |
A30F    0A          ASL                 ; Arithmetic Shift Left > Carry                  <------
A310    10 0C       BPL .Branch_A31E    ;                                                >------
;                                                                                               |
A312    48          PHA                 ; Push A                                                |
A313    20 72 A4    JSR .Jump12_A472    ; Call $A472 ( -> Call FETCH_UNPACKED_PARAMETER )       |
A316    18          CLC                 ; Clear Carry                                           |
A317    6D D6 C3    ADC $C3D6           ; Add                                                   |
A31A    8D D6 C3    STA $C3D6           ;                                                       |
A31D    68          PLA                 ; Pull A                                                |
;                                                                                               |
                    ;                                                                           |
.Branch_A31E        ;                                                                           |
A31E    0A          ASL                 ; Arithmetic Shift Left > Carry                  <------
A31F    10 10       BPL .Branch_A331    ;                                                >------
;                                                                                               |
A321    20 72 A4    JSR .Jump12_A472    ; Call $A472 ( -> Call FETCH_UNPACKED_PARAMETER )       |
A324    49 FF       EOR #$FF            ; NEG                                                   |
A326    38          SEC                 ; Set Carry                                             |
A327    6D D6 C3    ADC $C3D6           ; Add                                       >------     |
A32A    10 02       BPL .Branch_A32E    ;                                                  |    |
;                                                                                          |    |
A32C    A9 00       LDA #$00            ; A = 0                                            |    |
;                                                                                          |    |
.Branch_A32E        ;                                                                      |    |
A32E    8D D6 C3    STA $C3D6           ;                                           <------     |
;                                                                                               |
.Branch_A331        ;                                                                           |
A331    2C D2 C3    BIT $C3D2           ; Test Bit 6 -> Overflow-Flag                    <------
A334    50 32       BVC .Branch_A368    ; ---> 40 Bit                                              >------
;                                                                                                         |
;                                                                                                         |
A336    A0 0A       LDY #$0A            ; Y = 10                                                          |
A338    B1 A7       LDA ($A7),Y         ;                                                                 |
A33A    8D E0 C3    STA $C3E0           ; ?                                                               |
A33D    29 03       AND #$03            ; %0000 0011 -> 0000 00xx                                         |
A33F    4A          LSR                 ; Logical Shift Right , /2                                        |
A340    6A          ROR                 ; Rotate Right incl. carry                                        |
A341    0D D5 C3    ORA $C3D5           ;                                                                 |
A344    6A          ROR                 ;                                                                 |
A345    8D F5 C3    STA $C3F5           ; SPEECHDATA_BUFFER_T6721 , $C3F5 ,                               |
A348    AE D6 C3    LDX $C3D6           ;                                                                 |
A34B    F0 4B       BEQ .Branch29_A398  ; ---> 80 Bit                                                     |  >------
;                                                                                                         |         |
A34D    BD EB A3    LDA $A3EB,X         ; Load Parameter for synthesizing CONDITION 2 (Low-Nibble)        |         |
A350    6A          ROR                 ;                                                                 |         |
A351    8D F4 C3    STA $C3F4           ; SPEECHDATA_BUFFER_T6721 , $C3F4 ,                               |         |
A354    84 FD       STY $FD             ; Nibblecounter                                                   |         |
A356    88          DEY                 ; Y=Y-1                                                           |         |
;                                                                                                         |         |
                    ; Loop A357                                                                           |         |
.Branch_A357        ; get from big datatable and save in RAW buffer                                       |         |
A357    B1 A7       LDA ($A7),Y         ;                                                     <------     |         |
A359    99 F6 C3    STA $C3F6,Y         ; (Y = 9, 8, 7, 6, 5, ... 0)) , $C3FF .. $C3F6 , 80 Bit      |    |         |
A35C    88          DEY                 ; Y=Y-1                                                      |    |         |
A35D    10 F8       BPL .Branch_A357    ; Loop A357                                           >------     |         |
;                                                                                                         |         |
;                                                                                                         |         |
.Branch30_A35F      ;                                                                                     |         |
A35F    A9 F4       LDA #$F4            ; Address LSB ($C3F4)                                             |         |  <------
A361    85 BD       STA $BD             ;                                                                 |         |         |
;                                                                                                         |         |         |
A363    A0 00       LDY #$00            ; Y=0                                                             |         |         |
A365    68          PLA                 ; Pull A                                                          |         |         |
A366    AA          TAX                 ; Transfer A to X                                                 |         |         |
A367    60          RTS                 ; Return                                                          |         |         |
        ;_______________________________                                                                  |         |         |
;                                                                                                         |         |         |
;                                                                                                         |         |         |
; Note: CONDITION 2 (Low-Nibble), Bit D3: 0=48 bits/frame, 1=96 bits/frame                                |         |         |
;                                                                                                         |         |         |
                    ; 40 Bit (or unvoiced?)                                                               |         |         |
                    ; ------                                                                              |         |         |
.Branch_A368        ;                                                                                     |         |         |
A368    A0 04       LDY #$04            ; Y=4 , 40 Bit                                             <------          |         |
A36A    AE D6 C3    LDX $C3D6           ;                                                                           |         |
A36D    F0 29       BEQ .Branch29_A398  ;  ---> 80 Bit                                                       >------+         |
;                                                                                                                   |         |
A36F    BD EB A3    LDA $A3EB,X         ; Load Parameter for synthesizing CONDITION 2 (Low-Nibble)                  |         |
A372    0A          ASL                 ; Arithmetic Shift Left > Carry                                             |         |
A373    2A          ROL                 ; Rotate Left with Carry                                                    |         |
A374    2A          ROL                 ;                                                                           |         |
A375    8D F9 C3    STA $C3F9           ; SPEECHDATA_BUFFER_T6721 , $C3F9 ,                                         |         |
A378    2A          ROL                 ;                                                                           |         |
A379    29 07       AND #$07            ; %0000 0111 -> 0000 0xxx                                                   |         |
A37B    8D FA C3    STA $C3FA           ; SPEECHDATA_BUFFER_T6721 , $C3FA ,                                         |         |
;                                                                                                                   |         |
                    ; Loop A37E                                                                                     |         |
.Branch_A37E        ; get from big datatable and save in RAW buffer                                                 |         |
A37E    B1 A7       LDA ($A7),Y         ;                                                          <------          |         |
A380    99 FB C3    STA $C3FB,Y         ; (Y = 4, 3, 2, 1, 0) , $C3FF .. $C3FB , 40 Bit                   |         |         |
A383    88          DEY                 ; Y = Y - 1                                                       |         |         |
A384    10 F8       BPL .Branch_A37E    ; Loop A37E                                                >------          |         |
;                                                                                                                   |         |
A386    C8          INY                 ; Y = Y + 1                                                                 |         |
A387    8D E0 C3    STA $C3E0           ; ?                                                                         |         |
A38A    29 3F       AND #$3F            ; %0011 1111 -> 00xx xxxx                                                   |         |
A38C    99 FB C3    STA $C3FB,Y         ;                                                                           |         |
A38F    84 FD       STY $FD             ; Nibblecounter                                                             |         |
A391    A9 F9       LDA #$F9            ; $BD/$BE points to $C3F9 , SPEECHDATA_BUFFER_T6721                         |         |
A393    85 BD       STA $BD             ;                                                                           |         |
A395    68          PLA                 ; Pull A                                                                    |         |
A396    AA          TAX                 ; Transfer A to X                                                           |         |
A397    60          RTS                 ; Return                                                                    |         |
        ;_______________________________                                                                            |         |
;                                                                                                                   |         |
;                                                                                                                   |         |
                    ; 80 Bit (or voiced?)                                                                           |         |
                    ; ------                                                                                        |         |
.Branch29_A398      ;                                                                                               |         |
A398    A0 09       LDY #$09            ; Y=9 , 80 Bit                                                       <------          |
A39A    84 FD       STY $FD             ; Nibblecounter                                                                       |
A39C    8A          TXA                 ; Transfer X to A                                                                     |
;                                                                                                                             |
                    ; Loop A39D                                                                                               |
.Branch_A39D        ;                                                                                                         |
A39D    99 F6 C3    STA $C3F6,Y         ; (Y = 9, 8, 7, 6, 5, ... 0) , $C3FF .. $C3F6 , 80 Bit     <------                    |
A3A0    88          DEY                 ; Y = Y - 1                                                       |                   |
A3A1    10 FA       BPL .Branch_A39D    ; Loop A39D                                                >------                    |
;                                                                                                                             |
A3A3    A9 3F       LDA #$3F            ; %0111 1111                                                                          |
A3A5    8D F5 C3    STA $C3F5           ;                                                                                     |
A3A8    A9 01       LDA #$01            ; %0000 0001                                                                          |
A3AA    8D F4 C3    STA $C3F4           ;                                                                                     |
A3AD    D0 B0       BNE .Branch30_A35F  ; Branch always                                                                >------


; ------------------------------------------
; $A3AF Subroutine: FETCH_UNPACKED_PARAMETER
; ------------------------------------------
; FUNCTION:
;  Reads a Speechbyte from Memory, and Selects value from a datatable
;  
; INPUT:
;  $C3D0 = #$00 (always initalized to zero in $A1FF INIT_SPEECHDATA_BUFFER_T6721)
;  Stack = address of the datatable for decompression
;
; OUTPUT:
;  A = unpacked value (decoded)
;  X = 0
;
; LOCAL VARIABLES:
;  $C3D1 = Result of .Jump4_A185 READ_BYTE_FROM_MEMORY_AND_INC_POINTER_FBFC
;
; DESTROYS:
;
; CALLS:
;  - $A185 , READ_BYTE_FROM_MEMORY_AND_INC_POINTER_FBFC
;
; CALLED FROM:
;  - $A400 ($A220)              , $00 , once
;  - $A450 ($A2F3 and $A302)    , $50 , once
;  - $A472 ($A313 and $A321)    , $72 , once 
;  - $A493 ($A25A)              , $93 , alternatively $B0
;  - $A4B0 ($A277)              , $B0 , alternatively $93
;
; INFO:
;  Called with a JSR, so that the address of the following Datatable will be on stack


; Example $C3D1 = $D1 = %1101 0001,       A=    1
;              Y=2      %0110 1000 = $68, A=    2 , A=$68 - $02 = $   66
;              Y=3      %0011 0100 = $34, A=   CC , A=$CC - $34 = $   98
;              Y=4      %0001 1010 = $1A, A=(1)31 , A=$31 - $1A = $   17
;              Y=5      %0000 1101 = $0D, A=   2E , A=$2E - $0D = $   21
;              Y=6      %0000 0110 = $06, A=   42 , A=$42 - $06 = $   3C

; V364: $8355
.Jump_A3AF
A3AF    68          PLA                 ; Pull A , Datatable LSB = $00, $50, $72, $93, $B0
A3B0    85 9B       STA $9B             ;
A3B2    68          PLA                 ; Pull A , Datatable MSB = $A4
A3B3    85 9C       STA $9C             ; > $9B/$9C points to $A4xx , Datatable

					; Init
A3B5    A9 01       LDA #$01            ; A = 1 (Bit 0 = 1)
A3B7    A0 01       LDY #$01            ; Y = 1
A3B9    A2 00       LDX #$00            ; X = 0 (not used here)

                    ; Loop A3BB
.Branch_A3BB
A3BB    0E D0 C3    ASL $C3D0           ; Arithmetic Shift Left > Carry                                      <------
A3BE    D0 0F       BNE .Branch31_A3CF  ; Z=0                                                      >------          |
;                                                                                                         |         |
                    ; Save A and Y                                                                        |         |
A3C0    48          PHA                 ; Push A                                                          |         |
A3C1    98          TYA                 ; Transfer Y to A                                                 |         |
A3C2    48          PHA                 ; Push A                                                          |         |
;                                                                                                         |         |
A3C3    20 85 A1    JSR .Jump4_A185     ; Call READ_BYTE_FROM_MEMORY_AND_INC_POINTER_FBFC                 |         |
A3C6    8D D1 C3    STA $C3D1           ; store coded speechdata from memory                              |         |
;                                                                                                         |         |
                    ; Restore A and Y                                                                     |         |
A3C9    68          PLA                 ; Pull A                                                          |         |
A3CA    A8          TAY                 ; Transfer A to Y                                                 |         |
A3CB    68          PLA                 ; Pull A                                                          |         |
;                                                                                                         |         |
A3CC    EE D0 C3    INC $C3D0           ; $C3D0 = $C3D0 + 1 (1, 3, 7                                      |         |
                    ;                                                                                     |         |
.Branch31_A3CF      ;                                                                                     |         |
A3CF    C8          INY                 ; Y = Y + 1 ( 2, 3, 4,                                     <------          |
A3D0    0A          ASL                 ; Accu , Arithmetic Shift Left > Carry , Carry = Bit7 ( 2, 4, 8             |
A3D1    4E D1 C3    LSR $C3D1           ; coded speechdata , Logical Shift Right , Bit7 = 0, C = Bit0               |
A3D4    F1 9B       SBC ($9B),Y         ; Sub Accu = (Index - Accu), Index from Table                               |
A3D6    F0 02       BEQ .Branch32_A3DA  ; Z (Bit7) = 1               >------                                        |
;                                                                           |                                       |
A3D8    10 E1       BPL .Branch_A3BB    ; Loop A3BB                         |                                >------
;                                                                           |
                    ; Loop , add given indices                              |
.Branch32_A3DA      ;                                                       |
A3DA    71 9B       ADC ($9B),Y         ; Add                        <------
A3DC    88          DEY                 ; Y = Y - 1                         |
A3DE    D0 FB       BNE .Branch32_A3DA  ; Loop                       >------

A3DF    A8          TAY                 ; Transfer A to Y
A3E0    B1 9B       LDA ($9B),Y         ; Read entry from Datatable
A3E2    60          RTS                 ; Return
        ;_______________________________


; ---------------------------------------------------------------------------------
; Instructions and Data for the initialisation of the Voice Synthesizer T6721
; 9 Bytes, see Routine at $A001 INIT_VOICE_SYNTHESIZER
; The values for CONDITION 1 and CONDITION 2 are part of the Speech Data Memory (1st Byte of Speechdata)
; 
; V364: $841D

A3E3    !byte $02                       ; $2 = STOP (1 Nibble Instruction)
A3E4    !byte $0A                       ; $A = AUDIO POWER DOWN (1 Nibble Instruction)
A3E5    !byte $04                       ; $4 = AUDIO ASGIN (1 Nibble Instruction)

A3E6    !byte $05                       ; $5 = SPEED LOAD (2 Nibble Instruction)
A3E7    !byte $04                       ; Speech Speed = 4 (default)

A3E8    !byte $06                       ; $6 = CONDITION 1 (2 Nibble Instruction)
A3E9    !byte $00                       ; 0: Loss effect calculation, Sound source shape

A3EA    !byte $07                       ; $7 = CONDITION 2 (2 Nibble Instruction)
A3EB    !byte $00                       ; 0: Filter stages, Repeat, Frame length, Bits/Frame


; ----------------------
; SPEECH DECODING TABLES
; ----------------------

; ---------------------------------------------------------------------------------
; This table looks like a ?-Bit ternary sparse fixed codebook for synthesis model B

; ---------------------------
; $A3EC ENERGY DECODING TABLE or something else !
; ---------------------------
; V364: $???? , V364-Eprom: $0389

; 20 Bytes , 7 Bit (XXXX XXX-)
                                        ;  #     Dez.
A3EC    !byte $02                       ;  0      2
A3ED    !byte $04                       ;  1      4   +  2
A3EE    !byte $06                       ;  2      6   +  2
A3EF    !byte $08                       ;  3      8   +  2
A3F0    !byte $0A                       ;  4     10   +  2
A3F1    !byte $0C                       ;  5     12   +  2
A3F2    !byte $10                       ;  6     16   +  4
A3F3    !byte $14                       ;  7     20   +  4
A3F4    !byte $18                       ;  8     24   +  4
A3F5    !byte $1E                       ;  9     30   +  6
A3F6    !byte $24                       ; 10     36   +  6
A3F7    !byte $2E                       ; 11     46   + 10
A3F8    !byte $3A                       ; 12     58   + 12
A3F9    !byte $46                       ; 13     70   + 12
A3FA    !byte $56                       ; 14     86   + 16
A3FB    !byte $6C                       ; 15    108   + 16
A3FC    !byte $86                       ; 16    134   + 26
A3FD    !byte $A6                       ; 17    166   + 32
A3FE    !byte $CC                       ; 18    204   + 38
A3FF    !byte $FC                       ; 19    252   + 48


; ---------------------------------
; $A400 PITCH PERIOD DECODING TABLE or something else !
; ---------------------------------
; V364: $8894 , same data as V364

; CALLED FROM:
;  - $A220 ,

.Jump_A400
A400    20 AF A3    JSR $A3AF		    ; Call FETCH_UNPACKED_PARAMETER , V364: JSR $8355

; 77 (1 + 12 + 64) Bytes , 8 Bit (XXXX XXXX)

                                        ;  #     Dez.
A403    !byte $0C                       ;  0     12     "12" = Length of Index-Table

A404    !byte $00                       ;  1      0     Index 1..12 (added)
A405    !byte $01                       ;  2      1
A406    !byte $00                       ;  3      0
A407    !byte $04                       ;  4      4
A408    !byte $08                       ;  5      8
A409    !byte $0A                       ;  6     10
A40A    !byte $08                       ;  7      8
A40B    !byte $02                       ;  8      2
A40C    !byte $02                       ;  9      2
A40D    !byte $0B                       ; 10     11
A40E    !byte $11                       ; 11     17
A40F    !byte $01                       ; 12      1
;                                               ---
;                                          SUM   64

A410    !byte $01                       ;  1      1     64 Data Values , Range 0..245 , no duplicates
A411    !byte $21                       ;  2     33
A412    !byte $03                       ;  3      3
A413    !byte $23                       ;  4     35
A414    !byte $25                       ;  5     37
A415    !byte $33                       ;  6     51
A416    !byte $2D                       ;  7     45
A417    !byte $05                       ;  8      5
A418    !byte $13                       ;  9     19
A419    !byte $A1                       ; 10    161
A41A    !byte $2B                       ; 11     43
A41B    !byte $11                       ; 12     17
A41C    !byte $A3                       ; 13    163
A41D    !byte $35                       ; 14     53
A41E    !byte $B3                       ; 15    179
A41F    !byte $31                       ; 16     49
A420    !byte $09                       ; 17      9
A421    !byte $00                       ; 18      0
A422    !byte $65                       ; 19    101
A423    !byte $29                       ; 20     41
A424    !byte $0B                       ; 21     11
A425    !byte $A5                       ; 22    165
A426    !byte $AD                       ; 23
A427    !byte $B1                       ; 24
A428    !byte $E5                       ; 25
A429    !byte $0D                       ; 26
A42A    !byte $63                       ; 27
A42B    !byte $15                       ; 28
A42C    !byte $B5                       ; 29
A42D    !byte $AB                       ; 30
A42E    !byte $6D                       ; 31
A42F    !byte $A9                       ; 32
A430    !byte $E3                       ; 33
A431    !byte $75                       ; 34
A432    !byte $ED                       ; 35
A433    !byte $55                       ; 36
A434    !byte $53                       ; 37
A435    !byte $69                       ; 38
A436    !byte $61                       ; 39
A437    !byte $71                       ; 40
A438    !byte $6B                       ; 41
A439    !byte $E1                       ; 42
A43A    !byte $73                       ; 43
A43B    !byte $43                       ; 44
A43C    !byte $F5                       ; 45    245
A43D    !byte $45                       ; 46
A43E    !byte $C9                       ; 47
A43F    !byte $C5                       ; 48
A440    !byte $CD                       ; 49
A441    !byte $CB                       ; 50
A442    !byte $D3                       ; 51
A443    !byte $D1                       ; 52
A444    !byte $E9                       ; 53
A445    !byte $D5                       ; 54
A446    !byte $F1                       ; 55
A447    !byte $EB                       ; 56
A448    !byte $51                       ; 57
A449    !byte $F3                       ; 58    243
A44A    !byte $4B                       ; 59     75
A44B    !byte $49                       ; 60
A44C    !byte $4D                       ; 61
A44D    !byte $41                       ; 62
A44E    !byte $C3                       ; 63
A44F    !byte $C1                       ; 64


; ---------------------------
; $A450 TABLE
; ---------------------------

; CALLED FROM:
;  - $A2F3 , 
;  - $A302 , 

.Jump_A450
A450    20 AF A3    JSR $A3AF		    ; Call FETCH_UNPACKED_PARAMETER , V364: JSR $8355

; 31 (1 + 12 + 18) Bytes , 6 Bit (--XX XXXX)

                                        ;  #     Dez.
A453    !byte $0C                       ;  0     12     "12" = Length of Index-Table

A454    !byte $01                       ;  1      1     Index 1..12 (added)
A455    !byte $01                       ;  2      1
A456    !byte $01                       ;  3      1
A457    !byte $00                       ;  4      0
A458    !byte $01                       ;  5      1
A459    !byte $03                       ;  6      3
A45A    !byte $04                       ;  7      4
A45B    !byte $03                       ;  8      3
A45C    !byte $01                       ;  9      1
A45D    !byte $01                       ; 10      1
A45E    !byte $01                       ; 11      1
A45F    !byte $01                       ; 12      1
;                                               ---
;                                          SUM   18

A460    !byte $01                       ;  1      1     18 Data Values , Range 1..63 , no duplicates
A461    !byte $02                       ;  2      2
A462    !byte $03                       ;  3      3
A463    !byte $04                       ;  4      4
A464    !byte $05                       ;  5      5
A465    !byte $23                       ;  6     35
A466    !byte $1C                       ;  7     28
A467    !byte $31                       ;  8     49
A468    !byte $06                       ;  9      6
A469    !byte $07                       ; 10      7
A46A    !byte $0E                       ; 11     14
A46B    !byte $08                       ; 12      8
A46C    !byte $2A                       ; 13     42
A46D    !byte $15                       ; 14     21
A46E    !byte $09                       ; 15      9
A46F    !byte $0A                       ; 16     10
A470    !byte $38                       ; 17     56
A471    !byte $3F                       ; 18     63


; ---------------------------
; $A472 TABLE
; ---------------------------

; CALLED FROM:
;  - $A313 , 
;  - $A321 ,

.Jump12_A472
A472    20 AF A3    JSR $A3AF           ; Call FETCH_UNPACKED_PARAMETER , V364: JSR $8355

; 30 (1 + 9 + 20) Bytes , 5 Bit (---X XXXX)

                                        ;  #     Dez.
A475    !byte $09                       ;  0      9     "9" = Length of Index-Table

A476    !byte $01                       ;  1      1     Index 1..9 (added)
A477    !byte $00                       ;  2      0
A478    !byte $02                       ;  3      2
A479    !byte $01                       ;  4      1
A47A    !byte $03                       ;  5      3
A47B    !byte $03                       ;  6      3
A47C    !byte $04                       ;  7      4
A47D    !byte $02                       ;  8      2
A47E    !byte $04                       ;  9      4
;                                               ---
;                                          SUM   20

A47F    !byte $01                       ;  1      1     20 Data Values , Range 1..20 , no duplicates
A480    !byte $02                       ;  2      2
A481    !byte $03                       ;  3      3
A482    !byte $04                       ;  4      4
A483    !byte $05                       ;  5      5
A484    !byte $07                       ;  6      7
A485    !byte $06                       ;  7      6
A486    !byte $09                       ;  8      9
A487    !byte $0A                       ;  9     10
A488    !byte $08                       ; 10      8
A489    !byte $0D                       ; 11     13
A48A    !byte $0E                       ; 12     14
A48B    !byte $0B                       ; 13     11
A48C    !byte $0C                       ; 14     12
A48D    !byte $0F                       ; 15     15
A48E    !byte $10                       ; 16     16
A48F    !byte $11                       ; 17     17
A490    !byte $12                       ; 18     18
A491    !byte $14                       ; 19     20
A492    !byte $13                       ; 20     19


; ---------------------------
; $A493 TABLE
; ---------------------------

; CALLED FROM:
;  - $A25A ,

.Jump11_A493
A493    20 AF A3    JSR $A3AF           ; Call FETCH_UNPACKED_PARAMETER , V364: JSR $8355

; 26 (1 + 9 + 16) Bytes , 4 Bit (---- XXXX)

                                        ;  #     Dez.
A496    !byte $09                       ;  0      9     "9" = Length of Index-Table

A497    !byte $00                       ;  1      0     Index 1..9 (added)
A498    !byte $01                       ;  2      1
A499    !byte $03                       ;  3      3
A49A    !byte $04                       ;  4      4
A49B    !byte $03                       ;  5      3
A49C    !byte $01                       ;  6      1
A49D    !byte $01                       ;  7      1
A49E    !byte $01                       ;  8      1
A49F    !byte $02                       ;  9      2
;                                               ---
;                                          SUM   16

A4A0    !byte $00                       ;  1      0     16 Data Values , Range 0..15 , no duplicates
A4A1    !byte $04                       ;  2      4
A4A2    !byte $01                       ;  3      1
A4A3    !byte $02                       ;  4      2
A4A4    !byte $05                       ;  5      5
A4A5    !byte $03                       ;  6      3
A4A6    !byte $06                       ;  7      6
A4A7    !byte $07                       ;  8      7
A4A8    !byte $0D                       ;  9     13
A4A9    !byte $0B                       ; 10     11
A4AA    !byte $0A                       ; 11     10
A4AB    !byte $08                       ; 12      8
A4AC    !byte $09                       ; 13      9
A4AD    !byte $0F                       ; 14     15
A4AE    !byte $0E                       ; 15     14
A4AF    !byte $0C                       ; 16     12


; ---------------------------
; $A4B0 TABLE
; ---------------------------

; CALLED FROM:
;  - $A277 ,

.Jump_A4B0
A4B0    20 AF A3    JSR $A3AF           ; Call FETCH_UNPACKED_PARAMETER , V364: JSR $8355

; 210 (1 + 10 + 199) Bytes , 8 Bit (XXXX XXXX) , ... 4C 02

                                        ;  #     Dez.
A4B3    !byte $0A                       ;  0     10     "10" = Length of Index-Table

A4B4    !byte $00                       ;  1      0     Index 1..10 (added)
A4B5    !byte $00                       ;  2      0
A4B6    !byte $00                       ;  3      0
A4B7    !byte $00                       ;  4      0
A4B8    !byte $00                       ;  5      0
A4B9    !byte $04                       ;  6      4
A4BA    !byte $44                       ;  7     68
A4BB    !byte $54                       ;  8     84
A4BC    !byte $25                       ;  9     37
A4BD    !byte $06                       ; 10      6
;                                               ---
;                                          SUM  199

A4BE    !byte $00                       ;   1     0     199 Data Values , Range 0..198 , no duplicates
A4BF    !byte $C3                       ;   2
A4C0    !byte $05                       ;   3     5
A4C1    !byte $06                       ;   4     6
A4C2    !byte $89                       ;   5
A4C3    !byte $03                       ;   6     3
A4C4    !byte $01                       ;   7     1
A4C5    !byte $9A                       ;   8
A4C6    !byte $26                       ;   9
A4C7    !byte $09                       ;  10     9
A4C8    !byte $84                       ;  11
A4C9    !byte $08                       ;  12     8
A4CA    !byte $22                       ;  13
A4CB    !byte $0C                       ;  14
A4CC    !byte $AE                       ;  15
A4CD    !byte $93                       ;  16
A4CE    !byte $0B                       ;  17
A4CF    !byte $91                       ;  18
A4D0    !byte $47                       ;  19
A4D1    !byte $97                       ;  20
A4D2    !byte $82                       ;  21
A4D3    !byte $0E                       ;  22
A4D4    !byte $04                       ;  23     4
A4D5    !byte $BD                       ;  24
A4D6    !byte $90                       ;  25
A4D7    !byte $17                       ;  26
A4D8    !byte $86                       ;  27
A4D9    !byte $7B                       ;  28
A4DA    !byte $02                       ;  29     2
A4DB    !byte $4E                       ;  30
A4DC    !byte $43                       ;  31
A4DD    !byte $C1                       ;  32
A4DE    !byte $8B                       ;  33
A4DF    !byte $85                       ;  34
A4E0    !byte $1E                       ;  35
A4E1    !byte $18                       ;  36
A4E2    !byte $11                       ;  37
A4E3    !byte $0F                       ;  38
A4E4    !byte $B5                       ;  39
A4E5    !byte $8C                       ;  40
A4E6    !byte $4D                       ;  41
A4E7    !byte $12                       ;  42
A4E8    !byte $A2                       ;  43
A4E9    !byte $66                       ;  44
A4EA    !byte $28                       ;  45
A4EB    !byte $24                       ;  46
A4EC    !byte $13                       ;  47
A4ED    !byte $B6                       ;  48
A4EE    !byte $98                       ;  49
A4EF    !byte $59                       ;  50
A4F0    !byte $55                       ;  51
A4F1    !byte $46                       ;  52
A4F2    !byte $2C                       ;  53
A4F3    !byte $75                       ;  54
A4F4    !byte $69                       ;  55
A4F5    !byte $29                       ;  56
A4F6    !byte $10                       ;  57    16
A4F7    !byte $A6                       ;  58
A4F8    !byte $8E                       ;  59
A4F9    !byte $42                       ;  60
A4FA    !byte $23                       ;  61
A4FB    !byte $96                       ;  62
A4FC    !byte $88                       ;  63
A4FD    !byte $BF                       ;  64
A4FE    !byte $AD                       ;  65
A4FF    !byte $A0                       ;  66
A500    !byte $87                       ;  67
A501    !byte $7F                       ;  68
A502    !byte $25                       ;  69
A503    !byte $9D                       ;  70
A504    !byte $62                       ;  71
A505    !byte $2A                       ;  72
A506    !byte $3A                       ;  73
A507    !byte $31                       ;  74
A508    !byte $4F                       ;  75
A509    !byte $40                       ;  76
A50A    !byte $81                       ;  77
A50B    !byte $80                       ;  78
A50C    !byte $AF                       ;  79
A50D    !byte $99                       ;  80
A50E    !byte $95                       ;  81
A50F    !byte $C4                       ;  82   196
A510    !byte $3E                       ;  83
A511    !byte $14                       ;  84
A512    !byte $BE                       ;  85
A513    !byte $B2                       ;  86
A514    !byte $B1                       ;  87
A515    !byte $A7                       ;  88
A516    !byte $6B                       ;  89
A517    !byte $6A                       ;  90
A518    !byte $1C                       ;  91
A519    !byte $1B                       ;  92
A51A    !byte $51                       ;  93
A51B    !byte $3C                       ;  94
A51C    !byte $60                       ;  95
A51D    !byte $5A                       ;  96
A51E    !byte $AA                       ;  97
A51F    !byte $77                       ;  98
A520    !byte $BA                       ;  99
A521    !byte $B8                       ; 100
A522    !byte $AB                       ; 101
A523    !byte $A1                       ; 102
A524    !byte $8A                       ; 103
A525    !byte $B4                       ; 104
A526    !byte $2B                       ; 105
A527    !byte $21                       ; 106
A528    !byte $32                       ; 107
A529    !byte $2F                       ; 108
A52A    !byte $39                       ; 109
A52B    !byte $36                       ; 110
A52C    !byte $45                       ; 111
A52D    !byte $3D                       ; 112
A52E    !byte $C2                       ; 113
A52F    !byte $94                       ; 114
A530    !byte $8D                       ; 115
A531    !byte $68                       ; 116
A532    !byte $44                       ; 117
A533    !byte $3B                       ; 118
A534    !byte $27                       ; 119
A535    !byte $20                       ; 120
A536    !byte $9F                       ; 121
A537    !byte $4C                       ; 122
A538    !byte $A9                       ; 123
A539    !byte $A5                       ; 124
A53A    !byte $C5                       ; 125   197
A53B    !byte $AC                       ; 126
A53C    !byte $7C                       ; 127
A53D    !byte $78                       ; 128
A53E    !byte $35                       ; 129
A53F    !byte $0A                       ; 130
A540    !byte $B3                       ; 131
A541    !byte $07                       ; 132     7
A542    !byte $54                       ; 133
A543    !byte $37                       ; 134
A544    !byte $0D                       ; 135    13
A545    !byte $2D                       ; 136
A546    !byte $1D                       ; 137
A547    !byte $1A                       ; 138
A548    !byte $34                       ; 139
A549    !byte $30                       ; 140
A54A    !byte $16                       ; 141
A54B    !byte $A8                       ; 142
A54C    !byte $57                       ; 143
A54D    !byte $56                       ; 144
A54E    !byte $48                       ; 145
A54F    !byte $41                       ; 146
A550    !byte $B7                       ; 147
A551    !byte $4A                       ; 148
A552    !byte $1F                       ; 149
A553    !byte $15                       ; 150
A554    !byte $9E                       ; 151
A555    !byte $67                       ; 152
A556    !byte $B0                       ; 153
A557    !byte $C0                       ; 154
A558    !byte $9C                       ; 155
A559    !byte $92                       ; 156
A55A    !byte $7A                       ; 157
A55B    !byte $6D                       ; 158
A55C    !byte $65                       ; 159
A55D    !byte $58                       ; 160
A55E    !byte $73                       ; 161
A55F    !byte $6E                       ; 162
A560    !byte $63                       ; 163
A561    !byte $74                       ; 164
A562    !byte $7D                       ; 165
A563    !byte $76                       ; 166
A564    !byte $A4                       ; 167
A565    !byte $9B                       ; 168
A566    !byte $38                       ; 169
A567    !byte $71                       ; 170
A568    !byte $6C                       ; 171
A569    !byte $5D                       ; 172
A56A    !byte $8F                       ; 173
A56B    !byte $70                       ; 174
A56C    !byte $50                       ; 175
A56D    !byte $33                       ; 176
A56E    !byte $A3                       ; 177
A56F    !byte $72                       ; 178
A570    !byte $C6                       ; 179   198
A571    !byte $B9                       ; 180
A572    !byte $19                       ; 181
A573    !byte $5C                       ; 182
A574    !byte $49                       ; 183
A575    !byte $3F                       ; 184
A576    !byte $53                       ; 185
A577    !byte $52                       ; 186
A578    !byte $6F                       ; 187
A579    !byte $61                       ; 188
A57A    !byte $5B                       ; 189
A57B    !byte $BC                       ; 190
A57C    !byte $83                       ; 191
A57D    !byte $7E                       ; 192
A57E    !byte $2E                       ; 193
A57F    !byte $4B                       ; 194
A580    !byte $79                       ; 195
A581    !byte $5E                       ; 196
A582    !byte $5F                       ; 197
A583    !byte $BB                       ; 198
A584    !byte $64                       ; 199


; ---------------------------
; $A585 TABLE
; ---------------------------
;
; see .Branch27_A2E3
;
; $A7/$A8 points to Datatable at $A585
; 199 * (1 + 10) = 2189 Bytes

; 1 + 10 bytes, last one is always in range 00..03

                                                                ;   #     Dez.
A585    !byte $DC                                               ;   0     220
A586    !byte $84, $C0, $7D, $83, $82, $C2, $0F, $FC, $01, $03

A590    !byte $C9                                               ;   1     201
A591    !byte $84, $E8, $0F, $74, $32, $82, $1F, $04, $06, $03

A59B    !byte $B8                                               ;   2     184
A59C    !byte $6E, $FD, $43, $B0, $BF, $53, $C0, $2B, $0E, $02

A5A6    !byte $D3                                               ;   3     211
A5A7    !byte $E3, $9B, $5E, $74, $33, $62, $07, $00, $08, $01

A5B1    !byte $E7                                               ;   4     231
A5B2    !byte $AD, $34, $AF, $31, $81, $F3, $07, $08, $FE, $03

A5BC    !byte $0B                                               ;   5      11
A5BD    !byte $0C, $5F, $5A, $62, $15, $C3, $E7, $FB, $FF, $02

A5C7    !byte $ED                                               ;   6     237
A5C8    !byte $D6, $36, $9B, $73, $45, $52, $DF, $FF, $01, $03

A5D2    !byte $C9                                               ;   7     201
A5D3    !byte $55, $39, $EF, $43, $81, $92, $0F, $1C, $02, $00

A5DD    !byte $BF                                               ;   8     191
A5DE    !byte $EC, $10, $FE, $11, $82, $83, $FF, $03, $F8, $03

A5E8    !byte $2D                                               ;   9
A5E9    !byte $71, $1B, $9A, $A0, $84, $23, $00, $00, $02, $00

A5F3    !byte $C5                                               ;  10
A5F4    !byte $F9, $18, $3C, $A0, $B3, $CF, $A1, $E7, $0D, $03

A5FE    !byte $E9                                               ;  11
A5FF    !byte $A2, $03, $3C, $33, $14, $73, $E7, $03, $00, $00

A609    !byte $B5                                               ;  12
A60A    !byte $20, $E4, $7F, $B2, $C1, $13, $E7, $03, $08, $02

A614    !byte $C8                                               ;  13
A615    !byte $11, $85, $75, $51, $4F, $33, $D9, $1F, $10, $01

A61F    !byte $13                                               ;  14
A620    !byte $55, $C8, $BC, $D1, $A2, $13, $08, $0C, $00, $03

A62A    !byte $B2                                               ;  15
A62B    !byte $F9, $28, $11, $91, $BF, $04, $C0, $1B, $04, $03

A635    !byte $BE                                               ;  16
A636    !byte $93, $41, $60, $C0, $11, $63, $0F, $2C, $FC, $03

A640    !byte $B6                                               ;  17
A641    !byte $36, $1C, $D0, $E4, $B2, $40, $17, $28, $18, $00

A64B    !byte $D2                                               ;  18
A64C    !byte $1C, $E5, $B1, $21, $81, $C2, $0F, $20, $04, $01

A656    !byte $17                                               ;  19
A657    !byte $60, $5B, $6B, $62, $34, $22, $E7, $1B, $10, $02

A661    !byte $49                                               ;  20
A662    !byte $FF, $3F, $4A, $4E, $C4, $63, $00, $FC, $07, $00

A66C    !byte $ED                                               ;  21
A66D    !byte $D3, $9A, $3B, $64, $C4, $0F, $37, $48, $1A, $00

A677    !byte $82                                               ;  22
A678    !byte $BC, $9D, $32, $C4, $2F, $60, $90, $14, $F6, $02

A682    !byte $C5                                               ;  23
A683    !byte $F5, $1E, $7C, $F4, $34, $62, $D7, $FF, $01, $00

A68D    !byte $B2                                               ;  24
A68E    !byte $5E, $44, $2D, $C4, $62, $52, $FF, $FF, $07, $03

A698    !byte $B9                                               ;  25
A699    !byte $B0, $89, $54, $CE, $40, $93, $FF, $43, $12, $00

A6A3    !byte $A9                                               ;  26
A6A4    !byte $C6, $C9, $11, $6F, $F0, $23, $C0, $3F, $00, $00

A6AE    !byte $86                                               ;  27
A6AF    !byte $AE, $D0, $5E, $64, $C0, $10, $6F, $1C, $1E, $03

A6B9    !byte $A5                                               ;  28
A6BA    !byte $9C, $C4, $44, $F0, $3D, $61, $E2, $03, $08, $00

A6C4    !byte $CA                                               ;  29
A6C5    !byte $69, $21, $5B, $42, $21, $20, $BA, $F3, $01, $03

A6CF    !byte $D3                                               ;  30
A6D0    !byte $04, $58, $3C, $E1, $B1, $C4, $17, $E8, $FB, $01

A6DA    !byte $84                                               ;  31
A6DB    !byte $5D, $FD, $C0, $03, $00, $11, $C0, $40, $14, $02

A6E5    !byte $BF                                               ;  32
A6E6    !byte $3C, $61, $A2, $CD, $6F, $53, $BF, $2F, $FE, $02

A6F0    !byte $AE                                               ;  33
A6F1    !byte $96, $75, $81, $41, $6F, $14, $D8, $23, $08, $02

A6FB    !byte $9A                                               ;  34
A6FC    !byte $BE, $CB, $8E, $F1, $31, $33, $2F, $0C, $0E, $02

A706    !byte $CF                                               ;  35
A707    !byte $10, $4F, $AE, $64, $A4, $B0, $E6, $13, $0A, $03

A711    !byte $C4                                               ;  36
A712    !byte $E2, $5B, $CE, $50, $20, $43, $A1, $03, $F8, $01

A71C    !byte $82                                               ;  37
A71D    !byte $5C, $B5, $63, $E3, $41, $80, $00, $1C, $00, $03

A727    !byte $D4                                               ;  38
A728    !byte $96, $A7, $2C, $1F, $B0, $22, $08, $0C, $06, $03

A732	!byte $A4                                               ;  39
A733	!byte $B4, $BD, $B4, $DF, $2D, $63, $89, $2B, $04, $01

A73D	!byte $B8                                               ;  40
A73E	!byte $A4, $0C, $3D, $0E, $A0, $04, $F0, $1B, $FC, $03

A748	!byte $B0                                               ;  41
A749	!byte $AF, $BB, $0D, $60, $C2, $A3, $D7, $07, $00, $01

A753	!byte $9F                                               ;  42
A754	!byte $06, $F5, $41, $EF, $31, $B3, $87, $2B, $04, $00

A75E	!byte $9C                                               ;  43
A75F	!byte $15, $79, $03, $B0, $AD, $94, $F8, $17, $02, $01

A769    !byte $84                                               ;  44
A76A    !byte $08, $61, $50, $F4, $61, $82, $0F, $14, $1C, $03

A774    !byte $83                                               ;  45
A775    !byte $86, $05, $21, $35, $31, $C1, $57, $18, $16, $01

A77F    !byte $9A                                               ;  46
A780    !byte $3B, $35, $55, $9E, $CE, $70, $C2, $FF, $0B, $03

A78A    !byte $07                                               ;  47
A78B    !byte $1E, $21, $22, $D3, $51, $71, $30, $18, $08, $02

A795    !byte $B8                                               ;  48
A796    !byte $59, $E5, $62, $F2, $1E, $12, $D1, $23, $08, $02

A7A0    !byte $9E                                               ;  49
A7A1    !byte $4F, $7D, $E1, $F0, $BE, $A2, $99, $23, $00, $01

A7AB    !byte $B8                                               ;  50
A7AC    !byte $41, $53, $41, $75, $D3, $0E, $27, $20, $0C, $01

A7B6    !byte $BB                                               ;  51
A7B7    !byte $79, $05, $96, $A1, $BE, $62, $F0, $2B, $1C, $01

A7C1    !byte $86                                               ;  52
A7C2    !byte $94, $61, $F0, $0D, $00, $63, $C9, $17, $F8, $03

A7CC    !byte $87                                               ;  53
A7CD    !byte $6E, $BC, $60, $30, $61, $C0, $21, $34, $FE, $03

A7D7    !byte $AC                                               ;  54
A7D8    !byte $D2, $AE, $DF, $D5, $44, $B1, $07, $E8, $FB, $00

A7E2	!byte $AA                                               ;  55
A7E3	!byte $E8, $E3, $52, $15, $11, $E0, $56, $44, $22, $03

A7ED    !byte $A4                                               ;  56
A7EE    !byte $7B, $15, $86, $11, $4D, $51, $D2, $0F, $10, $01

A7F8    !byte $F2                                               ;  57
A7F9    !byte $BB, $BB, $7A, $00, $E3, $03, $91, $0B, $F6, $01

A803    !byte $C6                                               ;  58
A804    !byte $A5, $E6, $5D, $45, $94, $2E, $67, $40, $0A, $01

A80E    !byte $B0                                               ;  59
A80F    !byte $73, $5D, $BD, $D3, $20, $D0, $A1, $17, $0A, $02

A819    !byte $87                                               ;  60
A81A    !byte $B9, $80, $5F, $82, $6F, $50, $40, $24, $00, $00

A824    !byte $8A                                               ;  61
A825    !byte $89, $6C, $FD, $F2, $01, $C3, $07, $0C, $10, $03

A82F    !byte $84                                               ;  62
A830    !byte $65, $1D, $D1, $E0, $1F, $F0, $48, $20, $FC, $01

A83A    !byte $92                                               ;  63
A83B    !byte $C5, $95, $C0, $2C, $10, $F3, $61, $03, $0A, $03

A845    !byte $C7                                               ;  64
A846    !byte $AC, $64, $43, $E2, $EE, $91, $C9, $13, $08, $00

A850    !byte $B3                                               ;  65
A851    !byte $D8, $C1, $BF, $C0, $21, $B3, $2F, $2C, $02, $00

A85B    !byte $A3                                               ;  66
A85C    !byte $9C, $F4, $F1, $43, $21, $51, $1F, $24, $08, $02

A866    !byte $D4                                               ;  67
A867    !byte $01, $63, $6B, $11, $94, $43, $08, $08, $FA, $02

A871    !byte $91                                               ;  68
A872    !byte $92, $C9, $B3, $FC, $1E, $02, $8A, $03, $0A, $02

A87C    !byte $97                                               ;  69
A87D    !byte $4E, $1D, $03, $3E, $5F, $93, $69, $13, $02, $02

A887    !byte $89                                               ;  70
A888    !byte $DE, $AF, $50, $23, $73, $D2, $2F, $18, $0C, $03

A892    !byte $01                                               ;  71
A893    !byte $D4, $27, $CD, $2D, $FE, $B0, $40, $24, $0E, $00

A89D    !byte $B4                                               ;  72
A89E    !byte $23, $3D, $4A, $94, $E1, $8F, $89, $03, $04, $03

A8A8    !byte $9C                                               ;  73
A8A9    !byte $E0, $0B, $65, $9E, $8F, $E3, $A0 ,$07, $06, $03

A8B3    !byte $CE                                               ;  74
A8B4    !byte $8F, $56, $1D, $44, $B5, $71, $FF, $F7, $FB, $02

A8BE    !byte $A0                                               ;  75
A8BF    !byte $89, $61, $85, $EC, $2F, $34, $EA, $2F, $06, $02

A8C9    !byte $9C                                               ;  76
A8CA    !byte $73, $FC, $6F, $EE, $7F, $F3, $81, $13, $04, $03

A8D4    !byte $20                                               ;  77
A8D5    !byte $D4, $3C, $10, $30, $40, $20, $D8, $03, $00, $03

A8DF    !byte $3F                                               ;  78
A8E0    !byte $4B, $D5, $B2, $C0, $7F, $50, $10, $00, $FE, $00

A8EA    !byte $8A                                               ;  79
A8EB    !byte $0E, $49, $12, $9F, $3F, $F2, $99, $03, $00, $01

A8F5    !byte $A5                                               ;  80
A8F6    !byte $3C, $ED, $8F, $E0, $70, $9F, $CA, $FF, $17, $03

A900    !byte $9C                                               ;  81
A901    !byte $5E, $2D, $8E, $BE, $F0, $73, $90, $27, $FE, $01

A90B    !byte $8C                                               ;  82
A90C    !byte $E3, $D7, $62, $4E, $31, $AF, $59, $20, $06, $01

A916    !byte $A0                                               ;  83
A917    !byte $72, $F1, $6C, $D0, $F2, $CE, $B9, $E3, $1D, $00

A921    !byte $A1                                               ;  84
A922    !byte $E4, $2C, $7E, $C1, $23, $82, $DF, $0F, $FE, $02

A92C    !byte $AD                                               ;  85
A92D    !byte $26, $6B, $8D, $4F, $D0, $62, $59, $34, $08, $00

A937    !byte $4C                                               ;  86
A938    !byte $D4, $80, $EB, $1C, $F1, $62, $38, $04, $08, $00

A942    !byte $95                                               ;  87
A943    !byte $EA, $4C, $70, $01, $10, $5E, $19, $10, $06, $00

A95D    !byte $90                                               ;  88
A95E    !byte $BE, $17, $A3, $0F, $C5, $01, $EF, $FB, $F7, $03

A958    !byte $9F                                               ;  89
A959    !byte $B3, $FF, $6E, $5F, $A1, $A2, $C9, $07, $00, $02

A963    !byte $90                                               ;  90
A964    !byte $61, $C0, $B2, $01, $4F, $93, $60, $0B, $04, $02

A96E    !byte $A5                                               ;  91
A96F    !byte $85, $51, $3C, $45, $8E, $62, $89, $1B, $06, $00

A979    !byte $15                                               ;  92
A97A    !byte $0D, $7B, $5A, $1F, $25, $94, $A0, $EF, $FF, $00

A984    !byte $8D                                               ;  93
A985    !byte $16, $51, $95, $CC, $90, $32, $C8, $FB, $09, $02

A98F    !byte $A0                                               ;  94
A990    !byte $B7, $9E, $A0, $65, $C1, $0D, $E0, $50, $F0, $02

A99A    !byte $AF                                               ;  95
A99B    !byte $8E, $60, $76, $B3, $EC, $10, $02, $20, $0A, $02

A9A5    !byte $A6                                               ;  96
A9A6    !byte $B6, $F3, $1D, $C3, $A3, $13, $A1, $07, $F0, $02

A9B0    !byte $8C                                               ;  97
A9B1    !byte $A2, $21, $DC, $2F, $F2, $61, $09, $00, $F8, $00

A9BB    !byte $24                                               ;  98
A9BC    !byte $58, $C0, $0A, $DF, $21, $74, $F0, $07, $FC, $00

A9C6    !byte $95                                               ;  99
A9C7    !byte $A8, $95, $E0, $2C, $72, $13, $B0, $0B, $04, $02

A9D1    !byte $AD                                               ; 100
A9D2    !byte $6C, $DD, $6A, $33, $2F, $41, $C8, $C0, $11, $03

A9DC    !byte $85                                               ; 101
A9DD    !byte $3E, $F8, $34, $C0, $93, $40, $31, $04, $0C, $02

A9E7    !byte $ED                                               ; 102
A9E8    !byte $21, $F7, $CD, $4D, $3F, $70, $40, $4C, $12, $03

A9F2    !byte $D3                                               ; 103
A9F3    !byte $14, $D1, $BE, $90, $AD, $21, $50, $5C, $1A, $02

A9FD    !byte $E1                                               ; 104
A9FE    !byte $F3, $83, $23, $E1, $1C, $42, $48, $20, $08, $03

AA08    !byte $4C                                               ; 105
AA09    !byte $71, $F0, $A1, $FF, $AF, $1F, $00, $FC, $FF, $02

AA13    !byte $86                                               ; 106
AA14    !byte $FE, $E8, $7F, $D1, $A3, $CF, $47, $14, $16, $03

AA1E    !byte $E2                                               ; 107
AA1F    !byte $37, $49, $7D, $E1, $C0, $80, $C9, $13, $02, $02

AA29    !byte $B3                                               ; 108
AA2A    !byte $05, $57, $52, $51, $8F, $32, $C9, $EB, $09, $03

AA34    !byte $8F                                               ; 109
AA35    !byte $F1, $96, $02, $F6, $04, $40, $07, $04, $04, $02

AA3F    !byte $E6                                               ; 110
AA40    !byte $FA, $D2, $E9, $0C, $B0, $80, $58, $04, $08, $00

AA4A    !byte $D3                                               ; 111
AA4B    !byte $A3, $B8, $EF, $8E, $22, $10, $4A, $D4, $0D, $02

AA55    !byte $4F                                               ; 112
AA56    !byte $3A, $47, $CB, $2D, $90, $C1, $48, $1C, $00, $01

AA60    !byte $9C                                               ; 113
AA61    !byte $3A, $A4, $8B, $44, $C0, $3E, $80, $18, $2C, $00

AA6B    !byte $D6                                               ; 114
AA6C    !byte $50, $9F, $01, $7D, $50, $01, $B1, $00, $FE, $00

AA76    !byte $A1                                               ; 115
AA77    !byte $28, $37, $50, $86, $B1, $CF, $FF, $E7, $17, $00

AA81    !byte $8C                                               ; 116
AA82    !byte $5E, $57, $A2, $44, $BF, $CE, $B8, $4C, $E8, $03

AA8C    !byte $99                                               ; 117
AA8D    !byte $9F, $C8, $FC, $1E, $D0, $71, $48, $F0, $05, $01

AA97    !byte $A1                                               ; 118
AA98    !byte $C4, $9F, $60, $11, $BC, $02, $39, $3C, $FE, $01

AAA2    !byte $A0                                               ; 119
AAA3    !byte $D5, $83, $E1, $61, $8F, $0E, $78, $04, $F6, $02

AAAD    !byte $2B                                               ; 120
AAAE    !byte $05, $65, $9F, $1D, $AD, $00, $F8, $13, $04, $03

AAB8    !byte $91                                               ; 121
AAB9    !byte $8F, $4D, $7B, $82, $8F, $92, $87, $40, $18, $02

AAC3    !byte $6E                                               ; 122
AAC4    !byte $EE, $04, $B2, $3E, $0F, $E0, $07, $F8, $FB, $01

AACE    !byte $BF                                               ; 123
AACF    !byte $05, $B4, $7E, $3E, $1E, $D1, $20, $30, $02, $00

AAD9    !byte $19                                               ; 124
AADA    !byte $1D, $5C, $DE, $3D, $1D, $85, $18, $11, $F8, $00

AAE4    !byte $88                                               ; 125
AAE5    !byte $9C, $45, $B2, $D2, $8B, $D0, $28, $25, $EE, $00

AAEF    !byte $B6                                               ; 126
AAF0    !byte $C4, $FC, $9E, $30, $0E, $6E, $08, $B4, $03, $02

AAFA    !byte $85                                               ; 127
AAFB    !byte $8A, $F8, $F0, $72, $02, $F0, $F8, $1F, $FA, $01

AB05    !byte $8E                                               ; 128
AB06    !byte $DA, $E0, $B2, $24, $EE, $5E, $0F, $5D, $00, $02

AB10    !byte $49                                               ; 129
AB11    !byte $45, $95, $1C, $CF, $9A, $B0, $77, $59, $2C, $03

AB1B    !byte $D8                                               ; 130
AB1C    !byte $76, $48, $20, $45, $DF, $C0, $3F, $49, $00, $03

AB26    !byte $89                                               ; 131
AB27    !byte $57, $08, $2D, $56, $40, $E0, $60, $E8, $13, $00

AB31    !byte $29                                               ; 132
AB32    !byte $10, $09, $90, $8F, $3A, $02, $40, $49, $1A, $02

AB3C    !byte $B1                                               ; 133
AB3D    !byte $EB, $63, $20, $14, $5E, $41, $7F, $6C, $40, $03

AB47    !byte $F0                                               ; 134
AB48    !byte $8A, $00, $31, $D2, $5D, $02, $38, $19, $04, $01

AB52    !byte $D9                                               ; 135
AB53    !byte $50, $F4, $40, $02, $1F, $E2, $6F, $35, $00, $01

AB5D    !byte $B2                                               ; 136
AB5E    !byte $C0, $38, $31, $F2, $0D, $43, $C7, $60, $2E, $02

AB68    !byte $F1                                               ; 137
AB69    !byte $9B, $64, $7E, $FF, $EE, $32, $48, $1D, $02, $02

AB73    !byte $D3                                               ; 138
AB74    !byte $3E, $54, $AF, $00, $90, $00, $20, $35, $00, $01

AB7E    !byte $E2                                               ; 139
AB7F    !byte $A4, $60, $8B, $DF, $DE, $21, $78, $00, $0A, $01

AB89    !byte $FB                                               ; 140
AB8A    !byte $F5, $1C, $1F, $21, $8E, $E2, $47, $2D, $06, $00

AB94    !byte $FA                                               ; 141
AB95    !byte $52, $DC, $4C, $BC, $B0, $14, $19, $ED, $ED, $01

AB9F    !byte $C6                                               ; 142
ABA0    !byte $C9, $18, $A2, $63, $4E, $41, $48, $1D, $FA, $03

ABAA    !byte $F8                                               ; 143
ABAB    !byte $FB, $18, $EA, $3D, $F1, $92, $B1, $A8, $01, $00

ABB5    !byte $C6                                               ; 144
ABB6    !byte $12, $20, $A1, $83, $EE, $D1, $1E, $65, $22, $02

ABC0    !byte $E0                                               ; 145
ABC1    !byte $C2, $E3, $C0, $44, $8E, $51, $3F, $59, $0C, $01

ABCB    !byte $A3                                               ; 146
ABCC    !byte $D2, $A4, $C3, $31, $ED, $41, $10, $35, $04, $01

ABD6    !byte $31                                               ; 147
ABD7    !byte $BC, $50, $9F, $1D, $7B, $C3, $58, $31, $02, $01

ABE1    !byte $BE                                               ; 148
ABE2    !byte $07, $61, $30, $94, $EE, $30, $A9, $10, $00, $01

ABEC    !byte $D0                                               ; 149
ABED    !byte $93, $CB, $6D, $33, $1E, $13, $9F, $78, $40, $02

ABF7    !byte $AF                                               ; 150
ABF8    !byte $36, $F4, $B2, $84, $5E, $60, $07, $65, $1C, $02

AC02    !byte $12                                               ; 151
AC03    !byte $8C, $84, $2F, $DF, $8C, $E3, $57, $31, $06, $01

AC0D    !byte $BC                                               ; 152
AC0E    !byte $94, $13, $EE, $AF, $5F, $12, $F7, $24, $16, $02

AC18    !byte $97                                               ; 153
AC19    !byte $BB, $F0, $51, $F3, $DC, $70, $1F, $75, $18, $02

AC23    !byte $E3                                               ; 154
AC24    !byte $22, $68, $FE, $50, $3E, $02, $DF, $5C, $22, $03

AC2E    !byte $C9                                               ; 155
AC2F    !byte $5E, $D5, $FD, $3E, $1E, $34, $FF, $50, $0E, $01

AC39    !byte $14                                               ; 156
AC3A    !byte $F5, $60, $9D, $EB, $5D, $04, $41, $D5, $F9, $03

AC44    !byte $BA                                               ; 157
AC45    !byte $A6, $54, $6F, $01, $C1, $21, $89, $13, $08, $03

AC4F    !byte $C5                                               ; 158
AC50    !byte $68, $40, $EB, $8F, $B2, $52, $69, $D8, $FF, $01

AC5A    !byte $A6                                               ; 159
AC5B    !byte $E1, $33, $4D, $B0, $F0, $30, $F0, $10, $1A, $02

AC65    !byte $EE                                               ; 160
AC66    !byte $C7, $13, $5F, $6F, $DE, $72, $47, $49, $FA, $03

AC70    !byte $BD                                               ; 161
AC71    !byte $05, $C0, $EB, $2F, $52, $C2, $D6, $00, $2C, $00

AC7B    !byte $DB                                               ; 162
AC7C    !byte $28, $20, $B2, $74, $2D, $F1, $57, $19, $02, $02

AC86    !byte $B1                                               ; 163
AC87    !byte $04, $B0, $89, $12, $73, $31, $00, $D0, $25, $02

AC91    !byte $A2                                               ; 164
AC92    !byte $1F, $98, $D4, $C4, $FC, $4F, $F0, $4C, $16, $03

AC9C    !byte $B7                                               ; 165
AC9D    !byte $4A, $78, $9A, $22, $C0, $30, $D0, $08, $1E, $02

ACA7    !byte $A3                                               ; 166
ACA8    !byte $21, $48, $60, $02, $6F, $D1, $DE, $7C, $26, $00

ACB2    !byte $C0                                               ; 167
ACB3    !byte $0C, $09, $BF, $EF, $DE, $81, $D0, $10, $1A, $03

ACBD    !byte $97                                               ; 168
ACBE    !byte $18, $34, $DD, $11, $21, $C0, $90, $14, $1C, $00

ACC8    !byte $BB                                               ; 169
ACC9    !byte $75, $03, $A3, $A5, $BE, $8F, $07, $6D, $08, $01

ACD3    !byte $AE                                               ; 170
ACD4    !byte $46, $F5, $0B, $00, $00, $E1, $66, $20, $DA, $03

ACDE    !byte $A4                                               ; 171
ACDF    !byte $E8, $C7, $DB, $C1, $D2, $20, $E7, $08, $2C, $01

ACE9    !byte $AB                                               ; 172
ACEA    !byte $48, $7D, $3D, $D1, $9D, $F2, $77, $3C, $3C, $02

ACF4    !byte $9C                                               ; 173
ACF5    !byte $2C, $DC, $C2, $05, $4F, $DF, $BE, $5C, $2C, $00

ACFF    !byte $03                                               ; 174
AD00    !byte $CB, $13, $50, $F2, $9D, $62, $37, $45, $06, $02

AD0A    !byte $89                                               ; 175
AD0B    !byte $46, $08, $30, $D2, $3F, $E2, $17, $31, $EC, $03

AD15    !byte $DA                                               ; 176
AD16    !byte $9C, $58, $10, $20, $5D, $B4, $D7, $5C, $18, $01

AD20    !byte $AD                                               ; 177
AD21    !byte $40, $1D, $50, $6F, $BF, $83, $B7, $6C, $1C, $03

AD2B    !byte $8C                                               ; 178
AD2C    !byte $44, $C5, $30, $A1, $0D, $91, $28, $65, $EA, $03

AD36    !byte $C1                                               ; 179
AD37    !byte $11, $58, $DE, $01, $20, $40, $AE, $38, $3C, $03

AD41    !byte $39                                               ; 180
AD42    !byte $48, $A0, $9A, $DE, $EC, $A2, $60, $39, $08, $02

AD4C    !byte $C5                                               ; 181
AD4D    !byte $91, $EF, $90, $65, $10, $B0, $E6, $6C, $22, $02

AD57    !byte $00                                               ; 182
AD58    !byte $E3, $27, $1F, $55, $CF, $F1, $3E, $49, $18, $02

AD62    !byte $E6                                               ; 183
AD63    !byte $33, $47, $3F, $B5, $91, $60, $AE, $78, $24, $01

AD6D    !byte $8E                                               ; 184
AD6E    !byte $0E, $58, $1E, $E0, $12, $E4, $20, $10, $02, $02

AD78    !byte $36                                               ; 185
AD79    !byte $4A, $07, $3F, $AE, $5D, $7F, $57, $4C, $04, $00

AD83    !byte $90                                               ; 186
AD84    !byte $0A, $B8, $EC, $63, $A3, $40, $E7, $EC, $1B, $00

AD8E    !byte $32                                               ; 187
AD8F    !byte $80, $BA, $DE, $40, $C0, $C1, $58, $18, $0A, $01

AD99    !byte $82                                               ; 188
AD9A    !byte $D1, $78, $8F, $3D, $1F, $41, $09, $14, $02, $01

ADA4    !byte $06                                               ; 189
ADA5    !byte $12, $C8, $DD, $E0, $5C, $C4, $17, $55, $24, $00

ADAF    !byte $AF                                               ; 190
ADB0    !byte $A1, $6F, $01, $56, $D1, $10, $86, $64, $3C, $02

ADBA    !byte $14                                               ; 191
ADBB    !byte $35, $31, $1F, $9E, $DC, $72, $38, $25, $02, $00

ADC5    !byte $C5                                               ; 192
ADC6    !byte $9E, $C5, $6D, $5F, $01, $40, $30, $EC, $03, $01

ADD0    !byte $1C                                               ; 193
ADD1    !byte $14, $E0, $1E, $6F, $EE, $9E, $F7, $03, $04, $02

ADDB    !byte $94                                               ; 194
ADDC    !byte $8C, $8C, $03, $64, $3E, $40, $57, $38, $2A, $03

ADE6    !byte $13                                               ; 195
ADE7    !byte $B1, $58, $BE, $DF, $DB, $92, $FF, $5C, $28, $01

ADF1    !byte $05                                               ; 196
ADF2    !byte $15, $98, $0C, $73, $7E, $A2, $6E, $48, $48, $00

ADFC    !byte $B4                                               ; 197
ADFD    !byte $0A, $B1, $04, $7F, $0E, $C3, $90, $2B, $06, $01

AE07    !byte $32                                               ; 198
AE08    !byte $76, $44, $03, $14, $31, $91, $20, $14, $02, $00


; ----------------------------------
; 80 Bytes

AE12    !byte $54, $83, $10, $30, $17, $88, $24, $0E, $07, $F2
AE1C    !byte $2C, $26, $0A, $2B, $07, $EC, $85, $16, $3E, $31
AE26    !byte $10, $90, $03, $E4, $ED, $78, $E9, $01, $CC, $E2
AE30    !byte $A0, $7F, $1A, $1F, $11, $64, $E7, $0E, $13, $FA
AE3A    !byte $94, $07, $17, $4E, $35, $54, $48, $03, $EA, $EF
AE44    !byte $74, $BE, $2E, $BC, $BE, $68, $86, $33, $BE, $CF
AE4E    !byte $0C, $F8, $0B, $0E, $F8, $00, $EA, $10, $47, $E7
AE58    !byte $2C, $D8, $13, $35, $27, $54, $C8, $15, $D2, $BE

;AE62   4C DC C0    JMP $C0DC
; the following code was copied from $AE62 to $C000 in INITIALIZE_SPEECHMODULE_AND_C64
; see code at $C000


; ***************************************
; C000 - User Interface
; ***************************************

; Eprom: $0E62 seen at $AE62, copied to $C000

C000    4C DC C0    JMP $C0DC           ; STARTUP vector
C003    4C 1B C0    JMP $C01B           ; SRESET vector - Reset The Speech System / Stop Talking
C006    4C 39 C0    JMP $C039           ; SPSTAT vector - Get Status Of Speech Module
C009    4C 82 C0    JMP $C082           ; SAYIT vector - Say A Word
C00C    4C 85 C0    JMP $C085           ; SAYRAM vector - Say A Word From RAM
C00F    4C 7E C0    JMP $C07E           ; SPEED vector - Set Speaking Speed Of Synthesizer
C012    4C A3 C0    JMP $C0A3           ; SETTAB vector - Set Utterance Look Up Table Address
C015    4C 9F C0    JMP $C09F           ; SIGNAL vector - Enable Vectoring To Completion Code


; ---------------------------
; Subroutine: COMPLETION_CODE
; ---------------------------
; This ...
; power-up footprint
; C018    XX XX XX    JMP $YYYY         ; JUMP !
; YYYY    Code
;         RTS                           ; Return from Subroutine

C018    EA          NOP                 ; completion code vector
C019    EA          NOP                 ;
C01A    60          RTS                 ; Return
        ;_______________________________


; -----------------------------------------------------------
; Subroutine: SRESET - Reset The Speech System / Stop Talking
; -----------------------------------------------------------
; FUNCTION:
;  This command resets the synthesizer hardware. It should be included in application programs
;  for initialization purposes and may be used to stop speech output in mid-utterance.

; Condition: None

; Returned Information: Accumulator (A-reg) is destroyed

C01B    A9 00       LDA #$00            ; %0000 0000 - Disable Interrupts
C01D    8D DB C3    STA $C3DB           ; $C3DB = #$00 , Clear Counting Semaphore
C020    8D 85 DF    STA $DF85           ; 6525 Interrupt Mask Register - [-][-][-][0][DIR][EOS][0][0]
C023    20 39 C0    JSR $C039           ; Call SPSTAT
C026    F0 06       BEQ .Branch_C02E    ; Branch if speech module is ready to handle next "SAYIT" request (not busy)   >------
                                        ;                                                                                     |
.Jump7_C028                             ;                                                                                     |
C028    AD 39 03    LDA $0339           ; Reload original NMI vector MSB ($FE)                                                |
C02B    8D 19 03    STA $0319           ; Store to Vector: Hardware NMI Interrupt Address MSB                                 |
;                                                                                                                             |
.Branch_C02E                            ;                                                                                     |
C02E    A9 22       LDA #$22            ; %0010 0010 ,  , /WR=Low , $2=STOP-Command                                    <------
C030    8D 81 DF    STA $DF81           ; 6525 Port B - IN:[/EXROM] OUT:[?][?][/WR][D3][D2][D1][D0]
C033    09 10       ORA #$10            ; %0001 0000 ,  , /WR=High
C035    8D 81 DF    STA $DF81           ; 6525 Port B - IN:[/EXROM] OUT:[?][?][/WR][D3][D2][D1][D0]
C038    60          RTS                 ; Return
        ;_______________________________


; ------------------------------------------------
; Subroutine: SPSTAT - Get Status Of Speech Module
; ------------------------------------------------
; FUNCTION:
;  This command may be used to determine whether the speech module has completed previous "SAYIT"
;  requests and whether a new "SAYIT" request can be handled immediately.

; Condition: None

; Returned Information: A-reg = 0 if ready , A-reg = -1 if busy talking

C039    08          PHP                 ;
C03A    A9 C0       LDA #$C0            ; Load New NMI vector MSB ($C0)
C03C    CD 19 03    CMP $0319           ; Compare with Vector: Hardware NMI Interrupt Address MSB
C03F    F0 02       BEQ .Branch_C043    ;                                      >------
                                        ;                                             |
C041    A9 00       LDA #$00            ; 0                                           |
                    ;                                                                 |
.Branch_C043        ;                                                                 |
C043    28          PLP                 ;                                      <------
C044    09 00       ORA #$00            ; ?
C046    60          RTS                 ; Return
        ;_______________________________


; ------------------------------------------
; Interrupt Service Routine: MAGIC_VOICE_NMI
; ------------------------------------------
; FUNCTION:
;
; $0318 and $0319 contains the "Vector: Hardware NMI Interrupt Address"
; Default is $FE47
; An NMI is generated by the Magic Voice Module by two conditions
;   1. EOS-Signal (End of Speech) of the Speech Synthesizer (U5: T6721)
;   2. DIR-Signal (Data in Ready) of the 4-Bit x 16-Word FIFO Register (U1: 40105)

                    ; Save registers to stack
C047    48          PHA                 ; Push A , save Acc. to Stack
C048    8A          TXA                 ; Transfer X to A
C049    48          PHA                 ; Push A , save X-Reg. to Stack
C04A    98          TYA                 ; Transfer Y to A
C04B    48          PHA                 ; Push A , save Y-Reg. to Stack

                    ; Interrupt source from Magic Voice Module?
C04C    AD 85 DF    LDA $DF85           ; 6525 Interrupt Mask Register - [-][-][-][0][DIR][EOS][0][0]
C04F    F0 27       BEQ .Branch_C078    ; DIR or EOS? If not then -> Return                                                      >------
                                        ;                                                                                               |
C051    A9 00       LDA #$00            ; %0000 0000 - Disable Interrupts                                                               |
C053    8D 85 DF    STA $DF85           ; 6525 Interrupt Mask Register - [-][-][-][0][DIR][EOS][0][0]                                   |
                                        ;                                                                                               |
C056    20 AA C0    JSR $C0AA           ; Call TURN_OFF_INTERRUPTS_AND_BASIC                                                            |
C059    20 25 A1    JSR $A125           ; Call HANDLE_EOS_OR_DIR_INTERRUPT                                                              |
C05C    20 C7 C0    JSR $C0C7           ; Call TURN_ON_BASIC                                                                            |
C05F    20 39 C0    JSR $C039           ; Call SPSTAT                                                                                   |
C062    F0 07       BEQ .Branch_C06B    ; Branch if speech module is ready to handle next "SAYIT" request (not busy)   >------          |
                                        ;                                                                                     |         |
					; Module is busy                                                                                          |         |
C064    A9 0C       LDA #$0C            ; %0000 1100 - Enable Interrupts                                                      |         |
C066    8D 85 DF    STA $DF85           ; 6525 Interrupt Mask Register - [-][-][-][0][DIR][EOS][0][0]                         |         |
C069    D0 0D       BNE .Branch_C078    ; -> Return                                                                           |  >------+
                                        ;                                                                                     |         |
					; Module is ready                                                                                         |         |
.Branch_C06B        ;                                                                                                         |         |
C06B    AD DB C3    LDA $C3DB           ; Load Counting Semaphore                                                      <------          |
C06E    F0 08       BEQ .Branch_C078    ; if Zero then Speech Completed -> Return                                                >------+
                                        ;                                                                                               |
C070    CE DB C3    DEC $C3DB           ; $C3DB=$C3DB-1 , Decrement Counting Semaphore                                                  |
C073    F0 03       BEQ .Branch_C078    ; Speech Completed -> Return                                                             >------+
                                        ;                                                                                               |
C075    20 18 C0    JSR $C018           ; Call COMPLETION_CODE                                                                          |
                                        ;                                                                                               |
                    ; Restore registers from stack                                                                                      |
.Branch_C078        ;                                                                                                                   |
C078    68          PLA                 ; Pull A , restore Y-Reg. from Stack                                                     <------
C079    A8          TAY                 ; Transfer A to Y
C07A    68          PLA                 ; Pull A , restore X-Reg. from Stack
C07B    AA          TAX                 ; Transfer A to X
C07C    68          PLA                 ; Pull A , restore Acc. from Stack
C07D    40          RTI                 ; Return from INTERRUPT
        ;_______________________________


; -----------------------------------------------------
; Subroutine: SPEED - Set Speaking Speed Of Synthesizer
; -----------------------------------------------------
; FUNCTION:
;  The SPEED capability is used to speed up or slow down the speaking rate of the synthesizer.
;  The range of speed variations is from .64X decrease in the speed (speed code = 1) to a 1.4X
;  increase (speed code = 10). Normal speed is code 4.
;
; INPUT:
;  Condition: A-reg = desired speed code from 1...10

; Returned Information: No register affected

C07E    8D E7 A3    STA $A3E7           ; Store speed code in $A3E7 (writing over original ROM value)
C081    60          RTS                 ; Return
        ;_______________________________


; ------------------------------
; Subroutine: SAYIT - Say A Word
; ------------------------------
; FUNCTION:
;  This command initiates the synthesis of a word or phrase. Control is returned to the calling program
;  almost immediately if the module is not already talking. If the module is talking, then control will
;  not be returned until the current request can be initiated.
;  Words number 0 through 255 are words which are in the speech module. Words number 256 through 4095 are
;  interpreted as located in the user's program space.

; Condition: A-reg = Word-Number LSB, least significant portion of the word number
;            X-reg = Word-Number MSB, most significant portion of the word number

; Returned Information: All registers are destroyed

C082    18          CLC                 ; Clear Carry, indicates to use speech data from ROM
C083    90 01       BCC .Branch_C086    ; Branch always                                            >------
;                                                                                                         |
;                                                                                                         |
; ----------------------------------------                                                                |
; Subroutine: SAYRAM - Say A Word From RAM                                                                |
; ----------------------------------------                                                                |
; FUNCTION:                                                                                               |
;  This command is similar to the "SAYIT" except that the structure permitting access through the memory  |
;  mapping system is bypassed. This entry point is intented to permit generation of speech from RAM based |
;  speech data. This may also be useful if RAM versions of words are modified under program control.      |
;                                                                                                         |
; INPUT:                                                                                                  |
;  Condition: A-reg = Word-Number LSB, least significant portion of the word number                       |
;             X-reg = Word-Number MSB, most significant portion of the word number                        |
;                                                                                                         |
; Returned Information: All registers destroyed                                                           |
;                                                                                                         |
C085    38          SEC                 ; Set Carry, indicates to use speech data from RAM                |
;                                                                                                         |
.Branch_C086		;                                                                                     |
C086    48          PHA                 ; Push A , save Word-Number LSB                            <------

                    ; Loop (wait until speech module is ready)
.Branch_C087
C087    20 39 C0    JSR $C039           ; Call SPSTAT (destroys A)             <------
C08A    D0 FB       BNE .Branch_C087    ; Loop if speech module is busy (wait) >------

C08C    68          PLA                 ; Pull A , restore Word-Number LSB
C08D    86 BE       STX $BE             ; Store word MSB , Word-Number MSB
C08F    85 BD       STA $BD             ; Store word LSB , Word-Number LSB
C091    20 AA C0    JSR $C0AA           ; Call TURN_OFF_INTERRUPTS_AND_BASIC
C094    B0 03       BCS .Branch_C099    ; Branch if using RAM (Carry Set)      >------
                                        ;                                             |
C096    20 3E A0    JSR $A03E           ; Call SAY_ROMDATA                            |
                    ;                                                                 |
.Branch_C099        ;                                                                 |
C099    20 59 A0    JSR $A059           ; Call SAY_RAMDATA                     <------
C09C    4C 0E C2    JMP .Jump_C20E      ; Jump ... continue the "SAYRAM - Say A Word From RAM" - Routine


; --------------------------------------------------------
; Subroutine: SIGNAL - Enable Vectoring To Completion Code
; --------------------------------------------------------
; FUNCTION:
;  This function is for support of advanced applications which implement asynchronous event driven
;  programming techniques. The effect of the SIGNAL call is to increment a counting semaphore maintained
;  by the talking process. This semaphore is waited on by the speech completion, which when signalled,
;  will jump to the completion code vector address ($C018). Users should plant a JMP intruction in the
;  three bytes of memory starting at this address. ONLY $C018-$C01A SHOULD BE CHANGED.

; Condition: JMP instruction to completion code handling routine MUST be planted in memory locations $C018-$C01A

; Returned Information: None

C09F    EE DB C3    INC $C3DB           ; $C3DB=$C3DB+1 , Increment Counting Semaphore
C0A2    60          RTS                 ; Return
        ;_______________________________


; --------------------------------------------------------
; Subroutine: SETTAB - Set Utterance Look Up Table Address
; --------------------------------------------------------
; FUNCTION:
;  The SETTAB function is used to tell the speech module the starting memory address of user supplied speech data.
;  It is identical to the BASIC VOC command. This command MUST be employed prior to any attempts to generate speech
;  with utterance numbers greater than 255.

; Condition: A-reg = LSB , lower byte of address
;            X-reg = MSB , upper byte of address

; Returned Information: None


C0A3    8D CE C3    STA $C3CE           ; RAM Utterance Look Up Table Address LSB
        8E CF C3    STX $C3CF           ; RAM Utterance Look Up Table Address MSB
C0A9    60          RTS                 ; Return
        ;_______________________________


; -----------------------------------------
; Subroutine: TURN_OFF_INTERRUPTS_AND_BASIC
; -----------------------------------------
; FUNCTION:
; 
; CALLED FROM:
;


C0AA    78          SEI                 ; Set Interrupt Flag (disable IRQ)
C0AB    AD 86 DF    LDA $DF86           ; 6525 Control Register - [CB1][CB0][CA1][CA0][IE4][IE3][IP][MC]
C0AE    8D DF C3    STA $C3DF           ; Storage for 6525 Control Register
C0B1    29 CF       AND #$CF            ; %1100 1111 -> xx00xxxx
C0B3    09 20       ORA #$20            ; %0010 0000 -> xx10xxxx -> RAM, CA=Low
C0B5    8D 86 DF    STA $DF86           ; 6525 Control Register - [CB1][CB0][CA1][CA0][IE4][IE3][IP][MC]
C0B8    A9 E5       LDA #$E5            ; %1110 0110 , RAM , CA=Low, CB=High, Priority Operation
C0BA    8D 86 DF    STA $DF86           ; 6525 Control Register - [CB1][CB0][CA1][CA0][IE4][IE3][IP][MC]
C0BD    A5 01       LDA $01             ; 6510 On-Chip Port - [-][-][Cass Motor][Cass Switch][Cass DOut][/CHAREN][/HIRAM][/LORAM]
C0BF    8D E1 C3    STA $C3E1           ; Storage for 6510 On-Chip Port
C0C2    29 FE       AND #$FE            ; %1111 1110
C0C4    85 01       STA $01             ; 6510 On-Chip Port - [-][-][Cass Motor][Cass Switch][Cass DOut][/CHAREN][/HIRAM][/LORAM]
C0C6    60          RTS                 ; Return
        ;_______________________________


; -------------------------
; Subroutine: TURN_ON_BASIC
; -------------------------
; FUNCTION:
; 

C0C7    AD E1 C3    LDA $C3E1           ; Storage for 6510 On-Chip Port , Retrieve old value
C0CA    85 01       STA $01             ; 6510 On-Chip Port - [-][-][Cass Motor][Cass Switch][Cass DOut][/CHAREN][/HIRAM][/LORAM]
C0CC    AD DF C3    LDA $C3DF           ; Storage for 6525 Control Register
C0CF    48          PHA                 ; Push A
C0D0    29 CF       AND #$CF            ; %1100 1111 -> xx00xxxx
C0D2    09 20       ORA #$20            ; %0010 0000 -> xx10xxxx -> RAM, CA=Low
C0D4    8D 86 DF    STA $DF86           ; 6525 Control Register - [CB1][CB0][CA1][CA0][IE4][IE3][IP][MC]
C0D7    68          PLA                 ; Pull A , Restore old value
C0D8    8D 86 DF    STA $DF86           ; 6525 Control Register - [CB1][CB0][CA1][CA0][IE4][IE3][IP][MC]
C0DB    60          RTS                 ; Return
        ;_______________________________


; --------
; STARTUP
; --------
; FUNCTION:
; After RESET (Power Up)
; 
.
C0DC    20 87 FF    JSR $FF87           ; Call RAMTAS Init Ram & Buffers
C0DF    20 8A FF    JSR $FF8A           ; Call RESTOR Restore Vectors
C0E2    20 81 FF    JSR $FF81           ; Call CINT Init Editor & Video Chips
C0E5    58          CLI                 ; Clear Interrupt Flag (enable IRQ)
C0E6    A9 04       LDA #$04            ; A = 4
C0E8    8D DC C3    STA $C3DC           ; Speech Speed
C0EB    A2 00       LDX #$00            ; X = 0
C0ED    8E CE C3    STX $C3CE           ; RAM Utterance Look Up Table Address LSB
C0F0    8E CF C3    STX $C3CF           ; RAM Utterance Look Up Table Address MSB
C0F3    8E DB C3    STX $C3DB           ; $C3DB = #$00 , Clear Counting Semaphore

                    ; Initialise Vectors
                    ; Copy 12 bytes from $C105-$C110 (Eprom $0F67-) to $0300-$030B
C0F6    A2 0C       LDX #$0C            ; 12 Bytes

.Branch_C0F8        ; Loop
C0F8    BD 04 C1    LDA $C104,X         ; $C104 + $0C = $C110                  <------
C0FB    9D FF 02    STA $02FF,X         ; $02FF + $0C = $030B                         |
C0FE    CA          DEX                 ; X = X - 1                                   |
C0FF    D0 F7       BNE .Branch_C0F8    ; Loop                                 >------

C101    58          CLI                 ; Clear Interrupt Flag (enable IRQ)
C104    4C 97 E3    JMP $E397           ; KERNEL - Entry after JSR $E453(initialise vectors) - ($E394=RESET routine)
                                        ; jump to 3 bytes after init (BASIC Cold Start)


; ---------------------------------------------
; Eprom: $0F67
; 12 bytes copied from $C105 (Eprom $0F67) by Startup routine to $0300
C105    !byte $8B, $E3                  ; Vector: $E38B BASIC Error Message                   (original=$E38B, unchanged)
C107    !byte $83, $A4                  ; Vector: $A483 BASIC Input Line and Decode           (original=$A483, unchanged)
C109    !byte $79, $C2                  ; Vector: $C279 BASIC Tokenise Routine                (original=$A57C)
C10B    !byte $58, $C3                  ; Vector: $C358 BASIC LIST Routine                    (original=$A71A)
C10D    !byte $11, $C1                  ; Vector: $C111 BASIC Character dispatch Routine      (original=$A7E4)
C10F    !byte $8E, $C3                  ; Vector: $C38E BASIC Token evaluation                (original=$AE86)


; ---------------------------------------------
; Magic Voice, BASIC Character dispatch Routine
; ---------------------------------------------
;
.
C111    20 73 00    JSR $0073           ; Call: Get next byte of BASIC text
C114    C9 FE       CMP #$FE            ; is this a magic voice token?
C116    F0 06       BEQ .Branch_C11E    ; Branch if yes                                                                >------
;                                                                                                                             |
C118    20 79 00    JSR $0079           ; Call: Entry to get same byte again ($0073=Get next byte of BASIC text)              |
;                                                                                                                             |
C11B    4C E7 A7    JMP $A7E7           ; Call: Entry after JSR $0073 ($A7E4=BASIC Character dispatch Routine)                |
;                                                                                                                             |
.Branch_C11E        ;                                                                                                         |
C11E    20 73 00    JSR $0073           ; Call: Get next byte of BASIC text                                            <------
C121    29 7F       AND #$7F            ; %0111 1111 (second token byte is $80..$84)
C123    C9 00       CMP #$00            ; %0000 0000
C125    F0 42       BEQ .Branch_C169    ; SAY                                                                          >------
C127    C9 01       CMP #$01            ; %0000 0001                                                                          |
C129    F0 29       BEQ .Branch_C154    ; RATE                                                               >------          |
C12B    C9 02       CMP #$02            ; %0000 0010                                                                |         |
C12D    F0 0B       BEQ .Branch_C13A    ; VOC                                                      >------          |         |
C12F    A2 0B       LDX #$0B            ; X=11 , Error-Message: syntax                                    |         |         |
;                                                                                                         |         |         |
                    ; Error message                                                                       |         |         |
.Branch_C131        ;                                                                                     |         |         |  <------
C131    20 8B E3    JSR $E38B           ; Call: KERNEL - Handle error messages                            |         |         |         |
C134    38          SEC                 ; Set Carry                                                       |         |         |         |
C135    60          RTS                 ; Return                                                          |         |         |         |
        ;_______________________________                                                                  |         |         |         |
;                                                                                                         |         |         |         |
                    ;                                                                                     |         |         |         |
.Branch_C136        ;                                                                                     |         |         |         |
C136    A2 16       LDX #$16            ; X=22 , Error-Message: type mismatch                             |         |         |         |  <------
C138    D0 F7       BNE .Branch_C131    ; > Call: KERNEL - Handle error messages -> Return                |         |         |  >------+         |
                                        ;                                                                 |         |         |         |         |
                    ; *******                                                                             |         |         |         |         |
                    ; * VOC *                                                                             |         |         |         |         |
                    ; *******                                                                             |         |         |         |         |
.Branch_C13A        ;                                                                                     |         |         |         |         |
C13A    20 73 00    JSR $0073           ; Call: Get next byte of BASIC text                        <------          |         |         |         |
C13D    20 9E AD    JSR $AD9E           ; Call: BASIC - Evaluate Expression in Text                                 |         |         |         |
C140    24 0D       BIT $0D             ; check if numeric                                                          |         |         |         |
C142    30 F2       BMI .Branch_C136    ; Bit7=1? -> Type Mismatch Error                                            |         |         |  >------+
                                        ;                                                                           |         |         |         |
C144    20 F7 B7    JSR $B7F7           ; Call: BASIC - Convert FAC#1 Float-to-Integer in $14/$15                   |         |         |         |
C147    A5 14       LDA $14             ;                                                                           |         |         |         |
C149    8D CE C3    STA $C3CE           ; RAM Utterance Look Up Table Address LSB                                   |         |         |         |
C14C    A5 15       LDA $15             ;                                                                           |         |         |         |
C14E    8D CF C3    STA $C3CF           ; RAM Utterance Look Up Table Address MSB                                   |         |         |         |
C151    4C AE A7    JMP $A7AE           ; BASIC: BASIC Warm Start (execute next statement)                          |         |         |         |
                                        ;                                                                           |         |         |         |
                    ; ********                                                                                      |         |         |         |
                    ; * RATE *                                                                                      |         |         |         |
                    ; ********                                                                                      |         |         |         |
.Branch_C154        ;                                                                                        <------          |         |         |
C154    20 73 00    JSR $0073           ; Call: Get next byte of BASIC text                                                   |         |         |
C157    20 9E AD    JSR $AD9E           ; Call: BASIC - Evaluate Expression in Text                                           |         |         |
C15A    24 0D       BIT $0D             ; check if numeric                                                                    |         |         |
C15C    30 D8       BMI .Branch_C136    ; Bit7=1? -> -> Type Mismatch Error                                                   |         |  >------
;                                                                                                                             |         |
C15E    20 F7 B7    JSR $B7F7           ; Call: BASIC - Convert FAC#1 Float-to-Integer in $14/$15                             |         |
;                                                                                                                             |         |
;                                                                                                                             |         |
C161    A5 14       LDA $14             ;                                                                                     |         |
C163    8D DC C3    STA $C3DC           ; Speech Speed                                                                        |         |
C166    4C AE A7    JMP $A7AE           ; BASIC: BASIC Warm Start (execute next statement)                                    |         |
;                                                                                                                             |         |
                    ; *******                                                                                                 |         |
                    ; * SAY *                                                                                                 |         |
                    ; *******                                                                                                 |         |
.Branch_C169        ;                                                                                                         |         |
C169    20 73 00    JSR $0073           ; Call: Get next byte of BASIC text                                            <------          |
C16C    20 9E AD    JSR $AD9E           ; Call: BASIC - Evaluate Expression in Text                                                     |
;                                                                                                                                       |
                    ; Loop                                                                                                              |
.Branch_C16F        ;                                                                                                                   |
C16F    20 39 C0    JSR $C039           ; Call SPSTAT                          <------+                                                 |
C172    D0 FB       BNE .Branch_C16F    ; Loop if speech module is busy (wait) >------+                                                 |
;                                                                                                                                       |
C174    24 0D       BIT $0D             ; check if numeric                                                                              |
C176    10 5A       BPL .Branch_C1D2    ; -> SAY "Word Number"                                                         >------          |
                                        ;                                                                                     |         |
                    ; SAY "Word String"                                                                                       |         |
C178    20 A3 B6    JSR $B6A3           ; Call: BASIC - Perform String Housekeeping                                           |         |
C17B    A8          TAY                 ; Transfer A to Y                                                                     |         |
C17C    A9 00       LDA #$00            ; A = 0                                                                               |         |
C17E    85 FB       STA $FB             ; $FB = 0                                                                             |         |
C180    88          DEY                 ; Y = Y - 1                                                                           |         |
                                        ;                                                                                     |         |
                    ; Loop C181                                                <----------                                    |         |
.Branch_C181        ;                                                                     |                                   |         |
C181    8D DA C3    STA $C3DA           ;                                                 |                                   |         |
C184    B1 22       LDA ($22),Y         ;                                                 |                                   |         |
C186    29 5F       AND #$5F            ; %0101 1111 , 95                                 |                                   |         |
C188    18          CLC                 ; Clear Carry                                     |                                   |         |
C189    65 FB       ADC $FB             ; Add                                             |                                   |         |
C18B    85 FB       STA $FB             ; Store                                           |                                   |         |
C18D    90 03       BCC .Branch_C192    ;                                      >------    |                                   |         |
                                        ;                                             |   |                                   |         |
C18F    EE DA C3    INC $C3DA           ; $C3DA = $C3DA + 1                           |   |                                   |         |
                                        ;                                             |   |                                   |         |
.Branch_C192                            ;                                             |   |                                   |         |
C192    88          DEY                 ; Y = Y - 1                            <------    |                                   |         |
C193    30 0F       BMI .Branch_C1A4    ; Bit7 = 1 ?                                      |        >------                    |         |
                                        ;                                                 |               |                   |         |
C195    A2 04       LDX #$04            ; X = 4                                           |               |                   |         |
C197    AD DA C3    LDA $C3DA           ;                                                 |               |                   |         |
                                        ;                                                 |               |                   |         |
                    ; Loop C19A                                                <------    |               |                   |         |
.Branch_C19A                            ;                                             |   |               |                   |         |
C19A    C9 80       CMP #$80            ; %1000 0000                                  |   |               |                   |         |
C19C    26 FB       ROL $FB             ; Rotate Left with Carry                      |   |               |                   |         |
C19E    2A          ROL                 ;                                             |   |               |                   |         |
C19F    CA          DEX                 ; X=X-1                                       |   |               |                   |         |
C1A0    D0 F8       BNE .Branch_C19A    ; Loop C19A                            >------    |               |                   |         |
C1A2    F0 DD       BEQ .Branch_C181    ; Loop C181                            >----------                |                   |         |
                                        ;                                                                 |                   |         |
                                        ;                                                                 |                   |         |
                    ; RAM - Table (custom vocabulary)                                                     |                   |         |
                    ; -----------                                                                         |                   |         |
.Branch_C1A4        ;                                                                                     |                   |         |
C1A4    AD CF C3    LDA $C3CF           ; RAM Utterance Look Up Table Address MSB                  <------                    |         |
C1A7    85 23       STA $23             ; if $00 (VOC not set) then build in words                                            |         |
C1A9    F0 0D       BEQ .Branch_C1B8    ; -> ROM                               >------                                        |         |
                                        ;                                             |                                       |         |
C1AB    AD CE C3    LDA $C3CE           ; RAM Utterance Look Up Table Address LSB     |                                       |         |
C1AE    85 22       STA $22             ;                                             |                                       |         |
C1B0    20 2F C2    JSR $C22F           ; Call BASIC_GET_WORDNUMBER_FROM_WORDSTRING   |                                       |         |
C1B3    E6 BE       INC $BE             ; $BE = $BE + 1                               |                                       |         |
C1B5    8A          TXA                 ; Transfer X to A                             |                                       |         |
C1B6    D0 25       BNE .Branch_C1DD    ;                                             |              >------                  |         |
                                        ;                                             |                     |                 |         |
                                        ;                                             |                     |                 |         |
                    ; ROM - Table (build in phrases)                                  |                     |                 |         |
                    ; -----------                                                     |                     |                 |         |
.Branch_C1B8        ;                                                                 |                     |                 |         |
C1B8    20 AA C0    JSR $C0AA           ; Call TURN_OFF_INTERRUPTS_AND_BASIC   <------                      |                 |         |
C1BB    A9 40       LDA #$40            ;                                                                   |                 |         |
C1BD    85 22       STA $22             ; $B240 - Start of built in Speech Data Table                       |                 |         |
C1BF    A9 B2       LDA #$B2            ; build in Utterance Look Up Table Address                          |                 |         |
C1C1    85 23       STA $23             ;                                                                   |                 |         |
C1C3    20 2F C2    JSR $C22F           ; Call BASIC_GET_WORDNUMBER_FROM_WORDSTRING                         |                 |         |
C1C6    8A          TXA                 ; Transfer X to A                                                   |                 |         |
C1C7    D0 17       BNE .Branch_C1E0    ;                                                                   |     >------     |         |
                                        ;                                                                   |            |    |         |
                    ;                                                                                       |            |    |         |
.Branch_C1C9        ;                                                                                       |            |    |         |
C1C9    20 C7 C0    JSR $C0C7           ; Call TURN_ON_BASIC                                                |            |    |         |
C1CC    58          CLI                 ; Clear Interrupt Flag (enable IRQ)                                 |            |    |         |
C1CD    A2 0E       LDX #$0E            ; X=14 , Error-Message: illegal quantity                            |            |    |         |
C1CF    4C 31 C1    JMP .Branch_C131    ; > Call: KERNEL - Handle error messages -> Return                  |            |    |  >------
                                        ;                                                                   |            |    |
                                        ;                                                                   |            |    |
.Branch_C1D2        ;                                                                                       |            |    |
C1D2    20 F7 B7    JSR $B7F7           ;  Call: BASIC - Convert FAC#1 Float-to-Integer in $14/$15          |            | <--
C1D5    A5 14       LDA $14             ;  ( at $A212                                                       |            |
C1D7    85 BD       STA $BD             ;     > $BD/$BE points to $C3FF , End of SPEECHDATA_BUFFER_T6721    |            |
C1D9    A5 15       LDA $15             ; $15                                                               |            |
C1DB    85 BE       STA $BE             ;                                                                   |            |
                                        ;                                                                   |            |
.Branch_C1DD        ;                                                                                       |            |
C1DD    20 AA C0    JSR $C0AA           ; Call TURN_OFF_INTERRUPTS_AND_BASIC                         <------             |
                                        ;                                                                                |
.Branch_C1E0        ;                                                                                                    |
C1E0    20 E6 C1    JSR $C1E6           ; Call Magic Voice, BASIC_COMMAND_SAY                                     <------
C1E3    4C AE A7    JMP $A7AE           ; BASIC: BASIC Warm Start (execute next statement)


; --------------------------------------------------
; Subroutine: $C1E6 - Magic Voice, BASIC_COMMAND_SAY
; --------------------------------------------------
;
; FUNCTION:
;  This routine is called, if the Basic command "SAY" ...
;
; INPUT:
;  $BD/$BE = Word Number
;
; OUTPUT:
;
; DESTROYS:
;
; CALLS:
;  - $A000 , INIT_VOICE_SYNTHESIZER
;  - $A03E , SAY_ROMDATA
;  - $A059 , SAY_RAMDATA
;
;
; CALLED FROM:
;  - $C1E0 , Magic Voice, BASIC Character dispatch Routine                                                |
;                                                                                                         |
; INFO:                                                                                                   |
;  If Word-Number is > 255 but no VOC set, then return                                                    |
;  If VOC-Adress is within [$A000..$C000]                                                                 |
;
                    ;                                                                                     |
C1E6    A9 00       LDA #$00            ; A=0                                                             |
C1E8    8D DB C3    STA $C3DB           ; C3DB = #$00 , Clear Counting Semaphore                          |
C1EB    AD DC C3    LDA $C3DC           ; Speech Speed                                                    |
C1EE    8D E7 A3    STA $A3E7           ; Speech Speed                                                    |
C1F1    A5 BE       LDA $BE             ; Word-Number MSB                                                 |
C1F3    F0 14       BEQ .Branch_C209    ; 0? If Word-Number is <= 255 Then ...           >------          |
                                        ;                                                       |         |
C1F5    AD CF C3    LDA $C3CF           ; RAM Utterance Look Up Table Address MSB               |         |
C1F8    F0 CF       BEQ .Branch_C1C9    ; if 0 , no VOC set (-> Return)                         |  >------+
                                        ;                                                       |         |
C1FA    AD CF C3    LDA $C3CF           ; RAM Utterance Look Up Table Address MSB               |         |
C1FD    CD 84 02    CMP $0284           ; =CMP #$A0 , $0283/$0284 Pointer:                      |         |
                                        ;  Top of Memory for Operating System ($A000)           |         |
C200    90 07       BCC .Branch_C209    ;                                                >------+         |
                                        ;                                                       |         |
C202    C9 C0       CMP #$C0            ; %1100 0000 , 12 ($C000)                               |         |
C204    B0 03       BCS .Branch_C209    ; Branch if using RAM (Carry Set)                >------+         |
                                        ;                                                       |         |
                    ; ROM                                                                       |         |
                    ; ---                                                                       |         |
C206    20 3E A0    JSR $A03E           ; Call SAY_ROMDATA                                      |         |   Custom
                                        ;                                                       |         |
                    ; RAM                                                                       |         |
                    ; ---                                                                       |         |
.Branch_C209        ;                                                                           |         |
C209    20 59 A0    JSR $A059           ; Call SAY_RAMDATA                               <------          |   Built-in or Cartridge
C20C    B0 BB       BCS .Branch_C1C9    ; ... (-> Return)                                          >------


; ----------------------------------------------------------------
; from C09C: continue the "SAYRAM - Say A Word From RAM" - Routine
------------------------------------------------------------------
; continued from assembler interface (SAYIT or SAYRAM) or BASIC command SAY
;
.Jump_C20E
C20E    B0 15       BCS .Branch_C225    ; Branch if using RAM (Carry Set)                >------
                                        ;                                                       |
                    ; ROM                                                                       |
                    ; ---                                                                       |
C210    AD 19 03    LDA $0319           ; Vector: Hardware NMI Interrupt Address MSB            |
C213    8D 39 03    STA $0339           ; relocated original NMI vector MSB                     |
C216    AD 18 03    LDA $0318           ; Vector: Hardware NMI Interrupt Address LSB            |
C219    C9 47       CMP #$47            ; $xx47                                                 |
C21B    D0 08       BNE .Branch_C225    ;                                                >------+
                                        ;                                                       |
C21D    A9 C0       LDA #$C0            ; $C0xx                                                 |
C21F    8D 19 03    STA $0319           ; Vector: Hardware NMI Interrupt Address MSB            |
C222    20 01 A0    JSR $A001           ; Call INIT_VOICE_SYNTHESIZER                           |
                                        ;                                                       |
                    ; RAM                                                                       |
                    ; ---                                                                       |
.Branch_C225        ;                                                                           |
C225    20 C7 C0    JSR $C0C7           ; Call TURN_ON_BASIC                             <------
C228    A9 0C       LDA #$0C            ; %0000 1100 - Enable Interrupts
C22A    8D 85 DF    STA $DF85           ; 6525 Interrupt Mask Register - [-][-][-][0][DIR][EOS][0][0]
C22D    58          CLI                 ; Clear Interrupt Flag (enable IRQ)
C22E    60          RTS                 ; Return
        ;_______________________________


; ----------------------------------------------------------------------
; Subroutine: $C22F - Magic Voice , BASIC_GET_WORDNUMBER_FROM_WORDSTRING
; ----------------------------------------------------------------------
; FUNCTION:
;  If the Basic command SAY is used with "<word>" (e.g. SAY "HI"),
;  this routine will determine the corresponding word number.
;
; INPUT:
;  $22 = Utterance Look Up Table Address LSB (VOC-Startadress)
;  $23 = Utterance Look Up Table Address MSB (VOC-Startadress)
;  $FB =
;  $C3DA = 
:
; OUTPUT:
;  X = ? (transfered to A after RETURN)
;  $xx = 
;  $BD/$BE = Word Number
;
; DESTROYS:
;
; CALLS:
;  nothing
;
; CALLED FROM:
;  - $C1B0 , in Sub $C111 - Magic Voice, BASIC Character dispatch Routine (RAM user data)
;  - $C1C3 , in Sub $C111 - Magic Voice, BASIC Character dispatch Routine (ROM build in data)
;
; INFO:
; Build in: $22 = #$40 , $23 = #$B2 , VOC-Address $B240
; $01DA

                    ;
C22F    A0 01       LDY #$01            ; Y=1
C231    B1 22       LDA ($22),Y         ; read from VOC-Address, (Offset to startadress of Word-Tokenlist) +1 = 2nd byte
C233    88          DEY                 ; Y=Y-1=0
C234    18          CLC                 ; Clear Carry
C235    65 22       ADC $22             ; Add, $40 + $DA = $11A (Carry + $1A)
C237    48          PHA                 ; Push A, save 2nd Byte
C238    B1 22       LDA ($22),Y         ; read from VOC-Address, (Offset to startadress of Word-Tokenlist) +0 = 1st Byte
C23A    65 23       ADC $23             ; Add, $B2 + $01 = $B3 + Carry = $B4
C23C    85 23       STA $23             ; Store, 1st byte
C23E    68          PLA                 ; Pull A, restore 2nd Byte
C23F    85 22       STA $22             ; Store, 2nd Byte
                    ; now $22/$23 contains the address of the beginning of Word-Tokenlist, Build in = $B41A
C241    A2 02       LDX #$02            ; X = 2
C243    84 BE       STY $BE             ; $BE = #$00

                    ;
.Branch_C245        ;                                                                    <------
C245    8A          TXA                 ; Transfer X to A                                       |
C246    D0 0A       BNE .Branch_C252    ; ...                             >------               |
                                        ;                                        |              |
.Branch_C248        ;                                                            |              |
C248    8A          TXA                 ; Transfer X to A                        |  <------     |
C249    F0 06       BEQ .Branch_C251    ; -> Return             >------          |         |    |
                                        ;                              |         |         |    |
C24B    98          TYA                 ; Transfer Y to A              |         |         |    |
C24C    46 BE       LSR $BE             ;                              |         |         |    |
C24E    6A          ROR                 ;                              |         |         |    |
C24F    85 BD       STA $BD             ;                              |         |         |    |
                                        ;                              |         |         |    |
.Branch_C251        ;                                                  |         |         |    |
C251    60          RTS                 ; Return                <------          |         |    |
        ;_______________________________                                         |         |    |
                                        ;                                        |         |    |
                    ; ...                                                        |         |    |
.Branch_C252        ;                                                     <------          |    |
C252    A2 02       LDX #$02            ; X=2                                              |    |
C254    B1 22       LDA ($22),Y         ;                                                  |    |
C256    D0 01       BNE .Branch_C259    ;                       >------                    |    |
C258    CA          DEX                 ; X=X-1                        |                   |    |
                    ;                                                  |                   |    |
.Branch_C259        ;                                                  |                   |    |
C259    C5 FB       CMP $FB             ;                       <------                    |    |
C25B    D0 0D       BNE .Branch_C26A    ;                                 >------          |    |
                                        ;                                        |         |    |
C25D    C8          INY                 ; Y=Y+1                                  |         |    |
C25E    B1 22       LDA ($22),Y         ;                                        |         |    |
C260    D0 01       BNE .Branch_C263    ;                       >------          |         |    |
C262    CA          DEX                 ; X=X-1                        |         |         |    |
                    ;                                                  |         |         |    |
.Branch_C263        ;                                                  |         |         |    |
C263    CD DA C3    CMP $C3DA           ;                       <------          |         |    |
C266    F0 E0       BEQ .Branch_C248    ;                                        |  >------     |
C268    D0 06       BNE .Branch_C270    ;                       >------          |              |
                    ;                                                  |         |              |
.Branch_C26A        ;                                                  |         |              |
C26A    C8          INY                 ; Y=Y+1                        |  <------               |
C26B    B1 22       LDA ($22),Y         ;                              |                        |
C26D    D0 01       BNE .Branch_C270    ;                       >------+                        |
                                        ;                              |                        |
C26F    CA          DEX                 ; X=X-1                        |                        |
                    ;                                                  |                        |
.Branch_C270        ;                                                  |                        |
C270    C8          INY                 ; Y=Y+1                 <------                         |
C271    D0 D2       BNE .Branch_C245    ;                                                >------+
                                        ;                                                       |
C273    E6 23       INC $23             ; $23=$23+1                                             |
                                        ;                                                       |
                    ;                                                                           |
C275    E6 BE       INC $BE             ; $BE=$BE+1                                             |
C277    D0 CC       BNE .Branch_C245    ;                                                >------


; -----------------------------------
; Magic Voice, BASIC Tokenise Routine
; -----------------------------------
; compare with original C64 BASIC-ROM at $A57C (standard token cruncher)

C279    A6 7A       LDX $7A             ; X = $7A/$7B Pointer: Current Byte of BASIC Text
C27B    A0 04       LDY #$04            ; Y=4
C27D    84 0F       STY $0F             ; $0F=4 , Flag: DATA scan/List Quote/Garbage collection

.Branch_C27F
C27F    BD 00 02    LDA $0200,X         ; System- / BASIC-Eingabepuffer        <------
C282    10 07       BPL .Branch_C28B    ;                       >------               |
                    ;                                                  |              |
C284    C9 FF       CMP #$FF            ; 255 = PI                     |              |
C286    F0 43       BEQ .Branch_C2CB    ; (Exit)                       |              |            >------
                                        ;                              |              |                   |
C288    E8          INX                 ; X=X+1                        |              |                   |
C289    D0 F4       BNE .Branch_C27F    ;                              |       >------                    |
                    ;                                                  |                                  |
.Branch_C28B        ;                                                  |                                  |
C28B    C9 20       CMP #$20            ; 32 = Space            <------                                   |
C28D    F0 3C       BEQ .Branch_C2CB    ;                                                          >------+
                    ;                                                                                     |
C28F    8D DA C3    STA $C3DA           ;                                                                 |
C292    C9 22       CMP #$22            ; 34 = " (quotation mark)                                         |
C294    F0 5C       BEQ .Branch_C2F2    ;                                                                 |  >------
                    ;                                                                                     |         |
C296    24 0F       BIT $0F             ; Quotation mode switch during tokenization, Bit6: 0=Normal mode, 1=Quotation mode
C298    70 31       BVS .Branch_C2CB    ; Overflow-Flag Bit6=1                                     >------+         |
                    ;                                                                                     |         |
C29A    C9 3F       CMP #$3F            ; 63 = "?" (question mark)                                        |         |
C29C    D0 04       BNE .Branch_C2A2    ;                                      >------                    |         |
                    ;                                                                 |                   |         |
C29E    A9 99       LDA #$99            ; 153 = , PRINT-Code                          |                   |         |
C2A0    D0 29       BNE .Branch_C2CB    ;                                             |            >------+         |
                    ;                                                                 |                   |         |
.Branch_C2A2        ;                                                                 |                   |         |
C2A2    C9 30       CMP #$30            ; 48 = "0"                             <------                    |         |
C2A4    90 04       BCC .Branch_C2AA    ;                                      >------                    |         |
                    ;                                                                 |                   |         |
C2A6    C9 3C       CMP #$3C            ; 60 = "<"                                    |                   |         |
C2A8    90 21       BCC .Branch_C2CB    ;                                             |            >------+         |
                    ;                                                                 |                   |         |
                    ; "0".."9", ":", ";"                                              |                   |         |
.Branch_C2AA                                                                          |                   |         |
C2AA    8C D9 C3    STY $C3D9           ;                                      <------                    |         |
C2AD    A0 00       LDY #$00            ; Y = 0                                                           |         |
C2AF    8C D8 C3    STY $C3D8           ;                                                                 |         |
C2B2    88          DEY                 ; Y=Y-1                                                           |         |
C2B3    86 7A       STX $7A             ; $7A/$7B Pointer: Current Byte of BASIC Text                     |         |
C2B5    CA          DEX                 ; X=X-1                                                           |         |
                    ;                                                                                     |         |
.Branch_C2B6        ;                                                                                     |         |
C2B6    C8          INY                 ; Y = Y + 1                  <------                              |         |
C2B7    E8          INX                 ; X = X + 1                         |                             |         |
;                                                                           |                             |         |
.Branch_C2B8                            ;                                   |                             |         |
C2B8    BD 00 02    LDA $0200,X         ; System-/BASIC-Eingabepuffer       |            <------          |         |
C2BB    38          SEC                 ; Set Carry                         |                   |         |         |
C2BC    F9 9E A0    SBC $A09E,Y         ; Sub, Table of C64-BASIC-Commands  |                   |         |         |
C2BF    F0 F5       BEQ .Branch_C2B6    ;                            >------                    |         |         |
;                                                                                               |         |         |
C2C1    C9 80       CMP #$80            ; %1000 0000 , last letter?                             |         |         |
C2C3    D0 34       BNE .Branch_C2F9    ;                                           >------     |         |         |
;                                                                                          |    |         |         |
C2C5    0D D8 C3    ORA $C3D8           ;                                                  |    |         |         |
;                                                                                          |    |         |         |
.Branch_C2C8                            ;                                                  |    |         |         |
C2C8    AC D9 C3    LDY $C3D9           ;                                                  |    |         |         |  <------
;                                                                                          |    |         |         |         |
;                                                                                          |    |         |         |         |
.Branch_C2CB                            ;                                                  |    |         |         |         |
C2CB    E8          INX                 ; X = X + 1                                        |    |  <------+         |         |
C2CC    C8          INY                 ; Y = Y + 1                                        |    |         |         |         |
C2CD    99 FB 01    STA $01FB,Y         ; Processor stack                                  |    |         |         |         |
C2D0    B9 FB 01    LDA $01FB,Y         ; reload same value , Flags?                       |    |         |         |         |
C2D3    F0 6E       BEQ .Branch_C343    ; -> JMP $A609 (entry to original BASIC Tokenise Routine , C64 BASIC-ROM at $A57C)    |
C2D5    38          SEC                 ; Set Carry                                        |    |         |         |         |
;                                                                                          |    |         |         |         |
C2D6    E9 3A       SBC #$3A            ; 58 = ":" (colon) , Sub                           |    |         |         |         |
C2D8    F0 04       BEQ .Branch_C2DE    ; STA $0F                                          |    |         |         |         |
;                                                                                          |    |         |         |         |
C2DA    C9 49       CMP #$49            ; 93 = "]" , DATA-Code                             |    |         |         |         |
C2DC    D0 02       BNE .Branch_C2E0    ;                                                  |    |         |         |         |
;                                                                                          |    |         |         |         |
.Branch_C2DE        ;                                                                      |    |         |         |         |
C2DE    85 0F       STA $0F             ; Flag: DATA-Zeilen lesen / ausfuehren von LIST; Merker fuer die Durchfuehrung einer Garbarge Collection
;                                                                                          |    |         |         |         |
.Branch_C2E0        ;                                                                      |    |         |         |         |
C2E0    38          SEC                 ; Set Carry                                        |    |         |         |         |
C2E1    E9 55       SBC #$55            ; 85 = "U" , REM-Code , Sub    |                   |    |         |         |         |
C2E3    D0 9A       BNE .Branch_C27F    ; next                  >------                    |    |         |         |         |
;                                                                                          |    |         |         |         |
;                                                                                          |    |         |         |         |
C2E5    8D DA C3    STA $C3DA           ;                                                  |    |         |         |         |
C2E8    BD 00 02    LDA $0200,X         ; System-/BASIC-Eingabepuffer<------               |    |         |         |         |
C2EB    F0 DE       BEQ .Branch_C2CB    ;                                   |              |    |  >------+         |         |
                    ;                                                       |              |    |         |         |         |
C2ED    CD DA C3    CMP $C3DA           ;                                   |              |    |         |         |         |
C2F0    F0 D9       BEQ .Branch_C2CB    ;                                   |              |    |  >------+         |         |
;                                                                           |              |    |         |         |         |
.Branch_C2F2                            ;                                   |              |    |         |         |         |
C2F2    C8          INY                 ; Y = Y + 1                         |              |    |         |  <------          |
C2F3    99 FB 01    STA $01FB,Y         ; Processor stack                   |              |    |         |                   |
C2F6    E8          INX                 ; X = X + 1                         |              |    |         |                   |
C2F7    D0 EF       BNE $C2E8           ;                            >------               |    |         |                   |
;                                                                                          |    |         |                   |
.Branch_C2F9        ;                                                                      |    |         |                   |
C2F9    A6 7A       LDX $7A             ; $7A/$7B Pointer: Current Byte of BASIC Text <---      |         |                   |
C2FB    EE D8 C3    INC $C3D8           ;                                                       |         |                   |
;                                                                                               |         |                   |
.Branch_C2FE        ;                                                                           |         |                   |
C2FE    C8          INY                 ; Y = Y + 1        <------                              |         |                   |
C2FF    B9 9D A0    LDA $A09D,Y         ;                         |                             |         |                   |
C302    10 FA       BPL .Branch_C2FE    ;                  >------                              |         |                   |
;                                                                                               |         |                   |
C304    B9 9E A0    LDA $A09E,Y         ; Table of C64-BASIC-Commands                           |         |                   |
C307    D0 AF       BNE .Branch_C2B8    ;                                                >------          |                   |
;                                                                                                         |                   |
C309    8D D8 C3    STA $C3D8           ;                                                                 |                   |
C30C    A0 FF       LDY #$FF            ; Y = 255                                                         |                   |
C30E    CA          DEX                 ; X = X - 1                                                       |                   |
;                                                                                                         |                   |
.Branch_C30F        ;                                                                                     |                   |
C30F    C8          INY                 ; Y = Y + 1                            <------                    |                   |
C310    E8          INX                 ; X = X + 1                                   |                   |                   |
;                                                                                     |                   |                   |
.Branch_C311        ;                                                                 |                   |                   |
C311    BD 00 02    LDA $0200,X         ; System-/BASIC-Eingabepuffer                 |  <------          |                   |
C314    38          SEC                 ; Set Carry                                   |         |         |                   |
C315    F9 46 C3    SBC $C346,Y         ; characters of Magic Voice BASIC commands (keywords)   |         |                   |
C318    F0 F5       BEQ .Branch_C30F    ;                                      >------          |         |                   |
;                                                                                               |         |                   |
C31A    C9 80       CMP #$80            ; %1000 0000 , last letter?                             |         |                   |
C31C    D0 10       BNE .Branch_C32E    ;                                           >------     |         |                   |
;                                                                                          |    |         |                   |
C31E    A9 FE       LDA #$FE            ; A = 254                                          |    |         |                   |
C320    AC D9 C3    LDY $C3D9           ;                                                  |    |         |                   |
C323    C8          INY                 ; Y = Y + 1                                        |    |         |                   |
C324    99 FB 01    STA $01FB,Y         ; Processor stack                                  |    |         |                   |
C327    AD D8 C3    LDA $C3D8           ;                                                  |    |         |                   |
C32A    09 80       ORA #$80            ; %1000 0000                                       |    |         |                   |
C32C    D0 9D       BNE .Branch_C2CB    ;                                                  |    |  >------                    |
;                                                                                          |    |                             |
.Branch_C32E        ;                                                                      |    |                             |
C32E    A6 7A       LDX $7A             ; $7A/$7B Pointer: Current Byte of BASIC Text  <---     |                             |
C330    EE D8 C3    INC $C3D8           ;                                                       |                             |
;                                                                                               |                             |
.Branch_C333        ;                                                                           |                             |
C333    C8          INY                 ; Y = Y + 1                                 <------     |                             |
C334    B9 45 C3    LDA $C345,Y         ;                                                  |    |                             |
C337    10 FA       BPL .Branch_C333    ;                                           >------     |                             |
                                        ;                                                       |                             |
C339    B9 46 C3    LDA $C346,Y         ; characters of Magic Voice BASIC commands (keywords)   |                             |
C33C    D0 D3       BNE .Branch_C311    ;                                                >------                              |
;                                                                                                                             |
C33E    BD 00 02    LDA $0200,X         ; System-/BASIC-Eingabepuffer                                                         |
C341    10 85       BPL .Branch_C2C8    ;                                                                              >------

.Branch_C343
C343    4C 09 A6    JMP $A609           ; Jump , entry to original BASIC Tokenise Routine , C64 BASIC-ROM at $A57C


; -------------------------------------
; Magic Voice BASIC commands (keywords)
; -------------------------------------
; Eprom: $11A8 , V364: $85E0
C346    !byte $53, $41, $D9             ; SAY  , last letter +$80, Token: $FE80
C349    !byte $52, $41, $54, $C5        ; RATE , last letter +$80, Token: $FE81
C34D    !byte $56, $4F, $C3             ; VOC  , last letter +$80, Token: $FE82
C350    !byte $44, $41, $54, $C1        ; DATA , last letter +$80, Token: $FE83
C354    !byte $52, $44, $D9             ; RDY  , last letter +$80, Token: $FE84
C357    !byte $00                       ; 0


; -------------------------------
; Magic Voice, BASIC LIST Routine
; -------------------------------

C358    48          PHA                 ; Push A
C359    24 0F       BIT $0F             ; Flag: DATA-Zeilen lesen / ausfhren von LIST
C35B    30 2D       BMI .Branch_C38A    ; Bit7=1?                                                                                >------
                                        ;                                                                                               |
C35D    C9 FE       CMP #$FE            ; %1111 1110                                                                                    |
C35F    D0 29       BNE .Branch_C38A    ; Bit0= ? , Magic Voice Token                                                            >------+
                                        ;                                                                                               |
C361    C8          INY                 ; Y = Y + 1                                                                                     |
C362    B1 5F       LDA ($5F),Y         ;                                                                                               |
C364    0A          ASL                 ; Arithmetic Shift Left > Carry                                                                 |
C365    C9 0A       CMP #$0A            ; %0000 1010 , 10                                                                               |
C367    B0 21       BCS .Branch_C38A    ;                                                                                        >------+
                                        ;                                                                                               |
C369    AA          TAX                 ; Transfer A to X                                                                               |
C36A    68          PLA                 ; Pull A                                                                                        |
C36B    84 49       STY $49             ;                                                                                               |
C36D    A0 FF       LDY #$FF            ; Y = 255                                                                                       |
                                        ;                                                                                               |
                    ; Loop xxx                                                                                                          |
.Branch_C36F        ;                                                                                                                   |
C36F    CA          DEX                 ; X = X - 2                                                               <------               |
C370    CA          DEX                 ;                                                                                |              |
C371    30 08       BMI .Branch_C37B    ; Exit Loop                                                                      |  >------     |
                    ;                                                                                                    |         |    |
                    ; Loop iii                                                                                           |         |    |
.Branch_C373        ;                                                                                                    |         |    |
C373    C8          INY                 ; Y = Y + 1                                                          <------     |         |    |
C374    B9 46 C3    LDA $C346,Y         ; characters of Magic Voice BASIC commands (keywords)                       |    |         |    |
C377    10 FA       BPL .Branch_C373    ; Loop iii , not last character?                                     >------     |         |    |
                                        ;                                                                                |         |    |
C379    30 F4       BMI .Branch_C36F    ; Loop xxx , last character?                                              >------          |    |
                                        ;                                                                                          |    |
                    ; Loop C37B                                                                                                    |    |
.Branch_C37B        ;                                                                                                              |    |
C37B    C8          INY                 ; Y = Y + 1 (first entry with Y=$FF -> start with 0)                                <------+    |
C37C    B9 46 C3    LDA $C346,Y         ; characters of Magic Voice BASIC commands (keywords)                                      |    |
C37F    30 06       BMI .Branch_C387    ; Branch if last letter of keyword (Branch on Minus = +$80)               >------          |    |
C381    20 47 AB    JSR $AB47           ; Call  Ausgabe eines PETSCII-Zeichens, Akku muss PETSCII-Wert enthalten         |         |    |
                                        ;         part of print character on CMD output file                             |         |    |
C384    4C 7B C3    JMP $C37B           ; Loop C37B                                                                      |  >------     |
                    ;                                                                                                    |              |
.Branch_C387        ;                                                                                                    |              |
C387    4C EF A6    JMP $A6EF           ; Entry in "$A6C9 = print lines from $5F/$60 to $14/$15"                  <------               |
                    ;                                                                                                                   |
.Branch_C38A        ;                                                                                                                   |
C38A    68          PLA                 ; Pull A                                                                                 <------
C38B    4C 1A A7    JMP $A71A           ; default 'Tokenprinter'


; -----------------------------------
; Magic Voice, BASIC Token evaluation
; -----------------------------------

C38E    A9 00       LDA #$00            ; A = 0
C390    85 0D       STA $0D             ;
C392    20 73 00    JSR $0073           ; Call: Get next byte of BASIC text
C395    90 26       BCC .Branch_C3BD    ; if                                                                 >------
                    ;                                                                                               |
C397    C9 FE       CMP #$FE            ; is this a magic voice token?                                              |
C399    D0 25       BNE .Branch_C3C0    ; Branch if not                                                             |  >------ 
                    ;                                                                                               |         |
C39B    20 73 00    JSR $0073           ; Call: Get next byte of BASIC text                                         |         |
C39E    C9 84       CMP #$84            ; "RDY"?                                                                    |         |
C3A0    D0 1E       BNE .Branch_C3C0    ; Branch if not                                                             |  >------+
                    ;                                                                                               |         |
C3A2    20 73 00    JSR $0073           ; Call: Get next byte of BASIC text                                         |         |
C3A5    AD 85 DF    LDA $DF85           ; 6525 Interrupt Mask Register - [-][-][-][0][DIR][EOS][0][0]               |         |
C3A8    D0 06       BNE .Branch_C3B0    ; if no interrupt is enabled (mask off)                         >------     |         |
                    ;                                                                                          |    |         |
C3AA    A0 FF       LDY #$FF            ; Y = 255                                                              |    |         |
C3AC    A9 FF       LDA #$FF            ; A = 255                                                              |    |         |
C3AE    D0 04       BNE .Branch_C3B4    ;                                                     >------          |    |         |
                    ;                                                                                |         |    |         |
.Branch_C3B0        ;                                                                                |         |    |         |
C3B0    A9 00       LDA #$00            ; A = 0                                                      |   <-----     |         |
C3B2    A0 00       LDY #$00            ; Y = 0                                                      |              |         |
                    ;                                                                                |              |         |
.Branch_C3B4        ;                                                                                |              |         |
C3B4    84 62       STY $62             ; = 0 or 255 , Float-Akku #1: Exponent                <------               |         |
C3B6    85 63       STA $63             ; = 0 or 255 , Float-Akku #1: Mantisse                                      |         |
C3B8    A2 90       LDX #$90            ; X = $90 = 144 = %1001 0000                                                |         |
C3BA    4C 44 BC    JMP $BC44           ; Ende der "Routine zum Konvertieren eines Integers in Float"               |         |
                                        ; Einsprung in "signed Wert von A in den Float-Akkumulator verschieben"     |         |
                    ;                                                                                               |         |
.Branch_C3BD        ;                                                                                               |         |
C3BD    4C 8F AE    JMP $AE8F           ; > JMP $BCF3 > "convert String to Float and write toFloat-Akku"     <------          |
                    ;                                                                                                         |
.Branch_C3C0        ;                                                                                                         |
C3C0    20 79 00    JSR $0079           ; Call: Entry to get same byte again ($0073=Get next byte of BASIC text)       <------
C3C3    4C 92 AE    JMP $AE92           ; > JSR $B113 > Zeichen in A ueberpruefen, C=1 wenn alphabetisch, C=0 wenn nicht
                                        ; --> Return


; -----------------
; Data / Variables
; -----------------

C3C6    !byte $7F                       ;
C3C7    !byte $AF                       ;

C3C8    !byte $DE                       ;
C3C9    !byte $C3                       ;

C3CA    !byte $49                       ;
C3CB    !byte $06                       ;

C3CC    !byte $CA                       ;
C3CD    !byte $9E                       ;

C3CE    !byte $C1                       ; RAM Utterance Look Up Table Address LSB
C3CF    !byte $94                       ; RAM Utterance Look Up Table Address MSB

C3D0    !byte $3C                       ; = #$00 after INIT_SPEECHDATA_BUFFER_T6721 , Decompression? cleared to #$00 at $A205, Shift Left at $A3BB, increment at $A3CC
C3D1    !byte $B9                       ; Coded Speechdata from memory, Decompression?
C3D2    !byte $04                       ; = #$FF after INIT_SPEECHDATA_BUFFER_T6721 , Decompression? Bit-Flags ?
C3D3    !byte $B8                       ;
C3D4    !byte $04                       ;

C3D5    !byte $D3                       ; = #$40 after INIT_SPEECHDATA_BUFFER_T6721 , Address LSB , points to $0040 , $003F-0040 Current DATA Line number
C3D6    !byte $E4                       ; = #$00 after INIT_SPEECHDATA_BUFFER_T6721 , Address MSB

C3D7    !byte $04                       ; Set when 1st Speechdata Byte (synth. conditions) evaluated, Bit4 = compressed Data , Bit 5 = 

C3D8    !byte $AC                       ; Basic
C3D9    !byte $04                       ; Basic
C3DA    !byte $93                       ; Basic, Char of Basictext?

C3DB    !byte $B1                       ; Counting Semaphore, Counter: Bit 0..5, Flags: Bit6= , Bit7 = Speechdata in EXROM
C3DC    !byte $D3                       ; Speech Speed , copied to $A3E7

C3DD    !byte $0E                       ; used as pointer smilar FB/FC to memory of speechdata
C3DE    !byte $00                       ;

C3DF    !byte $00                       ; Storage for 6525 Control Register
C3E0    !byte $B8                       ; something with the SPEECHDATA_BUFFER_T6721 during CONVERT_SPEECHDATA_TO_T6721
C3E1    !byte $00                       ; Storage for 6510 On-Chip Port

C3E2    !byte $00                       ; stored to $FC, set EXROM Adress??
C3E3    !byte $00                       ; = #$00 after INIT_VOICE_SYNTHESIZER


; -------------------------------------
; $C3E4 - SPEECHDATA_BUFFER_RAW
; -------------------------------------
; Storage of 12 Bytes (96 Bit) at $C3E4
; 10 of them got from Subroutine at $A185: READ_BYTE_FROM_MEMORY_AND_INC_POINTER_FBFC , see code at $A2C7

C3E4    !byte                           ;  1
C3E5    !byte                           ;  2
C3E6    !byte                           ;  3
C3E7    !byte                           ;  4
C3E8    !byte                           ;  5
C3E9    !byte                           ;  6
C3EA    !byte                           ;  7
C3EB    !byte                           ;  8
C3EC    !byte                           ;  9
C3ED    !byte                           ; 10

C3EE    !byte                           ;
C3EF    !byte                           ;


; -----------------------------------
; $C3F0 - SPEECHDATA_BUFFER_T6721
; -----------------------------------
; Storage of 1+15 (16) Bytes
; contains synthesizer condition and unpacked speechdata in T6721A-Format (Float to Integer)
; see Subroutine at $A1FF - INIT_SPEECHDATA_BUFFER_T6721, $BD/$BE points to $C3FE , End of SPEECHDATA_BUFFER_T6721 - 1
; see Subroutine at $A21E - CONVERT_SPEECHDATA_TO_T6721, fills 15 Bytes C3F1-C3FF with #$FF
;
; for 10 K-Parameters (3 Nibbles each) we need 15 Bytes

                                        ;                            , 
C3F0    !byte $80                       ;                            , (#$00) ?

C3F1    !byte $FF                       ; 40 Bit                     ,
C3F2    !byte $FF                       ;
C3F3    !byte $FF                       ;
C3F4    !byte $FF                       ; $01 , %0000 0001 , write at
C3F5    !byte $FF                       ; $3F , %0011 1111 , write at

C3F6    !byte $FF                       ; 80 Bit (start at $C3FF)
C3F7    !byte $FF                       ;
C3F8    !byte $FF                       ;
C3F9    !byte $FF                       ;
C3FA    !byte $FF                       ; write at

C3FB    !byte $FF                       ; 40 Bit (start at $C3FF)
C3FC    !byte $FF                       ;
C3FD    !byte $FF                       ;
C3FE    !byte $FF                       ;                            ,
C3FF    !byte $FF                       ;                            , = #$00 after INIT_SPEECHDATA_BUFFER_T6721



; Speech Data Table partially copied to RAM, not used
; C3DE    !word $01DA                   ; Size of Table, End = $C3DE + $01DA = $C5B8 = Start of Word Tokens
; C3E0    !byte $B8                     ;
; C3E1    !byte $00                     ;

; The complete Look-Up Table is copied to C3E2...
; and also the beginning of the Word-Tokens, but is not used at this RAM-address

; *****************
; Speech Data Table
; *****************
; Eprom; $1240- , V364: $

B240    !word $01DA                     ; Size of Table, End = $B240 + $01DA = $B41A = Start of Word Tokens
B242    !byte $B8                       ; %1011 1000 Commodore Demo: $17 = %0001 0111
B243    !byte $00                       ;            Commodore Demo: $00

----------------------
; Speech Look-Up Table
----------------------
; Start of speech data for a word = Start of Table + Look up offset
; Example "ZERO": $B240 + $03B2 = $B5F2

B244    !word $03B2                     ;   0 = ZERO  , at $C3E2 , $FC
B246    !word $03E7                     ;   1 = ONE
B248    !word $0412                     ;   2 = TWO
B24A    !word $0433                     ;   3 = THREE
B24C    !word $0456                     ;   4 = FOUR
B24E    !word $0479                     ;   5 = FIVE
B250    !word $04AC                     ;   6 = SIX
B252    !word $04CD                     ;   7 = SEVEN
B254    !word $04F8                     ;   8 = EIGHT
B256    !word $051A                     ;   9 = NINE
B258    !word $054A                     ;  10 = TEN
B25A    !word $056F                     ;  11 = ELEVEN
B25C    !word $05A7                     ;  12 = TWELVE
B25E    !word $05D6                     ;  13 = THIR
B260    !word $05F1                     ;  14 = FIF
B262    !word $0607                     ;  15 = TWENTY
B264    !word $0634                     ;  16 = HUNDRED
B266    !word $0667                     ;  17 = THOUSAND
B268    !word $069A                     ;  18 = MILLION
B26A    !word $06D5                     ;  19 = TEEN
B26C    !word $06FA                     ;  20 = TY
B26E    !word $0715                     ;  21 = A
B270    !word $073B                     ;  22 = B
B272    !word $0762                     ;  23 = C
B274    !word $078E                     ;  24 = D
B276    !word $07BE                     ;  25 = E
B278    !word $07EA                     ;  26 = F
B27A    !word $0809                     ;  27 = G
B27C    !word $0833                     ;  28 = H
B27E    !word $085A                     ;  29 = I
B280    !word $087F                     ;  30 = J
B282    !word $08AC                     ;  31 = K
B284    !word $08D2                     ;  32 = L
B286    !word $08F4                     ;  33 = M
B288    !word $0913                     ;  34 = N
B28A    !word $0930                     ;  35 = O
B28C    !word $094F                     ;  36 = P
B28E    !word $0972                     ;  37 = Q
B290    !word $0996                     ;  38 = R
B292    !word $09B8                     ;  39 = S
B294    !word $09DA                     ;  40 = T
B296    !word $09FA                     ;  41 = U
B298    !word $0A1C                     ;  42 = V
B29A    !word $0A44                     ;  43 = W
B29C    !word $0A81                     ;  44 = X
B29E    !word $0AA2                     ;  45 = Y
B2A0    !word $0ACB                     ;  46 = Z
B2A2    !word $0AEF                     ;  47 = "Silence"
B2A4    !word $0AF1                     ;  48 = ADD
B2A6    !word $0B14                     ;  49 = SUBTRACT
B2A8    !word $0B4F                     ;  50 = DIVIDE
B2AA    !word $0B8F                     ;  51 = DIVIDED
B2AC    !word $0BD8                     ;  52 = EQUALS
B2AE    !word $0C12                     ;  53 = LESS
B2B0    !word $0C34                     ;  54 = MINUS
B2B2    !word $0C68                     ;  55 = MORE
B2B4    !word $0C94                     ;  56 = NUMBER
B2B6    !word $0CD9                     ;  57 = PLUS
B2B8    !word $0D01                     ;  58 = REMAINDER
B2BA    !word $0D4E                     ;  59 = IT
B2BC    !word $0D70                     ;  60 = AT
B2BE    !word $0D8E                     ;  61 = WHEN

; ------------------------------------------------------------------------------------
; Note: The Addressline CA14 of the C64 is connected to A13 of the Eprom.
;
;         |            MSB             |             LSB           |
; C64      15 14 13 12    11 10  9  8     7  6  5  4     3  2  1  0
;           x  X  x  X  .  X  X  X  X  .  X  X  X  X  .  X  X  X  X
; EPROM       13    12    11 10  9  8     7  6  5  4     3  2  1  0
;
; ------------------------------------------------------------------------------------

; Eprom: $12C0
B2C0    !word $2DC0                     ;  62 = HAS
B2C2    !word $2DF0                     ;  63 = TIMES
B2C4    !word $2E23                     ;  64 = APOSTROPHE
B2C6    !word $2E7E                     ;  65 = WORD
B2C8    !word $2EB0                     ;  66 = ER
B2CA    !word $2ED1                     ;  67 = EST
B2CC    !word $2EF1                     ;  68 = ING
B2CE    !word $2F84                     ;  69 = SSSS
B2D0    !word $2F84                     ;  70 = TH         , $C46D
B2D2    !word $2F8E                     ;  71 = ALL
B2D4    !word $2FB3                     ;  72 = ME
B2D6    !word $2FD5                     ;  73 = MY
B2D8    !word $3004                     ;  74 = THAT
B2DA    !word $3027                     ;  75 = THEIR
B2DC    !word $3027                     ;  76 = THEY'RE (=THEIR)
B2DE    !word $3052                     ;  77 = THIS
B2E0    !word $3076                     ;  78 = WHAT
B2E2    !word $30C8                     ;  79 = WHICH
B2E4    !word $30E8                     ;  80 = WHO
B2E6    !word $317D                     ;  81 = YOUR
B2E8    !word $317D                     ;  82 = YOU'RE
B2EA    !word $31A1                     ;  83 = ANSWER
B2EC    !word $31D7                     ;  84 = COMMODORE
B2EE    !word $3215                     ;  85 = END
B2F0    !word $323B                     ;  86 = POINT
B2F2    !word $3266                     ;  87 = THING
B2F4    !word $328F                     ;  88 = QUESTION
B2F6    !word $32CA                     ;  89 = TURN
B2F8    !word $32EE                     ;  90 = AM
B2FA    !word $0996                     ;  91 = ARE (=R)
B2FC    !word $073B                     ;  92 = BE (=B)
B2FE    !word $330F                     ;  93 = BUY
B300    !word $333A                     ;  94 = CAN
B302    !word $335C                     ;  95 = CORRECT
B304    !word $3385                     ;  96 = DID
B306    !word $33A7                     ;  97 = DO
B308    !word $33C7                     ;  98 = DOES
B30A    !word $33F0                     ;  99 = DONE
B30C    !word $3416                     ; 100 = FIND
B30E    !word $3445                     ; 101 = GET
B310    !word $3469                     ; 102 = HAVE
B312    !word $3491                     ; 103 = HEAR
B314    !word $34BD                     ; 104 = HELP
B316    !word $34E2                     ; 105 = IS
B318    !word $357B                     ; 106 = KNOW
B31A    !word $35A9                     ; 107 = LIKE
B31C    !word $35CC                     ; 108 = PRESENTS
B31E    !word $3606                     ; 109 = READ
B320    !word $3637                     ; 110 = SAY
B322    !word $0762                     ; 111 = SEE (=C)
B324    !word $3660                     ; 112 = START
B326    !word $3683                     ; 113 = USE
B328    !word $36AA                     ; 114 = WAIT
B32A    !word $36CF                     ; 115 = WANT
B32C    !word $3703                     ; 116 = WAS
B32E    !word $03E7                     ; 117 = WON (=ONE)
B330    !word $372E                     ; 118 = WRITE
B332    !word $3491                     ; 119 = HERE (=HEAR)
B334    !word $3757                     ; 120 = HIGH
B336    !word $377D                     ; 121 = HOW
B338    !word $3027                     ; 122 = THERE (=THEIR)
B33A    !word $0412                     ; 123 = TOO (=TWO)
B33C    !word $37A5                     ; 124 = WHERE
B33E    !word $0AA2                     ; 125 = WHY (=Y)
B340    !word $37C7                     ; 126 = UH
B342    !word $37EB                     ; 127 = AN                , C4E0
B344    !word $3807                     ; 128 = AND
B346    !word $3830                     ; 129 = AS
B348    !word $38E3                     ; 130 = BUT
B34A    !word $330F                     ; 131 = BY (=BUY)
B34C    !word $0456                     ; 132 = FOR (=FOUR)
B34E    !word $392D                     ; 133 = FROM
B350    !word $395A                     ; 134 = IF
B352    !word $0913                     ; 135 = IN (=N)
B354    !word $397E                     ; 136 = LARGE
B356    !word $39A9                     ; 137 = NEXT
B358    !word $39CD                     ; 138 = NOT
B35A    !word $39F7                     ; 139 = OF
B35C    !word $3A21                     ; 140 = OFF
B35E    !word $0930                     ; 141 = OH (=O)
B360    !word $3A3A                     ; 142 = ON
B362    !word $3A5E                     ; 143 = OR
B364    !word $3A85                     ; 144 = READY
B366    !word $3AAB                     ; 145 = SAME
B368    !word $3AD4                     ; 146 = THAN
B36A    !word $3B05                     ; 147 = THE
B36C    !word $3B27                     ; 148 = THUH
B36E    !word $3B98                     ; 149 = THEN
B370    !word $0412                     ; 150 = TO (=TWO)
B372    !word $3BC7                     ; 151 = WITH
B374    !word $3C66                     ; 152 = VERY
B376    !word $330F                     ; 153 = BYE (=BUY)
B378    !word $3757                     ; 154 = HI (=HIGH)
B37A    !word $3C97                     ; 155 = PLEASE
B37C    !word $3CCF                     ; 156 = THANK
B37E    !word $3CEF                     ; 157 = YES
B380    !word $3D16                     ; 158 = BAD
B382    !word $3D95                     ; 159 = GOOD
B384    !word $3DCE                     ; 160 = SORRY
B386    !word $3DF6                     ; 161 = WRONG
B388    !word $3E28                     ; 162 = AFTER
B38A    !word $3E5D                     ; 163 = MOST
B38C    !word $3E87                     ; 164 = BECAUSE
B38E    !word $357B                     ; 165 = NO (=KNOW)
B390    !word $3F6B                     ; 166 = OUT
B392    !word $3F8C                     ; 167 = SEND
B394    !word $3FBB                     ; 168 = TALK
B396    !word $3FD9                     ; 169 = ANY
B398    !word $4008                     ; 170 = EACH
B39A    !word $402B                     ; 171 = ENTER
B39C    !word $4060                     ; 172 = ERROR
B39E    !word $4088                     ; 173 = MANY
B3A0    !word $40C3                     ; 174 = EVERY
B3A2    !word $40F6                     ; 175 = AGAIN
B3A4    !word $412D                     ; 176 = NOW
B3A6    !word $4159                     ; 177 = SMALL
B3A8    !word $418D                     ; 178 = TERRIFIC
B3AA    !word $41CF                     ; 179 = TRY
B3AC    !word $41FB                     ; 180 = LETTER
B3AE    !word $4230                     ; 181 = FIRST
B3B0    !word $425E                     ; 182 = SECOND
B3B2    !word $4292                     ; 183 = THIRD
B3B4    !word $42BF                     ; 184 = COLOR
B3B6    !word $42E8                     ; 185 = BLACK
B3B8    !word $4310                     ; 186 = WHITE
B3BA    !word $4333                     ; 187 = RED
B3BC    !word $4357                     ; 188 = CYAN
B3BE    !word $4387                     ; 189 = PURPLE
B3C0    !word $43AE                     ; 190 = GREEN
B3C2    !word $43EB                     ; 191 = BLUE
B3C4    !word $4419                     ; 192 = YELLOW
B3C6    !word $4443                     ; 193 = ORANGE
B3C8    !word $4518                     ; 194 = BROWN
B3CA    !word $454C                     ; 195 = GREY
B3CC    !word $4579                     ; 196 = LIGHT
B3CE    !word $45A0                     ; 197 = HE
B3D0    !word $45C5                     ; 198 = OUR
B3D2    !word $45F6                     ; 199 = SHE
B3D4    !word $461D                     ; 200 = WE
B3D6    !word $09FA                     ; 201 = YOU
B3D8    !word $464A                     ; 202 = COME
B3DA    !word $4668                     ; 203 = GIVE
B3DC    !word $46A0                     ; 204 = PUT
B3DE    !word $46BF                     ; 205 = SET
B3E0    !word $46DB                     ; 206 = TAKE
B3E2    !word $46FA                     ; 207 = WERE
B3E4    !word $4725                     ; 208 = UNTIL
B3E6    !word $475A                     ; 209 = MAY
B3E8    !word $4825                     ; 210 = OVER
B3EA    !word $485A                     ; 211 = DARK
B3EC    !word $4883                     ; 212 = COMMAND
B3EE    !word $48B5                     ; 213 = COMPUTER
B3F0    !word $4902                     ; 214 = CONTROL
B3F2    !word $4945                     ; 215 = CURSOR
B3F4    !word $4978                     ; 216 = DISK
B3F6    !word $4998                     ; 217 = DOWN
B3F8    !word $49C9                     ; 218 = GAME
B3FA    !word $49F0                     ; 219 = KEY
B3FC    !word $4A0C                     ; 220 = LEFT
B3FE    !word $4A2F                     ; 221 = LOAD
B400    !word $4A65                     ; 222 = NAME
B402    !word $4A9A                     ; 223 = PLAY
B404    !word $4AC3                     ; 224 = PRESS
B406    !word $4B10                     ; 225 = PROGRAM
B408    !word $372E                     ; 226 = RIGHT (=WRITE)
B40A    !word $4BF9                     ; 227 = RUN
B40C    !word $4C31                     ; 228 = SAVE
B40E    !word $4C5B                     ; 229 = STOP
B410    !word $4C7B                     ; 230 = SYMBOL
B412    !word $4CB4                     ; 231 = TAPE
B414    !word $4CD9                     ; 232 = UP
B416    !word $36AA                     ; 233 = WEIGHT (=WAIT)
B418    !word $45C5                     ; 234 = HOUR


; ------------------
; Speech Word Tokens
; ------------------
; Eprom: $141A , V364: $

B41A    !byte $AF, $46                  ;   0 = ZERO
B41C    !byte $2F, $4A                  ;   1 = ONE
B41E    !byte $C4, $54                  ;   2 = TWO
B420    !byte $1D, $A7                  ;   3 = THREE
B422    !byte $3B, $7A                  ;   4 = FOUR
B424    !byte $DA, $AA                  ;   5 = FIVE
B426    !byte $E3, $5C                  ;   6 = SIX
B428    !byte $F5, $AA                  ;   7 = SEVEN
B42A    !byte $2D, $CC                  ;   8 = EIGHT
B42C    !byte $E2, $A2                  ;   9 = NINE
B42E    !byte $A4, $52                  ;  10 = TEN
B430    !byte $2F, $AF                  ;  11 = ELEVEN
B432    !byte $6F, $0F                  ;  12 = TWELVE
B434    !byte $D9, $6D                  ;  13 = THIR
B436    !byte $D6, $4A                  ;  14 = FIF
B438    !byte $AD, $30                  ;  15 = TWENTY
B43A    !byte $3E, $DC                  ;  16 = HUNDRED
B43C    !byte $41, $36                  ;  17 = THOUSAND
B43E    !byte $1B, $64                  ;  18 = MILLION
B440    !byte $A9, $29                  ;  19 = TEEN
B442    !byte $E4, $05                  ;  20 = TY
B444    !byte $41, $00                  ;  21 = A
B446    !byte $42, $00                  ;  22 = B
B448    !byte $43, $00                  ;  23 = C
B44A    !byte $44, $00                  ;  24 = D
B44C    !byte $45, $00                  ;  25 = E
B44E    !byte $46, $00                  ;  26 = F
B450    !byte $47, $00                  ;  27 = G
B452    !byte $48, $00                  ;  28 = H
B454    !byte $49, $00                  ;  29 = I
B456    !byte $4A, $00                  ;  30 = J
B458    !byte $4B, $00                  ;  31 = K
B45A    !byte $4C, $00                  ;  32 = L
B45C    !byte $4D, $00                  ;  33 = M
B45E    !byte $4E, $00                  ;  34 = N
B460    !byte $4F, $00                  ;  35 = O
B462    !byte $50, $00                  ;  36 = P
B464    !byte $51, $00                  ;  37 = Q
B466    !byte $52, $00                  ;  38 = R
B468    !byte $53, $00                  ;  39 = S
B46A    !byte $54, $00                  ;  40 = T
B46C    !byte $55, $00                  ;  41 = U
B46E    !byte $56, $00                  ;  42 = V
B470    !byte $57, $00                  ;  43 = W
B472    !byte $58, $00                  ;  44 = X
B474    !byte $59, $00                  ;  45 = Y
B476    !byte $5A, $00                  ;  46 = Z
B478    !byte $65, $EA                  ;  47 = "Silence"
B47A    !byte $81, $48                  ;  48 = ADD
B47C    !byte $10, $0F                  ;  49 = SUBTRACT
B47E    !byte $6C, $EF                  ;  50 = DIVIDE
B480    !byte $6D, $33                  ;  51 = DIVIDED
B482    !byte $D5, $6F                  ;  52 = EQUALS
B484    !byte $A1, $87                  ;  53 = LESS
B486    !byte $35, $A3                  ;  54 = MINUS
B488    !byte $41, $A7                  ;  55 = MORE
B48A    !byte $07, $78                  ;  56 = NUMBER
B48C    !byte $15, $8A                  ;  57 = PLUS
B48E    !byte $25, $FB                  ;  58 = REMAINDER
B490    !byte $89, $05                  ;  59 = IT
B492    !byte $81, $05                  ;  60 = AT
B494    !byte $DC, $29                  ;  61 = WHEN
B496    !byte $58, $57                  ;  62 = HAS
B498    !byte $3B, $A2                  ;  63 = TIMES
B49A    !byte $57, $DD                  ;  64 = APOSTROPHE
B49C    !byte $4B, $97                  ;  65 = WORD
B49E    !byte $65, $05                  ;  66 = ER
B4A0    !byte $75, $59                  ;  67 = EST
B4A2    !byte $29, $4C                  ;  68 = ING
B4A4    !byte $88, $88                  ;  69 = SSSS
B4A6    !byte $D4, $04                  ;  70 = TH
B4A8    !byte $01, $51                  ;  71 = ALL
B4AA    !byte $9D, $04                  ;  72 = ME
B4AC    !byte $DD, $05                  ;  73 = MY
B4AE    !byte $D9, $85                  ;  74 = THAT
B4B0    !byte $2A, $DA                  ;  75 = THEIR
B4B2    !byte $01, $24                  ;  76 = THEY'RE
B4B4    !byte $D9, $7D                  ;  77 = THIS
B4B6    !byte $DC, $85                  ;  78 = WHAT
B4B8    !byte $23, $7E                  ;  79 = WHICH
B4BA    !byte $D7, $53                  ;  80 = WHO
B4BC    !byte $4E, $7A                  ;  81 = YOUR
B4BE    !byte $EB, $CE                  ;  82 = YOU'RE
B4C0    !byte $8B, $CD                  ;  83 = ANSWER
B4C2    !byte $11, $96                  ;  84 = COMMODORE
B4C4    !byte $25, $49                  ;  85 = END
B4C6    !byte $99, $2E                  ;  86 = POINT
B4C8    !byte $20, $2E                  ;  87 = THING
B4CA    !byte $8F, $AE                  ;  88 = QUESTION
B4CC    !byte $A9, $37                  ;  89 = TURN
B4CE    !byte $11, $05                  ;  90 = AM
B4D0    !byte $61, $4A                  ;  91 = ARE
B4D2    !byte $92, $04                  ;  92 = BE
B4D4    !byte $92, $5E                  ;  93 = BUY
B4D6    !byte $53, $52                  ;  94 = CAN
B4D8    !byte $AD, $CF                  ;  95 = CORRECT
B4DA    !byte $D4, $48                  ;  96 = DID
B4DC    !byte $34, $05                  ;  97 = DO
B4DE    !byte $39, $7A                  ;  98 = DOES
B4E0    !byte $38, $A3                  ;  99 = DONE
B4E2    !byte $DA, $92                  ; 100 = FIND
B4E4    !byte $97, $58                  ; 101 = GET
B4E6    !byte $5C, $AA                  ; 102 = HAVE
B4E8    !byte $9D, $65                  ; 103 = HEAR
B4EA    !byte $9D, $50                  ; 104 = HELP
B4EC    !byte $79, $05                  ; 105 = IS
B4EE    !byte $30, $C4                  ; 106 = KNOW
B4F0    !byte $E0, $9F                  ; 107 = LIKE
B4F2    !byte $90, $03                  ; 108 = PRESENTS
B4F4    !byte $A6, $85                  ; 109 = READ
B4F6    !byte $63, $5D                  ; 110 = SAY
B4F8    !byte $A3, $49                  ; 111 = SEE
B4FA    !byte $EC, $66                  ; 112 = START
B4FC    !byte $85, $4A                  ; 113 = USE
B4FE    !byte $6C, $8D                  ; 114 = WAIT
B500    !byte $6C, $92                  ; 115 = WANT
B502    !byte $67, $57                  ; 116 = WAS
B504    !byte $47, $53                  ; 117 = WON
B506    !byte $C1, $8E                  ; 118 = WRITE
B508    !byte $9C, $A6                  ; 119 = HERE
B50A    !byte $DC, $CB                  ; 120 = HIGH
B50C    !byte $38, $5C                  ; 121 = HOW
B50E    !byte $1E, $6A                  ; 122 = THERE
B510    !byte $44, $54                  ; 123 = TOO
B512    !byte $21, $6A                  ; 124 = WHERE
B514    !byte $D7, $5D                  ; 125 = WHY
B516    !byte $D5, $04                  ; 126 = UH
B518    !byte $21, $05                  ; 127 = AN
B51A    !byte $21, $49                  ; 128 = AND
B51C    !byte $71, $05                  ; 129 = AS
B51E    !byte $92, $59                  ; 130 = BUT
B520    !byte $D2, $05                  ; 131 = BY
B522    !byte $36, $57                  ; 132 = FOR
B524    !byte $6B, $24                  ; 133 = FROM
B526    !byte $A9, $04                  ; 134 = IF
B528    !byte $29, $05                  ; 135 = IN
B52A    !byte $A5, $C6                  ; 136 = LARGE
B52C    !byte $A3, $9C                  ; 137 = NEXT
B52E    !byte $3E, $59                  ; 138 = NOT
B530    !byte $AF, $04                  ; 139 = OF
B532    !byte $AF, $4A                  ; 140 = OFF
B534    !byte $CF, $04                  ; 141 = OH
B536    !byte $2F, $05                  ; 142 = ON
B538    !byte $6F, $05                  ; 143 = OR
B53A    !byte $FF, $85                  ; 144 = READY
B53C    !byte $67, $A1                  ; 145 = SAME
B53E    !byte $D9, $25                  ; 146 = THAN
B540    !byte $D4, $49                  ; 147 = THE
B542    !byte $D8, $D9                  ; 148 = THUH
B544    !byte $D9, $29                  ; 149 = THEN
B546    !byte $44, $05                  ; 150 = TO
B548    !byte $EB, $D8                  ; 151 = WITH
B54A    !byte $AB, $E6                  ; 152 = VERY
B54C    !byte $D2, $4A                  ; 153 = BYE
B54E    !byte $D8, $04                  ; 154 = HI
B550    !byte $B7, $5E                  ; 155 = PLEASE
B552    !byte $24, $26                  ; 156 = THANK
B554    !byte $A9, $57                  ; 157 = YES
B556    !byte $52, $48                  ; 158 = BAD
B558    !byte $3B, $94                  ; 159 = GOOD
B55A    !byte $A1, $77                  ; 160 = SORRY
B55C    !byte $C3, $34                  ; 161 = WRONG
B55E    !byte $F7, $A8                  ; 162 = AFTER
B560    !byte $42, $98                  ; 163 = MOST
B562    !byte $1B, $A2                  ; 164 = BECAUSE
B564    !byte $3E, $05                  ; 165 = NO
B566    !byte $9F, $59                  ; 166 = OUT
B568    !byte $A7, $92                  ; 167 = SEND
B56A    !byte $69, $00                  ; 168 = TALK
B56C    !byte $21, $5E                  ; 169 = ANY
B56E    !byte $59, $C7                  ; 170 = EACH
B570    !byte $7B, $A9                  ; 171 = ENTER
B572    !byte $BC, $47                  ; 172 = ERROR
B574    !byte $62, $E2                  ; 173 = MANY
B576    !byte $03, $6B                  ; 174 = EVERY
B578    !byte $03, $D6                  ; 175 = AGAIN
B57A    !byte $3E, $5C                  ; 176 = NOW
B57C    !byte $74, $06                  ; 177 = SMALL
B57E    !byte $56, $F4                  ; 178 = TERRIFIC
B580    !byte $74, $5E                  ; 179 = TRY
B582    !byte $06, $9E                  ; 180 = LETTER
B584    !byte $2F, $87                  ; 181 = FIRST
B586    !byte $36, $3C                  ; 182 = SECOND
B588    !byte $1D, $6E                  ; 183 = THIRD
B58A    !byte $8A, $41                  ; 184 = COLOR
B58C    !byte $51, $76                  ; 185 = BLACK
B58E    !byte $21, $8E                  ; 186 = WHITE
B590    !byte $A2, $48                  ; 187 = RED
B592    !byte $D8, $26                  ; 188 = CYAN
B594    !byte $41, $5C                  ; 189 = PURPLE
B596    !byte $B9, $9A                  ; 190 = GREEN
B598    !byte $06, $AA                  ; 191 = BLUE
B59A    !byte $6D, $16                  ; 192 = YELLOW
B59C    !byte $0B, $2B                  ; 193 = ORANGE
B59E    !byte $B5, $C4                  ; 194 = BROWN
B5A0    !byte $6C, $DA                  ; 195 = GREY
B5A2    !byte $34, $CC                  ; 196 = LIGHT
B5A4    !byte $98, $04                  ; 197 = HE
B5A6    !byte $9F, $57                  ; 198 = OUR
B5A8    !byte $D3, $49                  ; 199 = SHE
B5AA    !byte $A7, $04                  ; 200 = WE
B5AC    !byte $49, $5A                  ; 201 = YOU
B5AE    !byte $37, $A2                  ; 202 = COME
B5B0    !byte $DB, $AA                  ; 203 = GIVE
B5B2    !byte $A0, $59                  ; 204 = PUT
B5B4    !byte $A3, $58                  ; 205 = SET
B5B6    !byte $68, $9F                  ; 206 = TAKE
B5B8    !byte $AB, $A6                  ; 207 = WERE
B5BA    !byte $85, $E9                  ; 208 = UNTIL
B5BC    !byte $5D, $5D                  ; 209 = MAY
B5BE    !byte $B4, $6A                  ; 210 = OVER
B5C0    !byte $59, $06                  ; 211 = DARK
B5C2    !byte $59, $6B                  ; 212 = COMMAND
B5C4    !byte $D2, $BC                  ; 213 = COMPUTER
B5C6    !byte $7A, $E4                  ; 214 = CONTROL
B5C8    !byte $07, $8D                  ; 215 = CURSOR
B5CA    !byte $D9, $07                  ; 216 = DISK
B5CC    !byte $39, $3C                  ; 217 = DOWN
B5CE    !byte $5B, $A1                  ; 218 = GAME
B5D0    !byte $9B, $5D                  ; 219 = KEY
B5D2    !byte $A1, $8A                  ; 220 = LEFT
B5D4    !byte $40, $86                  ; 221 = LOAD
B5D6    !byte $62, $A1                  ; 222 = NAME
B5D8    !byte $15, $D6                  ; 223 = PLAY
B5DA    !byte $C8, $7A                  ; 224 = PRESS
B5DC    !byte $D7, $15                  ; 225 = PROGRAM
B5DE    !byte $3A, $CC                  ; 226 = RIGHT
B5E0    !byte $A2, $53                  ; 227 = RUN
B5E2    !byte $67, $AA                  ; 228 = SAVE
B5E4    !byte $98, $54                  ; 229 = STOP
B5E6    !byte $F6, $77                  ; 230 = SYMBOL
B5E8    !byte $68, $A4                  ; 231 = TAPE
B5EA    !byte $55, $05                  ; 232 = UP
B5EC    !byte $33, $C3                  ; 233 = WEIGHT
B5EE    !byte $3D, $7A                  ; 234 = HOUR

B5F0    !byte $00, $00                  ; Ends with $00 $00 always


; -----------
; Speech Data
; -----------
; Eprom: $15F2
; V364: $9710 (different speech data, after decompression, the only difference is the energy value)
; Compressed Data

        ;   0 = ZERO
B5F2    !byte $4A, $D1, $FE, $D7, $C1, $66, $10, $7D, $B2, $13, $31, $72, $B3, $A2, $CC, $C4
B602    !byte $1E, $99, $55, $AB, $D6, $3D, $27, $7C, $D7, $D4, $E1, $C0, $1A, $16, $75, $78
B612    !byte $85, $25, $59, $A6, $D9, $2E, $B5, $4A, $76, $A9, $59, $B5, $7E, $AE, $75, $CB
B622    !byte $6C, $59, $D9, $96, $E5

        ;   1 = ONE
B627    !byte $4A, $B1, $E8, $6B, $5E, $8C, $27, $2E, $2C, $B7, $4F, $E3, $E7, $72, $B3, $7C
B637    !byte $73, $12, $11, $88, $27, $27, $D3, $54, $3C, $75, $45, $AC, $7F, $6C, $FD, $30
B647    !byte $F3, $13, $73, $6C, $EB, $EE, $FF, $C6, $15, $AB, $2C

        ;   2 = TWO
B652    !byte $4A, $6B, $6E, $5B, $FE, $AA, $B1, $CA, $DB, $FA, $7C, $6E, $B4, $54, $98, $24
B662    !byte $83, $65, $D9, $D9, $A5, $6E, $C9, $CE, $CE, $3E, $F5, $FB, $D4, $2D, $4B, $16
B672    !byte $96

        ;   3 = THREE
B673    !byte $4A, $2B, $4D, $49, $40, $B9, $FA, $5E, $79, $6E, $FB, $3F, $AA, $49, $8D, $67
B683    !byte $22, $F2, $5A, $87, $50, $94, $AA, $5C, $71, $D8, $06, $B5, $CB, $5E, $F7, $6A
B693    !byte $5C, $09, $CB

        ;   4 = FOUR
B696    !byte $4A, $AB, $24, $24, $86, $F7, $BB, $7B, $25, $F1, $4F, $3B, $B5, $09, $23, $84
B6A6    !byte $3F, $92, $79, $4C, $A6, $F5, $38, $A6, $57, $08, $A3, $27, $84, $0D, $21, $2C
B6B6    !byte $FE, $37, $2C

        ;   5 = FIVE
B6B9    !byte $4A, $2B, $00, $78, $6B, $EE, $E3, $99, $F7, $20, $10, $E5, $6B, $AA, $00, $1A
B6C9    !byte $9A, $A6, $D5, $9A, $B4, $CB, $97, $C0, $22, $A0, $A4, $2A, $B4, $AE, $2A, $A1
B6D9    !byte $FE, $34, $58, $4B, $E0, $B3, $D1, $9A, $45, $7E, $7C, $72, $CC, $28, $F0, $6B
B6E9    !byte $D0, $1E, $CB

        ;   6 = SIX
B6EC    !byte $4A, $2B, $71, $73, $80, $7A, $0B, $EF, $F3, $20, $4A, $3C, $11, $10, $26, $64
B6FC    !byte $13, $A5, $89, $29, $A4, $5C, $FA, $01, $7E, $3B, $4A, $81, $99, $40, $22, $A3
B70C    !byte $96

        ;   7 = SEVEN
B70D    !byte $4A, $2B, $85, $04, $DE, $B2, $FB, $3B, $00, $8D, $2C, $37, $13, $4B, $5B, $C0
B71D    !byte $5F, $3B, $68, $CE, $11, $B1, $2B, $3B, $E0, $D3, $64, $AA, $B3, $53, $FB, $67
B72D    !byte $6E, $DE, $AC, $3A, $12, $9B, $C7, $FA, $59, $DC, $F2

        ;   8 = EIGHT
B738    !byte $4A, $91, $79, $FF, $9B, $90, $55, $05, $3B, $AE, $B2, $75, $C1, $02, $32, $D3
B748    !byte $69, $01, $9E, $BC, $E4, $4F, $02, $F4, $D3, $50, $BC, $AD, $01, $58, $53, $21
B758    !byte $51, $CB

        ;   9 = NINE
B75A    !byte $4A, $F1, $C1, $9F, $6D, $A7, $1B, $B3, $1B, $71, $3D, $51, $EE, $8E, $78, $6B
B76A    !byte $F3, $B8, $31, $DB, $99, $C6, $25, $4D, $A6, $6D, $F2, $98, $B4, $05, $16, $46
B77A    !byte $C9, $2E, $B5, $BA, $53, $13, $32, $B3, $75, $5B, $22, $59, $D7, $A2, $58, $FE

        ;  10 = TEN
B78A    !byte $4A, $AB, $2F, $83, $2B, $29, $6F, $E0, $79, $E6, $68, $9A, $09, $85, $8D, $68
B79A    !byte $97, $4A, $30, $B5, $DF, $36, $87, $94, $5D, $6C, $3D, $33, $4D, $B4, $AB, $13
B7AA    !byte $BB, $1B, $C3, $64, $F9

        ;  11 = ELEVEN
B7AF    !byte $4A, $D1, $F4, $BC, $A5, $EB, $26, $A6, $60, $77, $C2, $6C, $47, $C5, $01, $CB
B7BF    !byte $83, $8D, $28, $66, $9B, $B6, $69, $59, $50, $26, $E8, $DD, $81, $26, $0F, $06
B7CF    !byte $BE, $BA, $72, $3F, $DE, $02, $7E, $02, $51, $F2, $62, $D5, $57, $4E, $93, $51
B7DF    !byte $79, $22, $61, $19, $5A, $B9, $AB, $CB

        ;  12 = TWELVE
B7E7    !byte $4A, $6B, $3F, $32, $56, $51, $4A, $BD, $B7, $9E, $E5, $23, $33, $64, $5A, $03
B7F7    !byte $5E, $9B, $89, $A5, $69, $9A, $46, $94, $9A, $DA, $21, $BB, $EC, $EC, $B2, $13
B807    !byte $EB, $A5, $7E, $CA, $AE, $75, $42, $36, $7E, $9B, $D8, $5D, $A3, $58, $FE

        ;  13 = THIR
B816    !byte $4A, $EB, $23, $72, $33, $11, $7B, $BC, $8D, $F7, $6B, $90, $5F, $F5, $8A, $D8
B826    !byte $06, $3B, $48, $5D, $14, $3B, $3B, $E1, $B6, $67, $F9

        ;  14 = FIF
B831    !byte $4A, $2B, $49, $49, $49, $52, $D4, $BB, $E7, $FE, $CE, $13, $CA, $86, $74, $7F
B841    !byte $6F, $37, $03, $5A, $CF, $2C

        ;  15 = TWENTY
B847    !byte $4A, $AB, $79, $1E, $2F, $6F, $E7, $93, $B8, $50, $FC, $5E, $06, $8F, $11, $16
B857    !byte $02, $34, $61, $BD, $5F, $D9, $89, $BB, $5A, $DF, $34, $DA, $F5, $71, $CF, $9B
B867    !byte $BB, $0B, $A5, $34, $B5, $B7, $B5, $4B, $B8, $19, $EB, $B5, $FC

        ;  16 = HUNDRED
B874    !byte $4A, $EB, $59, $69, $A5, $BE, $67, $EE, $3D, $79, $12, $A5, $24, $AD, $BE, $A1
B884    !byte $12, $73, $C4, $4E, $0A, $03, $C6, $70, $CF, $58, $FB, $22, $B9, $CE, $E4, $34
B894    !byte $C8, $2B, $ED, $6A, $9B, $90, $82, $CC, $84, $B8, $37, $CD, $F4, $D5, $A0, $F1
B8A4    !byte $DC, $2B, $CB

        ;  17 = THOUSAND
B8A7    !byte $4A, $2B, $49, $50, $09, $EF, $77, $8F, $A8, $EC, $35, $74, $4A, $D2, $64, $C8
B8B7    !byte $68, $54, $E8, $13, $8D, $B2, $34, $B3, $F6, $7E, $17, $F2, $84, $F7, $CA, $3E
B8C7    !byte $37, $6A, $1A, $F3, $AA, $0E, $D7, $DC, $4D, $F6, $32, $AB, $EB, $B8, $F8, $DC
B8D7    !byte $6B, $34, $CB

        ;  18 = MILLION
B8DA    !byte $4A, $31, $F1, $E7, $B6, $DC, $CA, $CE, $DC, $2C, $12, $BA, $A3, $BC, $15, $91
B8EA    !byte $CC, $84, $38, $B3, $B4, $26, $33, $3C, $4B, $E0, $6A, $7E, $27, $67, $A0, $6C
B8FA    !byte $06, $A4, $0C, $40, $26, $BC, $D9, $5E, $AB, $63, $9F, $BA, $9E, $9D, $D9, $2C
B90A    !byte $3A, $88, $04, $4F, $B5, $4A, $ED, $B7, $EE, $B5, $96

        ;  19 = TEEN
B915    !byte $4A, $AB, $6F, $9F, $BC, $B9, $77, $63, $57, $3C, $10, $E9, $9A, $32, $A0, $9A
B925    !byte $E1, $9F, $E4, $64, $C9, $13, $EE, $97, $F0, $CF, $84, $22, $EB, $41, $CB, $6A
B935    !byte $35, $99, $46, $B3, $FC

        ;  20 = TY
B93A    !byte $4A, $EB, $FB, $BC, $29, $CF, $B3, $71, $B5, $85, $DE, $92, $8F, $5C, $C2, $71
B94A    !byte $09, $70, $76, $C9, $6B, $FD, $48, $15, $4D, $CE, $F2

        ;  21 = A
B955    !byte 

        ;  22 = B

        ;  23 = C

        ;  24 = D

        ;  25 = E

        ;  26 = F

        ;  27 = G

        ;  28 = H

        ;  29 = I

        ;  30 = J

        ;  31 = K

        ;  32 = L

        ;  33 = M

        ;  34 = N

        ;  35 = O

        ;  36 = P

        ;  37 = Q

        ;  38 = R

        ;  39 = S

        ;  40 = T

        ;  41 = U

        ;  42 = V

        ;  43 = W

        ;  44 = X

        ;  45 = Y

        ;  46 = Z

        ;  47 = "Silence"
BD2F    !byte $4A, $2C

        ;  48 = ADD
BD31    !byte $4A, $91, $F5, $FC, $DD, $80, $52, $66, $0D, $C2, $6C, $9A, $A6, $81, $C6, $00
BD41    !byte $01, $69, $32, $41, $D6, $98, $FD, $9A, $1C, $66, $91, $2F, $D1, $6D, $19, $C1
BD51    !byte $BD, $D6, $F2

        ;  49 = SUBTRACT

        ;  50 = DIVIDE

        ;  51 = DIVIDED

        ;  52 = EQUALS

        ;  53 = LESS

        ;  54 = MINUS

        ;  55 = MORE

        ;  56 = NUMBER

        ;  57 = PLUS

        ;  58 = REMAINDER

        ;  59 = IT

        ;  60 = AT

        ;  61 = WHEN

; CA14 / A13

        ;  62 = HAS

        ;  63 = TIMES

        ;  64 = APOSTROPHE

        ;  65 = WORD

        ;  66 = ER

        ;  67 = EST

        ;  68 = ING

        ;  69 = SSSS

        ;  70 = TH

        ;  71 = ALL

        ;  72 = ME

        ;  73 = MY


C5FF          BRK
; ------
C600          BVC $C602
C602          EOR ($00),y
              !byte $52


        ; 104 = HELP
E6FD    !byte $4A, $AB, $B9, $F2, $D6, $3C, $4F, $A4, $5D, $BD, $49, $04, $34, $D9, $F0, $89
E70D    !byte $67, $A6, $09, $82, $E4, $09, $1D, $3F, $09, $7F, $96, $30, $E2, $9E, $7E, $D3
E71D    !byte $00, $AC, $45, $FE, $2F

		; 105 = IS (the speechcondition is the same like in the ABeeCs cartridge, unpacked)
E722    !byte $03, $00, $D9, $B1, $70, $3B, $30, $D7, $B7, $E1, $F0, $19, $70, $ED, $78, $F1
E732    !byte $74, $28, $80, $6B, $7B, $A9, $60, $4C, $50, $DB, $9B, $99, $54, $5D, $40, $5B
E742    !byte $9C, $D9, $58, $4C, $30, $EA, $BB, $01, $DD, $4A, $20, $5B, $FB, $A9, $D5, $16
E752    !byte $50, $5A, $3B, $C2, $4D, $17, $80, $BA, $7C, $32, $CD, $4B, $50, $59, $DD, $FA
E762    !byte $D0, $7A, $22, $48, $FC, $3A, $55, $48, $22, $D7, $3A, $4B, $55, $58, $12, $49
E772    !byte $59, $AB, $4D, $45, $13, $D8, $96, $BB, $45, $67, $12, $3B, $B6, $4B, $3D, $AB
E782    !byte $13, $B8, $F4, $3B, $B9, $CB, $13, $D6, $11, $34, $B9, $EB, $06, $36, $2F, $8C
E792    !byte $45, $DB, $16, $45, $4D, $54, $D5, $F8, $67, $B0, $4A, $DC, $E0, $FA, $B8, $A2
E7A2    !byte $6A, $74, $DC, $F9, $BB, $32, $6B, $54, $60, $DA, $BC, $C0, $8C, $34, $5C, $E9
E7B2    !byte $DA, $43, $05, $30, $5C, $E9, $C0, $FF, $FF		
; TEST
; E722    !byte $03, $00
; E724    !byte $D9, $B1, $70, $3B, $30, $D7
; E72A    !byte $B7, $E1, $F0, $19, $70, $ED
; E730    !byte $78, $F1, $74, $28, $80, $6B
; E736    !byte $7B, $A9, $60, $4C, $50, $DB
; E73C    !byte $9B, $99, $54, $5D, $40, $5B
; E742    !byte $9C, $D9, $58, $4C, $30, $EA
; E748    !byte $BB, $01, $DD, $4A, $20, $5B
; E74E    !byte $FB, $A9, $D5, $16, $50, $5A
; E754    !byte $3B, $C2, $4D, $17, $80, $BA
; E75A    !byte $7C, $32, $CD, $4B, $50, $59
; E760    !byte $DD, $FA, $D0, $7A, $22, $48
; E766    !byte $FC, $3A, $55, $48, $22, $D7
; E76C    !byte $3A, $4B, $55, $58, $12, $49
; E772    !byte $59, $AB, $4D, $45, $13, $D8
; E778    !byte $96, $BB, $45, $67, $12, $3B
; E77E    !byte $B6, $4B, $3D, $AB, $13, $B8
; E784    !byte $F4, $3B, $B9, $CB, $13, $D6
; E78A    !byte $11, $34, $B9, $EB, $06, $36
; E790    !byte $2F, $8C, $45, $DB, $16, $45
; E796    !byte $4D, $54, $D5, $F8, $67, $B0
; E79C    !byte $4A, $DC, $E0, $FA, $B8, $A2
; E7A2    !byte $6A, $74, $DC, $F9, $BB, $32
; E798    !byte $6B, $54, $60, $DA, $BC, $C0
; E79E    !byte $8C, $34, $5C, $E9, $DA, $43
; E7B4    !byte $05, $30, $5C, $E9, $C0, $FF
; E7BA    !byte $FF

        ; 106 = KNOW
E7BB    !byte $4A, $31, $F1, $78, $A4, $EE, $E4, $46, $72, $C3, $D7, $45, $BB, $E5, $B2, $CB
E7CB    !byte $59, $44, $09, $4D, $66, $CA, $14, $AA, $C8, $E4, $58, $5F, $42, $15, $61, $44
E7DB    !byte $72, $B2, $68, $C2, $67, $D1, $4C, $23, $E5, $91, $2D, $F9, $B9, $FC

        ; 107 = LIKE

        ; 108 = PRESENTS

        ; 109 = READ


        ; 234 = HOUR
FF19    !byte $4A, $71, $FB, $EF, $DF, $BC, $DA, $C9, $4E, $DC, $A6, $2A, $D9, $3A, $DB, $A9
FF29    !byte $99, $46, $5F, $C0, $5A, $E4, $3F, $F2, $5B, $FE, $8A, $53, $F5


;FF36   , $FF36-$FFD2 was copied to $0200-$029C during RESET

; The following programcode from $0200-$029C was copied after RESET from EPROM to RAM
; -----------------------------------------------------------------------------------

; -----------------------------
; Subroutine: COPY_EPROM_TO_RAM
; -----------------------------
; Eprom: $3F36
;
; FUNCTION:
;  This routine copies ...
;
; INPUT:
;    Y = 0
;  $FB = Start-/Endaddress Lowbyte
;  $FC = Startaddress Highbyte
;  $FD = Endaddress Highbyte
;
; OUTPUT:
;  
;    Y = 0
;
; DESTROYS:
;
; CALLS:
;
; CALLED FROM:
; - $0224 , in $021A - INITIALIZE_SPEECHMODULE_AND_C64 with $FB/$FC = $A000 and $FD = $C000
; - $022D , in $021A - INITIALIZE_SPEECHMODULE_AND_C64 with $FB/$FC = $E000 and $FD = $E000

                    ; Loop 0200
.Branch_0200
0200    A2 F5       LDX #$F5            ; %1111 0101 , EPROM , CA = High , CB = High                    <------
0202    8E 86 DF    STX $DF86           ; 6525 Control Register - [CB1][CB0][CA1][CA0][IE4][IE3][IP][MC]       |
0205    B1 FB       LDA ($FB),Y         ; Load Byte from EPROM                                                 |
;                                                                                                              |
0207    A2 E5       LDX #$E5            ; %1110 0101 , RAM , CA = Low , CB = High                              |
0209    8E 86 DF    STX $DF86           ; 6525 Control Register - [CB1][CB0][CA1][CA0][IE4][IE3][IP][MC]       |
020C    91 FB       STA ($FB),Y         ; Store Byte to RAM                                                    |
;                                                                                                              |
020E    C8          INY                 ; Y=Y+1 (pointer Low-Byte)                                             |
020F    D0 EF       BNE .Branch_0200    ; Loop 0200 - Copy 256 bytes                                    >------+
;                                                                                                              |
0211    E6 FC       INC $FC             ; $FC=$FC+1 (source pointer High-Byte)                                 |
0213    A6 FD       LDX $FD             ; contains Endaddress+1 High-Byte                                      |
0215    E4 FC       CPX $FC             ;                                                                      |
0217    D0 E7       BNE .Branch_0200    ; Loop 0200 - Next block with 256 bytes                         >------
0219    60          RTS                 ; Return
        ;_______________________________




LDX #$F5            ;                         %1    1    1    1    0    1    0   1 ,  CA = High , CB = High -> access EPROM
STX $DF86           ; 6525 Control Register - [CB1][CB0][CA1][CA0][IE4][IE3][IP][MC]
LDA ($FB),Y         ; Load Byte from EPROM

LDX #$E5            ;                         %1    1    1    0    0    1    0   1 , CA = Low , CB = High -> access RAM
STX $DF86           ; 6525 Control Register - [CB1][CB0][CA1][CA0][IE4][IE3][IP][MC]
STA ($FB),Y         ; Store Byte to RAM 




; -------------------------------
; INITIALIZE_SPEECHMODULE_AND_C64
; -------------------------------
; FUNCTION:
;  Copies some Code and Data from the Magic Voice EPROM to C64-Memory
;   - Copy $A000-$BFFF from EPROM to $A000-$BFFF in RAM
:   - Copy $E000-$FFFF from EPROM to $E000-$FFFF in RAM
;
;  Initialisation of the T6721A
;  Initialisation of the C64
;
;   - Copy C64-RAM $AE62-$B461 to $C000-$C5FF
;
; INPUT:
;   Y = 0 (needs to be zero)
;
; INFO:
;  Executed after Reset

.Jump_021A
021A    84 FB       STY $FB             ; $FB = 0

021C    A9 A0       LDA #$A0            ; $A0 , Startadress
021E    85 FC       STA $FC             ; Load address #$A000 and store in $FB/$FC
0220    A9 C0       LDA #$C0            ; $C0 , Endaddress Highbyte + 1 (next after $BF is $C0)
0222    85 FD       STA $FD             ; $FD = #$C0
0224    20 00 02    JSR .Branch_0200    ; Call COPY_EPROM_TO_RAM , Copy $A000-$BFFF from EPROM to $A000-$BFFF in RAM

0227    A9 E0       LDA #$E0            ; $E0 , Startadress
0229    85 FC       STA $FC             ; Load address #$E000
022B    84 FD       STY $FD             ; $FD = #$00 , Endaddress Highbyte + 1 (next after $FF is $00)
022D    20 00 02    JSR .Branch_0200    ; Call COPY_EPROM_TO_RAM , Copy $E000-$FFFF from EPROM to $E000-$FFFF in RAM

                    ; INIT speechsynthesizer T6721A
0230    A9 AB       LDA #$AB            ; %1010 1011 , /WR=Low, $B = SYSTEM ASGIN (1 Nibble Instruction)
0232    8D 81 DF    STA $DF81           ; 6525 Port B - IN:[/EXROM] OUT:[?][?][/WR][D3][D2][D1][D0]
0235    09 10       ORA #$10            ; %1011 1011 , /WR=High
0237    8D 81 DF    STA $DF81           ; 6525 Port B - IN:[/EXROM] OUT:[?][?][/WR][D3][D2][D1][D0]
023A    A9 1F       LDA #$1F            ; %0001 1111
023C    8D 83 DF    STA $DF83           ; 6525 Data Direction Port A - 0=Input, 1=Output

                    ; INIT C64 I/O
023F    20 84 FF    JSR $FF84           ; Call Kernal-Routine, IOINIT Init I/O Devices, Ports & Timers

0242    A9 E6       LDA #$E6            ; %1110 0110 , BASIC ROM off, Kernel ROM on, CHARROM off   ?????
0244    85 01       STA $01             ; 6510 On-Chip Port - [-][-][Cass Motor][Cass Switch][Cass DOut][/CHAREN][/HIRAM][/LORAM]

                    ; INIT SID
0246    A9 0F       LDA #$0F            ; %0000 1111 , Bit7: Voice 3 not disconnected, Bit 4..6: all filter off, Bit0..3: Volume = 15 (max)
0248    8D 18 D4    STA $D418           ; SID - Select Filter Mode and Volume


					; INIT Adresspointer
024B    A0 00       LDY #$00            ; Y=0
024D    A9 AE       LDA #$AE            ; Load Source address #$AE62 and store in $BD/$BE
024F    85 BE       STA $BE             ;
0251    A9 62       LDA #$62            ;
0253    85 BD       STA $BD             ;
0255    A9 C0       LDA #$C0            ; Load Destination address #$C000 and store in $FB/$FC
0257    85 FC       STA $FC             ; (#$00 still in $FB)
0259    A2 B3       LDX #$B3            ; high limit of $BE counter

                    ; Loop 025B - Copy C64-RAM $AE62-$B461 to $C000-$C5FF
.Branch_025B
025B    B1 BD       LDA ($BD),Y         ; Load from Address ($AE62+Y)                              <------
025D    91 FB       STA ($FB),Y         ; Store to Address ($C000+Y)                                      |
025F    88          DEY                 ; Y = Y - 1                                                       |
0260    D0 F9       BNE .Branch_025B    ; Loop 025B - Copy 256 bytes from ($BE,$BD) to ($FC,$FB)   >------+
;                                                                                                         |
0262    E6 BE       INC $BE             ; $BE=$BE+1 (MSB of address) , AE, AF, B0, B1, B2, B3             |
0264    E6 FC       INC $FC             ; $FC=$FC+1 (MSB of address) , C0, C1, C2, C3, C4, C5             |
0266    E4 BE       CPX $BE             ; X = #$B3                                                        |
0268    10 F1       BPL .Branch_025B    ; Loop 025B - Copy $AE62-$B461 to $C000-$C5FF              >------

; !exrom  !game
; 1       1    - no cart
; 1       0    - ultimax
; 0       1    - 8k game
; 0       0    - 16k game

026A    A9 E7       LDA #$E7            ; %1110 0111 , BASIC ROM on, Kernel on, CHARROM off
026C    85 01       STA $01             ; 6510 On-Chip Port - [-][-][Cass Motor][Cass Switch][Cass DOut][/CHAREN][/HIRAM][/LORAM]
026E    AD 81 DF    LDA $DF81           ; 6525 Port B - IN:[/EXROM] OUT:[?][?][/WR][D3][D2][D1][D0]
0271    29 80       AND #$80            ; %1000 0000 , EXROM
0273    A8          TAY                 ; Transfer A to Y
0274    AD 80 DF    LDA $DF80           ; 6525 Port A - IN:[DIR][/EOS][/GAME] OUT:[SI][D3][D2][D1][D0]
0277    29 20       AND #$20            ; %0010 0000 , GAME
0279    D0 0F       BNE .Branch_028A    ; Branch if external cart GAME is high (inactve)                          >------
;                                                                                                                        |
027B    98          TYA                 ; Transfer Y to A                                                                |
027C    D0 08       BNE .Branch_0286    ; Branch if external cart EXROM is high (inactive)         >------               |
                                                                                                          |              |
                    ; GAME and EXROM low (active) - 16k Cartridge                                         |              |
                    ;                                                                                     |              |
027E    A9 B5       LDA #$B5            ; %1011 0101 , CA= , CB=                                          |              |
                                                                                                          |              |
                    ; start 8k or 16k Game Cartridge                                                      |              |
.Branch_0280        ;                                                                                     |              |
0280    8D 86 DF    STA $DF86           ; 6525 Control Register - [CB1][CB0][CA1][CA0][IE4][IE3][IP][MC]  |              |
0283    6C FC FF    JMP ($FFFC)         ; $FFD3 RESET vector                                              |  <------     |
;                                                                                                         |         |    |
                    ; GAME low (active) and EXROM high (active) - 8k Cartridge                            |         |    |
.Branch_0286        ;                                                                                     |         |    |
0286    A9 F5       LDA #$F5            ; %1111 0101 , CA=High, CB=High                            <------          |    |
0288    D0 F6       BNE .Branch_0280    ; Branch always   -> Reset                                           >------     |
;                                                                                                                        |
                    ; GAME is high (inactive), check EXROM for Ultimax Cartridge                                         |
.Branch_028A        ;                                                                                                    |
028A    98          TYA                 ; Transfer Y to A, Get back external cart EXROM value                     <------
028B    D0 0D       BNE .Branch_029A    ; Branch if external cart EXROM is high                                   >------
;                                                                                                                        |
                    ; EXROM is high (inactive), check ROML CBM80 signature                                               |
028D    A9 A5       LDA #$A5            ; %1010 0101 , CA=Low, CB=Low                                                    |
028F    8D 86 DF    STA $DF86           ; 6525 Control Register - [CB1][CB0][CA1][CA0][IE4][IE3][IP][MC]                 |
0292    20 02 FD    JSR $FD02           ; Call Kernal-Routine, Checks for Cartridge (CBM80), Check for 8-ROM             |
0295    D0 03       BNE .Branch_029A    ; Branch if CBM80 signature not found                                     >------+
;                                                                                                                        |
                    ; start CBM80 cartridge by calling the reset vector                                                  |
0297    6C FC FF    JMP ($FFFC)         ; $FFD3 RESET vector (this vecor was changed if a CBM80-cartridge is inserted)   |
                                        ; start cartridge code                                                           |
;                                                                                                                        |
                    ; no Cartridge or Ultimax Cartridge with no CBM80 Signature                                          |
.Branch_029A        ;                                                                                                    |
029A    4C 00 C0    JMP $C000           ; Jump to Magic Voice code at $C000                                       <------


; ROM initially mapped in Ultimax mode
; Eprom: $3FD3

; ------------
; RESET_VECTOR
; ------------
; After Reset
; 
FFD3    78          SEI                 ; Set Interrupt Flag (disable IRQ)
FFD4    A2 00       LDX #$00            ; %0000 0000
FFD6    8E 16 D0    STX $D016           ; VIC Control Register
                                        ;     7-6 Unused
                                        ;       5   ALWAYS SET THIS BIT TO 0 !
                                        ;       4 Multi-Color Mode: 1 = Enable (Text or Bit-Map)
                                        ;       3 Select 38/40 Column Text Display: 1 = 40 Cols
                                        ;     2-0 Smooth Scroll to X Pos
FFD9    CA          DEX                 ; X=X-1 (#$FF)
FFDA    9A          TXS                 ; Transfer X to Stack Ptr
FFDB    D8          CLD                 ; Clear Decimal-Flag
FFDC    A9 E9       LDA #$E9            ; %1110 1001 , $9 = SYSTEM POWER DOWN (1 Nibble Instruction)
FFDE    8D 81 DF    STA $DF81           ; 6525 Port B - IN:[/EXROM] OUT:[?][?][/WR][D3][D2][D1][D0]
FFE1    A2 7F       LDX #$7F            ; %0111 1111
FFE3    8E 84 DF    STX $DF84           ; 6525 Data Direction Port B - 0=Input, 1=Output
FFE6    09 10       ORA #$10            ; %0001 0000 , /WR=High
FFE8    8D 81 DF    STA $DF81           ; 6525 Port B - IN:[/EXROM] OUT:[?][?][/WR][D3][D2][D1][D0]

                    ; Copy 157 bytes from $FF36-$FFD2 to $0200-$029C (program code for INITIALIZE_SPEECHMODULE_AND_C64 and COPY_EPROM_TO_RAM)
FFEB    A0 9D       LDY #$9D            ; Y=157

                    ; Loop FFED
.Branch_FFED
FFED    B9 35 FF    LDA $FF35,Y         ;                  <------
FFF0    88          DEY                 ; Y=Y-1                   |
FFF1    99 00 02    STA $0200,Y         ;                         |
FFF4    D0 F7       BNE .Branch_FFED    ; Loop FFED        >------

FFF6    4C 1A 02    JMP .Jump_021A      ; Jump INITIALIZE_SPEECHMODULE_AND_C64


; ------------------
; NMI_AND_IRQ_VECTOR
; ------------------
; 
FFF9    40          RTI                 ; Return from INTERRUPT

; Eprom: $3FFA
FFFA    !byte $F9, $FF                  ; $FFF9 NMI vector
FFFC    !byte $D3, $FF                  ; $FFD3 RESET vector (65491)
FFFE    !byte $F9, $FF                  ; $FFF9 IRQ vector

; *******
; * END *
; *******
