A2osX/BIN/SH.S.CMD.txt

1305 lines
21 KiB
Plaintext
Raw Normal View History

NEW
2019-04-15 05:40:13 +00:00
AUTO 3,1
*--------------------------------------
CMD.ALIAS lda (ZPArgVBufPtr)
beq .10
jmp CMD.ALIAS.ADD
.10 >LDA.G hAliases
beq .8
ldy #0
lda #1
.1 >STYA ZPTmpW Save KeyID
>PUSHB.G hAliases
>PUSHW ZPTmpW KeyID
>PUSHW ZPCLBuf
>SYSCALL SListGetByID
bcs .8
>STYA ZPPtr1 NextID
ldy #hAliases
jsr CORE.SListGetData
bcs .9
phx
>PUSHW L.MSG.ALIAS
>PUSHW ZPCLBuf
txa
>SYSCALL GetMemPtr
>PUSHYA
>PUSHBI 4
>SYSCALL PrintF
pla
>SYSCALL FreeMem
>LDYA ZPPtr1
bra .1
.8 clc
.9 rts
*--------------------------------------
CMD.ALIAS.ADD >LDYA ZPArgVBufPtr
>STYA ZPVarNamePtr
jsr CORE.ArgV.Next
beq .9
cmp #'='
bne .99
jsr CORE.ArgV.Next
beq .9
>LDA.G hAliases
bne .1
lda #0
>SYSCALL SListNew
bcs .99
>STA.G hAliases
.1 >PUSHA
>PUSHW ZPVarNamePtr
>SYSCALL SListNewKey
bcs .99
>STYA ZPTmpW Save KeyID
>PUSHB.G hAliases
>PUSHW ZPTmpW KeyID
>PUSHW ZPArgVBufPtr DataPtr
>PUSHWZ String Mode
>SYSCALL SListAddData
rts
.9 lda #E.CSYN
sec
.99 rts
*--------------------------------------
2019-08-12 07:40:16 +00:00
CMD.. lda (ZPArgVBufPtr)
2020-08-11 18:55:28 +00:00
beq CMD...9
2019-08-12 07:40:16 +00:00
>LDYA ZPArgVBufPtr
2020-12-15 13:23:22 +00:00
>SYSCALL LoadTxtFile
2019-08-15 12:48:58 +00:00
bcs CMD.SHIFTA.RTS
>LDYA ZPArgVBufPtr Exec . file
2020-08-11 18:55:28 +00:00
CMD..EXEC.YAX jsr CORE.Load.YAX Y,A = Args, X = Code
2019-08-15 12:48:58 +00:00
bcs CMD.SHIFTA.RTS
2019-08-12 07:40:16 +00:00
2019-08-15 12:48:58 +00:00
lda #$C0+C..
jmp CORE.StkPush
2019-12-12 07:09:44 +00:00
CMD...9 jmp CMD.E.CSYN
2019-08-12 07:40:16 +00:00
*--------------------------------------
2019-12-12 07:09:44 +00:00
CMD.NOHUP lda (ZPArgVBufPtr)
beq CMD...9
lda #S.PS.F.NOHUP
2019-08-12 07:40:16 +00:00
tsb CORE.PSFlags
2020-01-20 15:24:53 +00:00
2019-02-03 21:58:26 +00:00
jmp CORE.ExecExtCmd
2018-11-09 15:59:04 +00:00
*--------------------------------------
2019-10-29 20:48:34 +00:00
CMD.SHIFT lda (ZPArgVBufPtr)
beq CMD.SHIFT.1
2019-10-29 21:38:02 +00:00
2019-11-22 11:25:27 +00:00
jsr EXP.GetInt8Exp
2019-10-29 20:48:34 +00:00
bcs CMD.SHIFTA.RTS
2019-10-29 21:52:06 +00:00
.HS B0 BCS
2021-05-11 18:44:13 +00:00
2019-10-29 20:48:34 +00:00
CMD.SHIFT.1 inc
2019-02-01 16:32:29 +00:00
2020-02-06 16:23:59 +00:00
CMD.SHIFTA >SYSCALL Shift
2019-10-29 20:48:34 +00:00
2019-08-15 12:48:58 +00:00
CMD.SHIFTA.RTS rts
2019-02-01 16:32:29 +00:00
*--------------------------------------
CMD.PUSHD >LDA.G PUSHD.STACK
cmp #PUSHD.STACK+PUSHD.STACK.MAX
beq CMD.POPD.CSYN
2019-10-29 20:48:34 +00:00
2019-12-20 21:17:17 +00:00
jsr GetCWD
2020-03-09 16:24:08 +00:00
>SYSCALL StrDup
2019-02-01 16:32:29 +00:00
bcs CMD.POPD.CSYN
2020-08-11 18:55:28 +00:00
2019-02-01 16:32:29 +00:00
>INC.G PUSHD.STACK
tay
2018-11-26 16:36:55 +00:00
txa
2019-02-01 16:32:29 +00:00
sta (pData),y
2019-02-11 06:58:33 +00:00
lda (ZPArgVBufPtr)
2019-03-18 16:48:16 +00:00
bne CMD.CD.0
2020-01-18 19:37:32 +00:00
* clc
2019-02-01 16:32:29 +00:00
.9 rts
*--------------------------------------
CMD.POPD >LDA.G PUSHD.STACK
cmp #PUSHD.STACK
beq CMD.POPD.CSYN
2020-01-18 19:37:32 +00:00
2019-02-01 16:32:29 +00:00
tay
lda (pData),y
2019-08-12 07:40:16 +00:00
jsr CMD.SetCWDA
2019-02-01 16:32:29 +00:00
>DEC.G PUSHD.STACK
clc
2019-10-03 06:25:27 +00:00
CMD.POPD.RTS rts
2019-08-15 12:48:58 +00:00
CMD.POPD.CSYN jmp CMD.E.CSYN
2019-02-03 21:58:26 +00:00
*--------------------------------------
2019-04-03 11:46:50 +00:00
CMD... lda (ZPArgVBufPtr)
bne CMD.POPD.CSYN
2019-10-10 06:04:11 +00:00
2019-09-17 20:37:52 +00:00
>LDYA L.CD..
2019-04-03 11:46:50 +00:00
bra CMD.CD.YA
*--------------------------------------
2019-02-11 06:58:33 +00:00
CMD.CD lda (ZPArgVBufPtr)
2019-02-14 16:39:35 +00:00
beq CMD.CD.HOME
2019-03-18 16:48:16 +00:00
CMD.CD.0 >LDYA ZPArgVBufPtr
2019-04-03 11:46:50 +00:00
bra CMD.CD.YA
2019-02-01 16:32:29 +00:00
2019-04-16 15:54:56 +00:00
CMD.CD.HOME >LDYA L.HOME
2019-10-10 10:23:02 +00:00
2020-02-14 07:21:56 +00:00
CMD.CD.YA >PUSHYA
2021-07-24 20:42:23 +00:00
>PUSHWZ Allocate
2020-03-09 16:24:08 +00:00
>SYSCALL RealPath
2019-02-01 16:32:29 +00:00
bcs CMD.POPD.RTS
>STYA ZPPtr1
2019-07-31 15:10:59 +00:00
stx ZPTmpW Save hMem
2020-02-14 07:21:56 +00:00
2019-02-01 16:32:29 +00:00
ldy #1
lda (ZPPtr1),y
2019-02-03 21:58:26 +00:00
bne .12
2019-01-21 06:52:04 +00:00
2019-02-03 21:58:26 +00:00
txa
2019-08-12 07:40:16 +00:00
jmp CMD.SetCWDA we have '/'
2019-02-03 21:58:26 +00:00
2019-11-15 14:40:48 +00:00
.12 >LDYA ZPPtr1
jsr IO.StatYA
2019-02-03 21:58:26 +00:00
bcs .19
2021-05-11 18:44:13 +00:00
2021-02-17 16:15:43 +00:00
cmp /S.STAT.MODE.DIR
2019-02-03 21:58:26 +00:00
beq .11
2021-05-11 18:44:13 +00:00
2019-02-03 21:58:26 +00:00
lda #MLI.E.INVPATH
.19 pha
2019-07-31 15:10:59 +00:00
lda ZPTmpW
2020-02-28 07:21:46 +00:00
>SYSCALL FreeMem
2019-02-03 21:58:26 +00:00
pla
sec
rts
2019-02-01 16:32:29 +00:00
2019-08-05 13:30:58 +00:00
.11 jsr GetPtr1LenY
2019-02-01 16:32:29 +00:00
dey
lda #'/'
2020-02-26 16:34:13 +00:00
cmp (ZPPtr1),y
beq .14
2021-05-11 18:44:13 +00:00
2020-02-26 16:34:13 +00:00
iny
sta (ZPPtr1),y
2019-07-31 15:10:59 +00:00
iny
lda #0
2020-02-26 16:34:13 +00:00
sta (ZPPtr1),y
.14 lda ZPTmpW
2019-02-01 16:32:29 +00:00
*--------------------------------------
2019-08-12 07:40:16 +00:00
CMD.SetCWDA pha
2019-07-22 16:28:44 +00:00
ldy #S.PS.hCWD
2020-02-28 07:21:46 +00:00
lda (pPS),y
2019-02-01 16:32:29 +00:00
>SYSCALL FreeMem
pla
2019-07-22 16:28:44 +00:00
ldy #S.PS.hCWD
2020-02-28 07:21:46 +00:00
sta (pPS),y
2019-02-01 16:32:29 +00:00
lda #0
* clc
rts
*--------------------------------------
2019-02-11 06:58:33 +00:00
CMD.SET lda (ZPArgVBufPtr)
bne CMD.SET.1
2019-02-01 16:32:29 +00:00
* No arg, print all ENV
2020-01-18 19:37:32 +00:00
>PUSHWZ
>PUSHWZ
>SYSCALL GetEnv
2020-03-09 16:24:08 +00:00
>STYA ZPPtr1
2020-01-18 19:37:32 +00:00
stx ZPTmpW
2015-10-19 20:35:00 +00:00
2020-03-09 16:24:08 +00:00
.1 lda (ZPPtr1)
2020-01-14 15:26:24 +00:00
beq .8 Ending 0 ?
2019-02-01 16:32:29 +00:00
2020-03-09 16:24:08 +00:00
>LDYA ZPPtr1
2020-02-28 07:21:46 +00:00
>SYSCALL PutS
2020-01-14 15:26:24 +00:00
bcs .9
2019-02-01 16:32:29 +00:00
2020-01-06 07:03:37 +00:00
jsr GetPtr1NextString
2020-01-14 15:26:24 +00:00
bra .1
2020-01-18 19:37:32 +00:00
.8 lda ZPTmpW
2020-02-28 07:21:46 +00:00
>SYSCALL FreeMem
2020-01-14 15:26:24 +00:00
* clc
2019-02-01 16:32:29 +00:00
.9 rts
*--------------------------------------
* SET +X VAR = VALUE1 op VALUE2 op VALUE3 ...
*--------------------------------------
2021-05-11 18:44:13 +00:00
CMD.SET.1
2019-02-11 06:58:33 +00:00
.1 jsr CMD.IsSwitch
2019-02-01 16:32:29 +00:00
bcs .6
2019-12-20 19:46:21 +00:00
ldx #SET.VARS-SET.FLAGS-1
2021-05-11 18:44:13 +00:00
.2 cmp SET.FLAGS,x
bne .3
2019-11-30 13:37:55 +00:00
lda SET.VARS,x
2019-11-30 13:37:55 +00:00
eor bState
sta bState
2019-04-02 15:28:50 +00:00
bra .5
.3 dex
bpl .2
2019-11-30 13:37:55 +00:00
2019-04-02 15:28:50 +00:00
.4 cmp #'F'
2019-02-01 16:32:29 +00:00
bne .99
2019-11-30 13:37:55 +00:00
2019-04-01 15:24:01 +00:00
jsr CORE.FUNCRESET
2019-11-30 13:37:55 +00:00
2020-01-20 15:24:53 +00:00
.5 jsr CORE.ArgV.Next
2019-02-11 06:58:33 +00:00
bne .1
2019-11-30 13:37:55 +00:00
2019-02-11 06:58:33 +00:00
clc
rts
2020-05-06 19:26:56 +00:00
*--------------------------------------
2019-02-11 06:58:33 +00:00
.6 >LDYA ZPArgVBufPtr
>STYA ZPVarNamePtr
2019-02-11 06:58:33 +00:00
jsr CORE.ArgV.Next
beq CMD.SET.GET
2021-05-11 18:44:13 +00:00
2019-02-01 16:32:29 +00:00
cmp #'='
bne .99
2019-11-30 13:37:55 +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 .99
2019-11-30 13:37:55 +00:00
2019-02-11 06:58:33 +00:00
jsr CORE.ArgV.Next
beq CMD.SET.UNSET
2021-05-11 18:44:13 +00:00
2019-02-15 16:38:17 +00:00
cmp #'`'
beq CMD.SET.EXEC
2020-07-09 11:34:07 +00:00
2019-02-01 16:32:29 +00:00
jsr EXP.GET
2019-11-15 14:40:48 +00:00
bcc CMD.SET.YA
2019-02-01 16:32:29 +00:00
rts
2019-08-15 12:48:58 +00:00
.99 jmp CMD.E.CSYN
2019-11-15 14:40:48 +00:00
2020-01-17 07:31:00 +00:00
CMD.SET.YA pha
>PUSHW ZPVarNamePtr
pla
>PUSHYA
2019-11-15 14:40:48 +00:00
>SYSCALL SetEnv
rts
2021-05-11 18:44:13 +00:00
2020-01-17 11:23:11 +00:00
CMD.SET.UNSET >PUSHW ZPVarNamePtr
2019-02-01 16:32:29 +00:00
>SYSCALL UnsetEnv
rts
2020-01-15 09:50:04 +00:00
CMD.SET.GET >PUSHW ZPVarNamePtr
>PUSHW ZPCLBuf
2019-02-01 16:32:29 +00:00
>SYSCALL GetEnv
2020-01-18 19:37:32 +00:00
bcs .8
2021-05-11 18:44:13 +00:00
2020-01-18 19:37:32 +00:00
>LDYA ZPCLBuf
2020-02-28 07:21:46 +00:00
>SYSCALL PutS
2020-07-09 11:34:07 +00:00
2020-01-18 19:37:32 +00:00
rts
2021-05-11 18:44:13 +00:00
2020-01-18 19:37:32 +00:00
.8 clc
2021-05-15 14:35:24 +00:00
CMD.SET.RTS rts
2019-01-28 16:33:30 +00:00
*--------------------------------------
2019-02-15 16:38:17 +00:00
CMD.SET.EXEC jsr CORE.ArgV.NextChar skip "`"
jsr IO.Pipe.Out
2021-05-15 14:35:24 +00:00
bcs CMD.SET.RTS
2019-02-15 16:38:17 +00:00
2020-08-20 13:20:33 +00:00
jsr IO.Exec
2021-05-15 14:35:24 +00:00
bcs CMD.SET.RTS
2019-08-02 14:36:49 +00:00
2019-02-15 16:38:17 +00:00
jsr IO.Pipe.In
2021-05-15 14:35:24 +00:00
bcs CMD.SET.RTS
2021-05-11 18:44:13 +00:00
* clc Silent Mode
jsr CL.ReadReset
2019-08-15 12:48:58 +00:00
jmp CMD.READ.VAR
2019-02-15 16:38:17 +00:00
*--------------------------------------
2020-01-18 19:37:32 +00:00
CMD.DATE >PUSHEA.G TimeBuf
2019-02-01 16:32:29 +00:00
>SYSCALL Time
2018-09-17 06:16:45 +00:00
2020-01-18 19:37:32 +00:00
>PUSHW ZPCLBuf
2021-05-11 18:44:13 +00:00
2019-10-26 14:33:37 +00:00
lda (ZPArgVBufPtr)
beq .1
2021-05-11 18:44:13 +00:00
2019-10-26 14:33:37 +00:00
>LDYA ZPArgVBufPtr
2019-02-01 16:32:29 +00:00
bra .2
2021-05-11 18:44:13 +00:00
2019-10-26 14:33:37 +00:00
.1 >LDYA L.FMT.DATE
2019-02-01 16:32:29 +00:00
2019-10-26 14:33:37 +00:00
.2 >PUSHYA
2021-05-11 18:44:13 +00:00
2020-01-18 19:37:32 +00:00
>PUSHEA.G TimeBuf
2019-02-01 16:32:29 +00:00
>SYSCALL StrFTime
2020-01-15 09:50:04 +00:00
CMD.DATE.PRINT >LDYA ZPCLBuf
2020-02-28 07:21:46 +00:00
>SYSCALL PutS
2019-02-01 16:32:29 +00:00
rts
*--------------------------------------
2019-02-12 16:47:34 +00:00
CMD.ECHO stz ZPPtr1 echo -N
2019-02-15 16:38:17 +00:00
stz ZPPtr1+1 Token Cnt
2019-02-01 16:32:29 +00:00
2019-02-11 06:58:33 +00:00
lda (ZPArgVBufPtr)
2019-02-28 21:41:05 +00:00
beq .7
2019-03-01 14:36:20 +00:00
2019-02-08 16:13:43 +00:00
.1 jsr CMD.IsSwitch
2019-02-01 16:32:29 +00:00
bcs .2
2021-05-11 18:44:13 +00:00
2019-02-01 16:32:29 +00:00
cmp #'N'
2019-06-02 08:58:46 +00:00
bne CMD.ECHO.CSYN
2019-03-01 15:41:27 +00:00
2019-02-01 16:32:29 +00:00
lda #$ff
2019-02-12 16:47:34 +00:00
eor ZPPtr1
sta ZPPtr1
2021-05-11 18:44:13 +00:00
bra .4
2019-02-12 16:47:34 +00:00
.2 lda ZPPtr1+1
beq .3
2021-05-11 18:44:13 +00:00
2019-02-12 16:47:34 +00:00
lda #C.SPACE
2020-03-09 16:24:08 +00:00
>SYSCALL PutChar
2020-01-06 07:03:37 +00:00
.3 >LDYA ZPArgVBufPtr
jsr PrintYANoCR
2019-02-01 16:32:29 +00:00
bcs .9
2020-01-06 07:03:37 +00:00
2019-02-12 16:47:34 +00:00
inc ZPPtr1+1
2020-01-06 07:03:37 +00:00
2019-02-12 16:47:34 +00:00
.4 jsr CORE.ArgV.Next
2019-02-11 06:58:33 +00:00
bne .1
2020-01-06 07:03:37 +00:00
2019-02-28 21:41:05 +00:00
.7 bit ZPPtr1
2019-02-01 16:32:29 +00:00
bmi .8
2019-02-21 14:34:35 +00:00
>LDYA L.MSG.ECHOCRLF
jmp PrintYANoCR
2019-02-01 16:32:29 +00:00
.8 clc
.9 rts
2018-09-17 06:16:45 +00:00
2019-06-02 08:58:46 +00:00
CMD.ECHO.CSYN lda #E.CSYN
2019-02-01 16:32:29 +00:00
sec
2019-06-02 08:58:46 +00:00
2019-10-26 14:33:37 +00:00
CMD.ECHO.RTS rts
2019-02-01 16:32:29 +00:00
*--------------------------------------
2019-02-11 06:58:33 +00:00
CMD.READ lda (ZPArgVBufPtr)
2020-01-06 07:03:37 +00:00
beq CMD.ECHO.CSYN
2019-11-04 07:21:40 +00:00
2019-08-15 12:48:58 +00:00
stz ZPVarNamePtr+1
2021-05-11 18:44:13 +00:00
jsr CL.ReadResetV
2018-11-28 21:37:18 +00:00
2019-02-01 16:32:29 +00:00
.1 jsr CMD.IsSwitch
bcs .4
2019-10-29 20:48:34 +00:00
2019-02-01 16:32:29 +00:00
cmp #'S'
bne .2
2019-10-29 20:48:34 +00:00
2019-01-28 16:33:30 +00:00
lda #$ff
2021-05-11 18:44:13 +00:00
>STA.G CL.bSilent
2019-08-15 12:48:58 +00:00
bra .5
2019-10-29 20:48:34 +00:00
2019-08-15 12:48:58 +00:00
.2 cmp #'P'
bne .3
2019-10-29 20:48:34 +00:00
2019-02-11 06:58:33 +00:00
jsr CORE.ArgV.Next
2020-01-06 07:03:37 +00:00
beq CMD.ECHO.CSYN
2019-02-11 06:58:33 +00:00
>LDYA ZPArgVBufPtr
jsr PrintYANoCR
2019-10-26 14:33:37 +00:00
bcs CMD.ECHO.RTS
2019-08-15 12:48:58 +00:00
bra .5
.3 cmp #'N'
2020-01-06 07:03:37 +00:00
bne CMD.ECHO.CSYN
2019-10-29 20:48:34 +00:00
2019-08-15 12:48:58 +00:00
jsr CORE.ArgV.Next
2020-01-06 07:03:37 +00:00
beq CMD.ECHO.CSYN
2019-10-31 15:59:11 +00:00
2019-11-22 11:25:27 +00:00
jsr EXP.GetInt8Arg
2019-10-26 14:33:37 +00:00
bcs CMD.ECHO.RTS
2019-08-15 12:48:58 +00:00
2021-05-11 18:44:13 +00:00
>STA.G CL.MaxCnt
2019-08-15 12:48:58 +00:00
bra .5
2019-10-29 20:48:34 +00:00
2019-02-18 21:16:49 +00:00
.4 >LDYA ZPArgVBufPtr
>STYA ZPVarNamePtr
2019-08-15 12:48:58 +00:00
.5 jsr CORE.ArgV.Next
2019-02-11 06:58:33 +00:00
bne .1
2019-10-29 20:48:34 +00:00
2019-08-15 12:48:58 +00:00
lda ZPVarNamePtr+1
2020-01-06 07:03:37 +00:00
beq CMD.ECHO.CSYN
2021-05-11 18:44:13 +00:00
*--------------------------------------
2019-08-15 12:48:58 +00:00
CMD.READ.VAR jsr CL.Reset
2019-11-04 07:21:40 +00:00
2019-08-15 12:48:58 +00:00
.1 >SYSCALL GetChar
2019-11-15 14:40:48 +00:00
bcs CMD.SLEEP.RTS
2019-08-15 12:48:58 +00:00
jsr CL.CHARIN
>LDA.G CL.bReady
bpl .1
lda (ZPCLBuf)
2019-11-15 14:40:48 +00:00
bne .2
2021-05-11 18:44:13 +00:00
2019-11-15 14:40:48 +00:00
jmp CMD.SET.UNSET
2021-05-11 18:44:13 +00:00
2019-11-15 14:40:48 +00:00
.2 >LDYA ZPCLBuf
jmp CMD.SET.YA
2019-02-01 16:32:29 +00:00
*--------------------------------------
2019-02-11 06:58:33 +00:00
CMD.SLEEP lda (ZPArgVBufPtr)
2019-08-15 12:48:58 +00:00
beq CMD.REN.CSYN
2018-11-26 06:57:11 +00:00
2019-11-22 11:25:27 +00:00
jsr EXP.GetInt32Arg
bcs CMD.SLEEP.RTS
2019-02-01 16:32:29 +00:00
>PULLL.G Sleep
2019-11-22 11:25:27 +00:00
2019-11-15 14:40:48 +00:00
CMD.SLEEP.RTS rts
2018-11-26 06:57:11 +00:00
*--------------------------------------
CMD.PAUSE lda #bState.Pause
tsb bState
2018-11-26 06:57:11 +00:00
clc
rts
2019-02-01 16:32:29 +00:00
*--------------------------------------
2019-02-11 06:58:33 +00:00
CMD.MD lda (ZPArgVBufPtr)
2019-08-15 12:48:58 +00:00
beq CMD.REN.CSYN
2019-02-11 06:58:33 +00:00
2020-02-29 14:06:28 +00:00
>PUSHW ZPArgVBufPtr
>PUSHWI S.STAT.MODE.FO+S.STAT.MODE.FG+S.STAT.MODE.FU
2019-02-01 16:32:29 +00:00
>SYSCALL MKDir
rts
*--------------------------------------
2019-12-20 21:17:17 +00:00
CMD.PWD jsr GetCWD
2020-02-28 07:21:46 +00:00
>SYSCALL PutS
2019-10-10 06:04:11 +00:00
rts
*--------------------------------------
2019-02-11 06:58:33 +00:00
CMD.RD lda (ZPArgVBufPtr)
2019-08-15 12:48:58 +00:00
beq CMD.REN.CSYN
2021-05-11 18:44:13 +00:00
2020-01-07 13:44:38 +00:00
jsr IO.StatArgVBufPtr
2019-02-01 16:32:29 +00:00
bcs .99
2021-05-11 18:44:13 +00:00
2021-02-17 16:15:43 +00:00
cmp /S.STAT.MODE.DIR
2019-08-15 12:48:58 +00:00
bne CMD.REN.CSYN
2020-01-07 13:44:38 +00:00
2020-05-20 13:14:28 +00:00
>LDYA ZPArgVBufPtr
2019-02-01 16:32:29 +00:00
>SYSCALL Remove
.99 rts
*--------------------------------------
2019-10-10 10:23:02 +00:00
CMD.REN.CSYN jmp CMD.E.CSYN
CMD.REN lda (ZPArgVBufPtr)
beq CMD.REN.CSYN
jsr CORE.ArgV.Next
lda (ZPArgVBufPtr)
beq CMD.REN.CSYN
2020-02-14 07:21:56 +00:00
>PUSHW ZPArgVBufPrev old path
2021-07-24 20:42:23 +00:00
>PUSHWZ Allocate
2020-03-09 16:24:08 +00:00
>SYSCALL RealPath
2019-10-10 10:23:02 +00:00
bcs CMD.REN.CSYN
2021-05-11 18:44:13 +00:00
2019-10-10 10:23:02 +00:00
>STYA ZPPtr1
stx ZPTmpW
2021-05-11 18:44:13 +00:00
2019-10-10 10:23:02 +00:00
ldy #$ff
2021-05-11 18:44:13 +00:00
2019-10-10 10:23:02 +00:00
.1 iny
lda (ZPPtr1),y
beq .2
cmp #'/'
bne .1
2021-05-11 18:44:13 +00:00
2019-10-10 10:23:02 +00:00
tya
tax
bra .1
2021-05-11 18:44:13 +00:00
2019-10-10 10:23:02 +00:00
.2 ldy #$ff
.3 iny
inx
lda (ZPArgVBufPtr),y
bne .3
2021-05-11 18:44:13 +00:00
2019-10-10 10:23:02 +00:00
txa
tay
lda #0
2021-05-11 18:44:13 +00:00
2020-02-28 07:21:46 +00:00
>SYSCALL GetMem
2019-10-10 10:23:02 +00:00
bcs .90
>STYA ZPPtr2
stx ZPTmpW+1
2021-05-11 18:44:13 +00:00
2019-10-10 10:23:02 +00:00
ldy #$ff
2021-05-11 18:44:13 +00:00
2019-10-10 10:23:02 +00:00
.4 iny
2021-05-11 18:44:13 +00:00
lda (ZPPtr1),y
2019-10-10 10:23:02 +00:00
beq .5
sta (ZPPtr2),y
cmp #'/'
bne .4
2021-05-11 18:44:13 +00:00
2019-10-10 10:23:02 +00:00
tya
inc
tax
bra .4
2021-05-11 18:44:13 +00:00
2019-10-10 10:23:02 +00:00
.5 txa
tay
lda #0
sta (ZPPtr2),y
2021-05-04 17:31:21 +00:00
>PUSHW ZPPtr2
2019-10-10 10:23:02 +00:00
>PUSHW ZPArgVBufPtr
2020-03-09 16:24:08 +00:00
>SYSCALL StrCat
2021-05-11 18:44:13 +00:00
2019-10-10 10:23:02 +00:00
lda ZPTmpW
2020-02-28 07:21:46 +00:00
>SYSCALL FreeMem
2019-10-10 10:23:02 +00:00
lda ZPTmpW+1
sta ZPTmpW
2021-05-11 18:44:13 +00:00
2020-02-23 20:46:25 +00:00
>PUSHW ZPPtr1
2019-10-10 10:23:02 +00:00
>PUSHW ZPPtr2
>SYSCALL Rename
.90 php
pha
lda ZPTmpW
2020-02-28 07:21:46 +00:00
>SYSCALL FreeMem
2019-10-10 10:23:02 +00:00
pla
plp
rts
*--------------------------------------
2019-08-12 07:40:16 +00:00
CMD.FUNCTION lda (ZPArgVBufPtr)
2019-03-13 16:29:24 +00:00
beq .9
jsr CORE.StkGetCtx
2019-08-12 07:40:16 +00:00
bcc .9 No context allowed
2019-03-15 16:20:28 +00:00
>LDA.G hFunctions
2019-03-13 16:29:24 +00:00
bne .1
2021-05-11 18:44:13 +00:00
lda #SL..+SL._
2019-03-13 16:29:24 +00:00
>SYSCALL SListNew
2019-03-15 16:20:28 +00:00
bcs .99
2021-05-11 18:44:13 +00:00
>STA.G hFunctions
2021-05-11 18:44:13 +00:00
2020-02-18 15:34:56 +00:00
.1 >PUSHA
>PUSHW ZPArgVBufPtr
2021-05-11 18:44:13 +00:00
2019-03-13 16:29:24 +00:00
>SYSCALL SListNewKey
bcs .99
2019-08-05 13:30:58 +00:00
2019-08-12 07:40:16 +00:00
>STYA ZPTmpW Save KeyID
2019-03-13 16:29:24 +00:00
2019-08-12 07:40:16 +00:00
jsr CORE.ArgV.Next nothing after function name
beq .10
cmp #'{'
bne .9
2019-08-05 13:30:58 +00:00
2019-08-12 07:40:16 +00:00
ldy #1
lda (ZPArgVBufPtr),y
beq .11
2021-05-11 18:44:13 +00:00
2019-08-15 12:48:58 +00:00
.9 jmp CMD.E.CSYN
2019-08-12 07:40:16 +00:00
2021-05-11 18:44:13 +00:00
.99 rts
2019-10-03 06:25:27 +00:00
*--------------------------------------
2019-08-12 07:40:16 +00:00
.10 jsr CORE.GetCharNB
bcs .9
2020-05-19 20:53:03 +00:00
2019-08-12 07:40:16 +00:00
cmp #'{'
bne .9
2020-05-19 20:53:03 +00:00
2019-08-12 07:40:16 +00:00
jsr CORE.GetNextCharNB
bcs .9
2020-05-19 20:53:03 +00:00
2021-05-11 18:44:13 +00:00
.11 >LDYA ZPInputBufPtr
2019-08-12 07:40:16 +00:00
>STYA ZPPtr1
2020-05-19 20:53:03 +00:00
2021-05-11 18:44:13 +00:00
stz ZPPtr2
stz ZPPtr2+1 DataLen
ldx #0 '{' counter
2019-08-12 07:40:16 +00:00
lda (ZPInputBufPtr)
beq .6
2020-05-19 20:53:03 +00:00
2019-08-12 07:40:16 +00:00
.12 cmp #'{'
bne .13
2020-05-19 20:53:03 +00:00
2021-05-11 18:44:13 +00:00
inx
2019-08-12 07:40:16 +00:00
bra .14
2020-05-19 20:53:03 +00:00
2019-08-12 07:40:16 +00:00
.13 cmp #'}'
bne .14
2020-05-19 20:53:03 +00:00
2021-05-11 18:44:13 +00:00
dex
2019-08-12 07:40:16 +00:00
bmi .7
2020-05-19 20:53:03 +00:00
2021-05-11 18:44:13 +00:00
.14 inc ZPPtr2
2019-08-12 07:40:16 +00:00
bne .15
2021-05-11 18:44:13 +00:00
inc ZPPtr2+1
2019-08-12 07:40:16 +00:00
.15 jsr CORE.GetNextChar
bcc .12
2020-05-19 20:53:03 +00:00
2021-05-11 18:44:13 +00:00
.6 txa
2019-08-12 07:40:16 +00:00
bpl .9
2020-05-19 20:53:03 +00:00
2019-08-12 07:40:16 +00:00
.7 jsr CORE.GetNextChar skip ending '}'
>PUSHB.G hFunctions
2019-08-12 07:40:16 +00:00
>PUSHW ZPTmpW KeyID
2020-02-18 15:34:56 +00:00
>PUSHW ZPPtr1 DataPtr
2021-05-11 18:44:13 +00:00
>PUSHW ZPPtr2 DataLen
2019-08-12 07:40:16 +00:00
>SYSCALL SListAddData
2020-08-20 13:20:33 +00:00
bcs .99
>PUSHB.G hFunctions
2020-08-20 13:20:33 +00:00
>PUSHW ZPTmpW KeyID
>PUSHW L.PtrZero DataPtr
>PUSHWI 1 DataLen
>SYSCALL SListAddData Add Ending \0
2019-08-12 07:40:16 +00:00
rts
2019-03-12 16:50:16 +00:00
*--------------------------------------
2019-11-22 11:25:27 +00:00
CMD.CALL jsr CMD.CALL.GETFUNC
bcs CMD.CALL.RTS
2019-08-05 13:30:58 +00:00
2019-07-31 15:10:59 +00:00
>STYA ZPTmpW KeyID
2019-04-01 06:07:56 +00:00
ldy #hFunctions
jsr CORE.SListGetData
2019-04-04 15:44:20 +00:00
bcs CMD.CALL.RTS
2019-04-02 15:28:50 +00:00
>LDYA ZPArgVBufPtr FUNC PARAM1 PARAM2...
2019-08-15 12:48:58 +00:00
jsr CORE.Load.YAX Exec FUNC
bcs CMD.CALL.RTS
2020-05-19 20:53:03 +00:00
2019-08-15 12:48:58 +00:00
lda #$C0+C.CALL
jmp CORE.StkPush
2019-04-03 11:46:50 +00:00
*--------------------------------------
2021-05-11 18:44:13 +00:00
CMD.CALL.GETFUNC
>LDA.G hFunctions
2019-11-22 11:25:27 +00:00
beq CMD.CALL.UNDEF
>PUSHB.G hFunctions
2019-11-22 11:25:27 +00:00
>PUSHW ZPArgVBufPtr
>SYSCALL SListLookup
bcc CMD.CALL.RTS
2021-05-11 18:44:13 +00:00
2019-11-22 11:25:27 +00:00
CMD.CALL.UNDEF lda #E.FUNDEF
sec
CMD.CALL.RTS rts
*--------------------------------------
2019-04-03 11:46:50 +00:00
CMD.EXIT lda (ZPArgVBufPtr)
2019-04-06 18:43:33 +00:00
beq .1 no arg, exit 0
2019-04-03 11:46:50 +00:00
2019-11-22 11:25:27 +00:00
jsr EXP.GetInt8Exp
2019-08-05 13:30:58 +00:00
bcs .9
2021-05-11 18:44:13 +00:00
2019-11-30 13:37:55 +00:00
.1 ldy #S.PS.RC
2020-02-28 07:21:46 +00:00
sta (pPS),y
2019-12-05 15:09:38 +00:00
2019-08-15 12:48:58 +00:00
.2 jsr CORE.StkPull Pull everything until CALL . CL...
2019-04-05 13:02:42 +00:00
bcs .9
2019-04-06 18:43:33 +00:00
2019-11-30 13:37:55 +00:00
cmp #$C0+C.. in CALL, "." or CL context ?
2019-08-15 12:48:58 +00:00
beq CMD.EXIT.FILE
2019-11-30 13:37:55 +00:00
2019-08-15 12:48:58 +00:00
cmp #$C0+C.CALL
beq CMD.EXIT.FILE
2019-11-30 13:37:55 +00:00
2019-08-15 12:48:58 +00:00
cmp #$C0+C.CLEXEC
2019-11-30 13:37:55 +00:00
beq .8
2021-05-11 18:44:13 +00:00
2019-11-30 13:37:55 +00:00
jsr CORE.StkPopCtxA
2019-08-12 07:40:16 +00:00
bcc .2
2019-11-30 13:37:55 +00:00
rts
2019-04-05 13:02:42 +00:00
2019-11-30 13:37:55 +00:00
.8 jsr CMD.EXIT.FILE
lda #bState.ExitOnEOF
tsb bState
2019-08-15 12:48:58 +00:00
clc
2019-11-30 13:37:55 +00:00
.9 rts
2019-08-15 12:48:58 +00:00
*--------------------------------------
2019-12-20 21:17:17 +00:00
CMD.EXIT.FILE jsr CORE.StkPullFree Code buffer
2019-11-30 13:37:55 +00:00
2019-04-04 15:44:20 +00:00
ldy #S.PS.hARGV
lda (pPS),y
2020-02-28 07:21:46 +00:00
>SYSCALL FreeMem ArgV buffer
2019-11-30 13:37:55 +00:00
2019-04-04 15:44:20 +00:00
jsr CORE.StkPull
ldy #S.PS.hARGV
sta (pPS),y
2019-11-30 13:37:55 +00:00
2019-04-05 15:21:05 +00:00
jsr CORE.StkPull
ldy #S.PS.ARGC
sta (pPS),y
2019-05-31 07:31:41 +00:00
jsr CORE.StkPullInputBufPtr
2019-11-30 13:37:55 +00:00
2019-04-04 15:44:20 +00:00
jsr CORE.StkPull
sta ZPInputBuf
2020-08-20 13:20:33 +00:00
jsr CORE.StkPull
sta ZPInputBuf+1
2019-04-05 05:59:06 +00:00
2019-12-05 15:09:38 +00:00
ldy #S.PS.RC
2020-02-28 07:21:46 +00:00
lda (pPS),y
2021-05-11 18:44:13 +00:00
2019-08-12 07:40:16 +00:00
clc
2019-11-30 13:37:55 +00:00
rts
2019-04-03 11:46:50 +00:00
*--------------------------------------
2019-07-31 15:10:59 +00:00
CMD.BREAK jsr CORE.StkGetCtx Get context in CORE.TestResult
2019-03-12 16:50:16 +00:00
bcs .9
tax
and #$3F
cmp #C.CASE
bne .9
txa
bpl .8
jsr CORE.StkPull remove C.CASE
jsr CORE.StkGet
and #$7F
2019-08-15 12:48:58 +00:00
2020-03-09 16:24:08 +00:00
sta (pData),y
2019-03-12 16:50:16 +00:00
.8 clc
rts
2019-08-15 12:48:58 +00:00
.9 jmp CMD.E.CSYN
2019-03-08 16:36:21 +00:00
*--------------------------------------
* stack-1 hVALUE
* stack SWITCH TOKEN
2019-02-01 16:32:29 +00:00
*--------------------------------------
2019-03-08 16:36:21 +00:00
CMD.SWITCH jsr CORE.StkGetCtx
2019-03-06 16:29:51 +00:00
2019-04-04 15:44:20 +00:00
lda #2
jsr CORE.StkCheck
bcs .9
2019-03-08 16:36:21 +00:00
jsr EXP.GET
bcs .9
2020-03-09 16:24:08 +00:00
>SYSCALL StrDup
2019-03-08 16:36:21 +00:00
bcs .9
txa
jsr CORE.StkPush Push EXP hVALUE
2019-07-31 15:10:59 +00:00
lda CORE.TestResult
2019-03-08 16:36:21 +00:00
beq .1
ora #$80
.1 ora #C.SWITCH
jmp CORE.StkPush
.9 rts
*--------------------------------------
2019-07-31 15:10:59 +00:00
CMD.CASE jsr CORE.StkGetCtx Get context in CORE.TestResult
2019-03-06 16:29:51 +00:00
2019-03-08 16:36:21 +00:00
bcs .9
2021-05-11 18:44:13 +00:00
tax
2019-03-08 16:36:21 +00:00
and #$3F
cmp #C.SWITCH
beq .1
cmp #C.CASE
bne .9
2019-03-13 16:29:24 +00:00
txa previous case was true ?
2020-02-24 13:33:28 +00:00
bpl .10
2019-03-13 16:29:24 +00:00
jsr EXP.GET skip expression
bcs .9
rts keep existing context
.10 jsr CORE.StkPull remove previous C.CASE
2019-03-08 16:36:21 +00:00
bra CMD.CASE
2019-11-15 14:40:48 +00:00
2019-03-08 16:36:21 +00:00
.1 jsr EXP.GET
bcs .9
2019-11-15 14:40:48 +00:00
2019-03-08 16:36:21 +00:00
>PUSHYA
2019-11-15 14:40:48 +00:00
lda (pData)
2019-03-08 16:36:21 +00:00
tay
dey get hVALUE
2019-11-15 14:40:48 +00:00
lda (pData),y
2019-03-08 16:36:21 +00:00
>SYSCALL GetMemPtr
2021-05-04 17:31:21 +00:00
>PUSHYA
2020-03-09 16:24:08 +00:00
>SYSCALL StrCmp
2019-03-08 16:36:21 +00:00
ror CS if !=
and #$80
eor #$80
2019-07-31 15:10:59 +00:00
ora CORE.TestResult
2019-03-08 16:36:21 +00:00
ora #C.CASE
jmp CORE.StkPush
2019-10-03 06:25:27 +00:00
.9
2019-08-15 12:48:58 +00:00
CMD.E.CSYN lda #E.CSYN
sec
rts
2019-03-08 16:36:21 +00:00
*--------------------------------------
2019-07-31 15:10:59 +00:00
CMD.DEFAULT jsr CORE.StkGetCtx Get context in CORE.TestResult
2019-08-15 12:48:58 +00:00
bcs CMD.E.CSYN
2019-03-12 16:50:16 +00:00
2019-03-08 16:36:21 +00:00
and #$3F
2019-11-15 14:40:48 +00:00
2019-03-08 16:36:21 +00:00
cmp #C.SWITCH
beq .1
2019-11-15 14:40:48 +00:00
2019-03-08 16:36:21 +00:00
cmp #C.CASE
2019-08-15 12:48:58 +00:00
bne CMD.E.CSYN
2019-11-15 14:40:48 +00:00
2019-03-08 16:36:21 +00:00
jsr CORE.StkPull remove C.CASE
2019-03-12 16:50:16 +00:00
.1 jsr CORE.StkGet
and #$C0
2019-03-08 16:36:21 +00:00
ora #C.DEFAULT
jmp CORE.StkPush
*--------------------------------------
2019-07-31 15:10:59 +00:00
CMD.END jsr CORE.StkGetCtx Get context in CORE.TestResult
2019-08-15 12:48:58 +00:00
bcs CMD.E.CSYN
2019-03-13 16:29:24 +00:00
2019-08-12 07:40:16 +00:00
and #$3F
2019-11-15 14:40:48 +00:00
2019-03-08 16:36:21 +00:00
cmp #C.SWITCH
2019-11-30 13:37:55 +00:00
beq .8
2019-11-15 14:40:48 +00:00
2019-03-08 16:36:21 +00:00
cmp #C.CASE
2019-11-30 13:37:55 +00:00
beq .8
2019-11-15 14:40:48 +00:00
2019-03-08 16:36:21 +00:00
cmp #C.DEFAULT
2019-08-15 12:48:58 +00:00
bne CMD.E.CSYN
2019-11-30 13:37:55 +00:00
.8 jmp CORE.StkPopCtx
2019-03-08 16:36:21 +00:00
*--------------------------------------
CMD.FOR jsr CORE.StkGetCtx
2019-03-06 16:29:51 +00:00
lda (ZPArgVBufPtr)
2019-08-15 12:48:58 +00:00
beq CMD.E.CSYN
2019-03-05 16:49:34 +00:00
>LDYA ZPArgVBufPtr
>STYA ZPVarNamePtr
jsr CORE.ArgV.Next
2019-08-15 12:48:58 +00:00
beq CMD.E.CSYN
2021-05-04 17:31:21 +00:00
>PUSHW L.IN
2019-05-31 07:31:41 +00:00
>PUSHW ZPArgVBufPtr
>SYSCALL StrCaseCmp
2019-08-15 12:48:58 +00:00
bcs CMD.E.CSYN
2019-03-07 16:48:30 +00:00
2019-03-05 16:49:34 +00:00
jsr CORE.ArgV.Next
2019-08-15 12:48:58 +00:00
beq CMD.E.CSYN
2019-03-06 16:29:51 +00:00
2019-05-31 07:31:41 +00:00
lda #8 Make sure 8 bytes free on stack
2019-04-04 15:44:20 +00:00
jsr CORE.StkCheck
2020-01-13 13:33:30 +00:00
bcs FOR.FILE.9
2019-04-04 15:44:20 +00:00
lda (ZPArgVBufPtr)
2019-03-06 16:29:51 +00:00
cmp #'('
2019-07-31 15:10:59 +00:00
beq CMD.FOR.FILE
2019-03-05 16:49:34 +00:00
cmp #'`'
2020-02-24 13:33:28 +00:00
beq CMD.FOR.EXEC
2019-03-06 16:29:51 +00:00
*--------------------------------------
2019-07-31 15:10:59 +00:00
CMD.FOR.LIST >LDYA ZPArgVBufPtr
2020-03-09 16:24:08 +00:00
>SYSCALL StrDup
2019-07-31 15:10:59 +00:00
bcs FOR.FILE.9
2019-12-12 14:13:32 +00:00
phy
pha
2021-05-11 18:44:13 +00:00
2020-01-06 16:27:52 +00:00
jsr CORE.StkPushInputBufPtr Push CmdPtr AFTER FOR
2019-12-12 14:13:32 +00:00
pla
ply
2021-05-11 18:44:13 +00:00
2019-05-31 07:31:41 +00:00
jsr CORE.StkPushYAX Push listPtr,hList
2019-12-12 14:13:32 +00:00
2019-09-18 15:33:00 +00:00
jsr CORE.PushVarName Push hVARNAME
2019-12-12 14:13:32 +00:00
2019-03-06 16:29:51 +00:00
lda #C.FOR.LIST
2019-03-05 16:49:34 +00:00
jsr CORE.StkPush
2019-03-06 16:29:51 +00:00
lda #C.FOR
2019-03-05 16:49:34 +00:00
jsr CORE.StkPush
2019-03-06 16:29:51 +00:00
2019-09-18 15:33:00 +00:00
jsr CMD.NEXT.LIST.TOKEN
bcc CMD.FOR.LOOP
rts
2019-03-06 16:29:51 +00:00
*--------------------------------------
2019-07-31 15:10:59 +00:00
CMD.FOR.FILE jsr CORE.ArgV.NextChar skip "("
2019-03-07 16:48:30 +00:00
>LDYA ZPArgVBufPtr
2019-08-02 14:36:49 +00:00
ldx #O.RDONLY+O.TEXT
jsr IO.FOpenYAX
2019-09-18 15:33:00 +00:00
bcc CMD.FOR.PUSH
2021-05-11 18:44:13 +00:00
FOR.FILE.9 rts
2019-02-01 16:32:29 +00:00
*--------------------------------------
2019-07-31 15:10:59 +00:00
CMD.FOR.EXEC jsr CORE.ArgV.NextChar skip "`"
2019-03-08 11:16:19 +00:00
jsr IO.Pipe.Out
2019-07-31 15:10:59 +00:00
bcs FOR.FILE.9
2019-03-08 11:16:19 +00:00
2020-08-20 13:20:33 +00:00
jsr IO.Exec
2019-07-31 15:10:59 +00:00
bcs FOR.FILE.9
2019-10-25 15:09:13 +00:00
jsr IO.Pop.Out Restore OUT (NO close)
jsr IO.Pipe.OpenR
2021-05-11 18:44:13 +00:00
2019-07-31 15:10:59 +00:00
bcs FOR.FILE.9
2019-03-11 15:43:33 +00:00
2019-12-12 14:13:32 +00:00
CMD.FOR.PUSH pha save hFILE/hPIPE
2020-01-06 16:27:52 +00:00
jsr CORE.StkPushInputBufPtr Push CmdPtr AFTER FOR
2019-12-12 14:13:32 +00:00
pla
jsr CORE.StkPush push hPIPE for read
2019-09-18 15:33:00 +00:00
jsr CORE.PushVarName Push hVARNAME
2019-12-12 14:13:32 +00:00
* bcs FOR.FILE.9
2019-03-08 11:16:19 +00:00
2019-09-18 15:33:00 +00:00
lda #C.FOR.FILEEXEC
2019-03-08 11:16:19 +00:00
jsr CORE.StkPush
lda #C.FOR
jsr CORE.StkPush
2019-03-11 15:43:33 +00:00
jsr CMD.NEXT.LINE
2019-07-31 15:10:59 +00:00
bcs FOR.FILE.9
2021-05-11 18:44:13 +00:00
2019-07-31 15:10:59 +00:00
CMD.FOR.LOOP ora CORE.TestResult
2019-03-08 11:16:19 +00:00
ora #C.FOR Push FOR
pha
lda (pData)
tay
pla
sta (pData),y
2019-09-18 15:33:00 +00:00
2019-10-03 06:25:27 +00:00
* clc
2019-07-31 15:10:59 +00:00
rts
2019-03-05 16:49:34 +00:00
*--------------------------------------
CMD.NEXT jsr CORE.StkGet Y = StkPtr
bcs .9
2019-06-07 15:02:51 +00:00
2019-03-05 16:49:34 +00:00
and #$3F
cmp #C.FOR
bne .9
dey
lda (pData),y
2019-03-06 16:29:51 +00:00
iny
2019-09-18 15:33:00 +00:00
tax
beq CMD.NEXT.LIST
jmp CMD.NEXT.FILEEXEC
2019-11-30 13:37:55 +00:00
2019-03-06 16:29:51 +00:00
.9 lda #E.NOFOR
sec
rts
*--------------------------------------
* stack-6 CmdPtr
* stack-4 ListPtr
* stack-3 hLIST
* stack-2 hVARNAME
2019-03-08 16:36:21 +00:00
* stack-1 FOR SUB TOKEN
2019-03-06 16:29:51 +00:00
* stack FOR TOKEN
*--------------------------------------
CMD.NEXT.LIST lda (pData),y Y = StkPtr
bpl .1
2019-11-15 14:40:48 +00:00
2019-09-18 15:33:00 +00:00
jsr CMD.NEXT.LIST.TOKEN
2019-03-06 16:29:51 +00:00
bcs .9
bpl .1
2019-11-15 14:40:48 +00:00
2019-03-06 16:29:51 +00:00
lda (pData)
sec
sbc #6
2020-01-06 16:27:52 +00:00
jmp CMD.NEXT.FILEEXEC.LOOPY
2019-11-15 14:40:48 +00:00
2019-03-06 16:29:51 +00:00
.1 lda (pData)
tay
sec
sbc #8
sta (pData)
2019-11-15 14:40:48 +00:00
2019-03-06 16:29:51 +00:00
dey
2019-10-03 06:25:27 +00:00
dey
2019-03-06 16:29:51 +00:00
lda (pData),y hVARNAME
pha
dey
lda (pData),y hLIST
2020-02-28 07:21:46 +00:00
>SYSCALL FreeMem
2019-03-06 16:29:51 +00:00
pla
2020-02-28 07:21:46 +00:00
>SYSCALL FreeMem
2019-09-18 15:33:00 +00:00
* clc
2019-03-06 16:29:51 +00:00
.9 rts
*--------------------------------------
2019-09-18 15:33:00 +00:00
CMD.NEXT.LIST.TOKEN
2020-01-06 16:27:52 +00:00
jsr CMD.NEXT.GetVarNamePtr
2019-03-06 16:29:51 +00:00
2019-03-05 16:49:34 +00:00
dey skip hLIST
dey
lda (pData),y
2019-03-06 16:29:51 +00:00
sta ZPPtr1
2019-03-05 16:49:34 +00:00
dey
lda (pData),y
sta ZPPtr1+1
2019-03-08 11:16:19 +00:00
ldy #0
2020-01-06 07:03:37 +00:00
.10 jsr GetPtr1NextChar
2019-03-08 11:16:19 +00:00
beq .3
2019-07-31 05:42:04 +00:00
cmp #C.SPACE
2019-03-08 11:16:19 +00:00
beq .10
2019-03-08 11:16:19 +00:00
sta (ZPCLBuf),y
iny
2020-01-06 07:03:37 +00:00
.1 jsr GetPtr1NextChar
2019-03-06 16:29:51 +00:00
beq .3
2019-03-05 16:49:34 +00:00
2019-07-31 05:42:04 +00:00
cmp #C.SPACE
2019-03-05 16:49:34 +00:00
beq .3
sta (ZPCLBuf),y
2019-03-08 11:16:19 +00:00
iny
2019-03-05 16:49:34 +00:00
bra .1
2019-11-15 14:40:48 +00:00
2019-10-03 06:25:27 +00:00
.3 lda #0
2019-03-05 16:49:34 +00:00
sta (ZPCLBuf),y
tya
beq .8
2019-11-15 14:40:48 +00:00
>LDYA ZPCLBuf
jsr CMD.SET.YA
2019-03-06 16:29:51 +00:00
bcs .9
2019-03-05 16:49:34 +00:00
lda (pData)
sec
2019-03-06 16:29:51 +00:00
sbc #4
2019-03-05 16:49:34 +00:00
tay
lda ZPPtr1
sta (pData),y
2019-03-06 16:29:51 +00:00
dey
2019-03-05 16:49:34 +00:00
lda ZPPtr1+1
sta (pData),y
2019-11-15 14:40:48 +00:00
2019-03-06 16:29:51 +00:00
lda #$80
2019-03-05 16:49:34 +00:00
clc
2019-03-06 16:29:51 +00:00
.9 rts
2019-11-15 14:40:48 +00:00
.8 jmp CMD.NEXT.END
2019-03-06 16:29:51 +00:00
*--------------------------------------
2019-03-07 16:48:30 +00:00
* stack-4 CmdPtr
2019-09-18 15:33:00 +00:00
* stack-3 hFILE/hPIPE
2019-03-08 11:16:19 +00:00
* stack-2 hVARNAME
2021-05-11 18:44:13 +00:00
* stack-1 FOR SUB TOKEN
2019-03-08 11:16:19 +00:00
* stack FOR TOKEN
*--------------------------------------
2019-09-18 15:33:00 +00:00
CMD.NEXT.FILEEXEC
lda (pData),y Y = StkPtr
2019-12-12 14:13:32 +00:00
bpl CMD.NEXT.FILEEXEC.POP
2019-09-18 15:33:00 +00:00
2019-03-11 15:43:33 +00:00
jsr CMD.NEXT.LINE
2020-01-06 16:27:52 +00:00
bcs CMD.NEXT.FILEEXEC.9
2019-12-12 14:13:32 +00:00
bpl CMD.NEXT.FILEEXEC.POP end of file/pipe
2019-03-08 11:16:19 +00:00
lda (pData)
sec
sbc #4
2020-01-06 16:27:52 +00:00
CMD.NEXT.FILEEXEC.LOOPY
2019-03-08 11:16:19 +00:00
tay
lda (pData),y
2019-05-31 07:31:41 +00:00
sta ZPInputBufPtr
2019-03-08 11:16:19 +00:00
dey
lda (pData),y
2019-05-31 07:31:41 +00:00
sta ZPInputBufPtr+1
2019-03-08 11:16:19 +00:00
clc
2020-01-06 16:27:52 +00:00
CMD.NEXT.FILEEXEC.9
rts
2019-11-15 14:40:48 +00:00
2019-12-12 14:13:32 +00:00
CMD.NEXT.FILEEXEC.POP
lda (pData)
2019-03-08 11:16:19 +00:00
tay
sec
sbc #6
sta (pData)
2019-11-15 14:40:48 +00:00
2019-03-08 11:16:19 +00:00
dey
2019-10-03 06:25:27 +00:00
dey
2019-03-08 11:16:19 +00:00
lda (pData),y hVARNAME
pha
dey
2019-03-11 15:43:33 +00:00
lda (pData),y hFILE/hPIPE
2020-02-28 07:21:46 +00:00
>SYSCALL FClose
2019-03-08 11:16:19 +00:00
pla
2020-02-28 07:21:46 +00:00
>SYSCALL FreeMem
2019-03-08 11:16:19 +00:00
* clc
2019-12-12 14:13:32 +00:00
rts
2019-03-08 11:16:19 +00:00
*--------------------------------------
2020-01-06 16:27:52 +00:00
CMD.NEXT.LINE jsr CMD.NEXT.GetVarNamePtr
2019-03-08 11:16:19 +00:00
2019-05-07 15:39:35 +00:00
dey
lda (pData),y hFILE/hPIPE
2020-12-23 14:54:57 +00:00
>PUSHA
>PUSHW ZPCLBuf
>PUSHWI 256
2020-03-09 16:24:08 +00:00
>SYSCALL FGetS
2019-11-15 14:40:48 +00:00
bcs CMD.NEXT.END
2021-05-11 18:44:13 +00:00
2019-11-15 14:40:48 +00:00
>LDYA ZPCLBuf
jsr CMD.SET.YA
bcs CMD.NEXT.LINE.RTS
2019-03-08 11:16:19 +00:00
lda #$80
* clc
2019-03-05 16:49:34 +00:00
rts
2021-05-11 18:44:13 +00:00
2019-11-15 14:40:48 +00:00
CMD.NEXT.END jsr CMD.SET.UNSET
2019-03-08 11:16:19 +00:00
bcs .9
lda #0
2019-11-15 14:40:48 +00:00
clc keep this CLC for CMD.NEXT.LIST.TOKEN
2019-10-03 06:25:27 +00:00
.9
2019-09-09 15:38:37 +00:00
CMD.NEXT.LINE.RTS
rts
2019-03-05 16:49:34 +00:00
*--------------------------------------
2020-01-06 16:27:52 +00:00
CMD.NEXT.GetVarNamePtr
lda (pData)
dec skip FOR
dec skip SUB TOKEN
tay
lda (pData),y
phy
>SYSCALL GetMemPtr hVARNAME
>STYA ZPVarNamePtr
ply
rts
*--------------------------------------
2021-05-11 18:44:13 +00:00
CMD.WHILE
2019-03-08 16:36:21 +00:00
CMD.IF jsr CORE.StkGetCtx
2019-02-01 16:32:29 +00:00
bit #$40 Parent is true ?
beq .3
2019-02-11 16:44:56 +00:00
2019-02-11 06:58:33 +00:00
jsr EXP.TEST
2019-09-09 15:38:37 +00:00
bcs CMD.NEXT.LINE.RTS
2019-07-31 15:10:59 +00:00
.3 lda CORE.IntCmd
2019-02-01 16:32:29 +00:00
cmp #C.WHILE
bne .8
2019-11-30 13:37:55 +00:00
2019-09-09 15:38:37 +00:00
lda #3
jsr CORE.StkCheck
bcs CMD.NEXT.LINE.RTS
2019-11-30 13:37:55 +00:00
2019-05-31 20:04:41 +00:00
>LDYA ZPInputCmdPtr
2019-05-31 07:31:41 +00:00
jsr CORE.StkPushYA Push BEFORE WHILE/IF
2019-11-30 13:37:55 +00:00
2019-07-31 15:10:59 +00:00
.8 lda CORE.TestResult
ora CORE.IntCmd
2019-09-09 15:38:37 +00:00
jmp CORE.StkPush
2018-11-24 22:25:33 +00:00
*--------------------------------------
2019-03-04 16:44:33 +00:00
CMD.LOOP jsr CORE.StkPull
bcs .9
2019-05-31 20:04:41 +00:00
2019-03-04 16:44:33 +00:00
tax
and #$3F
cmp #C.WHILE
bne .9
txa
2019-11-30 13:37:55 +00:00
bmi .8 true, loop
2021-05-11 18:44:13 +00:00
2019-11-30 13:37:55 +00:00
jmp CORE.StkPopCtxA false, Discard loop Ptr
2019-03-06 16:29:51 +00:00
2019-05-31 07:31:41 +00:00
.8 jmp CORE.StkPullInputBufPtr
2019-11-15 14:40:48 +00:00
2019-03-04 16:44:33 +00:00
.9 lda #E.NOWHILE
sec
2019-10-03 06:25:27 +00:00
rts
2019-03-04 16:44:33 +00:00
*--------------------------------------
2019-02-01 16:32:29 +00:00
CMD.ELSE jsr CORE.StkGet
bcs .9
bit #$40 parent is true ?
beq .8 no, skip
tax
and #$3F
cmp #C.IF
bne .9
txa
eor #$80 toggle and store at stack ptr
sta (pData),y
.8 clc
rts
2019-12-20 19:46:21 +00:00
.9
CMD.ELSE.NOIF lda #E.NOIF
sec
2019-02-01 16:32:29 +00:00
rts
2018-11-10 17:43:20 +00:00
*--------------------------------------
2019-02-01 16:32:29 +00:00
CMD.FI jsr CORE.StkPull
2019-12-20 19:46:21 +00:00
bcs CMD.ELSE.NOIF
2019-11-30 13:37:55 +00:00
2019-02-01 16:32:29 +00:00
and #$3F
cmp #C.IF
2019-12-20 19:46:21 +00:00
bne CMD.ELSE.NOIF
2019-11-30 13:37:55 +00:00
2019-02-01 16:32:29 +00:00
clc
rts
2018-11-24 18:20:48 +00:00
*--------------------------------------
2019-02-11 06:58:33 +00:00
CMD.IsSwitch lda (ZPArgVBufPtr)
2019-02-01 16:32:29 +00:00
cmp #'-'
bne .9
2020-01-20 15:24:53 +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
beq .9
2020-01-20 15:24:53 +00:00
2019-03-01 14:36:20 +00:00
cmp #'0' is -0 ... -9 ?
bcc .9
2020-01-20 15:24:53 +00:00
2019-03-01 14:36:20 +00:00
cmp #'9'+1
bcc .9
2019-12-20 19:46:21 +00:00
tax
2018-11-19 16:15:16 +00:00
iny
2019-02-11 06:58:33 +00:00
lda (ZPArgVBufPtr),y
2019-02-01 16:32:29 +00:00
bne .9
2020-01-20 15:24:53 +00:00
2019-02-11 06:58:33 +00:00
txa
2019-03-05 16:49:34 +00:00
jmp ToUpperCase
2021-05-11 18:44:13 +00:00
2019-10-03 06:25:27 +00:00
.9 sec
2018-11-19 16:15:16 +00:00
rts
*--------------------------------------
2015-10-19 20:35:00 +00:00
MAN
2020-05-26 14:23:09 +00:00
SAVE usr/src/bin/sh.s.cmd
LOAD usr/src/bin/sh.s
2015-10-19 20:35:00 +00:00
ASM