2015-10-19 20:35:00 +00:00
|
|
|
|
PR#3
|
|
|
|
|
PREFIX /A2OSX.SRC
|
|
|
|
|
NEW
|
|
|
|
|
INC 1
|
|
|
|
|
AUTO 6
|
|
|
|
|
.LIST OFF
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
EXEC.CMD stz hFullCmd
|
|
|
|
|
stz hEnvPath
|
|
|
|
|
|
|
|
|
|
ldy #hCmdLine
|
2015-11-22 22:30:06 +00:00
|
|
|
|
lda (pData),y
|
|
|
|
|
>PUSHA
|
2015-10-19 20:35:00 +00:00
|
|
|
|
>PUSHBI $20 Push SEP=' '
|
|
|
|
|
>PUSHBI 0 Push 0 for getting CMD & ARGS
|
|
|
|
|
>SYSCALL SYS.PStrGetTkn
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
sta hExecCmd
|
|
|
|
|
stx hExecArgs
|
|
|
|
|
|
|
|
|
|
>SYSCALL SYS.GetMemPtrA
|
|
|
|
|
>STYA ZPPtr1
|
|
|
|
|
|
|
|
|
|
ldx #0
|
|
|
|
|
stz ExecCmdIdx
|
|
|
|
|
|
|
|
|
|
.1 lda CMDS,x
|
|
|
|
|
beq EXEC.CMD.EXT
|
|
|
|
|
cmp (ZPPtr1)
|
|
|
|
|
bne .5
|
|
|
|
|
|
|
|
|
|
phx
|
|
|
|
|
ldy #0
|
|
|
|
|
|
|
|
|
|
.2 iny
|
|
|
|
|
inx
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
cmp #'a'
|
|
|
|
|
bcc .3
|
2015-11-22 22:30:06 +00:00
|
|
|
|
cmp #'z'+1
|
2015-10-19 20:35:00 +00:00
|
|
|
|
bcs .3
|
|
|
|
|
eor #$20 to Uppercase
|
|
|
|
|
.3 cmp CMDS,x
|
|
|
|
|
bne .4
|
|
|
|
|
tya
|
|
|
|
|
cmp (ZPPtr1)
|
|
|
|
|
bne .2
|
|
|
|
|
plx
|
|
|
|
|
|
|
|
|
|
jsr EXEC.CMD.INT
|
|
|
|
|
jmp EXEC.CMD.ClnUp
|
|
|
|
|
|
|
|
|
|
.4 plx
|
|
|
|
|
.5 txa
|
|
|
|
|
sec
|
|
|
|
|
adc CMDS,x
|
|
|
|
|
tax
|
|
|
|
|
inc ExecCmdIdx
|
|
|
|
|
inc ExecCmdIdx
|
|
|
|
|
bra .1
|
|
|
|
|
.99 rts
|
2015-11-22 22:30:06 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* ZPPtr1 = hExecCmd
|
|
|
|
|
*--------------------------------------
|
2015-10-19 20:35:00 +00:00
|
|
|
|
EXEC.CMD.EXT ldy #1
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
cmp #'/'
|
2015-11-22 22:30:06 +00:00
|
|
|
|
bne .1
|
|
|
|
|
>LDYA ZPPtr1
|
|
|
|
|
>SYSCALL SYS.NewPStrYA
|
|
|
|
|
bra .10
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2015-11-22 22:30:06 +00:00
|
|
|
|
.1 >LDYA L.ENV.PATH push ENVNAME=PATH
|
|
|
|
|
>SYSCALL SYS.GetEnvVarYA get value for ENV=PATH
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2015-11-22 22:30:06 +00:00
|
|
|
|
bcc .12
|
|
|
|
|
jmp EXEC.CMD.ClnUp
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2015-11-22 22:30:06 +00:00
|
|
|
|
.12 sta hEnvPath
|
2015-10-19 20:35:00 +00:00
|
|
|
|
>PUSHB hExecCmd
|
|
|
|
|
>PUSHB hEnvPath
|
|
|
|
|
>SYSCALL SYS.FileSearch
|
|
|
|
|
bcc .10
|
|
|
|
|
|
|
|
|
|
>PUSHB hExecCmd
|
|
|
|
|
ldy #S.PS.hPREFIX
|
|
|
|
|
lda (pPs),y
|
|
|
|
|
>PUSHA
|
|
|
|
|
>SYSCALL SYS.FileSearch
|
|
|
|
|
|
2015-11-22 22:30:06 +00:00
|
|
|
|
.10 bcs EXEC.CMD.ClnUp
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2015-11-22 22:30:06 +00:00
|
|
|
|
sta hFullCmd
|
|
|
|
|
>SYSCALL SYS.MLIGetFileInfoA
|
2015-10-19 20:35:00 +00:00
|
|
|
|
bcs EXEC.CMD.ClnUp
|
|
|
|
|
|
|
|
|
|
>STYA ZPPTR1
|
|
|
|
|
ldy #1 Get File Type
|
|
|
|
|
lda (ZPPTR1),y
|
|
|
|
|
cmp #$04 TXT File ?
|
2015-11-22 22:30:06 +00:00
|
|
|
|
bne .2
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2015-11-22 22:30:06 +00:00
|
|
|
|
lda hFullCmd
|
|
|
|
|
jsr OpenTxtFileA
|
|
|
|
|
bcs EXEC.CMD.ClnUp
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2015-11-22 22:30:06 +00:00
|
|
|
|
lda hExecArgs
|
|
|
|
|
beq .11
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2015-11-22 22:30:06 +00:00
|
|
|
|
>SYSCALL SYS.PStrCpyA
|
|
|
|
|
bcs EXEC.CMD.ClnUp
|
|
|
|
|
.11 ldy #hInputArgs
|
|
|
|
|
sta (pData),y
|
|
|
|
|
bra EXEC.CMD.ClnUp
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2015-11-22 22:30:06 +00:00
|
|
|
|
.2 cmp #$06 BIN File ?
|
|
|
|
|
bne .4
|
|
|
|
|
|
|
|
|
|
ldy #S.PS.PID
|
|
|
|
|
lda (pPs),y
|
|
|
|
|
beq .3 0, we are in kernel space
|
|
|
|
|
|
|
|
|
|
lda hFullCmd
|
|
|
|
|
ldy hExecArgs
|
|
|
|
|
>SYSCALL SYS.ExecProcessNewEnvYA
|
|
|
|
|
bra EXEC.CMD.ClnUp
|
|
|
|
|
|
|
|
|
|
.3 lda hFullCmd
|
|
|
|
|
ldy hExecArgs
|
|
|
|
|
>SYSCALL SYS.CreateProcessYA
|
|
|
|
|
bra EXEC.CMD.ClnUp
|
|
|
|
|
|
|
|
|
|
.4 cmp #$ff SYS File ?
|
|
|
|
|
bne .5
|
|
|
|
|
|
|
|
|
|
bra *
|
|
|
|
|
|
|
|
|
|
.5 lda #SYSMGR.ERRSYN
|
|
|
|
|
sec
|
2015-10-19 20:35:00 +00:00
|
|
|
|
EXEC.CMD.ClnUp pha
|
|
|
|
|
php
|
|
|
|
|
lda hFullCmd
|
|
|
|
|
beq .1
|
|
|
|
|
>SYSCALL SYS.FreeMemA
|
|
|
|
|
|
|
|
|
|
.1 lda hEnvPath
|
|
|
|
|
beq .2
|
|
|
|
|
>SYSCALL SYS.FreeMemA
|
|
|
|
|
|
|
|
|
|
.2 lda hExecArgs
|
|
|
|
|
beq .3
|
|
|
|
|
>SYSCALL SYS.FreeMemA
|
|
|
|
|
|
|
|
|
|
.3 lda hExecCmd
|
|
|
|
|
beq .8
|
|
|
|
|
>SYSCALL SYS.FreeMemA
|
|
|
|
|
.8 plp
|
|
|
|
|
pla
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
EXEC.CMD.INT ldx ExecCmdIdx
|
|
|
|
|
jmp (J.INTCMDS,x)
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
EXEC.CMD.CD lda hExecArgs
|
|
|
|
|
bne EXEC.CMD.CD.C
|
|
|
|
|
ldy #S.PS.hPREFIX
|
|
|
|
|
lda (pPs),y
|
2015-11-22 22:30:06 +00:00
|
|
|
|
>SYSCALL SYS.PSTROutA
|
|
|
|
|
lda #13
|
|
|
|
|
>SYSCALL SYS.COutA
|
2015-10-19 20:35:00 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
EXEC.CMD.CD.C >SYSCALL SYS.GetMemPtrA
|
|
|
|
|
>STYA ZPPTR2
|
|
|
|
|
ldy #S.PS.hPREFIX
|
|
|
|
|
lda (pPs),y
|
|
|
|
|
>SYSCALL SYS.GetMemPtrA
|
|
|
|
|
>STYA ZPPTR1
|
|
|
|
|
>PUSHWI MLI.MAXPATH+1 Get a buffer for new PATH
|
|
|
|
|
>PUSHBI 0 no particular Option
|
|
|
|
|
>SYSCALL SYS.GetMem
|
|
|
|
|
bcs .99
|
|
|
|
|
>STYA ZPPTR3
|
|
|
|
|
stx hNEWPATH
|
|
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
|
sta (ZPPTR3)
|
|
|
|
|
ldy #1
|
|
|
|
|
lda (ZPPTR2),y
|
|
|
|
|
cmp #'/' Full Path?
|
|
|
|
|
beq .3
|
|
|
|
|
cmp #'.' ".." ?
|
|
|
|
|
bne .2
|
|
|
|
|
lda (ZPPTR2)
|
|
|
|
|
cmp #2
|
|
|
|
|
bne .97
|
|
|
|
|
iny
|
|
|
|
|
lda (ZPPTR2),y
|
|
|
|
|
cmp #'.'
|
|
|
|
|
bne .97
|
|
|
|
|
lda (ZPPTR1)
|
|
|
|
|
tay
|
|
|
|
|
.1 dey
|
|
|
|
|
beq .97
|
|
|
|
|
lda (ZPPTR1),y
|
|
|
|
|
cmp #'/'
|
|
|
|
|
bne .1
|
|
|
|
|
tya
|
|
|
|
|
sta (ZPPTR3)
|
|
|
|
|
.11 lda (ZPPTR1),y
|
|
|
|
|
sta (ZPPTR3),y
|
|
|
|
|
dey
|
|
|
|
|
bne .11
|
|
|
|
|
bra .4
|
|
|
|
|
.97 lda #SYSMGR.ERRSYN
|
|
|
|
|
.98 pha
|
|
|
|
|
lda hNEWPATH
|
|
|
|
|
>SYSCALL SYS.FreeMemA
|
|
|
|
|
pla
|
|
|
|
|
sec
|
|
|
|
|
.99 rts
|
|
|
|
|
|
|
|
|
|
.2 >PUSHW ZPPTR1
|
|
|
|
|
>PUSHW ZPPTR3
|
|
|
|
|
>LIBCALL hLIBSTR,LIBSTR.STRCPYP
|
|
|
|
|
.3 >PUSHW ZPPTR2
|
|
|
|
|
>PUSHW ZPPTR3
|
|
|
|
|
>LIBCALL hLIBSTR,LIBSTR.STRCATP
|
|
|
|
|
lda (ZPPTR3)
|
|
|
|
|
tay
|
|
|
|
|
lda #'/' Ending with '/'?
|
|
|
|
|
cmp (ZPPTR3),y
|
|
|
|
|
beq .4
|
|
|
|
|
iny
|
|
|
|
|
sta (ZPPTR3),y
|
|
|
|
|
tya
|
|
|
|
|
sta (ZPPTR3)
|
|
|
|
|
.4 lda hNEWPATH
|
|
|
|
|
>SYSCALL SYS.CheckPrefixA
|
|
|
|
|
bcs .98
|
|
|
|
|
ldy #S.PS.hPREFIX
|
|
|
|
|
lda (pPs),y
|
|
|
|
|
pha
|
|
|
|
|
lda hNEWPATH
|
|
|
|
|
sta (pPs),y
|
|
|
|
|
pla
|
|
|
|
|
>SYSCALL SYS.FreeMemA
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
EXEC.CMD.SET lda hExecArgs
|
2015-11-22 22:30:06 +00:00
|
|
|
|
bne EXEC.CMD.SETVAR
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
|
|
|
|
ldy #S.PS.hENV
|
|
|
|
|
lda (pPs),y
|
|
|
|
|
>SYSCALL SYS.GetMemPtrA
|
|
|
|
|
>STYA ZPPTR1
|
|
|
|
|
|
|
|
|
|
.1 lda (ZPPTR1)
|
|
|
|
|
beq .8 Ending 0 ?
|
2015-11-22 22:30:06 +00:00
|
|
|
|
>LDYA ZPPTR1
|
|
|
|
|
>SYSCALL SYS.PSTROutYA
|
|
|
|
|
lda #13
|
|
|
|
|
>SYSCALL SYS.COutA
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
|
|
|
|
lda ZPPTR1
|
|
|
|
|
sec
|
|
|
|
|
adc (ZPPTR1) Add len+1 to PTR
|
|
|
|
|
sta ZPPTR1
|
|
|
|
|
bcc .1
|
|
|
|
|
inc ZPPTR1
|
|
|
|
|
bra .1
|
|
|
|
|
|
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
|
|
|
|
|
2015-11-22 22:30:06 +00:00
|
|
|
|
EXEC.CMD.SETVAR >PUSHA Push Cmd Line
|
2015-10-19 20:35:00 +00:00
|
|
|
|
>PUSHBI $3D Push SEP='='
|
|
|
|
|
>PUSHBI 0 Push Token IDX
|
|
|
|
|
>SYSCALL SYS.PStrGetTkn
|
|
|
|
|
bcc .3
|
|
|
|
|
lda #SYSMGR.ERRSYN
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.3 sta hVarName
|
|
|
|
|
stx hVarValue
|
|
|
|
|
txa
|
2015-11-22 22:30:06 +00:00
|
|
|
|
beq .31
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2015-11-22 22:30:06 +00:00
|
|
|
|
>PUSHB hVarValue
|
|
|
|
|
>PUSHB hVarName
|
|
|
|
|
>SYSCALL SYS.SetEnvVarH
|
|
|
|
|
jmp .97
|
|
|
|
|
|
|
|
|
|
.31 lda hExecArgs
|
2015-10-19 20:35:00 +00:00
|
|
|
|
>SYSCALL SYS.GetMemPtrA
|
|
|
|
|
>STYA ZPPTR1
|
|
|
|
|
lda (ZPPTR1)
|
|
|
|
|
tay
|
|
|
|
|
lda (ZPPTR1),y
|
|
|
|
|
cmp #'='
|
2015-11-22 22:30:06 +00:00
|
|
|
|
bne .4
|
|
|
|
|
|
|
|
|
|
lda hVarName
|
|
|
|
|
>SYSCALL SYS.DelEnvVarA
|
|
|
|
|
bra .97
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2015-11-22 22:30:06 +00:00
|
|
|
|
.4 lda hVarName
|
|
|
|
|
>SYSCALL SYS.GetEnvVarA
|
2015-10-19 20:35:00 +00:00
|
|
|
|
bcs .97
|
|
|
|
|
sta hVarValue
|
|
|
|
|
|
|
|
|
|
lda hVarName
|
2015-11-22 22:30:06 +00:00
|
|
|
|
>SYSCALL SYS.PSTROutA
|
2015-10-19 20:35:00 +00:00
|
|
|
|
lda #'='
|
2015-11-22 22:30:06 +00:00
|
|
|
|
>SYSCALL SYS.COutA
|
2015-10-19 20:35:00 +00:00
|
|
|
|
lda hVarValue
|
2015-11-22 22:30:06 +00:00
|
|
|
|
>SYSCALL SYS.PSTROutA
|
|
|
|
|
lda #13
|
|
|
|
|
>SYSCALL SYS.COutA
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
|
2015-10-19 20:35:00 +00:00
|
|
|
|
.97 php
|
|
|
|
|
pha
|
|
|
|
|
lda hVarValue
|
|
|
|
|
beq .98
|
|
|
|
|
>SYSCALL SYS.FreeMemA
|
|
|
|
|
.98 lda hVarName
|
|
|
|
|
>SYSCALL SYS.FreeMemA
|
|
|
|
|
pla
|
|
|
|
|
php
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
EXEC.CMD.DATE >SYSCALL SYS.MLIGetTime
|
|
|
|
|
bcs .9
|
|
|
|
|
>PUSHW DATELO
|
|
|
|
|
>LIBCALL hLIBSTR,LIBSTR.PRINTDATE
|
2015-11-22 22:30:06 +00:00
|
|
|
|
lda #13
|
|
|
|
|
>SYSCALL SYS.COutA
|
2015-10-19 20:35:00 +00:00
|
|
|
|
clc
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
EXEC.CMD.TIME >SYSCALL SYS.MLIGetTime
|
|
|
|
|
bcs .9
|
|
|
|
|
>PUSHW TIMELO
|
|
|
|
|
>LIBCALL hLIBSTR,LIBSTR.PRINTTIME
|
2015-11-22 22:30:06 +00:00
|
|
|
|
lda #13
|
|
|
|
|
>SYSCALL SYS.COutA
|
2015-10-19 20:35:00 +00:00
|
|
|
|
clc
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
EXEC.CMD.ECHO lda hExecArgs
|
|
|
|
|
beq .98
|
|
|
|
|
>SYSCALL SYS.ExpandPStrA
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
pha
|
2015-11-22 22:30:06 +00:00
|
|
|
|
>SYSCALL SYS.PSTROutA
|
|
|
|
|
lda #13
|
|
|
|
|
>SYSCALL SYS.COutA
|
2015-10-19 20:35:00 +00:00
|
|
|
|
pla
|
|
|
|
|
>SYSCALL SYS.FreeMemA
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.98 lda #SYSMGR.ERRSYN
|
|
|
|
|
sec
|
|
|
|
|
.99 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
EXEC.CMD.TYPE lda hExecArgs
|
|
|
|
|
beq .98
|
|
|
|
|
>SYSCALL SYS.LoadFileA
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
>STYA ZPPTR2 store file len
|
|
|
|
|
phx
|
|
|
|
|
txa
|
|
|
|
|
>SYSCALL SYS.GetMemPtrA
|
|
|
|
|
>STYA ZPPTR1
|
|
|
|
|
.1 lda ZPPTR2
|
|
|
|
|
bne .2
|
|
|
|
|
lda ZPPTR2+1
|
|
|
|
|
beq .3
|
|
|
|
|
dec ZPPTR2+1
|
|
|
|
|
.2 dec ZPPTR2
|
|
|
|
|
|
|
|
|
|
lda (ZPPTR1)
|
2015-11-22 22:30:06 +00:00
|
|
|
|
>SYSCALL SYS.COutA
|
2015-10-19 20:35:00 +00:00
|
|
|
|
inc ZPPTR1
|
|
|
|
|
bne .1
|
|
|
|
|
inc ZPPTR1+1
|
|
|
|
|
bra .1
|
|
|
|
|
|
|
|
|
|
.3 pla
|
|
|
|
|
>SYSCALL SYS.FreeMemA
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.98 lda #SYSMGR.ERRSYN
|
|
|
|
|
sec
|
|
|
|
|
.99 rts
|
|
|
|
|
*--------------------------------------
|
2015-11-22 22:30:06 +00:00
|
|
|
|
EXEC.CMD.READ
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
EXEC.CMD.PAUSE ldy #bPause
|
|
|
|
|
lda #$80
|
|
|
|
|
sta (pData),y
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2015-10-19 20:35:00 +00:00
|
|
|
|
EXEC.CMD.EXIT ldy #bEXIT
|
|
|
|
|
lda #$FF
|
|
|
|
|
sta (pData),y
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
|
|
|
|
SAVE SBIN/SHELL.S.CMD
|
|
|
|
|
LOAD SBIN/SHELL.S
|
|
|
|
|
ASM
|