* NAM A/BASIC FLEX2 V3.0
* OPT SYM,NOG,LIS,PAG
*   ORIGINALLY DISASSEMBLED AND PARTIALLY COMMENTED BY
* NEIL CHERRY, 2024.  EDITS FOR THE HM-68 HOMEMADE 6802
* COMPUTER BY DAVE HASSLER, '24
*   COMPILES WITH WILLIAM COLLEY'S 'A68' ASSEMBLER AS REVISED
* BY HERB JOHNSON, 2022.  MIKBUG/SWTBUG SCRATCH RAM LOCATIONS
* IN EQUATES IMMEDIATELY BELOW SHOULD BE CHANGED FROM $7Fxx
* TO $A0xx FOR REGULAR USE.
*   THIS VERSION IS PROBABLY 1.4, NOT 3.0, AS STATED ABOVE.
* TO COMPILE A BASIC PROGRAM FROM FLEX 2/3, ENTER:
*               ABASIC,SOURCE.TXT,OBJECT.BIN
*   THIS VERSION STILL HAS 'TREAD' AND 'TWRITE' STATEMENTS,
* AND DOES NOT HAVE ANY OF THE DISK I/O STATEMENTS OF VERSION
* 2.1F.  REFER TO THE 'A/BASIC COMPILER REFERENCE MANUAL' FOR
* VERSION 1.0C FOR FORMAT AND LANGUAGE SPECIFICS.
*
PDATA EQU $AD1E
OUTHEX EQU $AD3C
OUTADR EQU $AD45
OUTSPC EQU $E0CC
DOS EQU $AD03
PCRLF EQU $AD24
GETFIL EQU $AD2D
RPTERR EQU $AD3F
SETEXT EQU $AD33
ESCRTN EQU $AC16
FCB EQU $A840
FMSCLS EQU $B403
FMS EQU $B406
PUTCHR EQU $AD18
GETCHR EQU $AD15
NOOPT EQU $E283
RDON EQU $E334
RDOFF EQU $E347
PNCHON EQU $E34D
PNCHOF EQU $E353
PORECH EQU $7F0C
SAVGET EQU $7F10
LA00E EQU $7F0E
CLOCK EQU $0005         ; NOT USED IN THIS VERSION
IRQVEC EQU $7F00
NMIVEC EQU $7F06

DIGITS EQU 5

* SOME TOKENS *
ENDT EQU $80
POST EQU ENDT
CLKT EQU POST+1
RNDT EQU CLKT+1
GOSUBT EQU RNDT+1
ABST EQU GOSUBT
PEEKT EQU ABST+1
GOTOT EQU PEEKT+1
LENT EQU GOTOT
VALT EQU LENT+1
ASCT EQU VALT+1
SUBSTT EQU ASCT+1
ONT EQU SUBSTT+5
BUFT EQU ONT+8
IRQT EQU BUFT+6
THENT EQU IRQT+37
TOT EQU THENT+1
STEPT EQU TOT+1
OFFT EQU STEPT+1
ERRORT EQU OFFT+1
NMIT EQU ERRORT+1
NOVRT EQU NMIT+1
TABT EQU NOVRT+1
* SPC 1
 ORG $20
XTEMP1 RMB 2
VARC RMB 2
PC RMB 2
ARRAYF RMB 1
STRPNT RMB 1
STRFLG RMB 1
XRTEMP RMB 1
L002A RMB 1
L002B RMB 1
L002C RMB 1
L002D RMB 1
PASFLG RMB 1
LREFB RMB 2
BUFPNT RMB 2
VARG RMB 2
L0037 RMB 1
PGCNT RMB 1
L0039 RMB 1
LSTLIN RMB 2
L003C RMB 1
OPTFLG RMB 1
SYMB RMB 2
SYME RMB 2
L0043 RMB 1
L0044 RMB 1
L0045 RMB 2
L0047 RMB 2
L0049 RMB 2
L004B RMB 2
L004D RMB 1
L004E RMB 1
LREFEN RMB 2
L0051 RMB 1
L0052 RMB 1
L0053 RMB 2
VARADD RMB 2
OBJPNT RMB 2
FORPNT RMB 2
L005B RMB 1
L005C RMB 1
ERRTOT RMB 1
L005E RMB 1
XTEMP3 RMB 2
L0061 RMB 4
XTEMP2 RMB 2
PGMTOT RMB 2
VARTOT RMB 2
GROUP2 RMB 1
GROUP1 RMB 1
GROUP7 RMB 1
GROUP5 RMB 1
L006F RMB 1
GROUP8 RMB 1
 RMB 1
GROUP6 RMB 1
GROUP4 RMB 1
GROUP3 RMB 1
PCGRP2 RMB 2
PCGRP1 RMB 2
PCGRP7 RMB 2
PCGRP5 RMB 2
PCGRP8 RMB 2
PCGRP6 RMB 2
PCGRP4 RMB 2
PCGRP3 RMB 2
L0085 RMB 1
L0086 RMB 1
L0087 RMB 1
L0088 RMB 1
OPCODE RMB 1
OPRAND RMB 2
 RMB 2
L008E RMB 1
L008F RMB 1
OBJCNT RMB 1
OBJADR RMB 2
FORSTK RMB 25*4 ;  NUMBER OFF FOR NEXT LOOP'S
FORSTB RMB 1
L00F3 RMB 2
ORGFLG RMB 1
TRNSFR RMB 2
 ORG $100
BASIC LDX #CLOSE ; SET ESCAPE RETURN ADDRESS
 STX ESCRTN
FILNAM LDX #FCB ;  GET FILENAME
 JSR GETFIL
 BCS BERR2A
 LDAA #3        ; SET EXTENSION TO "BAS"
 JSR SETEXT
 LDAA #1        ; OPEN FOR READ
 STAA 0,X
 JSR FMS
 BNE BERR1
 LDX #BFCB
 JSR GETFIL     ; GET FILENAME
BERR2A BCS BERR2
 CLRA   ;    SET EXTENSION TO "BIN"
 JSR SETEXT
 LDX #BFCB
 LDAA #2        ; SET FOR WRITE
 STAA 0,X
 JSR FMS
 BNE BERR3
 LDAA #$FF      ;  SET FOR BINARY WRITE
 STAA 59,X
PASS1 LDS #STK ;   SET STACK
 LDX #LREFTE ;     SET REFERENCE TABLE
 STX LREFEN
 STX SYMB
 LDX #SYMBTE ;     SET SYMBOL TABLE
 STX SYME
 LDX #LREFT
 STX LREFB
L0124 CLR 0,X
 INX 
 CPX SYME
 BNE L0124
 CLRB
 STAB L0039
 STAB ORGFLG
 STAB PGCNT
 STAB OPTFLG
 STAB VARTOT
 STAB VARTOT+1
 STAB PASFLG
 LDX #$0030     ; INIT VAR.
 STX VARC
 LDX #GROUP2
L0140 CLR 0,X
 INX 
 CPX #OPCODE
 BNE L0140
L0148 LDX #$1000 ; INIT ORG.
 STX PC
 STX TRNSFR     ; SAVE TRANSFER ADDRESS
 JSR L1755 
 LDX #0
 STX OBJCNT
 STX ERRTOT
 STX LSTLIN
 STX PGMTOT
 JSR L0621 
 LDX #FORSTB
 STX FORPNT
NXTLIN JSR INLINE
 BRA L016F
BERR1 JMP DERR1
BERR3 LDAA 1,X ;   GET DISK ERROR
BERR2 JMP DERR2
L016F LDAB PASFLG
 BEQ L017F 
 RORB
 BCS L017F 
 LDX #PC
 JSR OUT4H
 JSR PRNLIN
L017F JSR SKIPSP
 CMPA #$D
 BEQ NXTLIN
 JSR CKLNUM
 BCS LNOKAY
 LDAA #1
 BRA ERRORP
LNOKAY CMPA LSTLIN
 BCS SEQERR
 BNE L019D 
 CMPB LSTLIN+1
 BHI L019D 
SEQERR LDAA #2
 BRA ERRORP
L019D STAA LSTLIN
 STAB LSTLIN+1
 JSR CKLREF
CONTL STX BUFPNT
 JSR SCRSYM
 JSR FNXTCH
 JSR ALPHA
 BCS L01B3 
 BRA ILSTAT
L01B3 LDAA 1,X
 JSR ALPHA
 BCS L01BF 
 JSR LET1
 BRA FINISH
L01BF JSR FKEY1
 BCC ILSTAT
 CLRB
 LDX #DSPTCH
L01C8 CBA 
 BEQ L01D0 
 INX 
 INX 
 INCB
 BRA L01C8 
L01D0 LDX 0,X
 JSR 0,X
FINISH BCC ERRORP
 JSR SKIPSP
 CMPA #$D
 BEQ NXTLQ
 INX 
 CMPA #':'
 BEQ CONTL
 LDAA #4
 BRA ERRORP
ILSTAT LDAA #3
ERRORP BSR L01F1
NXTLQ JMP NXTLIN
* REM *
REM INS
 INS 
 BRA NXTLQ
L01F1 PSHA
 JSR PRNLIN
L01F5 CPX BUFPNT
 BEQ L0204 
 CPX #L1D41 
 BEQ L0208 
 INX 
 JSR L03A3 
 BRA L01F5 
L0204 LDAA #'^'
 BSR L0235 
L0208 BSR L0216 
 LDX #ERRMSG
 JSR L0342 
 PULA
 INC ERRTOT
 BSR L0219 
L0216 JMP L0362 
L0219 TAB 
 CLRA
LOUP CMPB #$63
 BLS L0224 
 SUBB #$64
 INCA
 BRA LOUP
L0224 BSR L0233 
 CLRA
NUMTST CMPB #9
 BLS L0230 
 SUBB #$A
 INCA
 BRA NUMTST
L0230 BSR L0233 
 TBA 
L0233 ORAA #$30
L0235 JMP OUTCHQ
ERRMSG FCC "** ERROR "
 FCB $D
* LET *
LET LDX BUFPNT
LET1 BSR L02AB
 BCC RET0
L0248 JSR SCRSYM
 JSR L0B10 
 BCC RET0
 LDAA STRFLG
 BEQ L0259 
 JSR EVALS
 BRA L025C 
L0259 JSR EVALN
L025C BCS L025F 
RET0 RTS
L025F LDAA STRFLG
 BNE L0279 
 LDAA ARRAYF
 BEQ L026E 
 BSR L02A2 
 JSR STAA2
 BRA L0275 
L026E LDAA VARADD
 LDAB VARADD+1
 JSR L14F3 
L0275 STX BUFPNT
 SEC 
 RTS 
L0279 CLRA
 LDAB #$27
 JSR L1552 
 BSR L0288 
L0281 LDAA L0037 
 JSR L0EB6 
 BRA L0275 
L0288 LDAA ARRAYF
 BEQ L028E 
 BRA L02A2 
L028E LDAA L0037 
 BEQ L0298 
 LDAA L0087 
 LDAB L0088 
 BRA L029C 
L0298 LDAA VARADD
 LDAB VARADD+1
L029C JSR SETADR
 JMP LDX3
L02A2 JSR TSX
 JSR LDXX
 JMP INS
L02AB CLRB
 STAB L0037 
 STAB ARRAYF
 STAB STRFLG
 BSR SKIPSP
 BSR ALPHA
 BCS L02BC
 LDAA #DIGITS
L02BA CLC 
 RTS 
L02BC LDAB 1,X
 CMPB #'$'
 BNE NUMVAR
 INX 
 INX 
 STAB STRFLG
 BRA L02CB 
NUMVAR JSR L10DB
L02CB BSR L0306 
 BEQ ARRAY
 TST STRFLG
 BEQ L02D9 
 JSR L130D 
 BRA L02DC 
