*
*   THIS CODE HANDLES ONE CONTROLLER WITH UP TO 3 AUDIO MIXERS.
*   FIRST MIXER IS FOR THE REPEATER. SECOND MIXER IS FOR LINK TX.
*   THIRD MIXER IS FOR THE REMOTE BASE TX.
*
*
*ADD TONE GENERATE CODE TO ADJ. ID LEVEL.08/21/91
*ENABLED RESPONSE TO PATHES THAT ARE ENABLED.09/10/91
*FIX TEST TONE TO SHIFT HIGH WITH T.T. "A". 09/10/91
*FIX TEST TONE TO SHIFT LOW WITH T.T. "B".  09/10/91
*FIX TEST TONE TO TERMINATE WITH T.T. "C".  09/10/91
*FIX TEST TONE TO SWEEP LOW TO HIGH. 09/11/91
*
*
*THE FOLLOWING EQUATES MUST BE ENTERED FOR THE POWER ON RESET STATE
*OF THE CONTROLLER.  DO NOT ENTER HERE.  THEY START AT LINE 81.
*  FCT1    EQU    $00     ;POR DEFAULTS FOR FUNCTION BYTE 1.
*  FCT2    EQU    $00     ;POR DEFAULTS FOR FUNCTION BYTE 2.
*  FCT3    EQU    $00     ;POR DEFAULTS FOR FUNCTION BYTE 3.
*  FCT4    EQU    $00     ;POR DEFAULTS FOR FUNCTION BYTE 4.
*  FCT5    EQU    $00     ;POR DEFAULTS FOR FUNCTION BYTE 5.
*  FCT6    EQU    $00     ;POR DEFAULTS FOR FUNCTION BYTE 6.
*  AUDIO1  EQU    $00     ;POR DEFAULTS FOR MIXER1.
*  AUDIO2  EQU    $00     ;POR DEFAULTS FOR MIXER2.
*  AUDIO3  EQU    $00     ;POR DEFAULTS FOR MIXER3.
*
*
        ORG     $FFF0
*
FILL1   FDB     $FFFF,$FFFF,$FFFF,$FFFF
*
        ORG     $E000
*********************PUT NEW EPROM DATE HERE***********************************
*
DATE    FCC     " V2, THE ROM DATE IS 12/01/08. "
        FCB     EOT
******REPLACE MY CALL SIGN WITH YOURS.  MUST BE UPPER CASE CHARACTERS.*********
*
MYCALL  FCC     " DE WB6JHQ/R "  ;MAY BE ANY UPPER CASE ASCII CHARACTERS.
        FCB     EOT              ;A-Z,0-9 AND ANY LENGTH.
*
******THIS ENTRY IS THE ALTERNATE ID.  NORMALLY I PLACE THE LOCATION SUFFIX HERE.
*
MYCALL1 FCC     " DE WB6JHQ/R SUNSET "  ;MAY BE ANY UPPER CASE ASCII CHARACTERS.
        FCB     EOT               ;A-Z,0-9 AND ANY LENGTH.
*******************************************************************************
*
REMOFF  FCC     " RMT OFF"
        FCB     EOT
*
P1ON    FCC     " P1 ON"
        FCB     EOT
P2ON    FCC     " P2 ON"
        FCB     EOT
P3ON    FCC     " P3 ON"
        FCB     EOT
P4ON    FCC     " P4 ON"
        FCB     EOT
P5ON    FCC     " P5 ON"
        FCB     EOT
P6ON    FCC     " P6 ON"
        FCB     EOT
*
P1OFF   FCC     " P1 OFF"
        FCB     EOT
P2OFF   FCC     " P2 OFF"
        FCB     EOT
P3OFF   FCC     " P3 OFF"
        FCB     EOT
P4OFF   FCC     " P4 OFF"
        FCB     EOT
P5OFF   FCC     " P5 OFF"
        FCB     EOT
P6OFF   FCC     " P6 OFF"
        FCB     EOT
