A2osX/BIN/SH.S.EXP.txt

326 lines
5.8 KiB
Plaintext
Raw Normal View History

2019-02-01 16:32:29 +00:00
NEW
2019-06-02 08:58:46 +00:00
AUTO 3,1
2021-05-11 18:44:13 +00:00
.LIST OFF
2019-02-01 16:32:29 +00:00
*--------------------------------------
2019-02-12 16:47:34 +00:00
EXP.GET jsr CORE.ArgV.Next
2019-02-11 06:58:33 +00:00
bne .1
2019-02-12 16:47:34 +00:00
>LDYA ZPArgVBufPrev no op, return text value
2019-02-11 06:58:33 +00:00
clc
rts
2019-11-15 14:40:48 +00:00
2020-08-20 13:20:33 +00:00
.1 >PUSHEA.G M32.BUF
>PUSHW L.FMT.Long
2019-11-15 14:40:48 +00:00
2020-08-20 13:20:33 +00:00
>LDYA ZPArgVBufPrev
jsr EXP.GetInt32YA To Int32 on stack
bcs .94 4 bytes on stack
2021-05-11 18:44:13 +00:00
2019-04-01 06:07:56 +00:00
.2 >LDYA L.EXP.OP.MATH + - .... ?
2019-02-11 16:44:56 +00:00
jsr CORE.LookupArgVBuf
2020-08-20 13:20:33 +00:00
bcs .98
2019-02-11 06:58:33 +00:00
2019-07-31 15:10:59 +00:00
stx CORE.Operator
2019-07-26 06:28:52 +00:00
jsr CORE.ArgV.Next get next argument
2020-08-20 13:20:33 +00:00
beq .98
2019-11-22 11:25:27 +00:00
jsr EXP.GetInt32Arg To Int32 on stack
2020-08-20 13:20:33 +00:00
bcs .98
2019-02-11 06:58:33 +00:00
2019-07-07 20:48:57 +00:00
jsr EXP.FPU.EXEC
2019-08-15 12:48:58 +00:00
jsr CORE.ArgV.Next another op ?
2019-02-11 06:58:33 +00:00
bne .2
2020-01-08 07:13:42 +00:00
2020-05-06 19:26:56 +00:00
>PUSHBI 4
2020-03-09 16:24:08 +00:00
>SYSCALL SPrintF
2019-02-11 06:58:33 +00:00
bcs .9
2020-05-06 19:26:56 +00:00
2019-04-01 06:07:56 +00:00
>LEA.G M32.BUF
2019-02-11 06:58:33 +00:00
rts
2019-11-15 14:40:48 +00:00
2020-08-20 13:20:33 +00:00
.98 jsr IncPStack4
2020-01-08 07:13:42 +00:00
.94 jsr IncPStack4
2019-12-20 19:46:21 +00:00
.9 jmp EXP.E.ESYN
2019-11-15 14:40:48 +00:00
2019-07-31 15:10:59 +00:00
EXP.FPU.EXEC ldy CORE.Operator
ldx EXP.OP.MATH.FPU,y
2019-07-07 20:48:57 +00:00
2020-02-28 07:21:46 +00:00
jmp A2osX.FPUCALL
2019-02-11 06:58:33 +00:00
*--------------------------------------
EXP.TEST lda (ZPArgVBufPtr)
2019-02-01 16:32:29 +00:00
beq .9
2019-04-02 15:28:50 +00:00
2019-04-08 15:39:38 +00:00
lda #$80
2019-07-31 15:10:59 +00:00
sta CORE.LogicOp No Op
2019-04-01 15:24:01 +00:00
.10 >LDYA L.EXP.BEGIN
2019-02-11 16:44:56 +00:00
jsr CORE.LookupArgVBuf
2019-02-01 16:32:29 +00:00
bcs .9
2021-05-11 18:44:13 +00:00
2019-04-08 15:39:38 +00:00
dex 0=[ or 1=![ , $ff or 0
2019-02-01 16:32:29 +00:00
txa
2019-04-08 20:42:18 +00:00
asl in C
php
2019-07-31 15:10:59 +00:00
lda CORE.TestResult get parent
2019-04-08 20:42:18 +00:00
asl discard true/false
plp get new
ror set ctx and parent
2019-07-31 15:10:59 +00:00
sta CORE.TestResult
2019-02-11 06:58:33 +00:00
jsr CORE.ArgV.Next
2019-02-01 16:32:29 +00:00
beq .9
2019-02-12 16:47:34 +00:00
2019-02-14 14:51:24 +00:00
>LDYA L.EXP.OP.UNARY -d -e -f -n -z ?
2019-02-11 16:44:56 +00:00
jsr CORE.LookupArgVBuf
2019-02-01 16:32:29 +00:00
bcs .1
2019-07-31 15:10:59 +00:00
stx CORE.Operator
2021-05-11 18:44:13 +00:00
2019-02-11 06:58:33 +00:00
jsr EXP.TEST.UNARY
2019-02-01 16:32:29 +00:00
bcs .9
2019-07-31 15:10:59 +00:00
eor CORE.TestResult
2019-07-31 20:41:37 +00:00
sta CORE.TestResult
2019-02-14 14:51:24 +00:00
lda (ZPArgVBufPtr)
2019-04-08 15:39:38 +00:00
bra .8 go check ]
2019-02-11 06:58:33 +00:00
2019-12-20 19:46:21 +00:00
.9 jmp EXP.E.ESYN
2019-02-12 16:47:34 +00:00
.1 jsr CORE.ArgV.Next
2019-02-01 16:32:29 +00:00
beq .9
2021-05-09 17:04:44 +00:00
2019-02-01 16:32:29 +00:00
>LDYA L.EXP.OP.BINARY -eq -ne .... ?
2019-02-11 16:44:56 +00:00
jsr CORE.LookupArgVBuf
2019-02-01 16:32:29 +00:00
bcs .9
2021-05-09 17:04:44 +00:00
2020-03-09 16:24:08 +00:00
stx CORE.Operator
2019-02-11 06:58:33 +00:00
jsr EXP.TEST.BINARY
2019-02-01 16:32:29 +00:00
bcs .9
2019-07-31 15:10:59 +00:00
eor CORE.TestResult
2019-07-31 20:41:37 +00:00
sta CORE.TestResult
2019-02-01 16:32:29 +00:00
2019-04-08 15:39:38 +00:00
jsr CORE.ArgV.Next
2019-02-01 16:32:29 +00:00
beq .9
2020-01-07 16:46:50 +00:00
2019-04-08 15:39:38 +00:00
.8 cmp #']'
2019-02-01 16:32:29 +00:00
bne .9
2020-01-07 16:46:50 +00:00
2019-02-01 16:32:29 +00:00
ldy #1
2019-02-11 06:58:33 +00:00
lda (ZPArgVBufPtr),y
2019-02-01 16:32:29 +00:00
bne .9
2020-01-07 16:46:50 +00:00
2019-04-01 15:24:01 +00:00
jsr CORE.ArgV.Next
2019-04-08 15:39:38 +00:00
beq .80
2020-01-07 16:46:50 +00:00
2019-04-01 15:24:01 +00:00
>LDYA L.EXP.OP.LOGIC
jsr CORE.LookupArgVBuf
bcs .9
2019-04-08 15:39:38 +00:00
2019-07-31 15:10:59 +00:00
stx CORE.LogicOp 0 = AND, 1 = OR
2019-04-01 15:24:01 +00:00
txa
2019-04-08 15:39:38 +00:00
beq .84
2020-01-07 21:34:10 +00:00
2019-07-31 15:10:59 +00:00
lda CORE.TestResult OR : prev test is true, exit
2019-04-08 15:39:38 +00:00
bmi .88
2020-01-07 21:34:10 +00:00
2019-04-08 15:39:38 +00:00
bra .85
2020-01-07 21:34:10 +00:00
2019-07-31 15:10:59 +00:00
.84 lda CORE.TestResult AND : prev test is false, exit
2019-04-01 15:24:01 +00:00
bpl .88
2020-01-07 21:34:10 +00:00
2019-07-31 15:10:59 +00:00
.85 lda CORE.TestResult
sta CORE.PrevTestResult
2019-04-08 15:39:38 +00:00
jsr CORE.ArgV.Next
2019-04-01 15:24:01 +00:00
beq .9
2020-01-07 21:34:10 +00:00
2021-05-11 18:44:13 +00:00
jmp .10
2020-01-07 21:34:10 +00:00
2019-07-31 15:10:59 +00:00
.80 lda CORE.LogicOp
2019-04-08 15:39:38 +00:00
bne .88 NONE, or OR : exit with last result
2020-01-07 21:34:10 +00:00
2019-07-31 15:10:59 +00:00
lda CORE.PrevTestResult AND : stop if false
and CORE.TestResult
sta CORE.TestResult
2020-01-07 21:34:10 +00:00
2019-04-01 15:24:01 +00:00
.88 clc
2019-02-01 16:32:29 +00:00
rts
*--------------------------------------
2019-02-11 06:58:33 +00:00
EXP.TEST.UNARY jsr CORE.ArgV.Next
2019-02-14 14:51:24 +00:00
beq EXP.OP.UNARY.ESYN we need one arg or ]
2021-05-11 18:44:13 +00:00
2019-07-31 15:10:59 +00:00
lda CORE.Operator
2019-04-01 06:07:56 +00:00
asl
2019-02-01 16:32:29 +00:00
tax
jmp (J.EXP.OP.UNARY,x)
2019-02-14 14:51:24 +00:00
EXP.OP.UNARY.ESYN
2019-12-20 19:46:21 +00:00
jmp EXP.E.ESYN
2019-11-20 10:08:49 +00:00
2020-01-07 21:34:10 +00:00
EXP.OP.UNARY.D jsr IO.StatArgVBufPtr
2019-02-01 16:32:29 +00:00
bcs EXP.OP.UNARY.DEF.9
2020-01-07 13:44:38 +00:00
2021-02-17 16:15:43 +00:00
cmp /S.STAT.MODE.DIR
2019-02-01 16:32:29 +00:00
bne EXP.OP.UNARY.DEF.9
bra EXP.OP.UNARY.DEF.8
2021-05-11 18:44:13 +00:00
2020-01-07 13:44:38 +00:00
EXP.OP.UNARY.E jsr IO.StatArgVBufPtr
2019-02-01 16:32:29 +00:00
bcs EXP.OP.UNARY.DEF.9
bra EXP.OP.UNARY.DEF.8 DIR or FILE exist
2019-11-22 11:25:27 +00:00
2020-01-07 13:44:38 +00:00
EXP.OP.UNARY.F jsr IO.StatArgVBufPtr
2019-02-01 16:32:29 +00:00
bcs EXP.OP.UNARY.DEF.9
2021-02-17 16:15:43 +00:00
cmp /S.STAT.MODE.DIR
2019-02-01 16:32:29 +00:00
beq EXP.OP.UNARY.DEF.9
2021-05-11 18:44:13 +00:00
EXP.OP.UNARY.DEF.8
2020-01-07 13:44:38 +00:00
sec true
.HS 90 BCC
2021-05-11 18:44:13 +00:00
EXP.OP.UNARY.DEF.9
2020-01-07 13:44:38 +00:00
clc false
jsr CORE.ArgV.Next
2020-01-07 21:34:10 +00:00
2020-01-07 13:44:38 +00:00
lda #0
2020-01-07 21:34:10 +00:00
ror
2021-05-11 18:44:13 +00:00
2020-01-07 16:46:50 +00:00
* clc
2019-11-22 11:25:27 +00:00
EXP.OP.UNARY.DEF.RTS
2019-02-01 16:32:29 +00:00
rts
*--------------------------------------
2019-11-22 11:25:27 +00:00
EXP.OP.UNARY.I jsr EXP.GetInt32Arg
2019-11-20 10:08:49 +00:00
bcs EXP.OP.UNARY.DEF.9
2020-01-08 07:13:42 +00:00
jsr IncPStack4 Discard Long
2021-05-11 18:44:13 +00:00
2019-11-22 11:25:27 +00:00
bra EXP.OP.UNARY.DEF.8
2019-11-20 10:08:49 +00:00
*--------------------------------------
2019-11-22 11:25:27 +00:00
EXP.OP.UNARY.N jsr EXP.OP.UNARY.Z
bcs EXP.OP.UNARY.DEF.RTS
eor #$80
* clc
rts
2021-05-11 18:44:13 +00:00
2019-02-14 14:51:24 +00:00
EXP.OP.UNARY.Z lda (ZPArgVBufPtr) [ -Z ] ?
cmp #']'
2020-01-07 16:46:50 +00:00
bne .1
lda #$80 TRUE
clc
rts
2020-01-07 15:13:40 +00:00
2020-01-07 16:46:50 +00:00
.1 jsr CORE.ArgV.Next
2019-11-20 10:08:49 +00:00
beq EXP.TEST.BINARY.ESYN
2020-01-07 15:13:40 +00:00
2020-01-07 16:46:50 +00:00
eor #']'
2020-01-07 13:44:38 +00:00
bne EXP.TEST.BINARY.ESYN
2020-01-07 15:13:40 +00:00
2020-01-07 16:46:50 +00:00
clc FALSE
rts
2019-02-14 14:51:24 +00:00
*--------------------------------------
2019-11-22 11:25:27 +00:00
EXP.OP.UNARY.X jsr CMD.CALL.GETFUNC
bcs EXP.OP.UNARY.DEF.9 FALSE
bra EXP.OP.UNARY.DEF.8 TRUE
*--------------------------------------
2019-07-31 15:10:59 +00:00
EXP.TEST.BINARY lda CORE.Operator
2021-05-04 17:31:21 +00:00
cmp #6
bcc EXP.TEST.BINARY.NUM
>LDYA ZPArgVBufPrev =, !=, <= <, >=, >
2019-02-21 22:03:08 +00:00
>STYA ZPPtr1
jsr CORE.ArgV.Next
2019-03-11 15:43:33 +00:00
beq EXP.TEST.BINARY.ESYN
2019-11-15 14:40:48 +00:00
2019-02-21 22:03:08 +00:00
>PUSHW ZPPtr1
2021-05-04 17:31:21 +00:00
>PUSHW ZPArgVBufPtr
2020-03-09 16:24:08 +00:00
>SYSCALL StrCmp
2021-05-11 18:44:13 +00:00
bcs .1 CS if !=
2019-11-15 14:40:48 +00:00
2019-10-03 06:25:27 +00:00
lda #%010 010 str1 = str2
2021-05-04 17:31:21 +00:00
bra .3
2019-11-15 14:40:48 +00:00
2019-03-11 15:43:33 +00:00
.1 asl CS if <
2021-05-11 18:44:13 +00:00
bcc .2
2019-11-15 14:40:48 +00:00
2021-05-11 18:44:13 +00:00
lda #%100 100 str1 < str2
2021-05-04 17:31:21 +00:00
bra .3
2019-11-15 14:40:48 +00:00
2021-05-11 18:44:13 +00:00
.2 lda #%001 001 str1 > str2
2021-05-04 17:31:21 +00:00
.3 ldx CORE.Operator
2021-05-11 18:44:13 +00:00
2021-05-04 17:31:21 +00:00
and EXP.OP.BINARY.BITS-6,x
beq .8 false
lda #$80 true
.8 clc
rts
2019-07-25 06:13:56 +00:00
EXP.TEST.BINARY.ESYN4
2020-01-08 07:13:42 +00:00
jsr IncPStack4
2019-03-11 15:43:33 +00:00
EXP.TEST.BINARY.ESYN
2019-12-20 19:46:21 +00:00
jmp EXP.E.ESYN
2019-02-01 16:32:29 +00:00
*--------------------------------------
2019-02-11 06:58:33 +00:00
EXP.TEST.BINARY.NUM
2019-02-14 14:51:24 +00:00
>LDYA ZPArgVBufPrev
2019-11-22 11:25:27 +00:00
jsr EXP.GetInt32YA
2019-03-11 15:43:33 +00:00
bcs EXP.TEST.BINARY.ESYN
2021-05-11 18:44:13 +00:00
2019-02-14 14:51:24 +00:00
jsr CORE.ArgV.Next
2019-07-25 06:13:56 +00:00
beq EXP.TEST.BINARY.ESYN4
2019-11-22 11:25:27 +00:00
jsr EXP.GetInt32Arg
2019-07-25 06:13:56 +00:00
bcs EXP.TEST.BINARY.ESYN4
2019-02-01 16:32:29 +00:00
2021-05-04 17:31:21 +00:00
lda CORE.Operator
2021-05-09 17:04:44 +00:00
asl
2021-05-04 17:31:21 +00:00
* clc
adc #FPU.lL
2019-08-02 20:55:43 +00:00
tax
2021-05-04 17:31:21 +00:00
jsr A2osX.FPUCALL
lda (pStack)
2019-07-31 15:10:59 +00:00
beq .8 false
2019-02-01 16:32:29 +00:00
lda #$80 true
2019-07-31 15:10:59 +00:00
2021-05-09 17:04:44 +00:00
.8 clc
>RET 4
2019-02-01 16:32:29 +00:00
*--------------------------------------
2019-11-22 11:25:27 +00:00
EXP.GetInt8Exp jsr EXP.GET
bcc EXP.GetInt8YA
rts
2021-05-11 18:44:13 +00:00
2019-11-22 11:25:27 +00:00
EXP.GetInt8Arg >LDYA ZPArgVBufPtr
EXP.GetInt8YA jsr EXP.GetInt32YA
bcs .9
>PULLA
2020-01-08 07:13:42 +00:00
jsr IncPStack3
2019-11-22 11:25:27 +00:00
* clc
2021-05-11 18:44:13 +00:00
2019-11-22 11:25:27 +00:00
.9 rts
*--------------------------------------
EXP.GetInt32Arg >LDYA ZPArgVBufPtr
2020-02-14 16:32:52 +00:00
EXP.GetInt32YA >PUSHYA
2019-11-22 11:25:27 +00:00
>PUSHWI ZPPtr1
2020-02-14 16:32:52 +00:00
>PUSHBI 10
2020-03-09 16:24:08 +00:00
>SYSCALL StrToL
2019-12-20 19:46:21 +00:00
bcs EXP.E.ESYN
2021-05-11 18:44:13 +00:00
2019-11-22 11:25:27 +00:00
lda (ZPPtr1)
beq EXP.GetInt32YA.RTS
2019-12-20 19:46:21 +00:00
EXP.E.ESYN lda #E.ESYN
sec
2019-11-22 11:25:27 +00:00
EXP.GetInt32YA.RTS
2021-05-11 18:44:13 +00:00
rts
2019-11-22 11:25:27 +00:00
*--------------------------------------
2019-02-01 16:32:29 +00:00
MAN
2020-05-26 14:23:09 +00:00
SAVE usr/src/bin/sh.s.exp
LOAD usr/src/bin/sh.s
2019-02-01 16:32:29 +00:00
ASM