2018-01-10 16:34:57 +00:00
|
|
|
|
NEW
|
2019-05-02 09:52:32 +00:00
|
|
|
|
AUTO 3,1
|
2018-03-28 15:23:32 +00:00
|
|
|
|
.LIST OFF
|
|
|
|
|
.OP 65C02
|
|
|
|
|
.OR $2000
|
2020-02-23 20:01:48 +00:00
|
|
|
|
.TF bin/asm
|
2019-03-25 07:04:40 +00:00
|
|
|
|
*---------------------------------------
|
|
|
|
|
PAGE.LEN .EQ 23
|
2019-04-01 06:07:56 +00:00
|
|
|
|
DO.MAXDEPTH .EQ 8
|
|
|
|
|
IN.MAXDEPTH .EQ 4
|
|
|
|
|
MA.MAXDEPTH .EQ 8
|
2015-03-14 21:47:37 +00:00
|
|
|
|
*---------------------------------------
|
2018-07-23 15:28:42 +00:00
|
|
|
|
.INB INC/MACROS.I
|
|
|
|
|
.INB INC/A2OSX.I
|
2020-02-23 20:01:48 +00:00
|
|
|
|
.INB INC/MLI.I
|
2019-03-25 07:04:40 +00:00
|
|
|
|
.INB INC/MLI.E.I
|
2015-03-14 21:47:37 +00:00
|
|
|
|
*---------------------------------------
|
2019-03-19 16:52:08 +00:00
|
|
|
|
.DUMMY
|
|
|
|
|
.OR ZPBIN
|
|
|
|
|
ZS.START
|
2019-03-25 07:04:40 +00:00
|
|
|
|
ZPTmpBuf .BS 2
|
2019-03-20 16:55:26 +00:00
|
|
|
|
ZPLineBuf .BS 2
|
|
|
|
|
ZPLinePtr .BS 2
|
2019-03-29 16:21:30 +00:00
|
|
|
|
ZPSymbolBuf .BS 2
|
2018-03-28 15:23:32 +00:00
|
|
|
|
|
2019-03-20 16:55:26 +00:00
|
|
|
|
ZPAMPtr .BS 2
|
|
|
|
|
ZPRPtr .BS 2
|
|
|
|
|
ZPOpsPtr .BS 2
|
|
|
|
|
ZPOpDefPtr .BS 2
|
|
|
|
|
|
2020-02-23 20:01:48 +00:00
|
|
|
|
ZPMacroStk .BS 2
|
|
|
|
|
ZPMacroBuf .BS 2
|
|
|
|
|
ZPMacroArgBuf .BS 2
|
2020-02-24 16:37:55 +00:00
|
|
|
|
ZPMacroArgCnt .BS 1
|
2020-02-23 20:01:48 +00:00
|
|
|
|
|
2020-02-27 16:46:40 +00:00
|
|
|
|
DIR.Byte .BS 1
|
|
|
|
|
|
|
|
|
|
DIR.Word .BS 2
|
2020-02-23 20:01:48 +00:00
|
|
|
|
ZPPtr1 .BS 2
|
|
|
|
|
ZPPtr2 .BS 2
|
|
|
|
|
|
2019-03-19 16:52:08 +00:00
|
|
|
|
ZS.END .ED
|
2015-10-06 16:14:48 +00:00
|
|
|
|
*---------------------------------------
|
2019-01-29 16:42:06 +00:00
|
|
|
|
* Symbols
|
|
|
|
|
*---------------------------------------
|
2019-03-20 16:55:26 +00:00
|
|
|
|
SYMG.F .EQ 0
|
2020-03-02 06:53:19 +00:00
|
|
|
|
SYMG.F.RW .EQ %10000000
|
2020-03-06 06:56:36 +00:00
|
|
|
|
SYMG.F.EQU .EQ %01000000
|
|
|
|
|
SYMG.F.LOCALS .EQ %00100000
|
|
|
|
|
SYMG.F.FWREF .EQ %00010000
|
2019-03-20 16:55:26 +00:00
|
|
|
|
SYMG.SIZE .EQ 1 1,2,3,4
|
2020-02-26 16:34:13 +00:00
|
|
|
|
SYMG.V .EQ 2 DWORD
|
2018-03-23 15:57:35 +00:00
|
|
|
|
*
|
2020-02-26 16:34:13 +00:00
|
|
|
|
SYMG .EQ 6
|
2018-03-22 16:45:23 +00:00
|
|
|
|
*---------------------------------------
|
2019-01-29 16:42:06 +00:00
|
|
|
|
SYML.ID .EQ 0 1..255
|
2020-02-26 16:34:13 +00:00
|
|
|
|
SYML.CtxID .EQ 1 0 if local, !0 if private
|
2019-03-29 16:21:30 +00:00
|
|
|
|
SYML.V .EQ 2 DWORD
|
2018-03-23 15:57:35 +00:00
|
|
|
|
*
|
2019-03-29 16:21:30 +00:00
|
|
|
|
SYML .EQ 6
|
2018-04-06 15:10:02 +00:00
|
|
|
|
*---------------------------------------
|
2018-03-28 15:23:32 +00:00
|
|
|
|
ASM.T.AM .EQ 0
|
|
|
|
|
ASM.T.R .EQ 2
|
|
|
|
|
ASM.T.O .EQ 4
|
2015-10-28 16:55:12 +00:00
|
|
|
|
*---------------------------------------
|
2019-03-25 07:04:40 +00:00
|
|
|
|
E.SYNTAX.ERROR .EQ $A0
|
|
|
|
|
E.SYM.TOO.LONG .EQ $A1
|
2019-04-01 06:07:56 +00:00
|
|
|
|
E.VAL.TOO.BIG .EQ $A2
|
2019-03-25 07:04:40 +00:00
|
|
|
|
E.LINE.TOO.LONG .EQ $A3
|
|
|
|
|
E.INV.LABEL .EQ $A4
|
2019-04-01 06:07:56 +00:00
|
|
|
|
E.INV.DIR .EQ $A5
|
2020-02-25 07:28:30 +00:00
|
|
|
|
E.ILLEGAL.DIR .EQ $A6
|
|
|
|
|
E.INV.OPCODE .EQ $A7
|
|
|
|
|
E.INV.AM.SYN .EQ $A8
|
|
|
|
|
E.INV.AM .EQ $A9
|
|
|
|
|
E.INV.AM.4.OC .EQ $AA
|
|
|
|
|
E.RANGE .EQ $AB
|
|
|
|
|
E.UNDEF.SYMBOL .EQ $AC
|
|
|
|
|
E.SYMBOL.REDEF .EQ $AD
|
|
|
|
|
E.TOO.MANY.DO .EQ $AE
|
|
|
|
|
E.ELSE.WITHOUT.DO .EQ $AF
|
|
|
|
|
E.TOO.MANY.LOCAL .EQ $B0
|
|
|
|
|
E.MISSING.EXP .EQ $B1
|
|
|
|
|
E.EXP.SYN.ERROR .EQ $B2
|
|
|
|
|
E.MACRO.INV.DEF .EQ $B3
|
|
|
|
|
E.MACRO.TOO.BIG .EQ $B4
|
|
|
|
|
E.MACRO.INV .EQ $B5
|
|
|
|
|
E.MACRO.TOO.MANY .EQ $B6
|
2019-03-25 07:04:40 +00:00
|
|
|
|
*
|
2020-03-06 16:20:29 +00:00
|
|
|
|
E.OUT.OF.SYNC .EQ $B8
|
2020-03-04 06:39:08 +00:00
|
|
|
|
E.INV.SYM .EQ $B9
|
2019-03-25 07:04:40 +00:00
|
|
|
|
E.INV.ARGS .EQ $BA
|
2020-03-06 16:20:29 +00:00
|
|
|
|
E.INV.CPU.FILE .EQ $BC
|
2019-03-25 07:04:40 +00:00
|
|
|
|
E.SRC.INV.TYPE .EQ $BD
|
|
|
|
|
E.SRC.TOO.MANY.IN .EQ $BE
|
|
|
|
|
E.SRC.UNEXP.EOF .EQ $BF
|
2015-08-05 20:38:05 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* File Header (16 Bytes)
|
|
|
|
|
*--------------------------------------
|
2018-03-28 15:23:32 +00:00
|
|
|
|
CS.START cld
|
|
|
|
|
jmp (.1,x)
|
|
|
|
|
.DA #$61 6502,Level 1 (65c02)
|
|
|
|
|
.DA #1 BIN Layout Version 1
|
2020-02-23 20:01:48 +00:00
|
|
|
|
.DA #0 S.PS.F.EVENT
|
2018-11-26 21:52:49 +00:00
|
|
|
|
.DA #0
|
2018-03-28 15:23:32 +00:00
|
|
|
|
.DA CS.END-CS.START CS
|
|
|
|
|
.DA DS.END-DS.START DS
|
2020-02-23 20:01:48 +00:00
|
|
|
|
.DA #64 SS
|
|
|
|
|
.DA #ZS.END-ZS.START ZP
|
2018-03-28 15:23:32 +00:00
|
|
|
|
.DA 0
|
2015-08-05 20:38:05 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Relocation Table
|
|
|
|
|
*--------------------------------------
|
2018-03-28 15:23:32 +00:00
|
|
|
|
.1 .DA CS.INIT
|
|
|
|
|
.DA CS.RUN
|
|
|
|
|
.DA CS.DOEVENT
|
|
|
|
|
.DA CS.QUIT
|
|
|
|
|
L.MSG.HELP .DA MSG.HELP
|
2020-03-02 06:53:19 +00:00
|
|
|
|
L.MSG.CRLF .DA MSG.CRLF
|
2018-03-28 15:23:32 +00:00
|
|
|
|
L.MSG.OUT0 .DA MSG.OUT0
|
|
|
|
|
.DA MSG.OUT1
|
|
|
|
|
.DA MSG.OUT2
|
|
|
|
|
.DA MSG.OUT3
|
|
|
|
|
L.MSG.EQU0 .DA MSG.EQU0
|
|
|
|
|
.DA MSG.EQU1
|
|
|
|
|
.DA MSG.EQU2
|
|
|
|
|
.DA MSG.EQU3
|
|
|
|
|
.DA MSG.EQU4
|
2019-03-25 07:04:40 +00:00
|
|
|
|
L.MSG.PASS .DA MSG.PASS
|
2019-04-01 06:07:56 +00:00
|
|
|
|
L.MSG.LINENUM .DA MSG.LINENUM
|
2018-03-28 15:23:32 +00:00
|
|
|
|
L.MSG.ERROR .DA MSG.ERROR
|
|
|
|
|
L.MSG.SYMBOLS .DA MSG.SYMBOLS
|
2019-03-25 07:04:40 +00:00
|
|
|
|
L.MSG.LSYMBOL .DA MSG.LSYMBOL
|
2019-04-01 06:07:56 +00:00
|
|
|
|
L.MSG.PSYMBOL .DA MSG.PSYMBOL
|
2018-03-28 15:23:32 +00:00
|
|
|
|
L.MSG.SUMMARY .DA MSG.SUMMARY
|
2019-03-25 07:04:40 +00:00
|
|
|
|
L.MSG.END .DA MSG.END
|
2020-03-02 06:53:19 +00:00
|
|
|
|
L.MSG.DEBUG .DA MSG.DEBUG
|
2018-03-28 15:23:32 +00:00
|
|
|
|
L.MSG.SRC.FILE .DA MSG.SRC.FILE
|
|
|
|
|
L.MSG.OBJ.FILE .DA MSG.OBJ.FILE
|
|
|
|
|
L.MSG.T.FILE .DA MSG.T.FILE
|
|
|
|
|
L.SRC.AM.StrBuf .DA SRC.AM.StrBuf
|
|
|
|
|
L.ASM.6502 .DA ASM.6502
|
2020-02-23 20:01:48 +00:00
|
|
|
|
L.ASM.CPU.FILE .DA ASM.CPU.FILE
|
2019-03-20 16:55:26 +00:00
|
|
|
|
L.SRC.ACC.F .DA SRC.ACC.F
|
2020-02-23 20:46:25 +00:00
|
|
|
|
L.SRC.ACC .DA SRC.ACC
|
|
|
|
|
L.SRC.ARG .DA SRC.ARG
|
2018-03-28 15:23:32 +00:00
|
|
|
|
L.T.DIRECTIVES .DA T.DIRECTIVES
|
|
|
|
|
J.DIRECTIVES .DA DIR.AC
|
|
|
|
|
.DA DIR.AS
|
|
|
|
|
.DA DIR.AT
|
|
|
|
|
.DA DIR.AZ
|
|
|
|
|
.DA DIR.BS
|
|
|
|
|
.DA DIR.DA
|
|
|
|
|
.DA DIR.DO
|
|
|
|
|
.DA DIR.DU
|
|
|
|
|
.DA DIR.DU
|
|
|
|
|
.DA DIR.ED
|
|
|
|
|
.DA DIR.EL
|
|
|
|
|
.DA DIR.EM
|
|
|
|
|
.DA DIR.EN
|
|
|
|
|
.DA DIR.EP
|
|
|
|
|
.DA DIR.EQ
|
|
|
|
|
.DA DIR.FI
|
|
|
|
|
.DA DIR.HS
|
|
|
|
|
.DA DIR.IN
|
|
|
|
|
.DA DIR.IN
|
|
|
|
|
.DA DIR.IN
|
|
|
|
|
.DA DIR.IN
|
|
|
|
|
.DA DIR.IN
|
|
|
|
|
.DA DIR.IN
|
|
|
|
|
.DA DIR.IN
|
|
|
|
|
.DA DIR.IN
|
|
|
|
|
.DA DIR.IN
|
|
|
|
|
.DA DIR.IN
|
|
|
|
|
.DA DIR.IN
|
|
|
|
|
.DA DIR.LI
|
|
|
|
|
.DA DIR.LI
|
|
|
|
|
.DA DIR.MA
|
|
|
|
|
.DA DIR.OP
|
|
|
|
|
.DA DIR.OR
|
|
|
|
|
.DA DIR.PG
|
|
|
|
|
.DA DIR.PH
|
|
|
|
|
.DA DIR.SE
|
|
|
|
|
.DA DIR.TA
|
|
|
|
|
.DA DIR.TF
|
|
|
|
|
.DA DIR.TI
|
|
|
|
|
.DA DIR.US
|
|
|
|
|
L.T.LI .DA T.LI
|
|
|
|
|
J.LI .DA DIR.LI.ON
|
|
|
|
|
.DA DIR.LI.OFF
|
|
|
|
|
.DA DIR.LI.CON
|
|
|
|
|
.DA DIR.LI.COFF
|
|
|
|
|
.DA DIR.LI.MON
|
|
|
|
|
.DA DIR.LI.MOFF
|
|
|
|
|
.DA DIR.LI.XON
|
|
|
|
|
.DA DIR.LI.XOFF
|
|
|
|
|
J.EXP.MOD .DA EXP.MOD.8.1 #/^<>
|
|
|
|
|
.DA EXP.MOD.8.2
|
|
|
|
|
.DA EXP.MOD.8.3
|
|
|
|
|
.DA EXP.MOD.24
|
|
|
|
|
.DA EXP.MOD.32
|
|
|
|
|
J.EXP.OP .DA EXP.OP.EOR ^!|&<=>+-*/
|
|
|
|
|
.DA EXP.OP.ORA
|
|
|
|
|
.DA EXP.OP.ORA
|
|
|
|
|
.DA EXP.OP.AND
|
|
|
|
|
.DA EXP.OP.LOW
|
|
|
|
|
.DA EXP.OP.EQU
|
|
|
|
|
.DA EXP.OP.GRT
|
|
|
|
|
.DA EXP.OP.ADD
|
|
|
|
|
.DA EXP.OP.SUB
|
|
|
|
|
.DA EXP.OP.MUL
|
|
|
|
|
.DA EXP.OP.DIV
|
|
|
|
|
.DA 0
|
2015-03-14 21:47:37 +00:00
|
|
|
|
*---------------------------------------
|
2020-02-26 16:34:13 +00:00
|
|
|
|
CS.INIT jsr CS.RUN.ARGS
|
2020-02-25 16:42:22 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
jsr FIO.Init
|
|
|
|
|
bcs .9
|
2017-07-07 15:13:55 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
jsr SYM.Init
|
|
|
|
|
bcs .9
|
2017-07-07 15:13:55 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
jsr MAC.Init
|
|
|
|
|
bcs .9
|
2020-02-23 20:01:48 +00:00
|
|
|
|
|
2020-03-10 07:24:08 +00:00
|
|
|
|
jmp OUT.Init
|
2020-02-23 20:01:48 +00:00
|
|
|
|
|
2020-02-26 16:34:13 +00:00
|
|
|
|
.99 pha
|
|
|
|
|
>PUSHW L.MSG.HELP
|
2020-02-23 20:01:48 +00:00
|
|
|
|
>PUSHBI 0
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL PrintF
|
2020-02-26 16:34:13 +00:00
|
|
|
|
pla
|
2018-03-28 15:23:32 +00:00
|
|
|
|
sec
|
2019-03-18 16:48:16 +00:00
|
|
|
|
.9 rts
|
2015-03-14 21:47:37 +00:00
|
|
|
|
*--------------------------------------
|
2020-02-26 16:34:13 +00:00
|
|
|
|
CS.RUN.ARGS ldy #S.PS.ARGC
|
2020-02-28 07:21:46 +00:00
|
|
|
|
lda (pPS),y
|
2020-02-26 16:34:13 +00:00
|
|
|
|
beq .90
|
2020-02-25 16:42:22 +00:00
|
|
|
|
|
2020-02-26 16:34:13 +00:00
|
|
|
|
.1 inc ZPPtr1
|
|
|
|
|
|
|
|
|
|
lda ZPPtr1
|
2020-02-25 16:42:22 +00:00
|
|
|
|
>SYSCALL ArgV
|
2020-02-26 16:34:13 +00:00
|
|
|
|
bcs .8
|
|
|
|
|
>STYA ZPPtr2
|
|
|
|
|
|
|
|
|
|
lda (ZPPtr2)
|
|
|
|
|
cmp #'-'
|
|
|
|
|
beq .2
|
|
|
|
|
|
|
|
|
|
>PUSHW ZPPtr2
|
2020-02-25 16:42:22 +00:00
|
|
|
|
>PUSHWI 0 Allocate
|
|
|
|
|
>SYSCALL RealPath
|
2020-02-26 16:34:13 +00:00
|
|
|
|
bcs .99
|
2020-02-25 16:42:22 +00:00
|
|
|
|
txa
|
|
|
|
|
>STA.G SRC.hFILENAME
|
2020-02-26 16:34:13 +00:00
|
|
|
|
bra .1
|
|
|
|
|
|
|
|
|
|
.2 ldy #1
|
|
|
|
|
lda (ZPPtr2),y
|
|
|
|
|
cmp #'L'
|
|
|
|
|
bne .3
|
|
|
|
|
|
|
|
|
|
lda #$ff
|
|
|
|
|
>STA.G bListAll
|
|
|
|
|
bra .1
|
|
|
|
|
|
|
|
|
|
.3 cmp #'T'
|
|
|
|
|
bne .90
|
|
|
|
|
|
|
|
|
|
inc ZPPtr1
|
|
|
|
|
lda ZPPtr1
|
|
|
|
|
>SYSCALL ArgV
|
|
|
|
|
bcs .90
|
|
|
|
|
|
|
|
|
|
lda ZPPtr1
|
|
|
|
|
>STA.G ArgDstFile
|
|
|
|
|
bra .1
|
2020-02-25 16:42:22 +00:00
|
|
|
|
|
2020-02-26 16:34:13 +00:00
|
|
|
|
.8 >LDA.G SRC.hFILENAME
|
|
|
|
|
beq .90
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.90 lda #E.INV.ARGS
|
|
|
|
|
sec
|
|
|
|
|
.99 rts
|
2020-02-25 16:42:22 +00:00
|
|
|
|
*--------------------------------------
|
2019-03-18 16:48:16 +00:00
|
|
|
|
CS.RUN ldy #S.PS.hStdIn
|
|
|
|
|
lda (pPS),y
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL FEOF
|
2019-03-18 16:48:16 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
tay
|
2019-05-02 09:52:32 +00:00
|
|
|
|
bne .13
|
2019-03-18 16:48:16 +00:00
|
|
|
|
|
|
|
|
|
>SYSCALL GetChar
|
|
|
|
|
bcs .99
|
2018-03-28 15:23:32 +00:00
|
|
|
|
|
2018-04-06 15:10:02 +00:00
|
|
|
|
cmp #$03 Ctrl-C
|
|
|
|
|
beq .99 Abort....beq=CS
|
2020-02-23 20:01:48 +00:00
|
|
|
|
|
2018-04-06 15:10:02 +00:00
|
|
|
|
cmp #$13 Ctrl-S
|
2018-03-28 15:23:32 +00:00
|
|
|
|
bne .11
|
|
|
|
|
|
2018-04-06 15:10:02 +00:00
|
|
|
|
>LDA.G bPause
|
2018-03-28 15:23:32 +00:00
|
|
|
|
eor #$ff
|
|
|
|
|
sta (pData),y
|
|
|
|
|
|
2018-04-06 15:10:02 +00:00
|
|
|
|
bpl .12
|
2020-02-23 20:01:48 +00:00
|
|
|
|
|
2018-04-06 15:10:02 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
2020-02-23 20:01:48 +00:00
|
|
|
|
|
2018-04-06 15:10:02 +00:00
|
|
|
|
.13 >LDA.G bPause
|
2018-11-26 21:52:49 +00:00
|
|
|
|
bpl .11
|
2020-02-23 20:01:48 +00:00
|
|
|
|
|
2018-11-26 21:52:49 +00:00
|
|
|
|
clc
|
2019-03-18 16:48:16 +00:00
|
|
|
|
.99 rts
|
2020-02-23 20:01:48 +00:00
|
|
|
|
|
2018-04-06 15:10:02 +00:00
|
|
|
|
.11 >STZ.G bPause
|
|
|
|
|
|
2020-02-24 13:33:28 +00:00
|
|
|
|
.12 >LDA.G SRC.Depth root file is already opened?
|
2018-03-28 15:23:32 +00:00
|
|
|
|
bne .10
|
2020-02-23 20:01:48 +00:00
|
|
|
|
|
|
|
|
|
>PUSHW L.MSG.PASS
|
2018-03-28 15:23:32 +00:00
|
|
|
|
>LDA.G ASM.PASS
|
|
|
|
|
inc
|
|
|
|
|
>PUSHA
|
2018-11-26 21:52:49 +00:00
|
|
|
|
>PUSHBI 1
|
2018-03-28 15:23:32 +00:00
|
|
|
|
jsr OUT.Print
|
2020-02-23 20:01:48 +00:00
|
|
|
|
|
|
|
|
|
>LDA.G SRC.hFILENAME
|
2018-07-18 15:30:42 +00:00
|
|
|
|
>SYSCALL GetMemPtr
|
2018-03-28 15:23:32 +00:00
|
|
|
|
jsr FIO.OpenFile
|
|
|
|
|
bcs .99
|
2020-02-23 20:01:48 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
jsr DIR.Reset
|
2020-03-02 16:49:47 +00:00
|
|
|
|
|
|
|
|
|
>STZ.G MAC.StkPtr
|
|
|
|
|
>STZ.G SYM.BufPtr
|
2020-02-27 16:46:40 +00:00
|
|
|
|
|
2019-03-29 16:21:30 +00:00
|
|
|
|
.10 >LDYA ZPLineBuf
|
|
|
|
|
>STYA ZPLinePtr
|
2020-02-23 20:01:48 +00:00
|
|
|
|
|
2019-03-29 16:21:30 +00:00
|
|
|
|
>LDA.G MAC.StkPtr
|
|
|
|
|
beq .20
|
2020-02-23 20:01:48 +00:00
|
|
|
|
|
|
|
|
|
.15 jsr MAC.ReadLine
|
2019-03-29 16:21:30 +00:00
|
|
|
|
bcc .2
|
2020-02-23 20:01:48 +00:00
|
|
|
|
|
2019-05-12 20:45:11 +00:00
|
|
|
|
cmp #E.EMPTYKEY
|
2019-03-29 16:21:30 +00:00
|
|
|
|
bne .9
|
2020-02-23 20:01:48 +00:00
|
|
|
|
|
|
|
|
|
jsr MAC.Pop
|
|
|
|
|
bne .15
|
|
|
|
|
|
2019-03-29 16:21:30 +00:00
|
|
|
|
.20 jsr FIO.ReadLine
|
2018-03-28 15:23:32 +00:00
|
|
|
|
bcc .2
|
2020-02-23 20:01:48 +00:00
|
|
|
|
|
2019-03-25 07:04:40 +00:00
|
|
|
|
cmp #MLI.E.EOF End Of File?
|
2018-03-28 15:23:32 +00:00
|
|
|
|
bne .9
|
2020-02-23 20:01:48 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
jsr FIO.FileClose
|
2020-02-24 13:33:28 +00:00
|
|
|
|
>LDA.G SRC.Depth end of root file ?
|
2019-03-25 07:04:40 +00:00
|
|
|
|
bne .8 no continue back to previous file
|
|
|
|
|
|
|
|
|
|
jsr SYM.StoreGlobal Make sure last Global flushed
|
2020-02-26 16:34:13 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
2019-03-25 07:04:40 +00:00
|
|
|
|
>LDA.G ASM.PASS End of pass #2 ??
|
2018-03-28 15:23:32 +00:00
|
|
|
|
bne .1
|
|
|
|
|
inc
|
|
|
|
|
sta (pData),y
|
2020-02-26 16:34:13 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
clc
|
2019-03-18 16:48:16 +00:00
|
|
|
|
rts
|
2020-02-23 20:01:48 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
.1 jsr SYM.Dump
|
2019-03-19 16:52:08 +00:00
|
|
|
|
|
2019-03-25 07:04:40 +00:00
|
|
|
|
>LDYA L.MSG.END
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL PutS
|
2019-03-25 07:04:40 +00:00
|
|
|
|
lda #0 End of assembly, exit with no error
|
2018-03-28 15:23:32 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
2020-02-23 20:01:48 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
.2 jsr SRC.ParseLine
|
|
|
|
|
bcs .9
|
2020-02-23 20:01:48 +00:00
|
|
|
|
|
2019-03-26 12:17:47 +00:00
|
|
|
|
jsr OUT.PrintLine
|
2020-02-24 13:33:28 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
2015-10-02 16:04:30 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
.9 pha
|
|
|
|
|
jsr OUT.PrintLineErr
|
|
|
|
|
pla
|
|
|
|
|
sec
|
|
|
|
|
rts
|
2015-08-05 20:38:05 +00:00
|
|
|
|
*--------------------------------------
|
2018-03-28 15:23:32 +00:00
|
|
|
|
CS.DOEVENT sec
|
|
|
|
|
rts
|
2015-08-05 20:38:05 +00:00
|
|
|
|
*--------------------------------------
|
2020-02-29 14:06:28 +00:00
|
|
|
|
CS.QUIT >LDA.G SRC.Depth
|
2020-02-26 16:34:13 +00:00
|
|
|
|
beq .1
|
|
|
|
|
|
2020-02-29 14:06:28 +00:00
|
|
|
|
jsr FIO.FileClose
|
|
|
|
|
bra CS.QUIT
|
|
|
|
|
|
|
|
|
|
.1 >LDA.G DST.hREFNUM
|
|
|
|
|
beq .2
|
|
|
|
|
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL FClose
|
2020-02-26 16:34:13 +00:00
|
|
|
|
|
2020-02-29 14:06:28 +00:00
|
|
|
|
.2 jsr MAC.Quit
|
2020-02-23 20:01:48 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
jsr SYM.Quit
|
2020-02-23 20:01:48 +00:00
|
|
|
|
|
2020-02-27 16:46:40 +00:00
|
|
|
|
ldy #ASM.hCPUFILE
|
2020-02-23 20:01:48 +00:00
|
|
|
|
jsr .7
|
|
|
|
|
|
|
|
|
|
ldy #SRC.hFILENAME
|
|
|
|
|
jsr .7
|
|
|
|
|
|
2020-02-26 16:34:13 +00:00
|
|
|
|
ldy #DST.hFILENAME
|
|
|
|
|
jsr .7
|
|
|
|
|
|
2020-02-23 20:01:48 +00:00
|
|
|
|
ldy #SRC.hLineBuf
|
|
|
|
|
jsr .7
|
|
|
|
|
|
|
|
|
|
ldy #SRC.hTmpBuf
|
|
|
|
|
|
|
|
|
|
.7 lda (pData),y
|
2018-03-28 15:23:32 +00:00
|
|
|
|
beq .8
|
2018-07-18 15:30:42 +00:00
|
|
|
|
>SYSCALL FreeMem
|
2018-03-28 15:23:32 +00:00
|
|
|
|
|
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
2015-08-05 20:38:05 +00:00
|
|
|
|
*---------------------------------------
|
2019-01-28 07:44:37 +00:00
|
|
|
|
.INB USR/SRC/BIN/ASM.S.DIR
|
|
|
|
|
.INB USR/SRC/BIN/ASM.S.EXP
|
|
|
|
|
.INB USR/SRC/BIN/ASM.S.FIO
|
|
|
|
|
.INB USR/SRC/BIN/ASM.S.MAC
|
|
|
|
|
.INB USR/SRC/BIN/ASM.S.OUT
|
|
|
|
|
.INB USR/SRC/BIN/ASM.S.SRC
|
|
|
|
|
.INB USR/SRC/BIN/ASM.S.SYM
|
2015-10-02 16:04:30 +00:00
|
|
|
|
*---------------------------------------
|
2015-03-14 21:47:37 +00:00
|
|
|
|
CS.END
|
2018-03-28 15:23:32 +00:00
|
|
|
|
T.DIRECTIVES >PSTR "AC"
|
|
|
|
|
>PSTR "AS"
|
|
|
|
|
>PSTR "AT"
|
|
|
|
|
>PSTR "AZ"
|
|
|
|
|
>PSTR "BS"
|
|
|
|
|
>PSTR "DA"
|
|
|
|
|
>PSTR "DO"
|
|
|
|
|
>PSTR "DU"
|
|
|
|
|
>PSTR "DUMMY"
|
|
|
|
|
>PSTR "ED"
|
|
|
|
|
>PSTR "ELSE"
|
|
|
|
|
>PSTR "EM"
|
|
|
|
|
>PSTR "EN"
|
|
|
|
|
>PSTR "EP"
|
|
|
|
|
>PSTR "EQ"
|
|
|
|
|
>PSTR "FIN"
|
|
|
|
|
>PSTR "HS"
|
|
|
|
|
>PSTR "IN"
|
|
|
|
|
>PSTR "INB"
|
|
|
|
|
>PSTR "INB1"
|
|
|
|
|
>PSTR "INB2"
|
|
|
|
|
>PSTR "INB3"
|
|
|
|
|
>PSTR "INB4"
|
|
|
|
|
>PSTR "INB5"
|
|
|
|
|
>PSTR "INB6"
|
|
|
|
|
>PSTR "INB7"
|
|
|
|
|
>PSTR "INB8"
|
|
|
|
|
>PSTR "INB9"
|
|
|
|
|
>PSTR "LI"
|
|
|
|
|
>PSTR "LIST"
|
|
|
|
|
>PSTR "MA"
|
|
|
|
|
>PSTR "OP"
|
|
|
|
|
>PSTR "OR"
|
|
|
|
|
>PSTR "PG"
|
|
|
|
|
>PSTR "PH"
|
|
|
|
|
>PSTR "SE"
|
|
|
|
|
>PSTR "TA"
|
|
|
|
|
>PSTR "TF"
|
|
|
|
|
>PSTR "TI"
|
|
|
|
|
>PSTR "US"
|
|
|
|
|
.HS 00
|
2015-03-14 21:47:37 +00:00
|
|
|
|
*---------------------------------------
|
2018-03-28 15:23:32 +00:00
|
|
|
|
T.LI >PSTR "ON"
|
|
|
|
|
>PSTR "OFF"
|
|
|
|
|
>PSTR "CON"
|
|
|
|
|
>PSTR "COFF"
|
|
|
|
|
>PSTR "MON"
|
|
|
|
|
>PSTR "MOFF"
|
|
|
|
|
>PSTR "XON"
|
|
|
|
|
>PSTR "XOFF"
|
|
|
|
|
.HS 00
|
2015-10-06 16:14:48 +00:00
|
|
|
|
*---------------------------------------
|
2020-02-23 20:01:48 +00:00
|
|
|
|
SRC.MOD.RESERVED >PSTR "#/^<>"
|
|
|
|
|
SRC.EXP.RESERVED >PSTR "^!|&<=>+-*/"
|
|
|
|
|
SRC.AM.RESERVED >PSTR "[](),"
|
|
|
|
|
*---------------------------------------
|
2020-02-27 16:46:40 +00:00
|
|
|
|
DIR.SYS .AZ "SYS"
|
|
|
|
|
*---------------------------------------
|
2018-03-28 15:23:32 +00:00
|
|
|
|
ASM.6502 .AZ "6502"
|
2020-02-23 20:01:48 +00:00
|
|
|
|
MSG.HELP .AS "A2osX-Macro Assembler (S-C MASM 3.0 Based)\r\n"
|
|
|
|
|
.AS "Usage : ASM <src file> [type TXT ($04) or S-C/BAS ($FA)]\r\n"
|
|
|
|
|
.AS " -L : Override .LIST (C,M,X)OFF\r\n"
|
2020-03-02 06:53:19 +00:00
|
|
|
|
.AS " -T <target file> : Override .TF directive"
|
|
|
|
|
MSG.CRLF .AZ "\r\n"
|
2020-03-09 16:24:08 +00:00
|
|
|
|
MSG.PASS .AZ "**** Pass:#%d"
|
2019-03-26 15:22:48 +00:00
|
|
|
|
MSG.SRC.FILE .AZ "**** Reading SRC File:%s"
|
|
|
|
|
MSG.OBJ.FILE .AZ "**** Writing OBJ File:%s, Type=%02x"
|
|
|
|
|
MSG.T.FILE .AZ "**** Loading CPU File:%s"
|
2019-03-29 16:21:30 +00:00
|
|
|
|
MSG.OUT0 .AZ "%H- "
|
|
|
|
|
MSG.OUT1 .AZ "%H-%h "
|
|
|
|
|
MSG.OUT2 .AZ "%H-%h %h "
|
|
|
|
|
MSG.OUT3 .AZ "%H-%h %h %h"
|
2019-03-22 16:47:33 +00:00
|
|
|
|
MSG.EQU0 .AZ " [ ?] "
|
|
|
|
|
MSG.EQU1 .AZ " [ %h] "
|
|
|
|
|
MSG.EQU2 .AZ " [ %h%h] "
|
|
|
|
|
MSG.EQU3 .AZ " [ %h%h%h] "
|
|
|
|
|
MSG.EQU4 .AZ " [%h%h%h%h] "
|
2019-04-01 06:07:56 +00:00
|
|
|
|
MSG.LINENUM .AZ " %05D "
|
2019-03-22 16:47:33 +00:00
|
|
|
|
MSG.ERROR .AZ "**** Fatal Error $%h"
|
2020-03-04 06:39:08 +00:00
|
|
|
|
MSG.SYMBOLS .AZ "**** Symbol Table:"
|
2019-03-25 07:04:40 +00:00
|
|
|
|
MSG.LSYMBOL .AZ " .%d=%h%h%h%h"
|
2019-04-01 06:07:56 +00:00
|
|
|
|
MSG.PSYMBOL .AZ " :%d(%d)=%h%h%h%h"
|
2020-03-04 06:39:08 +00:00
|
|
|
|
MSG.SUMMARY .AZ "\r\n**** Symbol Table Size : %5D Bytes.\r\n"
|
2020-02-24 13:33:28 +00:00
|
|
|
|
MSG.END .AZ "**** End Of Assembly."
|
2020-03-02 06:53:19 +00:00
|
|
|
|
MSG.DEBUG .AZ "PC=%h%h%h%h, ACC=%h%h%h%h [%h] F:%b ARG=%h%h%h%h [%h]\r\n"
|
2018-01-11 16:34:09 +00:00
|
|
|
|
*---------------------------------------
|
2020-02-23 20:01:48 +00:00
|
|
|
|
ASM.CPU.FILE .BS 65
|
2015-11-20 16:31:14 +00:00
|
|
|
|
|
2019-03-20 16:55:26 +00:00
|
|
|
|
SRC.ACC.F .BS 1
|
2018-03-28 15:23:32 +00:00
|
|
|
|
SRC.ACC.SIZE .BS 1
|
|
|
|
|
SRC.ACC .BS 4
|
2015-09-16 20:48:59 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
SRC.ARG.SIZE .BS 1
|
|
|
|
|
SRC.ARG .BS 4
|
|
|
|
|
|
|
|
|
|
SRC.ACCTMP .BS 4
|
|
|
|
|
SRC.AM.StrBuf .BS 32
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.DUMMY
|
|
|
|
|
.OR 0
|
|
|
|
|
DS.START
|
|
|
|
|
bPause .BS 1
|
2020-02-26 16:34:13 +00:00
|
|
|
|
bListAll .BS 1
|
|
|
|
|
ArgDstFile .BS 1
|
2015-10-02 16:04:30 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
SRC.hFILENAME .BS 1
|
|
|
|
|
SRC.hLineBuf .BS 1
|
|
|
|
|
SRC.hTmpBuf .BS 1
|
2015-08-05 20:38:05 +00:00
|
|
|
|
|
2020-02-24 13:33:28 +00:00
|
|
|
|
SRC.Depth .BS 1
|
2018-04-06 15:10:02 +00:00
|
|
|
|
SRC.hFILES .BS IN.MAXDEPTH
|
|
|
|
|
SRC.hFILETYPES .BS IN.MAXDEPTH
|
2018-03-23 15:57:35 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
SRC.LINENUM .BS 2
|
|
|
|
|
SRC.AMID .BS 1
|
2015-10-06 16:14:48 +00:00
|
|
|
|
|
2020-02-27 16:46:40 +00:00
|
|
|
|
ASM.hCPUFILE .BS 1
|
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
DST.hFILENAME .BS 1
|
|
|
|
|
DST.hREFNUM .BS 1
|
2020-02-27 16:46:40 +00:00
|
|
|
|
DST.AUXTYPE .BS 2
|
2018-03-16 16:33:11 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
EXP.Modifier .BS 1
|
|
|
|
|
EXP.Prefix .BS 1
|
|
|
|
|
EXP.Operator .BS 1
|
2018-03-16 16:33:11 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
ASM.PASS .BS 1
|
2018-04-06 15:10:02 +00:00
|
|
|
|
|
|
|
|
|
ASM.DO.StackPtr .BS 1
|
|
|
|
|
ASM.DO.Stack .BS DO.MAXDEPTH
|
|
|
|
|
|
|
|
|
|
ASM.DU.ON .BS 1
|
2018-03-28 15:23:32 +00:00
|
|
|
|
ASM.PH.ON .BS 1
|
2018-04-06 15:10:02 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
ASM.LI.ON .BS 1
|
|
|
|
|
ASM.LI.CON .BS 1
|
|
|
|
|
ASM.LI.MON .BS 1
|
|
|
|
|
ASM.LI.XON .BS 1
|
2018-04-06 15:10:02 +00:00
|
|
|
|
|
|
|
|
|
ASM.MA.ON .BS 1
|
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
ASM.PC .BS 4
|
|
|
|
|
ASM.PC.PH .BS 4
|
2018-04-06 15:10:02 +00:00
|
|
|
|
ASM.PC.DU .BS 4
|
2018-03-22 16:45:23 +00:00
|
|
|
|
|
2019-03-29 16:21:30 +00:00
|
|
|
|
SYM.hList .BS 1
|
2020-03-02 16:49:47 +00:00
|
|
|
|
SYM.hBuf .BS 1
|
|
|
|
|
SYM.BufPtr .BS 1
|
|
|
|
|
SYM.ID .BS 2
|
2018-03-22 16:45:23 +00:00
|
|
|
|
|
2019-03-29 16:21:30 +00:00
|
|
|
|
MAC.hList .BS 1
|
|
|
|
|
MAC.hBuf .BS 1
|
2019-03-18 16:48:16 +00:00
|
|
|
|
MAC.BufPtr .BS 1
|
2020-03-02 16:49:47 +00:00
|
|
|
|
MAC.ID .BS 2
|
|
|
|
|
|
2019-03-29 16:21:30 +00:00
|
|
|
|
MAC.hStk .BS 1
|
|
|
|
|
MAC.StkPtr .BS 1
|
2020-02-23 20:01:48 +00:00
|
|
|
|
MAC.hArgBuf .BS 1
|
2020-02-24 16:37:55 +00:00
|
|
|
|
MAC.CtxID .BS 1
|
2020-02-25 16:42:22 +00:00
|
|
|
|
MAC.CtxNextID .BS 1
|
|
|
|
|
MAC.CtxStackPtr .BS 1
|
|
|
|
|
MAC.CtxStack .BS MA.MAXDEPTH
|
2018-01-26 16:19:17 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
OUT.PC .BS 4
|
|
|
|
|
OUT.Buf .BS 4
|
|
|
|
|
OUT.bEquate .BS 1
|
|
|
|
|
OUT.LineCnt .BS 1
|
2018-01-31 16:20:20 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
DS.END .ED
|
2015-11-20 16:31:14 +00:00
|
|
|
|
*---------------------------------------
|
2018-03-28 15:23:32 +00:00
|
|
|
|
.DO DS.END-DS.START>$FF
|
|
|
|
|
ERROR:DS too big
|
|
|
|
|
.FIN
|
2015-03-14 21:47:37 +00:00
|
|
|
|
*---------------------------------------
|
|
|
|
|
MAN
|
2019-01-28 07:44:37 +00:00
|
|
|
|
SAVE USR/SRC/BIN/ASM.S
|
2015-03-14 21:47:37 +00:00
|
|
|
|
ASM
|