2015-10-19 20:35:00 +00:00
|
|
|
|
PR#3
|
|
|
|
|
PREFIX /A2OSX.SRC
|
|
|
|
|
NEW
|
|
|
|
|
INC 1
|
|
|
|
|
AUTO 6
|
|
|
|
|
.LIST OFF
|
|
|
|
|
*--------------------------------------
|
2016-08-17 06:25:58 +00:00
|
|
|
|
* Y,A -> Command line (formatted & not empty)
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
Cmd.ExecYA stz Cmd.Exec.Mode
|
2016-10-24 15:54:43 +00:00
|
|
|
|
Cmd.ExecYA.1 >SYSCALL ExpandPStrYA
|
2015-10-19 20:35:00 +00:00
|
|
|
|
>STYA ZPPtr1
|
|
|
|
|
|
2016-10-29 19:58:21 +00:00
|
|
|
|
phx
|
|
|
|
|
|
2016-08-17 06:25:58 +00:00
|
|
|
|
ldy #1
|
|
|
|
|
ldx #0 ARGS len
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
|
|
|
|
lda (ZPPtr1),y
|
2016-08-17 06:25:58 +00:00
|
|
|
|
.10 cmp #'a'
|
|
|
|
|
bcc .11
|
2015-11-22 22:30:06 +00:00
|
|
|
|
cmp #'z'+1
|
2016-08-17 06:25:58 +00:00
|
|
|
|
bcs .11
|
|
|
|
|
eor #$20 to Uppercase
|
|
|
|
|
|
|
|
|
|
.11 sta CMD,y Store Cmd in Buffer
|
|
|
|
|
sty CMD update CMD len
|
|
|
|
|
|
2015-10-19 20:35:00 +00:00
|
|
|
|
tya
|
|
|
|
|
cmp (ZPPtr1)
|
2016-08-17 06:25:58 +00:00
|
|
|
|
beq .13 end of string
|
|
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
cmp #' '
|
|
|
|
|
bne .10
|
|
|
|
|
|
|
|
|
|
.12 tya
|
|
|
|
|
cmp (ZPPtr1)
|
|
|
|
|
beq .13 end of string
|
|
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
inx
|
|
|
|
|
sta ARGS,x
|
|
|
|
|
bra .12
|
|
|
|
|
|
|
|
|
|
.13 stx ARGS update ARGS len
|
|
|
|
|
|
2016-10-29 19:58:21 +00:00
|
|
|
|
pla
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL FreeMemA
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
|
|
|
|
>LDYA L.CMDS
|
|
|
|
|
>STYA ZPPtr2
|
|
|
|
|
|
|
|
|
|
ldx #0
|
|
|
|
|
|
|
|
|
|
.1 lda (ZPPtr2)
|
|
|
|
|
beq Cmd.Exec.EXT Ending 0, must be an external Cmd....
|
|
|
|
|
|
|
|
|
|
cmp CMD
|
|
|
|
|
bne .4
|
|
|
|
|
|
|
|
|
|
tay
|
|
|
|
|
|
|
|
|
|
.2 lda CMD,y
|
|
|
|
|
.3 cmp (ZPPtr2),y
|
|
|
|
|
bne .4
|
|
|
|
|
dey
|
2015-10-19 20:35:00 +00:00
|
|
|
|
bne .2
|
|
|
|
|
|
2016-08-17 06:25:58 +00:00
|
|
|
|
jmp (J.INTCMDS,x) Found an internal Cmd...
|
|
|
|
|
|
|
|
|
|
.4 inx
|
|
|
|
|
inx
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2016-08-17 06:25:58 +00:00
|
|
|
|
lda ZPPtr2
|
2015-10-19 20:35:00 +00:00
|
|
|
|
sec
|
2016-08-17 06:25:58 +00:00
|
|
|
|
adc (ZPPtr2)
|
|
|
|
|
sta ZPPtr2
|
|
|
|
|
bcc .1
|
|
|
|
|
inc ZPPtr2+1
|
2015-10-19 20:35:00 +00:00
|
|
|
|
bra .1
|
2015-11-22 22:30:06 +00:00
|
|
|
|
*--------------------------------------
|
2016-08-17 06:25:58 +00:00
|
|
|
|
Cmd.Exec.EXT ldy #1
|
|
|
|
|
lda CMD,y
|
|
|
|
|
cmp #'/' Command line is already full path, no search
|
2016-10-29 19:58:21 +00:00
|
|
|
|
beq .3
|
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
|
|
|
|
|
>SYSCALL GetEnvYA 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
|
|
|
|
|
2016-08-17 06:25:58 +00:00
|
|
|
|
>PUSHW L.CMD
|
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
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL GetMemPtrA
|
2016-08-17 06:25:58 +00:00
|
|
|
|
>PUSHYA push search list
|
|
|
|
|
>PUSHW L.CMD
|
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
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL PStrCpy
|
2016-08-17 06:25:58 +00:00
|
|
|
|
pla
|
2016-10-29 19:58:21 +00:00
|
|
|
|
>SYSCALL FreeMemA 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-10-03 06:18:46 +00:00
|
|
|
|
lda STAT+S.STAT.PRODOS.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
|
|
|
|
|
.99 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* TXT : Launch "/PATH/SHELL /PATH/CMD ARGS"
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
Cmd.Exec.EXT.TXT
|
|
|
|
|
lda #0 Get arg[0] = /PATH/SHELL
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL GetArgA
|
2016-08-17 06:25:58 +00:00
|
|
|
|
>PUSHYA
|
2016-09-26 06:18:51 +00:00
|
|
|
|
>PUSHWI UsrBuf256
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL PStrCpy
|
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
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL PStrCat
|
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
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL PStrCat
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2016-09-26 06:18:51 +00:00
|
|
|
|
.1 >LDYAI UsrBuf256
|
2016-08-17 06:25:58 +00:00
|
|
|
|
bit Cmd.Exec.Mode
|
|
|
|
|
bmi .2 startproc
|
2016-03-13 21:53:55 +00:00
|
|
|
|
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL ExecProcessNewEnvYA
|
2016-08-17 06:25:58 +00:00
|
|
|
|
rts
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
2016-10-24 15:54:43 +00:00
|
|
|
|
.2 >SYSCALL CreateProcessYA
|
2016-08-17 06:25:58 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* 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
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL GetMemPtrA
|
2016-10-17 15:47:50 +00:00
|
|
|
|
>PUSHYA
|
|
|
|
|
>LDYA L.MSG.PSTR
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL PrintFYA
|
2016-10-17 15:47:50 +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
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL GetMemPtrA
|
2016-08-17 06:25:58 +00:00
|
|
|
|
>PUSHYA
|
2016-09-26 06:18:51 +00:00
|
|
|
|
>PUSHWI UsrBuf256
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL PStrCpy
|
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
|
|
|
|
|
>SYSCALL PStrCat
|
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-10-03 06:18:46 +00:00
|
|
|
|
lda STAT+S.STAT.PRODOS.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
|
|
|
|
|
>SYSCALL NewPStrYA
|
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
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL FreeMemA
|
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
|
2016-08-17 06:25:58 +00:00
|
|
|
|
ror Cmd.Exec.Mode
|
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
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL GetMemPtrA
|
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
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL PrintFYA
|
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...
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL PutEnvYA
|
2016-08-17 06:25:58 +00:00
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.2 dec ARGS String is "VAR=", Remove endig '='
|
|
|
|
|
>LDYA L.ARGS String is "VAR"...
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL UnsetEnvYA
|
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
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL GetEnvYA
|
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
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL PrintFYA
|
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
|
|
|
|
|
|
|
|
|
.99 lda #SYSMGR.ERRSYN
|
|
|
|
|
sec
|
|
|
|
|
rts
|
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
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL PStrFTime
|
2016-09-05 16:00:11 +00:00
|
|
|
|
|
2016-10-17 15:47:50 +00:00
|
|
|
|
>PUSHWI UsrBuf256
|
|
|
|
|
>LDYA L.MSG.PSTR
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL PrintFYA
|
2016-10-17 15:47:50 +00:00
|
|
|
|
rts
|
2015-10-19 20:35:00 +00:00
|
|
|
|
*--------------------------------------
|
2016-08-17 06:25:58 +00:00
|
|
|
|
Cmd.Exec.ECHO lda ARGS
|
2016-10-27 08:14:13 +00:00
|
|
|
|
beq Cmd.Exec.ECHO.SYN
|
2016-10-17 15:47:50 +00:00
|
|
|
|
>PUSHW L.ARGS
|
|
|
|
|
>LDYA L.MSG.PSTR
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL PrintFYA
|
2015-10-19 20:35:00 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
2016-10-27 08:14:13 +00:00
|
|
|
|
Cmd.Exec.ECHO.SYN
|
|
|
|
|
lda #SYSMGR.ERRSYN
|
2015-10-19 20:35:00 +00:00
|
|
|
|
sec
|
2016-10-27 08:14:13 +00:00
|
|
|
|
Cmd.Exec.ECHO.RTS
|
2016-08-17 06:25:58 +00:00
|
|
|
|
rts
|
2015-10-19 20:35:00 +00:00
|
|
|
|
*--------------------------------------
|
2016-08-17 06:25:58 +00:00
|
|
|
|
Cmd.Exec.TYPE lda ARGS
|
2016-10-27 08:14:13 +00:00
|
|
|
|
beq Cmd.Exec.ECHO.SYN
|
|
|
|
|
>LDYA L.ARGS
|
|
|
|
|
>SYSCALL GetFullPathYA
|
|
|
|
|
bcs Cmd.Exec.ECHO.RTS
|
|
|
|
|
|
|
|
|
|
>STYA ZPPTR1
|
|
|
|
|
stx hFullPath
|
|
|
|
|
|
2016-09-22 06:19:49 +00:00
|
|
|
|
>PUSHWI 0 Aux type
|
|
|
|
|
>PUSHBI 4 S.FILEINFO.TYPE.TXT
|
|
|
|
|
>PUSHBI SYS.FOPEN.R
|
2016-10-27 08:14:13 +00:00
|
|
|
|
>PUSHW ZPPTR1
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL LoadFile
|
2016-10-27 08:14:13 +00:00
|
|
|
|
bcs .98
|
|
|
|
|
stx hTextFile
|
|
|
|
|
|
|
|
|
|
eor #$ff
|
|
|
|
|
sta ZPPTR2+1
|
|
|
|
|
tya
|
|
|
|
|
eor #$ff
|
|
|
|
|
sta ZPPTR2 store file !len
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
|
|
|
|
txa
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL GetMemPtrA
|
2016-10-27 08:14:13 +00:00
|
|
|
|
|
2015-10-19 20:35:00 +00:00
|
|
|
|
>STYA ZPPTR1
|
2016-10-27 08:14:13 +00:00
|
|
|
|
|
|
|
|
|
ldy #0
|
|
|
|
|
lda #13 if len=0, exit print CR
|
|
|
|
|
|
|
|
|
|
.1 inc ZPPTR2
|
2015-10-19 20:35:00 +00:00
|
|
|
|
bne .2
|
2016-10-27 08:14:13 +00:00
|
|
|
|
inc ZPPTR2+1
|
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
.2 lda (ZPPTR1)
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL COutA
|
2016-10-27 08:14:13 +00:00
|
|
|
|
bcs .97
|
|
|
|
|
|
|
|
|
|
lda (ZPPTR1) get last char in A
|
|
|
|
|
|
2015-10-19 20:35:00 +00:00
|
|
|
|
inc ZPPTR1
|
|
|
|
|
bne .1
|
|
|
|
|
inc ZPPTR1+1
|
|
|
|
|
bra .1
|
|
|
|
|
|
2016-10-27 08:14:13 +00:00
|
|
|
|
.8 cmp #13 is last char printed a CR ?
|
|
|
|
|
beq .81
|
|
|
|
|
lda #13
|
|
|
|
|
>SYSCALL COutA no, add one
|
|
|
|
|
bcs .97
|
|
|
|
|
|
|
|
|
|
.81 jsr .97 cleanup...
|
|
|
|
|
|
2015-10-19 20:35:00 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
2016-10-27 08:14:13 +00:00
|
|
|
|
.97 pha
|
|
|
|
|
lda hTextFile
|
|
|
|
|
>SYSCALL FreeMemA
|
|
|
|
|
pla
|
|
|
|
|
|
|
|
|
|
.98 pha
|
|
|
|
|
lda hFullPath
|
|
|
|
|
>SYSCALL FreeMemA
|
|
|
|
|
pla
|
|
|
|
|
|
2015-10-19 20:35:00 +00:00
|
|
|
|
sec
|
2016-10-27 08:14:13 +00:00
|
|
|
|
rts
|
2015-10-19 20:35:00 +00:00
|
|
|
|
*--------------------------------------
|
2016-08-17 06:25:58 +00:00
|
|
|
|
Cmd.Exec.READ
|
2015-11-22 22:30:06 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
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
|
|
|
|
|
SAVE SBIN/SHELL.S.CMD
|
|
|
|
|
LOAD SBIN/SHELL.S
|
|
|
|
|
ASM
|