L02D9 JSR FVARAD
L02DC STAA VARADD
 STAB VARADD+1
 SEC 
 RTS 
ARRAY INC ARRAYF
 TST STRFLG
 BNE L02EF 
 JSR L111F 
 BRA L02F2 
L02EF JSR L111A 
L02F2 BCC L02BA 
 JMP PSHB
* BUF$ *
BUFSTR LDX L0087
 STX VARADD
 LDAA #$11
 STAA STRFLG
 STAA L0037 
 BSR FNXTCH
 JMP L0248 
L0306 PSHB
 LDAB 0,X
 CMPB #'('
 PULB
 RTS 
FNXTCH LDX BUFPNT
 BRA SKIPSP
L0311 INX 
SKIPSP LDAA 0,X
 CMPA #$20
 BEQ L0311 
 SEC 
 RTS 
ALPHA CMPA #'A'
 BCS L0339
 CMPA #'Z'+1
 BHI L0339 
 SEC 
 RTS 
NUMD CMPA #'0'
 BCS L0339
 CMPA #'9'
 BHI L0339 
L032C SEC 
 RTS 
L032E JSR SKIPSP
CKLEND CMPA #$D
 BEQ L032C 
 CMPA #':'
 BEQ L032C 
L0339 CLC 
 RTS 
L033B CMPA #','
 BNE L0339 
 INX 
 SEC 
 RTS 
L0342 LDAA 0,X
 CMPA #$D
 BNE L0349 
 RTS 
L0349 INX 
 BSR OUTCHQ
 BRA L0342 
OUTCHQ JMP PUTCHR
L0351 STX BUFPNT
 BSR L0362 
 LDX BUFPNT
 RTS 
PRNLIN BSR L035E
 BSR L0342 
 BSR L0362 
L035E LDX #LINBUF
 RTS 
L0362 JSR PCRLF
 LDAA L0039 
 INCA
 STAA L0039 
 CMPA #$39
 BCC PGHEAD
 RTS 
PGHEAD LDAB #4
 BSR L039C 
 STAB L0039 
 LDAB #4
L0377 LDAA #'-'
 BSR OUTCHQ
 DECB
 BNE L0377 
 JSR PCRLF
 JSR PCRLF
 LDX #PGMSG
 BSR L0342 
 LDAA PGCNT
 INCA
 STAA PGCNT
 JSR L0219 
 LDAB #$A
 BSR L03A5 
 LDX #BASMSG
 BSR L0342 
 LDAB #3
L039C JSR PCRLF
 DECB
 BNE L039C 
 RTS 
L03A3 LDAB #1
L03A5 LDAA #$20
 BSR OUTCHQ
 DECB
 BNE L03A5 
 RTS 
PGMSG FCC "PG "
 FCB $D
BASMSG FCC "A/BASIC V3.0"
 FCB $D
L03BE STX BUFPNT
 LDX #LREFT-4
L03C3 INX 
 INX 
 INX 
 INX 
 CPX LREFB
 BNE L03CD 
 CLC 
 RTS 
L03CD CMPA 0,X
 BNE L03C3 
 CMPB 1,X
 BNE L03C3 
 SEC 
 RTS 
CKLREF BSR L03BE
 BCC L03EC 
 CPX SYMB
 BNE L03E4 
 LDAA #31
 JMP ERRORS
L03E4 LDAA PC
 LDAB PC+1
 STAA 2,X
 STAB 3,X
L03EC LDX BUFPNT
 RTS 
FKEY1 STX BUFPNT
 LDX #KEYTBL
 STX L0049 
 LDX #KEY1EN
 BRA SRCHT
FFNNUM STX BUFPNT
 LDX #FUNCTI
 STX L0049 
 LDX #FNEND
 BRA SRCHT
FFNSTR STX BUFPNT
 LDX #FNSTR
 STX L0049 
 LDX #FNSEND
 BRA SRCHT
FKEY2 JSR FNXTCH
 STX BUFPNT
 LDX #KEYTB2
 STX L0049 
 LDX #KEY2EN
SRCHT STX L004B
 LDAA #7
 STAA L003C 
 LDX BUFPNT
 STX XTEMP3
 STX L0045 
NXTKEY DEC L003C
 BNE L0437 
NTFND LDX XTEMP3
 STX BUFPNT
 CLC 
 RTS 
L0437 LDX BUFPNT
 LDAA 0,X
 JSR ALPHA
 BCC NTFND
 INX 
 STX BUFPNT
 LDX L0049 
L0445 STX L0047 
 LDX L0045 
 STX XTEMP1
SRCHT1 LDX L0047
 LDAA 0,X
 BMI L046F 
 INX 
 STX L0047 
 LDX XTEMP1
 CMPA 0,X
 BNE L045F 
 INX 
 STX XTEMP1
 BRA SRCHT1
L045F LDX L0047 
L0461 LDAA 0,X
 BMI L0468 
 INX 
 BRA L0461 
L0468 CPX L004B 
 BEQ NXTKEY
 INX 
 BRA L0445 
L046F ANDA #$7F
 LDX XTEMP1
 STX BUFPNT
 SEC 
 RTS 
* STATEMENT TABLE *
KEYTBL FCC "END"
 FCB ENDT
 FCC "FOR"
 FCB $81
 FCC "NEXT"
 FCB $82
 FCC "REM"
 FCB $84
 FCC "GOTO"
 FCB GOTOT
 FCC "IF"
 FCB $86
 FCC "INPUT"
 FCB $87
 FCC "PRINT"
 FCB $88
 FCC "RETURN"
 FCB $89
 FCC "ORG"
 FCB $8A
 FCC "BASE"
 FCB $8B
 FCC "LET"
 FCB $8C
 FCC "STACK"
 FCB $8E
 FCC "STOP"
 FCB $8F
 FCC "CALL"
 FCB $90
 FCC "DIM"
 FCB $91
 FCC "POKE"
 FCB $92
 FCC "OPT"
 FCB $93
 FCC "GEN"
 FCB $94
 FCC "TREAD"
 FCB $96
 FCC "TWRITE"
 FCB $97
 FCC "RETI"
 FCB $98
 FCC "TASK"
 FCB $99
 FCC "SWITCH"
 FCB $9A
KEYTB2 FCC "ON"
 FCB ONT
 FCC "GOSUB"
 FCB GOSUBT
 FCC "BUF$"
 FCB BUFT
 FCC "IRQ"
KEY1EN FCB IRQT
 FCC "THEN"
 FCB THENT
 FCC "TO"
 FCB TOT
 FCC "STEP"
 FCB STEPT
 FCC "OFF"
 FCB OFFT
 FCC "ERROR"
 FCB ERRORT
 FCC "OVR"
 FCB ERRORT
 FCC "NMI"
 FCB NMIT
 FCC "NOVR"
 FCB NOVRT
 FCC "TAB"
KEY2EN FCB TABT
* FUNCTION KEYWORDS *
FUNCTI FCC "ABS"
 FCB ABST
 FCC "RND"
 FCB RNDT
 FCC "POS"
 FCB POST
 FCC "PEEK"
 FCB PEEKT
 FCC "CLK"
 FCB CLKT
 FCC "LEN"
 FCB LENT
 FCC "VAL"
 FCB VALT
 FCC "ASC"
 FCB ASCT
 FCC "SUBSTR"
FNEND FCB SUBSTT
FNSTR FCC "STR$"
 FCB $85
 FCC "RIGHT$"
 FCB $82
 FCC "LEFT$"
 FCB $81
 FCC "MID$"
 FCB $83
 FCC "CHR$"
 FCB $84
 FCC "TRM$"
FNSEND FCB $80
CKLNUM JSR NUMD
 BCC RET1
 LDAB #5
 STAB L003C 
 CLRB
 STAB L004D 
 STAB L004E 
L0580 JSR NUMD
 BCC L05AE 
 SUBA #$30
 PSHA
 STX BUFPNT
 LDX #L004D 
 BSR L05B2 
 LDAB 1,X
 LDAA 0,X
 BSR L05B2 
 BSR L05B2 
 ADDB 1,X
 ADCA 0,X
 TSX 
 ADDB 0,X
 ADCA #0
 INS 
 JSR SETADR
 LDX BUFPNT
 INX 
 LDAA 0,X
 DEC L003C 
 BNE L0580 
L05AE LDAA L004D 
 SEC 
RET1 RTS
L05B2 ASL 1,X
 ROL 0,X
 RTS 
BUFCOD STX XTEMP3
 PSHA
 PSHB
 LDAA PASFLG
 BEQ L05E9 
 ANDA #2
 BEQ L05E9 
 LDAB #2
 JSR L03A5 
 LDX #PC
 JSR OUT4H
 LDX #OPCODE
 JSR OUT2H
 PULB
 PSHB
 CMPB #1
 BEQ L05E6 
 CMPB #2
 BNE L05E3 
 JSR OUT2H
 BRA L05E6 
L05E3 JSR OUT4H
L05E6 JSR L0362 
L05E9 PULB
 LDX #OPCODE
 BSR L05F4
 PULA
 LDX XTEMP3
 SEC 
 RTS 
L05F4 LDAA 0,X
 INX 
 STX XTEMP2
 LDX PC
 INX 
 STX PC
 PSHB
 LDAB PASFLG
 BEQ L061A 
 LDX OBJPNT
 STAA 0,X
 INX 
 STX OBJPNT
 LDAA OBJCNT
 INCA
 STAA OBJCNT
 CMPA #248      ;  BLOCK LENGTH.
 BCS L0615 
 BSR L0621 
L0615 LDX PGMTOT
 INX 
 STX PGMTOT
L061A LDX XTEMP2
 PULB
 DECB
 BNE L05F4 
 RTS 
L0621 LDAA OBJCNT
 BEQ L0628 
 JSR L16A5 
L0628 LDX #OBJBUF
 STX OBJPNT
 LDX PC
 STX OBJADR
 CLR OBJCNT
 RTS 
* COMMAND DISPATCH TABLE *
DSPTCH FDB END
 FDB FOR
 FDB NEXT
 FDB GOSUB
 FDB REM
 FDB GOTO
 FDB IF
 FDB INPUT
 FDB PRINT
 FDB RETURN
 FDB ORG
 FDB BASE
 FDB LET
 FDB ON
 FDB STACK
 FDB STOP
 FDB CALL
 FDB DIM
 FDB POKE
 FDB OPT
 FDB GEN
 FDB BUFSTR
 FDB TREAD
 FDB TWRITE
 FDB RETI
 FDB TASK
 FDB SWITCH
 FDB IRQ
* OPT *
OPT LDX BUFPNT
L066F LDAB #1
 JSR L032E 
 BCS L06AA 
 CMPA #'N'
 BEQ L0691
 INCB
 CMPA #'H'
 BEQ L0691
 ASLB
 CMPA #'S'
 BEQ L0691
 ASLB
 CMPA #'I'
 BEQ L0691
 CMPA #','
 BEQ L0695
 LDAA #26
 CLC 
 RTS 
L0691 ORAB OPTFLG
 STAB OPTFLG
L0695 INX 
 BRA L066F 
L0698 INX 
 LDAA 0,X
 JSR L0B04 
 BCC L06A8 
 TSTA
 BNE ERR21
 TSTB
 BNE L06AA 
ERR21 LDAA #21
L06A8 CLC 
 RTS 
L06AA SEC
 RTS 
* DIM *
DIM JSR FNXTCH
 LDAA #'Z'      ;  LABEL "ZZ"
 TAB 
 JSR FVARAD
L06B5 CLR L005E 
 LDAA 0,X
 JSR ALPHA
 BCS L06C2 
 LDAA #$A
 RTS 
