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
|
|
|
|
|
*---------------------------------------
|
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
|
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
|
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
|
2020-08-17 13:03:39 +00:00
|
|
|
|
.DO ASMDBG=1
|
|
|
|
|
L.MSG.DBG .DA MSG.DBG
|
|
|
|
|
.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
|
2020-08-17 13:03:39 +00:00
|
|
|
|
L.SRC.ACC.SIZE .DA SRC.ACC.SIZE
|
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
|
2020-08-17 13:03:39 +00:00
|
|
|
|
J.DIRECTIVES .DA DIR.AC 0
|
2018-03-28 15:23:32 +00:00
|
|
|
|
.DA DIR.AS
|
|
|
|
|
.DA DIR.AT
|
|
|
|
|
.DA DIR.AZ
|
|
|
|
|
.DA DIR.BS
|
|
|
|
|
.DA DIR.DA
|
2020-08-17 13:03:39 +00:00
|
|
|
|
.DA DIR.DO 12
|
2018-03-28 15:23:32 +00:00
|
|
|
|
.DA DIR.DU
|
|
|
|
|
.DA DIR.DU
|
|
|
|
|
.DA DIR.ED
|
2020-08-17 13:03:39 +00:00
|
|
|
|
.DA DIR.EL 20
|
2018-03-28 15:23:32 +00:00
|
|
|
|
.DA DIR.EM
|
|
|
|
|
.DA DIR.EN
|
|
|
|
|
.DA DIR.EP
|
|
|
|
|
.DA DIR.EQ
|
2020-08-17 13:03:39 +00:00
|
|
|
|
.DA DIR.FI 30
|
2018-03-28 15:23:32 +00:00
|
|
|
|
.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
|
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
|
2020-02-25 16:42:22 +00:00
|
|
|
|
|
2020-08-17 13:03:39 +00:00
|
|
|
|
.1 >SLEEP
|
|
|
|
|
jsr CS.RUN.LOOP
|
|
|
|
|
bcc .1
|
2020-02-26 16:34:13 +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
|
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
*--------------------------------------
|
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
|
|
|
|
|
>STYA ZPPtr2
|
|
|
|
|
|
|
|
|
|
lda (ZPPtr2)
|
|
|
|
|
cmp #'-'
|
|
|
|
|
beq .2
|
|
|
|
|
|
|
|
|
|
>PUSHW ZPPtr2
|
|
|
|
|
>PUSHWI 0 Allocate
|
|
|
|
|
>SYSCALL RealPath
|
|
|
|
|
bcs .99
|
|
|
|
|
txa
|
|
|
|
|
>STA.G SRC.hFILENAME
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
.8 >LDA.G SRC.hFILENAME
|
|
|
|
|
beq .90
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.90 >PUSHW L.MSG.HELP
|
|
|
|
|
>PUSHBI 0
|
|
|
|
|
>SYSCALL PrintF
|
|
|
|
|
|
|
|
|
|
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
|
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"
|
2020-08-17 13:03:39 +00:00
|
|
|
|
MSG.CPU.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-08-17 13:03:39 +00:00
|
|
|
|
.DO ASMDBG=1
|
|
|
|
|
MSG.DBG .AZ "\r\nCtxID=%d, ARG=%H%H <op> ACC=%H%H -> ACC %b [%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
|
|
|
|
|
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
|
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
|
|
|
|
|
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
|