2018-01-10 16:34:57 +00:00
|
|
|
|
NEW
|
2019-03-18 16:48:16 +00:00
|
|
|
|
PREFIX
|
2018-01-10 16:34:57 +00:00
|
|
|
|
AUTO 4,1
|
2015-10-09 15:53:30 +00:00
|
|
|
|
*---------------------------------------
|
2018-03-16 16:33:11 +00:00
|
|
|
|
* EXP.Modifiers:
|
|
|
|
|
* # : 8b,Byte 1
|
|
|
|
|
* / : 8b,Byte 2
|
|
|
|
|
* ^ : 8b,Byte 3
|
|
|
|
|
* < : 24b,Byte 1,2,3
|
|
|
|
|
* > : 32b
|
|
|
|
|
*---------------------------------------
|
2015-10-09 15:53:30 +00:00
|
|
|
|
* Num Format : 0-9 -> decimal
|
2015-10-28 16:55:12 +00:00
|
|
|
|
* $ = Hex
|
2015-10-09 15:53:30 +00:00
|
|
|
|
* % = binary
|
|
|
|
|
* & = octal
|
2015-10-28 16:55:12 +00:00
|
|
|
|
* * = PC
|
2015-10-09 15:53:30 +00:00
|
|
|
|
*---------------------------------------
|
2018-03-28 15:23:32 +00:00
|
|
|
|
EXP.Eval.Missing
|
2019-03-25 07:04:40 +00:00
|
|
|
|
lda #E.MISSING.EXP
|
2018-03-28 15:23:32 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
2018-03-23 15:57:35 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
EXP.Eval >STZ.G EXP.Modifier
|
|
|
|
|
>STZ.G EXP.Prefix
|
|
|
|
|
>STZ.G EXP.Operator
|
|
|
|
|
|
|
|
|
|
jsr SRC.GetChar
|
|
|
|
|
bcs EXP.Eval.Missing
|
|
|
|
|
|
|
|
|
|
jsr SRC.IsMODReserved
|
|
|
|
|
bcs EXP.Eval.Next
|
|
|
|
|
|
|
|
|
|
txa
|
|
|
|
|
>STA.G EXP.Modifier
|
|
|
|
|
lda #'#'
|
|
|
|
|
>STA.G EXP.Prefix
|
|
|
|
|
|
|
|
|
|
EXP.Eval.Next0 jsr SRC.GetNextChar
|
|
|
|
|
|
2019-03-21 16:37:02 +00:00
|
|
|
|
EXP.Eval.Next stz SRC.ACC.F
|
|
|
|
|
lda #2
|
2018-03-28 15:23:32 +00:00
|
|
|
|
sta SRC.ACC.SIZE Default To WORD (2 bytes)
|
2018-03-22 16:45:23 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
stz SRC.ACC
|
|
|
|
|
stz SRC.ACC+1
|
|
|
|
|
stz SRC.ACC+2
|
|
|
|
|
stz SRC.ACC+3
|
|
|
|
|
|
|
|
|
|
jsr SRC.GetChar
|
|
|
|
|
bcs EXP.Eval.Missing
|
|
|
|
|
|
|
|
|
|
cmp #'.' Local Label?
|
|
|
|
|
bne .12
|
2018-01-26 16:19:17 +00:00
|
|
|
|
|
2019-03-22 16:47:33 +00:00
|
|
|
|
jsr EXP.GetLocal
|
2018-03-28 15:23:32 +00:00
|
|
|
|
bcs .14
|
|
|
|
|
|
|
|
|
|
jmp EXP.EvalOperator
|
|
|
|
|
.14 rts
|
|
|
|
|
|
|
|
|
|
.12 cmp #'*'
|
|
|
|
|
bne .10
|
2018-02-01 16:30:18 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
ldy #ASM.PC+3
|
|
|
|
|
ldx #3
|
|
|
|
|
|
|
|
|
|
.11 lda (pData),y
|
|
|
|
|
sta SRC.ACC,x
|
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bpl .11
|
2015-12-17 16:57:35 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
jsr SRC.GetNextChar
|
|
|
|
|
jmp EXP.EvalOperator
|
|
|
|
|
|
|
|
|
|
.10 jsr SRC.IsDigit10 Decimal constant ?
|
|
|
|
|
bcs .1
|
|
|
|
|
|
|
|
|
|
jsr SRC.GetDecimal
|
|
|
|
|
|
|
|
|
|
bcs EXP.EvalExitRTS
|
|
|
|
|
bra EXP.EvalOperator
|
|
|
|
|
|
|
|
|
|
.1 cmp #'$' Hex?
|
|
|
|
|
bne .2
|
|
|
|
|
|
|
|
|
|
jsr SRC.GetHex
|
|
|
|
|
|
|
|
|
|
bcs EXP.EvalExitRTS
|
|
|
|
|
bra EXP.EvalOperator
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.2 cmp #'%' binary?
|
|
|
|
|
bne .3
|
2018-01-24 16:24:06 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
jsr SRC.GetBinary
|
|
|
|
|
|
|
|
|
|
bcs EXP.EvalExitRTS
|
|
|
|
|
bra EXP.EvalOperator
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.3 cmp #'&' octal?
|
|
|
|
|
bne .4
|
|
|
|
|
jsr SRC.GetOctal
|
|
|
|
|
|
|
|
|
|
bcs EXP.EvalExitRTS
|
|
|
|
|
bra EXP.EvalOperator
|
|
|
|
|
|
|
|
|
|
.4 cmp #'''
|
|
|
|
|
bne .43
|
|
|
|
|
jsr SRC.GetNextChar
|
|
|
|
|
bcs EXP.EvalExitSYN
|
|
|
|
|
|
|
|
|
|
jsr EXP.SetAccA
|
|
|
|
|
jsr SRC.GetNextChar
|
|
|
|
|
bcs EXP.EvalOperator
|
|
|
|
|
cmp #'''
|
|
|
|
|
bne EXP.EvalExitSYN
|
|
|
|
|
jsr SRC.GetNextChar
|
|
|
|
|
bra EXP.EvalOperator
|
|
|
|
|
|
|
|
|
|
.43 cmp #'"'
|
|
|
|
|
bne .42
|
|
|
|
|
jsr SRC.GetNextChar
|
|
|
|
|
bcs EXP.EvalExitSYN
|
|
|
|
|
ora #$80
|
|
|
|
|
jsr EXP.SetAccA
|
|
|
|
|
jsr SRC.GetNextChar
|
|
|
|
|
bcs EXP.EvalOperator
|
|
|
|
|
cmp #'"'
|
|
|
|
|
bne EXP.EvalExitSYN
|
|
|
|
|
jsr SRC.GetNextChar
|
|
|
|
|
bra EXP.EvalOperator
|
|
|
|
|
|
|
|
|
|
.42 jsr SRC.IsLetter Symbol ?
|
|
|
|
|
bcs EXP.EvalExitSYN
|
2018-01-11 16:34:09 +00:00
|
|
|
|
|
2019-03-22 16:47:33 +00:00
|
|
|
|
jsr EXP.GetGlobal
|
2018-03-28 15:23:32 +00:00
|
|
|
|
bcs EXP.EvalExitUND
|
|
|
|
|
bra EXP.EvalOperator
|
|
|
|
|
|
|
|
|
|
EXP.EvalExitOK >LDA.G EXP.Modifier
|
|
|
|
|
beq .8
|
|
|
|
|
asl
|
|
|
|
|
tax
|
|
|
|
|
jmp (J.EXP.MOD-2,x)
|
|
|
|
|
|
|
|
|
|
.8 clc
|
|
|
|
|
EXP.EvalExitRTS rts
|
|
|
|
|
|
2019-03-25 07:04:40 +00:00
|
|
|
|
EXP.EvalExitSYN lda #E.SYNTAX.ERROR
|
2018-03-28 15:23:32 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
2015-11-27 16:26:11 +00:00
|
|
|
|
|
2019-03-25 07:04:40 +00:00
|
|
|
|
EXP.EvalExitUND lda #E.UNDEF.SYMBOL
|
2018-03-28 15:23:32 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*---------------------------------------
|
|
|
|
|
EXP.EvalOperator
|
|
|
|
|
>LDA.G EXP.Operator
|
|
|
|
|
beq .7
|
|
|
|
|
|
|
|
|
|
jsr EXP.Compute
|
|
|
|
|
bcs EXP.EvalExitRTS
|
|
|
|
|
|
|
|
|
|
.7 jsr SRC.GetChar
|
|
|
|
|
bcs EXP.EvalExitOK
|
2015-12-04 16:33:33 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
cmp #' '
|
|
|
|
|
beq EXP.EvalExitOK
|
2015-12-04 16:33:33 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
jsr SRC.IsAMReserved
|
|
|
|
|
bcc EXP.EvalExitOK
|
2015-12-04 16:33:33 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
jsr SRC.IsEXPReserved
|
|
|
|
|
bcs EXP.EvalExitSYN
|
|
|
|
|
txa
|
|
|
|
|
>STA.G EXP.Operator
|
|
|
|
|
|
2018-04-06 15:10:02 +00:00
|
|
|
|
ldx #4
|
2018-03-28 15:23:32 +00:00
|
|
|
|
|
2018-04-06 15:10:02 +00:00
|
|
|
|
.8 lda SRC.ACC.SIZE,x
|
|
|
|
|
sta SRC.ARG.SIZE,x
|
2018-03-28 15:23:32 +00:00
|
|
|
|
dex
|
|
|
|
|
bpl .8
|
|
|
|
|
|
|
|
|
|
jmp EXP.Eval.Next0
|
2015-11-27 16:26:11 +00:00
|
|
|
|
*---------------------------------------
|
2019-03-22 16:47:33 +00:00
|
|
|
|
EXP.GetLocal jsr SRC.GetNextChar
|
2018-03-28 15:23:32 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
jsr SRC.GetDecimal
|
|
|
|
|
bcs EXP.EvalExitSYN
|
|
|
|
|
lda SRC.ACC+1
|
|
|
|
|
ora SRC.ACC+2
|
|
|
|
|
ora SRC.ACC+3
|
|
|
|
|
bne EXP.EvalExitSYN Max .255
|
2019-03-20 16:55:26 +00:00
|
|
|
|
ldx SRC.ACC
|
2018-03-28 15:23:32 +00:00
|
|
|
|
beq EXP.EvalExitSYN .0 is not allowed
|
|
|
|
|
|
2019-03-20 16:55:26 +00:00
|
|
|
|
jsr SYM.GetLocalX
|
2018-04-06 15:10:02 +00:00
|
|
|
|
bcc .8
|
|
|
|
|
|
|
|
|
|
>LDA.G ASM.PASS pass#2?
|
|
|
|
|
bne EXP.EvalExitUND
|
2019-03-20 16:55:26 +00:00
|
|
|
|
|
|
|
|
|
lda #SYMG.F.FWREF Mark ACC as pending
|
2019-03-21 16:37:02 +00:00
|
|
|
|
tsb SRC.ACC.F
|
2019-03-20 16:55:26 +00:00
|
|
|
|
stz SRC.ACC.SIZE
|
|
|
|
|
|
2018-04-06 15:10:02 +00:00
|
|
|
|
clc
|
2018-03-28 15:23:32 +00:00
|
|
|
|
rts
|
|
|
|
|
|
2019-03-25 07:04:40 +00:00
|
|
|
|
.9 lda #E.SYNTAX.ERROR
|
2018-03-28 15:23:32 +00:00
|
|
|
|
sec
|
2018-04-06 15:10:02 +00:00
|
|
|
|
.8 rts
|
2015-10-09 15:53:30 +00:00
|
|
|
|
*---------------------------------------
|
2019-03-22 16:47:33 +00:00
|
|
|
|
EXP.GetGlobal jsr SYM.LookupGlobal
|
|
|
|
|
bcc .2
|
|
|
|
|
|
2019-03-22 07:41:35 +00:00
|
|
|
|
>LDA.G ASM.PASS pass#2?
|
2018-04-06 15:10:02 +00:00
|
|
|
|
bne EXP.EvalExitUND yes, undefined symbol
|
2018-03-28 15:23:32 +00:00
|
|
|
|
|
2019-03-22 07:41:35 +00:00
|
|
|
|
lda #SYMG.F.FWREF
|
|
|
|
|
tsb SRC.ACC.F Mark ACC as pending
|
|
|
|
|
stz SRC.ACC.SIZE
|
2018-03-28 15:23:32 +00:00
|
|
|
|
|
2019-03-22 07:41:35 +00:00
|
|
|
|
.1 jsr SRC.GetNextChar
|
2018-03-28 15:23:32 +00:00
|
|
|
|
bcs .8
|
|
|
|
|
|
|
|
|
|
jsr SRC.IsLetterOrDigit
|
2019-03-22 07:41:35 +00:00
|
|
|
|
bcc .1
|
2018-03-28 15:23:32 +00:00
|
|
|
|
cmp #'.'
|
2019-03-22 07:41:35 +00:00
|
|
|
|
beq .1
|
2018-03-28 15:23:32 +00:00
|
|
|
|
cmp #'_'
|
2019-03-22 07:41:35 +00:00
|
|
|
|
beq .1
|
2018-03-28 15:23:32 +00:00
|
|
|
|
|
2019-03-22 16:47:33 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.2
|
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
2015-11-27 16:26:11 +00:00
|
|
|
|
*---------------------------------------
|
2018-04-06 15:10:02 +00:00
|
|
|
|
EXP.MOD.8.3 lda SRC.ACC+2
|
|
|
|
|
bra EXP.MOD.8
|
|
|
|
|
EXP.MOD.8.2 lda SRC.ACC+1
|
|
|
|
|
EXP.MOD.8 sta SRC.ACC
|
|
|
|
|
EXP.MOD.8.1 lda #1
|
2018-03-28 15:23:32 +00:00
|
|
|
|
sta SRC.ACC.SIZE
|
2018-04-06 15:10:02 +00:00
|
|
|
|
clc
|
2018-03-28 15:23:32 +00:00
|
|
|
|
rts
|
2018-04-06 15:10:02 +00:00
|
|
|
|
EXP.MOD.24 lda #3
|
|
|
|
|
sta SRC.ACC.SIZE
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
EXP.MOD.32 lda #4
|
|
|
|
|
sta SRC.ACC.SIZE
|
|
|
|
|
clc
|
|
|
|
|
rts
|
2018-03-23 15:57:35 +00:00
|
|
|
|
*---------------------------------------
|
2018-04-06 15:10:02 +00:00
|
|
|
|
EXP.Compute ldx SRC.ACC.SIZE
|
|
|
|
|
beq .1
|
|
|
|
|
ldx SRC.ARG.SIZE
|
2018-03-28 15:23:32 +00:00
|
|
|
|
beq .1
|
|
|
|
|
|
|
|
|
|
asl
|
|
|
|
|
tax
|
|
|
|
|
jmp (J.EXP.OP-2,x)
|
|
|
|
|
|
|
|
|
|
.1 >LDA.G ASM.PASS
|
|
|
|
|
beq .8
|
|
|
|
|
|
2019-03-25 07:04:40 +00:00
|
|
|
|
lda #E.UNDEF.SYMBOL
|
2018-03-28 15:23:32 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
|
2019-03-21 16:37:02 +00:00
|
|
|
|
.8 lda #SYMG.F.FWREF Mark ACC as pending
|
|
|
|
|
tsb SRC.ACC.F
|
|
|
|
|
stz SRC.ACC.SIZE
|
|
|
|
|
clc
|
2018-03-28 15:23:32 +00:00
|
|
|
|
rts
|
2015-12-04 16:33:33 +00:00
|
|
|
|
*---------------------------------------
|
2018-03-28 15:23:32 +00:00
|
|
|
|
EXP.OP.EOR ldx #3
|
2018-02-05 07:09:38 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
.1 lda SRC.ARG,x
|
|
|
|
|
eor SRC.ACC,x
|
|
|
|
|
sta SRC.ACC,x
|
|
|
|
|
dex
|
|
|
|
|
bpl .1
|
|
|
|
|
rts
|
2015-12-04 16:33:33 +00:00
|
|
|
|
*---------------------------------------
|
2018-03-28 15:23:32 +00:00
|
|
|
|
EXP.OP.ORA ldx #3
|
2018-02-05 07:09:38 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
.1 lda SRC.ARG,x
|
|
|
|
|
ora SRC.ACC,x
|
|
|
|
|
sta SRC.ACC,x
|
|
|
|
|
dex
|
|
|
|
|
bpl .1
|
|
|
|
|
rts
|
2015-12-04 16:33:33 +00:00
|
|
|
|
*---------------------------------------
|
2018-03-28 15:23:32 +00:00
|
|
|
|
EXP.OP.AND ldx #3
|
2018-02-05 07:09:38 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
.1 lda SRC.ARG,x
|
|
|
|
|
and SRC.ACC,x
|
|
|
|
|
sta SRC.ACC,x
|
|
|
|
|
dex
|
|
|
|
|
bpl .1
|
|
|
|
|
rts
|
2015-12-04 16:33:33 +00:00
|
|
|
|
*---------------------------------------
|
2018-04-06 15:10:02 +00:00
|
|
|
|
EXP.OP.LOW jsr EXP.OP.SUB
|
|
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
|
rol
|
|
|
|
|
|
|
|
|
|
jmp EXP.SetAccA
|
2015-12-04 16:33:33 +00:00
|
|
|
|
*---------------------------------------
|
2018-03-28 15:23:32 +00:00
|
|
|
|
EXP.OP.EQU ldx #0 ARG-ACC->ACC
|
|
|
|
|
ldy #4
|
|
|
|
|
|
|
|
|
|
clc il not Equals, return 0
|
|
|
|
|
|
|
|
|
|
.1 lda SRC.ARG,x
|
|
|
|
|
eor SRC.ACC,x
|
|
|
|
|
bne .2
|
|
|
|
|
inx
|
|
|
|
|
dey
|
|
|
|
|
bne .1
|
2018-02-02 15:55:20 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
sec equals, return 1
|
|
|
|
|
|
|
|
|
|
.2 lda #0
|
|
|
|
|
rol
|
|
|
|
|
sta SRC.ACC
|
2018-02-02 15:55:20 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
lda #1
|
|
|
|
|
sta SRC.ACC.SIZE
|
|
|
|
|
|
|
|
|
|
.9 rts
|
2015-12-04 16:33:33 +00:00
|
|
|
|
*---------------------------------------
|
2018-04-06 15:10:02 +00:00
|
|
|
|
EXP.OP.GRT jsr EXP.OP.SUB
|
|
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
|
rol
|
|
|
|
|
eor #1
|
|
|
|
|
|
|
|
|
|
jmp EXP.SetAccA
|
2015-12-04 16:33:33 +00:00
|
|
|
|
*---------------------------------------
|
2018-03-28 15:23:32 +00:00
|
|
|
|
EXP.OP.ADD ldx #0 ARG-ACC->ACC
|
|
|
|
|
ldy #4
|
2018-04-06 15:10:02 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
clc
|
|
|
|
|
|
|
|
|
|
.1 lda SRC.ARG,x
|
|
|
|
|
adc SRC.ACC,x
|
|
|
|
|
sta SRC.ACC,x
|
|
|
|
|
inx
|
|
|
|
|
dey
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
bcc .8
|
|
|
|
|
|
2019-03-25 07:04:40 +00:00
|
|
|
|
lda #E.VAL.TOO.BIG
|
2018-03-28 15:23:32 +00:00
|
|
|
|
.8 rts
|
2015-12-04 16:33:33 +00:00
|
|
|
|
*---------------------------------------
|
2018-03-28 15:23:32 +00:00
|
|
|
|
EXP.OP.SUB ldx #0 ARG-ACC->ACC
|
|
|
|
|
ldy #4
|
2018-04-06 15:10:02 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
sec
|
2015-12-04 16:33:33 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
.1 lda SRC.ARG,x
|
|
|
|
|
sbc SRC.ACC,x
|
|
|
|
|
sta SRC.ACC,x
|
|
|
|
|
inx
|
|
|
|
|
dey
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
bcs .8
|
|
|
|
|
|
2019-03-25 07:04:40 +00:00
|
|
|
|
lda #E.VAL.TOO.BIG
|
2018-03-28 15:23:32 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
2015-12-04 16:33:33 +00:00
|
|
|
|
*---------------------------------------
|
2016-09-22 15:46:01 +00:00
|
|
|
|
EXP.OP.MUL
|
2015-12-04 16:33:33 +00:00
|
|
|
|
*---------------------------------------
|
2016-09-22 15:46:01 +00:00
|
|
|
|
EXP.OP.DIV
|
2018-03-28 15:23:32 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
2015-11-27 16:26:11 +00:00
|
|
|
|
*---------------------------------------
|
2018-04-06 15:10:02 +00:00
|
|
|
|
EXP.SetAccA sta SRC.ACC
|
|
|
|
|
stz SRC.ACC+1
|
|
|
|
|
stz SRC.ACC+2
|
|
|
|
|
stz SRC.ACC+3
|
|
|
|
|
lda #1
|
|
|
|
|
sta SRC.ACC.SIZE
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*---------------------------------------
|
2015-10-09 15:53:30 +00:00
|
|
|
|
MAN
|
2019-01-28 07:44:37 +00:00
|
|
|
|
SAVE USR/SRC/BIN/ASM.S.EXP
|
|
|
|
|
LOAD USR/SRC/BIN/ASM.S
|
2015-10-28 16:55:12 +00:00
|
|
|
|
ASM
|