L06C2 LDAB 1,X
 CMPB #$24
 BEQ L06D0 
 INC L005E 
 JSR L10DB 
 BRA L06D2 
L06D0 INX 
 INX 
L06D2 JSR L12E7
 BCC L06E0 
 TST PASFLG
 BNE L06E6 
 LDAA #19
 CLC 
 RTS 
L06E0 STAA 0,X
 STAB 1,X
 STX XTEMP3
L06E6 LDX BUFPNT
 LDAA 0,X
 CMPA #'('
 BNE ERR20
 CLR L008F 
 BSR L0698 
 BCC RET2
 STAB L008E
 LDAA 0,X
 CMPA #','
 BNE L0709 
 LDAB L005E 
 BEQ ERR20
 BSR L0698 
 BCC RET2
 STAB L008F
 LDAA 0,X
L0709 CMPA #')'
 BEQ L0711 
ERR20 LDAA #20
 CLC 
RET2 RTS
L0711 INX 
 STX BUFPNT
 LDAA PASFLG
 BNE L0746 
 LDX XTEMP3
 LDAA L008E 
 LDAB L008F 
 STAA 4,X
 STAB 5,X
 BSR L0761 
 STAA 2,X
 STAB 3,X
 JSR L1346
 LDAB L008E 
 LDAA L008F 
 BEQ L0733 
 BSR SUBG5
L0733 BSR L075C 
 TST L005E 
 BNE L0742 
 BSR L075C 
 BSR L075C 
 BSR L075C 
 BSR L075C 
L0742 BSR L0766 
 BCC RET3
L0746 LDX BUFPNT
 JSR L032E 
 BCS RET3
 JSR L033B 
 BCC ERR16
 JSR SKIPSP
 JMP L06B5 
ERR16 LDAA #16
 CLC 
RET3 RTS
L075C ASLB
 ROLA
 BCS L0788 
 RTS
L0761 LDAA VARC
 LDAB VARC+1
 RTS 
L0766 PSHB
 PSHA
 TSX 
 BSR L0761 
 ADDB 1,X
 ADCA 0,X
 BCS L0788 
 STAA VARC
 STAB VARC+1
 LDAA PASFLG
 BNE L0785 
 LDAA VARTOT
 LDAB VARTOT+1
 ADDB 1,X
 ADCA 0,X
 STAA VARTOT
 STAB VARTOT+1
L0785 SEC 
 BRA L078B 
L0788 LDAA #$20
 CLC 
L078B INS 
 INS 
 RTS 
SUBG5 PSHB
 LDAB #8
 PSHB
 TSX 
 CLRB
L0794 ASLB
 ROLA
 BCC L079C 
 ADDB 1,X
 ADCA #0
L079C DEC 0,X
 BNE L0794 
 INS 
 INS 
 RTS
* IRQ *
IRQ JSR FKEY2
 BCC ERR33
 CMPA #OFFT-ENDT
 BNE L07AF 
 JMP SEI
L07AF CMPA #ONT-ENDT
 BNE ERR33
 JMP CLI
ERR33 LDAA #33
 CLC 
 RTS 
* END *
END INS
 INS
L07BC JSR CPYSUB
 LDAA PASFLG
 BNE L07C6
 LDX #FCB       ;   REWIND FILE FOR READ
 LDAA #5
 STAA 0,X
 JSR FMS
 BNE BERR2B
PASS2 LDAA OPTFLG
 ORAA #$80      ;  UPDATE PASSFLAG
 STAA PASFLG
 JSR PGHEAD
 JMP L0148      ;  DO PASS2
BERR2B JMP DERR2
L07C6 JSR L0621
 JSR L0841
 LDX #PGMERR
 BSR L0835
 LDAA ERRTOT
 JSR L0219
 BSR L0841 
 LDX #VARLEN
 BSR L0835 
 LDX #VARTOT
 BSR L083A 
 LDX #PGMLEN
 BSR L0835 
 LDX #PGMTOT
 BSR L083A 
 LDX #PGMEND
 BSR L0835 
 LDX OBJADR
 DEX 
 STX XTEMP3
 LDX #XTEMP3
 BSR L083A 
 BSR L0841 
 LDAB PASFLG
 ANDB #4
 BEQ L0826 
 LDX SYMB
L0805 CPX LREFEN
 BEQ L0826 
 LDAA 0,X
 BSR L0829 
 INX 
 LDAA 0,X
 BSR L0829 
 LDAB #3
 JSR L03A5 
 INX 
 JSR OUT4H
 JSR OUT2H
 JSR OUT2H
 JSR L0351 
 BRA L0805 
L0826 JMP DOORG ;  GOTO CLOSE PROGRAM'S
L0829 TSTA
 BPL L082E 
 LDAA #$2A
L082E BNE L0832 
L0830 LDAA #$20
L0832 JMP OUTCHQ
L0835 JSR L0342 
 BRA L0830 
L083A LDAA #$24
 BSR L0832 
 JSR OUT4H
L0841 JMP L0362 
PGMEND FCC "PGM END"
 FCB $D
PGMERR FCC "ERRORS "
 FCB $D
PGMLEN FCC "PGM LEN"
 FCB $D
VARLEN FCC "VAR LEN"
 FCB $D
* TWRITE *
TWRITE LDAA #1
 BRA L0869
* PRINT *
PRINT CLRA
L0869 STAA L006F 
 INCA
 STAA GROUP2
 JSR L08F6 
 LDAB #SUBG21-LOUT
 BSR L08EF
 JSR L032E
 BNE L087E
 LDAB #SUBG27-LOUT
 BRA L08EF 
L087E JSR FKEY2
 BCC L088B 
 CMPA #TABT-ENDT
 BEQ L08AD 
 CMPA #BUFT-ENDT
 BEQ L08E5 
L088B JSR SCRSYM
 STX XTEMP3
 JSR EVALS
 BCC L08A0 
 TSTA
 BEQ L089C 
 LDAB #SUBG29-LOUT
 BRA L08BD
L089C LDAB #SUBG28-LOUT
 BRA L08BD 
L08A0 LDX XTEMP3
 STX BUFPNT
 JSR FKEY2
 BCC L08B6 
 CMPA #TABT-ENDT
 BNE L08B6 
L08AD JSR EVALN
 BCC RET4
 LDAB #SUBG24-LOUT
 BRA L08BD
L08B6 JSR EVALN
 BCC RET4
 LDAB #SUBG2A-LOUT
L08BD BSR L08EF
 JSR L033B
 BCC L08CA
 LDAB #LTAB-LOUT
 BSR L08EF 
 BRA L088B 
L08CA CMPA #';'
 BNE L08DC 
 INX 
 JSR L032E 
 BNE L088B 
 LDAA L006F 
 BNE L08ED
 LDAB #SUBG23-LOUT
 BRA L08EF 
L08DC JSR CKLEND
 BEQ L08E5 
 LDAA #$10
 CLC 
RET4 RTS
L08E5 LDAA L006F 
 BNE L08ED 
 LDAB #SUBG26-LOUT
 BRA L08EF
L08ED LDAB #SUBG25-LOUT
L08EF CLRA
 ADDB PCGRP2+1
 ADCA PCGRP2
 BRA L0905 
L08F6 LDX L0087 
 STX L004D 
 JSR FNXTCH
 JMP LDX3
L0900 CLRA
 ADDB PCGRP1+1
 ADCA PCGRP1
L0905 JSR L1457 
 JMP SKIPSP
* TREAD *
TREAD LDAB #SUBG13-LINPUT
 BRA L0911
* INPUT *
INPUT LDAB #SUBG14-LINPUT
L0911 PSHB
 BSR L08F6 
 PULB
 BSR L0900 
 LDAB #1
 STAB GROUP1
 JSR FKEY2
 BCC L0924 
 CMPA #BUFT-ENDT
 BEQ L0946 
L0924 JSR L02AB 
 BCC RET5
 LDAA STRFLG
 BNE L0935 
 CLRB
 BSR L0900 
 JSR L025F 
 BRA L093C 
L0935 JSR L0288 
 LDAB #SUBG12-LINPUT
 BSR L0900 
L093C JSR FNXTCH
 CMPA #','
 BNE L0946 
 INX 
 BRA L0924 
L0946 SEC 
RET5 RTS
* GEN *
GEN LDX BUFPNT
L094A JSR SKIPSP
 JSR L0FC3 
 BCC RET6
 TSTA
 BNE L095A 
 TBA 
 BSR L0971 
 BRA L095D 
L095A JSR BYT2
L095D JSR SKIPSP
 JSR L033B 
 BCC L0967 
 BRA L094A 
L0967 SEC 
RET6 RTS
* RETURN *
RETURN LDAA #$39 ; "RTS"
 BRA L096F
* RETI *
RETI LDAA #$3B ;   "RTI"
L096F LDX BUFPNT
L0971 JMP BYT1
* SWITCH *
SWITCH LDAA #LA00E/$100
 LDAB #LA00E*$100/$100
 JSR SETADR
 LDAA #$7C      ;  "INC"
 LDX BUFPNT
 JSR BYT3
 JSR SEI
 JSR SWI
 JMP CLI
* TASK *
TASK JSR L0AF6
 BCC ERR14
 TSTA
 BNE ERR14
 CMPB #$10      ;  MAX NUMBER OF TASK'S
 BCC ERR14
 LDAA #$86      ;  "LDAA #"
 JSR BYT2
 STX BUFPNT
 JSR FKEY2
 BCC ERR14
 CMPA #OFFT-ENDT
 BNE L09AB
 LDAB #NOOPT*$100/$100
 BRA L09B7
L09AB CMPA #ONT-ENDT
 BEQ L09B5
ERR14 LDAA #14
 CLC
 RTS
L09B5 LDAB #NOOPT*$100/$100
L09B7 LDAA #NOOPT/$100
 BRA L0A27
L09BB LDAA #$CE ;  "LDX #"
 BRA L09C5 
* GOSUB *
GOSUB LDAA #$BD ;  "JSR"
 BRA L09C5 
* GOTO *
GOTO LDAA #$7E ;   "JMP"
L09C5 STAA OPCODE
 BSR L09D4 
 BCC RET7
L09CB STAA OPRAND
 STAB OPRAND+1
 LDAB #3
 JMP BUFCOD
L09D4 JSR FNXTCH
 JSR CKLNUM
 BCS L09DF 
 LDAA #10
RET7 RTS
L09DF STX BUFPNT
 TST PASFLG
 BNE L0A06 
 JSR L03BE 
 BCS L0A02 
 CPX SYMB
 BNE L09F4 
 LDAA #13
 CLC 
 RTS 
L09F4 STAA 0,X
 STAB 1,X
 CLR 3,X
 CLR 2,X
 INX 
 INX 
 INX 
 INX 
 STX LREFB
L0A02 LDX BUFPNT
 SEC 
 RTS 
L0A06 JSR L03BE 
 BCC ERR7
 LDAA 2,X
 LDAB 3,X
 BNE L0A02 
 TSTA
 BNE L0A02 
ERR7 LDAA #7
 CLC 
 RTS 
* STOP *
STOP LDX BUFPNT
 LDAA #DOS/$100
 LDAB #DOS*$100/$100
 JMP JMP
* CALL *
CALL JSR L0AF6
 BCS L0A27 
RET8 RTS
L0A27 JMP L1457 
* STACK *
STACK LDAA #$8E ;  "LDS #"
 STAA OPCODE
 JSR L0AFB 
 BCC RET8
 BRA L09CB 
L0A35 LDAA L002C 
 BNE L0A3C 
 JSR L0EA1 
