mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-08 14:07:34 +00:00
83 lines
1.4 KiB
Plaintext
83 lines
1.4 KiB
Plaintext
PR#3
|
||
PREFIX /A2OSX.BUILD
|
||
LOMEM $A00
|
||
INC 1
|
||
AUTO 6
|
||
*/--------------------------------------
|
||
* # GetArgC
|
||
* Returns argument count in the process command line.
|
||
* ## In:
|
||
* none.
|
||
* ## Out:
|
||
* A = Command line Arg Count (Including /path/cmd)
|
||
*\--------------------------------------
|
||
K.GetArgC jsr ARG.InitArgPtr1
|
||
|
||
ldx #0
|
||
|
||
.1 lda (ZPPtr1)
|
||
beq .8
|
||
|
||
jsr ARG.NextArgPtr1
|
||
inx
|
||
bne .1
|
||
|
||
.8 txa
|
||
rts
|
||
*/--------------------------------------
|
||
* # GetArg.A
|
||
* ## In:
|
||
* A = argument index.
|
||
* ## Out:
|
||
* CC : success
|
||
* Y,A = CStr To Arg[A]
|
||
* CS : Out Of Bound
|
||
*\--------------------------------------
|
||
K.GetArg.A sta .2+1
|
||
jsr ARG.InitArgPtr1
|
||
|
||
lda .2+1
|
||
beq .8
|
||
|
||
ldx #0
|
||
|
||
.1 lda (ZPPtr1)
|
||
beq .9
|
||
|
||
.2 cpx #$ff Self Modified
|
||
beq .8
|
||
|
||
jsr ARG.NextArgPtr1
|
||
inx
|
||
bra .1
|
||
|
||
.8 >LDYA ZPPtr1
|
||
clc
|
||
rts
|
||
|
||
.9 sec
|
||
rts
|
||
*--------------------------------------
|
||
ARG.InitArgPtr1 ldy #S.PS.hARGS
|
||
lda (pPs),y
|
||
jsr K.GetMemPtr.A
|
||
>STYA ZPPtr1
|
||
rts
|
||
*--------------------------------------
|
||
ARG.NextArgPtr1 inc ZPPtr1
|
||
bne .1
|
||
inc ZPPtr1+1
|
||
|
||
.1 lda (ZPPtr1)
|
||
bne ARG.NextArgPtr1
|
||
|
||
inc ZPPtr1
|
||
bne .8
|
||
inc ZPPtr1+1
|
||
.8 rts
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE /A2OSX.SRC/SYS/KERNEL.S.ARG
|
||
LOAD /A2OSX.SRC/SYS/KERNEL.S
|
||
ASM
|