A2osX/BIN/SH.S.EXP.txt
2019-04-03 06:51:28 +01:00

303 lines
5.3 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

NEW
PREFIX
AUTO 4,1
.LIST OFF
*--------------------------------------
EXP.GET jsr CORE.ArgV.Next
bne .1
>LDYA ZPArgVBufPrev no op, return text value
clc
rts
.1 >LDYA ZPArgVBufPrev
>SYSCALL AToL
bcs .99
>PULLL M32.ACC
.2 >LDYA L.EXP.OP.MATH + - .... ?
jsr CORE.LookupArgVBuf
bcs .9
txa
>STA.G CORE.Operator
jsr M32.ACC2ARG
jsr CORE.ArgV.Next get next argument in ACC
beq .9
>LDYA ZPArgVBufPtr
>SYSCALL AToL
bcs .9
>PULLL M32.ACC
jsr EXP.GET.OP
.99 bcs .9
jsr CORE.ArgV.Next another op ?
bne .2
.8 >PUSHL M32.ACC
>PUSHBI 4
>PUSHW L.M32.Printf
>LEA.G M32.BUF
>SYSCALL sprintf
bcs .9
>LEA.G M32.BUF
rts
.9 lda #E.ESYN
sec
rts
EXP.GET.OP >LDA.G CORE.Operator
asl
tax
jmp (J.EXP.OP.MATH,x)
*--------------------------------------
EXP.TEST lda (ZPArgVBufPtr)
beq .9
lda #$ff
>STA.G CORE.TestArg True
>STA.G CORE.TestOp no op
.10 >LDYA L.EXP.BEGIN
jsr CORE.LookupArgVBuf
bcs .9
cpx #2 0=[ or 1=![
bcs .9
dex $ff or 0
txa
and #$80 true or false
>ORA.G CORE.Test
sta (pData),y
jsr CORE.ArgV.Next
beq .9
>LDYA L.EXP.OP.UNARY -d -e -f -n -z ?
jsr CORE.LookupArgVBuf
bcs .1
txa
>STA.G CORE.Operator
jsr EXP.TEST.UNARY
bcs .9
>EOR.G CORE.Test
sta (pData),y
lda (ZPArgVBufPtr)
bra .80 go check ]
.9 lda #E.ESYN
sec
.99 rts
.1 jsr CORE.ArgV.Next
beq .9
>LDYA L.EXP.OP.BINARY -eq -ne .... ?
jsr CORE.LookupArgVBuf
bcs .9
txa
>STA.G CORE.Operator
jsr EXP.TEST.BINARY
bcs .9
>EOR.G CORE.Test
sta (pData),y
.8 jsr CORE.ArgV.Next
beq .9
.80 cmp #']'
bne .9
ldy #1
lda (ZPArgVBufPtr),y
bne .9
jsr CORE.ArgV.Next
beq .82
>LDYA L.EXP.OP.LOGIC
jsr CORE.LookupArgVBuf
bcs .9
txa
>STA.G CORE.TestOp
>LDA.G CORE.Test
>STA.G CORE.TestArg
txa
bne .81 OR...
tay AND : stop if already false
bpl .88
.81 jsr CORE.ArgV.Next
beq .9
jmp .10
.82 >LDA.G CORE.TestOp
bmi .88
>LDA.G CORE.Test
>ORA.G CORE.TestArg
>STA.G CORE.Test
.88 clc
rts
*--------------------------------------
EXP.TEST.UNARY jsr CORE.ArgV.Next
beq EXP.OP.UNARY.ESYN we need one arg or ]
>LDA.G CORE.Operator
asl
tax
jmp (J.EXP.OP.UNARY,x)
EXP.OP.UNARY.ESYN
lda #E.ESYN
sec
rts
EXP.OP.UNARY.D jsr EXP.OP.UNARY.STAT
bcs EXP.OP.UNARY.DEF.9
>LDA.G StatBuf+S.STAT.P.TYPE
cmp #S.FI.T.DIR
bne EXP.OP.UNARY.DEF.9
bra EXP.OP.UNARY.DEF.8
EXP.OP.UNARY.E jsr EXP.OP.UNARY.STAT
bcs EXP.OP.UNARY.DEF.9
bra EXP.OP.UNARY.DEF.8 DIR or FILE exist
EXP.OP.UNARY.F jsr EXP.OP.UNARY.STAT
bcs EXP.OP.UNARY.DEF.9
>LDA.G StatBuf+S.STAT.P.TYPE
cmp #S.FI.T.DIR
beq EXP.OP.UNARY.DEF.9
bra EXP.OP.UNARY.DEF.8
EXP.OP.UNARY.STAT
>PUSHEA.G StatBuf
>LDYA ZPArgVBufPtr
>SYSCALL STAT
php
jsr CORE.ArgV.Next
plp
rts
EXP.OP.UNARY.DEF.8
lda #$80 true
clc
rts
EXP.OP.UNARY.DEF.9
lda #0 false
clc
rts
*--------------------------------------
EXP.OP.UNARY.N lda (ZPArgVBufPtr) [ -N ] ?
cmp #']'
beq EXP.OP.UNARY.DEF.9 FALSE
jsr CORE.ArgV.Next
beq EXP.OP.UNARY.ESYN
bra EXP.OP.UNARY.DEF.8 arg is not empty TRUE
EXP.OP.UNARY.Z lda (ZPArgVBufPtr) [ -Z ] ?
cmp #']'
beq EXP.OP.UNARY.DEF.8 TRUE
jsr CORE.ArgV.Next
beq EXP.OP.UNARY.ESYN
bra EXP.OP.UNARY.DEF.9 FALSE
*--------------------------------------
EXP.TEST.BINARY >LDA.G CORE.Operator
cmp #6 =, !=, <= <, >=, >
bcs EXP.TEST.BINARY.NUM
>LDYA ZPArgVBufPrev
>STYA ZPPtr1
jsr CORE.ArgV.Next
beq EXP.TEST.BINARY.ESYN
>PUSHW ZPPtr1
>LDYA ZPArgVBufPtr
>SYSCALL strcmp
bcs .1 CS if !=
lda #%010 010 str1 = str2
bra EXP.TEST.BINARY.END
.1 asl CS if <
bcs .2
lda #%100 010 str1 < str2
bra EXP.TEST.BINARY.END
.2 lda #%001 010 str1 > str2
bra EXP.TEST.BINARY.END
EXP.TEST.BINARY.ESYN
lda #E.ESYN
sec
rts
*--------------------------------------
EXP.TEST.BINARY.NUM
>LDYA ZPArgVBufPrev
>SYSCALL AToL
bcs EXP.TEST.BINARY.ESYN
>PULLL M32.ACC
jsr CORE.ArgV.Next
beq EXP.TEST.BINARY.ESYN
>LDYA ZPArgVBufPtr
>SYSCALL AToL
bcs EXP.TEST.BINARY.ESYN
>PULLL M32.ARG
jsr M32.Cmp
EXP.TEST.BINARY.END
pha
>LDA.G CORE.Operator
tax
pla
and EXP.OP.BINARY.BITS,x
beq .80
lda #$80 true
clc
rts
.80 lda #0 false
clc
rts
*--------------------------------------
MAN
SAVE USR/SRC/BIN/SH.S.EXP
LOAD USR/SRC/BIN/SH.S
ASM