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
|
|
|
|
*---------------------------------------
|
2020-08-17 13:03:39 +00:00
|
|
|
|
ASMDBG .EQ 0
|
2023-07-16 09:09:23 +00:00
|
|
|
|
SYMDBG .EQ 0
|
2020-08-17 13:03:39 +00:00
|
|
|
|
*---------------------------------------
|
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
|
|
|
|
*---------------------------------------
|
2020-08-17 13:03:39 +00:00
|
|
|
|
.INB inc/macros.i
|
|
|
|
|
.INB inc/a2osx.i
|
|
|
|
|
.INB inc/mli.i
|
|
|
|
|
.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
|
2020-08-17 13:03:39 +00:00
|
|
|
|
ZPMacroBuf .BS 2
|
2020-02-23 20:01:48 +00:00
|
|
|
|
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
|
2022-09-11 19:11:32 +00:00
|
|
|
|
SYM.LocalOfs .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
|
2023-07-22 13:41:22 +00:00
|
|
|
|
SYMG.V .EQ 1 DWORD
|
2018-03-23 15:57:35 +00:00
|
|
|
|
*
|
2023-07-22 13:41:22 +00:00
|
|
|
|
SYMG .EQ 5
|
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
|
2022-09-11 19:11:32 +00:00
|
|
|
|
SYML.O .EQ 2 WORD
|
2018-03-23 15:57:35 +00:00
|
|
|
|
*
|
2022-09-11 19:11:32 +00:00
|
|
|
|
SYML .EQ 4
|
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
|
2020-08-17 13:03:39 +00:00
|
|
|
|
.DA CS.DOEVENT
|
2018-03-28 15:23:32 +00:00
|
|
|
|
.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
|
2023-07-16 09:09:23 +00:00
|
|
|
|
L.MSG.WARN1 .DA MSG.WARN1
|
2020-08-17 13:03:39 +00:00
|
|
|
|
.DO ASMDBG=1
|
|
|
|
|
L.MSG.DBG .DA MSG.DBG
|
|
|
|
|
.FIN
|
2023-07-16 09:09:23 +00:00
|
|
|
|
.DO SYMDBG=1
|
|
|
|
|
L.MSG.SYMDBG .DA MSG.SYMDBG
|
|
|
|
|
.FIN
|
2018-03-28 15:23:32 +00:00
|
|
|
|
L.MSG.SRC.FILE .DA MSG.SRC.FILE
|
|
|
|
|
L.MSG.OBJ.FILE .DA MSG.OBJ.FILE
|
2020-08-17 13:03:39 +00:00
|
|
|
|
L.MSG.CPU.FILE .DA MSG.CPU.FILE
|
2018-03-28 15:23:32 +00:00
|
|
|
|
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
|
2023-07-22 13:41:22 +00:00
|
|
|
|
L.SRC.ACC.F .DA SRC.ACC.F
|
2018-03-28 15:23:32 +00:00
|
|
|
|
L.T.DIRECTIVES .DA T.DIRECTIVES
|
2022-09-11 19:11:32 +00:00
|
|
|
|
J.DIRECTIVES .DA DIR.AC
|
2018-03-28 15:23:32 +00:00
|
|
|
|
.DA DIR.AS
|
|
|
|
|
.DA DIR.AT
|
|
|
|
|
.DA DIR.AZ
|
|
|
|
|
.DA DIR.BS
|
2022-09-11 19:11:32 +00:00
|
|
|
|
.DA DIR.CS
|
|
|
|
|
.DA DIR.CZ
|
2018-03-28 15:23:32 +00:00
|
|
|
|
.DA DIR.DA
|
2023-07-16 09:09:23 +00:00
|
|
|
|
DIR.DO.ID .EQ *-J.DIRECTIVES
|
2022-09-11 19:11:32 +00:00
|
|
|
|
.DA DIR.DO
|
2018-03-28 15:23:32 +00:00
|
|
|
|
.DA DIR.DU
|
|
|
|
|
.DA DIR.DU
|
|
|
|
|
.DA DIR.ED
|
2022-09-11 19:11:32 +00:00
|
|
|
|
DIR.EL.ID .EQ *-J.DIRECTIVES
|
|
|
|
|
.DA DIR.EL
|
2018-03-28 15:23:32 +00:00
|
|
|
|
.DA DIR.EM
|
|
|
|
|
.DA DIR.EN
|
|
|
|
|
.DA DIR.EP
|
|
|
|
|
.DA DIR.EQ
|
2022-09-11 19:11:32 +00:00
|
|
|
|
DIR.FI.ID .EQ *-J.DIRECTIVES
|
|
|
|
|
.DA DIR.FI
|
2018-03-28 15:23:32 +00:00
|
|
|
|
.DA DIR.HS
|
2022-12-07 07:02:29 +00:00
|
|
|
|
.DA DIR.HX
|
2018-03-28 15:23:32 +00:00
|
|
|
|
.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
|
2022-09-11 19:11:32 +00:00
|
|
|
|
.DA DIR.PS
|
2018-03-28 15:23:32 +00:00
|
|
|
|
.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
|
2021-09-07 12:32:31 +00:00
|
|
|
|
.DA EXP.OP.LWR
|
2018-03-28 15:23:32 +00:00
|
|
|
|
.DA EXP.OP.EQU
|
|
|
|
|
.DA EXP.OP.GRT
|
|
|
|
|
.DA EXP.OP.ADD
|
|
|
|
|
.DA EXP.OP.SUB
|
|
|
|
|
.DA EXP.OP.MUL
|
2020-08-17 13:03:39 +00:00
|
|
|
|
.DA EXP.OP.DIV
|
2018-03-28 15:23:32 +00:00
|
|
|
|
.DA 0
|
2015-03-14 21:47:37 +00:00
|
|
|
|
*---------------------------------------
|
2020-08-17 13:03:39 +00:00
|
|
|
|
CS.INIT clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN jsr CS.RUN.ARGS
|
|
|
|
|
bcs .9
|
|
|
|
|
|
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-08-17 13:03:39 +00:00
|
|
|
|
jsr OUT.Init
|
|
|
|
|
bcs .9
|
2023-07-16 09:09:23 +00:00
|
|
|
|
|
2020-08-17 13:03:39 +00:00
|
|
|
|
.1 >SLEEP
|
2023-07-16 09:09:23 +00:00
|
|
|
|
jsr CS.RUN.LOOP
|
2020-08-17 13:03:39 +00:00
|
|
|
|
bcc .1
|
2023-07-16 09:09:23 +00:00
|
|
|
|
|
2020-08-17 13:03:39 +00:00
|
|
|
|
.9 rts
|
2020-02-25 16:42:22 +00:00
|
|
|
|
*--------------------------------------
|
2020-08-17 13:03:39 +00:00
|
|
|
|
CS.RUN.LOOP ldy #S.PS.hStdIn
|
2019-03-18 16:48:16 +00:00
|
|
|
|
lda (pPS),y
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL FEOF
|
2019-03-18 16:48:16 +00:00
|
|
|
|
bcs .99
|
2021-05-19 12:44:47 +00:00
|
|
|
|
|
2019-03-18 16:48:16 +00:00
|
|
|
|
tay
|
2019-05-02 09:52:32 +00:00
|
|
|
|
bne .13
|
2019-03-18 16:48:16 +00:00
|
|
|
|
|
|
|
|
|
>SYSCALL GetChar
|
|
|
|
|
bcs .99
|
2020-08-17 13:03:39 +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
|
2020-08-17 13:03:39 +00:00
|
|
|
|
|
2018-04-06 15:10:02 +00:00
|
|
|
|
bpl .12
|
2020-08-17 13:03:39 +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?
|
2020-08-17 13:03:39 +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-08-17 13:03:39 +00:00
|
|
|
|
|
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-08-17 13:03:39 +00:00
|
|
|
|
|
2019-03-29 16:21:30 +00:00
|
|
|
|
.10 >LDYA ZPLineBuf
|
|
|
|
|
>STYA ZPLinePtr
|
2020-08-17 13:03:39 +00:00
|
|
|
|
|
2019-03-29 16:21:30 +00:00
|
|
|
|
>LDA.G MAC.StkPtr
|
|
|
|
|
beq .20
|
2020-08-17 13:03:39 +00:00
|
|
|
|
|
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-08-17 13:03:39 +00:00
|
|
|
|
|
2020-02-23 20:01:48 +00:00
|
|
|
|
jsr MAC.Pop
|
|
|
|
|
bne .15
|
2020-08-17 13:03:39 +00:00
|
|
|
|
|
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-08-17 13:03:39 +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
|
2020-08-17 13:03:39 +00:00
|
|
|
|
|
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
|
2023-11-12 21:12:24 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
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
|
2020-08-17 13:03:39 +00:00
|
|
|
|
sec
|
2018-03-28 15:23:32 +00:00
|
|
|
|
rts
|
2020-08-17 13:03:39 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
.2 jsr SRC.ParseLine
|
|
|
|
|
bcs .9
|
2020-08-17 13:03:39 +00:00
|
|
|
|
|
2022-09-11 19:11:32 +00:00
|
|
|
|
jmp 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
|
|
|
|
*--------------------------------------
|
2020-08-17 13:03:39 +00:00
|
|
|
|
CS.RUN.ARGS ldy #S.PS.ARGC
|
|
|
|
|
lda (pPS),y
|
|
|
|
|
beq .90
|
|
|
|
|
|
|
|
|
|
.1 inc ZPPtr1
|
|
|
|
|
|
|
|
|
|
lda ZPPtr1
|
|
|
|
|
>SYSCALL ArgV
|
|
|
|
|
bcs .8
|
2022-09-11 19:11:32 +00:00
|
|
|
|
|
2020-08-17 13:03:39 +00:00
|
|
|
|
>STYA ZPPtr2
|
|
|
|
|
|
|
|
|
|
lda (ZPPtr2)
|
|
|
|
|
cmp #'-'
|
|
|
|
|
beq .2
|
|
|
|
|
|
|
|
|
|
>PUSHW ZPPtr2
|
2021-07-24 20:42:23 +00:00
|
|
|
|
>PUSHWZ Allocate
|
2020-08-17 13:03:39 +00:00
|
|
|
|
>SYSCALL RealPath
|
|
|
|
|
bcs .99
|
|
|
|
|
txa
|
|
|
|
|
>STA.G SRC.hFILENAME
|
|
|
|
|
bra .1
|
|
|
|
|
|
2023-07-16 09:09:23 +00:00
|
|
|
|
.2 ldy #2
|
|
|
|
|
lda (ZPPtr2),y
|
|
|
|
|
bne .90
|
|
|
|
|
|
|
|
|
|
dey
|
2020-08-17 13:03:39 +00:00
|
|
|
|
lda (ZPPtr2),y
|
2023-07-16 09:09:23 +00:00
|
|
|
|
|
|
|
|
|
cmp #'a'
|
|
|
|
|
bcc .20
|
|
|
|
|
|
|
|
|
|
cmp #'z'+1
|
|
|
|
|
bcs .20
|
|
|
|
|
|
|
|
|
|
eor #$20
|
|
|
|
|
|
|
|
|
|
.20 cmp #'L'
|
2020-08-17 13:03:39 +00:00
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
.8 >LDA.G SRC.hFILENAME
|
|
|
|
|
beq .90
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.90 >PUSHW L.MSG.HELP
|
|
|
|
|
>PUSHBI 0
|
|
|
|
|
>SYSCALL PrintF
|
2023-07-16 09:09:23 +00:00
|
|
|
|
|
2020-08-17 13:03:39 +00:00
|
|
|
|
lda #E.INV.ARGS
|
|
|
|
|
sec
|
|
|
|
|
.99 rts
|
|
|
|
|
*--------------------------------------
|
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-08-17 13:03:39 +00:00
|
|
|
|
|
2020-02-29 14:06:28 +00:00
|
|
|
|
jsr FIO.FileClose
|
2020-08-17 13:03:39 +00:00
|
|
|
|
bra CS.QUIT
|
2020-02-29 14:06:28 +00:00
|
|
|
|
|
|
|
|
|
.1 >LDA.G DST.hREFNUM
|
|
|
|
|
beq .2
|
2020-08-17 13:03:39 +00:00
|
|
|
|
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL FClose
|
2020-08-17 13:03:39 +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-08-17 13:03:39 +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-08-17 13:03:39 +00:00
|
|
|
|
|
2020-02-26 16:34:13 +00:00
|
|
|
|
ldy #DST.hFILENAME
|
|
|
|
|
jsr .7
|
2020-08-17 13:03:39 +00:00
|
|
|
|
|
2020-02-23 20:01:48 +00:00
|
|
|
|
ldy #SRC.hLineBuf
|
|
|
|
|
jsr .7
|
2020-08-17 13:03:39 +00:00
|
|
|
|
|
2020-02-23 20:01:48 +00:00
|
|
|
|
ldy #SRC.hTmpBuf
|
2020-08-17 13:03:39 +00:00
|
|
|
|
|
2020-02-23 20:01:48 +00:00
|
|
|
|
.7 lda (pData),y
|
2018-03-28 15:23:32 +00:00
|
|
|
|
beq .8
|
2018-07-18 15:30:42 +00:00
|
|
|
|
>SYSCALL FreeMem
|
2020-08-17 13:03:39 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
2015-08-05 20:38:05 +00:00
|
|
|
|
*---------------------------------------
|
2020-08-17 13:03:39 +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
|
2022-09-11 19:11:32 +00:00
|
|
|
|
T.DIRECTIVES .PS "AC"
|
|
|
|
|
.PS "AS"
|
|
|
|
|
.PS "AT"
|
|
|
|
|
.PS "AZ"
|
|
|
|
|
.PS "BS"
|
|
|
|
|
.PS "CS"
|
|
|
|
|
.PS "CZ"
|
|
|
|
|
.PS "DA"
|
|
|
|
|
.PS "DO"
|
|
|
|
|
.PS "DU"
|
|
|
|
|
.PS "DUMMY"
|
|
|
|
|
.PS "ED"
|
|
|
|
|
.PS "ELSE"
|
|
|
|
|
.PS "EM"
|
|
|
|
|
.PS "EN"
|
|
|
|
|
.PS "EP"
|
|
|
|
|
.PS "EQ"
|
|
|
|
|
.PS "FIN"
|
|
|
|
|
.PS "HS"
|
2022-12-07 07:02:29 +00:00
|
|
|
|
.PS "HX"
|
2022-09-11 19:11:32 +00:00
|
|
|
|
.PS "IN"
|
|
|
|
|
.PS "INB"
|
|
|
|
|
.PS "INB1"
|
|
|
|
|
.PS "INB2"
|
|
|
|
|
.PS "INB3"
|
|
|
|
|
.PS "INB4"
|
|
|
|
|
.PS "INB5"
|
|
|
|
|
.PS "INB6"
|
|
|
|
|
.PS "INB7"
|
|
|
|
|
.PS "INB8"
|
|
|
|
|
.PS "INB9"
|
|
|
|
|
.PS "LI"
|
|
|
|
|
.PS "LIST"
|
|
|
|
|
.PS "MA"
|
|
|
|
|
.PS "OP"
|
|
|
|
|
.PS "OR"
|
|
|
|
|
.PS "PG"
|
|
|
|
|
.PS "PH"
|
|
|
|
|
.PS "PS"
|
|
|
|
|
.PS "SE"
|
|
|
|
|
.PS "TA"
|
|
|
|
|
.PS "TF"
|
|
|
|
|
.PS "TI"
|
|
|
|
|
.PS "US"
|
2018-03-28 15:23:32 +00:00
|
|
|
|
.HS 00
|
2015-03-14 21:47:37 +00:00
|
|
|
|
*---------------------------------------
|
2022-09-11 19:11:32 +00:00
|
|
|
|
T.LI .PS "ON"
|
|
|
|
|
.PS "OFF"
|
|
|
|
|
.PS "CON"
|
|
|
|
|
.PS "COFF"
|
|
|
|
|
.PS "MON"
|
|
|
|
|
.PS "MOFF"
|
|
|
|
|
.PS "XON"
|
|
|
|
|
.PS "XOFF"
|
2018-03-28 15:23:32 +00:00
|
|
|
|
.HS 00
|
2022-09-11 19:11:32 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
DIR.EscChars .AS "abefnrtv"
|
2022-10-18 05:56:59 +00:00
|
|
|
|
.HS 5C27223F25 \'"?%
|
2022-09-11 19:11:32 +00:00
|
|
|
|
DIR.EscChars.L .EQ *-DIR.EscChars
|
|
|
|
|
DIR.EscCodes .HS 07081B0C0A0D090B
|
2022-10-18 05:56:59 +00:00
|
|
|
|
.HS 5C27223F25
|
2015-10-06 16:14:48 +00:00
|
|
|
|
*---------------------------------------
|
2022-09-11 19:11:32 +00:00
|
|
|
|
SRC.MOD.RESERVED .PS "#/^<>"
|
|
|
|
|
SRC.EXP.RESERVED .PS "^!|&<=>+-*/"
|
|
|
|
|
SRC.AM.RESERVED .PS "[](),"
|
2020-02-23 20:01:48 +00:00
|
|
|
|
*---------------------------------------
|
2020-02-27 16:46:40 +00:00
|
|
|
|
DIR.SYS .AZ "SYS"
|
2018-03-28 15:23:32 +00:00
|
|
|
|
ASM.6502 .AZ "6502"
|
2022-09-11 19:11:32 +00:00
|
|
|
|
*---------------------------------------
|
|
|
|
|
MSG.HELP .CS "A2osX-Macro Assembler (S-C MASM 3.1 Dialect)\r\n"
|
|
|
|
|
.CS "Usage : ASM <src file> [type TXT ($04) or S-C/BAS ($FA)]\r\n"
|
|
|
|
|
.CS " -L : Override .LIST (C,M,X)OFF\r\n"
|
|
|
|
|
.CS " -T <target file> : Override .TF directive"
|
|
|
|
|
MSG.CRLF .CZ "\r\n"
|
|
|
|
|
MSG.PASS .CZ "**** Pass:#%d"
|
|
|
|
|
MSG.SRC.FILE .CZ "**** Reading SRC File:%s"
|
|
|
|
|
MSG.OBJ.FILE .CZ "**** Writing OBJ File:%s, Type=%02x"
|
|
|
|
|
MSG.CPU.FILE .CZ "**** Loading CPU File:%s"
|
|
|
|
|
MSG.OUT0 .CZ "%H- "
|
|
|
|
|
MSG.OUT1 .CZ "%H-%h "
|
|
|
|
|
MSG.OUT2 .CZ "%H-%h %h "
|
|
|
|
|
MSG.OUT3 .CZ "%H-%h %h %h"
|
|
|
|
|
MSG.EQU0 .CZ " [ ?] "
|
|
|
|
|
MSG.EQU1 .CZ " [ %h] "
|
|
|
|
|
MSG.EQU2 .CZ " [ %h%h] "
|
|
|
|
|
MSG.EQU3 .CZ " [ %h%h%h] "
|
|
|
|
|
MSG.EQU4 .CZ " [%h%h%h%h] "
|
|
|
|
|
MSG.LINENUM .CZ " %05D "
|
|
|
|
|
MSG.ERROR .CZ "**** Fatal Error $%h"
|
|
|
|
|
MSG.SYMBOLS .CZ "**** Symbol Table:"
|
|
|
|
|
MSG.LSYMBOL .CZ " .%d=%h%h%h%h"
|
|
|
|
|
MSG.PSYMBOL .CZ " :%d(%d)=%h%h%h%h"
|
|
|
|
|
MSG.SUMMARY .CZ "\r\n**** Symbol Table Size : %5D Bytes.\r\n"
|
|
|
|
|
MSG.END .CZ "**** End Of Assembly."
|
2023-07-16 09:09:23 +00:00
|
|
|
|
MSG.WARN1 .CZ "**** WARN : Unoptimized adressing mode due to forward reference.\r\n"
|
2020-08-17 13:03:39 +00:00
|
|
|
|
.DO ASMDBG=1
|
2022-09-11 19:11:32 +00:00
|
|
|
|
MSG.DBG .CZ "\r\nCtxID=%d, ARG=%H%H <op> ACC=%H%H -> ACC %b [%h]\r\n"
|
2020-08-17 13:03:39 +00:00
|
|
|
|
.FIN
|
2023-07-16 09:09:23 +00:00
|
|
|
|
.DO SYMDBG=1
|
|
|
|
|
MSG.SYMDBG .CZ "SymID=%H\r\n"
|
|
|
|
|
.FIN
|
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
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
SRC.ACC.SIZE .BS 1
|
2023-07-22 13:41:22 +00:00
|
|
|
|
|
|
|
|
|
SRC.ACC.F .BS 1
|
2018-03-28 15:23:32 +00:00
|
|
|
|
SRC.ACC .BS 4
|
2020-08-17 13:03:39 +00:00
|
|
|
|
SRC.ARG.F .BS 1
|
2018-03-28 15:23:32 +00:00
|
|
|
|
SRC.ARG .BS 4
|
|
|
|
|
|
|
|
|
|
SRC.ACCTMP .BS 4
|
|
|
|
|
SRC.AM.StrBuf .BS 32
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.DUMMY
|
|
|
|
|
.OR 0
|
2020-08-17 13:03:39 +00:00
|
|
|
|
DS.START
|
2018-03-28 15:23:32 +00:00
|
|
|
|
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
|
|
|
|
|
2023-07-16 09:09:23 +00:00
|
|
|
|
FWR.hList .BS 1
|
|
|
|
|
FWR.ID .BS 2
|
|
|
|
|
|
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
|
2020-08-17 13:03:39 +00:00
|
|
|
|
SAVE usr/src/bin/asm.s
|
2015-03-14 21:47:37 +00:00
|
|
|
|
ASM
|