L0A3C LDAA #$C
 JSR L0EB6 
 CLRA
 LDAB #$27      ;  "BEQ"
 JSR L154B 
 CLRA
 LDAB #$20      ;  "BRA"
 JMP L1552 
L0A4D BSR L0A35 
 BSR L0AC4 
 BCC L0A84 
 BSR L0AC5 
 LDAA #$24      ;  "BCC"
 CMPB #4
 BEQ L0A60 
 INCA
 CMPB #3
 BNE L0A84 
L0A60 STAA L005E 
 JSR EVALS
 BCC RET8
 LDAA #$B
 JSR L0EB6 
 LDAA L005E 
 LDAB #3
 JSR BYT2
 BRA L0AAB 
* IF *
IF JSR FNXTCH
 JSR EVALS
 BCS L0A4D 
 JSR EVALN1
 BSR L0AC4 
 BCS L0A87 
L0A84 LDAA #$F
 RTS
L0A87 BSR L0AC5 
 STAB L005E 
 INC L0051 
 CLR L002D 
 JSR L0F32 
 LDAB #1
 LDAA L002D 
 BEQ L0A9E 
 JSR NEGA
 CLRB
L0A9E JSR L10BC 
 LDX #BRCHTBL
 LDAB L005E 
 DECB
 ASLB
 JSR L1366 
L0AAB STX BUFPNT
 JSR FKEY2
 BCC ERR4
 CMPA #THENT-ENDT
 BNE L0AB9
 JMP GOTO
L0AB9 CMPA #GOSUBT-ENDT
 BNE ERR4
 JMP GOSUB
ERR4 LDAA #4
L0AC2 CLC 
RET9 RTS
L0AC4 CLRB
L0AC5 LDAA 0,X ;   SEARCH OPERATOR
 CMPA #'='
 BNE L0ACF
 ORAB #4
 BRA L0ADD
L0ACF CMPA #'<'
 BNE L0AD7
 ORAB #2
 BRA L0ADD
L0AD7 CMPA #'>'
 BNE L0AC2 
 ORAB #1
L0ADD INX 
 SEC 
 RTS 
BRCHTBL FDB BLT1 ; GET ROUTINE FOR OPERATOR
 FDB BGE
 FDB BEQ
 FDB BNE
 FDB BLT2
 FDB BLT3
* BASE *
BASE BSR L0AFB
 BCC RET9
 STAA VARC
 STAB VARC+1
 SEC 
 RTS 
L0AF6 JSR FNXTCH
 BRA L0B04 
L0AFB LDX BUFPNT
 BSR L0B10 
 BCC RETA
 JSR SKIPSP
L0B04 JSR CKLNUM
 BCS RETA
 BSR L0B4A 
 BCS RETA
 LDAA #$B
RETA RTS
L0B10 JSR SKIPSP
 CMPA #'='
 BNE L0B4C
 INX 
 SEC 
 RTS 
* POKE *
POKE BSR L0AF6
 BCC RETA
 JSR L02DC 
 CLR ARRAYF
 BSR L0B10 
 BCC RETA
 JSR EVALN
 LDAA VARADD
 LDAB VARADD+1
 JMP L153C 
* ORG *
ORG BSR L0AFB
 BCC RETA
 STAA PC
 STAB PC+1
 LDAA PASFLG
 BEQ L0B45 
 STX BUFPNT
 LDAA ORGFLG ;     IF "ORG" THEN
 BNE NORG
 INCA           ; SET FLAG
 STAA ORGFLG
 LDX PC ;  AND SAVE TRANSFER ADDRESS
 STX TRNSFR
NORG JSR L0621
 LDX BUFPNT
L0B45 SEC 
 RTS 
 JSR FNXTCH
L0B4A CMPA #'$'
L0B4C BNE L0B91
 INX 
 BSR HEX
 BCC L0B91 
 LDAB #4
 STAB L003C 
 CLRB
 STAB L004D 
 STAB L004E 
L0B5C BSR HEX
 BCC L0B75 
 LDAB #4
L0B62 ASL L004E
 ROL L004D 
 DECB
 BNE L0B62 
 ORAA L004E 
 STAA L004E 
 INX 
 DEC L003C 
 BNE L0B5C 
L0B75 LDAA L004D 
 LDAB L004E 
 SEC 
 RTS 
HEX LDAA 0,X
 SUBA #$30
 BCS L0B91 
 CMPA #9
 BLS L0B8F 
 SUBA #7
 CMPA #$A
 BCS L0B91 
 CMPA #$F
 BHI L0B91 
L0B8F SEC 
 RTS 
L0B91 CLC 
 RTS 
* FOR *
FOR JSR FNXTCH
 STX BUFPNT
 JSR L10DB 
 BCS L0BA0 
 LDAA #5
RETB RTS
L0BA0 JSR L0306 
 BNE FTO
 LDAA #$12
 CLC 
 RTS 
FTO STAA L005B
 STAB L005C 
 JSR LET
 BCC RETB
 JSR FKEY2
 BCC ERR4A
 CMPA #TOT-ENDT
 BEQ FSTEP
ERR4A LDAA #4
 CLC 
 RTS 
FSTEP LDAA L005B
 LDAB L005C 
 ORAA #$80
 JSR L0C8B 
 BCC RETB
 CLR L005E 
 JSR FKEY2
 BCC L0BE4 
 CMPA #STEPT-ENDT
 BNE L0BE4 
 LDAA L005B 
 LDAB L005C 
 ORAB #$80
 JSR L0C8B 
 BCC RETB
 INC L005E 
L0BE4 STX BUFPNT
 LDX FORPNT
 CPX #FORSTK
 BNE L0BF1 
 LDAA #30
 CLC 
 RTS 
L0BF1 LDAA L005B 
 TST L005E 
 BEQ L0BFA 
 ORAA #$80
L0BFA STAA 0,X
 DEX 
 LDAB L005C 
 STAB 0,X
 DEX 
 LDAA PC
 STAA 0,X
 DEX 
 LDAA PC+1
 STAA 0,X
 DEX 
 STX FORPNT
 LDX BUFPNT
 SEC 
 RTS 
* NEXT *
NEXT JSR FNXTCH
 JSR L10DB 
 BCS L0C1D 
 LDAA #5
 RTS 
L0C1D STAA L005B 
 STAB L005C 
 STX BUFPNT
 LDX FORPNT
 CPX #FORSTB
 BNE L0C2E 
ERR12 LDAA #12
 CLC 
 RTS 
L0C2E INX
 LDAA 0,X
 STAA VARADD+1
 INX 
 LDAA 0,X
 STAA VARADD
 INX 
 LDAB 0,X
 INX 
 LDAA 0,X
 STX FORPNT
 LDX BUFPNT
 STAA L005E 
 ANDA #$7F
 CMPA L005B 
 BNE ERR12
 CMPB L005C 
 BNE ERR12
 JSR FVARAD
 PSHA
 PSHB
 JSR LDAB3
 LDAA L005E 
 ANDA #$80
 BEQ L0C6A 
 LDAA L005B 
 LDAB L005C 
 ORAB #$80
 JSR FVARAD
 JSR ADB3
 BRA L0C70 
L0C6A LDAB #1
 CLRA
 JSR L14C9 
L0C70 PULB
 PULA
 JSR L14F3 
 LDAA L005B 
 LDAB L005C 
 ORAA #$80
 JSR FVARAD
 JSR SUBB3
 JSR BLT3
 LDAA VARADD
 LDAB VARADD+1
 JMP JMP
L0C8B JSR FVARAD
 STAA VARADD
 STAB VARADD+1
 CLRB
 STAB ARRAYF
 STAB STRFLG
 JMP L0259 
* ON *
ON JSR FKEY2
 BCC L0CA2 
 JMP ONNMI
L0CA2 JSR EVALN1
 BCC RETC
 LDAA #$4D      ;  "TSTA"
 BSR L0D01 
 LDAA #$27      ;  "BEQ +2"
 LDAB #2
 BSR L0CFC 
 LDAA #$C6      ;  "LDAB #$FF"
 LDAB #$FF
 BSR L0CFC 
 JSR FNXTCH
 JSR FKEY1
 CLRB
 CMPA #GOTOT-ENDT
 BEQ L0CCB 
 INCB
 CMPA #GOSUBT-ENDT
 BEQ L0CCB 
ERR4B LDAA #4
 CLC 
RETC RTS
L0CCB STAB L008F 
 CLR L008E 
L0CD0 LDAA #$C1 ;  "CMPB"
 LDAB L008E 
 INCB
 STAB L008E 
 BSR L0CFC 
 JSR L1576 
 LDAA L008F 
 BNE L0CE4 
 BSR L0D3D 
 BRA L0CE7 
L0CE4 JSR L09BB 
L0CE7 BCC RETC
 JSR FNXTCH
 CMPA #','
 BNE L0CF5 
 INX 
 STX BUFPNT
 BRA L0CD0 
L0CF5 LDAA L008F
 BEQ L0CFF 
 LDAA #$AD      ;  "JSR 0,X"
 CLRB
L0CFC JMP BYT2
L0CFF LDAA #$D
L0D01 JMP BYT1
ONNMI STAA L008E
 JSR FNXTCH
 JSR FKEY1
 BCC ERR4B
 CMPA #GOTOT-ENDT
 BNE ERR4B
 LDAA L008E
 CMPA #NMIT-ENDT
 BNE ONIRQ
 LDAA #NMIVEC*$100/$100 ;  LSB OF NMI ADDRESS
 BRA L0D21
ONIRQ CMPA #IRQT-ENDT
 BNE ONERR
 CLRA   ;    LSB OF IRQ ADDRESS.
L0D21 PSHA
 JSR L09BB 
 BCC RETC
 LDAA #IRQVEC/$100      ;  MSB OF IRQ & NMI ADDRESS
 PULB
 JMP L1552 
ONERR LDAB #$24
 CMPA #ERRORT-ENDT
 BEQ L0D38 
 INCB
 CMPA #NOVRT-ENDT
 BNE ERR4B
L0D38 TBA 
 LDAB #3
 BSR L0CFC 
L0D3D JMP GOTO
L0D40 STX BUFPNT
 JSR SKIPSP
 CMPA #'"'
 BNE L0D8E 
 INX 
 STX BUFPNT
 CLRB
L0D4D BSR L0D7B
 BCS L0D4D 
 TSTA
 BEQ L0D59 
 LDAA #17
 JMP ERRORS
L0D59 INCB
 LDAA #$20      ;  "BRA"
 JSR BYT2
 LDAA PC
 LDAB PC+1
 PSHB
 PSHA
 LDX BUFPNT
L0D67 BSR L0D7B 
 BCC L0D70 
 JSR BYT1
 BRA L0D67 
L0D70 JSR BYT1
 PULA
 PULB
 JSR SETADR
 JMP LDX3
L0D7B LDAA 0,X
 JSR CKLEND
 BEQ L0D8E 
 CMPA #'"'
 BNE L0D91 
 LDAA 1,X
 CMPA #'"'
 BEQ L0D90
 CLRA
 INX
L0D8E CLC
 RTS
L0D90 INX
L0D91 INX
 INCB
 SEC 
 RTS 
EVALS BSR L0DB4
 BCC RETD
L0D99 LDAA L002C 
 BEQ L0DAB 
 LDAA L0085 
 LDAB L0086 
L0DA1 JSR SETADR
 JSR LDX3
 LDAA #2
 SEC 
 RTS 
L0DAB LDAA XRTEMP
 CMPA #1
 BEQ L0DB2 
 CLRA
L0DB2 SEC 
RETD RTS
L0DB4 LDAA 0,X
 BSR L0D40 
 BCS L0E1D 
 JSR ALPHA
 BCC RETD
 BRA L0DC6 