*
*PUT POWER ON RESET DEFAULTS HERE.
*
*FUNCTION BYTE ONE.
FCT1    EQU     $37     ;POR DEFAULTS FOR FUNCTION BYTE 1.
*
CTRLK   EQU     $80     ;0 . . . . . . . ;CONTROLLER LOCKED.
RPT_ON  EQU     $40     ;. * . . . . . . ;REPEATER ON.(PATH0)
CHPON   EQU     $20     ;. . 1 . . . . . ;CHOPPER ON.
FSON    EQU     $10     ;. . . 1 . . . . ;FAILSAFE ON.
DIAG    EQU     $08     ;. . . . 0 . . . ;DIAGNOSTIC MODE SET.
KFLTON  EQU     $04     ;. . . . . 1 . . ;KERCHUNK FILTER ON.
DROPON  EQU     $02     ;. . . . . . 1 . ;DROP DELAY ON.
PLON    EQU     $01     ;. . . . . . . 1 ;PL MODE ON.
*
*FUNCTION BYTE TWO.
FCT2    EQU     $CD     ;POR DEFAULTS FOR FUNCTION BYTE 2.
*
PWRFL   EQU     $80     ;1 . . . . . . . ;POWER FAILURE BIT.
MUTEON  EQU     $40     ;. 1 . . . . . . ;MUTE FUNCTION ON BIT.
TIMEADJ EQU     $20     ;. . * . . . . . ;1 HERTZ TIMER ADJUSTMENT.
REST_PL EQU     $10     ;. . . 0 . . . . ;AUTO RESTORE PL MODE.
RTON    EQU     $08     ;. . . . 1 . . . ;REMOTE TELEMETRY ON.
USERFA  EQU     $04     ;. . . . . 1 . . ;USER FUNCTION ALLOWED.
RSTCOR  EQU     $02     ;. . . . . . 0 . ;TIMER RESET ON COR DROP.
NPLREQ  EQU     $01     ;. . . . . . . 1 ;NO PL REQUIRED FOR DECODE.
*
*FUNCTION BYTE THREE.
FCT3    EQU     $94     ;POR DEFAULTS FOR FUNCTION BYTE 3.
*
RESPBIT EQU     $80     ;1 . . . . . . . ;REPONCE ENABLED BIT.
SNDROM  EQU     $40     ;. * . . . . . . ;SEND ROM DATE BIT.
ID_BIT  EQU     $20     ;. . * . . . . . ;FORCE I.D. BIT.
AUTOID  EQU     $10     ;. . . 1 . . . . ;IDENTIFIER ON.
AUTOL   EQU     $08     ;. . . . 0 . . . ;AUTO LOCKUP.
BEP_ON  EQU     $04     ;. . . . . 1 . . ;COR RESET BEEP ON.
IDBIT2  EQU     $02     ;. . . . . . * . ;SELECT IDENT BIT 2.
IDBIT1  EQU     $01     ;. . . . . . . * ;SELECT IDENT BIT 1.
*
*FUNCTION BYTE FOUR.
FCT4    EQU     $00     ;POR DEFAULTS FOR FUNCTION BYTE 4.
*
AROFF   EQU     $80     ;0 . . . . . . . ;AUTO REPEATER OFF IN 30 SECONDS.
DBLLK   EQU     $40     ;. 0 . . . . . . ;DOUBLE LOCKED BIT.
*SPARE  EQU     $20     ;. . 0 . . . . . ;
SERTST  EQU     $10     ;. . . 0 . . . . ;SENDS SERIAL DATA CONSTANTLY.
TSTONE  EQU     $08     ;. . . . 0 . . . ;TEST TONE GENERATE.
SWEEP1  EQU     $04     ;. . . . . 0 . . ;SWEEP TONE GENERATOR STEP X1 L TO H.
SWEEP4  EQU     $02     ;. . . . . . 0 . ;SWEEP TONE GENERATOR STEP X4 L TO H.
SWEEP8  EQU     $01     ;. . . . . . . 0 ;SWEEP TONE GENERATOR STEP X8 L TO H.
*
*FUNCTION BYTE FIVE.
FCT5    EQU     $00     ;POR DEFAULTS FOR FUNCTION BYTE 5.
*
PATH0   EQU     $80     ;0 . . . . . . . ;RPTR TO RPTT ENABLED.
PATH1   EQU     $40     ;. 0 . . . . . . ;LNKR TO RPTT ENABLED.
PATH2   EQU     $20     ;. . 0 . . . . . ;RMTR TO RPTT ENABLED.
PATH3   EQU     $10     ;. . . 0 . . . . ;RPTR TO LNKT ENABLED.
PATH4   EQU     $08     ;. . . . 0 . . . ;RMTR TO LNKT ENABLED.
PATH5   EQU     $04     ;. . . . . 0 . . ;RPTR TO RMTT ENABLED.
PATH6   EQU     $02     ;. . . . . . 0 . ;LNKR TO RMTT ENABLED.
PATH7   EQU     $01     ;. . . . . . . 0 ;SPARE.
*
*FUNCTION BYTE SIX.
FCT6    EQU     $00     ;POR DEFAULTS FOR FUNCTION BYTE 6.
*
*       EQU     $80     ;0 . . . . . . . ;SPARE.
*       EQU     $40     ;. 0 . . . . . . ;SPARE.
*       EQU     $20     ;. . 0 . . . . . ;SPARE.
*       EQU     $10     ;. . . 0 . . . . ;SPARE.
*       EQU     $08     ;. . . . 0 . . . ;SPARE.
*       EQU     $04     ;. . . . . 0 . . ;SPARE.
*       EQU     $02     ;. . . . . . 0 . ;SPARE.
*       EQU     $01     ;. . . . . . . 0 ;SPARE.
*
*PUT MIXER POR DEFAULTS HERE IN AUDIO1,AUDIO2,AUDIO3.
*
*THIS MIXER IS FOR THE REPEATER TRANSMITTER.
*
AUDIO1  EQU     $00     ;0 . . . . . . . ;MIXER1 CHAN8
*                       ;. 0 . . . . . . ;MIXER1 CHAN7
*                       ;. . 0 . . . . . ;MIXER1 CHAN6
*                       ;. . . 0 . . . . ;MIXER1 CHAN5
*                       ;. . . . 0 . . . ;MIXER1 CHAN4 (RESPONSE/ID)
*                       ;. . . . . 0 . . ;MIXER1 CHAN3 (RMT AUDIO  )
*                       ;. . . . . . 0 . ;MIXER1 CHAN2 (LINK AUDIO )
*                       ;. . . . . . . 0 ;MIXER1 CHAN1 (RPT AUDIO  )
*
*THIS MIXER IS FOR THE LINK TRANSMITTER.
*
AUDIO2  EQU     $00     ;0 . . . . . . . ;MIXER2 CHAN8
*                       ;. 0 . . . . . . ;MIXER2 CHAN7
*                       ;. . 0 . . . . . ;MIXER2 CHAN6
*                       ;. . . 0 . . . . ;MIXER2 CHAN5
*                       ;. . . . 0 . . . ;MIXER2 CHAN4 (RESPONSE/ID)
*                       ;. . . . . 0 . . ;MIXER2 CHAN3 (RMT AUDIO  )
*                       ;. . . . . . 0 . ;MIXER2 CHAN2 (LINK AUDIO )
*                       ;. . . . . . . 0 ;MIXER2 CHAN1 (RPT AUDIO  )
*
*THIS MIXER IS FOR THE REMOTE TRANSMITTER.
*
AUDIO3  EQU     $00     ;0 . . . . . . . ;MIXER3 CHAN8
*                       ;. 0 . . . . . . ;MIXER3 CHAN7
*                       ;. . 0 . . . . . ;MIXER3 CHAN6
*                       ;. . . 0 . . . . ;MIXER3 CHAN5
*                       ;. . . . 0 . . . ;MIXER3 CHAN4 (RESPONSE/ID)
*                       ;. . . . . 0 . . ;MIXER3 CHAN3 (RMT AUDIO  )
*                       ;. . . . . . 0 . ;MIXER3 CHAN2 (LINK AUDIO )
*                       ;. . . . . . . 0 ;MIXER3 CHAN1 (RPT AUDIO  )
*
*MIXER DEFINITIONS
*
M1C1    EQU     $01     ;MIXER1 CH1. (RPT AUDIO  )
M1C2    EQU     $02     ;MIXER1 CH2. (LINK AUDIO )
M1C3    EQU     $04     ;MIXER1 CH3. (RMT AUDIO  )
M1C4    EQU     $08     ;MIXER1 CH4.
M1C5    EQU     $10     ;MIXER1 CH5.
M1C6    EQU     $20     ;MIXER1 CH6.
M1C7    EQU     $40     ;MIXER1 CH7.
M1C8    EQU     $80     ;MIXER1 CH8.
*
M2C1    EQU     $01     ;MIXER2 CH1. (RPT AUDIO  )
M2C2    EQU     $02     ;MIXER2 CH2. (LINK AUDIO )
M2C3    EQU     $04     ;MIXER2 CH3. (RMT AUDIO  )
M2C4    EQU     $08     ;MIXER2 CH4.
M2C5    EQU     $10     ;MIXER2 CH5.
M2C6    EQU     $20     ;MIXER2 CH6.
M2C7    EQU     $40     ;MIXER2 CH7.
M2C8    EQU     $80     ;MIXER2 CH8.
*
M3C1    EQU     $01     ;MIXER3 CH1. (RPT AUDIO  )
M3C2    EQU     $02     ;MIXER3 CH2. (LINK AUDIO )
M3C3    EQU     $04     ;MIXER3 CH3. (RMT AUDIO  )
M3C4    EQU     $08     ;MIXER3 CH4.
M3C5    EQU     $10     ;MIXER3 CH5.
M3C6    EQU     $20     ;MIXER3 CH6.
M3C7    EQU     $40     ;MIXER3 CH7.
M3C8    EQU     $80     ;MIXER3 CH8.
*
* FLAG BYTE0 EQUATES.
*
TXFLG   EQU     $80     ;TRANSMIT FLAG.
FSFLG   EQU     $40     ;FAILSAFE FLAG.
CHPFLG  EQU     $20     ;3 MIN. TIMER FLAG.
RRFLAG  EQU     $10     ;REMOTE RESPONCE REQUEST FLAG.
IDFLG   EQU     $08     ;IDENT FLAG.
MUTEFLG EQU     $04     ;MUTE FLAG.
MORSE   EQU     $02     ;MORSE CODE RESPONSE FLAG.
SERFLG  EQU     $01     ;SERIAL REQUEST FLAG.
*
* FLAG BYTE1 EQUATES.
*
*SPARE  EQU     $80     ;SPARE.
*SPARE  EQU     $40     ;SPARE.
*SPARE  EQU     $20     ;SPARE.
*SPARE  EQU     $10     ;SPARE.
*SPARE  EQU     $08     ;SPARE.
*SPARE  EQU     $04     ;SPARE.
*SPARE  EQU     $02     ;SPARE.
*SPARE  EQU     $01     ;SPARE.
*
*TX REQUEST OFF BYTE
*
*       EQU     $80     ;SPARE.
*       EQU     $40     ;SPARE.
*       EQU     $20     ;SPARE.
RPT_TX  EQU     $10     ;T5.
*       EQU     $08     ;SPARE.
*       EQU     $04     ;SPARE.
LNK_TX  EQU     $02     ;T2.
RMT_TX  EQU     $01     ;T1.
*
*************RRBYTE DETAIL*********************************
*SPARE  EQU     $80     ;SPARE
R_LO1   EQU     $40     ;RESPONSE REQUEST 420R->450T.(P1)
R_LO2   EQU     $20     ;RESPONSE REQUEST RMTR->450T.(P2)
R_HI1   EQU     $10     ;RESPONSE REQUEST 450R->420T.(P3)
R_LO3   EQU     $08     ;RESPONSE REQUEST RMTR->420T.(P4)
R_HI2   EQU     $04     ;RESPONSE REQUEST 450R->RMTT.(P5)
R_HI3   EQU     $02     ;RESPONSE REQUEST 420R->RMTT.(P6)
*SPARE  EQU     $01     ;SPARE
*
*
*       FUNCTION TOUCHTONE CODES GO HERE.
*
*          TOUCH-TONE: 1  2  3  4  5  6  7  8  9  0  *  #  A  B  C  D
*          EQUALS      |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |
* SSI-202 DECODER HEX: 1  2  3  4  5  6  7  8  9  A  B  C  D  E  F  0
*
*
*PUT PREFIX DIGIT HERE. IE:$0B=*,$0C=#,$00=D.
*
PREFIX  EQU     $0B     ;TOUCHTONE '*'
*
************** CHECK FOR USER FUNCTION____________
*                                                 |
*              HEX                                V  TOUCH-TONE
F1      EQU    $1AA1  ;LOCK CODE                 [ ]( 1 0 0 1 )
F2      EQU    $1AA2  ;UNLOCK CODE               [ ]( 1 0 0 2 )
F3      EQU    $1AA3  ;FORCE IDENT0.             [ ]( 1 0 0 3 )
F4      EQU    $1AA4  ;FORCE RESET (POR)         [ ]( 1 0 0 4 )
F5      EQU    $1AA5  ;REPEATER ON CODE          [ ]( 1 0 0 5 )
F6      EQU    $1AA6  ;SEND EPROM DATE           [ ]( 1 0 0 6 )
F7      EQU    $1AA7  ;REPEATER OFF CODE         [ ]( 1 0 0 7 )
F8      EQU    $1AA8  ;PL MODE ON CODE           [ ]( 1 0 0 8 )
F9      EQU    $1AA9  ;PL MODE OFF CODE          [ ]( 1 0 0 9 )
F10     EQU    $1A1A  ;CHOPPER ON                [ ]( 1 0 1 0 )
F11     EQU    $1A11  ;CHOPPER OFF               [ ]( 1 0 1 1 )
F12     EQU    $1A12  ;FORCE IDENT1.             [ ]( 1 0 1 2 )
F13     EQU    $1A13  ;SET AUTO REPEATER OFF.    [ ]( 1 0 1 3 )
F14     EQU    $1A14  ;RESET AUTO RPTR. OFF.     [ ]( 1 0 1 4 )
*F15    EQU    $1A15  ;                          [ ]( 1 0 1 5 )
F16     EQU    $1A16  ;KERCHUNK FILTER ON        [ ]( 1 0 1 6 )
F17     EQU    $1A17  ;KERCHUNK FILTER OFF       [ ]( 1 0 1 7 )
F18     EQU    $1A18  ;DROP DELAY ON             [ ]( 1 0 1 8 )
F19     EQU    $1A19  ;DROP DELAY OFF            [ ]( 1 0 1 9 )
F20     EQU    $1A2A  ;POWER FAILURE BIT RST.    [ ]( 1 0 2 0 )
F21     EQU    $1A21  ;MUTE ON                   [ ]( 1 0 2 1 )
F22     EQU    $1A22  ;MUTE OFF                  [ ]( 1 0 2 2 )
F23     EQU    $1A23  ;TURN ON SWEEP TEST STEP1. [ ]( 1 0 2 3 )
F24     EQU    $1A24  ;TURN ON SWEEP TEST STEP4. [ ]( 1 0 2 4 )
F25     EQU    $1A25  ;TURN ON SWEEP TEST STEP8. [ ]( 1 0 2 5 )
F26     EQU    $1A26  ;RESET NORMAL MODE.        [ ]( 1 0 2 6 )
*F27    EQU    $1A27  ;                          [ ]( 1 0 2 7 )
F28     EQU    $1A28  ;USER FUNCTIONS ALLOWED    [ ]( 1 0 2 8 )
F29     EQU    $1A29  ;USER FUNCTS NOT ALLOWED   [ ]( 1 0 2 9 )
F30     EQU    $1A3A  ;TIMER RESET ON COR DROP   [ ]( 1 0 3 0 )
F31     EQU    $1A31  ;TIMER RESET ON TX DROP    [ ]( 1 0 3 1 )
F32     EQU    $1A32  ;ADJUST 1 HERTZ TIMER.     [ ]( 1 0 3 2 )
*F33    EQU    $1A33  ;                          [ ]( 1 0 3 3 )
F34     EQU    $1A34  ;RESPONSE ON               [ ]( 1 0 3 4 )
F35     EQU    $1A35  ;RESPONSE OFF              [ ]( 1 0 3 5 )
F36     EQU    $1A36  ;AUTO RESTORE PL MODE.     [ ]( 1 0 3 6 )
F37     EQU    $1A37  ;RESET RESTORE PL MODE.    [ ]( 1 0 3 7 )
*F38    EQU    $1A38  ;                          [ ]( 1 0 3 8 )
*F39    EQU    $1A39  ;                          [ ]( 1 0 3 9 )
F40     EQU    $1A4A  ;REMOTE TELEMETRY ON.      [ ]( 1 0 4 0 )
F41     EQU    $1A41  ;REMOTE TELEMETRY OFF.     [ ]( 1 0 4 1 )
F42     EQU    $1A42  ;NO PL REQUIRED FOR DECODE [ ]( 1 0 4 2 )
F43     EQU    $1A43  ;PL REQUIRED FOR DECODE.   [ ]( 1 0 4 3 )
*F44    EQU    $1A44  ;                          [ ]( 1 0 4 4 )
*F45    EQU    $1A45  ;                          [ ]( 1 0 4 5 )
*F46    EQU    $1A46  ;                          [ ]( 1 0 4 6 )
F47     EQU    $1A47  ;INCR. MIN10 CNTR.         [ ]( 1 0 4 7 )
F48     EQU    $1A48  ;DECR. MIN10 CNTR.         [ ]( 1 0 4 8 )
F49     EQU    $1A49  ;INCR. CHOP TIMER.         [ ]( 1 0 4 9 )
F50     EQU    $1A5A  ;DECR. CHOP TIMER.         [ ]( 1 0 5 0 )
F51     EQU    $1A51  ;INCR. KERCHUNK FILTER.    [ ]( 1 0 5 1 )
F52     EQU    $1A52  ;DECR. KERCHUNK FILTER.    [ ]( 1 0 5 2 )
F53     EQU    $1A53  ;INCR. DROP DELAY CNTR.    [ ]( 1 0 5 3 )
F54     EQU    $1A54  ;DECR. DROP DELAY CNTR.    [ ]( 1 0 5 4 )
F55     EQU    $1A55  ;INCR. ID TIMER.           [ ]( 1 0 5 5 )
F56     EQU    $1A56  ;DECR. ID TIMER.           [ ]( 1 0 5 6 )
F57     EQU    $1A57  ;LINK TO RPTR ENABLE.      [ ]( 1 0 5 7 )
F58     EQU    $1A58  ;LINK TO RPTR DISABLE.     [ ]( 1 0 5 8 )
F59     EQU    $1A59  ;RPTR TO LINK ENABLE.      [ ]( 1 0 5 9 )
F60     EQU    $1A6A  ;RPTR TO LINK DISABLE.     [ ]( 1 0 6 0 )
F61     EQU    $1A61  ;RPTR TO REMOTE ENABLE.    [ ]( 1 0 6 1 )
F62     EQU    $1A62  ;RPTR TO REMOTE DISABLE.   [ ]( 1 0 6 2 )
F63     EQU    $1A63  ;REMOTE TO RPTR ENABLE.    [ ]( 1 0 6 3 )
F64     EQU    $1A64  ;REMOTE TO RPTR DISABLE.   [ ]( 1 0 6 4 )
F65     EQU    $1A65  ;LINK TO REMOTE ENABLE.    [ ]( 1 0 6 5 )
F66     EQU    $1A66  ;LINK TO REMOTE DISABLE.   [ ]( 1 0 6 6 )
F67     EQU    $1A67  ;REMOTE TO LINK ENABLE.    [ ]( 1 0 6 7 )
F68     EQU    $1A68  ;REMOTE TO LINK DISABLE.   [ ]( 1 0 6 8 )
F69     EQU    $1A69  ;COR RESET BEEP ON         [ ]( 1 0 6 9 )
F70     EQU    $1A7A  ;COR RESET BEEP OFF        [ ]( 1 0 7 0 )
*F71    EQU    $1A71  ;                          [ ]( 1 0 7 1 )
*F72    EQU    $1A72  ;                          [ ]( 1 0 7 2 )
*F73    EQU    $1A73  ;                          [ ]( 1 0 7 3 )
*F74    EQU    $1A74  ;                          [ ]( 1 0 7 4 )
F75     EQU    $1A75  ;SET AUTO LOCKUP.          [ ]( 1 0 7 5 )
F76     EQU    $1A76  ;RESET AUTO LOCKUP.        [ ]( 1 0 7 6 )
F77     EQU    $1A77  ;RESET DOUBL LOCK.         [ ]( 1 0 7 7 )
F78     EQU    $1A78  ;SET DIAGNOSTIC MODE BIT.  [ ]( 1 0 7 8 )
F79     EQU    $1A79  ;RESET DIAGNOSTIC BIT.     [ ]( 1 0 7 9 )
F80     EQU    $1A8A  ;SET DOUBLE LOCKED.        [ ]( 1 0 8 0 )
*F81    EQU    $1A81  ;                          [ ]( 1 0 8 1 )
*F82    EQU    $1A82  ;                          [ ]( 1 0 8 2 )
F83     EQU    $1A83  ;DECR. ID. TONE.           [ ]( 1 0 8 3 )
F84     EQU    $1A84  ;INCR. ID. TONE.           [ ]( 1 0 8 4 )
F85     EQU    $1A85  ;ENABLE IDENTIFIER.        [ ]( 1 0 8 5 )
F86     EQU    $1A86  ;DISABLE IDENTIFIER.       [ ]( 1 0 8 6 )
F87     EQU    $1A87  ;SET FAILSAFE ON.          [ ]( 1 0 8 7 )
F88     EQU    $1A88  ;RESET FAILSAFE ON.        [ ]( 1 0 8 8 )
F89     EQU    $1A89  ;ALL TIMERS OFF.           [ ]( 1 0 8 9 )
F90     EQU    $1A9A  ;ALL TIMERS ON.            [ ]( 1 0 9 0 )
F91     EQU    $1A91  ;SET SERIAL TEST.          [ ]( 1 0 9 1 )
F92     EQU    $1A92  ;RESET SERIAL TEST.        [ ]( 1 0 9 2 )
F93     EQU    $1A93  ;TEST TONE GENERATE.       [ ]( 1 0 9 3 )
*F94    EQU    $1A94  ;                          [ ]( 1 0 9 4 )
*F95    EQU    $1A95  ;                          [ ]( 1 0 9 5 )
F96     EQU    $1A96  ;SET FL1 (T6)              [ ]( 1 0 9 6 )
F97     EQU    $1A97  ;SET FL2 (T7)              [ ]( 1 0 9 7 )
F98     EQU    $1A98  ;SET FL3 (T4)              [ ]( 1 0 9 8 )
F99     EQU    $1A99  ;SET FL4 (T3)              [ ]( 1 0 9 9 )
F100    EQU    $11AA  ;SET FL5 (T2)              [ ]( 1 1 0 0 )
F101    EQU    $11A1  ;SET FL6 (T1)              [ ]( 1 1 0 1 )
F102    EQU    $11A2  ;RST FL1 (T6)              [ ]( 1 1 0 2 )
F103    EQU    $11A3  ;RST FL2 (T7)              [ ]( 1 1 0 3 )
F104    EQU    $11A4  ;RST FL3 (T4)              [ ]( 1 1 0 4 )
F105    EQU    $11A5  ;RST FL4 (T3)              [ ]( 1 1 0 5 )
F106    EQU    $11A6  ;RST FL5 (T2)              [ ]( 1 1 0 6 )
F107    EQU    $11A7  ;RST FL6 (T1)              [ ]( 1 1 0 7 )
F108    EQU    $11A8  ;TURN ON MIXER1 CHAN 8     [ ]( 1 1 0 8 )
F109    EQU    $11A9  ;TURN ON MIXER1 CHAN 7     [ ]( 1 1 0 9 )
F110    EQU    $111A  ;TURN ON MIXER1 CHAN 6     [ ]( 1 1 1 0 )
F111    EQU    $1111  ;TURN ON MIXER1 CHAN 5     [ ]( 1 1 1 1 )
F112    EQU    $1112  ;TURN ON MIXER1 CHAN 4     [ ]( 1 1 1 2 )
F113    EQU    $1113  ;TURN ON MIXER1 CHAN 3     [ ]( 1 1 1 3 )
F114    EQU    $1114  ;TURN ON MIXER1 CHAN 2     [ ]( 1 1 1 4 )
F115    EQU    $1115  ;TURN ON MIXER1 CHAN 1     [ ]( 1 1 1 5 )
F116    EQU    $1116  ;TURN OFF MIXER1 CHAN 8    [ ]( 1 1 1 6 )
F117    EQU    $1117  ;TURN OFF MIXER1 CHAN 7    [ ]( 1 1 1 7 )
F118    EQU    $1118  ;TURN OFF MIXER1 CHAN 6    [ ]( 1 1 1 8 )
F119    EQU    $1119  ;TURN OFF MIXER1 CHAN 5    [ ]( 1 1 1 9 )
F120    EQU    $112A  ;TURN OFF MIXER1 CHAN 4    [ ]( 1 1 2 0 )
F121    EQU    $1121  ;TURN OFF MIXER1 CHAN 3    [ ]( 1 1 2 1 )
F122    EQU    $1122  ;TURN OFF MIXER1 CHAN 2    [ ]( 1 1 2 2 )
F123    EQU    $1123  ;TURN OFF MIXER1 CHAN 1    [ ]( 1 1 2 3 )
F124    EQU    $1124  ;TURN ON MIXER2 CHAN 8     [ ]( 1 1 2 4 )
F125    EQU    $1125  ;TURN ON MIXER2 CHAN 7     [ ]( 1 1 2 5 )
F126    EQU    $1126  ;TURN ON MIXER2 CHAN 6     [ ]( 1 1 2 6 )
F127    EQU    $1127  ;TURN ON MIXER2 CHAN 5     [ ]( 1 1 2 7 )
F128    EQU    $1128  ;TURN ON MIXER2 CHAN 4     [ ]( 1 1 2 8 )
F129    EQU    $1129  ;TURN ON MIXER2 CHAN 3     [ ]( 1 1 2 9 )
F130    EQU    $113A  ;TURN ON MIXER2 CHAN 2     [ ]( 1 1 3 0 )
F131    EQU    $1131  ;TURN ON MIXER2 CHAN 1     [ ]( 1 1 3 1 )
F132    EQU    $1132  ;TURN OFF MIXER2 CHAN 8    [ ]( 1 1 3 2 )
F133    EQU    $1133  ;TURN OFF MIXER2 CHAN 7    [ ]( 1 1 3 3 )
F134    EQU    $1134  ;TURN OFF MIXER2 CHAN 6    [ ]( 1 1 3 4 )
F135    EQU    $1135  ;TURN OFF MIXER2 CHAN 5    [ ]( 1 1 3 5 )
F136    EQU    $1136  ;TURN OFF MIXER2 CHAN 4    [ ]( 1 1 3 6 )
F137    EQU    $1137  ;TURN OFF MIXER2 CHAN 3    [ ]( 1 1 3 7 )
F138    EQU    $1138  ;TURN OFF MIXER2 CHAN 2    [ ]( 1 1 3 8 )
F139    EQU    $1139  ;TURN OFF MIXER2 CHAN 1    [ ]( 1 1 3 9 )
F140    EQU    $114A  ;TURN ON MIXER3 CHAN 8     [ ]( 1 1 4 0 )
F141    EQU    $1141  ;TURN ON MIXER3 CHAN 7     [ ]( 1 1 4 1 )
F142    EQU    $1142  ;TURN ON MIXER3 CHAN 6     [ ]( 1 1 4 2 )
F143    EQU    $1143  ;TURN ON MIXER3 CHAN 5     [ ]( 1 1 4 3 )
F144    EQU    $1144  ;TURN ON MIXER3 CHAN 4     [ ]( 1 1 4 4 )
F145    EQU    $1145  ;TURN ON MIXER3 CHAN 3     [ ]( 1 1 4 5 )
F146    EQU    $1146  ;TURN ON MIXER3 CHAN 2     [ ]( 1 1 4 6 )
F147    EQU    $1147  ;TURN ON MIXER3 CHAN 1     [ ]( 1 1 4 7 )
F148    EQU    $1148  ;TURN OFF MIXER3 CHAN 8    [ ]( 1 1 4 8 )
F149    EQU    $1149  ;TURN OFF MIXER3 CHAN 7    [ ]( 1 1 4 9 )
F150    EQU    $115A  ;TURN OFF MIXER3 CHAN 6    [ ]( 1 1 5 0 )
F151    EQU    $1151  ;TURN OFF MIXER3 CHAN 5    [ ]( 1 1 5 1 )
F152    EQU    $1152  ;TURN OFF MIXER3 CHAN 4    [ ]( 1 1 5 2 )
F153    EQU    $1153  ;TURN OFF MIXER3 CHAN 3    [ ]( 1 1 5 3 )
F154    EQU    $1154  ;TURN OFF MIXER3 CHAN 2    [ ]( 1 1 5 4 )
F155    EQU    $1155  ;TURN OFF MIXER3 CHAN 1    [ ]( 1 1 5 5 )
*
F_TABLE FDB     F3,F_ID0        ;FORCE IDENT, SET DEFAULT.
        FDB     F4,FRCRST       ;FORCE RESET.
        FDB     F5,RPTRON       ;SET REPEATER ON BIT.
        FDB     F7,RPTOFF       ;RESET REPEATER ON BIT.
        FDB     F6,SROM         ;SEND EPROM DATE.
        FDB     F10,CHON        ;CHOPPER ON.
        FDB     F11,CHOFF       ;CHOPPER OFF.
        FDB     F12,F_ID1       ;FORCE IDENT, SET ID1.
        FDB     F23,SWEEPR1     ;TURN ON AUDIO SWEEP GENERATOR STEP1.
        FDB     F24,SWEEPR4     ;TURN ON AUDIO SWEEP GENERATOR STEP4.
        FDB     F25,SWEEPR8     ;TURN ON AUDIO SWEEP GENERATOR STEP8.
        FDB     F28,USERA       ;USER FUNCTION ALLOWED.
        FDB     F30,TROCD       ;TIMER RESET ON COR DROP.
        FDB     F31,TROTD       ;TIMER RESET ON TX DROP.
        FDB     F32,ADJ_ON      ;1 HERTZ TIMER ADJ. RTN.
        FDB     F36,ARP         ;AUTO RESTORE PL MODE.
        FDB     F37,RARP        ;RESET AUTO RESTORE PL.
        FDB     F42,NPR         ;NO PL REQUIRED FOR DECODE.
        FDB     F43,PR          ;PL REQUIRED FOR DECODE.
        FDB     F47,IMC         ;INCR. MIN10.
        FDB     F48,DMC         ;DECR. MIN10.
        FDB     F49,ICT         ;INCR. CHOPPER TIMER.
        FDB     F50,DCT         ;DECR. CHOPPER TIMER.
        FDB     F51,IKF         ;INCR. KERCHUNCK FILTER.
        FDB     F52,DKF         ;DECR. KERCHUNCK FILTER.
        FDB     F53,IDC         ;INCR. DROP DELAY COUNTER.
        FDB     F54,DDC         ;DECR. DROP DELAY COUNTER.
        FDB     F55,IIC         ;INCR. IDENT COUNTER.
        FDB     F56,DIC         ;DECR. IDENT COUNTER.
        FDB     F75,SALOCK      ;SET AUTO LOCKUP.
        FDB     F76,RALOCK      ;RESET AUTO LOCKUP.
        FDB     F78,DIAGON      ;SET DIAG MODE BIT.
        FDB     F79,DIAGOFF     ;RESET DIAG MODE BIT.
        FDB     F83,ID_UP       ;INCREMENT ID TONE.
        FDB     F84,ID_DWN      ;DECREMENT ID TONE.
        FDB     F85,ID_ON       ;ENABLE IDENTIFIER.
        FDB     F86,ID_OFF      ;DISABLE IDENTIFIER.
        FDB     F87,SFSON       ;SET FAILSAFE ON.
        FDB     F88,RFSON       ;RESET "      " .
        FDB     F91,SSTST       ;SET SERIAL TEST BIT.
        FDB     F92,RSTST       ;RESET SERIAL TEST BIT.
        FDB     F93,TTGEN       ;TEST TONE GENERATE.
        FDB     F96,SF1         ;SET F1.   TURNS ON TRANSISTOR T6.
        FDB     F97,SF2         ;SET F2.   TURNS ON TRANSISTOR T7.
        FDB     F98,SF3         ;SET F3    TURNS ON TRANSISTOR T4.
        FDB     F99,SF4         ;SET F4    TURNS ON TRANSISTOR T3.
        FDB     F100,SF5        ;SET F5    TURNS ON TRANSISTOR T2.
        FDB     F101,SF6        ;SET F6    TURNS ON TRANSISTOR T1.
        FDB     F102,RF1        ;RESET F1  TURNS OFF TRANSISTOR T6.
        FDB     F103,RF2        ;RESET F2  TURNS OFF TRANSISTOR T7.
        FDB     F104,RF3        ;RESET F3  TURNS OFF TRANSISTOR T4.
        FDB     F105,RF4        ;RESET F4  TURNS OFF TRANSISTOR T3.
        FDB     F106,RF5        ;RESET F5  TURNS OFF TRANSISTOR T2.
        FDB     F107,RF6        ;RESET F6  TURNS OFF TRANSISTOR T1.
        FDB     F108,TOM1C8     ;TURN ON MIXER1 CHAN 8.
        FDB     F109,TOM1C7     ;TURN ON MIXER1 CHAN 7.
        FDB     F110,TOM1C6     ;TURN ON MIXER1 CHAN 6.
        FDB     F111,TOM1C5     ;TURN ON MIXER1 CHAN 5.
        FDB     F112,TOM1C4     ;TURN ON MIXER1 CHAN 4.
        FDB     F113,TOM1C3     ;TURN ON MIXER1 CHAN 3.
        FDB     F114,TOM1C2     ;TURN ON MIXER1 CHAN 2.
        FDB     F115,TOM1C1     ;TURN ON MIXER1 CHAN 1.
        FDB     F116,TOFM1C8    ;TURN OFF MIXER1 CHAN 8.
        FDB     F117,TOFM1C7    ;TURN OFF MIXER1 CHAN 7.
        FDB     F118,TOFM1C6    ;TURN OFF MIXER1 CHAN 6.
        FDB     F119,TOFM1C5    ;TURN OFF MIXER1 CHAN 5.
        FDB     F120,TOFM1C4    ;TURN OFF MIXER1 CHAN 4.
        FDB     F121,TOFM1C3    ;TURN OFF MIXER1 CHAN 3.
        FDB     F122,TOFM1C2    ;TURN OFF MIXER1 CHAN 2.
        FDB     F123,TOFM1C1    ;TURN OFF MIXER1 CHAN 1.
        FDB     F124,TOM2C8     ;TURN ON MIXER2 CHAN 8.
        FDB     F125,TOM2C7     ;TURN ON MIXER2 CHAN 7.
        FDB     F126,TOM2C6     ;TURN ON MIXER2 CHAN 6.
        FDB     F127,TOM2C5     ;TURN ON MIXER2 CHAN 5.
        FDB     F128,TOM2C4     ;TURN ON MIXER2 CHAN 4.
        FDB     F129,TOM2C3     ;TURN ON MIXER2 CHAN 3.
        FDB     F130,TOM2C2     ;TURN ON MIXER2 CHAN 2.
        FDB     F131,TOM2C1     ;TURN ON MIXER2 CHAN 1.
        FDB     F132,TOFM2C8    ;TURN OFF MIXER2 CHAN 8.
        FDB     F133,TOFM2C7    ;TURN OFF MIXER2 CHAN 7.
        FDB     F134,TOFM2C6    ;TURN OFF MIXER2 CHAN 6.
        FDB     F135,TOFM2C5    ;TURN OFF MIXER2 CHAN 5.
        FDB     F136,TOFM2C4    ;TURN OFF MIXER2 CHAN 4.
        FDB     F137,TOFM2C3    ;TURN OFF MIXER2 CHAN 3.
        FDB     F138,TOFM2C2    ;TURN OFF MIXER2 CHAN 2.
        FDB     F139,TOFM2C1    ;TURN OFF MIXER2 CHAN 1.
        FDB     F140,TOM3C8     ;TURN ON MIXER3 CHAN 8.
        FDB     F141,TOM3C7     ;TURN ON MIXER3 CHAN 7.
        FDB     F142,TOM3C6     ;TURN ON MIXER3 CHAN 6.
        FDB     F143,TOM3C5     ;TURN ON MIXER3 CHAN 5.
        FDB     F144,TOM3C4     ;TURN ON MIXER3 CHAN 4.
        FDB     F145,TOM3C3     ;TURN ON MIXER3 CHAN 3.
        FDB     F146,TOM3C2     ;TURN ON MIXER3 CHAN 2.
        FDB     F147,TOM3C1     ;TURN ON MIXER3 CHAN 1.
        FDB     F148,TOFM3C8    ;TURN OFF MIXER3 CHAN 8.
        FDB     F149,TOFM3C7    ;TURN OFF MIXER3 CHAN 7.
        FDB     F150,TOFM3C6    ;TURN OFF MIXER3 CHAN 6.
        FDB     F151,TOFM3C5    ;TURN OFF MIXER3 CHAN 5.
        FDB     F152,TOFM3C4    ;TURN OFF MIXER3 CHAN 4.
        FDB     F153,TOFM3C3    ;TURN OFF MIXER3 CHAN 3.
        FDB     F154,TOFM3C2    ;TURN OFF MIXER3 CHAN 2.
        FDB     F155,TOFM3C1    ;TURN OFF MIXER3 CHAN 1.
        FDB     F8,PLMON        ;PL MODE ON.
        FDB     F9,CORMODE      ;COR MODE ON.
        FDB     F16,KON         ;KERCHUNK FILTER ON.
        FDB     F17,KOFF        ;KERCHUNK FILTER OFF.
        FDB     F18,DON         ;DROP DELAY ON.
        FDB     F19,DOFF        ;DROP DELAY OFF.
        FDB     F21,MON         ;MUTE ON.
        FDB     F22,MOFF        ;MUTE OFF.
        FDB     F26,RNM         ;RESET NORMAL MODE.
        FDB     F34,RSPON       ;RESPONSE ENABLED.
        FDB     F35,RSPOFF      ;RESPONSE DISABLED.
        FDB     F40,RTON1       ;REMOTE TELEMETRY ON.
        FDB     F41,RTOFF       ;REMOTE TELEMETRY OFF.
