A2osX/SYS/KERNEL.S.ARG.txt
2020-02-06 17:23:59 +01:00

85 lines
1.4 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

NEW
AUTO 3,1
*/--------------------------------------
* # Shift
* ## ASM
* A = argument index.
* ## RETURN VALUE
* CC : success
* Y,A = PTR To Arg[A]
* CS : Out Of Bound
*\--------------------------------------
K.Shift jsr K.ArgV
bcs .9
>STYA ZPPtr1
* >STYA ZPPtr2 already set from ArgV
ldy #$ff
.1 iny
lda (ZPPtr1),y
bne .1
.2 jsr SHARED.AddYp1ToPtr1
ldy #$ff
.3 iny
lda (ZPPtr1),y
sta (ZPPtr2),y
bne .3
tya
beq .8
jsr SHARED.AddYp1ToPtr2
bra .2
.8 ldy #S.PS.ARGC
lda (pPS),y
dec
sta (pPS),y
clc
rts
.9 rts
*/--------------------------------------
* # ArgV
* ## ASM
* A = argument index.
* ## RETURN VALUE
* CC : success
* Y,A = PTR To Arg[A]
* CS : Out Of Bound
*\--------------------------------------
K.ArgV tax save requested arg#
ldy #S.PS.hARGV
lda (pPs),y
jsr K.GetMemPtr
>STYA ZPPtr2 Use Ptr2, called from ExpandStr
.1 lda (ZPPtr2) end of ARGV[] ?
beq .9 yes, not found....
dex
bmi .7
.3 jsr SHARED.GetCharPtr2 skip str
bne .3
jsr SHARED.NextCharPtr2 skip \0
bra .1
.7 >LDYA ZPPtr2
.8 clc
rts
.9 lda #E.OOB
sec
rts
*--------------------------------------
MAN
SAVE USR/SRC/SYS/KERNEL.S.ARG
LOAD USR/SRC/SYS/KERNEL.S
ASM