A2osX/SYS/KERNEL.S.ARG.txt

80 lines
1.4 KiB
Plaintext
Raw Normal View History

2016-08-17 06:25:58 +00:00
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)
*\--------------------------------------
2016-09-29 15:30:15 +00:00
K.GetArgC jsr ARG.InitArgPtr1
2016-08-17 06:25:58 +00:00
ldx #0
.1 lda (ZPQuickPtr1)
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
.1 lda (ZPQuickPtr1)
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
.8 >LDYA ZPQuickPtr1
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
2016-08-17 06:25:58 +00:00
>STYA ZPQuickPtr1
rts
*--------------------------------------
2016-09-29 15:30:15 +00:00
ARG.NextArgPtr1 lda ZPQuickPtr1
2016-08-17 06:25:58 +00:00
sec
adc (ZPQuickPtr1)
sta ZPQuickPtr1
bcc .8
inc ZPQuickPtr1+1
.8 rts
*--------------------------------------
MAN
SAVE SYS/KERNEL.S.ARG
LOAD SYS/KERNEL.S
ASM