UFA     FDB     F57,EP1         ;LNKR TO RPTT ENABLE.
        FDB     F58,DP1         ;LNKR TO RPTT DISABLE.
        FDB     F59,EP3         ;RPTR TO LNKT ENABLE.
        FDB     F60,DP3         ;RPTR TO LNKT DISABLE.
        FDB     F61,EP5         ;RPTR TO RMTT ENABLE.
        FDB     F62,DP5         ;RPTR TO RMTT DISABLE.
        FDB     F63,EP2         ;RMTR TO RPTT ENABLE.
        FDB     F64,DP2         ;RMTR TO RPTT DISABLE.
        FDB     F65,EP6         ;LNKR TO RMTT ENABLE.
        FDB     F66,DP6         ;LNKR TO RMTT DISABLE.
        FDB     F67,EP4         ;RMTR TO LNKT ENABLE.
        FDB     F68,DP4         ;RMTR TO LNKT DISABLE.
        FDB     F69,RSTBON      ;RESET BEEP ON.
        FDB     F70,RSTBOFF     ;RESET BEEP OFF.
        FDB     F89,ALLTOFF     ;TURN ALL TIMERS OFF.
        FDB     F90,ALLTON      ;TURN ALL TIMERS ON.
SECOND  FDB     F2,UNLCK        ;UNLOCK FUNCTION.
        FDB     F1,LOCK         ;LOCKED FUNCTION.
        FDB     F13,SAROFF      ;SET AUTO REPEATER OFF.
        FDB     F14,RAROFF      ;RESET AUTO REPEATER OFF.
PRIM    FDB     F77,RSDBL       ;RESET DOUBLE LOCKED.
        FDB     F29,USERNA      ;USER FUNCTION NOT ALLOWED.
        FDB     F80,SDBL        ;SET DOUBLE LOCKED.
        FDB     F20,PORRST      ;POR FAILURE BIT RESET.
ENDTAB  FCB     $01
*
* LOW MEMORY ASSIGNMENTS
*
MIN3    EQU    $0000   ;3 MINUTE CHOP TIMER SAVE AREA.(1)
M10INT  EQU    $0001   ;INIT VALUE FOR IDTEN.(2)
IDTEN   EQU    $0003   ;ID TIMER.(2)
XTEMP   EQU    $0005   ;TEMP STORAGE FOR SCODE RTN.(2)
TONECT  EQU    $0007   ;TONE DURATION SAVE AREA.(2)
CORRST  EQU    $0009   ;COUNTER FOR RESTORING PL MODE.(2)
UTIME   EQU    $000B   ;MORSE TONE GENERATOR SAVE AREA.(1)
X_INC   EQU    $000C   ;INDEX REG. INCREMENT AREA.(2)
FCCTR   EQU    $000E   ;FUNCTION CONPLETE COUNTER.(1)
TXREQ   EQU    $000F   ;TRANSMITTER REQUEST OFF BYTE.(1)
MSAVE   EQU    $0010   ;CODE CONVERT SAVE AREA. (2)
M3INT   EQU    $0012   ;INIT VALUE FOR MIN3.(1)
KINT    EQU    $0013   ;KERCHUNK INIT.(2)
DINT    EQU    $0015   ;DELAY COUNTER INIT.(2)
ARPLMS  EQU    $0017   ;AUTO-RESTORE PLMODE TIMER SAVE AREA.(2)
RRBYTE  EQU    $0019   ;REMOTE RESPONSE BYTE.(1)
FLAGS0  EQU    $001A   ;FLAGS REG 0.(1)
*SPARE  EQU    $001B   ;SPARE 1 BYTE.(1)
IN1     EQU    $001C   ;INPUT AREA BYTE ONE, 2 DIGITS.(1)
IN2     EQU    $001D   ;INPUT AREA BYTE TWO, 2 DIGITS.(1)
DCTR    EQU    $001E   ;DIGIT COUNTER SAVE AREA.(1)
FCTB1   EQU    $001F   ;FUNCTION BYTE ONE.(1)
FCTB2   EQU    $0020   ;FUNCTION BYTE TWO.(1)
FCTB3   EQU    $0021   ;FUNCTION BYTE THREE.(1)
FCTB4   EQU    $0022   ;FUNCTION BYTE FOUR.(1)
FCTB5   EQU    $0023   ;FUNCTION BYTE FIVE.(1)
FCTB6   EQU    $0024   ;FUNCTION BYTE SIX.(1)
MIX1    EQU    $0025   ;AUDIO MIXER1 CONTROL BYTE.(1)
MIX2    EQU    $0026   ;AUDIO MIXER2 CONTROL BYTE.(1)
MIX3    EQU    $0027   ;AUDIO MIXER3 CONTROL BYTE.(1)
MUTECNT EQU    $002D   ;MUTE COUNTER SAVE AREA.(1)
PMTO16  EQU    $002E   ;PMTO COUNTER SAVE AREA.(2)
MSAVE0  EQU    $0030   ;TEMP DATA SAVE AREA FOR MORSE CONV.(1)
MSAVE1  EQU    $0031   ;TERMINATE CHARACTER FOR MORSE CONV.(1)
SAVEXM  EQU    $0032   ;TEMP INDEX SAVE AREA FOR MORSE CONV.(1)
STACK   EQU    $007F   ;STACK POINTER INITIAL VALUE.
*
*
* PIA AND OTHER EQUATES
*
REQINT  EQU    $00     ;SET TX ENABLE FOR 450T ON POR.
IDAUDIO EQU    $80     ;I.D. AUDIO BIT IN DATA OUT REG.
PTIME   EQU     240    ;240 SECONDS AFTER CHOP FORCE RPTR OFF.
ONESEC  EQU    $07D0   ;ADJUST FOR 1 SECOND.
TDLY    EQU    $8000   ;1 SEC. COUNT DOWN VALUE.
PLCOR   EQU    $3000   ;PL OR COR GLITCH DELAY VALUE.
RMT_COS EQU    $80     ;REMOTE COS INPUT.(PA7)
LNK_COS EQU    $40     ;LINK COS INPUT.(PA6)
PL_BIT  EQU    $20     ;REPEATER PL BIT.(PA5)
COR_BIT EQU    $10     ;REPEATER COS LINE.(PA4)
DATAIN  EQU    $A000   ;CONTROL LINES AND TOUCHTONES READ HERE.
DATAOUT EQU    $A002   ;OUTPUT TRANSISTORS AND AUDIO SENT HERE.
PIAINP  EQU    $001F   ;CONFIG BYTES FOR PIA'S.
PIAOUT  EQU    $FF2F   ;
ARPLMI  EQU    $001E   ;AUTO LOCKUP IN 30 SECONDS.
LOCKIT  EQU    $80     ; "     "
LOW1    EQU    $A0     ;LOW TONE 1 FREQ. VALUE.
HIGH1   EQU    $60     ;HIGH TONE 1 FREQ. VALUE.
LOW2    EQU    $90     ;LOW TONE 2 FREQ. VALUE.
HIGH2   EQU    $50     ;HIGH TONE 2 FREQ. VALUE.
LOW3    EQU    $80     ;LOW TONE 3 FREQ. VALUE.
HIGH3   EQU    $40     ;HIGH TONE 3 FREQ. VALUE.
RMTONE  EQU    $0050   ;REMOTE RESPONSE TONE DURATION.
RRDELAY EQU     15     ;REMOTE RESPONSE DELAY TIME.
DTCT    EQU    $0030   ;DIT LENGTH ADJUSTMENT.(DAH = 3*DTCT)
UTIMI   EQU    $50     ;500 USEC. (83*6)
EOT     EQU    $FF     ;END OF TRANSMISSION.
EOC     EQU    $80     ;END OF CHARACTER.
SPACE   EQU    $21     ;SPACE CODE.
M10I    EQU     0590   ;ID TIMER INIT VALUE (9 MIN. 50 SEC.)
M3I     EQU     0180   ;3 MINUTE INIT VALUE.(CHANGE AS REQUIRED)
KCHKI   EQU    $2000   ;KERCHUNK INIT VALUE.
DLYI    EQU    $6000   ;DROP DELAY INIT VALUE.(CHANGE AS REQUIRED)
FLGSI   EQU    $01     ;FLAGS INIT VALUE.
MUTM    EQU    $02     ;MUTE DELAY TIME.
FL1     EQU    $20     ;FUNCTION 1 LATCH (T6).
FL2     EQU    $40     ;FUNCTION 2 LATCH (T7)
TX_BIT  EQU    $10     ;TX BIT IN PIA OUTPUT REG.(T5)
FL3     EQU    $08     ;FUNCTION 3 LATCH (T4)
FL4     EQU    $04     ;FUNCTION 4 LATCH (T3)
FL5     EQU    $02     ;FUNCTION 5 LATCH (T2)
FL6     EQU    $01     ;FUNCTION 6 LATCH (T1)
CLK     EQU    $20     ;T6 (FL1) IS CLOCK.
NOCLK   EQU    $DF     ;
DATABIT EQU    $40     ;T7 (FL2) IS DATA BIT.
ID1ST   EQU    $1E     ;IDENT AFTER POR NO LESS THAN 30 SECONDS.
*
*
*       TITLE   'REPEATER SOFTWARE BY WB6JHQ'
*
RESTART SEI                    ;DISABLE INTERRUPTS.
        LDS           #STACK   ;LOAD STACK POINTER.
        LDX           #PIAINP  ;INPUTS AND IRQ ENABLED.
        STX            DATAIN  ;INIT 1ST PIA PORT AS INPUTS WITH IRQ.
        LDX           #PIAOUT  ;OUTPUTS AND STROBE.
        STX            DATAOUT ;INIT 2ND PIA PORT AS OUTPUTS & STRB.
        LDAA          #$00     ;TURN OFF ALL TX'S.
        STAA           DATAOUT ;PUT IT OUT.
        JSR            CLRMEM  ;CLEAR LOW MEMORY.
        JSR            INITIT  ;INITS LOW MENORY CONSTANTS.
        JSR            SERDATA ;CLEAR SERIAL PORT.
        LDS           #STACK   ;LOAD STACK POINTER.
        JSR            TXOFF   ;TURN OFF TRANSMITTER.
        CLI                    ;ENABLE INTERRUPTS FROM TOUCHTONE DECODER
*
*       THIS IS THE CONTROL LOOP. CHECKING FUNCTION AND STATUS BITS.
*       PUT SCANNED FUNCTIONS IN HERE.
C_LOOP  LDAA           FCTB2   ;CHECK FOR NO CONTROL PL REQUIRED.
        ANDA          #NPLREQ  ;TO FUNCTION CONTROLLER.
        BNE            PMTO    ;IF BIT ON THEN NO PL REQUIRED.
        LDAA           DATAIN  ;DIGIT COUNTER.
        ANDA          #PL_BIT  ;
        BEQ            PMTO    ;IF PL ACTIVE GO TO P.M.T.O.
FFDCTR  LDAA          #$FF     ;LOAD DCTR TO DUMP DECODER.
        STAA           DCTR    ;
PMTO    LDAA          #PTIME   ;PUT # IN COUNT DOWN TIMER.
        STAA           PMTO16  ;FOR PROCESS MONITOR TIMEOUT.
        LDAA           FCCTR   ;GET RESPONSE VALUE.
        BEQ            CKMORSE ;GO ON IF ZERO.
        JSR            RESPOND ;GO SEND RESPONSE BEEPS.
