mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-04 03:05:43 +00:00
ce34b41f47
(revealed many bugs in LS.S & KERNEL.S.CIO.txt that are now corrected)
80 lines
1.4 KiB
Plaintext
80 lines
1.4 KiB
Plaintext
PR#3
|
||
PREFIX /A2OSX.SRC
|
||
NEW
|
||
INC 1
|
||
AUTO 6
|
||
.LIST OFF
|
||
*/--------------------------------------
|
||
* #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 (ZPQuickPtr1)
|
||
beq .8
|
||
|
||
jsr ARG.NextArgPtr1
|
||
inx
|
||
bne .1
|
||
|
||
.8 txa
|
||
rts
|
||
*/--------------------------------------
|
||
* #GetArgA
|
||
* ##In:
|
||
* A = argument index.
|
||
* ##Out:
|
||
* CC : success
|
||
* Y,A = PStr To Arg[A]
|
||
* CS : Out Of Bound
|
||
*\--------------------------------------
|
||
K.GetArgA sta .2+1
|
||
jsr ARG.InitArgPtr1
|
||
|
||
lda .2+1
|
||
beq .8
|
||
|
||
ldx #0
|
||
|
||
.1 lda (ZPQuickPtr1)
|
||
beq .9
|
||
|
||
.2 cpx #$ff Self Modified
|
||
beq .8
|
||
|
||
jsr ARG.NextArgPtr1
|
||
inx
|
||
bra .1
|
||
|
||
.8 >LDYA ZPQuickPtr1
|
||
clc
|
||
rts
|
||
|
||
.9 sec
|
||
rts
|
||
*--------------------------------------
|
||
ARG.InitArgPtr1 ldy #S.PS.hCMDLINE
|
||
lda (pPs),y
|
||
jsr K.GetMemPtrA
|
||
>STYA ZPQuickPtr1
|
||
rts
|
||
*--------------------------------------
|
||
ARG.NextArgPtr1 lda ZPQuickPtr1
|
||
sec
|
||
adc (ZPQuickPtr1)
|
||
sta ZPQuickPtr1
|
||
bcc .8
|
||
inc ZPQuickPtr1+1
|
||
.8 rts
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE SYS/KERNEL.S.ARG
|
||
LOAD SYS/KERNEL.S
|
||
ASM
|