A2osX/BIN/SH.S.CMD.txt

1237 lines
21 KiB
Plaintext
Raw Normal View History

NEW
2019-04-15 05:40:13 +00:00
AUTO 3,1
2015-10-19 20:35:00 +00:00
.LIST OFF
*--------------------------------------
2019-08-12 07:40:16 +00:00
CMD.. lda (ZPArgVBufPtr)
beq .9
>LDYA ZPArgVBufPtr
jsr IO.Load
2019-08-15 12:48:58 +00:00
bcs CMD.SHIFTA.RTS
2019-08-12 07:40:16 +00:00
>LDYA ZPArgVBufPtr
2019-08-15 12:48:58 +00:00
jsr CORE.Load.YAX Exec . file
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
.9 jmp CMD.E.CSYN
2019-08-12 07:40:16 +00:00
*--------------------------------------
CMD.NOHUP lda #S.PS.F.NOHUP
tsb CORE.PSFlags
2019-02-03 21:58:26 +00:00
>LDYA ZPArgVBuf
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
2019-10-29 20:48:34 +00:00
CMD.SHIFT.1 inc
2019-02-01 16:32:29 +00:00
CMD.SHIFTA >SYSCALL ArgV
bcs .8
2019-10-29 20:48:34 +00:00
2019-02-03 21:58:26 +00:00
jsr RemoveStrFromArgV
2019-10-29 20:48:34 +00:00
ldy #S.PS.ARGC
2019-02-01 16:32:29 +00:00
lda (pPS),y
dec
sta (pPS),y
2019-10-29 20:48:34 +00:00
2019-02-01 16:32:29 +00:00
.8 clc
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-07-22 16:28:44 +00:00
ldy #S.PS.hCWD
2019-02-01 16:32:29 +00:00
lda (pPs),y
>SYSCALL GetMemPtr
>SYSCALL strdup
bcs CMD.POPD.CSYN
>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
2019-02-01 16:32:29 +00:00
.8 clc
.9 rts
*--------------------------------------
CMD.POPD >LDA.G PUSHD.STACK
cmp #PUSHD.STACK
beq CMD.POPD.CSYN
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
2019-04-03 11:46:50 +00:00
CMD.CD.YA >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
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
2019-02-01 16:32:29 +00:00
2019-02-03 21:58:26 +00:00
.10 >LDA.G StatBuf+S.STAT.P.TYPE
2019-02-01 16:32:29 +00:00
cmp #S.FI.T.DIR
2019-02-03 21:58:26 +00:00
beq .11
lda #MLI.E.INVPATH
.19 pha
2019-07-31 15:10:59 +00:00
lda ZPTmpW
2019-02-03 21:58:26 +00:00
>SYSCALL freemem
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 (ZPPtr1),y
cmp #'/'
2019-02-03 21:58:26 +00:00
bne .14
2019-02-01 16:32:29 +00:00
2019-07-31 15:10:59 +00:00
lda ZPTmpW
2019-10-11 20:05:54 +00:00
bra CMD.SetCWDA already ends with a /
2019-02-03 21:58:26 +00:00
2019-10-11 20:05:54 +00:00
.14 iny back to /
iny at \0
iny add+1 for adding \0 after adding '/'
2019-02-01 16:32:29 +00:00
lda #0
>SYSCALL getmem
2019-02-03 21:58:26 +00:00
bcs .19
2019-02-01 16:32:29 +00:00
>STYA ZPPtr2
2019-07-31 15:10:59 +00:00
jsr StrCpyPtr1Ptr2
2019-02-01 16:32:29 +00:00
lda #'/'
sta (ZPPtr2),y
2019-07-31 15:10:59 +00:00
iny
lda #0
sta (ZPPtr2),y
2019-02-01 16:32:29 +00:00
phx
2019-07-31 15:10:59 +00:00
lda ZPTmpW
2019-02-01 16:32:29 +00:00
>SYSCALL freemem
pla
*--------------------------------------
2019-08-12 07:40:16 +00:00
CMD.SetCWDA pha
2019-07-22 16:28:44 +00:00
ldy #S.PS.hCWD
2019-02-01 16:32:29 +00:00
lda (pPs),y
>SYSCALL FreeMem
pla
2019-07-22 16:28:44 +00:00
ldy #S.PS.hCWD
2019-02-01 16:32:29 +00:00
sta (pPs),y
lda #0
* clc
rts
*--------------------------------------
2019-02-03 21:58:26 +00:00
CMD.Exec.CSYN lda #E.CSYN
2018-11-28 11:39:33 +00:00
sec
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
2019-02-01 16:32:29 +00:00
ldy #S.PS.hENV
lda (pPs),y
>SYSCALL GetMemPtr
>STYA ZPPTR1
2015-10-19 20:35:00 +00:00
2019-02-01 16:32:29 +00:00
.1 lda (ZPPTR1)
beq .8 Ending 0 ?
2019-08-05 13:30:58 +00:00
jsr GetPtr1LenY
2019-02-01 16:32:29 +00:00
tya
sec
adc ZPPTR1
sta ZPPTR2
lda #0
2019-02-01 16:32:29 +00:00
adc ZPPTR1+1
sta ZPPTR2+1
>PUSHW ZPPTR2 Push value
>PUSHW ZPPTR1 Push name
jsr CMD.SET.PRINT
bcs .9
ldy #$ff
.3 iny
lda (ZPPTR2),y
bne .3
tya
sec
adc ZPPTR2
sta ZPPTR1
lda #0
adc ZPPTR2+1
sta ZPPTR1+1
bra .1
.8 clc
.9 rts
*--------------------------------------
* SET +X VAR = VALUE1 op VALUE2 op VALUE3 ...
*--------------------------------------
2019-02-11 16:44:56 +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
cmp #'C'
2019-01-28 16:33:30 +00:00
bne .2
2019-11-30 13:37:55 +00:00
2019-04-01 15:24:01 +00:00
ldy #bSET.C
2019-02-01 16:32:29 +00:00
bra .5
2019-11-30 13:37:55 +00:00
2019-02-01 16:32:29 +00:00
.2 cmp #'X'
2019-04-01 15:24:01 +00:00
bne .3
2019-11-30 13:37:55 +00:00
2019-04-01 15:24:01 +00:00
ldy #bSET.X
bra .5
2019-11-30 13:37:55 +00:00
2019-04-02 15:28:50 +00:00
.3 cmp #'E'
bne .4
2019-11-30 13:37:55 +00:00
2019-04-02 15:28:50 +00:00
ldy #bSET.E
bra .5
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
bra .50
2019-11-30 13:37:55 +00:00
2019-04-01 15:24:01 +00:00
.5 lda (pData),y
eor #$ff
2019-01-28 16:33:30 +00:00
sta (pData),y
2019-11-30 13:37:55 +00:00
2019-04-01 15:24:01 +00:00
.50 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
2019-11-30 13:37:55 +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
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
2019-11-15 14:40:48 +00:00
2019-02-15 16:38:17 +00:00
cmp #'`'
beq CMD.SET.EXEC
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-01-28 16:33:30 +00:00
.8 clc
2019-03-02 22:18:21 +00:00
.9 rts
2019-08-15 12:48:58 +00:00
.99 jmp CMD.E.CSYN
2019-11-15 14:40:48 +00:00
CMD.SET.YA >PUSHYA
>LDYA ZPVarNamePtr
>SYSCALL SetEnv
rts
2019-02-11 06:58:33 +00:00
CMD.SET.UNSET >LDYA ZPVarNamePtr
2019-02-01 16:32:29 +00:00
>SYSCALL UnsetEnv
rts
2019-02-11 06:58:33 +00:00
CMD.SET.GET >LDYA ZPVarNamePtr
2019-02-01 16:32:29 +00:00
>SYSCALL GetEnv
bcc .1
clc
rts
2019-11-15 14:40:48 +00:00
2019-02-01 16:32:29 +00:00
.1 >PUSHYA push value
2019-02-11 06:58:33 +00:00
>LDYA ZPVarNamePtr
2019-02-01 16:32:29 +00:00
>PUSHYA push name
2019-01-23 16:26:48 +00:00
*--------------------------------------
2019-02-01 16:32:29 +00:00
CMD.SET.PRINT >PUSHBI 4
>LDYA L.MSG.PRINTENV
>SYSCALL printf
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
bcs .9
2019-08-02 14:36:49 +00:00
>PUSHBI S.PS.F.CLOSEONX
2019-02-15 16:38:17 +00:00
>LDYA ZPArgVBufPtr
>SYSCALL execl
bcs .9
2019-08-02 14:36:49 +00:00
2019-02-15 16:38:17 +00:00
jsr IO.Pipe.In
bcs .9
2019-08-15 12:48:58 +00:00
lda #255
>STA.G READ.N
>STA.G bREAD.S
jmp CMD.READ.VAR
2019-02-15 16:38:17 +00:00
.9 rts
*--------------------------------------
2019-10-26 14:33:37 +00:00
CMD.DATE >LEA.G TimeBuf
2019-02-01 16:32:29 +00:00
>SYSCALL Time
2018-09-17 06:16:45 +00:00
2019-02-01 16:32:29 +00:00
>PUSHEA.G TimeBuf
2019-10-26 14:33:37 +00:00
lda (ZPArgVBufPtr)
beq .1
>LDYA ZPArgVBufPtr
2019-02-01 16:32:29 +00:00
bra .2
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
>LEA.G StatBuf
2019-02-01 16:32:29 +00:00
>SYSCALL StrFTime
2019-02-04 14:29:52 +00:00
>LEA.G StatBuf
2019-02-01 16:32:29 +00:00
>SYSCALL puts
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
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
2019-03-01 15:41:27 +00:00
bra .4
2019-02-12 16:47:34 +00:00
.2 lda ZPPtr1+1
beq .3
lda #C.SPACE
>SYSCALL putchar
.3 >PUSHBI 0
2019-02-11 06:58:33 +00:00
>LDYA ZPArgVBufPtr
2019-02-01 16:32:29 +00:00
>SYSCALL printf
bcs .9
2019-02-12 16:47:34 +00:00
inc ZPPtr1+1
.4 jsr CORE.ArgV.Next
2019-02-11 06:58:33 +00:00
bne .1
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
2019-02-01 16:32:29 +00:00
>PUSHBI 0
>LDYA L.MSG.ECHOCRLF
>SYSCALL printf
2019-06-02 08:58:46 +00:00
.9 rts
2019-02-01 16:32:29 +00:00
.8 clc
2019-03-25 16:51:51 +00:00
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)
2019-08-15 12:48:58 +00:00
beq .9
2019-11-04 07:21:40 +00:00
2019-08-15 12:48:58 +00:00
stz ZPVarNamePtr+1
>STZ.G bREAD.S
dec
>STA.G READ.N
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
2019-02-01 16:32:29 +00:00
>STA.G bREAD.S
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
beq .9
2019-02-01 16:32:29 +00:00
>PUSHBI 0
2019-02-11 06:58:33 +00:00
>LDYA ZPArgVBufPtr
2019-02-01 16:32:29 +00:00
>SYSCALL printf
2019-10-26 14:33:37 +00:00
bcs CMD.ECHO.RTS
2019-08-15 12:48:58 +00:00
bra .5
.9 jmp CMD.E.CSYN
2019-10-31 15:59:11 +00:00
2019-08-15 12:48:58 +00:00
.3 cmp #'N'
bne .9
2019-10-29 20:48:34 +00:00
2019-08-15 12:48:58 +00:00
jsr CORE.ArgV.Next
beq .9
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
>STA.G READ.N
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
2019-02-01 16:32:29 +00:00
beq .9
2019-10-29 20:48:34 +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
jmp CMD.SET.UNSET
.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
*--------------------------------------
2019-02-01 16:32:29 +00:00
CMD.PAUSE lda #$FF
>STA.G bPause
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
>LDYA ZPArgVBufPtr
2019-02-01 16:32:29 +00:00
>SYSCALL MKDir
rts
*--------------------------------------
2019-10-10 06:04:11 +00:00
CMD.PWD ldy #S.PS.hCWD
lda (pPs),y
>SYSCALL GetMemPtr
>SYSCALL puts
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
2019-11-15 14:40:48 +00:00
2019-02-11 06:58:33 +00:00
>LDYA ZPArgVBufPtr
2019-11-15 14:40:48 +00:00
jsr IO.StatYA
2019-02-01 16:32:29 +00:00
bcs .99
2019-11-15 14:40:48 +00:00
2019-02-01 16:32:29 +00:00
>LDA.G StatBuf+S.STAT.P.TYPE
cmp #S.FI.T.DIR
2019-08-15 12:48:58 +00:00
bne CMD.REN.CSYN
2019-02-11 06:58:33 +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
>LDYA ZPArgVBufPrev old path
>SYSCALL realpath
bcs CMD.REN.CSYN
>STYA ZPPtr1
stx ZPTmpW
ldy #$ff
.1 iny
lda (ZPPtr1),y
beq .2
cmp #'/'
bne .1
tya
tax
bra .1
.2 ldy #$ff
.3 iny
inx
lda (ZPArgVBufPtr),y
bne .3
txa
tay
lda #0
>SYSCALL getmem
bcs .90
>STYA ZPPtr2
stx ZPTmpW+1
ldy #$ff
.4 iny
lda (ZPPtr1),y
beq .5
sta (ZPPtr2),y
cmp #'/'
bne .4
tya
inc
tax
bra .4
.5 txa
tay
lda #0
sta (ZPPtr2),y
>PUSHW ZPArgVBufPtr
>LDYA ZPPtr2
>SYSCALL strcat
lda ZPTmpW
>SYSCALL freemem
lda ZPTmpW+1
sta ZPTmpW
>PUSHW ZPPtr2
2019-11-11 21:56:58 +00:00
>LDYA ZPPtr1
2019-10-10 10:23:02 +00:00
>SYSCALL Rename
.90 php
pha
lda ZPTmpW
>SYSCALL freemem
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
2019-03-13 16:29:24 +00:00
>LDA.G hFuncList
bne .1
>SYSCALL SListNew
2019-03-15 16:20:28 +00:00
bcs .99
2019-03-13 16:29:24 +00:00
>STA.G hFuncList
.1 >PUSHW ZPArgVBufPtr
>LDA.G hFuncList
2019-08-12 07:40:16 +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
2019-08-15 12:48:58 +00:00
.9 jmp CMD.E.CSYN
2019-08-12 07:40:16 +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
cmp #'{'
bne .9
jsr CORE.GetNextCharNB
bcs .9
.11 stz M32.ACC '{' counter
2019-04-01 15:24:01 +00:00
2019-08-12 07:40:16 +00:00
>LDYA ZPInputBufPtr
>STYA ZPPtr1
ldy #0
ldx #0
lda (ZPInputBufPtr)
beq .6
.12 cmp #'{'
bne .13
inc M32.ACC
bra .14
.13 cmp #'}'
bne .14
dec M32.ACC
bmi .7
.14 iny
bne .15
inx
.15 jsr CORE.GetNextChar
bne .12
.6 lda M32.ACC
bpl .9
.7 jsr CORE.GetNextChar skip ending '}'
txa
>PUSHYA DataLen
>PUSHW ZPPtr1 DataPtr
>PUSHW ZPTmpW KeyID
>LDA.G hFuncList
>SYSCALL SListAddData
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
2019-07-31 05:42:04 +00:00
>PUSHWZ From Start
2019-04-01 06:07:56 +00:00
>PUSHWI $ffff all
2019-07-31 05:42:04 +00:00
>PUSHWZ Allocate..
2019-07-31 15:10:59 +00:00
>PUSHW ZPTmpW KeyID
2019-04-01 06:07:56 +00:00
>LDA.G hFuncList
>SYSCALL 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
lda #$C0+C.CALL
jmp CORE.StkPush
2019-04-03 11:46:50 +00:00
*--------------------------------------
2019-11-22 11:25:27 +00:00
CMD.CALL.GETFUNC
>LDA.G hFuncList
beq CMD.CALL.UNDEF
>PUSHW ZPArgVBufPtr
>LDA.G hFuncList
>SYSCALL SListLookup
bcc CMD.CALL.RTS
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
2019-10-29 20:48:34 +00:00
2019-11-30 13:37:55 +00:00
.1 ldy #S.PS.RC
sta (pPs),y
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
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
2019-08-15 12:48:58 +00:00
lda #$ff
>STA.G bExitOnEOF
clc
2019-11-30 13:37:55 +00:00
.9 rts
2019-08-15 12:48:58 +00:00
*--------------------------------------
CMD.EXIT.FILE jsr CORE.StkPull
2019-04-04 15:44:20 +00:00
>SYSCALL freemem 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
>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+1
jsr CORE.StkPull
sta ZPInputBuf
2019-04-05 05:59:06 +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
2019-03-12 16:50:16 +00:00
sta (pDATA),y
.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
>SYSCALL strdup
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
2019-03-13 16:29:24 +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 ?
bpl .10
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
>SYSCALL strcmp
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
2019-05-31 07:31:41 +00:00
>PUSHW ZPArgVBufPtr
>LDYA L.IN
>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
bcs .9
2019-05-31 07:31:41 +00:00
>LDYA ZPInputBufPtr
jsr CORE.StkPushYA Push CmdPtr AFTER FOR
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 #'`'
2019-07-31 15:10:59 +00:00
bne CMD.FOR.LIST
2019-03-07 16:48:30 +00:00
2019-07-31 15:10:59 +00:00
jmp CMD.FOR.EXEC
2019-10-03 06:25:27 +00:00
.9 rts
2019-03-06 16:29:51 +00:00
*--------------------------------------
2019-07-31 15:10:59 +00:00
CMD.FOR.LIST >LDYA ZPArgVBufPtr
2019-03-05 16:49:34 +00:00
>SYSCALL strdup
2019-07-31 15:10:59 +00:00
bcs FOR.FILE.9
2019-05-31 07:31:41 +00:00
jsr CORE.StkPushYAX Push listPtr,hList
2019-09-18 15:33:00 +00:00
jsr CORE.PushVarName Push hVARNAME
2019-07-31 15:10:59 +00:00
bcs FOR.FILE.9
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
2019-04-03 11:46:50 +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
2019-08-02 14:36:49 +00:00
>PUSHBI S.PS.F.CLOSEONX
2019-03-08 11:16:19 +00:00
>LDYA ZPArgVBufPtr
>SYSCALL execl
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
2019-07-31 15:10:59 +00:00
bcs FOR.FILE.9
2019-03-11 15:43:33 +00:00
2019-10-25 15:09:13 +00:00
CMD.FOR.PUSH jsr CORE.StkPush push hPIPE for read
2019-09-18 15:33:00 +00:00
jsr CORE.PushVarName Push hVARNAME
2019-07-31 15:10:59 +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
2019-09-18 15:33:00 +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
tay
2019-03-05 16:49:34 +00:00
2019-03-06 16:29:51 +00:00
lda (pData),y
2019-05-31 07:31:41 +00:00
sta ZPInputBufPtr
2019-03-05 16:49:34 +00:00
dey
lda (pData),y
2019-05-31 07:31:41 +00:00
sta ZPInputBufPtr+1
2019-03-06 16:29:51 +00:00
clc
rts
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
>SYSCALL freemem
pla
>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
lda (pData)
2019-03-06 16:29:51 +00:00
dec skip FOR
dec skip SUB TOKEN
tay
lda (pData),y
phy
>SYSCALL GetMemPtr hVARNAME
>STYA ZPVarNamePtr
ply
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
2019-07-31 05:42:04 +00:00
.10 jsr GetPtr1Next
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
sta (ZPCLBuf),y
iny
2019-07-31 05:42:04 +00:00
.1 jsr GetPtr1Next
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
* stack-1 FOR SUB TOKEN
* stack FOR TOKEN
*--------------------------------------
2019-09-18 15:33:00 +00:00
CMD.NEXT.FILEEXEC
lda (pData),y Y = StkPtr
2019-03-08 11:16:19 +00:00
bpl .1
2019-09-18 15:33:00 +00:00
2019-03-11 15:43:33 +00:00
jsr CMD.NEXT.LINE
2019-03-08 11:16:19 +00:00
bcs .9
2019-05-07 15:39:35 +00:00
bpl .1 end of file/pipe
2019-03-08 11:16:19 +00:00
lda (pData)
sec
sbc #4
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
rts
2019-11-15 14:40:48 +00:00
2019-03-08 11:16:19 +00:00
.1 lda (pData)
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
2019-03-08 11:16:19 +00:00
>SYSCALL fclose
pla
>SYSCALL freemem
* clc
.9 rts
*--------------------------------------
2019-03-11 15:43:33 +00:00
CMD.NEXT.LINE lda (pData)
2019-03-08 11:16:19 +00:00
dec skip FOR
dec skip SUB TOKEN
tay
lda (pData),y
phy
>SYSCALL GetMemPtr hVARNAME
>STYA ZPVarNamePtr
>PUSHWI 256
>PUSHW ZPCLBuf
2019-05-07 15:39:35 +00:00
ply
dey
lda (pData),y hFILE/hPIPE
2019-03-08 11:16:19 +00:00
>SYSCALL fgets
2019-11-15 14:40:48 +00:00
bcs CMD.NEXT.END
>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
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
*--------------------------------------
2019-02-01 16:32:29 +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
2019-11-15 14:40:48 +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-02-01 16:32:29 +00:00
.9 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
bcs .9
2019-11-30 13:37:55 +00:00
2019-02-01 16:32:29 +00:00
and #$3F
cmp #C.IF
bne .9
2019-11-30 13:37:55 +00:00
2019-02-01 16:32:29 +00:00
clc
rts
2019-11-30 13:37:55 +00:00
2019-02-01 16:32:29 +00:00
.9 lda #E.NOIF
sec
2018-11-24 18:20:48 +00:00
rts
*--------------------------------------
2019-02-11 06:58:33 +00:00
CMD.IsSwitch lda (ZPArgVBufPtr)
2019-02-01 16:32:29 +00:00
cmp #'-'
bne .9
ldy #1
2019-02-11 06:58:33 +00:00
lda (ZPArgVBufPtr),y
2019-02-01 16:32:29 +00:00
beq .9
2019-03-01 14:36:20 +00:00
cmp #'0' is -0 ... -9 ?
bcc .9
cmp #'9'+1
bcc .9
.1 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
2019-02-11 06:58:33 +00:00
txa
2019-03-05 16:49:34 +00:00
jmp ToUpperCase
2019-10-03 06:25:27 +00:00
.9 sec
2019-10-31 15:59:11 +00:00
CMD.IsSwitch.RTS
2018-11-19 16:15:16 +00:00
rts
*--------------------------------------
2015-10-19 20:35:00 +00:00
MAN
2019-02-08 16:13:43 +00:00
SAVE USR/SRC/BIN/SH.S.CMD
LOAD USR/SRC/BIN/SH.S
2015-10-19 20:35:00 +00:00
ASM