*
CKMORSE LDAA           FLAGS0  ;CHECK SEND PATH OFF.
        ANDA          #MORSE   ;
        BEQ            P1      ;
        LDAA           FLAGS0  ;CHK MUTE FLAG
        ANDA          #MUTEFLG ;IF MUTE ON THEN DONT RESPOND.
        BNE            P1      ;
        LDAA           DATAIN  ;CHECK FOR RPTR COS.
        ANDA          #$40     ;IF ON DON'T RESPOND.
        BEQ            P1      ;
        LDAA           DATAIN  ;CHECK FOR RPTR PL.
        ANDA          #$20     ;IF ON DON'T RESPOND.
        BEQ            P1      ;
        LDAA           DATAIN  ;CHECK FOR LINK COS.
        ANDA          #$10     ;IF ON DON'T RESPOND.
        BEQ            P1      ;
        JSR            TXON    ;
        JSR            DELONE  ;
        LDX            MSAVE   ;POINT TO MORSE SAVE AREA.
        JSR            EPROM1  ;GO SEND IT.
        LDAA          #MORSE   ;TURN OFF FLAG.
        COMA                   ;
        ANDA           FLAGS0  ;
        STAA           FLAGS0  ;
        JSR            TXOFF   ;
*
************************************************************************
***SET AUDIO PATH AND TURN ON/OFF REPEATER, LINK OR REMOTE TX HERE.*****
************************************************************************
P1      LDAA           FCTB5   ;CHECK IF LINK ENABLED TO 450 RPTR.
        ANDA          #PATH1   ;
        BEQ            P1T     ;
        LDAA           DATAIN  ;GET LINK COS SENSE.
        ANDA          #LNK_COS ;MASK ALL BUT LINK COS.
        BNE            P1A     ;
        LDAA          #TX_BIT  ;TURN ON THE REPEATER TX WITHOUT FLAG.
        ORAA           DATAOUT ;
        STAA           DATAOUT ;
        BRA            P2      ;
P1A     LDAA           FCTB5   ;GET PATH STATUS.
        ANDA          #PATH0   ;CHECK FOR PATH 0 ON.
        BNE            P2      ;IF SO LET PATH 0 HANDLE TURN OFF OF T5.
        LDAA           FCTB5   ;GET PATH STATUS.
        ANDA          #PATH2   ;CHECK FOR PATH 2 ON.
        BNE            P2      ;IF PATH 2 OFF THEN TURN OFF T5.
P1TX    LDAA          #TX_BIT  ;TURN OFF RPTR TX. (T5)
        COMA                   ;
        JSR            RSTR1   ;
        BRA            P2      ;
P1T     LDAA           TXREQ   ;CHK FOR TX OFF REQ.
        ANDA          #RPT_TX  ;
        BEQ            P2      ;
        LDAA           TXREQ   ;CLEAR BIT IF ON.
        ANDA          #$EF     ;
        STAA           TXREQ   ;
        BRA            P1TX    ;
*
P2      LDAA           FCTB5   ;CHECK IF RMT IS ENABLED
        ANDA          #PATH2   ;TO THE 450 REPEATER.
        BEQ            P2T     ;
**************************TURN ON 450T*************************************
        LDAA           DATAIN  ;GET REMOTE COS SENSE.
        ANDA          #RMT_COS ;MASK ALL BUT RMT COS.
        BNE            P2A     ;
        LDAA          #TX_BIT  ;TURN ON THE REPEATER TX WITHOUT FLAG.
        ORAA           DATAOUT ;
        STAA           DATAOUT ;
        BRA            P3      ;
**************************TURN OFF 450T************************************
P2A     LDAA           FCTB5   ;GET PATH STATUS.
        ANDA          #PATH0   ;CHECK FOR PATH 0 ON.
        BNE            P3      ;IF SO LET PATH 0 HANDLE TURN OFF OF T5.
        LDAA           FCTB5   ;GET PATH STATUS.
        ANDA          #PATH1   ;CHECK FOR PATH 1 ON.
        BEQ            P3      ;
        LDAA           DATAIN  ;GET LINK COS SENSE.
        ANDA          #LNK_COS ;MASK ALL BUT LINK COS.
        BEQ            P3      ;
P2TX    LDAA          #TX_BIT  ;
        COMA                   ;
        JSR            RSTR1   ;
        BRA            P3      ;
P2T     LDAA           TXREQ   ;CHK FOR TX OFF REQ.
        ANDA          #RPT_TX  ;
        BEQ            P3      ;
        LDAA           TXREQ   ;CLEAR BIT IF ON.
        ANDA          #$EF     ;
        STAA           TXREQ   ;
        BRA            P2TX    ;
*
P3      LDAA           FCTB5   ;CHECK IF 450 AUDIO IS ENABLED TO LINK TX.
        ANDA          #PATH3   ;
        BEQ            P3T     ;
P3A     LDAA           FCTB1   ;GET FUNCTION BYTE ONE.
        ANDA          #PLON    ;MASK PL MODE BIT.
        BEQ            COR_P3  ;IF NOT ON THEN GO COR MODE.
        LDAA           DATAIN  ;GET RPTR PL SENSE.
        ANDA          #PL_BIT  ;MASK ALL BUT 450 PL.
        BNE            P3B     ;
        BRA            P3C     ;
COR_P3  LDAA           DATAIN  ;GET COS SENSE.
        ANDA          #COR_BIT ;
        BNE            P3B     ;
**************************TURN ON 420T*************************************
P3C     LDAA          #FL5     ;TURN ON THE LINK TX.
        ORAA           DATAOUT ;
        STAA           DATAOUT ;
        BRA            P4      ;
**************************TURN OFF 420T************************************
P3B     LDAA           FCTB5   ;GET PATH BITS.
        ANDA          #PATH4   ;CHECK FOR PATH 4 ON.
        BNE            P3D     ;IF SO DONT TURN OFF T2. CHK COS.
P3E     LDAA          #FL5     ;
        COMA                   ;
        JSR            RSTR1   ;
        BRA            P4      ;
P3D     LDAA           DATAIN  ;CHK RMT COS BIT.
        ANDA          #RMT_COS ;IF OFF THEN TURN OFF LINK (T2).
        BNE            P3E     ;
        BRA            P4      ;
P3T     LDAA           TXREQ   ;CHK FOR TX OFF REQ.
        ANDA          #LNK_TX  ;
        BEQ            P4      ;
        LDAA           TXREQ   ;CLEAR BIT IF ON.
        ANDA          #$FD     ;
        STAA           TXREQ   ;
        BRA            P3E     ;
*
P4      LDAA           FCTB5   ;CHECK IF RMT IS ENABLED TO LINK TX.
        ANDA          #PATH4   ;
        BEQ            P4T     ;
P4A     LDAA           DATAIN  ;GET REMOTE COS SENSE.
        ANDA          #RMT_COS ;MASK ALL BUT RMT COS.
        BNE            P4B     ;
        LDAA          #FL5     ;TURN ON THE LINK TX.
        ORAA           DATAOUT ;
        STAA           DATAOUT ;
        BRA            P5      ;
P4B     LDAA           FCTB5   ;GET PATH BITS.
        ANDA          #PATH3   ;CHECK FOR PATH 3 ON.
        BNE            P4D     ;IF SO DONT TURN OFF T2 YET.
P4E     LDAA          #FL5     ;TURN OFF 420 TX.
        COMA                   ;
        JSR            RSTR1   ;
        BRA            P5      ;
P4D     LDAA           DATAIN  ;CHK RPTR COS BIT.
        ANDA          #COR_BIT ;IF OFF THEN TURN OFF LINK (T2).
        BNE            P4E     ;
        BRA            P5      ;
P4T     LDAA           TXREQ   ;CHK FOR TX OFF REQ.
        ANDA          #LNK_TX  ;
        BEQ            P5      ;
        LDAA           TXREQ   ;CLEAR BIT IF ON.
        ANDA          #$FD     ;
        STAA           TXREQ   ;
        BRA            P4E     ;
*
P5      LDAA           FCTB5   ;CHECK IF 450 AUDIO IS ENABLED TO RMT TX.
        ANDA          #PATH5   ;
        BEQ            P5T     ;
P5A     LDAA           FCTB1   ;GET FUNCTION BYTE ONE.
        ANDA          #PLON    ;MASK PL MODE BIT.
        BEQ            COR_P5  ;IF NOT ON THEN GO COR MODE.
        LDAA           DATAIN  ;GET RPTR PL SENSE.
        ANDA          #PL_BIT  ;MASK ALL BUT 450 PL.
        BNE            P5B     ;
        BRA            P5C     ;
COR_P5  LDAA           DATAIN  ;GET COS SENSE.
        ANDA          #COR_BIT ;
        BNE            P5B     ;
P5C     LDAA          #FL6     ;TURN ON THE 10 METER TX.
        ORAA           DATAOUT ;
        STAA           DATAOUT ;
        BRA            P6      ;
P5B     LDAA           FCTB5   ;GET PATH BITS.
        ANDA          #PATH6   ;CHECK FOR PATH 6 ON.
        BNE            P5D     ;IF SO DONT TURN OFF T1 YET.
P5E     LDAA          #FL6     ;
        COMA                   ;
        JSR            RSTR1   ;
        BRA            P6      ;
P5D     LDAA           DATAIN  ;CHK LINK COS BIT.
        ANDA          #LNK_COS ;IF OFF THEN TURN OFF LINK (T1).
        BNE            P5E     ;
        BRA            P6      ;
P5T     LDAA           TXREQ   ;CHK FOR TX OFF REQ.
        ANDA          #RMT_TX  ;
        BEQ            P6      ;
        LDAA           TXREQ   ;CLEAR BIT IF ON.
        ANDA          #$FE     ;
        STAA           TXREQ   ;
        BRA            P5E     ;
*
P6      LDAA           FCTB5   ;CHECK IF LINK AUDIO IS ENABLED TO RMT TX.
        ANDA          #PATH6   ;
        BEQ            P6T     ;
P6A     LDAA           DATAIN  ;GET REMOTE COS SENSE.
        ANDA          #LNK_COS ;MASK ALL BUT LINK COS.
        BNE            P6B     ;
        LDAA          #FL6     ;TURN ON THE 10 METER TX.
        ORAA           DATAOUT ;
        STAA           DATAOUT ;
        BRA            SENDROM ;
P6B     LDAA           FCTB5   ;GET PATH BITS.
        ANDA          #PATH5   ;CHECK FOR PATH 5 ON.
        BNE            P6D     ;IF SO DONT TURN OFF T1 YET.
P6E     LDAA          #FL6     ;
        COMA                   ;
        JSR            RSTR1   ;
        BRA            SENDROM ;
P6D     LDAA           DATAIN  ;CHK RPTR COS BIT.
        ANDA          #COR_BIT ;IF OFF THEN TURN OFF RMT (T1).
        BNE            P6E     ;
        BRA            SENDROM ;
P6T     LDAA           TXREQ   ;CHK FOR TX OFF REQ.
        ANDA          #RMT_TX  ;
        BEQ            SENDROM ;
        LDAA           TXREQ   ;CLEAR BIT IF ON.
        ANDA          #$FE     ;
        STAA           TXREQ   ;
        BRA            P6E     ;
*
SENDROM LDAA           FCTB3   ;CHECK IF SEND EPROM IS ON.
        ANDA          #SNDROM
        BEQ            RRSP    ;
        JSR            EPROM
******************************************************************************
RRSP    LDAA           FCTB2   ;CHK IF REMOTE TELEMETRY IS ON.
        ANDA          #RTON    ;
        BEQ            CHKSER  ;
        LDAA           FLAGS0  ;CHECK IF MUTE FLAG IS ON.
        ANDA          #MUTEFLG ;IF ON DONT RESPOND YET.
        BNE            CHKSER  ;
        LDAA           FLAGS0  ;IF ON SEND REMOTE RESPONSES.
        ANDA          #RRFLAG  ;SET IN IRQ RTN.
        BEQ            CHKSER  ;
        LDAA           FLAGS0  ;RESET RRFLAG.
        ANDA          #$EF     ;
        STAA           FLAGS0  ;
        LDAA           DATAOUT ;SAVE OUTPUT STATE.
        PSHA                   ;
        LDAA           FCTB5   ;CHK FOR LINK TX ENABLED.
        ANDA          #$18     ;
        BEQ            RTX     ;TURN ON RPTR TX ONLY IF LINK OFF.
        LDAA          #FL5     ;
        ORAA          #TX_BIT  ;
        BRA            BTHON   ;
RTX     LDAA          #TX_BIT  ;
BTHON   ORAA           DATAOUT ;
        STAA           DATAOUT ;
        JSR            DELONE  ;
        LDAA           RRBYTE  ;GET RMT RESPONSE BYTE.
        ANDA          #R_LO1   ;CHK FOR LOW TONE 1 REQUEST.
        BEQ            RHI1    ;
        JSR            LONOTE1 ;SEND LOW NOTE 1.
RHI1    LDAA           RRBYTE  ;GET RMT RESPONSE BYTE.
        ANDA          #R_HI1   ;CHK FOR HIGH TONE 1 REQUEST.
        BEQ            RLO2    ;
        JSR            HINOTE1 ;SEND HIGH NOTE 1.
RLO2    LDAA           RRBYTE  ;GET RMT RESPONSE BYTE.
        ANDA          #R_LO2   ;CHK FOR LOW TONE 2 REQUEST.
        BEQ            RHI2    ;
        JSR            LONOTE2 ;SEND LOW NOTE 2.
RHI2    LDAA           RRBYTE  ;GET RMT RESPONSE BYTE.
        ANDA          #R_HI2   ;CHK FOR HIGH TONE 2 REQUEST.
        BEQ            RLO3    ;
        JSR            HINOTE2 ;SEND HIGH NOTE 2.
RLO3    LDAA           RRBYTE  ;GET RMT RESPONSE BYTE.
        ANDA          #R_LO3   ;CHK FOR LOW TONE 3 REQUEST.
        BEQ            RHI3    ;
        JSR            LONOTE3 ;SEND LOW NOTE 3.
RHI3    LDAA           RRBYTE  ;GET RMT RESPONSE BYTE.
        ANDA          #R_HI3   ;CHK FOR HIGH TONE 3 REQUEST.
        BEQ            RTXOFF  ;
        JSR            HINOTE3 ;SEND HIGH NOTE 3.
RTXOFF  PULA                   ;RESTORE RPTR AND LINK TX.
        STAA           DATAOUT ;
        LDAA           RRBYTE  ;CLEAR ALL RESPONSE BITS.
        ANDA          #$00     ;
        STAA           RRBYTE  ;
******************************************************************************
*
CHKSER  LDAA           FLAGS0  ;CHK SERIAL INTERFACE REQUEST FLG.
        ANDA          #SERFLG  ;
        BEQ            TTG     ;
        JSR            SERDATA ;
        LDAA           FLAGS0  ;
        ANDA          #$FE     ;
        STAA           FLAGS0  ;
TTG     LDAA           FCTB1   ;CHK DIAGNOSTIC MODE.
        ANDA          #DIAG    ;
        BEQ            ID_IT   ;
        LDAA           FCTB4    ;CHK FOR TONE GEN. FUNCTION.
        ANDA          #TSTONE   ;
        BEQ            SWP1     ;
TTGL    LDX           #$0000    ;INIT TONE DURATION.
        JSR            SAVER    ;SEND TONE.
        BRA            TTG      ;
SWP1    LDAA           FCTB4    ;CHK SWEEP ON.
        ANDA          #SWEEP1   ;
        BEQ            SWP4     ;
        LDAA          #$FF      ;
        STAA           UTIME    ;SET LOWEST FREQ.
        BRA            TTGL     ;
SWP4    LDAA           FCTB4    ;CHK SWEEP ON.
        ANDA          #SWEEP4   ;
        BEQ            SWP8     ;
        LDAA          #$FF      ;
        STAA           UTIME    ;SET LOWEST FREQ.
        BRA            TTGL     ;
SWP8    LDAA           FCTB4    ;CHK SWEEP ON.
        ANDA          #SWEEP8   ;
        BEQ            ID_IT    ;
        LDAA          #$FF      ;
        STAA           UTIME    ;SET LOWEST FREQ.
        BRA            TTGL     ;
*
ID_IT   LDAA           FCTB3   ;CHK IF FORCE ID BIT IS ON.
        ANDA          #ID_BIT  ;
        BEQ            RPTON   ;
        LDAA           FLAGS0  ;
        ANDA          #MUTEFLG ;
        BNE            RPTON   ;
        JSR            IDENT   ;
        LDAA          #ID_BIT  ;RESET FORCE IDENT BIT.
        COMA                   ;
        ANDA           FCTB3   ;
        STAA           FCTB3   ;
RPTON   LDAA           FCTB1   ;CHECK IF REPEATER IS FUNCTIONED ON.
        ANDA          #RPT_ON  ;
        BNE            TSTCHP  ;IF ON THEN GO ON; IF NOT THEN LOOP.
        JSR            TXOFF   ;
        JMP            C_LOOP  ;
TSTCHP  LDAA           FCTB1   ;SEE IF CHOP FUNCTION ON.
        ANDA          #CHPON   ;
        BEQ            PLMODE  ;
        LDAA           FLAGS0  ;SEE IF CHOP TIME.
        ANDA          #CHPFLG  ;
        BEQ            PLMODE  ;
        JMP            WARN1   ;IF ON THEN WARN BEEP AND TXOFF.
PLMODE  LDAA           FCTB1   ;GET FUNCTION BYTE ONE.
        ANDA          #PLON    ;MASK PL MODE BIT.
        BEQ            COR     ;IF NOT ON THEN GO COR MODE.
        LDAA           DATAIN  ;GET PL SENSE*...GND=ACTIVE.
        ANDA          #PL_BIT  ;
        BNE            DRPIT   ;IF PL MODE THEN NO K FILTER.
        BRA            KDONE   ;
DRPIT   BRA            DROPDLY ;
COR     LDAA           DATAIN  ;GET COR SENSE*...GND=ACTIVE.
        ANDA          #COR_BIT ;
        BEQ            KCHUNK  ;
*
DROPDLY LDAA           FCTB5   ;CHK FOR PATH 1 ON.
        ANDA          #$40     ;
        BNE            P1DD    ;
        LDAA           FCTB5   ;CHK FOR PATH 2 ON.
        ANDA          #$20     ;
        BNE            P2DD    ;
        LDAA           FLAGS0  ;TEST FOR TX FLAG.
        ANDA          #TXFLG   ;
        BEQ            NRST    ;IF OFF THEN DONT DO AGAIN.
        BRA            CHKMODE ;
