2016-08-17 06:25:58 +00:00
|
|
|
|
PR#3
|
2017-03-29 15:48:15 +00:00
|
|
|
|
PREFIX /A2OSX.BUILD
|
2017-03-15 16:44:15 +00:00
|
|
|
|
LOMEM $A00
|
2016-08-17 06:25:58 +00:00
|
|
|
|
INC 1
|
|
|
|
|
AUTO 6
|
2016-10-24 15:54:43 +00:00
|
|
|
|
*/--------------------------------------
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* # GetArgC
|
2016-10-25 06:58:15 +00:00
|
|
|
|
* Returns argument count in the process command line.
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## In:
|
2016-10-24 15:54:43 +00:00
|
|
|
|
* none.
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## Out:
|
2016-10-24 15:54:43 +00:00
|
|
|
|
* 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
|
2016-10-24 15:54:43 +00:00
|
|
|
|
*/--------------------------------------
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* # GetArgA
|
|
|
|
|
* ## In:
|
2016-10-25 06:58:15 +00:00
|
|
|
|
* A = argument index.
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## Out:
|
2016-10-24 15:54:43 +00:00
|
|
|
|
* CC : success
|
2017-08-24 06:47:31 +00:00
|
|
|
|
* Y,A = CStr To Arg[A]
|
2016-08-17 06:25:58 +00:00
|
|
|
|
* CS : Out Of Bound
|
2016-10-24 15:54:43 +00:00
|
|
|
|
*\--------------------------------------
|
2016-09-26 16:00:52 +00:00
|
|
|
|
K.GetArgA 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
|
|
|
|
|
*--------------------------------------
|
2016-09-29 15:30:15 +00:00
|
|
|
|
ARG.InitArgPtr1 ldy #S.PS.hCMDLINE
|
2016-08-17 06:25:58 +00:00
|
|
|
|
lda (pPs),y
|
2016-09-21 15:20:37 +00:00
|
|
|
|
jsr K.GetMemPtrA
|
2017-01-12 17:43:45 +00:00
|
|
|
|
>STYA ZPPtr1
|
2016-08-17 06:25:58 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-08-24 06:47:31 +00:00
|
|
|
|
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
|
2017-03-29 15:48:15 +00:00
|
|
|
|
SAVE /A2OSX.SRC/SYS/KERNEL.S.ARG
|
|
|
|
|
LOAD /A2OSX.SRC/SYS/KERNEL.S
|
2016-08-17 06:25:58 +00:00
|
|
|
|
ASM
|