ERR28 LDAA #28
BERR JMP ERRORS
L0DC6 LDAB 1,X
 CMPB #$24
 BNE L0E06 
 INX 
 INX 
 JSR L0306 
 BNE L0DE4 
 PSHB
 JSR L0E7D 
 PULB
 JSR L111A 
 BCC BERR
 JSR L1109 
 LDAB #3
 BRA L0DEC 
L0DE4 JSR L130D 
 JSR LDX3
 LDAB #2
L0DEC STAB XRTEMP
 LDAB L002C 
 BEQ L0DF5 
 JSR L0EA1 
L0DF5 JSR SKIPSP
 CMPA #'+'
 BNE L0DB2 
 INX 
 LDAB L002C 
 BNE L0DB4 
 JSR L0EA1 
 BRA L0DB4 
L0E06 STX BUFPNT
 STX XTEMP3
 JSR FKEY2
 BCC L0E25 
 CMPA #BUFT-ENDT
 BEQ L0E17 
 LDX XTEMP3
 BRA L0E25 
L0E17 LDAA L0087
 LDAB L0088 
 BSR L0DA1 
L0E1D LDAB #1
 BRA L0DEC 
ERR29 LDAA #29
 BRA BERR
L0E25 JSR FFNSTR
 BCS L0E2F 
 LDAA XRTEMP
 BNE ERR28
 RTS 
L0E2F PSHA
 BSR L0E86 
 JSR L0306 
 BNE ERR28
 INX 
 PULA
 PSHA
 CMPA #3
 BHI L0E55 
 JSR DES
 LDAA #1
 JSR L0EB6 
 JSR L0DB4 
 BCC ERR29
 PULB
 PSHB
 TSTB
 BEQ L0E70 
 JSR L033B 
 BCC ERR29
L0E55 BSR L0E81
 PULB
 PSHB
 CMPB #3
 BNE L0E70 
 LDAA 0,X
 JSR L033B 
 BCC ERR29
 LDAA #$37  ; "PSHB"
 JSR BYT1
 BSR L0E81 
 LDAA #$32  ; "PSHA"
 JSR BYT1
L0E70 LDAA 0,X
 JSR L1066 
 PULA
 ADDA #4
 BSR L0EB6 
 JMP L0DF5 
L0E7D CLRB
 JMP L0F1A 
L0E81 BSR L0E7D 
 JMP L11B5 
L0E86 LDAA L002C 
 BNE RETF
L0E8A LDAB L0085 
 LDAA #$86  ; "LDAA #"
 JSR BYT2
 LDAB L0086 
 LDAA #$C6  ; "LDAB #"
 JSR BYT2
 CLRA
 LDAB #$27  ; "BEQ"
 STAB L002C 
 JMP L14F3 
RETF RTS
L0EA1 LDAA XRTEMP
 BNE L0EA9 
 BSR L0E8A 
 BRA L0EAB 
L0EA9 BSR L0E86 
L0EAB LDAA XRTEMP
 BNE L0EB0 
 RTS 
L0EB0 INCA
 CMPA #4
 BNE L0EB6 
 DECA
L0EB6 LDAB #1
 STAB GROUP7
 CLRB
 STX BUFPNT
 LDX #L0ED5 
L0EC0 CBA 
 BEQ L0EC8 
 INCB
 INX 
 INX 
 BRA L0EC0 
L0EC8 LDAB 1,X
 LDAA 0,X
 LDX BUFPNT
 ADDB PCGRP7+1
 ADCA PCGRP7
 JMP L1457 
L0ED5 FDB SUBG76-STRING
 FDB SUBG71-STRING
 FDB SUB710-STRING
 FDB SUB712-STRING
 FDB SUBG74-STRING
 FDB LLEFT-STRING
 FDB LRIGHT-STRING
 FDB LMID-STRING
 FDB LCHR-STRING
 FDB SUB717-STRING
 FDB LLEN-STRING
 FDB SUB716-STRING
 FDB SUB714-STRING
 FDB SUB718-STRING
 FDB SUB711-STRING
 FDB SUBG72-STRING
 FDB SUB715-STRING
 FDB SUBG75-STRING
* SCREW UP SYMBOL TABLE
SCRSYM STX BUFPNT
 LDX #L1C07 
 STX L0053 
 LDX BUFPNT
 CLRB
 STAB L002C 
 STAB XRTEMP
L0F1A STAB L002D 
 STAB L0051 
 STAB L0052 
 RTS 
EVALN1 LDX BUFPNT
EVALN BSR SCRSYM
 BSR L0F32 
 BCC RETG
L0F29 LDAA L0052 
 BNE L0F30 
 JSR L10FA 
L0F30 SEC 
RETG RTS
L0F32 BSR L0F6B 
FPLUS BSR L0F64
 CMPA #'+'
 BNE FMIN
 BSR L0F67 
L0F3C CLRB
 JSR L10BC 
 BRA FPLUS
FMIN CMPA #'-'
 BEQ L0F48 
 SEC 
 RTS 
L0F48 LDAA L002D 
 PSHA
 CLRA
 STAA L002D 
 BSR L0F67 
 LDAA L002D 
 PULB
 STAB L002D 
 TSTA
 BEQ L0F5D 
 JSR NEGA
 BRA L0F3C 
L0F5D LDAB #1
 JSR L10BC 
 BRA FPLUS
L0F64 JMP SKIPSP
L0F67 INX 
 INC L0051 
L0F6B BSR L0F9F 
FMUL BSR L0F64
 CMPA #'*'
 BNE FDIV
 BSR L0F9B 
 LDAB #2
 JSR L10BC 
 BRA FMUL
FDIV CMPA #'/'
 BEQ L0F81 
 RTS 
L0F81 LDAA L002D 
 PSHA
 CLR L002D 
 BSR L0F9B 
 LDAA L002D 
 BEQ L0F91 
 LDAB #4
 BRA L0F93 
L0F91 LDAB #3
L0F93 JSR L10BC 
 PULA
 STAA L002D 
 BRA FMUL
L0F9B INC L0051 
 INX 
L0F9F BSR L0FDA 
FAND BSR L0F64
 CMPA #'&'
 BNE ORF
 LDAA #6
 BRA L0FBA 
ORF CMPA #'!'
 BNE FXOR
 LDAA #7
 BRA L0FBA 
FXOR CMPA #'%'
 BEQ L0FB8 
 RTS 
L0FB8 LDAA #8
L0FBA PSHA
 BSR L0FD6 
 PULB
 JSR L10BC 
 BRA FAND
L0FC3 STX BUFPNT
 LDAA 0,X
 JSR CKLNUM
 BCS RETH
 JSR L0B4A 
 BCS RETH
 LDX BUFPNT
 LDAA 0,X
RETH RTS
L0FD6 INC L0051 
 INX 
L0FDA BSR L0F64 
 JSR ALPHA
 BCC L1006 
 LDAA 1,X
 JSR ALPHA
 BCC L0FF0 
 JSR FFNNUM
 BCC L0FF0 
 JMP FPOS
L0FF0 LDAA 0,X
 JSR L10DB 
 JSR L0306 
 BNE L1000 
 JSR L1105 
 BCC ERRORS
 RTS 
L1000 JSR FVARAD
 CLRA
 BRA NXTADR
L1006 BSR L0FC3 
 BCC L100E 
 LDAA #1
 BRA NXTADR
L100E CMPA #'('
 BEQ L105F 
 CMPA #'-'
 BNE FNOT
 INX 
 BSR L0FC3 
 BCC L1025 
 LDAA L004D 
 LDAB L004E 
 NEGA
 NEGB
 SBCA #0
 BRA L1039 
L1025 BSR L1045 
 JMP NEGA
FNOT CMPA #'#'
 BNE L1055 
 INX 
 BSR L0FC3 
 BCC L1040 
 LDAA L004D 
 LDAB L004E 
 COMA
 COMB
L1039 JSR SETADR
 LDAA #1
 BRA NXTADR
L1040 BSR L1045 
 JMP COMA
L1045 INC L0051 
 JSR L0FDA 
L104B JSR L0F29 
 INC L002D 
 CLR L0051 
 RTS 
L1055 LDAA #9
ERRORS LDS #STK
 STX BUFPNT
 JMP FINISH
L105F INX 
 JSR L12D2 
 JSR L0F32 
L1066 CMPA #')'
 BEQ L106E 
 LDAA #8
 BRA ERRORS
L106E INX 
 SEC 
 RTS 
NXTADR LDAB L0051
 CMPB #1
 BLS L1086 
 LDAB L0052 
 BEQ L1086 
 CLR L0052 
 CLR L0051 
 PSHA
 JSR PSHB
 PULA
L1086 STX BUFPNT
 LDX L0053 
 STAA 0,X
 DEX 
 LDAB L004E 
 STAB 0,X
 DEX 
 LDAB L004D 
 STAB 0,X
 DEX 
 STX L0053 
 LDX BUFPNT
 SEC 
 RTS 
L109D STX BUFPNT
 LDX L0053 
 CPX #L1C07 
 BEQ L10B7 
 INX 
 LDAA 0,X
 STAA L004D 
 INX 
 LDAA 0,X
 STAA L004E 
 INX 
 LDAB 0,X
 STX L0053 
 BRA L10B9 
L10B7 LDAB #2
L10B9 LDX BUFPNT
 RTS 
L10BC PSHB
 LDAA L0052 
 BNE L10D3 
 BSR L109D 
 PSHB
 PSHA
 LDAA L004D 
 PSHA
 BSR L10FA 
 PULA
 STAA L004D 
 PULA
 STAA L004E 
 PULB
 BRA L10D5 
L10D3 BSR L109D 
L10D5 PULA
 JSR L1358 
 BRA L1110 
L10DB JSR ALPHA
 BCC L10EB 
 LDAA 1,X
 JSR NUMD
 BCS L10F2 
 CMPB #$24
 BNE L10ED 
L10EB CLC 
 RTS 
L10ED CLRB
 LDAA 0,X
 BRA L10F7 
L10F2 LDAA 0,X
 LDAB 1,X
 INX 
L10F7 INX 
 SEC 
 RTS 
L10FA JSR L109D 
 INC L0052 
 LDAA #5
 JMP L1358 
L1105 BSR L111F 
 BCC RETJ
L1109 LDAA PCGRP8
 LDAB PCGRP8+1
 JSR L1457 
L1110 CLRA
 STAA L0051 
 INCA
 STAA L0052 
 STAA L002D 
 SEC 
RETJ RTS
L111A PSHB
 LDAB #$20
 BRA L1122 
L111F PSHB
 LDAB #2
L1122 STAB VARG
 PULB
 JSR L12E7 
 BCC ERR23
 LDAA 2,X
 LDAB 3,X
 PSHB
 PSHA
 LDAA 4,X
 BNE L1138 
ERR23 LDAA #23
 CLC 
 RTS 
L1138 STAA GROUP8
 LDAA 5,X
 BNE L1160 
 LDAB VARG
 PSHB
 LDX BUFPNT
 JSR L12D2 
 JSR L1045 
 PULB
 STAB VARG
 CMPB #2
 BNE L1155 
 JSR ASLB
 BRA L1157 
L1155 BSR LDAA2
L1157 PULA
 PULB
 SUBB VARG
 SBCA #0
 JMP L14C9 
L1160 PSHA
 LDX BUFPNT
 INX 
 BSR L11B5 
 PULA
 STAA VARG+1
 LDAA 0,X
 CMPA #','
 BEQ L1175 
 INS 
 INS 
 LDAA #24
 CLC 
 RTS 