P1DD    LDAA           DATAIN  ;CHK LINK COS.
        ANDA          #LNK_COS ;
        BNE            NODLY   ;
        BRA            NRST    ;
P2DD    LDAA           DATAIN  ;CHK RMT COS.
        ANDA          #RMT_COS ;
        BNE            NODLY   ;
        BRA            NRST    ;
NOBLEP  JMP            NOBEP   ;
*
CHKMODE LDAA           FCTB2   ;CHECK MODE.
        ANDA          #RSTCOR  ;RESET ON COR OR TX DROP?
        BEQ            TXDROP  ;
        JMP            TAIL    ;DELAY 1 SEC.,BEEP,DELAY 2 SEC.
*
TXDROP  LDAA           FCTB1   ;CHECK FOR DROP DELAY ON/OFF.
        ANDA          #DROPON  ;
        BEQ            NODLY   ;
        LDX            DINT    ;
        JSR            TLDLA   ;
NODLY   BSR            TXOFF   ;GO TURN OFF TX.
NODLY1  LDAA           M3INT   ;INITIAL 3 MIN. TIMER.
        STAA           MIN3    ;
NRST    JMP            C_LOOP  ;
*                              ;END OF NORMAL C_LOOP.
KCHUNK  LDAA           FCTB1   ;GET FUNCTION BYTE ONE.
        ANDA          #KFLTON  ;MASK FOR KERCHUNCK BIT 2.
        BEQ            KDONE   ;IF OFF THEN SKIP IT.
        LDAA           FLAGS0  ;IF TX ALREADY ON THEN SKIP IT.
        ANDA          #TXFLG   ;
        BNE            KDONE   ;
        LDX            KINT    ;GET INITIAL KERCHUNK VALUE.
KLOOP   DEX                    ;SUBTRACT 1 FROM IT.
        BEQ            KDONE   ;IF ZERO THEN GO ON.
        LDAA           DATAIN  ;GET COR STATUS.
        ANDA          #COR_BIT ;
        BEQ            KLOOP   ;IF COR STILL ON DECREMENT KERCHUNK.
        JMP            C_LOOP  ;
KDONE   BSR            TXON    ;TURN ON TRANSMITTER.
        BSR            CHKID   ;CHECK IF TIME TO IDENTIFY.
        LDAA           DATAIN  ;GET PL SENSE*...GND=ACTIVE.
        ANDA          #PL_BIT  ;
        BNE            NOPL    ;IF PL SENSED THEN RESTORE ARPLM.
        LDX           #ARPLMI  ;SET AUTO RESTORE PL MODE VALUE.
        STX            ARPLMS  ;
NOPL    JMP            C_LOOP  ;
*
TXOFF   LDAA           FLAGS0  ;
        ANDA          #TXFLG   ;
        BEQ            NO_P    ;
        LDAA           FCTB2   ;GET POWER FAIL BIT.
        ANDA          #PWRFL   ;IS IT ON?
        BEQ            NO_P    ;
        JSR            SENDP   ;
NO_P    LDAA           DATAOUT ;TURN OFF XMIT.
        ANDA          #$EF     ;
        STAA           DATAOUT ;
        LDAA           FLAGS0  ;RESET TX FLAG AND CHOP FLAG.
        ANDA          #$5F     ;
        STAA           FLAGS0  ;
        RTS                    ;
*
TXON    LDAA           FLAGS0  ;CHECK FOR MUTE ON.
        ANDA          #MUTEFLG ;
        BNE            NO_P    ;
        LDAA           FLAGS0  ;
        ANDA          #TXFLG   ;
        BNE            FLGON   ;
        LDAA           DATAOUT ;GET OUTPUT REG.
        ORAA          #TX_BIT  ;SET TX BIT.
        STAA           DATAOUT ;
        LDAA           FLAGS0  ;
        ORAA          #TXFLG   ;SET TX FLAG BIT.
        STAA           FLAGS0  ;
FLGON   RTS                    ;
*                              ;
CHKID   LDAA           FLAGS0  ;CHK IF MUTE ON 1ST.
        ANDA          #MUTEFLG ;IF ON THEN HOLD OFF IDENT.
        BNE            NOTNOW  ;
        LDAA           FLAGS0  ;CHECK FOR I.D. TIME.
        ANDA          #IDFLG   ;
        BEQ            NOTNOW  ;
        JSR            IDENT   ;
NOTNOW  RTS                    ;
*                              ;
TAIL    LDX           #PLCOR   ;PL OR COR GLITCH DELAY VALUE.
        BSR            TLDLA   ;REMOVE GLITCHES.
        LDX           #TDLY    ;
        BSR            TLDLA   ;
*
CHKBEP  LDAA           FCTB3   ;IS RESET BEEP ENABLED?
        ANDA          #BEP_ON  ;
        BEQ            NOBEP   ;
        JSR            BEP     ;IF TIMED OUT SEND RESET TONE.
NOBEP   LDS           #STACK   ;INIT STACK.
        LDAA           M3INT   ;GET CHOPPER INIT VALUE.
        STAA           MIN3    ;
        LDAA           FLAGS0  ;GET FLAGS.
        ANDA          #$DF     ;MASK OUT CHOP FLAG.
        STAA           FLAGS0  ;PUT IT BACK.
        LDX           #TDLY    ;
        BSR            TLDLAY  ;
        JMP            NODLY   ;EXIT AND TURN OFF XMIT.
TLDLA   LDAA           FCTB1   ;THIS RTN RESTORES STACK BUT DOESNT
        ANDA          #PLON    ;RESET CHOPPER.
        BEQ            DO_COR  ;
        LDAA           DATAIN  ;GET PL SENSE. (GND ACTIVE)
        ANDA          #PL_BIT  ;
        BEQ            TLGATE  ;
        BRA            MNS1    ;
DO_COR  LDAB           DATAIN  ;GET COR SENSE. (GND ACTIVE)
        ANDB          #COR_BIT ;
        BEQ            TLGATE  ;
MNS1    DEX                    ;
        BNE            TLDLA   ;
        RTS                    ;
TLDLAY  LDAA           FCTB1   ;THIS RTN RESETS CHOPPER VALUE AND
        ANDA          #PLON    ;RESETS STACK.
        BEQ            TLD     ;
        LDAA           DATAIN  ;GET PL SENSE. (GND ACTIVE)
        ANDA          #PL_BIT  ;
        BEQ            RECON   ;
        BRA            MNUS1   ;
TLD     LDAB           DATAIN  ;
        ANDB          #COR_BIT ;
        BEQ            RECON   ;
MNUS1   DEX                    ;
        BNE            TLDLAY  ;
        RTS                    ;
RECON   LDS           #STACK   ;INIT STACK.
        LDAA           M3INT   ;INIT CHOPPER.
        STAA           MIN3    ;
        JMP            C_LOOP  ;
TLGATE  LDS           #STACK   ;INIT STACK.
        JMP            C_LOOP  ;DONT INIT CHOPPER.
WARN1   JSR            BEEP3   ;GO HERE ON CHOP.
HOLDOFF JSR            TXOFF   ;
        LDAA           FCTB1   ;
        ANDA          #RPT_ON  ;IF REPEATER OFF NOW THEN EXIT.
        BEQ            GETOUT  ;
        LDAA           FCTB1   ;CHECK PL OR COR MODE.
        ANDA          #PLON    ;
        BEQ            CCC     ;
        LDAA           DATAIN  ;GET PL SENSE. (GND ACTIVE)
        ANDA          #PL_BIT  ;
        BEQ            HOLDOFF ;
        BRA            GTOUT   ;
CCC     LDAA           DATAIN  ;
        ANDA          #COR_BIT ;
        BEQ            HOLDOFF ;COR IS GND ACTIVE.SO LOOK FOR
GTOUT   JSR            DEL2    ;PLUS TO GET OUT OF HOLDOFF LOOP.
GETOUT  JSR            IDENT   ;
        LDS           #STACK   ;INIT STACK.
        LDAA           M3INT   ;GET CHOPPER INIT VALUE.
        STAA           MIN3    ;
        LDAA           FLAGS0  ;GET FLAGS.
        ANDA          #$DF     ;MASK OUT CHOP FLAG.
        STAA           FLAGS0  ;PUT IT BACK.
        JMP            C_LOOP  ;GO TO COMMAND LOOP.
*
SERDATA LDAA            MIX3    ;AUDIO MIXER3 BYTE.
        BSR             SEROUT  ;
        LDAA            MIX2    ;AUDIO MIXER2 BYTE.
        BSR             SEROUT  ;
        LDAA            MIX1    ;AUDIO MIXER1 BYTE.
        BSR             SEROUT  ;
        LDAA            DATAOUT ;RESET DATA BIT.
        ORAA           #DATABIT ;
        STAA            DATAOUT ;
        RTS                     ;
*
SEROUT  LDAB           #$09     ;SET BIT COUNTER.
L1      DECB                    ;
        BEQ             L2      ;IF DONE EXIT.
        PSHB                    ;SAVE B.
        CLC                     ;CLEAR CARRY BIT.
        RORA                    ;SET CARRY BIT IF A 1.
        PSHA                    ;SAVE ROTATED BYTE.
        BCC             NOBIT   ;BRANCH IF CARRY IS CLEAR.
        LDAA            DATAOUT ;
        ANDA           #$BF     ;
        STAA            DATAOUT ;SET DATA BIT.
        BSR             CLKIT   ;GO SET/RESET CLOCK BIT.
        PULA                    ;RESTORE A.
        PULB                    ;RESTORE B.
        BRA             L1      ;
*
NOBIT   LDAA            DATAOUT ;RESET DATA BIT.
        ORAA           #DATABIT ;
        STAA            DATAOUT ;
        BSR             CLKIT   ;GO SET/RESET CLOCK BIT.
        PULA                    ;RESTORE A.
        PULB                    ;
        BRA             L1      ;
*
CLKIT   LDAB           #$06     ;DELAY
CLKIT1  DECB                    ;
        BNE             CLKIT1  ;
        LDAA            DATAOUT ;
        ANDA           #NOCLK   ;
        STAA            DATAOUT ;
        ORAA           #CLK     ;
        STAA            DATAOUT ;
L2      NOP                     ;
        NOP                     ;
        NOP                     ;
        NOP                     ;
        NOP                     ;
        NOP                     ;
        RTS                     ;
*
SENDP   LDX           #PCODE    ;
        JSR            SCODE    ;
        RTS
*
BEP     LDX           #DTCT/2  ;SHORT BEEP1.
        JSR            SAVER   ;SEND IT.
        RTS
*
LONOTE1 LDAA           UTIME   ;SAVE TONE FREQ.
        PSHA                   ;
        LDAA          #LOW1    ;SET FOR LOW TONE. (FREQ.)
        STAA           UTIME   ;
        LDX           #RMTONE  ;SET FOR DURATION. (LENGTH)
        STX            TONECT  ;
        JSR            SAVER   ;DO IT.
        PULA                   ;RESTORE UTIME.
        STAA           UTIME   ;
        RTS
*
HINOTE1 LDAA           UTIME   ;SAVE TONE FREQ.
        PSHA                   ;
        LDAA          #HIGH1   ;SET FOR HI TONE. (FREQ.)
        STAA           UTIME   ;
        LDX           #RMTONE  ;SET FOR DURATION.(LENGTH)
        STX            TONECT  ;
        JSR            SAVER   ;DO IT.
        PULA                   ;RESTORE UTIME.
        STAA           UTIME   ;
        RTS
*
LONOTE2 LDAA           UTIME   ;SAVE TONE FREQ.
        PSHA                   ;
        LDAA          #LOW2    ;SET FOR LOW TONE. (FREQ.)
        STAA           UTIME   ;
        LDX           #RMTONE  ;SET FOR DURATION. (LENGTH)
        STX            TONECT  ;
        JSR            SAVER   ;DO IT.
        PULA                   ;RESTORE UTIME.
        STAA           UTIME   ;
        RTS
*
HINOTE2 LDAA           UTIME   ;SAVE TONE FREQ.
        PSHA                   ;
        LDAA          #HIGH2   ;SET FOR HI TONE. (FREQ.)
        STAA           UTIME   ;
        LDX           #RMTONE  ;SET FOR DURATION.(LENGTH)
        STX            TONECT  ;
        JSR            SAVER   ;DO IT.
        PULA                   ;RESTORE UTIME.
        STAA           UTIME   ;
        RTS
*
LONOTE3 LDAA           UTIME   ;SAVE TONE FREQ.
        PSHA                   ;
        LDAA          #LOW3    ;SET FOR LOW TONE. (FREQ.)
        STAA           UTIME   ;
        LDX           #RMTONE  ;SET FOR DURATION. (LENGTH)
        STX            TONECT  ;
        JSR            SAVER   ;DO IT.
        PULA                   ;RESTORE UTIME.
        STAA           UTIME   ;
        RTS
*
HINOTE3 LDAA           UTIME   ;SAVE TONE FREQ.
        PSHA                   ;
        LDAA          #HIGH3   ;SET FOR HI TONE. (FREQ.)
        STAA           UTIME   ;
        LDX           #RMTONE  ;SET FOR DURATION.(LENGTH)
        STX            TONECT  ;
        JSR            SAVER   ;DO IT.
        PULA                   ;RESTORE UTIME.
        STAA           UTIME   ;
        RTS
*
*       INTERUPT ROUTINE FOR TOUCH TONE SERVICE BEGINS HERE. (MI)
*
IRQ     LDAB           FCTB2   ;LOOK FOR MUTE ON.
        ANDB          #MUTEON  ;
        BEQ            IRQA    ;
        LDAA           DATAIN  ;GET T.T. DATA.
        ANDA          #$0F     ;
        CMPA          #PREFIX  ;
        BEQ            RSTR    ;IF EQUAL GO TURN TX OFF & SET MUTE FLAG.
        LDAB           FLAGS0  ;
        ANDB          #MUTEFLG ;
        BEQ            IRQA    ;
        LDAB          #MUTM    ;INIT MUTE COUNTER.
        STAB           MUTECNT ;
IRQA    LDAA           DATAIN  ;GET T.T. DATA.
        ANDA          #$0F     ;
        CMPA          #PREFIX  ;
        BEQ            RSTRONE ;
        LDAB           DCTR    ;GET BYTE POINTER.
        BNE            CK1     ;IF = ZERO THEN FALL THROUGH.
IRQ1    ASLA                   ;SHIFT DATA LEFT 4 TIMES. ENTER HERE
        ASLA                   ;ALSO IF 4TH DIGIT OF SEQ. AND NO "D".
        ASLA                   ;"FUNCTION CHAINING"
        ASLA                   ;
        STAA           IN1     ;PUT AWAY IN INPUT AREA ONE.
        INC            DCTR    ;INCREMENT DIGIT COUNTER.
        RTI                    ;
CK1     CMPB          #$01     ;IS THIS 2ND DIGIT?
        BNE            CK2     ;
        ORAA           IN1     ;OR 1ST DIGIT WITH 2ND.
        STAA           IN1     ;PUT IT BACK.
        INC            DCTR    ;
        RTI                    ;
CK2     CMPB          #$02     ;IS IT 3RD DIGIT?
        BNE            CK3     ;
        ASLA                   ;
        ASLA                   ;
        ASLA                   ;
        ASLA                   ;
        STAA           IN2     ;
        INC            DCTR    ;INCREMENT DIGIT COUNTER.
        RTI                    ;
CK3     CMPB          #$03     ;IS IT 4TH DIGIT?
        BNE            INTRUDE ;IF NOT THE SET DGT TO FFH.
        ORAA           IN2     ;OR 2ND DIGIT WITH 3RD.
        STAA           IN2     ;PUT IT BACK.
        INC            DCTR    ;
        BRA            SEARCH  ;
*                              ;
RSTR    JMP            RESTORE ;
RSTRONE JMP            RSTORE1 ;
*                              ;
SEARCH  LDAA           FCTB4   ;
        ANDA          #DBLLK   ;
        BEQ            SECCK   ;
        LDX           #PRIM    ;
        BRA            SRCH1   ;
SECCK   LDAA           FCTB1   ;
        ANDA          #CTRLK   ;
        BEQ            ALL_ON  ;
        LDAA           FCTB2   ;ARE USER FUNCTIONS ALLOWED?
        ANDA          #USERFA  ;
        BNE            UFA_ON  ;
        LDX           #SECOND  ;
        BRA            SRCH1   ;
UFA_ON  LDX           #UFA     ;POINT TO USER FUNCTIONS.
        BRA            SRCH1   ;
ALL_ON  LDX           #F_TABLE ;LOAD INDEX REG WITH FUNCTIONS.
SRCH1   LDAA           IN1     ;GET 1ST DIGIT IN A-REG.
        LDAB           IN2     ;GET 2ND DIGIT IN B-REG.
LP1     CMPA             0,X   ;COMPARE A-REG PER INDEX.
        BNE            SRCHM   ;IF NO COMPARE THEN TRY AGAIN.
        INX                    ;IF MATCH THEN INCREMENT INDEX.
        CMPB             0,X   ;COMPARE B-REG PER INDEX.
        BNE            SRCHM1  ;IF NOT THEN TRY AGAIN.
        INC            FCCTR   ;INCREMENT FUNCTION COUNTER.
        LDX              1,X   ;IF MATCHED A & B. THEN GO DO IT
        JMP              0,X   ;PER INDEX REG.MUST END WITH RTI.
SRCHM   INX                    ;GO HERE IF A-REG DONT COMPARE.
SRCHM1  INX                    ;HERE IF A-REG DOES BUT NOT B-REG.
        INX                    ;
        INX                    ;
        CPX           #ENDTAB  ;IF END OF TABLE STOP SEARCHING.
        BNE            LP1     ;IF NOT THEN TRY AGAIN.
INTRUDE LDAA          #$FF     ;SET DIGIT COUNT TO FF HEX.
        STAA           DCTR    ;
        RTI                    ;
