A2osX/SYS/KERNEL.S.ARG.txt

83 lines
1.4 KiB
Plaintext
Raw Normal View History

2016-08-17 06:25:58 +00:00
PR#3
PREFIX /A2OSX.BUILD
LOMEM $A00
2016-08-17 06:25:58 +00:00
INC 1
AUTO 6
*/--------------------------------------
* # GetArgC
* Returns argument count in the process command line.
* ## In:
* none.
* ## Out:
* A = Command line Arg Count (Including /path/cmd)
*\--------------------------------------
2016-09-29 15:30:15 +00:00
K.GetArgC jsr ARG.InitArgPtr1
2016-08-17 06:25:58 +00:00
ldx #0
2017-01-12 17:43:45 +00:00
.1 lda (ZPPtr1)
2016-08-17 06:25:58 +00:00
beq .8
2016-09-29 15:30:15 +00:00
jsr ARG.NextArgPtr1
2016-08-17 06:25:58 +00:00
inx
bne .1
.8 txa
rts
*/--------------------------------------
* # GetArg.A
* ## In:
* A = argument index.
* ## Out:
* CC : success
* Y,A = CStr To Arg[A]
2016-08-17 06:25:58 +00:00
* CS : Out Of Bound
*\--------------------------------------
K.GetArg.A sta .2+1
2016-09-29 15:30:15 +00:00
jsr ARG.InitArgPtr1
2016-08-17 06:25:58 +00:00
2016-09-26 16:00:52 +00:00
lda .2+1
2016-08-17 06:25:58 +00:00
beq .8
ldx #0
2017-01-12 17:43:45 +00:00
.1 lda (ZPPtr1)
2016-08-17 06:25:58 +00:00
beq .9
2016-09-26 16:00:52 +00:00
.2 cpx #$ff Self Modified
2016-08-17 06:25:58 +00:00
beq .8
2016-09-29 15:30:15 +00:00
jsr ARG.NextArgPtr1
2016-08-17 06:25:58 +00:00
inx
bra .1
2017-01-12 17:43:45 +00:00
.8 >LDYA ZPPtr1
2016-08-17 06:25:58 +00:00
clc
rts
.9 sec
rts
*--------------------------------------
ARG.InitArgPtr1 ldy #S.PS.hARGS
2016-08-17 06:25:58 +00:00
lda (pPs),y
jsr K.GetMemPtr.A
2017-01-12 17:43:45 +00:00
>STYA ZPPtr1
2016-08-17 06:25:58 +00:00
rts
*--------------------------------------
ARG.NextArgPtr1 inc ZPPtr1
bne .1
inc ZPPtr1+1
.1 lda (ZPPtr1)
bne ARG.NextArgPtr1
inc ZPPtr1
bne .8
2017-01-12 17:43:45 +00:00
inc ZPPtr1+1
2016-08-17 06:25:58 +00:00
.8 rts
*--------------------------------------
MAN
SAVE /A2OSX.SRC/SYS/KERNEL.S.ARG
LOAD /A2OSX.SRC/SYS/KERNEL.S
2016-08-17 06:25:58 +00:00
ASM