A2osX/SYS/KERNEL.S.ARG.txt

79 lines
1.3 KiB
Plaintext
Raw Normal View History

2016-08-17 06:25:58 +00:00
PR#3
PREFIX /A2OSX.SRC
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
*/--------------------------------------
* #GetArgA
* ##In:
* A = argument index.
* ##Out:
* CC : success
* Y,A = PStr To Arg[A]
2016-08-17 06:25:58 +00:00
* CS : Out Of Bound
*\--------------------------------------
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-01-12 17:43:45 +00:00
ARG.NextArgPtr1 lda ZPPtr1
2016-08-17 06:25:58 +00:00
sec
2017-01-12 17:43:45 +00:00
adc (ZPPtr1)
sta ZPPtr1
2016-08-17 06:25:58 +00:00
bcc .8
2017-01-12 17:43:45 +00:00
inc ZPPtr1+1
2016-08-17 06:25:58 +00:00
.8 rts
*--------------------------------------
MAN
SAVE SYS/KERNEL.S.ARG
LOAD SYS/KERNEL.S
ASM