*
IDENT   JSR            TXON    ;RPTR TX ON.
        LDAA           FCTB5   ;CHK FOR PATH 3 & 4 ON.
        ANDA          #$18     ;
        BEQ            NO34P   ;
        LDAA          #LNK_TX  ;
        JSR            SETR1   ;
NO34P   JSR            DELONE  ;DELAY.
        LDAA           FCTB3   ;GET ID SELECT BITS.
        ANDA          #$03     ;
        CMPA          #$03     ;SEND ALT. ID?
        BEQ            IDENT1  ;
        BRA            DEFAULT ;MUST BE ID 0.
IDENT1  LDAA           FCTB3   ;GET ID BITS.
        ANDA          #$FC     ;CLEAR ID BITS.
        STAA           FCTB3   ;PUT IT BACK.
        LDX           #MYCALL1 ;POINT TO MORSE CODE.(MUST END WITH FFH)
GO_ID1  INX                    ;
        STX            SAVEXM  ;SAVE IT.
        LDAA             0,X   ;GET FIRST CHAR.
        CMPA          #EOT     ;LAST CHAR. SENT?
        BEQ            IDONE   ;
        JSR            CONVASC ;CONVERT ASCII TO HEX.
        LDX            SAVEXM  ;GET X BACK.
        BRA            GO_ID1  ;
DEFAULT LDX           #MYCALL  ;POINT TO MORSE CODE.(MUST END WITH FFH)
GO_ID0  INX                    ;
        STX            SAVEXM  ;SAVE IT.
        LDAA             0,X   ;GET FIRST CHAR.
        CMPA          #EOT     ;LAST CHAR. SENT?
        BEQ            IDONE1  ;
        JSR            CONVASC ;CONVERT ASCII TO HEX.
        LDX            SAVEXM  ;GET X BACK.
        BRA            GO_ID0  ;
IDONE1  LDAA           FCTB3   ;GET ID BITS.
        INCA                   ;INCREMENT PLUS ONE.
        STAA           FCTB3   ;PUT IT BACK.(MAKES IT LONG ID EVERY 4TH)
IDONE   LDX            M10INT  ;INIT NEXT ID TIME.
        STX            IDTEN   ;
        LDAA           FLAGS0  ;RESET ID FLAG.
        ANDA          #$F7     ;
        STAA           FLAGS0  ;
        RTS                    ;
RESTORE LDAB           FCTB2   ;LOOK FOR MUTE ON.
        ANDB          #MUTEON  ;
        BEQ            RSTORE1 ;
        LDAB           DATAOUT ;TURN OFF XMIT FOR MUTE.
        ANDB          #$EF     ;REMOVE TX_BIT.
        STAB           DATAOUT ;
        LDAB          #MUTM    ;
        STAB           MUTECNT ;INIT MUTE COUNTER.
        LDAB           FLAGS0  ;SET MUTE FLAG BIT.
        ORAB          #MUTEFLG ;
        STAB           FLAGS0  ;
RSTORE1 CLR            DCTR    ;
        LDAB           FCTB5   ;SETUP REMOTE RESPONCE BYTE.
        STAB           RRBYTE  ;
        LDAB           FLAGS0  ;SET RMT RESPONSE FLAG.
        ORAB          #RRFLAG  ;
        STAB           FLAGS0  ;
        RTI                    ;
CLRMEM  LDX           #$0038   ;GET READY TO CLEAR LOW MEMORY.
        LDAA          #$00     ;PUT ZEROS IN A-REG.
CLRLOOP STAA             0,X   ;PUT AWAY PER X-REG.
        DEX                    ;-1 FROM X-REG.
        BNE            CLRLOOP ;IF NOT DONE DO AGAIN.
        STAA             0,X   ;CLEAR ADDRESS ZERO BEFORE RETURN.
        RTS                    ;RETURN.
*
CLRMUTE LDAA          #MUTEFLG ;CLEAR MUTE FLAG.
        ORAA          #TXFLG   ;AND TXFLG.
        COMA                   ;
        ANDA           FLAGS0  ;
        STAA           FLAGS0  ;
        JSR            TXON    ;
        RTS                    ;
EPROM   LDAA           FLAGS0  ;CHK FOR MUTE OR IDENT FLAG.
        ANDA           MUTEFLG ;IF ON HOLD OFF EPROM DATE SEND.
        BNE            M_OR_I  ;
        LDAA           FLAGS0  ;
        ANDA           IDFLG   ;
        BNE            M_OR_I  ;
        JSR            TXON    ;
        JSR            DELONE  ;
        LDX           #DATE    ;
EPROM1  LDAA             0,X   ;GET FIRST CHAR.
        INX                    ;INCREMENT INDEX.
        STX            SAVEXM  ;SAVE IT.
        CMPA          #EOT     ;LAST CHAR. SENT?
        BEQ            IDONE2  ;
        JSR            CONVASC ;CONVERT ASCII TO HEX.
        LDX            SAVEXM  ;GET X BACK.
        BRA            EPROM1  ;
IDONE2  JSR            DELONE  ;
        JSR            TXOFF   ;
        LDAA           FCTB3   ;CLEAR SEND EPROM DATE BIT.
        ANDA          #$BF     ;
        STAA           FCTB3   ;
M_OR_I RTS                    ;
*
RESPOND LDAB           FCTB3   ;GET 3RD FUNCTION BYTE.
        ANDB          #RESPBIT ;IS RESPONSE ALLOWED.
        BEQ            QUIET1  ;IF NO THEN EXIT.
        LDAB           FLAGS0  ;GET FLAG0 BYTE.
        ANDB          #MUTEFLG ;CHK FOR MUTE FLAG.
        BNE            QUIET   ;
        BRA            CODE    ;
QUIET1  CLR            FCCTR   ;CLEAR FUNCTION COMPLETE COUNTER.
QUIET   RTS                    ;
*
CODE    LDAA           DATAIN  ;CHECK FOR RPTR COS.
        ANDA          #COR_BIT ;IF ON DON'T RESPOND.
        BEQ            QUIET   ;
        LDAA           DATAIN  ;CHECK FOR RPTR PL.
        ANDA          #PL_BIT   ;IF ON DON'T RESPOND.
        BEQ            QUIET   ;
        LDAA           DATAIN  ;CHECK FOR LINK COS.
        ANDA          #LNK_COS ;IF ON DON'T RESPOND.
        BEQ            QUIET   ;
        LDAA           FCTB5   ;GET PATH STATUS BYTE.
        ANDA          #$18      ;CHECK PATH 3 & 4 STATUS.
        BEQ            P34OFF  ;
        LDAA          #FL5     ;TURN ON THE LINK TX.
P34OFF  ORAA          #TX_BIT  ;TURN ON THE RPTR TX.
        ORAA           DATAOUT ;
        STAA           DATAOUT ;
        LDX           #BEEP    ;POINT TO BEEP CODE.
        JSR            SCODE   ;SEND BEEP BEEP.
        JSR            TXOFF   ;TURN OFF TRANSMITTER.
        LDAA           FCTB5   ;GET PATH STATUS BYTE.
        ANDA          #$18     ;CHECK PATH 3 & 4 STATUS.
        BEQ            P34RST  ;
        LDAA          #FL5     ;TURN ON THE LINK TX.
        COMA                   ;
        ANDA           DATAOUT ;
        STAA           DATAOUT ;
P34RST  DEC            FCCTR   ;DECREMENT FUNCTION COUNTER.
        BRA            QUIET   ;
*
* ENTER WITH CHAR. TO CONVERT TO MORSE IN THE A-REG.
*
CONVASC LDX           #ASCII   ;POINT TO CONVERSION TABLE.
LOOP10  CMPA             0,X   ;ASCII TO MORSE.
        BEQ            GOTIT   ;IF MATCH THEN SEND IT.
        INX                    ;POINT TO NEXT IN TABLE.
        BRA            LOOP10  ;LOOK SOMEMORE.
DONE    RTS                    ;
*
GOTIT   CMPA          #EOT     ;IS IT END OF TRANSMISSION?
        BEQ            DONE    ;
        LDAB           $30,X   ;GET MORSW EQUIV. TO ASCII.
        STAB           MSAVE0  ;PUT IT IN MORSE SAVE AREA. AND
        LDAB          #$FF     ;PUT A FF AFTER IT TO END SCODE RTN..
        STAB           MSAVE1  ;
        LDX           #MSAVE0  ;POINT TO CODE FOR SCODE.
        BSR            SCODE   ;
        RTS                     ;
*
ASCII   FCC     "1234567890"    ;UPPER CASE ASCII ONLY.
        FCC     "ABCDEFGHIJ"    ;
        FCC     "KLMNOPQRST"    ;
        FCC     "UVWXYZ/?,. "   ;
        FCB      $FF            ;
*
        ORG     ASCII+$30       ;
*
HEX     FDB      $7C3C          ;MORSE CODE EQUIV.
        FDB      $1C0C
        FDB      $0484
        FDB      $C4E4
        FDB      $F4FC
        FDB      $6088
        FDB      $A890
        FDB      $4028
        FDB      $D008
        FDB      $2078
        FDB      $B048
        FDB      $E0A0
        FDB      $F068
        FDB      $D850
        FDB      $10C0
        FDB      $3018
        FDB      $7098
        FDB      $B8C8
        FDB      $9432
        FDB      $CE56
        FDB      $21FF
*
SCODE   LDAA             0,X   ;GET CODE PER INDEX REG.
        INX                    ;
        STX            XTEMP   ;SAVE POINTER.
        CMPA          #EOT     ;IS IT END OF TRANSMISSION?
        BEQ            ENDIT   ;
        CMPA          #SPACE   ;IS IT A SPACE?
        BEQ            WRDSPC  ;
SHIFT   ASLA                   ;
        PSHA                   ;
        BCC            DITOUT  ;CARRY CLEAR?
        BSR            DAH     ;NO, SEND DAH.
ENDCHAR PULA                   ;
        CMPA          #EOC     ;IS IT END OF CHARACTER.
        BNE            SHIFT   ;
        BSR            UNISP2  ;
        LDX            XTEMP   ;RESTORE POINTER.
        BRA            SCODE   ;
*
DITOUT  BSR            DIT     ;
        BRA            ENDCHAR ;
*
UNITIM  LDAB           UTIME   ;SETS UNIT SPACE OF CODE.
UNITI   DECB                   ;
        BNE            UNITI   ;
        RTS                    ;
*
DIT     LDX           #DTCT    ;SETS LENGTH OF DITS AND DAHS.
        BRA            SAVER   ;
*
DAH     LDX           #3*DTCT  ;
SAVER   STX            TONECT  ;ENTER HERE WITH X=LENGTH OF NOTE &
TONOUT  LDAA           DATAOUT ;UTIME SETS SPEED.
        ORAA          #IDAUDIO ;
        STAA           DATAOUT ;TURN BIT ON.
        BSR            UNITIM  ;
        LDAA           DATAOUT ;
        ANDA          #$7F     ;TURN BIT OFF.
        STAA           DATAOUT ;
        BSR            UNITIM  ;
        LDX            TONECT  ;
        DEX                    ;
        STX            TONECT  ;
        BNE            TONOUT  ;
UNISPC  LDX           #3*DTCT  ;
UNSP    BSR            UNITIM  ;
        DEX                    ;
        BNE            UNSP    ;
        RTS                    ;
*
UNISP2  BSR            UNISPC  ;
        BSR            UNISPC  ;
ENDIT   RTS                    ;RETURN TO CALLER.
*
WRDSPC  BSR            UNISP2  ;
        BSR            UNISP2  ;
        BSR            UNISP2  ;
        LDX            XTEMP   ;
        BRA            SCODE   ;
*                              ;
BEEP1   LDX           #BEEPR1  ;
        BSR            SCODE   ;
        RTS                    ;
*
BEEP3   LDX           #BEEPR3  ;
        BSR            SCODE   ;
        RTS                    ;
*
DEL2    BSR            DELONE  ;
        BSR            DELONE  ;
        RTS                    ;
*
DELONE  LDX           #ONESEC  ;SET FOR 1 SECOND.
DELX    BSR            UNITIM  ;500 USEC.?
        DEX                    ;
        BNE            DELX    ;
        RTS                    ;
*
INITIT  LDX           #M10I    ;MINTEN INIT VALUE
        STX            M10INT  ;
        LDAA          #UTIMI   ;INIT. CODE TONE AT UTIME.
        STAA           UTIME   ;ABOUT 1000 HERTZ.
        LDX           #$001E   ;INIT ID FIRST TIME.
        STX            IDTEN   ;INIT ID COUNTER = 30 SECONDS.
        LDAA          #M3I     ;MIN3 INIT VALUE.
        STAA           M3INT   ;
        LDX           #KCHKI   ;KERCHUNK INIT VALUE.
        STX            KINT    ;
        LDX           #DLYI    ;DELAY COUNTER INIT VALUE.
        STX            DINT    ;
        LDAA          #$FF     ;INIT DIGIT COUNTER.
        STAA           DCTR    ;
        LDAA          #FCT1    ;INIT FCTB1.
        STAA           FCTB1   ;
        LDAA          #FCT2    ;INIT FCTB2.
        STAA           FCTB2   ;
        LDAA          #FCT3    ;INIT FCTB3.
        STAA           FCTB3   ;
        LDAA          #FCT4    ;INIT FCTB4.
        STAA           FCTB4   ;
        LDAA          #FCT5    ;INIT FCTB5.
        STAA           FCTB5   ;
        LDAA          #FCT6    ;INIT FCTB6.
        STAA           FCTB6   ;
        LDAA          #REQINT  ;INIT THE TX REQUEST OFF BYTE.
        STAA           TXREQ   ;
        LDAA          #AUDIO1  ;INIT MIXER 1.
        STAA           MIX1    ;
        LDAA          #AUDIO2  ;INIT MIXER 2.
        STAA           MIX2    ;
        LDAA          #AUDIO3  ;INIT MIXER 3
        STAA           MIX3    ;
        LDAA          #FLGSI   ;FLAGS INIT VALUE.
        STAA           FLAGS0  ;
        RTS
*
LP10    WAI                    ;
        LDX           #$F424   ;INIT INDEX WITH 1/2 SECOND.
LP20    DEX                    ;
        BNE            LP20    ;
        LDX           #$F424   ;
LP30    DEX                    ;
        BNE            LP30    ;
        LDAA           DATAIN   ;GET TOUCHTONE INPUT.
        ANDA          #$0F      ;MASK FOR T.T. DATA.
        CMPA          #$0F      ;IS IT T.T. "C"
        BEQ            TC_OUT   ;IF SO END IT.
        BRA            LP10     ;
TC_OUT  JMP            RESTART  ;
*
TIMERTN LDAA           FCTB1    ;CHK FOR DIAGNOSTIC MODE.
        ANDA          #DIAG     ;
        BEQ            NOSER    ;
        LDAA           FCTB2   ;GO SEE IF TIMER ADJUST ON.
        ANDA          #TIMEADJ ;
        BEQ            TIMEOFF ;
TIMESET STX            $0000   ;ADD ONE TO ADDRESS 0000H
        LDAA           $01     ;
        STAA           DATAOUT ;PUT IN LIGHTS.
        RTI                    ;
NOSER   JMP            NOSER1  ;
*
TIMEOFF LDAA           FCTB4    ;CHK FOR TONE GEN. FUNCTION.
        ANDA          #TSTONE   ;
        BEQ            STST     ;
TTGL1   LDAA           DATAIN   ;GET TOUCHTONE INPUT.
        ANDA          #$0F      ;MASK FOR T.T. DATA.
        CMPA          #$0F      ;IS IT T.T. "C"
        BNE            TTG1     ;IF SO END IT.
        LDAA          #TSTONE   ;RETURN AND LEAVE TONE FREQ. ALONE.
        COMA                    ;
        ANDA           FCTB4    ;
        STAA           FCTB4    ;
        JMP            NMIRETN  ;
TTG1    LDAA           DATAIN   ;GET TOUCHTONE INPUT.
        ANDA          #$0F      ;MASK FOR T.T. DATA.
        CMPA          #$0E      ;IS IT T.T. "B"
        BNE            TTG2     ;IF SO DECREMENT TONE.
        LDAA           UTIME    ;
        ADDA          #$10      ;
        STAA           UTIME    ;
TTG2    LDAA           DATAIN   ;GET TOUCHTONE INPUT.
        ANDA          #$0F      ;MASK FOR T.T. DATA.
        CMPA          #$0D      ;IS IT T.T. "A"
        BNE            STST     ;IF SO INCREMENT TONE.
        LDAA           UTIME    ;
        SUBA          #$10      ;
        STAA           UTIME    ;
*
STST    LDAA           FCTB4   ;CHK FOR SERIAL TEST BIT ON.
        ANDA          #SERTST  ;
        BEQ            SWEP1   ;
        LDAA           DATAIN  ;GET TOUCHTONE DATA.
        ANDA          #$0F     ;
        CMPA          #$0F     ;IF TT "C" THEN ESCAPE.
        BNE            NO_C    ;
        JMP            RESTART ;JUMP TO RESET.
NO_C    LDAA           FLAGS0  ;SET SERIAL REQUEST FLAG.
        ORAA          #SERFLG  ;
        STAA           FLAGS0  ;
SWEP1   LDAA           FCTB4   ;CHK FOR SWEEP TONE.
        ANDA          #SWEEP1  ;
        BEQ            SWEP4   ;
        DEC            UTIME   ;
        BRA            NOSER1  ;
SWEP4   LDAA           FCTB4   ;CHK FOR SWEEP TONE.
        ANDA          #SWEEP4  ;
        BEQ            SWEP8   ;
        DEC            UTIME   ;
        DEC            UTIME   ;
        DEC            UTIME   ;
        DEC            UTIME   ;
        BRA            NOSER1  ;
SWEP8   LDAA           FCTB4   ;CHK FOR SWEEP TONE.
        ANDA          #SWEEP8  ;
        BEQ            NOSER1  ;
        DEC            UTIME   ;
        DEC            UTIME   ;
        DEC            UTIME   ;
        DEC            UTIME   ;
        DEC            UTIME   ;
        DEC            UTIME   ;
        DEC            UTIME   ;
        DEC            UTIME   ;