L1175 INX 
 LDAB VARG+1
 BSR LDAA2
 INC L0051 
 JSR L0F32 
 CLRA
 JSR L10BC 
 JSR ASLB
 LDAB VARG+1
 CLRA
 ADDB #1
 ADCA #0
 ASLB
 ROLA
 NEGA
 NEGB
 SBCA #0
 STX BUFPNT
 TSX 
 ADDB 1,X
 ADCA 0,X
 INS 
 INS 
 LDX BUFPNT
 JSR L14C9 
 LDAA 0,X
 JMP L1066 
LDAA2 LDAA #$86         ; "LDAA"
 STAA GROUP5
 JSR BYT2
 LDAA PCGRP5
 LDAB PCGRP5+1
 JMP L1457 
L11B5 JSR L12D2
 JSR L0F32 
 JMP L104B 
FPOS TSTA               ; "POST-ENDT"
 BNE FCLK
 CLRA                   ; MSB OF ARRAYF.
 LDAB #ARRAYF*$100/$100 ; LSB OF ARRAYF.
L11C4 JSR SETADR
 JSR L12D2 
 JSR L1543 
 BRA L11FD 
FCLK CMPA #CLKT-ENDT
 BNE FRND
 CLRA                   ; MSB OF LOWER ADDRESS CLOCK.
 LDAB #CLOCK*$100/$100
 JSR SETADR
 JMP NXTADR
FRND CMPA #RNDT-ENDT
 BNE FABS
 STAA GROUP6
 JSR L0306 
 BNE L11F1 
 JSR L1045 
 BSR L1207 
 JSR STAA2
 BRA L11F6 
L11F1 JSR L12D2 
 BSR L1207 
L11F6 LDAA PCGRP6
 LDAB PCGRP6+1
 JSR L1457 
L11FD CLRA
 STAA L0051 
 INCA
 STAA L002D 
 STAA L0052 
 SEC 
 RTS 
L1207 LDAA #'R'         ; LABEL "RR"
 TAB 
 JSR FVARAD
 JMP LDX3
FABS CMPA #ABST-ENDT
 BNE FPEEK
 JSR L0306 
 BEQ L121E 
ERR25 LDAA #25
 JMP ERRORS
L121E JSR L1045 
 LDAA #$2A      ; "BPL +4"
 LDAB #4
 JSR BYT2
 JMP NEGA
FPEEK CMPA #PEEKT-ENDT
 BNE L1247 
 JSR L0306 
 BNE ERR25
 INX 
 JSR SKIPSP
 JSR L0FC3 
 BCC ERR25
 PSHA
 LDAA 0,X
 JSR L1066 
 PULA
 JMP L11C4 
L1247 PSHA
 JSR L12D2 
 LDAB L002C 
 PSHB
 BEQ L1258 
 JSR DES
 LDAA #1
 JSR L0EB6 
L1258 LDAA 0,X
 JSR L0306 
 BNE ERR25
 INX 
 JSR L0DB4 
 BCC ERR25
 LDAA L002C 
 BNE FSUB
 JSR L0EA1 
FSUB PULB
 PULA
 PSHA
 PSHB
 CMPA #SUBSTT-ENDT
 BNE L1281 
 LDAA 0,X
 JSR L033B 
 BCC ERR25
 JSR L0A35 
 JSR L0DB4 
L1281 LDAA 0,X
 JSR L1066 
 PULB
 PSHB
 TSTB
 BEQ L1292 
 LDAA #$F
 JSR L0EB6 
 BRA FLEN
L1292 JSR L0D99
FLEN PULB
 PULA
 PSHB
 CMPA #LENT-ENDT
 BNE FVAL
 LDAA #$A
 BRA L12BB 
FVAL CMPA #VALT-ENDT
 BNE FASC
 LDAA #$D
 BRA L12BB 
FASC CMPA #ASCT-ENDT
 BNE L12B9 
 LDAA #$E6      ; "LDAB 0,X"
 CLRB
 JSR BYT2
 LDAA #$4F      ; "CLRA"
 JSR BYT1
 BRA L12BE 
L12B9 LDAA #$10
L12BB JSR L0EB6 
L12BE PULB
 TSTB
 BEQ L12C9 
 LDAA #$E
 JSR L0EB6 
 BRA L12CE 
L12C9 CLRA
 STAA L002C 
 STAA XRTEMP
L12CE LDAA #1
 BRA L12E1 
L12D2 LDAA L0052 
 BEQ L12DE 
 JSR PSHB
 LDAA #2
 JSR L1086 
L12DE CLRA
 STAA L0051 
L12E1 STAA L0052 
 STAA L002D 
 SEC 
 RTS 
L12E7 STX BUFPNT
 LDX SYMB
 BRA L12F3 
L12ED INX 
 INX 
 INX 
 INX 
 INX 
 INX 
L12F3 CPX LREFEN
 BNE L12F9 
 CLC 
 RTS 
L12F9 CMPA 0,X
 BNE L12ED 
 CMPB 1,X
 BNE L12ED 
 SEC 
 RTS 
L1303 PSHB
 LDAB #$81
 BRA L1315 
L1308 PSHB
 LDAB #$FF
 BRA L1315 
L130D PSHB
 LDAB #$20
 BRA L1315 
FVARAD PSHB
 LDAB #2
L1315 STAB VARG
 PULB
 BSR L12E7 
 BCC L1322 
 LDAA 2,X
 LDAB 3,X
 BRA L133E 
L1322 STAA 0,X
 STAB 1,X
 LDAA VARC
 LDAB VARC+1
 STAA 2,X
 STAB 3,X
 CLR 4,X
 CLR 5,X
 BSR L1346 
 PSHB
 PSHA
 CLRA
 LDAB VARG
 JSR L0766 
 PULA
 PULB
L133E STAA L004D 
 STAB L004E 
 LDX BUFPNT
 SEC 
 RTS 
L1346 CPX SYME
 BNE L134F
 LDAA #13
 JMP ERRORS
L134F INX 
 INX 
 INX 
 INX 
 INX 
 INX 
 STX LREFEN
 RTS 
L1358 STX L0061 
 ASLA
 STAA L0043 
 ASLA
 ADDA L0043 
 ASLB
 ABA
 TAB 
 LDX #LGTBL
L1366 STX L0043 
 CLRA
 ADDB L0044 
 ADCA L0043 
 PSHB
 PSHA
 TSX 
 LDX 0,X
 LDX 0,X
 INS 
 INS 
 JSR 0,X
 LDX L0061 
 RTS 
LGTBL FDB ADB3
 FDB ADB2
 FDB ADBX
 FDB SUBB3
 FDB SUBB2
 FDB SUBBX
 FDB L147D
 FDB L1474
 FDB L146E
 FDB L144D
 FDB L1434
 FDB L142E
 FDB L1465
 FDB L145E
 FDB L1439
 FDB LDAB3
 FDB L13B1
 FDB SWI
 FDB ANDB3
 FDB ANDB2
 FDB ANDBX
 FDB ORAB3
 FDB ORAB2
 FDB ORABX
 FDB EORB3
 FDB EORB2
 FDB EORBX
L13B1 LDAB L004D
 BNE LDAA
 LDAA #$4F        ; CLRA"
 BSR BYT1
 BRA L13BF
LDAA LDAA #$86        ; LDAA"
 BSR BYT2
L13BF LDAA #$C6        ; LDAB"
 LDAB L004E 
 BNE BYT2
 LDAA #$5F        ; CLRB"
 BRA BYT1
JMP BSR SETADR
 LDAA #$7E        ; JMP"
 BRA BYT3
LDXX LDAA #$EE        ; LDX 0,X"
 CLRB
 BRA BYT2
SETADR STAA L004D
 STAB L004E 
 RTS
INS LDAA #$31        ; INS"
 BSR BYT1
 BRA BYT1
COMA LDAA #$43        ; COMA"
 BSR BYT1
 LDAA #$53        ; COMB"
 BRA BYT1
LDX3 LDAA #$CE        ; LDX #"
BYT3 STAA OPCODE
 LDAA L004D 
 STAA OPRAND
 LDAA L004E 
 STAA OPRAND+1
 LDAB #3
 BRA L1418
STAA2 LDAA #$A7        ; STAA"
 LDAB #$E7        ; STAB"
 BRA L1401
LDA LDAA #$A6        ; LDAA"
 LDAB #$E6        ; LDAB"
L1401 PSHB
 CLRB
 BSR BYT2
 PULA
 LDAB #1
 BRA BYT2
TSX LDAA #$30        ; TSX"
 BRA BYT1
PSHB LDAA #$37        ; PSHB"
 BSR BYT1
 LDAA #$36        ; PSHA"
BYT1 STAA OPCODE
 LDAB #1
L1418 JMP BUFCOD
NEGA LDAA #$40        ; NEGA"
 BSR BYT1
 LDAA #$50        ; NEGB"
 BSR BYT1
 LDAA #$82        ; SBCA"
 CLRB
BYT2 STAA OPCODE
 STAB OPRAND
 LDAB #2
 BRA L1418 
L142E BSR TSX
L1430 BSR L144F 
L1432 BRA INS
L1434 BSR PSHB
 JSR L13B1
L1439 BSR PSHB
 BSR TSX
 LDAA #$A6        ; LDAA 2,X"
 LDAB #2
 BSR BYT2
 LDAA #$E6        ; LDAB 3,X"
 LDAB #3
 BSR BYT2
 BSR L1430 
 BRA INS
L144D BSR LDX3
L144F LDAA #1
 STAA GROUP4
 LDAA PCGRP4
 LDAB PCGRP4+1
L1457 JSR SETADR
 LDAA #$BD        ; JSR"
 BRA BYT3
L145E BSR PSHB
 JSR L13B1 
 BRA L142E 
L1465 BSR PSHB
 JSR LDX3
 BSR LDA
 BRA L142E 
L146E BSR TSX
L1470 BSR L1480 
 BRA L1432 
L1474 BSR PSHB
 JSR L13B1 
 BSR TSX
 BRA L1470 
L147D JSR LDX3
L1480 LDAA #1
 STAA GROUP3
 LDAA PCGRP3
 LDAB PCGRP3+1
 BRA L1457
ANDBX LDAA #$E4        ; ANDB"
 LDAB #$A4        ; ANDA"
 BRA L14A6
ORABX LDAA #$EA        ; ORAB"
 LDAB #$AA        ; ORAA"
 BRA L14A6
EORBX LDAA #$E8        ; EORB"
 LDAB #$A8        ; EORA"
 BRA L14A6
ADBX LDAA #$EB        ; ADDB"
 LDAB #$A9        ; ADDA"
 BRA L14A6
SUBBX LDAA #$E0        ; SUBB"
 LDAB #$A2        ; SUBA"
L14A6 PSHB
 PSHA
 JSR TSX
 PULA
 LDAB #1
 BSR L14DE 
 PULA
 CLRB
 BSR L14DE 
 JMP L1432 
ANDB2 LDAA #$C4        ; ANDB"
 LDAB #$84        ; ANDA"
 BRA L14D6
ORAB2 LDAA #$CA        ; ORAB"
 LDAB #$8A        ; ORAA"
 BRA L14D6
EORB2 LDAA #$C8        ; EORB"
 LDAB #$88        ; EORA"
 BRA L14D6
L14C9 JSR SETADR
ADB2 LDAA #$CB        ; ADDB"
 LDAB #$89        ; ADCA"
 BRA L14D6
SUBB2 LDAA #$C0        ; SUBB"
 LDAB #$82        ; SBCA"
L14D6 PSHB
 LDAB L004E 
 BSR L14DE 
 PULA
 LDAB L004D 
L14DE JMP BYT2
ANDB3 LDAA #$F4        ; ANDB"
 LDAB #$B4        ; ANDA"
 BRA L150E
ORAB3 LDAA #$FA        ; ORAB"
 LDAB #$BA        ; ORAA"
 BRA L150E
