2018-01-18 06:49:41 +00:00
|
|
|
|
NEW
|
2017-03-29 15:48:15 +00:00
|
|
|
|
PREFIX /A2OSX.BUILD
|
2018-01-18 06:49:41 +00:00
|
|
|
|
AUTO 4,1
|
2015-10-19 20:35:00 +00:00
|
|
|
|
.LIST OFF
|
|
|
|
|
*--------------------------------------
|
2017-09-07 15:32:27 +00:00
|
|
|
|
CMD.Init >LDYAI CmdLine.MAX+1
|
2018-07-13 14:38:24 +00:00
|
|
|
|
>SYSCALL GetMem
|
2017-09-07 15:32:27 +00:00
|
|
|
|
bcs .9
|
2017-09-21 06:35:44 +00:00
|
|
|
|
>STYA ZPCMDBuf
|
2017-09-07 15:32:27 +00:00
|
|
|
|
txa
|
2017-09-08 14:49:23 +00:00
|
|
|
|
>STA.G hCmdBuf
|
2017-09-07 15:32:27 +00:00
|
|
|
|
.9 rts
|
2017-07-17 05:59:30 +00:00
|
|
|
|
*--------------------------------------
|
2017-09-22 06:38:22 +00:00
|
|
|
|
CMD.Quit >LDA.G hCmdBuf
|
|
|
|
|
beq .9
|
2018-07-13 14:38:24 +00:00
|
|
|
|
>SYSCALL FreeMem
|
2017-09-22 06:38:22 +00:00
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
2017-09-07 15:32:27 +00:00
|
|
|
|
* ZPCMDBuf : Remove extra SPACE & comment
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
Cmd.Parse >LDYA ZPCMDBuf
|
2017-07-17 05:59:30 +00:00
|
|
|
|
>STYA ZPPtr1
|
|
|
|
|
|
2017-09-15 15:16:04 +00:00
|
|
|
|
ldy #0
|
|
|
|
|
|
2017-09-07 15:32:27 +00:00
|
|
|
|
lda (ZPCMDBuf) empty line...quit
|
2017-07-17 05:59:30 +00:00
|
|
|
|
beq .9
|
2017-09-15 15:16:04 +00:00
|
|
|
|
|
2017-09-07 15:32:27 +00:00
|
|
|
|
.1 jsr Cmd.Parse.NextC
|
2017-07-17 05:59:30 +00:00
|
|
|
|
beq .8 no more char, exit
|
|
|
|
|
|
|
|
|
|
cmp #' ' skip leading spaces
|
|
|
|
|
beq .1
|
|
|
|
|
|
|
|
|
|
cmp #'#' Comment ?
|
|
|
|
|
beq .8 ignore remaining chars
|
|
|
|
|
|
2017-09-07 15:32:27 +00:00
|
|
|
|
.3 sta (ZPCMDBuf),y add char to buffer
|
2017-09-05 15:17:10 +00:00
|
|
|
|
iny
|
2017-07-17 05:59:30 +00:00
|
|
|
|
|
2017-09-07 15:32:27 +00:00
|
|
|
|
jsr Cmd.Parse.NextC
|
2017-07-17 05:59:30 +00:00
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
cmp #' '
|
|
|
|
|
bne .3
|
|
|
|
|
|
2017-09-07 15:32:27 +00:00
|
|
|
|
sta (ZPCMDBuf),y add One SPACE to buffer
|
2017-09-05 15:17:10 +00:00
|
|
|
|
iny
|
2017-07-17 05:59:30 +00:00
|
|
|
|
|
2017-09-07 15:32:27 +00:00
|
|
|
|
.5 jsr Cmd.Parse.NextC
|
2017-07-17 05:59:30 +00:00
|
|
|
|
beq .8
|
2017-09-05 15:17:10 +00:00
|
|
|
|
|
2017-07-17 05:59:30 +00:00
|
|
|
|
cmp #' '
|
|
|
|
|
beq .5 skip additional spaces
|
|
|
|
|
bne .3 no more space, add next word...
|
|
|
|
|
|
2017-09-05 15:17:10 +00:00
|
|
|
|
.8 lda #0
|
2017-09-07 15:32:27 +00:00
|
|
|
|
sta (ZPCMDBuf),y
|
2017-09-15 15:16:04 +00:00
|
|
|
|
|
|
|
|
|
.9 tya
|
|
|
|
|
>STA.G CmdBuflen
|
|
|
|
|
rts
|
2017-07-17 05:59:30 +00:00
|
|
|
|
|
2017-09-07 15:32:27 +00:00
|
|
|
|
Cmd.Parse.NextC lda (ZPPtr1)
|
2017-07-17 05:59:30 +00:00
|
|
|
|
beq .8
|
2017-09-05 15:17:10 +00:00
|
|
|
|
|
2017-07-17 05:59:30 +00:00
|
|
|
|
inc ZPPtr1
|
2017-09-05 15:17:10 +00:00
|
|
|
|
bne .8
|
|
|
|
|
inc ZPPtr1+1 never Z
|
2017-07-17 05:59:30 +00:00
|
|
|
|
.8 rts
|
|
|
|
|
*--------------------------------------
|
2017-09-07 15:32:27 +00:00
|
|
|
|
* ZPCMDBuf-> Command line (formatted & not empty)
|
2016-08-17 06:25:58 +00:00
|
|
|
|
*--------------------------------------
|
2017-09-14 15:21:06 +00:00
|
|
|
|
Cmd.Exec lda #0
|
|
|
|
|
>STA.G CMD.bStartProc
|
|
|
|
|
>STA.G CMD.hFullpath
|
2018-07-20 11:51:08 +00:00
|
|
|
|
|
|
|
|
|
* SET +X
|
2018-07-26 06:03:49 +00:00
|
|
|
|
* >LDYA ZPCMDBuf
|
|
|
|
|
* >SYSCALL puts
|
2018-07-16 05:52:52 +00:00
|
|
|
|
|
2018-07-26 06:03:49 +00:00
|
|
|
|
* sta $C055
|
|
|
|
|
* >DEBUG
|
2018-07-25 15:26:14 +00:00
|
|
|
|
|
2018-07-16 05:52:52 +00:00
|
|
|
|
>LDYA ZPCMDBuf
|
2018-07-13 14:38:24 +00:00
|
|
|
|
>SYSCALL ExpandStr
|
2017-09-12 15:24:36 +00:00
|
|
|
|
>STYA ZPPtr1 Ptr to CMD ARGS
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-09-07 15:32:27 +00:00
|
|
|
|
txa
|
2017-09-08 14:49:23 +00:00
|
|
|
|
>STA.G CMD.hCmdLine
|
2017-07-11 15:53:52 +00:00
|
|
|
|
>LDYA L.INTCMDS
|
2017-09-15 15:16:04 +00:00
|
|
|
|
>STYA ZPPtr2
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
|
|
|
|
ldx #0
|
|
|
|
|
|
2017-09-15 15:16:04 +00:00
|
|
|
|
.3 lda (ZPPtr2)
|
2017-09-07 15:32:27 +00:00
|
|
|
|
beq Cmd.Exec.EXT Array Ending 0, must be an external Cmd....
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-09-13 15:34:26 +00:00
|
|
|
|
ldy #$ff
|
2017-09-07 15:32:27 +00:00
|
|
|
|
|
2017-09-13 15:34:26 +00:00
|
|
|
|
.4 iny
|
2017-09-15 15:16:04 +00:00
|
|
|
|
lda (ZPPtr2),y
|
2017-09-13 15:34:26 +00:00
|
|
|
|
bne .41 End of string in array
|
|
|
|
|
|
|
|
|
|
lda (ZPPtr1),y Get CMD char...
|
|
|
|
|
beq .8 both end with 0, found!
|
2017-09-15 15:16:04 +00:00
|
|
|
|
cmp #' '
|
|
|
|
|
beq .8 we reached space between CMD & ARGS....
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-09-13 15:34:26 +00:00
|
|
|
|
.41 lda (ZPPtr1),y Get CMD char...
|
|
|
|
|
beq .61 end of CMD.....too short...
|
2017-09-15 15:16:04 +00:00
|
|
|
|
cmp #' '
|
|
|
|
|
beq .61 we reached space between CMD & ARGS....
|
2017-09-07 15:32:27 +00:00
|
|
|
|
|
2017-06-26 15:28:18 +00:00
|
|
|
|
cmp #'a' To Uppercase
|
2017-09-13 15:34:26 +00:00
|
|
|
|
bcc .5
|
2017-06-26 15:28:18 +00:00
|
|
|
|
cmp #'z'+1
|
2017-09-13 15:34:26 +00:00
|
|
|
|
bcs .5
|
2017-06-26 15:28:18 +00:00
|
|
|
|
eor #$20
|
2017-09-07 15:32:27 +00:00
|
|
|
|
|
2017-09-15 15:16:04 +00:00
|
|
|
|
.5 cmp (ZPPtr2),y
|
2017-09-13 15:34:26 +00:00
|
|
|
|
beq .4
|
2017-09-08 14:49:23 +00:00
|
|
|
|
|
2017-09-13 15:34:26 +00:00
|
|
|
|
.61 iny
|
2017-09-15 15:16:04 +00:00
|
|
|
|
lda (ZPPtr2),y
|
2017-09-13 15:34:26 +00:00
|
|
|
|
bne .61
|
2017-09-08 14:49:23 +00:00
|
|
|
|
|
2017-09-13 15:34:26 +00:00
|
|
|
|
.7 inx
|
|
|
|
|
inx
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2017-09-13 15:34:26 +00:00
|
|
|
|
tya
|
|
|
|
|
sec
|
2017-09-15 15:16:04 +00:00
|
|
|
|
adc ZPPtr2
|
|
|
|
|
sta ZPPtr2
|
2017-09-13 15:34:26 +00:00
|
|
|
|
bcc .3
|
2017-09-15 15:16:04 +00:00
|
|
|
|
inc ZPPtr2+1
|
2017-09-13 15:34:26 +00:00
|
|
|
|
bra .3
|
|
|
|
|
|
2017-09-15 15:16:04 +00:00
|
|
|
|
.8 jsr Cmd.Exec.Split X unmodified
|
|
|
|
|
jmp (J.INTCMDS,x) Found an internal Cmd...
|
2017-09-14 15:21:06 +00:00
|
|
|
|
*--------------------------------------
|
2017-09-07 15:32:27 +00:00
|
|
|
|
Cmd.Exec.Done php
|
|
|
|
|
pha
|
2017-09-08 14:49:23 +00:00
|
|
|
|
>LDA.G CMD.hCmdLine
|
2018-07-13 14:38:24 +00:00
|
|
|
|
>SYSCALL FreeMem
|
2017-09-14 15:21:06 +00:00
|
|
|
|
|
2017-09-15 15:16:04 +00:00
|
|
|
|
>LDA.G CMD.hFullpath
|
2017-09-14 15:21:06 +00:00
|
|
|
|
beq .1
|
2018-07-13 14:38:24 +00:00
|
|
|
|
>SYSCALL FreeMem
|
2017-09-14 15:21:06 +00:00
|
|
|
|
|
2017-09-15 15:16:04 +00:00
|
|
|
|
.1 pla
|
2017-08-23 11:33:51 +00:00
|
|
|
|
plp
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-09-15 15:16:04 +00:00
|
|
|
|
Cmd.Exec.EXT jsr Cmd.Exec.Split
|
|
|
|
|
|
2017-09-07 15:32:27 +00:00
|
|
|
|
lda (ZPPtr1)
|
2016-08-17 06:25:58 +00:00
|
|
|
|
cmp #'/' Command line is already full path, no search
|
2017-09-12 15:24:36 +00:00
|
|
|
|
bne .1
|
2017-08-23 15:05:29 +00:00
|
|
|
|
|
2017-09-25 15:50:33 +00:00
|
|
|
|
>PUSHEA.G CMD.Stat
|
2018-07-20 11:51:08 +00:00
|
|
|
|
>LDYA ZPPtr1
|
2017-09-12 15:24:36 +00:00
|
|
|
|
>SYSCALL STAT
|
2017-09-13 15:34:26 +00:00
|
|
|
|
bcs Cmd.Exec.Done
|
|
|
|
|
|
|
|
|
|
>LDYA ZPPtr1
|
|
|
|
|
bra .4
|
2017-09-12 15:24:36 +00:00
|
|
|
|
|
|
|
|
|
.1 >LDYA L.ENV.PATH push ENVNAME=PATH for search
|
2018-07-13 14:38:24 +00:00
|
|
|
|
>SYSCALL GetEnv get value for ENV=PATH
|
2017-09-12 15:24:36 +00:00
|
|
|
|
bcs .2 No PATH, try in CD
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2017-09-13 15:34:26 +00:00
|
|
|
|
jsr Cmd.Exec.EXT.Search
|
2017-09-12 15:24:36 +00:00
|
|
|
|
bcc .3
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2017-09-12 15:24:36 +00:00
|
|
|
|
.2 ldy #S.PS.hPREFIX not found, try in CD
|
2015-10-19 20:35:00 +00:00
|
|
|
|
lda (pPs),y
|
2018-07-13 14:38:24 +00:00
|
|
|
|
>SYSCALL GetMemPtr
|
2017-09-13 15:34:26 +00:00
|
|
|
|
jsr Cmd.Exec.EXT.Search
|
2016-08-17 06:25:58 +00:00
|
|
|
|
bcs .99
|
2017-09-12 15:24:36 +00:00
|
|
|
|
|
2017-09-13 15:34:26 +00:00
|
|
|
|
.3 >LDYA ZPCMDBuf
|
2017-12-14 16:25:03 +00:00
|
|
|
|
|
2018-07-13 14:38:24 +00:00
|
|
|
|
.4 >SYSCALL NewStr
|
2017-09-13 15:34:26 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
txa
|
|
|
|
|
>STA.G CMD.hFullpath
|
|
|
|
|
|
2017-12-14 16:25:03 +00:00
|
|
|
|
lda #0
|
|
|
|
|
sta (ZPCMDBuf) reset ZPCMDBuf for final CMD
|
|
|
|
|
|
2017-09-15 15:16:04 +00:00
|
|
|
|
ldy #CMD.Stat+S.STAT.P.TYPE
|
|
|
|
|
lda (pData),y
|
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
|
|
|
|
|
2017-10-26 16:01:54 +00:00
|
|
|
|
.9 lda #K.E.SYN
|
2016-08-17 06:25:58 +00:00
|
|
|
|
sec
|
2017-09-07 15:32:27 +00:00
|
|
|
|
.99 jmp Cmd.Exec.Done
|
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-12-14 16:25:03 +00:00
|
|
|
|
|
2018-07-13 14:38:24 +00:00
|
|
|
|
>SYSCALL GetArg
|
2017-09-13 15:34:26 +00:00
|
|
|
|
>PUSHYA
|
2018-07-16 05:52:52 +00:00
|
|
|
|
>LDYA ZPCMDBuf
|
2017-12-14 16:25:03 +00:00
|
|
|
|
>SYSCALL StrCat
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-09-13 15:34:26 +00:00
|
|
|
|
jsr Cmd.Exec.EXT.SEP Add a space....
|
2017-12-14 16:25:03 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* BIN : Launch "/PATH/CMD ARGS"
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
Cmd.Exec.EXT.BIN
|
2017-09-13 15:34:26 +00:00
|
|
|
|
>LDA.G CMD.hFullpath
|
2018-07-13 14:38:24 +00:00
|
|
|
|
>SYSCALL GetMemPtr
|
2017-09-13 15:34:26 +00:00
|
|
|
|
>PUSHYA
|
2018-07-16 05:52:52 +00:00
|
|
|
|
>LDYA ZPCMDBuf
|
2017-09-13 15:34:26 +00:00
|
|
|
|
>SYSCALL StrCat
|
2017-12-14 16:25:03 +00:00
|
|
|
|
|
2017-09-21 15:29:45 +00:00
|
|
|
|
lda (ZPPTR2) Some ARGS ?
|
|
|
|
|
beq .1
|
|
|
|
|
|
2017-09-13 15:34:26 +00:00
|
|
|
|
jsr Cmd.Exec.EXT.SEP Add a space....
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-09-08 14:49:23 +00:00
|
|
|
|
>PUSHW ZPPTR2
|
2018-07-16 05:52:52 +00:00
|
|
|
|
>LDYA ZPCMDBuf
|
2017-08-31 06:23:29 +00:00
|
|
|
|
>SYSCALL StrCat
|
2017-09-28 15:39:12 +00:00
|
|
|
|
|
2017-09-14 15:21:06 +00:00
|
|
|
|
.1 >LDA.G CMD.bStartProc
|
|
|
|
|
asl
|
|
|
|
|
>LDYA ZPCMDBuf
|
|
|
|
|
bcs .2 startproc
|
2016-03-13 21:53:55 +00:00
|
|
|
|
|
2018-07-13 14:38:24 +00:00
|
|
|
|
>SYSCALL ExecPSNewEnv
|
2017-09-07 15:32:27 +00:00
|
|
|
|
jmp Cmd.Exec.Done
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
2018-07-13 14:38:24 +00:00
|
|
|
|
.2 >SYSCALL CreatePSNewEnv
|
2017-09-07 15:32:27 +00:00
|
|
|
|
jmp Cmd.Exec.Done
|
2016-08-17 06:25:58 +00:00
|
|
|
|
*--------------------------------------
|
2017-09-13 15:34:26 +00:00
|
|
|
|
Cmd.Exec.EXT.Search
|
2018-07-16 05:52:52 +00:00
|
|
|
|
pha
|
|
|
|
|
phy
|
2017-09-25 15:50:33 +00:00
|
|
|
|
>PUSHEA.G CMD.Stat
|
2018-07-16 05:52:52 +00:00
|
|
|
|
>PUSHW ZPCMDBuf push dest full path
|
|
|
|
|
ply
|
|
|
|
|
pla
|
|
|
|
|
>PUSHYA push search list
|
|
|
|
|
>LDYA ZPPtr1 push CMD
|
2017-09-13 15:34:26 +00:00
|
|
|
|
>SYSCALL FileSearch
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
Cmd.Exec.EXT.SEP
|
|
|
|
|
ldy #$ff
|
|
|
|
|
.1 iny
|
|
|
|
|
lda (ZPCMDBuf),y
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
lda #' '
|
|
|
|
|
sta (ZPCMDBuf),y
|
|
|
|
|
iny
|
|
|
|
|
lda #0
|
|
|
|
|
sta (ZPCMDBuf),y
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2016-08-17 06:25:58 +00:00
|
|
|
|
* Internal Commands
|
2015-10-19 20:35:00 +00:00
|
|
|
|
*--------------------------------------
|
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
|
2018-07-13 14:38:24 +00:00
|
|
|
|
>SYSCALL GetMemPtr
|
2018-06-21 15:12:10 +00:00
|
|
|
|
>SYSCALL printf
|
2017-09-22 19:59:14 +00:00
|
|
|
|
jmp Cmd.Exec.ECHO.CR
|
2017-09-28 15:39:12 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
Cmd.Exec.CD lda (ZPPTR2)
|
|
|
|
|
bne .1
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2017-09-28 15:39:12 +00:00
|
|
|
|
>LDYA L.ENV.HOME
|
2018-07-13 14:38:24 +00:00
|
|
|
|
>SYSCALL GetEnv
|
2017-09-28 15:39:12 +00:00
|
|
|
|
bcs Cmd.Exec.PWD
|
2017-09-18 15:43:00 +00:00
|
|
|
|
|
2018-07-13 14:38:24 +00:00
|
|
|
|
>SYSCALL ExpandStr
|
2017-09-28 15:39:12 +00:00
|
|
|
|
bcs .9
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-09-28 15:39:12 +00:00
|
|
|
|
bra .4
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2017-09-28 15:39:12 +00:00
|
|
|
|
.1 ldy #0
|
2017-09-18 15:43:00 +00:00
|
|
|
|
|
2017-09-28 15:39:12 +00:00
|
|
|
|
.2 lda (ZPPTR2),y
|
|
|
|
|
tax
|
2017-09-25 06:31:19 +00:00
|
|
|
|
iny
|
2017-09-28 15:39:12 +00:00
|
|
|
|
lda (ZPPTR2),y
|
|
|
|
|
bne .2
|
|
|
|
|
cpx #'/'
|
|
|
|
|
beq .3
|
2017-09-15 15:16:04 +00:00
|
|
|
|
|
2017-09-28 15:39:12 +00:00
|
|
|
|
lda #'/'
|
|
|
|
|
sta (ZPPTR2),y
|
2017-09-15 15:16:04 +00:00
|
|
|
|
iny
|
2017-09-28 15:39:12 +00:00
|
|
|
|
lda #0
|
|
|
|
|
sta (ZPPTR2),y
|
2018-05-04 14:55:29 +00:00
|
|
|
|
|
2017-09-28 15:39:12 +00:00
|
|
|
|
.3 >LDYA ZPPTR2 Get ARG
|
2018-07-13 14:38:24 +00:00
|
|
|
|
>SYSCALL RealPath
|
2017-09-28 15:39:12 +00:00
|
|
|
|
bcs .9
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-09-28 15:39:12 +00:00
|
|
|
|
.4 >STYA ZPPTR2
|
|
|
|
|
txa
|
|
|
|
|
>STA.G CMD.hFullpath
|
2016-09-26 16:02:14 +00:00
|
|
|
|
|
2017-09-28 15:39:12 +00:00
|
|
|
|
ldy #1
|
|
|
|
|
lda (ZPPTR2),y
|
|
|
|
|
beq .8 we have '/'
|
2017-09-22 19:59:14 +00:00
|
|
|
|
|
2017-09-25 15:50:33 +00:00
|
|
|
|
>PUSHEA.G CMD.Stat
|
2018-07-20 11:51:08 +00:00
|
|
|
|
>LDYA ZPPTR2
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL STAT
|
2016-08-17 06:25:58 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
2017-09-15 15:16:04 +00:00
|
|
|
|
ldy #CMD.Stat+S.STAT.P.TYPE
|
|
|
|
|
lda (pData),y
|
2016-10-24 15:54:43 +00:00
|
|
|
|
cmp #$0F Directory ?
|
|
|
|
|
bne Cmd.Exec.ERRSYN
|
2016-09-26 16:02:14 +00:00
|
|
|
|
|
2017-09-28 15:39:12 +00:00
|
|
|
|
.8 >LDYA ZPPTR2
|
2018-07-13 14:38:24 +00:00
|
|
|
|
>SYSCALL NewStr
|
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
|
2018-07-13 14:38:24 +00:00
|
|
|
|
>SYSCALL FreeMem
|
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
|
2017-09-14 15:21:06 +00:00
|
|
|
|
.9 jmp Cmd.Exec.Done
|
2016-08-17 06:25:58 +00:00
|
|
|
|
*--------------------------------------
|
2017-10-26 16:01:54 +00:00
|
|
|
|
Cmd.Exec.ERRSYN lda #K.E.SYN
|
2016-10-24 15:54:43 +00:00
|
|
|
|
sec
|
2017-09-14 15:21:06 +00:00
|
|
|
|
jmp Cmd.Exec.Done
|
2016-10-24 15:54:43 +00:00
|
|
|
|
*--------------------------------------
|
2016-08-17 06:25:58 +00:00
|
|
|
|
Cmd.Exec.STARTPROC
|
2017-09-08 14:49:23 +00:00
|
|
|
|
lda (ZPPTR2)
|
2016-08-17 06:25:58 +00:00
|
|
|
|
beq Cmd.Exec.ERRSYN
|
2017-09-14 15:21:06 +00:00
|
|
|
|
lda #$ff
|
|
|
|
|
>STA.G CMD.bStartProc
|
2016-03-13 21:53:55 +00:00
|
|
|
|
|
2017-09-08 14:49:23 +00:00
|
|
|
|
>LDYA ZPPTR2
|
2017-09-11 06:11:57 +00:00
|
|
|
|
>STYA ZPPTR1
|
2017-09-14 15:21:06 +00:00
|
|
|
|
|
|
|
|
|
jmp Cmd.Exec.EXT
|
2016-03-13 21:53:55 +00:00
|
|
|
|
*--------------------------------------
|
2017-09-08 14:49:23 +00:00
|
|
|
|
Cmd.Exec.SET lda (ZPPTR2)
|
2016-08-17 06:25:58 +00:00
|
|
|
|
bne Cmd.Exec.SETVAR
|
2017-09-13 06:17:46 +00:00
|
|
|
|
|
2017-09-11 06:11:57 +00:00
|
|
|
|
* No arg, print all ENV
|
2017-09-13 06:17:46 +00:00
|
|
|
|
|
2015-10-19 20:35:00 +00:00
|
|
|
|
ldy #S.PS.hENV
|
|
|
|
|
lda (pPs),y
|
2018-07-13 14:38:24 +00:00
|
|
|
|
>SYSCALL GetMemPtr
|
2015-10-19 20:35:00 +00:00
|
|
|
|
>STYA ZPPTR1
|
2017-09-11 06:11:57 +00:00
|
|
|
|
|
2015-10-19 20:35:00 +00:00
|
|
|
|
.1 lda (ZPPTR1)
|
|
|
|
|
beq .8 Ending 0 ?
|
2016-10-17 15:47:50 +00:00
|
|
|
|
|
2017-09-11 06:11:57 +00:00
|
|
|
|
ldy #$ff
|
2017-09-13 06:17:46 +00:00
|
|
|
|
|
2017-09-11 06:11:57 +00:00
|
|
|
|
.2 iny
|
|
|
|
|
lda (ZPPTR1),y
|
|
|
|
|
bne .2
|
2017-09-13 06:17:46 +00:00
|
|
|
|
|
2017-09-11 06:11:57 +00:00
|
|
|
|
tya
|
2016-08-17 06:25:58 +00:00
|
|
|
|
sec
|
2017-09-11 06:11:57 +00:00
|
|
|
|
adc ZPPTR1
|
2016-10-17 15:47:50 +00:00
|
|
|
|
sta ZPPTR2
|
2017-09-11 06:11:57 +00:00
|
|
|
|
lda #0
|
|
|
|
|
adc ZPPTR1+1
|
2016-10-17 15:47:50 +00:00
|
|
|
|
sta ZPPTR2+1
|
|
|
|
|
|
|
|
|
|
>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
|
2018-06-21 15:12:10 +00:00
|
|
|
|
>SYSCALL printf
|
2016-08-17 06:25:58 +00:00
|
|
|
|
bcs .9
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2017-09-11 06:11:57 +00:00
|
|
|
|
ldy #$ff
|
|
|
|
|
|
|
|
|
|
.3 iny
|
|
|
|
|
lda (ZPPTR2),y
|
|
|
|
|
bne .3
|
|
|
|
|
|
|
|
|
|
tya
|
2015-10-19 20:35:00 +00:00
|
|
|
|
sec
|
2017-09-11 06:11:57 +00:00
|
|
|
|
adc ZPPTR2
|
2015-10-19 20:35:00 +00:00
|
|
|
|
sta ZPPTR1
|
2017-09-11 06:11:57 +00:00
|
|
|
|
lda #0
|
|
|
|
|
adc ZPPTR2+1
|
2016-10-17 15:47:50 +00:00
|
|
|
|
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
|
2017-09-14 15:21:06 +00:00
|
|
|
|
.9 jmp Cmd.Exec.Done
|
|
|
|
|
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2017-09-08 14:49:23 +00:00
|
|
|
|
Cmd.Exec.SETVAR ldy #0
|
|
|
|
|
|
|
|
|
|
lda (ZPPTR2),y
|
|
|
|
|
iny
|
|
|
|
|
cmp #'=' string is '=value' ?
|
|
|
|
|
beq .99 syntax error
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2017-09-08 14:49:23 +00:00
|
|
|
|
.1 lda (ZPPTR2),y
|
|
|
|
|
iny
|
2016-08-17 06:25:58 +00:00
|
|
|
|
beq .3 no =, GetEnv
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
2016-08-17 06:25:58 +00:00
|
|
|
|
cmp #'=' ARGS contains =, PutEnv
|
|
|
|
|
bne .1
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2017-09-08 14:49:23 +00:00
|
|
|
|
lda (ZPPTR2),y
|
|
|
|
|
beq .2 "VAR=" go UnsetEnv
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-09-08 14:49:23 +00:00
|
|
|
|
>LDYA ZPPTR2 String is VAR=VALUE...
|
2018-07-13 14:38:24 +00:00
|
|
|
|
>SYSCALL PutEnv
|
2017-09-14 15:21:06 +00:00
|
|
|
|
jmp Cmd.Exec.Done
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-09-08 14:49:23 +00:00
|
|
|
|
.2 dey String is "VAR=", Remove endig '='
|
|
|
|
|
sta (ZPPTR2),y
|
|
|
|
|
>LDYA ZPPTR2 String is "VAR"...
|
2018-07-13 14:38:24 +00:00
|
|
|
|
>SYSCALL UnsetEnv
|
2017-09-14 15:21:06 +00:00
|
|
|
|
jmp Cmd.Exec.Done
|
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
|
|
|
|
|
2017-09-08 14:49:23 +00:00
|
|
|
|
.3 >LDYA ZPPTR2
|
2018-07-13 14:38:24 +00:00
|
|
|
|
>SYSCALL GetEnv
|
2016-08-17 06:25:58 +00:00
|
|
|
|
bcs .8
|
|
|
|
|
|
2016-10-17 15:47:50 +00:00
|
|
|
|
>PUSHYA push value
|
2017-09-08 14:49:23 +00:00
|
|
|
|
>PUSHW ZPPTR2 push name
|
2016-10-17 15:47:50 +00:00
|
|
|
|
>LDYA L.MSG.PRINTENV
|
2018-06-21 15:12:10 +00:00
|
|
|
|
>SYSCALL printf
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2016-10-17 15:47:50 +00:00
|
|
|
|
.8 clc
|
2017-09-14 15:21:06 +00:00
|
|
|
|
.9 jmp Cmd.Exec.Done
|
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
|
2017-09-15 15:16:04 +00:00
|
|
|
|
>LEA.G CMD.Time
|
2018-07-13 14:38:24 +00:00
|
|
|
|
>SYSCALL Time
|
2016-09-05 16:00:11 +00:00
|
|
|
|
|
2017-11-06 16:25:40 +00:00
|
|
|
|
>PUSHW ZPCMDBuf
|
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
|
|
|
|
|
2017-09-25 15:50:33 +00:00
|
|
|
|
.2 >PUSHEA.G CMD.Time
|
2017-08-22 06:37:03 +00:00
|
|
|
|
>SYSCALL StrFTime
|
2016-09-05 16:00:11 +00:00
|
|
|
|
|
2017-11-06 16:25:40 +00:00
|
|
|
|
>LDYA ZPCMDBuf
|
2018-06-21 15:12:10 +00:00
|
|
|
|
>SYSCALL printf
|
2017-09-14 15:21:06 +00:00
|
|
|
|
bcs Cmd.Exec.ECHO.END
|
2017-07-11 15:53:52 +00:00
|
|
|
|
bra Cmd.Exec.ECHO.CR
|
2015-10-19 20:35:00 +00:00
|
|
|
|
*--------------------------------------
|
2017-09-08 14:49:23 +00:00
|
|
|
|
Cmd.Exec.ECHO lda (ZPPtr2)
|
2017-07-11 15:53:52 +00:00
|
|
|
|
beq Cmd.Exec.ECHO.CR
|
2016-11-03 16:26:02 +00:00
|
|
|
|
|
2017-09-11 15:29:08 +00:00
|
|
|
|
>LDYA ZPPtr2
|
2018-06-21 15:12:10 +00:00
|
|
|
|
>SYSCALL printf
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2017-07-11 15:53:52 +00:00
|
|
|
|
Cmd.Exec.ECHO.CR
|
|
|
|
|
lda #13
|
2018-07-13 14:38:24 +00:00
|
|
|
|
>SYSCALL PutChar
|
2017-09-14 15:21:06 +00:00
|
|
|
|
bcs Cmd.Exec.ECHO.END
|
2017-07-11 15:53:52 +00:00
|
|
|
|
|
2017-03-01 10:31:19 +00:00
|
|
|
|
lda #10
|
2018-07-13 14:38:24 +00:00
|
|
|
|
>SYSCALL PutChar
|
2017-09-14 15:21:06 +00:00
|
|
|
|
Cmd.Exec.ECHO.END
|
|
|
|
|
jmp Cmd.Exec.Done
|
2015-10-19 20:35:00 +00:00
|
|
|
|
*--------------------------------------
|
2017-09-08 14:49:23 +00:00
|
|
|
|
Cmd.Exec.READ lda (ZPPtr2)
|
2017-01-26 16:28:52 +00:00
|
|
|
|
beq .9
|
|
|
|
|
|
|
|
|
|
lda #0
|
2017-09-08 14:49:23 +00:00
|
|
|
|
>STA.G bSecureRead
|
2017-01-26 16:28:52 +00:00
|
|
|
|
|
|
|
|
|
lda pData
|
2015-11-22 22:30:06 +00:00
|
|
|
|
clc
|
2017-09-07 15:32:27 +00:00
|
|
|
|
adc #CMD.VarName
|
2017-01-26 16:28:52 +00:00
|
|
|
|
sta ZPPTR1
|
|
|
|
|
lda pData+1
|
|
|
|
|
adc #0
|
|
|
|
|
sta ZPPTR1+1
|
|
|
|
|
|
2017-09-08 14:49:23 +00:00
|
|
|
|
ldy #0
|
2017-01-26 16:28:52 +00:00
|
|
|
|
|
2017-09-08 14:49:23 +00:00
|
|
|
|
.1 lda (ZPPtr2),y
|
2017-01-26 16:28:52 +00:00
|
|
|
|
beq .8
|
2017-09-08 14:49:23 +00:00
|
|
|
|
iny
|
2017-01-26 16:28:52 +00:00
|
|
|
|
cmp #' '
|
|
|
|
|
beq .1
|
|
|
|
|
cmp #'-'
|
|
|
|
|
bne .7
|
|
|
|
|
|
2017-09-08 14:49:23 +00:00
|
|
|
|
lda (ZPPtr2),y
|
2017-01-26 16:28:52 +00:00
|
|
|
|
beq .9
|
2017-09-08 14:49:23 +00:00
|
|
|
|
iny
|
2017-01-26 16:28:52 +00:00
|
|
|
|
cmp #'S'
|
|
|
|
|
bne .2
|
|
|
|
|
|
|
|
|
|
lda #$80
|
2017-09-08 14:49:23 +00:00
|
|
|
|
>STA.G bSecureRead
|
2017-01-26 16:28:52 +00:00
|
|
|
|
bra .1
|
|
|
|
|
|
|
|
|
|
.2 cmp #'P'
|
|
|
|
|
bne .9
|
|
|
|
|
|
2017-09-08 14:49:23 +00:00
|
|
|
|
lda (ZPPtr2),y
|
2017-01-26 16:28:52 +00:00
|
|
|
|
beq .9
|
2017-09-08 14:49:23 +00:00
|
|
|
|
iny
|
2017-01-26 16:28:52 +00:00
|
|
|
|
cmp #' '
|
|
|
|
|
bne .9
|
|
|
|
|
|
2017-09-08 14:49:23 +00:00
|
|
|
|
lda (ZPPtr2),y
|
2017-01-26 16:28:52 +00:00
|
|
|
|
beq .9
|
2017-09-08 14:49:23 +00:00
|
|
|
|
iny
|
2017-01-26 16:28:52 +00:00
|
|
|
|
cmp #'"'
|
|
|
|
|
bne .9
|
|
|
|
|
|
2017-09-08 14:49:23 +00:00
|
|
|
|
.3 lda (ZPPtr2),y
|
2017-01-26 16:28:52 +00:00
|
|
|
|
beq .9
|
2017-09-08 14:49:23 +00:00
|
|
|
|
iny
|
2017-01-26 16:28:52 +00:00
|
|
|
|
cmp #'"'
|
|
|
|
|
beq .1
|
2017-09-08 14:49:23 +00:00
|
|
|
|
|
|
|
|
|
phy
|
2018-07-13 14:38:24 +00:00
|
|
|
|
>SYSCALL PutChar
|
2017-09-08 14:49:23 +00:00
|
|
|
|
ply
|
2017-01-26 16:28:52 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
bra .3
|
|
|
|
|
|
|
|
|
|
.9 jmp Cmd.Exec.ERRSYN
|
|
|
|
|
|
2017-09-08 14:49:23 +00:00
|
|
|
|
.70 lda (ZPPtr2),y
|
2017-01-26 16:28:52 +00:00
|
|
|
|
cmp #' '
|
|
|
|
|
beq .1
|
|
|
|
|
|
|
|
|
|
.7 lda (ZPPTR1)
|
|
|
|
|
cmp #VarLen.MAX
|
|
|
|
|
beq .9
|
|
|
|
|
inc
|
|
|
|
|
sta (ZPPTR1)
|
|
|
|
|
tay
|
2017-09-08 14:49:23 +00:00
|
|
|
|
lda (ZPPtr2),y
|
2017-01-26 16:28:52 +00:00
|
|
|
|
sta (ZPPTR1),y
|
2017-09-08 14:49:23 +00:00
|
|
|
|
|
2017-01-26 16:28:52 +00:00
|
|
|
|
bne .70
|
|
|
|
|
|
|
|
|
|
.8 lda (ZPPTR1) No var name ? SYNERR
|
|
|
|
|
beq .9
|
|
|
|
|
|
|
|
|
|
clc
|
2017-09-14 15:21:06 +00:00
|
|
|
|
.99 jmp Cmd.Exec.Done
|
2015-11-22 22:30:06 +00:00
|
|
|
|
*--------------------------------------
|
2017-09-08 14:49:23 +00:00
|
|
|
|
Cmd.Exec.SLEEP lda (ZPPtr2)
|
2017-07-17 05:59:30 +00:00
|
|
|
|
beq .9
|
|
|
|
|
|
2017-09-08 14:49:23 +00:00
|
|
|
|
>PUSHW ZPPtr2
|
2017-10-12 15:28:59 +00:00
|
|
|
|
>PUSHEA.G Sleep
|
2017-10-09 15:30:48 +00:00
|
|
|
|
>SYSCALL AToL
|
2017-07-17 05:59:30 +00:00
|
|
|
|
|
|
|
|
|
bcs .9
|
|
|
|
|
|
2017-09-14 15:21:06 +00:00
|
|
|
|
jmp Cmd.Exec.Done
|
2017-07-17 05:59:30 +00:00
|
|
|
|
.9 jmp Cmd.Exec.ERRSYN
|
|
|
|
|
*--------------------------------------
|
2017-09-07 15:32:27 +00:00
|
|
|
|
Cmd.Exec.PAUSE lda #$FF
|
2017-09-08 14:49:23 +00:00
|
|
|
|
>STA.G bPause
|
2015-11-22 22:30:06 +00:00
|
|
|
|
clc
|
2017-09-14 15:21:06 +00:00
|
|
|
|
jmp Cmd.Exec.Done
|
2015-11-22 22:30:06 +00:00
|
|
|
|
*--------------------------------------
|
2017-09-07 15:32:27 +00:00
|
|
|
|
Cmd.Exec.EXIT lda #$FF
|
2017-09-08 14:49:23 +00:00
|
|
|
|
>STA.G bExit
|
2015-10-19 20:35:00 +00:00
|
|
|
|
clc
|
2017-09-14 15:21:06 +00:00
|
|
|
|
jmp Cmd.Exec.Done
|
2015-10-19 20:35:00 +00:00
|
|
|
|
*--------------------------------------
|
2017-09-15 15:16:04 +00:00
|
|
|
|
Cmd.Exec.Split ldy #$ff CMD Len
|
|
|
|
|
|
|
|
|
|
.1 iny
|
|
|
|
|
lda (ZPPtr1),y Get CMD char...
|
|
|
|
|
beq .2
|
|
|
|
|
|
|
|
|
|
cmp #' ' we reached blank between CMD ARGS
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
|
sta (ZPPtr1),y Cut CMD with the ending 0
|
|
|
|
|
iny
|
|
|
|
|
|
|
|
|
|
.2 tya Y=CMD len+0, if ARGS="" Y=
|
|
|
|
|
clc
|
|
|
|
|
adc ZPPtr1
|
|
|
|
|
sta ZPPtr2
|
|
|
|
|
lda ZPPtr1+1
|
|
|
|
|
adc #0
|
|
|
|
|
sta ZPPtr2+1 ZPPtr2->ARGS or CMD ending 0 if empty
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2015-10-19 20:35:00 +00:00
|
|
|
|
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
|