2015-10-19 20:35:00 +00:00
|
|
|
|
PR#3
|
2017-03-29 15:48:15 +00:00
|
|
|
|
PREFIX /A2OSX.BUILD
|
2015-10-19 20:35:00 +00:00
|
|
|
|
NEW
|
|
|
|
|
INC 1
|
|
|
|
|
AUTO 6
|
|
|
|
|
.LIST OFF
|
|
|
|
|
*--------------------------------------
|
2017-07-17 05:59:30 +00:00
|
|
|
|
* Remove extra SPACE & comment
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
Cmd.Normalize >LDYA pData
|
|
|
|
|
>STYA ZPPtr1
|
|
|
|
|
|
|
|
|
|
lda (pData) empty line...quit
|
|
|
|
|
beq .9
|
|
|
|
|
|
|
|
|
|
tax Char count
|
|
|
|
|
|
|
|
|
|
ldy #0
|
|
|
|
|
|
|
|
|
|
.1 jsr Cmd.Normalize.Next
|
|
|
|
|
beq .8 no more char, exit
|
|
|
|
|
|
|
|
|
|
cmp #' ' skip leading spaces
|
|
|
|
|
beq .1
|
|
|
|
|
|
|
|
|
|
cmp #'#' Comment ?
|
|
|
|
|
beq .8 ignore remaining chars
|
|
|
|
|
|
|
|
|
|
.3 iny add char to buffer
|
|
|
|
|
sta (pData),y
|
|
|
|
|
|
|
|
|
|
jsr Cmd.Normalize.Next
|
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
cmp #' '
|
|
|
|
|
bne .3
|
|
|
|
|
|
|
|
|
|
iny add One SPACE to buffer
|
|
|
|
|
sta (pData),y
|
|
|
|
|
|
|
|
|
|
.5 jsr Cmd.Normalize.Next
|
|
|
|
|
beq .8
|
|
|
|
|
cmp #' '
|
|
|
|
|
beq .5 skip additional spaces
|
|
|
|
|
bne .3 no more space, add next word...
|
|
|
|
|
|
|
|
|
|
.8 tya
|
|
|
|
|
sta (pData)
|
|
|
|
|
|
|
|
|
|
.9 rts
|
|
|
|
|
|
|
|
|
|
Cmd.Normalize.Next
|
|
|
|
|
txa
|
|
|
|
|
beq .8
|
|
|
|
|
dex
|
|
|
|
|
inc ZPPtr1
|
|
|
|
|
bne .1
|
|
|
|
|
inc ZPPtr1+1
|
|
|
|
|
.1 lda (ZPPtr1)
|
|
|
|
|
.8 rts
|
|
|
|
|
*--------------------------------------
|
2016-08-17 06:25:58 +00:00
|
|
|
|
* Y,A -> Command line (formatted & not empty)
|
|
|
|
|
*--------------------------------------
|
2017-07-11 15:53:52 +00:00
|
|
|
|
Cmd.ExecYA stz bStartProc
|
2017-04-03 06:01:52 +00:00
|
|
|
|
|
2017-08-24 15:29:22 +00:00
|
|
|
|
Cmd.ExecYA.1 >SYSCALL ExpandStr.YA
|
2015-10-19 20:35:00 +00:00
|
|
|
|
>STYA ZPPtr1
|
2017-08-23 11:33:51 +00:00
|
|
|
|
>STYA ZPPtr2
|
|
|
|
|
stx Cmd.ExecYA.Exit.1+1
|
2017-04-04 13:07:58 +00:00
|
|
|
|
|
2017-08-23 11:33:51 +00:00
|
|
|
|
ldy #0 CMD len
|
2017-07-11 15:53:52 +00:00
|
|
|
|
|
2017-08-23 11:33:51 +00:00
|
|
|
|
lda (ZPPtr2)
|
|
|
|
|
tax ARGS len=Total Len
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-08-23 11:33:51 +00:00
|
|
|
|
.1 inc ZPPtr2 Next Cmd Char
|
|
|
|
|
bne .2
|
|
|
|
|
inc ZPPtr2+1
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-08-23 11:33:51 +00:00
|
|
|
|
.2 lda (ZPPtr2)
|
|
|
|
|
cmp #" " we reached blank between CMD ARGS
|
|
|
|
|
beq .3
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-08-23 11:33:51 +00:00
|
|
|
|
iny CMD+1
|
|
|
|
|
dex Total=0
|
|
|
|
|
bne .1
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-08-23 11:33:51 +00:00
|
|
|
|
.3 tya
|
|
|
|
|
sta (ZPPtr1) Cut CMD
|
|
|
|
|
txa
|
|
|
|
|
sta (ZPPtr2) Cut ARGS
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-07-11 15:53:52 +00:00
|
|
|
|
>LDYA L.INTCMDS
|
2017-08-23 11:33:51 +00:00
|
|
|
|
>STYA ZPPtr3
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
|
|
|
|
ldx #0
|
|
|
|
|
|
2017-08-23 11:33:51 +00:00
|
|
|
|
.4 lda (ZPPtr3)
|
2016-08-17 06:25:58 +00:00
|
|
|
|
beq Cmd.Exec.EXT Ending 0, must be an external Cmd....
|
|
|
|
|
|
2017-08-23 11:33:51 +00:00
|
|
|
|
cmp (ZPPtr1) Same Len ?
|
|
|
|
|
bne .8
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
|
|
|
|
tay
|
|
|
|
|
|
2017-08-23 11:33:51 +00:00
|
|
|
|
.5 lda (ZPPtr1),y
|
2017-06-26 15:28:18 +00:00
|
|
|
|
|
|
|
|
|
cmp #'a' To Uppercase
|
2017-08-23 11:33:51 +00:00
|
|
|
|
bcc .6
|
2017-06-26 15:28:18 +00:00
|
|
|
|
cmp #'z'+1
|
2017-08-23 11:33:51 +00:00
|
|
|
|
bcs .6
|
2017-06-26 15:28:18 +00:00
|
|
|
|
eor #$20
|
|
|
|
|
|
2017-08-23 11:33:51 +00:00
|
|
|
|
.6 cmp (ZPPtr3),y
|
|
|
|
|
bne .8
|
2016-08-17 06:25:58 +00:00
|
|
|
|
dey
|
2017-08-23 11:33:51 +00:00
|
|
|
|
bne .6
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2017-08-23 11:33:51 +00:00
|
|
|
|
jsr Cmd.Exec.INT Found an internal Cmd...
|
2017-06-26 15:28:18 +00:00
|
|
|
|
|
2017-08-23 11:33:51 +00:00
|
|
|
|
bcs .7
|
2017-04-03 06:01:52 +00:00
|
|
|
|
|
2016-11-08 16:56:05 +00:00
|
|
|
|
lda #0
|
2017-04-03 06:01:52 +00:00
|
|
|
|
|
2017-08-23 11:33:51 +00:00
|
|
|
|
.7 ldy #S.PS.RC
|
2016-11-08 16:56:05 +00:00
|
|
|
|
sta (pPS),y
|
2017-08-23 11:33:51 +00:00
|
|
|
|
bra Cmd.ExecYA.Exit
|
2017-04-04 13:07:58 +00:00
|
|
|
|
|
2017-08-23 11:33:51 +00:00
|
|
|
|
.8 inx
|
2016-08-17 06:25:58 +00:00
|
|
|
|
inx
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2017-08-23 11:33:51 +00:00
|
|
|
|
lda ZPPtr3
|
2015-10-19 20:35:00 +00:00
|
|
|
|
sec
|
2017-08-23 11:33:51 +00:00
|
|
|
|
adc (ZPPtr3)
|
|
|
|
|
sta ZPPtr3
|
|
|
|
|
bcc .4
|
|
|
|
|
inc ZPPtr3+1
|
|
|
|
|
bra .4
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
Cmd.ExecYA.Exit php
|
|
|
|
|
pha
|
|
|
|
|
Cmd.ExecYA.Exit.1
|
|
|
|
|
lda #$ff
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>SYSCALL FreeMem.A
|
2017-08-23 11:33:51 +00:00
|
|
|
|
pla
|
|
|
|
|
plp
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
Cmd.Exec.INT jmp (J.INTCMDS,x)
|
2015-11-22 22:30:06 +00:00
|
|
|
|
*--------------------------------------
|
2016-08-17 06:25:58 +00:00
|
|
|
|
Cmd.Exec.EXT ldy #1
|
2017-08-23 11:33:51 +00:00
|
|
|
|
lda (ZPPtr1),y
|
2016-08-17 06:25:58 +00:00
|
|
|
|
cmp #'/' Command line is already full path, no search
|
2017-08-23 15:05:29 +00:00
|
|
|
|
bne .10
|
|
|
|
|
|
|
|
|
|
|
2016-03-13 21:53:55 +00:00
|
|
|
|
|
2016-10-29 19:58:21 +00:00
|
|
|
|
>LDYA L.ENV.PATH push ENVNAME=PATH for search
|
2017-08-31 06:23:29 +00:00
|
|
|
|
>SYSCALL GetEnv.YA get value for ENV=PATH
|
2016-08-17 06:25:58 +00:00
|
|
|
|
bcs .1 No PATH, try in CD
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2016-08-17 06:25:58 +00:00
|
|
|
|
>PUSHYA push search list
|
2016-10-06 15:50:20 +00:00
|
|
|
|
|
2017-08-23 15:05:29 +00:00
|
|
|
|
>PUSHW ZPPtr1 push filename
|
|
|
|
|
>PUSHWI UsrBuf256
|
|
|
|
|
>PUSHW L.STAT
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL FileSearch
|
2016-08-17 06:25:58 +00:00
|
|
|
|
bcc .2
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2016-08-17 06:25:58 +00:00
|
|
|
|
.1 ldy #S.PS.hPREFIX not found, try in CD
|
2015-10-19 20:35:00 +00:00
|
|
|
|
lda (pPs),y
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>SYSCALL GetMemPtr.A
|
2016-08-17 06:25:58 +00:00
|
|
|
|
>PUSHYA push search list
|
2017-08-23 11:33:51 +00:00
|
|
|
|
>PUSHW ZPPtr1
|
2017-08-23 15:05:29 +00:00
|
|
|
|
>PUSHWI UsrBuf256
|
|
|
|
|
>PUSHW L.STAT
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL FileSearch
|
2016-08-17 06:25:58 +00:00
|
|
|
|
bcs .99
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2016-08-17 06:25:58 +00:00
|
|
|
|
.2 phx save X=hMem, Y,A = Filename
|
|
|
|
|
>PUSHYA
|
2016-10-06 15:50:20 +00:00
|
|
|
|
|
2016-08-17 06:25:58 +00:00
|
|
|
|
>PUSHW L.CMD replace CMD in TmpBuffer with full path
|
2017-08-31 06:23:29 +00:00
|
|
|
|
>SYSCALL StrCpy
|
2016-08-17 06:25:58 +00:00
|
|
|
|
pla
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>SYSCALL FreeMem.A Discard this string...
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2016-10-29 19:58:21 +00:00
|
|
|
|
.3 stz UsrBuf256 reset UsrBuf256 for final CMDLINE
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2016-09-26 16:02:14 +00:00
|
|
|
|
>PUSHW L.STAT
|
|
|
|
|
>PUSHW L.CMD
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL STAT
|
2016-08-17 06:25:58 +00:00
|
|
|
|
bcs .99
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2016-12-09 16:36:24 +00:00
|
|
|
|
lda STAT+S.STAT.P.TYPE
|
2015-10-19 20:35:00 +00:00
|
|
|
|
cmp #$04 TXT File ?
|
2016-08-17 06:25:58 +00:00
|
|
|
|
beq Cmd.Exec.EXT.TXT
|
|
|
|
|
cmp #$06 BIN File ?
|
|
|
|
|
beq Cmd.Exec.EXT.BIN
|
|
|
|
|
cmp #$ff SYS File ?
|
|
|
|
|
bne .9
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2016-08-17 06:25:58 +00:00
|
|
|
|
bra *
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2016-08-17 06:25:58 +00:00
|
|
|
|
.9 lda #SYSMGR.ERRSYN
|
|
|
|
|
sec
|
2017-08-23 11:33:51 +00:00
|
|
|
|
.99 jmp Cmd.ExecYA.Exit
|
2016-08-17 06:25:58 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* TXT : Launch "/PATH/SHELL /PATH/CMD ARGS"
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
Cmd.Exec.EXT.TXT
|
|
|
|
|
lda #0 Get arg[0] = /PATH/SHELL
|
2017-08-24 12:46:48 +00:00
|
|
|
|
>SYSCALL GetArg.A
|
2016-08-17 06:25:58 +00:00
|
|
|
|
>PUSHYA
|
2016-09-26 06:18:51 +00:00
|
|
|
|
>PUSHWI UsrBuf256
|
2017-08-31 06:23:29 +00:00
|
|
|
|
>SYSCALL StrCpy
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2016-09-26 06:18:51 +00:00
|
|
|
|
inc UsrBuf256 Add a space....
|
|
|
|
|
ldy UsrBuf256
|
2016-08-17 06:25:58 +00:00
|
|
|
|
lda #' '
|
2016-09-26 06:18:51 +00:00
|
|
|
|
sta UsrBuf256,y
|
2016-08-17 06:25:58 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* BIN : Launch "/PATH/CMD ARGS"
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
Cmd.Exec.EXT.BIN
|
|
|
|
|
>PUSHW L.CMD
|
2016-09-26 06:18:51 +00:00
|
|
|
|
>PUSHWI UsrBuf256
|
2017-08-31 06:23:29 +00:00
|
|
|
|
>SYSCALL StrCat
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2016-08-17 06:25:58 +00:00
|
|
|
|
lda ARGS
|
|
|
|
|
beq .1
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
2016-09-26 06:18:51 +00:00
|
|
|
|
inc UsrBuf256 Add a space....
|
|
|
|
|
ldy UsrBuf256
|
2016-08-17 06:25:58 +00:00
|
|
|
|
lda #' '
|
2016-09-26 06:18:51 +00:00
|
|
|
|
sta UsrBuf256,y
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
|
|
|
|
>PUSHW L.ARGS
|
2016-09-26 06:18:51 +00:00
|
|
|
|
>PUSHWI UsrBuf256
|
2017-08-31 06:23:29 +00:00
|
|
|
|
>SYSCALL StrCat
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2016-09-26 06:18:51 +00:00
|
|
|
|
.1 >LDYAI UsrBuf256
|
2017-07-11 15:53:52 +00:00
|
|
|
|
bit bStartProc
|
2016-08-17 06:25:58 +00:00
|
|
|
|
bmi .2 startproc
|
2016-03-13 21:53:55 +00:00
|
|
|
|
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL ExecProcessNewEnvYA
|
2017-08-23 11:33:51 +00:00
|
|
|
|
jmp Cmd.ExecYA.Exit
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
2016-10-24 15:54:43 +00:00
|
|
|
|
.2 >SYSCALL CreateProcessYA
|
2017-08-23 11:33:51 +00:00
|
|
|
|
jmp Cmd.ExecYA.Exit
|
2016-08-17 06:25:58 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Internal Commands
|
2015-10-19 20:35:00 +00:00
|
|
|
|
*--------------------------------------
|
2016-08-17 06:25:58 +00:00
|
|
|
|
Cmd.Exec.CD lda ARGS
|
|
|
|
|
bne Cmd.Exec.CD1
|
2016-10-25 06:58:15 +00:00
|
|
|
|
|
|
|
|
|
Cmd.Exec.PWD ldy #S.PS.hPREFIX
|
2015-10-19 20:35:00 +00:00
|
|
|
|
lda (pPs),y
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>SYSCALL GetMemPtr.A
|
2017-08-22 06:37:03 +00:00
|
|
|
|
>PUSHYA
|
|
|
|
|
>LDYA L.MSG.PSTRCR
|
2017-08-25 15:02:16 +00:00
|
|
|
|
>SYSCALL PrintF.YA
|
2017-08-22 06:37:03 +00:00
|
|
|
|
rts
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2016-10-24 15:54:43 +00:00
|
|
|
|
Cmd.Exec.CD1 stz UsrBuf256
|
|
|
|
|
lda ARGS+1
|
2016-08-17 06:25:58 +00:00
|
|
|
|
cmp #'/' Full Path?
|
2016-10-24 15:54:43 +00:00
|
|
|
|
beq .1
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2016-10-24 15:54:43 +00:00
|
|
|
|
ldy #S.PS.hPREFIX no, init target prefix with actual prefix
|
2015-10-19 20:35:00 +00:00
|
|
|
|
lda (pPs),y
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>SYSCALL GetMemPtr.A
|
2016-08-17 06:25:58 +00:00
|
|
|
|
>PUSHYA
|
2016-09-26 06:18:51 +00:00
|
|
|
|
>PUSHWI UsrBuf256
|
2017-08-31 06:23:29 +00:00
|
|
|
|
>SYSCALL StrCpy
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2016-10-24 15:54:43 +00:00
|
|
|
|
.1 >PUSHW L.ARGS Append ARG to buffer
|
|
|
|
|
>PUSHWI UsrBuf256
|
2017-08-31 06:23:29 +00:00
|
|
|
|
>SYSCALL StrCat
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2016-10-24 15:54:43 +00:00
|
|
|
|
lda #'/'
|
|
|
|
|
ldx UsrBuf256
|
|
|
|
|
cmp UsrBuf256,x Ending '/' ?
|
|
|
|
|
beq .2
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2016-10-24 15:54:43 +00:00
|
|
|
|
sta UsrBuf256+1,x no, add one...
|
|
|
|
|
inc UsrBuf256
|
|
|
|
|
|
|
|
|
|
.2 ldx #0 path is something like : /dir1/../dir2/
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2016-10-24 15:54:43 +00:00
|
|
|
|
.3 ldy #0 reset char counter
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2016-10-24 15:54:43 +00:00
|
|
|
|
.4 cpx UsrBuf256
|
|
|
|
|
beq .8
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2016-10-24 15:54:43 +00:00
|
|
|
|
inx
|
|
|
|
|
lda UsrBuf256,x
|
2015-10-19 20:35:00 +00:00
|
|
|
|
cmp #'/'
|
2016-10-24 15:54:43 +00:00
|
|
|
|
beq .5
|
|
|
|
|
iny char=char+1!!!
|
|
|
|
|
bra .4
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2016-10-24 15:54:43 +00:00
|
|
|
|
.5 tya any char count?
|
|
|
|
|
beq .4 no, start counting...
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2016-10-24 15:54:43 +00:00
|
|
|
|
cpy #2 do we have /xx/?
|
|
|
|
|
bne .3 no, skip this token
|
|
|
|
|
|
|
|
|
|
lda #'.'
|
|
|
|
|
cmp UsrBuf256-1,x /yy/x./ ?
|
|
|
|
|
bne .3
|
|
|
|
|
cmp UsrBuf256-2,x /yy/../ ?
|
|
|
|
|
bne .3
|
|
|
|
|
cpx #4 /../ ?
|
|
|
|
|
beq Cmd.Exec.ERRSYN illegal
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2016-10-24 15:54:43 +00:00
|
|
|
|
txa
|
|
|
|
|
tay save end of /../
|
2015-10-19 20:35:00 +00:00
|
|
|
|
sec
|
2016-10-24 15:54:43 +00:00
|
|
|
|
sbc #3 remove ../
|
|
|
|
|
tax
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2016-10-24 15:54:43 +00:00
|
|
|
|
.6 dex
|
|
|
|
|
lda UsrBuf256,x Found beginning of dir before /../
|
|
|
|
|
cmp #'/'
|
|
|
|
|
bne .6
|
|
|
|
|
|
|
|
|
|
.7 lda UsrBuf256,y strip dir/../
|
|
|
|
|
sta UsrBuf256,x
|
|
|
|
|
cpy UsrBuf256
|
|
|
|
|
beq .71
|
|
|
|
|
iny
|
|
|
|
|
inx
|
|
|
|
|
bra .7
|
|
|
|
|
|
|
|
|
|
.71 stx UsrBuf256
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2016-10-24 15:54:43 +00:00
|
|
|
|
bra .2 Start over...
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2016-10-24 15:54:43 +00:00
|
|
|
|
.8 cpx #1
|
|
|
|
|
beq .80 we have '/' go change prefix
|
2016-09-26 16:02:14 +00:00
|
|
|
|
|
|
|
|
|
>PUSHW L.STAT
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>PUSHWI UsrBuf256
|
|
|
|
|
>SYSCALL STAT
|
2016-08-17 06:25:58 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
2016-12-09 16:36:24 +00:00
|
|
|
|
lda STAT+S.STAT.P.TYPE
|
2016-10-24 15:54:43 +00:00
|
|
|
|
cmp #$0F Directory ?
|
|
|
|
|
bne Cmd.Exec.ERRSYN
|
2016-09-26 16:02:14 +00:00
|
|
|
|
|
2016-10-24 15:54:43 +00:00
|
|
|
|
.80 >LDYAI UsrBuf256
|
2017-08-31 06:23:29 +00:00
|
|
|
|
>SYSCALL NewStr.YA
|
2016-08-17 06:25:58 +00:00
|
|
|
|
bcs .9
|
2016-03-13 21:53:55 +00:00
|
|
|
|
phx
|
|
|
|
|
|
2016-08-17 06:25:58 +00:00
|
|
|
|
ldy #S.PS.hPREFIX
|
|
|
|
|
lda (pPs),y
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>SYSCALL FreeMem.A
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2016-03-13 21:53:55 +00:00
|
|
|
|
pla
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
|
|
|
|
ldy #S.PS.hPREFIX
|
|
|
|
|
sta (pPs),y
|
2016-10-29 19:58:21 +00:00
|
|
|
|
jsr SetPWD
|
2016-08-17 06:25:58 +00:00
|
|
|
|
clc
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
2016-10-24 15:54:43 +00:00
|
|
|
|
Cmd.Exec.ERRSYN lda #SYSMGR.ERRSYN
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2016-08-17 06:25:58 +00:00
|
|
|
|
Cmd.Exec.STARTPROC
|
|
|
|
|
lda ARGS
|
|
|
|
|
beq Cmd.Exec.ERRSYN
|
2016-03-13 21:53:55 +00:00
|
|
|
|
sec
|
2017-07-11 15:53:52 +00:00
|
|
|
|
ror bStartProc
|
2016-03-13 21:53:55 +00:00
|
|
|
|
|
2016-08-17 06:25:58 +00:00
|
|
|
|
>LDYA L.ARGS
|
|
|
|
|
jmp Cmd.ExecYA.1
|
2016-03-13 21:53:55 +00:00
|
|
|
|
*--------------------------------------
|
2016-08-17 06:25:58 +00:00
|
|
|
|
Cmd.Exec.SET lda ARGS
|
|
|
|
|
bne Cmd.Exec.SETVAR
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
|
|
|
|
ldy #S.PS.hENV
|
|
|
|
|
lda (pPs),y
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>SYSCALL GetMemPtr.A
|
2015-10-19 20:35:00 +00:00
|
|
|
|
>STYA ZPPTR1
|
|
|
|
|
|
2016-10-17 15:47:50 +00:00
|
|
|
|
* No arg, print all ENV
|
|
|
|
|
|
2015-10-19 20:35:00 +00:00
|
|
|
|
.1 lda (ZPPTR1)
|
|
|
|
|
beq .8 Ending 0 ?
|
2016-10-17 15:47:50 +00:00
|
|
|
|
|
|
|
|
|
lda ZPPTR1 get next for value
|
2016-08-17 06:25:58 +00:00
|
|
|
|
sec
|
|
|
|
|
adc (ZPPTR1) Add len+1 to PTR
|
2016-10-17 15:47:50 +00:00
|
|
|
|
sta ZPPTR2
|
|
|
|
|
lda ZPPTR1+1
|
|
|
|
|
adc #0
|
|
|
|
|
sta ZPPTR2+1
|
|
|
|
|
|
|
|
|
|
lda (ZPPTR2) just in case...
|
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
>PUSHW ZPPTR2 Push value
|
|
|
|
|
>PUSHW ZPPTR1 Push name
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2016-10-17 15:47:50 +00:00
|
|
|
|
>LDYA L.MSG.PRINTENV
|
2017-08-25 15:02:16 +00:00
|
|
|
|
>SYSCALL PrintF.YA
|
2016-08-17 06:25:58 +00:00
|
|
|
|
bcs .9
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2016-10-17 15:47:50 +00:00
|
|
|
|
lda ZPPTR2
|
2015-10-19 20:35:00 +00:00
|
|
|
|
sec
|
2016-10-17 15:47:50 +00:00
|
|
|
|
adc (ZPPTR2) Add len+1 to PTR
|
2015-10-19 20:35:00 +00:00
|
|
|
|
sta ZPPTR1
|
2016-10-17 15:47:50 +00:00
|
|
|
|
lda ZPPTR2+1
|
|
|
|
|
adc #0
|
|
|
|
|
sta ZPPTR1+1
|
2015-10-19 20:35:00 +00:00
|
|
|
|
bra .1
|
2016-10-17 15:47:50 +00:00
|
|
|
|
|
2015-10-19 20:35:00 +00:00
|
|
|
|
.8 clc
|
2016-08-17 06:25:58 +00:00
|
|
|
|
.9 rts
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2016-08-17 06:25:58 +00:00
|
|
|
|
Cmd.Exec.SETVAR tax
|
|
|
|
|
lda ARGS,x
|
|
|
|
|
cmp #'=' ARGS ends with =, UnsetEnv
|
|
|
|
|
beq .2
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2016-08-17 06:25:58 +00:00
|
|
|
|
.1 dex
|
|
|
|
|
beq .3 no =, GetEnv
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
2016-08-17 06:25:58 +00:00
|
|
|
|
lda ARGS,x
|
|
|
|
|
cmp #'=' ARGS contains =, PutEnv
|
|
|
|
|
bne .1
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2016-08-17 06:25:58 +00:00
|
|
|
|
cpx #1 string is '=value' ?
|
2016-10-24 15:54:43 +00:00
|
|
|
|
beq .99 syntax error
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
|
|
|
|
>LDYA L.ARGS String is VAR=VALUE...
|
2017-08-31 06:23:29 +00:00
|
|
|
|
>SYSCALL PutEnv.YA
|
2016-08-17 06:25:58 +00:00
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.2 dec ARGS String is "VAR=", Remove endig '='
|
|
|
|
|
>LDYA L.ARGS String is "VAR"...
|
2017-08-31 06:23:29 +00:00
|
|
|
|
>SYSCALL UnsetEnv.YA
|
2016-08-17 06:25:58 +00:00
|
|
|
|
rts
|
2016-10-17 15:47:50 +00:00
|
|
|
|
|
2016-10-24 15:54:43 +00:00
|
|
|
|
* Print requested VAR
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2016-10-17 15:47:50 +00:00
|
|
|
|
.3 >LDYA L.ARGS
|
2017-08-31 06:23:29 +00:00
|
|
|
|
>SYSCALL GetEnv.YA
|
2016-08-17 06:25:58 +00:00
|
|
|
|
bcs .8
|
|
|
|
|
|
2016-10-17 15:47:50 +00:00
|
|
|
|
>PUSHYA push value
|
|
|
|
|
>PUSHW L.ARGS push name
|
|
|
|
|
>LDYA L.MSG.PRINTENV
|
2017-08-25 15:02:16 +00:00
|
|
|
|
>SYSCALL PrintF.YA
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2016-10-17 15:47:50 +00:00
|
|
|
|
.8 clc
|
2016-08-17 06:25:58 +00:00
|
|
|
|
.9 rts
|
2016-10-24 15:54:43 +00:00
|
|
|
|
|
2017-01-26 16:28:52 +00:00
|
|
|
|
.99 jmp Cmd.Exec.ERRSYN
|
2015-10-19 20:35:00 +00:00
|
|
|
|
*--------------------------------------
|
2016-10-17 15:47:50 +00:00
|
|
|
|
Cmd.Exec.DATE sec
|
|
|
|
|
.HS 90 bcc
|
|
|
|
|
|
|
|
|
|
Cmd.Exec.TIME clc
|
|
|
|
|
php
|
|
|
|
|
>LDYA L.TIME
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL TimeYA
|
2016-09-05 16:00:11 +00:00
|
|
|
|
|
2016-09-26 06:18:51 +00:00
|
|
|
|
>PUSHWI UsrBuf256
|
2016-10-17 15:47:50 +00:00
|
|
|
|
plp
|
|
|
|
|
bcc .1
|
2016-09-05 16:00:11 +00:00
|
|
|
|
>PUSHW L.FMT.DATE
|
2016-10-17 15:47:50 +00:00
|
|
|
|
bra .2
|
|
|
|
|
.1 >PUSHW L.FMT.TIME
|
2016-09-05 16:00:11 +00:00
|
|
|
|
|
2016-10-17 15:47:50 +00:00
|
|
|
|
.2 >PUSHW L.TIME
|
2017-08-22 06:37:03 +00:00
|
|
|
|
>SYSCALL StrFTime
|
2016-09-05 16:00:11 +00:00
|
|
|
|
|
2016-11-03 16:26:02 +00:00
|
|
|
|
>LDYAI UsrBuf256
|
2017-08-25 15:02:16 +00:00
|
|
|
|
>SYSCALL PrintF.YA
|
2017-07-11 15:53:52 +00:00
|
|
|
|
bcs Cmd.Exec.ECHO.RTS
|
|
|
|
|
bra Cmd.Exec.ECHO.CR
|
2015-10-19 20:35:00 +00:00
|
|
|
|
*--------------------------------------
|
2016-08-17 06:25:58 +00:00
|
|
|
|
Cmd.Exec.ECHO lda ARGS
|
2017-07-11 15:53:52 +00:00
|
|
|
|
beq Cmd.Exec.ECHO.CR
|
2016-11-03 16:26:02 +00:00
|
|
|
|
|
2017-08-22 06:37:03 +00:00
|
|
|
|
>PUSHW L.ARGS
|
|
|
|
|
>LDYA L.MSG.PSTRCR
|
2017-08-25 15:02:16 +00:00
|
|
|
|
>SYSCALL PrintF.YA
|
2017-08-22 06:37:03 +00:00
|
|
|
|
rts
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2017-07-11 15:53:52 +00:00
|
|
|
|
Cmd.Exec.ECHO.CR
|
|
|
|
|
lda #13
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>SYSCALL PutChar.A
|
2017-07-11 15:53:52 +00:00
|
|
|
|
bcs Cmd.Exec.ECHO.RTS
|
|
|
|
|
|
2017-03-01 10:31:19 +00:00
|
|
|
|
lda #10
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>SYSCALL PutChar.A
|
2016-11-27 21:59:46 +00:00
|
|
|
|
|
2017-07-11 15:53:52 +00:00
|
|
|
|
Cmd.Exec.ECHO.RTS
|
|
|
|
|
rts
|
2015-10-19 20:35:00 +00:00
|
|
|
|
*--------------------------------------
|
2017-01-26 16:28:52 +00:00
|
|
|
|
Cmd.Exec.READ lda ARGS
|
|
|
|
|
beq .9
|
|
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
|
ldy #bSecureRead
|
|
|
|
|
sta (pData),y
|
|
|
|
|
|
|
|
|
|
lda pData
|
2015-11-22 22:30:06 +00:00
|
|
|
|
clc
|
2017-01-26 16:28:52 +00:00
|
|
|
|
adc #VarBuffer
|
|
|
|
|
sta ZPPTR1
|
|
|
|
|
lda pData+1
|
|
|
|
|
adc #0
|
|
|
|
|
sta ZPPTR1+1
|
|
|
|
|
|
|
|
|
|
ldx #0
|
|
|
|
|
|
|
|
|
|
.1 cpx ARGS
|
|
|
|
|
beq .8
|
|
|
|
|
inx
|
|
|
|
|
lda ARGS,x
|
|
|
|
|
cmp #' '
|
|
|
|
|
beq .1
|
|
|
|
|
cmp #'-'
|
|
|
|
|
bne .7
|
|
|
|
|
|
|
|
|
|
cpx ARGS
|
|
|
|
|
beq .9
|
|
|
|
|
inx
|
|
|
|
|
lda ARGS,x
|
|
|
|
|
cmp #'S'
|
|
|
|
|
bne .2
|
|
|
|
|
|
|
|
|
|
ldy #bSecureRead
|
|
|
|
|
lda #$80
|
|
|
|
|
sta (pData),y
|
|
|
|
|
bra .1
|
|
|
|
|
|
|
|
|
|
.2 cmp #'P'
|
|
|
|
|
bne .9
|
|
|
|
|
|
|
|
|
|
cpx ARGS
|
|
|
|
|
beq .9
|
|
|
|
|
inx
|
|
|
|
|
lda ARGS,x
|
|
|
|
|
cmp #' '
|
|
|
|
|
bne .9
|
|
|
|
|
|
|
|
|
|
cpx ARGS
|
|
|
|
|
beq .9
|
|
|
|
|
|
|
|
|
|
inx
|
|
|
|
|
lda ARGS,x
|
|
|
|
|
cmp #'"'
|
|
|
|
|
bne .9
|
|
|
|
|
|
|
|
|
|
.3 cpx ARGS
|
|
|
|
|
beq .9
|
|
|
|
|
|
|
|
|
|
inx
|
|
|
|
|
lda ARGS,x
|
|
|
|
|
cmp #'"'
|
|
|
|
|
beq .1
|
|
|
|
|
phx
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>SYSCALL PutChar.A
|
2017-01-26 16:28:52 +00:00
|
|
|
|
plx
|
|
|
|
|
bcs .99
|
|
|
|
|
bra .3
|
|
|
|
|
|
|
|
|
|
.9 jmp Cmd.Exec.ERRSYN
|
|
|
|
|
|
|
|
|
|
.70 inx
|
|
|
|
|
lda ARGS,x
|
|
|
|
|
cmp #' '
|
|
|
|
|
beq .1
|
|
|
|
|
|
|
|
|
|
.7 lda (ZPPTR1)
|
|
|
|
|
cmp #VarLen.MAX
|
|
|
|
|
beq .9
|
|
|
|
|
inc
|
|
|
|
|
sta (ZPPTR1)
|
|
|
|
|
tay
|
|
|
|
|
lda ARGS,x
|
|
|
|
|
sta (ZPPTR1),y
|
|
|
|
|
cpx ARGS
|
|
|
|
|
bne .70
|
|
|
|
|
|
|
|
|
|
.8 lda (ZPPTR1) No var name ? SYNERR
|
|
|
|
|
beq .9
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
.99 rts
|
2015-11-22 22:30:06 +00:00
|
|
|
|
*--------------------------------------
|
2017-07-17 05:59:30 +00:00
|
|
|
|
Cmd.Exec.SLEEP lda ARGS
|
|
|
|
|
beq .9
|
|
|
|
|
|
|
|
|
|
lda #Sleep
|
|
|
|
|
clc
|
|
|
|
|
adc pData
|
|
|
|
|
tay
|
|
|
|
|
lda /Sleep
|
|
|
|
|
adc pData+1
|
|
|
|
|
>PUSHYA
|
|
|
|
|
>PUSHW L.ARGS
|
2017-08-31 06:23:29 +00:00
|
|
|
|
>SYSCALL AToI.YA
|
2017-07-17 05:59:30 +00:00
|
|
|
|
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
.9 jmp Cmd.Exec.ERRSYN
|
|
|
|
|
*--------------------------------------
|
2016-08-17 06:25:58 +00:00
|
|
|
|
Cmd.Exec.PAUSE ldy #bPause
|
2015-11-22 22:30:06 +00:00
|
|
|
|
lda #$80
|
|
|
|
|
sta (pData),y
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2016-08-17 06:25:58 +00:00
|
|
|
|
Cmd.Exec.EXIT ldy #bEXIT
|
2015-10-19 20:35:00 +00:00
|
|
|
|
lda #$FF
|
|
|
|
|
sta (pData),y
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
2017-03-29 15:48:15 +00:00
|
|
|
|
SAVE /A2OSX.SRC/SBIN/SHELL.S.CMD
|
|
|
|
|
LOAD /A2OSX.SRC/SBIN/SHELL.S
|
2015-10-19 20:35:00 +00:00
|
|
|
|
ASM
|