EORB3 LDAA #$F8        ; EORB"
 LDAB #$B8        ; EORA"
 BRA L150E 
L14F3 JSR SETADR
STAB3 LDAA #$F7        ; STAB"
 LDAB #$B7        ; STAA"
 BRA L150E
ADB3 LDAA #$FB        ; ADDB"
 LDAB #$B9        ; ADCA"
 BRA L150E
LDAB3 LDAA #$F6        ; LDAB"
 LDAB #$B6        ; LDAA"
 BRA L150E
SUBB3 LDAA #$F0        ; SUBB"
 LDAB #$B2        ; SBCA"
 BRA L150E 
L150E PSHB
 LDAB L004D 
 BNE L1523 
 LDAB L004E 
 INCB
 BEQ L1523 
 BSR L151D 
 PULA
L151B LDAB L004E 
L151D ANDA #$DF
 JMP BYT2
 PSHB
L1523 INC L004E 
 BNE L152B 
 INC L004D 
L152B BSR L1539 
 TST L004E 
 BNE L1535 
 DEC L004D 
L1535 DEC L004E 
 PULA
L1539 JMP BYT3
L153C JSR SETADR
 LDAA #$F7        ; "STAB"
 BRA L1557
L1543 LDAA #$F6        ; "LDAB"
 BSR L1557
 LDAA #$4F        ; "CLRA"
 BRA L157C
L154B JSR SETADR
 LDAA #$FE        ; "LDX"
 BRA L1557 
L1552 JSR SETADR
 LDAA #$FF        ; "STX"
L1557 LDAB L004D 
 BNE L1539 
 BRA L151B 
BLT2 LDAA #$2D        ; "BLT +3"
L155F LDAB #3
L1561 JMP BYT2
BGE LDAA #$2C        ; "BGE +5"
 BRA L155F 
BLT3 LDAA #$2D        ; "BLT +5"
 LDAB #5
 BSR L1561 
BNE LDAA #$26        ; "BNE +6"
 LDAB #6
 BSR L1561 
 BSR L157A 
L1576 LDAA #$26        ; "BNE +3"
 BRA L155F 
L157A LDAA #$5D        ; "TSTB"
L157C JMP BYT1
BLT1 LDAA #$2D        ; "BLT +8"
 LDAB #8
 BSR L1561 
BEQ BSR L1576
 BSR L157A
 LDAA #$27        ; "BEQ +3"
 BRA L155F 
ASLB LDAA #$58        ; "ASLB"
 BSR L157C
 LDAA #$49        ; "ROLA"
 BRA L157C
SWI LDAA #$3F        ; "SWI"
 BRA L157C
DES LDAA #$34        ; "DES"
 BSR L157C
 BRA L157C
CLI LDAA #$E        ; "CLI"
 BRA L157C
SEI LDAA #1        ; "NOP"
 BSR L157C
 LDAA #$F        ; "SEI"
 BRA L157C
CPYSUB LDAA GROUP1      ; CALCULATE LIBRARY
 ORAA GROUP2
 BEQ L15E1 
 LDX VARC
 STX L0087
 LDAA #'I'      ; LABEL "IO"
 LDAB #'O'
 JSR L1303 
 LDAA GROUP1
 BEQ L15D2 
 LDX PC
 STX PCGRP1
 LDX #LINPUT
 LDAB #SUBG14-LINPUT
 BSR ADDBX      ; OFFSET TOO BIG GET NEXT.
 LDAB #MULTY-SUBG14
 BSR ADDBX
L15D2 LDAA GROUP2
 BEQ L15E1 
 LDX PC
 STX PCGRP2
 LDX #LOUT
 LDAB #LINPUT-LOUT
 BSR ADDBX
L15E1 LDAA GROUP3
 BEQ L15F0 
 LDX PC
 STX PCGRP3
 LDX #MULTY
 LDAB #DIVIDE-MULTY
 BSR ADDBX
L15F0 LDAA GROUP4
 BEQ L15FF 
 LDX PC
 STX PCGRP4
 LDX #DIVIDE
 LDAB #LRND-DIVIDE
 BSR ADDBX
L15FF LDAA GROUP5
 BEQ L1613 
 LDX PC
 STX PCGRP5
 LDX #SUBG5
 LDAB #IRQ-SUBG5
 BSR ADDBX
 BRA L1613 
ADDBX JMP L05F4
L1613 LDAA GROUP6
 BEQ L1622 
 LDX PC
 STX PCGRP6
 LDX #LRND
 LDAB #STRING-LRND
 BSR ADDBX
L1622 LDAA GROUP7
 BEQ L165C 
 LDX VARC
 STX L0085 
 LDAA #'S'      ; LABEL "ST"
 LDAB #'T'
 JSR L1308 
 LDX PC
 STX PCGRP7
 LDX #STRING
 LDAB #SUB715-STRING
 BSR ADDBX              ; OFFSET TOO BIG.
 LDAB #L1BBE-SUB715
 BSR ADDBX
 LDAA PASFLG
 PSHA
 ANDA #$FD
 STAA PASFLG
 LDAA PCGRP1
 LDAB PCGRP1+1
 JSR JMP
 LDAA PCGRP2
 LDAB PCGRP2+1
 ADDB #SUBG2A-LOUT
 ADCA #0
 JSR JMP
 PULA
 STAA PASFLG
L165C LDAA GROUP8
 BEQ L1684 
 LDX PC
 STX PCGRP8
 LDAA PASFLG
 PSHA
 ANDA #$FD
 STAA PASFLG
 LDAA #'Z'      ; LABEL "ZZ"
 TAB 
 JSR FVARAD
 PSHB
 PSHA
 JSR STAB3
 PULA
 PULB
 JSR L154B 
 JSR LDA
 JSR RETURN
 PULA
 STAA PASFLG
L1684 JMP L0621
L16A5 LDAA #2           ; MARK BINAIRY DATA
 BSR BDISK              ; SAVE ADDRESS
 LDAA OBJADR
 BSR BDISK
 LDAA OBJADR+1
 BSR BDISK
 LDAA OBJCNT            ; SAVE NUMBER OF DATA BYTES
 BSR BDISK
 LDX #OBJBUF
BNXTD LDAA 0,X          ; SAVE DATA
 INX
 STX OBJPNT
 BSR BDISK
 DEC OBJCNT
 BEQ FILEND
 LDX OBJPNT
 BRA BNXTD
BDISK LDX #BFCB         ; WRITE DATA TO DISK
 JSR FMS
 BNE DERR2
FILEND RTS
DERR1 LDAA 1,X
 CMPA #8
 BNE DERR2
 LDX L00F3
 BRA SETFLE
DOORG LDAA #$16         ; MARK TRANSFER ADDRESS
 BSR BDISK
 LDAA TRNSFR            ; SAVE TRANSFER ADDRESS
 BSR BDISK
 LDAA TRNSFR+1
 BSR BDISK
 BRA CLOSE
DERR2 JSR RPTERR
CLOSE JSR FMSCLS        ; CLOSE ALL FILES
 JMP DOS
INLINE BSR NEWBF9
NEWBF3 LDX L00F3
 LDAA 0,X
 BNE NEWBF4
 BSR SRCREC
 BRA NEWBF3
NEWBF4 INX
 STX L00F3
 LDX BUFPNT
 STAA 0,X
 INX 
 STX BUFPNT
 CMPA #$D
 BNE NEWBF3
NEWBF9 LDX #LINBUF
 STX BUFPNT
 RTS 
SRCREC BSR SREC2
NXTFL LDX #FCB          ; READ ONE SECTOR FROM DISK
 JSR FMS
 BNE DERR1
 LDX L00F3
 STAA 0,X
 INX
 STX L00F3
 CPX #TAPBUF+252
 BNE NXTFL
SETFLE CLR 0,X
SREC2 LDX #TAPBUF
 STX L00F3 
 RTS 
L1755 BSR SREC2
 CLR 0,X
 RTS 
OUT4H JSR OUTADR
 BRA OUTSI
OUT2H JSR OUTHEX
OUTSI INX
OUTS LDAA #$20
 JMP PUTCHR
* SUBROUTINE LIBRARY *
* GROUP 2 OUTPUT *
LOUT LDAA #$20
* PUT CHAR IN I/O BUF.*
ZOUT STX XTEMP1
 LDX VARC
 STAA 0,X
 LDAA ARRAYF
 CMPA #128
 BHI ZOUT2
 INCA
 INX 
ZOUT2 CLR 0,X
 STAA ARRAYF
 STX VARC
 LDX XTEMP1
 RTS 
* INITIALIZE I/O *
SUBG21 STX PC
 BRA ZINZ2
ZINZIO LDAA #1
 STAA ARRAYF
ZINZ2 LDX PC
 STX VARC
 RTS 
* SKIP ZONE *
ZSKPZ2 BSR LOUT
LTAB LDAA ARRAYF
 ANDA #DIGITS+2
 CMPA #1
 BNE ZSKPZ2
 RTS 
* PRINT BUFFER NO CR/LF *
SUBG23 BSR ZINZ2
ZEBN2 LDAA 0,X
 BEQ ZTAB3
 BSR PRCHR
 INX 
 BRA ZEBN2
ZTAB2 BSR LOUT
SUBG24 CMPB ARRAYF
 BHI ZTAB2
ZTAB3 RTS
ZGOUT BRA ZOUT
* WRITE BUFFER TO TAPE *
SUBG25 JSR PNCHON
 LDAB #90
ZENDT2 LDAA #$FF
 BSR PRCHR
 DECB
 BNE ZENDT2
 LDAA #2
 BSR PRCHR
 BSR SUBG23
 LDAA #3
 BSR PRCHR
 JMP PNCHOF
PRCHR JMP PUTCHR
* PRINT BUFFER + CR/LF *
SUBG26 BSR SUBG23
SUBG27 BSR ZINZIO
 JMP PCRLF
L17D2 PSHA
 LDAA 0,X
 BNE L17DB 
 TST 1,X
 BEQ L17E1 
L17DB ORAA #$30
 BSR ZOUT
 INC 1,X
L17E1 CLR 0,X
 PULA
 RTS 
SUBG28 LDAB #$20
 BRA L17EB
SUBG29 LDAB #$80
L17EB LDAA 0,X
 BEQ RETL
 BSR ZGOUT
 INX 
 DECB
 BNE L17EB 
RETL RTS
SUBG2A TSTA
 BPL L1803 
 PSHA
 LDAA #'-'
 BSR ZGOUT
 PULA
 NEGA
 NEGB
 SBCA #0
L1803 DES 
 DES 
 TSX 
 CLR 0,X
 CLR 1,X
L180A SUBB #$10
 SBCA #$27
 BCS L1814 
 INC 0,X
 BRA L180A 
L1814 ADDB #$10
 ADCA #$27
 BSR L17D2 
L181A SUBB #$E8
 SBCA #3
 BCS L1824 
 INC 0,X
 BRA L181A 
L1824 ADDB #$E8
 ADCA #3
 BSR L17D2 
L182A SUBB #$64
 SBCA #0
 BCS L1834 
 INC 0,X
 BRA L182A 
L1834 ADDB #$64
 BSR L17D2 
L1838 SUBB #$A
 BCS L1840 
 INC 0,X
 BRA L1838 
L1840 ADDB #$A
 BSR L17D2 
 STAB 0,X
 INC 1,X
 BSR L17D2 
 INS 
 INS 
 RTS 
* GROUP 1 INPUT *
SUBG11 EQU *
LINPUT CLRA
 PSHA
 PSHA
 PSHA
 PSHA
 LDAA #DIGITS
 PSHA
 TSX 
