A2osX/BIN/ASM.S.EXP.txt

280 lines
5.2 KiB
Plaintext
Raw Normal View History

2015-10-09 15:53:30 +00:00
PR#3
PREFIX /A2OSX.BUILD
2015-10-09 15:53:30 +00:00
NEW
INC 1
AUTO 6
.LIST OFF
*---------------------------------------
* U-Operators :
* B-Operators :
* 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
*---------------------------------------
2015-11-20 16:31:14 +00:00
EXP.Eval stz EXP.Operator
2015-11-27 16:26:11 +00:00
2015-12-17 16:57:35 +00:00
stz EXP.Modifier
jsr SRC.GetCharNB
beq EXP.Eval.Missing
jsr SRC.IsMODReserved
bcs EXP.Eval.Next1
stx EXP.Modifier
bra EXP.Eval.Next
EXP.Eval.Missing lda #ERR.MISSING.EXP
2015-11-27 16:26:11 +00:00
sec
2015-12-17 16:57:35 +00:00
rts
2015-11-27 16:26:11 +00:00
2015-12-17 16:57:35 +00:00
EXP.Eval.Next jsr SRC.GetCharUC
beq EXP.Eval.Missing
EXP.Eval.Next1 cmp #'.' Local Label?
2015-11-27 16:26:11 +00:00
bne .12
jsr EXP.GetLocal
bcs .14
jmp EXP.EvalOperator
2015-12-17 16:57:35 +00:00
.14 rts
2015-11-27 16:26:11 +00:00
.12 cmp #'*'
2015-10-28 16:55:12 +00:00
bne .10
2015-10-09 15:53:30 +00:00
2015-11-20 16:31:14 +00:00
ldy #ASM.PC+3
ldx #3
2015-10-09 15:53:30 +00:00
2015-10-28 16:55:12 +00:00
.11 lda (pData),y
sta SRC.ACC,x
2015-11-20 16:31:14 +00:00
dey
dex
bpl .11
2015-12-17 16:57:35 +00:00
jmp EXP.EvalOperator
2015-10-09 15:53:30 +00:00
2015-10-28 16:55:12 +00:00
.10 jsr SRC.IsDigit10 Decimal constant ?
bcs .1
2015-10-09 15:53:30 +00:00
2015-10-28 16:55:12 +00:00
dec SRC.BufPtr
jsr SRC.GetDecimal
2015-11-27 16:26:11 +00:00
bcs EXP.EvalExitSYN
bra EXP.EvalOperator
2015-10-09 15:53:30 +00:00
2015-10-28 16:55:12 +00:00
.1 cmp #'$' Hex?
bne .2
jsr SRC.GetHex
2015-11-27 16:26:11 +00:00
bcs EXP.EvalExitSYN
bra EXP.EvalOperator
2015-10-09 15:53:30 +00:00
2015-10-28 16:55:12 +00:00
.2 cmp #'%' binary?
bne .3
jsr SRC.GetBinary
2015-10-09 15:53:30 +00:00
2015-11-27 16:26:11 +00:00
bcs EXP.EvalExitSYN
bra EXP.EvalOperator
2015-10-09 15:53:30 +00:00
2015-10-30 16:34:59 +00:00
.3 cmp #'&' octal?
bne .4
jsr SRC.GetOctal
2015-11-27 16:26:11 +00:00
bcs EXP.EvalExitSYN
bra EXP.EvalOperator
.4 cmp #'''
bne .43
jsr SRC.GetChar
beq EXP.EvalExitSYN
jsr EXP.SetAccA
jsr SRC.GetChar
beq EXP.EvalOperator
cmp #'''
bne EXP.EvalExitSYN
bra EXP.EvalOperator
.43 cmp '"'
bne .42
jsr SRC.GetChar
beq EXP.EvalExitSYN
ora #$80
jsr EXP.SetAccA
jsr SRC.GetChar
beq EXP.EvalOperator
cmp #'"'
bne EXP.EvalExitSYN
bra EXP.EvalOperator
.42 jsr SRC.IsLetter Symbol ?
bcs EXP.EvalExitSYN
2015-11-20 16:31:14 +00:00
dec SRC.BufPtr
2015-11-27 16:26:11 +00:00
jsr EXP.GetSymbol
bcs EXP.EvalExitRTS
bra EXP.EvalOperator
2015-10-09 15:53:30 +00:00
2015-11-27 16:26:11 +00:00
EXP.EvalExitOK dec SRC.BufPtr Back One Char
EXP.EvalExitOK1 clc
EXP.EvalExitRTS rts
2015-11-27 16:26:11 +00:00
EXP.EvalExitSYN lda #ERR.SYNTAX.ERROR
sec
rts
EXP.EvalExitUND lda #ERR.UNDEF.SYMBOL
sec
rts
2015-11-27 16:26:11 +00:00
EXP.EvalOperator lda EXP.Operator
beq .7
2015-11-20 16:31:14 +00:00
2015-11-27 16:26:11 +00:00
jsr EXP.Compute
bcs EXP.EvalExitRTS
.7 jsr SRC.GetChar
beq EXP.EvalExitOK1
2015-12-04 16:33:33 +00:00
2015-11-27 16:26:11 +00:00
cmp #' '
2015-12-17 16:57:35 +00:00
beq EXP.EvalExitOK
2015-12-04 16:33:33 +00:00
2015-11-27 16:26:11 +00:00
jsr SRC.IsAMReserved
bcc EXP.EvalExitOK
2015-12-04 16:33:33 +00:00
2015-11-27 16:26:11 +00:00
jsr SRC.IsEXPReserved
bcs EXP.EvalExitSYN
2015-12-04 16:33:33 +00:00
stx EXP.Operator
2015-11-27 16:26:11 +00:00
ldx #3
.8 lda SRC.ACC,x
sta SRC.ARG,x
2015-11-20 16:31:14 +00:00
dex
2015-11-27 16:26:11 +00:00
bpl .8
2015-10-09 15:53:30 +00:00
2015-12-04 16:33:33 +00:00
jmp EXP.Eval.Next
2015-11-27 16:26:11 +00:00
*---------------------------------------
EXP.GetLocal jsr SRC.GetDecimal
bcs EXP.EvalExitSYN
lda SRC.ACC+1
ora SRC.ACC+2
ora SRC.ACC+3
bne EXP.EvalExitSYN Max .255
lda SRC.ACC
beq EXP.EvalExitSYN .0 is not allowed
2015-12-04 16:33:33 +00:00
jsr SYM.SearchLocal
2015-11-27 16:26:11 +00:00
bcs EXP.EvalExitUND
2015-11-20 16:31:14 +00:00
rts
2015-10-09 15:53:30 +00:00
*---------------------------------------
2015-11-27 16:26:11 +00:00
EXP.SetAccA sta SRC.ACC
2015-10-09 15:53:30 +00:00
stz SRC.ACC+1
stz SRC.ACC+2
stz SRC.ACC+3
2015-11-27 16:26:11 +00:00
rts
2015-10-09 15:53:30 +00:00
*---------------------------------------
2015-11-27 16:26:11 +00:00
EXP.GetSymbol >LDYA L.SRC.ELabel.Len
jsr SRC.GetLabel
bcs EXP.EvalExitSYN
2015-12-04 16:33:33 +00:00
>LDYA L.SRC.ELabel.Flags
jsr SYM.SearchGlobal
2015-11-27 16:26:11 +00:00
bcc .1
ldy #ASM.PASS
lda (pData),y pass#2?
bne EXP.EvalExitUND yes, undefined symbol
lda #$C0 Valid+Pending
sta SRC.ELabel.Flags
>LDYA L.SRC.ELabel.Flags
jsr SYM.AddGToGBlockYA
rts
2015-10-28 16:55:12 +00:00
2015-11-27 16:26:11 +00:00
.1 ldx #3
.2 lda SRC.FLabel.Value,x
sta SRC.ACC,x
dex
bpl .2
clc
rts
*---------------------------------------
2015-12-04 16:33:33 +00:00
EXP.Compute dec
asl
tax
2015-12-17 16:57:35 +00:00
* ldy #ASM.PASS
* lda (pData),y pass#2?
* beq .8
2015-12-04 16:33:33 +00:00
jmp (J.EXP.OP,x)
2015-12-17 16:57:35 +00:00
.8 clc
rts
2015-12-04 16:33:33 +00:00
*---------------------------------------
EXP.OP.EOR
2015-12-04 16:33:33 +00:00
*---------------------------------------
EXP.OP.ORA
2015-12-04 16:33:33 +00:00
*---------------------------------------
EXP.OP.AND
2015-12-04 16:33:33 +00:00
*---------------------------------------
EXP.OP.LOW
2015-12-04 16:33:33 +00:00
*---------------------------------------
EXP.OP.EQU
2015-12-04 16:33:33 +00:00
*---------------------------------------
EXP.OP.GRT
2015-12-04 16:33:33 +00:00
clc
rts
*---------------------------------------
EXP.OP.ADD ldx #0 ARG-ACC->ACC
2015-12-04 16:33:33 +00:00
ldy #4
clc
.1 lda SRC.ARG,x
adc SRC.ACC,x
sta SRC.ACC,x
inx
dey
bne .1
bcc .8
lda #ERR.VAL.TOO.BIG
.8 rts
*---------------------------------------
EXP.OP.SUB ldx #0 ARG-ACC->ACC
2015-12-04 16:33:33 +00:00
ldy #4
sec
.1 lda SRC.ARG,x
sbc SRC.ACC,x
sta SRC.ACC,x
inx
dey
bne .1
bcs .8
lda #ERR.VAL.TOO.BIG
sec
rts
.8 clc
rts
*---------------------------------------
EXP.OP.MUL
2015-12-04 16:33:33 +00:00
*---------------------------------------
EXP.OP.DIV
2015-11-27 16:26:11 +00:00
clc
rts
*---------------------------------------
2015-10-09 15:53:30 +00:00
MAN
SAVE /A2OSX.SRC/BIN/ASM.S.EXP
2015-10-09 15:53:30 +00:00
LOAD BIN/ASM.S
2015-10-28 16:55:12 +00:00
ASM