mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-25 05:32:20 +00:00
127ebe266a
SH: bugfix BIN/*, DRV/*:bugfix, API change
325 lines
5.8 KiB
Plaintext
325 lines
5.8 KiB
Plaintext
NEW
|
||
AUTO 3,1
|
||
*--------------------------------------
|
||
EXP.GET jsr CORE.ArgV.Next
|
||
bne .1
|
||
>LDYA ZPArgVBufPrev no op, return text value
|
||
clc
|
||
rts
|
||
|
||
.1 >PUSHEA.G M32.BUF
|
||
>PUSHW L.FMT.Long
|
||
|
||
>LDYA ZPArgVBufPrev
|
||
jsr EXP.GetInt32YA To Int32 on stack
|
||
bcs .94 4 bytes on stack
|
||
|
||
.2 >LDYA L.EXP.OP.MATH + - .... ?
|
||
jsr CORE.LookupArgVBuf
|
||
bcs .98
|
||
|
||
stx CORE.Operator
|
||
jsr CORE.ArgV.Next get next argument
|
||
beq .98
|
||
|
||
jsr EXP.GetInt32Arg To Int32 on stack
|
||
bcs .98
|
||
|
||
jsr EXP.FPU.EXEC
|
||
jsr CORE.ArgV.Next another op ?
|
||
bne .2
|
||
|
||
>PUSHBI 4
|
||
>SYSCALL SPrintF
|
||
bcs .9
|
||
|
||
>LEA.G M32.BUF
|
||
rts
|
||
|
||
.98 jsr IncPStack4
|
||
.94 jsr IncPStack4
|
||
.9 jmp EXP.E.ESYN
|
||
|
||
EXP.FPU.EXEC ldy CORE.Operator
|
||
ldx EXP.OP.MATH.FPU,y
|
||
|
||
jmp A2osX.FPUCALL
|
||
*--------------------------------------
|
||
EXP.TEST lda (ZPArgVBufPtr)
|
||
beq .9
|
||
|
||
lda #$80
|
||
sta CORE.LogicOp No Op
|
||
.10 >LDYA L.EXP.BEGIN
|
||
jsr CORE.LookupArgVBuf
|
||
|
||
bcs .9
|
||
|
||
dex 0=[ or 1=![ , $ff or 0
|
||
txa
|
||
asl in C
|
||
php
|
||
lda CORE.TestResult get parent
|
||
asl discard true/false
|
||
plp get new
|
||
ror set ctx and parent
|
||
sta CORE.TestResult
|
||
jsr CORE.ArgV.Next
|
||
beq .9
|
||
|
||
>LDYA L.EXP.OP.UNARY -d -e -f -n -z ?
|
||
jsr CORE.LookupArgVBuf
|
||
|
||
bcs .1
|
||
|
||
stx CORE.Operator
|
||
|
||
jsr EXP.TEST.UNARY
|
||
bcs .9
|
||
eor CORE.TestResult
|
||
sta CORE.TestResult
|
||
lda (ZPArgVBufPtr)
|
||
bra .8 go check ]
|
||
|
||
.9 jmp EXP.E.ESYN
|
||
|
||
.1 jsr CORE.ArgV.Next
|
||
beq .9
|
||
|
||
>LDYA L.EXP.OP.BINARY -eq -ne .... ?
|
||
jsr CORE.LookupArgVBuf
|
||
bcs .9
|
||
|
||
stx CORE.Operator
|
||
jsr EXP.TEST.BINARY
|
||
bcs .9
|
||
|
||
eor CORE.TestResult
|
||
sta CORE.TestResult
|
||
|
||
jsr CORE.ArgV.Next
|
||
beq .9
|
||
|
||
.8 cmp #']'
|
||
bne .9
|
||
|
||
ldy #1
|
||
lda (ZPArgVBufPtr),y
|
||
bne .9
|
||
|
||
jsr CORE.ArgV.Next
|
||
beq .80
|
||
|
||
>LDYA L.EXP.OP.LOGIC
|
||
jsr CORE.LookupArgVBuf
|
||
bcs .9
|
||
|
||
stx CORE.LogicOp 0 = AND, 1 = OR
|
||
txa
|
||
beq .84
|
||
|
||
lda CORE.TestResult OR : prev test is true, exit
|
||
bmi .88
|
||
|
||
bra .85
|
||
|
||
.84 lda CORE.TestResult AND : prev test is false, exit
|
||
bpl .88
|
||
|
||
.85 lda CORE.TestResult
|
||
sta CORE.PrevTestResult
|
||
jsr CORE.ArgV.Next
|
||
beq .9
|
||
|
||
jmp .10
|
||
|
||
.80 lda CORE.LogicOp
|
||
bne .88 NONE, or OR : exit with last result
|
||
|
||
lda CORE.PrevTestResult AND : stop if false
|
||
and CORE.TestResult
|
||
sta CORE.TestResult
|
||
|
||
.88 clc
|
||
rts
|
||
*--------------------------------------
|
||
EXP.TEST.UNARY jsr CORE.ArgV.Next
|
||
beq EXP.OP.UNARY.ESYN we need one arg or ]
|
||
|
||
lda CORE.Operator
|
||
asl
|
||
tax
|
||
jmp (J.EXP.OP.UNARY,x)
|
||
|
||
EXP.OP.UNARY.ESYN
|
||
jmp EXP.E.ESYN
|
||
|
||
EXP.OP.UNARY.D jsr IO.StatArgVBufPtr
|
||
bcs EXP.OP.UNARY.DEF.9
|
||
|
||
cmp /S.STAT.MODE.DIR
|
||
bne EXP.OP.UNARY.DEF.9
|
||
bra EXP.OP.UNARY.DEF.8
|
||
|
||
EXP.OP.UNARY.E jsr IO.StatArgVBufPtr
|
||
bcs EXP.OP.UNARY.DEF.9
|
||
bra EXP.OP.UNARY.DEF.8 DIR or FILE exist
|
||
|
||
EXP.OP.UNARY.F jsr IO.StatArgVBufPtr
|
||
bcs EXP.OP.UNARY.DEF.9
|
||
|
||
cmp /S.STAT.MODE.DIR
|
||
beq EXP.OP.UNARY.DEF.9
|
||
|
||
EXP.OP.UNARY.DEF.8
|
||
sec true
|
||
.HS 90 BCC
|
||
EXP.OP.UNARY.DEF.9
|
||
clc false
|
||
|
||
jsr CORE.ArgV.Next
|
||
|
||
lda #0
|
||
ror
|
||
|
||
* clc
|
||
EXP.OP.UNARY.DEF.RTS
|
||
rts
|
||
*--------------------------------------
|
||
EXP.OP.UNARY.I jsr EXP.GetInt32Arg
|
||
bcs EXP.OP.UNARY.DEF.9
|
||
|
||
jsr IncPStack4 Discard Long
|
||
|
||
bra EXP.OP.UNARY.DEF.8
|
||
*--------------------------------------
|
||
EXP.OP.UNARY.N jsr EXP.OP.UNARY.Z
|
||
bcs EXP.OP.UNARY.DEF.RTS
|
||
eor #$80
|
||
* clc
|
||
rts
|
||
|
||
EXP.OP.UNARY.Z lda (ZPArgVBufPtr) [ -Z ] ?
|
||
cmp #']'
|
||
bne .1
|
||
lda #$80 TRUE
|
||
clc
|
||
rts
|
||
|
||
.1 jsr CORE.ArgV.Next
|
||
beq EXP.TEST.BINARY.ESYN
|
||
|
||
eor #']'
|
||
bne EXP.TEST.BINARY.ESYN
|
||
|
||
clc FALSE
|
||
rts
|
||
*--------------------------------------
|
||
EXP.OP.UNARY.X jsr CMD.CALL.GETFUNC
|
||
bcs EXP.OP.UNARY.DEF.9 FALSE
|
||
bra EXP.OP.UNARY.DEF.8 TRUE
|
||
*--------------------------------------
|
||
EXP.TEST.BINARY lda CORE.Operator
|
||
cmp #6
|
||
bcc EXP.TEST.BINARY.NUM
|
||
|
||
>LDYA ZPArgVBufPrev =, !=, <= <, >=, >
|
||
>STYA ZPPtr1
|
||
jsr CORE.ArgV.Next
|
||
beq EXP.TEST.BINARY.ESYN
|
||
|
||
>PUSHW ZPPtr1
|
||
>PUSHW ZPArgVBufPtr
|
||
>SYSCALL StrCmp
|
||
|
||
bcs .1 CS if !=
|
||
|
||
lda #%010 010 str1 = str2
|
||
bra .3
|
||
|
||
.1 asl CS if <
|
||
bcc .2
|
||
|
||
lda #%100 100 str1 < str2
|
||
bra .3
|
||
|
||
.2 lda #%001 001 str1 > str2
|
||
|
||
.3 ldx CORE.Operator
|
||
|
||
and EXP.OP.BINARY.BITS-6,x
|
||
beq .8 false
|
||
|
||
lda #$80 true
|
||
|
||
.8 clc
|
||
rts
|
||
|
||
EXP.TEST.BINARY.ESYN4
|
||
jsr IncPStack4
|
||
EXP.TEST.BINARY.ESYN
|
||
jmp EXP.E.ESYN
|
||
*--------------------------------------
|
||
EXP.TEST.BINARY.NUM
|
||
>LDYA ZPArgVBufPrev
|
||
jsr EXP.GetInt32YA
|
||
bcs EXP.TEST.BINARY.ESYN
|
||
|
||
jsr CORE.ArgV.Next
|
||
beq EXP.TEST.BINARY.ESYN4
|
||
|
||
jsr EXP.GetInt32Arg
|
||
bcs EXP.TEST.BINARY.ESYN4
|
||
|
||
lda CORE.Operator
|
||
asl
|
||
* clc
|
||
adc #FPU.lL
|
||
tax
|
||
jsr A2osX.FPUCALL
|
||
|
||
lda (pStack)
|
||
beq .8 false
|
||
|
||
lda #$80 true
|
||
|
||
.8 clc
|
||
>RET 4
|
||
*--------------------------------------
|
||
EXP.GetInt8Exp jsr EXP.GET
|
||
bcc EXP.GetInt8YA
|
||
rts
|
||
|
||
EXP.GetInt8Arg >LDYA ZPArgVBufPtr
|
||
|
||
EXP.GetInt8YA jsr EXP.GetInt32YA
|
||
bcs .9
|
||
|
||
>PULLA
|
||
|
||
jsr IncPStack3
|
||
* clc
|
||
|
||
.9 rts
|
||
*--------------------------------------
|
||
EXP.GetInt32Arg >LDYA ZPArgVBufPtr
|
||
|
||
EXP.GetInt32YA >PUSHYA
|
||
>PUSHWI ZPPtr1
|
||
>PUSHBI 10
|
||
>SYSCALL StrToL
|
||
bcs EXP.E.ESYN
|
||
|
||
lda (ZPPtr1)
|
||
beq EXP.GetInt32YA.RTS
|
||
|
||
EXP.E.ESYN lda #E.ESYN
|
||
sec
|
||
EXP.GetInt32YA.RTS
|
||
rts
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE usr/src/bin/sh.s.exp
|
||
LOAD usr/src/bin/sh.s
|
||
ASM
|