mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-29 17:50:18 +00:00
200 lines
3.7 KiB
Plaintext
200 lines
3.7 KiB
Plaintext
PR#3
|
||
PREFIX /A2OSX.SRC
|
||
NEW
|
||
INC 1
|
||
AUTO 6
|
||
.LIST OFF
|
||
.OP 65C02
|
||
*--------------------------------------
|
||
* S.ExecFileA (R)
|
||
* in :
|
||
* A = hMem of FilePath (PSTRING)
|
||
* out :
|
||
*
|
||
*--------------------------------------
|
||
S.ExecFileA jsr S.LoadFileA
|
||
bcc S.ExecFileAOK
|
||
rts
|
||
|
||
S.ExecFileAOK >STYA S.ExecFileA.DataLen
|
||
stx S.ExecFileA.hData
|
||
txa
|
||
jsr S.GetMemPtrA
|
||
>STYA S.ExecFileA.DataPtr
|
||
|
||
.1 stz TmpBuffer256
|
||
|
||
.2 >LDYA S.ExecFileA.DataPtr
|
||
>STYA ZPQuickPtr1
|
||
|
||
inc S.ExecFileA.DataPtr
|
||
bne .21
|
||
inc S.ExecFileA.DataPtr+1
|
||
|
||
.21 lda S.ExecFileA.DataLen
|
||
bne .22
|
||
dec S.ExecFileA.DataLen+1
|
||
.22 dec S.ExecFileA.DataLen
|
||
|
||
lda (ZPQuickPtr1)
|
||
cmp #$0D
|
||
beq .3
|
||
inc TmpBuffer256
|
||
ldx TmpBuffer256
|
||
sta TmpBuffer256,x
|
||
|
||
lda S.ExecFileA.DataLen
|
||
bne .2
|
||
lda S.ExecFileA.DataLen+1
|
||
bne .2
|
||
|
||
.3 lda TmpBuffer256
|
||
beq .4
|
||
lda TmpBuffer256+1
|
||
cmp #'*'
|
||
beq .4
|
||
lda #'-'
|
||
jsr S.SysScrCOUTA
|
||
lda #'>'
|
||
jsr S.SysScrCOUTA
|
||
>LDYAI TmpBuffer256
|
||
jsr S.SysScrPPSTRYA
|
||
>LDYAI TmpBuffer256
|
||
jsr S.NewPStrYA
|
||
bcs .99
|
||
|
||
pha
|
||
jsr S.ExecCmdLineA
|
||
jsr S.SysScrPRCode
|
||
pla
|
||
jsr S.FreeMemA
|
||
|
||
.4 lda S.ExecFileA.DataLen
|
||
bne .1
|
||
lda S.ExecFileA.DataLen+1
|
||
bne .1
|
||
|
||
jsr .99
|
||
clc
|
||
rts
|
||
|
||
.99 lda S.ExecFileA.hData
|
||
jsr S.FreeMemA
|
||
sec
|
||
rts
|
||
*--------------------------------------
|
||
S.ExecCmdLineA >PUSHA Push Cmd Line
|
||
>PUSHBI $20 Push SEP=' '
|
||
>PUSHBI 0 Push Token IDX
|
||
jsr S.PStrGetTkn
|
||
bcs .99
|
||
|
||
sta S.ExecFileA.hCMD
|
||
stx S.ExecFileA.hARGS
|
||
jsr S.GetMemPtrA
|
||
>PUSHYA
|
||
>PUSHWI EXECCMDS
|
||
jsr S.GetPStrIndex
|
||
bcs .98
|
||
|
||
asl
|
||
tax
|
||
lda S.ExecFileA.hARGS
|
||
jsr S.ExecCmdLine
|
||
bcs .98
|
||
|
||
jsr .98
|
||
clc
|
||
rts
|
||
|
||
.98 pha
|
||
lda S.ExecFileA.hARGS
|
||
jsr S.FreeMemA
|
||
lda S.ExecFileA.hCMD
|
||
jsr S.FreeMemA
|
||
pla
|
||
.99 sec
|
||
rts
|
||
*--------------------------------------
|
||
S.ExecFileA.hData .BS 1
|
||
S.ExecFileA.DataLen .BS 2
|
||
S.ExecFileA.DataPtr .BS 2
|
||
S.ExecFileA.hCMD .BS 1
|
||
S.ExecFileA.hARGS .BS 1
|
||
*--------------------------------------
|
||
EXECCMDS .HS .03
|
||
.AS "SET"
|
||
.HS 04
|
||
.AS "LOAD"
|
||
.HS 04
|
||
.AS "EXEC"
|
||
.DA #0
|
||
*--------------------------------------
|
||
S.ExecCmdLine jmp (.1,x)
|
||
.1 .DA S.SetSysEnvA
|
||
.DA S.LoadDrvA VCPU!!!!
|
||
.DA S.CreateProcessA VCPU!!!!
|
||
*--------------------------------------
|
||
* S.GetPStrIndex
|
||
* in :
|
||
* PULLW = String Table (Array Of PSTR)
|
||
* PULLW = String To Search (PSTR)
|
||
* out :
|
||
* CC: A = String Index In Table
|
||
*--------------------------------------
|
||
S.GetPStrIndex >PULLW ZPQuickPtr1
|
||
>PULLW ZPQuickPtr2
|
||
ldx #0
|
||
.1 lda (ZPQuickPtr1)
|
||
beq .99
|
||
cmp (ZPQuickPtr2)
|
||
bne .3
|
||
tay
|
||
.2 lda (ZPQuickPtr1),y
|
||
eor (ZPQuickPtr2),y
|
||
and #$7F
|
||
bne .3
|
||
dey
|
||
bne .2
|
||
txa
|
||
clc
|
||
rts
|
||
.3 inx
|
||
lda (ZPQuickPtr1)
|
||
sec
|
||
adc ZPQuickPtr1
|
||
sta ZPQuickPtr1
|
||
bcc .1
|
||
inc ZPQuickPtr1+1
|
||
bra .1
|
||
.99 lda #SYSMGR.ERRSYN
|
||
sec
|
||
rts
|
||
*--------------------------------------
|
||
S.SetSysEnvA >PUSHA Push Cmd Line
|
||
>PUSHBI $3D Push SEP='='
|
||
>PUSHBI 0 Push Token IDX
|
||
jsr S.PStrGetTkn
|
||
bcs *
|
||
phx save X,A for discard
|
||
pha
|
||
pha
|
||
txa
|
||
>PUSHA
|
||
pla
|
||
>PUSHA
|
||
ldy #S.PS.hENV
|
||
lda TSKMGR.TABLE,y
|
||
>PUSHA
|
||
jsr S.SetEnvVarH
|
||
|
||
pla disard NAME
|
||
jsr S.FreeMemA
|
||
pla discard VALUE
|
||
jmp S.FreeMemA
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE SYS/KERNEL.S.EXE
|
||
LOAD SYS/KERNEL.S
|
||
ASM
|