L1856 BSR L18C7
 CMPA #$20
 BEQ L1856 
 CMPA #'-'
 BNE L186E 
 INC 4,X
L1862 BSR L18C7 
 BCC L189C 
 CMPA #$20
 BEQ L189C 
 TST 0,X
 BEQ L18AF 
L186E SUBA #$30
 BCS L18AF 
 CMPA #9
 BHI L18AF 
 STAA 1,X
 LDAA 2,X
 LDAB 3,X
 ASLB
 ROLA
 STAA 2,X
 STAB 3,X
 ASLB
 ROLA
 ASLB
 ROLA
 BCS L18AF 
 ADDB 3,X
 ADCA 2,X
 BCS L18AF 
 ADDB 1,X
 ADCA #0
 BCS L18AF 
 STAA 2,X
 STAB 3,X
 DEC 0,X
 BRA L1862 
L189C PULA
 CMPA #DIGITS
 BEQ L18B0 
 INS 
 PULA
 PULB
 TST 4,X
 BEQ L18AC 
 NEGA
 NEGB
 SBCA #0
L18AC INS 
 CLC 
 RTS 
L18AF INS 
L18B0 INS 
 INS 
 INS 
 INS 
 CLRA
 CLRB
 SEC 
 RTS 
SUBG12 LDAB #$20
L18BA BSR L18C7 
 BCC L18C4 
 STAA 0,X
 INX 
 DECB
 BNE L18BA 
L18C4 CLR 0,X
 RTS 
L18C7 STX XTEMP1
 LDX VARC
 LDAA 0,X
 BEQ L18D8 
 CMPA #','
 BEQ L18D7 
 BSR L18D7 
 SEC 
 RTS 
L18D7 INX 
L18D8 STX VARC
 LDX XTEMP1
 CLC 
 RTS 
* READ TAPE RECORD *
SUBG13 JSR RDON
 LDX SAVGET
ZREC2 JSR GETCHR
 CMPA #2
 BNE ZREC2
 CLRB
ZREC3 JSR GETCHR
 CMPA #3
 BEQ ZREC4
 STAA 0,X
 INX 
 INCB
 CMPB #128
 BCS ZREC3
ZREC4 CLR 0,X
 JSR RDOFF
 COM PORECH
 RTS
* READ TERMINAL INPUT LINE *
SUBG14 LDAA #'?'
 JSR PUTCHR
 JSR OUTSPC
ZRDBUF STX VARC
 STX PC
 LDAB #128
ZRBUF2 JSR GETCHR
 CMPA #8
 BNE CHKDEL
 CPX PC
 BEQ LINKIL
 DEX
 BRA ZRBUF2
CHKDEL CMPA #$18
 BNE ZRBUF4
LINKIL LDAA #'@'
 JSR PUTCHR
 BSR ZRLIN3
 LDX PC
 BRA ZRDBUF
ZRBUF4 STAA 0,X
 CMPA #$D
 BNE ZRBUF5
 CLR 0,X
ZRLIN3 LDAA #1
 STAA ARRAYF
 JMP PCRLF
ZRBUF5 TSTB
 BEQ ZRBUF2
 INX 
 DECB
 BRA ZRBUF2
* GROUP 3 MULTIPLY *
MULTY PSHB
L195B PSHA
 LDAB 1,X
 PSHB
 CLRB
 LDAA 0,X
 BPL L196B 
 INCB
 TSX 
 NEGA
 NEG 0,X
 SBCA #0
L196B PSHA
 PSHB
 LDAB #$10
 PSHB
 TSX 
 LDAA 4,X
 BPL L197E 
 NEGA
 NEG 5,X
 SBCA #0
 STAA 4,X
 INC 1,X
L197E CLRA
 CLRB
 ROR 2,X
 ROR 3,X
L1984 BCC L198A 
 ADDB 5,X
 ADCA 4,X
L198A RORA
 RORB
 ROR 2,X
 ROR 3,X
 DEC 0,X
 BNE L1984 
 TSTA
 BNE L19A8 
 TSTB
 BNE L19A8 
 LDAA 2,X
 LDAB 3,X
 ROR 1,X
 BCC L19C7 
 NEGA
 NEGB
 SBCA #0
 BRA L19C7 
L19A8 ROR 1,X
 BCC L19BE 
 COM 3,X
 COM 2,X
 COMB
 COMA
 INC 3,X
 BNE L19BE 
 INC 2,X
 BNE L19BE 
 ADDB #1
 ADCA #0
L19BE STAA L002B 
 STAB L002C 
 LDAB 3,X
 LDAA 2,X
 SEC 
L19C7 INS 
 INS 
 INS 
 INS 
 INS 
 INS 
 RTS 
* GROUP 4 DIVIDE *
DIVIDE PSHB
 PSHA
 LDAB 1,X
 PSHB
 CLRB
 LDAA 0,X
 BPL L19DF 
 INCB
 TSX 
 NEGA
 NEG 0,X
 SBCA #0
L19DF PSHA
 PSHB
 DES 
 TSX 
 LDAB 3,X
 TSTA
 BNE L19EE 
 TSTB
 BNE L19EE 
 SEC 
 BRA L1A3D 
L19EE TST 4,X
 BPL L19FC 
 NEG 4,X
 NEG 5,X
 BCC L19FA 
 DEC 4,X
L19FA INC 1,X
L19FC LDAA #1
 TST 2,X
 BMI L1A0D 
L1A02 INCA
 ASL 3,X
 ROL 2,X
 BMI L1A0D 
 CMPA #$11
 BNE L1A02 
L1A0D STAA 0,X
 LDAA 4,X
 LDAB 5,X
 CLR 4,X
 CLR 5,X
L1A17 SUBB 3,X
 SBCA 2,X
 BCC L1A24 
 ADDB 3,X
 ADCA 2,X
 CLC 
 BRA L1A25 
L1A24 SEC 
L1A25 ROL 5,X
 ROL 4,X
 LSR 2,X
 ROR 3,X
 DEC 0,X
 BNE L1A17 
 LDAA 4,X
 LDAB 5,X
 ROR 1,X
 BCC L1A3D 
 NEGA
 NEGB
 SBCA #0
L1A3D INS 
 INS 
 INS 
 INS 
 INS 
 INS 
 RTS 
* GROUP 6 RANDOM *
LRND LDAA 1,X
 ASLA
 ADDA 0,X
 LDAB 1,X
 ASLB
 ROLA
 ASLB
 ROLA
 ADDB 1,X
 ADCA 0,X
 ADDB #$19
 ADCA #$36
 LSRA
 RORB
 STAA 0,X
 STAB 1,X
 RTS 
* GROUP 7 STRINGS *
SUBG71 EQU *
STRING LDX STRPNT
 STX XRTEMP
 TSX 
 LDAA XRTEMP
 STAA 2,X
 LDAA L002A 
 STAA 3,X
 RTS 
SUBG72 TSX
 LDX 2,X
 RTS 
LLEN CLRB
L1A71 TST 0,X
 BEQ L1A79 
 INX 
 INCB
 BRA L1A71 
L1A79 CLRA
 RTS 
SUBG74 TSX
 LDX 2,X
 BSR LLEN
L1A80 TSTB
 BEQ L1AE9 
 DEX 
 LDAA 0,X
 CMPA #$20
 BNE L1AE9 
 CLR 0,X
 DECB
 BRA L1A80 
SUBG75 LDAB #$80
 BSR L1A98 
 CLR 0,X
 RTS 
SUBG76 LDAB #$20
L1A98 STX XRTEMP
 LDX STRPNT
 LDAA 0,X
 INX 
 STX STRPNT
 LDX XRTEMP
 STAA 0,X
 BEQ RETM
 INX 
 DECB
 BNE L1A98 
RETM RTS
LRIGHT TSX
 LDX 2,X
 STX STRPNT
 PSHB
 BSR LLEN
 TBA 
 PULB
 BEQ L1AE9 
 SBA 
 BLS L1AE9 
 INCA
 LDX STRPNT
 BRA L1AC3 
LMID TSX
 LDX 2,X
L1AC3 STX STRPNT
 TSTA
 BEQ L1AE9 
L1AC8 TST 0,X
 BEQ SUB711
 DECA
 BEQ L1AD2 
 INX 
 BRA L1AC8 
L1AD2 TSTB
 BEQ SUB711
 BSR L1B01 
 BRA L1AED 
L1AD9 BRA LLEN
LLEFT TSX
 LDX 2,X
L1ADE TSTB
 BEQ L1AE9 
 LDAA 0,X
 BEQ L1AE9 
 INX 
 DECB
 BRA L1ADE 
L1AE9 STX STRPNT
 CLR 0,X
L1AED TSX 
 LDX 0,X
 INS 
 INS 
 INS 
 INS 
 JMP 0,X
SUB710 LDAB #$80
 BRA L1B01
SUB711 TSX
 LDX 2,X
 BRA L1AE9
SUB712 LDAB #$20
L1B01 LDAA 0,X
 BSR L1B0D 
 TSTA
 BEQ RETN
 INX 
 DECB
 BNE L1B01 
L1B0C TBA 
L1B0D STX XRTEMP
 LDX STRPNT
 STAA 0,X
 BEQ L1B16 
L1B15 INX 
L1B16 STX STRPNT
 LDX XRTEMP
RETN RTS
LCHR BSR L1B0C
 CLRA
 BRA L1B0D
SUB714 LDX STRPNT
 CLR 0,X
 BRA L1B15
SUB715 LDAB #1
 STAB LREFB
 STX STRPNT
 BSR L1AD9 
 TSTB
 BEQ L1B5B 
 STAB L002C 
 LDX XTEMP1
 BSR L1AD9 
L1B37 STAB L002B 
 LDAB L002C 
 CMPB L002B 
 BLS L1B42 
 CLRB
 CLRA
 RTS 
L1B42 LDX STRPNT
 STX XRTEMP
 LDX XTEMP1
L1B48 STX L002D 
 LDX XRTEMP
 LDAA 0,X
 INX 
 STX XRTEMP
 LDX L002D 
 CMPA 0,X
 BNE L1B5F 
 INX 
 DECB
 BNE L1B48 
L1B5B LDAB LREFB
 CLRA
 RTS 
L1B5F LDX XTEMP1
 INX 
 STX XTEMP1
 INC LREFB
 LDAB L002B
 DECB
 BRA L1B37
SUB716 STX STRPNT
 LDX XTEMP1
 LDAA 0,X
 BEQ L1B83 
 INX 
 STX XTEMP1
 LDX STRPNT
 LDAB 0,X
 BEQ L1B81 
 INX 
 CBA 
 BEQ SUB716
L1B81 CLC 
 RTS 
L1B83 LDX STRPNT
 TST 0,X
 BNE L1B81 
 SEC 
 RTS 
SUB717 PSHA
 BSR L1BB2 
 LDX STRPNT
 STX VARC
 PULA
 BSR L1BBE+3
 LDX VARC
 STX STRPNT
 CLR 0,X
 BRA L1BA7 
SUB718 STX XRTEMP
 BSR L1BB2 
 LDX XRTEMP
 STX VARC
 BSR L1BBE 
L1BA7 PSHA
 LDAA L002B 
 STAA ARRAYF
 LDX L002D 
 STX VARC
 PULA
 RTS 
L1BB2 LDAA ARRAYF
 STAA L002B 
 CLR ARRAYF
 LDX VARC
 STX L002D 
 RTS
L1BBE RMB 73
L1C07 RMB 112
STK RMB 1
TAPBUF RMB 256
OBJBUF RMB 256
BFCB RMB 320
LINBUF RMB 128
L1D41 RMB 1
LREFT RMB 3000*4
LREFTE EQU *
SYMBT RMB 1500*6
SYMBTE EQU *
 END BASIC