NOSER1  LDAA           FCTB1   ;SEE IF CHOP FUNCTION ON.
        ANDA          #CHPON
        BEQ            PMTOX   ;IF NOT SKIP ROUTINE.
        LDAA           FLAGS0  ;CHECK CHOPPER TIMER FIRST.
        ANDA          #CHPFLG
        BNE            PMTOX   ;IF FLAG IS ON THEN SKIP IT.
        LDAA           FLAGS0  ;CHECK FOR TX ON.
        ANDA          #TXFLG
        BEQ            PMTOX   ;IF TX IS OFF THEN DONT DECREMENT.
        DEC            MIN3
        BEQ            CHPIT
        BRA            PMTOX
CHPIT   LDAA           FLAGS0
        ORAA          #CHPFLG
        STAA           FLAGS0
PMTOX   LDAA           FCTB1   ;IF FAILSAFE ON DECR. TIMER.
        ANDA          #FSON
        BEQ            PLMRST
        DEC            PMTO16  ;DECREMENT AND TEST PMTO. VALUE
        BNE            PLMRST  ;IS SET IN C_LOOP.
        JMP            FORCE   ;FORCE REPEATER OFF.
*
PLMRST  LDX            ARPLMS  ;VALUE IS SET AT KDONE ROUTINE.
        DEX                    ;IF ZERO THEN SET PL MODE, CONTROLLER-
        STX            ARPLMS  ;LOCKED AND AUTO REPEATER OFF IF WANTED.
        BNE            RSTMUTE ;
        LDAA           FCTB3   ;CHECK FOR AUTO LOCKUP BIT.
        ANDA          #AUTOL   ;
        BEQ            CKARF   ;
        LDAA           FCTB1   ;SET CONTROLLER LOCKED BIT.
        ORAA          #CTRLK   ;
        STAA           FCTB1   ;
CKARF   LDAA           FCTB4   ;CHECK FOR AUTO REPEATER OFF BIT.
        ANDA          #AROFF   ;
        BEQ            RPLM    ;
        LDAA           FCTB1   ;TURN OFF REPEATER.
        ANDA          #$BF     ;
        STAA           FCTB1   ;
RPLM    LDAA           FCTB2   ;CHECK FOR AUTO RESTORE PL MODE.
        ANDA          #REST_PL ;
        BEQ            RSTMUTE ;
        LDAA           FCTB1   ;RESTORE PL MODE.
        ORAA          #PLON    ;
        STAA           FCTB1   ;
RSTMUTE LDAA           FLAGS0  ;CHK FOR MUTE FLAG ON.
        ANDA          #MUTEFLG ;
        BEQ            IDCNTR  ;
        LDAA           MUTECNT ;
        BEQ            IDCNTR  ;
        DEC            MUTECNT ;VALUE IS SET IN IRQ RTN.
        BNE            IDCNTR  ;
        JSR            CLRMUTE ;RESET MUTE FLAG BIT.
IDCNTR  LDAA           FCTB3   ;CHECK IF AUTOMATIC IDENT ON.
        ANDA          #AUTOID  ;
        BEQ            NMIRETN ;
        LDAA           FLAGS0  ;CHECK ID TIMER.
        ANDA          #IDFLG   ;
        BNE            NMIRETN ;
        LDX            IDTEN   ;
        DEX                    ;
        BEQ            IDSET   ;
        STX            IDTEN   ;
        BRA            NMIRETN ;
IDSET   LDAA           FLAGS0  ;
        ORAA          #IDFLG   ;
        STAA           FLAGS0  ;
NMIRETN RTI                    ;
*
FORCE   LDAA          #$00     ;GO HERE IF FORCE OFF.
        STAA           DATAOUT ;CLEAR OUTPUTS.
        CLI                    ;CLEAR IRQ MASK.
        WAI                    ;WAIT HERE
        BRA            FORCE   ;
*
PCODE   FCB     $68
        FCB     EOT
*                             *
BEEP    FCB     SPACE
        FCB     $40
        FCB     $40
        FCB     EOT
BEEPR1  FCB     SPACE
        FCB     $40
        FCB     EOT
BEEPR3  FCB     SPACE
        FCB     $40
        FCB     SPACE
        FCB     $40
        FCB     SPACE
        FCB     $40
        FCB     EOT
*
ALLTOFF LDAA           FCTB1   ;GET FUNCTION BYTE ONE.
        ANDA          #$CF     ;REMOVE CHOPPER & FAILSAFE.
        STAA           FCTB1   ;PUT IT BACK.
        LDAA           FCTB3   ;GET RESET BEEP AND TURN OFF.
        ANDA          #$FB     ;
        STAA           FCTB3   ;
        BRA            RTN4    ;EXIT VIA IRQ ROUTINE.
*                              ;
ALLTON  LDAA          #$30     ;TURN TIMERS ON.
        ORAA           FCTB1   ;
        STAA           FCTB1   ;
        LDAA          #$04     ;
        ORAA           FCTB3   ;
        STAA           FCTB3   ;
        BRA            RTN4    ;
*
ID_UP   INC            UTIME   ;
*       JSR            IDENT   ;
        BRA            RTN4    ;
ID_DWN  DEC            UTIME   ;
*       JSR            IDENT   ;
        BRA            RTN4    ;
RTN4    JMP            RESTORE ;
*
IMC     LDX            M10INT  ;SETUP INX AND B-REG FIRST.
        LDAB          #$3C     ;INCR COUNTER BY 1 MINUTE.
        BSR            PXAGN   ;
        STX            M10INT  ;
        BRA            RTN3    ;
*                              ;
ICT     LDAA           M3INT   ;INCR CHOPPER BY 30 SECONDS.
        BSR            PLUSA   ;
        STAA           M3INT   ;
        BRA            RTN3    ;
*
IKF     LDAA           KINT    ;.075 SECONDS FOR EACH 10 HEX.
        LDAB          #$10     ;GET HIGH ORDER BYTE OF KERCHUNK FILTER.
        ABA                    ;ADD 10 HEX FROM IT.
        STAA           KINT    ;PUT IT BACK.
        BRA            RTN3    ;
*
IDC     LDAA           DINT    ;DROP DELAY (ADJUST MINUS .167 SEC.)
        LDAB          #$10     ;
        ABA                    ;ADD 10 HEX FROM A-REG.
        STAA           DINT    ;PUT IT BACK.
        BRA            RTN3    ;
*
IIC     LDX            IDTEN   ;SETUP INX AND B-REG FIRST.
        LDAB          #$3C     ;INCR COUNTER BY 1 MINUTE.
        BSR            PXAGN   ;
        STX            IDTEN   ;
        BRA            RTN3    ;
*
PLUSX   LDAB          #$00     ;
PXAGN   INX                    ;INCR INDEX REG.
        DECB                   ;DECR B-REG.
        BNE            PXAGN   ;
        RTS                    ;
*
PLUSA   LDAB          #$1E     ;DECIMAL 30.
APLUS   INCA                   ;
        DECB                   ;
        BNE            APLUS   ;
        RTS                    ;
*
DMC     LDX            M10INT  ;SETUP INX AND B-REG FIRST.
        LDAB          #$3C     ;DECR COUNTER BY 1 MINUTE.
        BSR            MXAGN   ;
        STX            M10INT  ;
        BRA            RTN3    ;
*
DCT     LDAA           M3INT   ;DECR CHOPPER BY 30 SECONDS.
        BSR            SUB_A   ;
        STAA           M3INT   ;
        BRA            RTN3    ;
*
DKF     LDAA           KINT    ;.075 SECONDS FOR EACH 10 HEX.
        LDAB          #$10     ;GET HIGH ORDER BYTE OF KERCHUNK FILTER.
        SBA                    ;SUBTRACT 10 HEX FROM IT.
        STAA           KINT    ;PUT IT BACK.
        BRA            RTN3    ;
*
DDC     LDAA           DINT    ;DROP DELAY (ADJUST MINUS .167 SEC.)
        LDAB          #$10     ;
        SBA                    ;SUBTRACT 10 HEX FROM A-REG.
        STAA           DINT    ;PUT IT BACK.
        BRA            RTN3    ;
*
DIC     LDX            IDTEN   ;SETUP INX AND B-REG FIRST.
        LDAB          #$3C     ;DECR COUNTER BY 1 MINUTE.
        BSR            MXAGN   ;
        STX            IDTEN   ;
        BRA            RTN3    ;
SUBX    LDAB          #$00     ;
MXAGN   DEX                    ;
        DECB                   ;
        BNE            MXAGN   ;
        RTS                    ;
SUB_A   LDAB          #$1E     ;30 DECIMAL.
MINUSA  DECA                   ;
        DECB                   ;
        BNE            MINUSA  ;
        RTS                    ;
*
RTN3    JMP            RESTORE ;
*
SVMORSE STX            MSAVE   ;SAVE POINTER FOR MORSE.
        LDAA           FLAGS0  ;SET MORSE FLAG.
        ORAA          #MORSE   ;
        STAA           FLAGS0  ;
        RTS
*
RTN2    JMP            RESTORE ;
*
SF1     LDAA          #FL1     ;
        BRA            SETREG  ;
SF2     LDAA          #FL2     ;
        BRA            SETREG  ;
SF3     LDAA          #FL3     ;
        BRA            SETREG  ;
SF4     LDAA          #FL4     ;
        BRA            SETREG  ;
SF5     LDAA          #FL5     ;
        BRA            SETREG  ;
SF6     LDAA          #FL6     ;
SETREG  BSR            SETR1   ;
        BRA            RTN2    ;
SETR1   ORAA           DATAOUT ;
        STAA           DATAOUT ;
        RTS                    ;
RF1     LDAA          #FL1     ;
        COMA                   ;
        BRA            RSTREG  ;
RF2     LDAA          #FL2     ;
        COMA                   ;
        BRA            RSTREG  ;
RF3     LDAA          #FL3     ;
        COMA                   ;
        BRA            RSTREG  ;
RF4     LDAA          #FL4     ;
        COMA                   ;
        BRA            RSTREG  ;
RF5     LDAA          #FL5     ;
        COMA                   ;
        BRA            RSTREG  ;
RF6     LDAA          #FL6     ;
        COMA                   ;
RSTREG  BSR            RSTR1   ;
        BRA            RTN2    ;
RSTR1   ANDA           DATAOUT ;
        STAA           DATAOUT ;
        RTS                    ;
*************ENABLES AUDIO MIXER PATHES*******************************
P0M1C1E LDAA           MIX1    ;GET MIXER BYTE 1.
        ORAA          #M1C1    ;SET CHAN 1 ON.
        ORAA          #M1C4    ;SET CHAN 4 ON.
        BRA            SMX1    ;
P1M1C2E LDAA           MIX1    ;GET MIXER BYTE 1.
        ORAA          #M1C2    ;SET CHAN 2 ON.
        ORAA          #M1C4    ;SET CHAN 4 ON.
        BRA            SMX1    ;
P2M1C3E LDAA           MIX1    ;GET MIXER BYTE 1.
        ORAA          #M1C3    ;SET CHAN 3 ON.
        ORAA          #M1C4    ;SET CHAN 4 ON.
SMX1    STAA           MIX1    ;PUT IT BACK.
        BRA            SSDBIT  ;
*
P3M2C1E LDAA           MIX2    ;GET MIXER BYTE 2.
        ORAA          #M2C1    ;SET CHAN 1 ON.
        ORAA          #M2C4    ;SET CHAN 4 ON.
        BRA            SMX2    ;
P4M2C3E LDAA           MIX2    ;GET MIXER BYTE 2.
        ORAA          #M2C3    ;SET CHAN 3 ON.
        ORAA          #M2C4    ;SET CHAN 4 ON.
SMX2    STAA           MIX2    ;PUT IT BACK.
        BRA            SSDBIT  ;
*
P5M3C1E LDAA           MIX3    ;GET MIXER BYTE 3.
        ORAA          #M3C1    ;SET CHAN 1 ON.
        BRA            SMX3    ;
P6M3C2E LDAA           MIX3    ;GET MIXER BYTE 3.
        ORAA          #M3C2    ;SET CHAN 2 ON.
SMX3    STAA           MIX3    ;PUT IT BACK.
        BRA            SSDBIT  ;
*
*************SETS SERIAL REQUEST FLAG*********************************
SSDBIT  LDAA            FLAGS0  ;SET SERIAL DATA REQUEST FLAG BIT.
        ORAA           #SERFLG  ;
        STAA            FLAGS0  ;
        RTS
*************DISABLE AUDIO MIXER PATHES*******************************
P0M1C1D LDAA          #M1C1    ;GET MIXER BYTE 1.
        COMA                   ;
        ANDA           MIX1    ;RESET CHAN 1.
        BRA            RMX1    ;
P1M1C2D LDAA          #M1C2    ;GET MIXER BYTE 1.
        COMA                   ;
        ANDA           MIX1    ;RESET CHAN 2.
        BRA            RMX1    ;
P2M1C3D LDAA          #M1C3    ;GET MIXER BYTE 1.
        COMA
        ANDA           MIX1    ;RESET CHAN 3.
RMX1    STAA           MIX1    ;PUT IT BACK.
        BRA            SSDBIT  ;
*
P3M2C1D LDAA          #M2C1    ;GET MIXER BYTE 2.
        ORAA          #M2C4    ;RESET CHAN 1 & 4.
        COMA                   ;
        ANDA           MIX2    ;RESET CHAN 1.
        BRA            RMX2    ;
P4M2C3D LDAA          #M2C3    ;GET MIXER BYTE 2.
        ORAA          #M2C4    ;RESET CHAN 3 & 4.
        COMA                   ;
        ANDA           MIX2    ;RESET CHAN 3.
RMX2    STAA           MIX2    ;PUT IT BACK.
        BRA            SSDBIT  ;
*
P5M3C1D LDAA          #M3C1    ;GET MIXER BYTE 3.
        COMA                   ;
        ANDA           MIX3    ;RESET CHAN 1.
        BRA            RMX3    ;
P6M3C2D LDAA          #M3C2    ;GET MIXER BYTE 3.
        COMA                   ;
        ANDA           MIX3    ;RESET CHAN 2.
RMX3    STAA           MIX3    ;PUT IT BACK.
        BRA            SSDBIT  ;
*
*****************THIS GROUP SETS BITS IN FCTB4******************
SAROFF  LDAA          #AROFF   ;SET AUTO REPEATER OFF.
        BRA            SFCTB4  ;
SDBL    LDAA          #DBLLK   ;SET DOUBLE LOCKED.
        BRA            SFCTB4  ;
SSTST   LDAA          #SERTST  ;SET SERIAL TEST BIT.
        BRA            SFCTB4  ;
TTGEN   LDAA          #TSTONE  ;SET TONE GENERATE FUNCTION.
        BRA            SFCTB4  ;
SWEEPR1 LDAA          #SWEEP1  ;SET SWEEP TONE GENERATE FUNCTION.
        BRA            SFCTB4  ;
SWEEPR4 LDAA          #SWEEP4  ;SET SWEEP TONE GENERATE FUNCTION.
        BRA            SFCTB4  ;
SWEEPR8 LDAA          #SWEEP8  ;SET SWEEP TONE GENERATE FUNCTION.
SFCTB4  ORAA           FCTB4   ;
        STAA           FCTB4   ;
        JMP            RESTORE ;
*****************THIS GROUP RESETS BITS IN FCTB4****************
RSTST   LDAA           FCTB4   ;RESET SERIAL TEST BIT.
        ANDA          #$EF     ;
        BRA            RFCTB4  ;
RAROFF  LDAA           FCTB4   ;RESET AUTO REPEATER OFF.
        ANDA          #$7F     ;
        BRA            RFCTB4  ;
RSDBL   LDAA           FCTB4   ;RESET DOUBLE LOCKED.
        ANDA          #$BF     ;
RFCTB4  STAA           FCTB4   ;
RTN5    JMP            RESTORE ;
*****************THIS GROUP SETS BITS IN FCTB3******************
RSTBON  LDAA          #BEP_ON  ;SET RESET BEEP ON BIT.
        BRA            SFCTB3  ;
SALOCK  LDAA          #$08     ;
        BRA            SFCTB3  ;
ID_ON   LDAA          #AUTOID  ;
        BRA            SFCTB3  ;TURN ON IDENTIFIER.
RSPON   LDAA          #$80     ;
        BRA            SFCTB3  ;
SROM    LDAA          #$40     ;
        BRA            SFCTB3  ;
F_ID0   LDAA           FCTB3   ;
        ANDA          #$FC     ;STRIP OUT 2 LOW ORDER ID BITS.
        ORAA          #$20      ;'OR' FORCE ID BIT.
        STAA           FCTB3   ;PUT IT BACK.
        BRA            RTN5    ;
F_ID1   LDAA           FCTB3   ;
        ANDA          #$FC     ;STRIP OUT 2 LOW ORDER ID BITS.
        ORAA          #$23     ;'OR' FORCE ID BIT AND ID1,ID2.
        STAA           FCTB3   ;PUT IT BACK.
        BRA            RTN5    ;
SFCTB3  ORAA           FCTB3   ;
        STAA           FCTB3   ;
        BRA            RTN5    ;
*****************THIS GROUP RESETS BITS IN FCTB3****************
RSTBOFF LDAA           FCTB3   ;RESET BEEP BIT OFF.
        ANDA          #$FB     ;
        BRA            RFCTB3  ;
ID_OFF  LDAA           FCTB3   ;TURN OFF IDENTIFIER.
        ANDA          #$EF     ;
        BRA            RFCTB3  ;
RALOCK  LDAA           FCTB3   ;RESET AUTO-RESTORE PL MODE.
        ANDA          #$F7     ;
        BRA            RFCTB3  ;
RSPOFF  LDAA           FCTB3   ;RESPONSE OFF.
        ANDA          #$7F     ;
RFCTB3  STAA           FCTB3   ;
        JMP            RESTORE ;
******************THIS GROUP SETS BITS IN FCTB5******************
EP1     JSR            P1M1C2E ;TURN ON M1C2. (LINK->RPTR)
        LDX           #P1ON    ;
        JSR            SVMORSE ;
        LDAA          #PATH1   ;ENABLE PATH1.
        BRA            SFCTB5  ;
EP2     JSR            P2M1C3E ;TURN ON M1C3. (RMT->RPTR)
        LDX           #P2ON    ;
        JSR            SVMORSE ;
        LDAA          #PATH2   ;ENABLE PATH2.
        BRA            SFCTB5  ;
EP3     JSR            P3M2C1E ;TURN ON M2C1. (RPTR->LINK)
        LDX           #P3ON    ;
        JSR            SVMORSE ;
        LDAA          #PATH3   ;ENABLE PATH3.
        BRA            SFCTB5  ;
EP4     JSR            P4M2C3E ;TURN ON M2C3. (RMT->LINK)
        LDX           #P4ON    ;
        JSR            SVMORSE ;
        LDAA          #PATH4   ;ENABLE PATH4.
        BRA            SFCTB5  ;
EP5     JSR            P5M3C1E ;TURN ON M3C1. (RPTR->RMT)
        LDX           #P5ON    ;
        JSR            SVMORSE ;
        LDAA          #PATH5   ;ENABLE PATH5.
        BRA            SFCTB5  ;
EP6     JSR            P6M3C2E ;TURN ON M3C2. (LINK->RMT)
        LDX           #P6ON    ;
        JSR            SVMORSE ;
        LDAA          #PATH6   ;ENABLE PATH6.
SFCTB5  ORAA           FCTB5   ;
        STAA           FCTB5   ;
        LDAA           FCTB1   ;TURN OFF TIMERS AND DELAYS AND BEEP.
        ANDA          #$C9     ;
        STAA           FCTB1   ;
        LDAA           FCTB2   ;
        ANDA          #$FD     ;
        STAA           FCTB2   ;
        JMP            RESTORE ;
*****************THIS GROUP RESETS BITS IN FCTB5*****************
DP1     JSR            P1M1C2D ;TURN OFF M1C2.(LINK->RPTR)
        LDX           #P1OFF   ;
        JSR            SVMORSE ;
        LDAA           TXREQ   ;REQ.TURN OFF TRANSISTOR T5.
        ORAA          #RPT_TX  ;
        STAA           TXREQ   ;
        LDAA           FCTB5   ;
        ANDA          #$BF     ;
        BRA            RFCTB5  ;
DP2     JSR            P2M1C3D ;TURN OFF M1C3.(RMT->RPTR)
        LDX           #P2OFF   ;
        JSR            SVMORSE ;
        LDAA           TXREQ   ;REQ.TURN OFF TRANSISTOR T5.
        ORAA          #RPT_TX  ;
        STAA           TXREQ   ;
        LDAA           FCTB5   ;
        ANDA          #$DF     ;
        BRA            RFCTB5  ;
DP3     JSR            P3M2C1D ;TURN OFF M2C1.(RPTR->LINK)
        LDX           #P3OFF   ;
        JSR            SVMORSE ;
        LDAA           TXREQ   ;REQ.TURN OFF TRANSISTOR T2.
        ORAA          #LNK_TX  ;
        STAA           TXREQ   ;
        LDAA           FCTB5   ;
        ANDA          #$EF     ;
        BRA            RFCTB5  ;
DP4     JSR            P4M2C3D ;TURN OFF M2C3.(RMT->LINK)
        LDX           #P4OFF   ;
        JSR            SVMORSE ;
        LDAA           TXREQ   ;REQ.TURN OFF TRANSISTOR T2.
        ORAA          #LNK_TX  ;
        STAA           TXREQ   ;
        LDAA           FCTB5   ;
        ANDA          #$F7     ;
        BRA            RFCTB5  ;
DP5     JSR            P5M3C1D ;TURN OFF M3C1.(RPTR->RMT)
        LDX           #P5OFF   ;
        JSR            SVMORSE ;
        LDAA           TXREQ   ;REQ.TURN OFF TRANSISTOR T1.
        ORAA          #RMT_TX  ;
        STAA           TXREQ   ;
        LDAA           FCTB5   ;
        ANDA          #$FB     ;
        BRA            RFCTB5  ;
DP6     JSR            P6M3C2D ;TURN OFF M3C2.(LINK->RMT)
        LDX           #P6OFF   ;
        JSR            SVMORSE ;
        LDAA           TXREQ   ;REQ.TURN OFF TRANSISTOR T1.
        ORAA          #RMT_TX  ;
        STAA           TXREQ   ;
        LDAA           FCTB5   ;
        ANDA          #$FD     ;
RFCTB5  STAA           FCTB5   ;
        LDAA           FCTB1   ;TURN ON TIMERS AND DELAYS AND BEEP.
        ORAA          #$36     ;
        STAA           FCTB1   ;
        LDAA           FCTB2   ;
        ORAA          #$02     ;
        STAA           FCTB2   ;
        JMP            RESTORE ;
******************THIS GROUP SETS BITS IN FCTB1******************
DIAGON  LDAA          #DIAG    ;SET DIAGNOST MODE BIT.
        BRA            SFCTB1  ;
DON     LDAA          #DROPON  ;
        BRA            SFCTB1  ;
CHON    LDAA          #CHPON   ;
        BRA            SFCTB1  ;
PLMON   LDAA          #PLON    ;
        BRA            SFCTB1  ;
SFSON   LDAA          #FSON    ;
        BRA            SFCTB1  ;
LOCK    LDAA          #CTRLK   ;
        BRA            SFCTB1  ;
RPTRON  LDAA           FCTB5   ;TURN ON PATH0 BIT IN FCTB5.
        ORAA          #PATH0   ;
        STAA           FCTB5   ;
        JSR            P0M1C1E ;TURN ON M1C1.
        LDAA          #RPT_ON  ;
        BRA            SFCTB1  ;
KON     LDAA          #KFLTON  ;
SFCTB1  ORAA           FCTB1   ;
        STAA           FCTB1   ;
        BRA            RETURN1 ;
*****************THIS GROUP RESETS BITS IN FCTB1*****************
DOFF    LDAA           FCTB1   ;
        ANDA          #$FD     ;
        BRA            RFCTB1  ;
CHOFF   LDAA           FCTB1   ;
        ANDA          #$DF     ;
        BRA            RFCTB1  ;
CORMODE LDAA           FCTB1   ;
        ANDA          #$FE     ;
        BRA            RFCTB1  ;
RFSON   LDAA           FCTB1   ;
        ANDA          #$EF     ;
        BRA            RFCTB1  ;
RPTOFF  LDAA           FCTB5   ;TURN OFF PATH0 BIT IN FCTB5.
        ANDA          #$7F     ;
        STAA           FCTB5   ;
        JSR            P0M1C1D ;TURN OFF M1C1.
        LDAA           TXREQ   ;REQ.TURN OFF T5.
        ORAA          #RPT_TX  ;
        STAA           TXREQ   ;
        LDAA           FLAGS0  ;RESET TX FLAG AND CHOP FLAG.
        ANDA          #$5F     ;
        STAA           FLAGS0  ;
        LDAA           FCTB1   ;
        ANDA          #$BF     ;
        BRA            RFCTB1  ;
KOFF    LDAA           FCTB1   ;
        ANDA          #$FB     ;
        BRA            RFCTB1  ;
DIAGOFF LDAA           FCTB1   ;
        ANDA          #$F7     ;
        BRA            RFCTB1  ;
UNLCK   LDAA           FCTB1   ;
        ANDA          #$7F     ;
RFCTB1  STAA           FCTB1   ;
RETURN1 JMP            RESTORE ;
*******************************************************************
FRCRST  JMP            RESTART ;
**********************SET BITS IN FCTB2****************************
NPR     LDAA          #NPLREQ  ;
        ORAA           FCTB2   ;
        STAA           FCTB2   ;
        BRA            RETURN1 ;
ARP     LDAA          #REST_PL ;SET AUTO RESTORE PL MODE.
        ORAA           FCTB2   ;
        STAA           FCTB2   ;
        BRA            RETURN1 ;
MON     LDAA          #MUTEON  ;SET MUTE FUNCT. ON.
        ORAA           FCTB2   ;
        STAA           FCTB2   ;
        BRA            RETURN1 ;
ADJ_ON  LDAA          #TIMEADJ ;SET TIME ADJUST FUNCTION
        ORAA           FCTB2   ;
        STAA           FCTB2   ;
        JMP            LP10    ;
*********************RESET BITS IN FCTB2***************************
PR      LDAA           FCTB2   ;
        ANDA          #$FE     ;
        STAA           FCTB2   ;
        BRA            RETURN1 ;
PORRST  LDAA           FCTB2   ;
        ANDA          #$7F     ;
        STAA           FCTB2   ;
        BRA            RETURN1 ;
MOFF    LDAA           FCTB2   ;
        ANDA          #$BF     ;
        STAA           FCTB2   ;
        BRA            RETURN1 ;
RARP    LDAA           FCTB2   ;
        ANDA          #$EF     ;
        STAA           FCTB2   ;
        BRA            RETURN1 ;
TROCD   LDAA           FCTB2   ;
        ORAA          #$02     ;
        BRA            SFCTB2  ;
RTON1   LDAA          #RTON    ;GET REMOTE TELEMETRY BIT.
        ORAA           FCTB2   ;GET FUNCTION BYTE TWO.
        BRA            SFCTB2  ;GO SET BIT.
USERA   LDAA           FCTB2   ;SET UFA.
        ORAA          #$04     ;
SFCTB2  STAA           FCTB2   ;
        BRA            RETURN1 ;
TROTD   LDAA           FCTB2   ;
        ANDA          #$FD     ;
        BRA            RFCTB2  ;
RTOFF   LDAA           FCTB2   ;TURN OF REMOTE TELEMETRY.
        ANDA          #$F7     ;
        BRA            RFCTB2  ;
USERNA  LDAA           FCTB2   ;
        ANDA          #$FB     ;
RFCTB2  STAA           FCTB2   ;
        BRA            RETURN1 ;
*
RNM     JSR            INITIT  ;GO INIT EVERYTHING BUT DO NOT
        STAA           FLAGS0  ;SET THE POWER FAILURE BIT.
        LDAA           FCTB2   ;RESTORE POR STATE EXCEPT "P".
        ANDA          #$7F     ;TURN OFF 'P' FOR POR.
        STAA           FCTB2   ;PUT IT BACK.
        JMP            RESTORE ;
*
TOM1C8  LDAA          #$80     ;TURN ON MIXER CHAN 8.
        BRA            SMC1    ;
TOM1C7  LDAA          #$40     ;TURN ON MIXER CHAN 7.
        BRA            SMC1    ;
TOM1C6  LDAA          #$20     ;TURN ON MIXER CHAN 6.
        BRA            SMC1    ;
TOM1C5  LDAA          #$10     ;TURN ON MIXER CHAN 5.
        BRA            SMC1    ;
TOM1C4  LDAA          #$08     ;TURN ON MIXER CHAN 4.
        BRA            SMC1    ;
TOM1C3  LDAA          #$04     ;TURN ON MIXER CHAN 3.
        BRA            SMC1    ;
TOM1C2  LDAA          #$02     ;TURN ON MIXER CHAN 2.
        BRA            SMC1    ;
TOM1C1  LDAA          #$01     ;TURN ON MIXER CHAN 1.
SMC1    ORAA           MIX1    ;
        STAA           MIX1    ;
        JMP            SETIT   ;
*
TOFM1C8 LDAA           MIX1    ;TURN OFF MIXER 1 CHAN 8.
        ANDA          #$7F     ;
        BRA            RMC1    ;
TOFM1C7 LDAA           MIX1    ;TURN OFF MIXER 1 CHAN 7.
        ANDA          #$BF    ;
        BRA            RMC1    ;
TOFM1C6 LDAA           MIX1    ;TURN OFF MIXER 1 CHAN 6.
        ANDA          #$DF    ;
        BRA            RMC1    ;
TOFM1C5 LDAA           MIX1    ;TURN OFF MIXER 1 CHAN 5.
        ANDA          #$EF    ;
        BRA            RMC1    ;
TOFM1C4 LDAA           MIX1    ;TURN OFF MIXER 1 CHAN 4.
        ANDA          #$F7    ;
        BRA            RMC1    ;
TOFM1C3 LDAA           MIX1    ;TURN OFF MIXER 1 CHAN 3.
        ANDA          #$FB    ;
        BRA            RMC1    ;
TOFM1C2 LDAA           MIX1    ;TURN OFF MIXER 1 CHAN 2.
        ANDA          #$FD    ;
        BRA            RMC1    ;
TOFM1C1 LDAA           MIX1    ;TURN OFF MIXER 1 CHAN 1.
        ANDA          #$FE    ;
RMC1    STAA           MIX1    ;
        JMP            SETIT   ;
*
TOM2C8  LDAA          #$80     ;TURN ON MIXER 2 CHAN 8.
        BRA            SMIX2   ;
TOM2C7  LDAA          #$40     ;TURN ON MIXER 2 CHAN 7.
        BRA            SMIX2   ;
TOM2C6  LDAA          #$20     ;TURN ON MIXER 2 CHAN 6.
        BRA            SMIX2   ;
TOM2C5  LDAA          #$10     ;TURN ON MIXER 2 CHAN 5.
        BRA            SMIX2   ;
TOM2C4  LDAA          #$08     ;TURN ON MIXER 2 CHAN 4.
        BRA            SMIX2   ;
TOM2C3  LDAA          #$04     ;TURN ON MIXER 2 CHAN 3.
        BRA            SMIX2   ;
TOM2C2  LDAA          #$02     ;TURN ON MIXER 2 CHAN 2.
        BRA            SMIX2   ;
TOM2C1  LDAA          #$01     ;TURN ON MIXER 2 CHAN 1.
SMIX2   ORAA           MIX2    ;
        STAA           MIX2    ;
        JMP            SETIT   ;
*
TOFM2C8 LDAA           MIX2    ;TURN OFF MIXER 2 CHAN 8.
        ANDA          #$7F     ;
        BRA            RMIX2   ;
TOFM2C7 LDAA           MIX2    ;TURN OFF MIXER 2 CHAN 7.
        ANDA          #$BF    ;
        BRA            RMIX2   ;
TOFM2C6 LDAA           MIX2    ;TURN OFF MIXER 2 CHAN 6.
        ANDA          #$DF    ;
        BRA            RMIX2   ;
TOFM2C5 LDAA           MIX2    ;TURN OFF MIXER 2 CHAN 5.
        ANDA          #$EF    ;
        BRA            RMIX2   ;
TOFM2C4 LDAA           MIX2    ;TURN OFF MIXER 2 CHAN 4.
        ANDA          #$F7    ;
        BRA            RMIX2   ;
TOFM2C3 LDAA           MIX2    ;TURN OFF MIXER 2 CHAN 3.
        ANDA          #$FB    ;
        BRA            RMIX2   ;
TOFM2C2 LDAA           MIX2    ;TURN OFF MIXER 2 CHAN 2.
        ANDA          #$FD    ;
        BRA            RMIX2   ;
TOFM2C1 LDAA           MIX2    ;TURN OFF MIXER 2 CHAN 1.
        ANDA          #$FE    ;
RMIX2   STAA           MIX2    ;
        JMP            SETIT   ;
*
TOM3C8  LDAA          #$80     ;TURN ON MIXER 3 CHAN 8.
        BRA            SMIX3   ;
TOM3C7  LDAA          #$40     ;TURN ON MIXER 3 CHAN 7.
        BRA            SMIX3   ;
TOM3C6  LDAA          #$20     ;TURN ON MIXER 3 CHAN 6.
        BRA            SMIX3   ;
TOM3C5  LDAA          #$10     ;TURN ON MIXER 3 CHAN 5.
        BRA            SMIX3   ;
TOM3C4  LDAA          #$08     ;TURN ON MIXER 3 CHAN 4.
        BRA            SMIX3   ;
TOM3C3  LDAA          #$04     ;TURN ON MIXER 3 CHAN 3.
        BRA            SMIX3   ;
TOM3C2  LDAA          #$02     ;TURN ON MIXER 3 CHAN 2.
        BRA            SMIX3   ;
TOM3C1  LDAA          #$01     ;TURN ON MIXER 3 CHAN 1.
SMIX3   ORAA           MIX3    ;
        STAA           MIX3    ;
        BRA            SETIT   ;
*
TOFM3C8 LDAA           MIX3    ;TURN OFF MIXER 3 CHAN 8.
        ANDA          #$7F     ;
        BRA            RMIX3   ;
TOFM3C7 LDAA           MIX3    ;TURN OFF MIXER 3 CHAN 7.
        ANDA          #$BF    ;
        BRA            RMIX3   ;
TOFM3C6 LDAA           MIX3    ;TURN OFF MIXER 3 CHAN 6.
        ANDA          #$DF    ;
        BRA            RMIX3   ;
TOFM3C5 LDAA           MIX3    ;TURN OFF MIXER 3 CHAN 5.
        ANDA          #$EF    ;
        BRA            RMIX3   ;
TOFM3C4 LDAA           MIX3    ;TURN OFF MIXER 3 CHAN 4.
        ANDA          #$F7    ;
        BRA            RMIX3   ;
TOFM3C3 LDAA           MIX3    ;TURN OFF MIXER 3 CHAN 3.
        ANDA          #$FB    ;
        BRA            RMIX3   ;
TOFM3C2 LDAA           MIX3    ;TURN OFF MIXER 3 CHAN 2.
        ANDA          #$FD    ;
        BRA            RMIX3   ;
TOFM3C1 LDAA           MIX3    ;TURN OFF MIXER 3 CHAN 1.
        ANDA          #$FE    ;
RMIX3   STAA           MIX3    ;
*
SETIT   LDAA          #SERFLG  ;SET SERIAL REQUEST FLAG.
        ORAA           FLAGS0  ;
        STAA           FLAGS0  ;
        JMP            RESTORE ;RETURN FROM IRQ.
*
        ORG     $FFE0          ;
        FCC     "WB6JHQ, 12/01/08" ;
*
        ORG     $FFF8           ;
*
MI      FDB     IRQ             ;
SWI     FDB     RESTART         ;
NMI     FDB     TIMERTN         ;
RESET   FDB     RESTART         ;
*
        ORG     $FFF0
*
FILL2   FDB     $FFFF,$FFFF,$FFFF,$FFFF
        END
