mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-23 07:35:19 +00:00
57 lines
1020 B
Plaintext
57 lines
1020 B
Plaintext
NEW
|
||
PREFIX /A2OSX.BUILD
|
||
AUTO 4,1
|
||
*/--------------------------------------
|
||
* # GetArg
|
||
* ## ASM
|
||
* **In:**
|
||
* A = argument index.
|
||
* **Out:**
|
||
* CC : success
|
||
* Y,A = PTR To Arg[A]
|
||
* CS : Out Of Bound
|
||
*\--------------------------------------
|
||
K.GetArg pha save requested arg#
|
||
|
||
ldy #S.PS.hARGS
|
||
lda (pPs),y
|
||
jsr K.GetMemPtr
|
||
|
||
plx we want 0 ?
|
||
|
||
beq .8 yes, returns MemPtr
|
||
|
||
>STYA ZPPtr1 no, save it
|
||
|
||
.1 lda (ZPPtr1) end of ARG[]
|
||
beq .9 yes, not found....
|
||
|
||
.3 inc ZPPtr1 skip next one....
|
||
bne .4
|
||
inc ZPPtr1+1
|
||
|
||
.4 lda (ZPPtr1)
|
||
bne .3
|
||
|
||
inc ZPPtr1 ....and point to next, or ending 0
|
||
bne .5
|
||
inc ZPPtr1+1
|
||
|
||
.5 dex
|
||
bne .1 stop here....
|
||
|
||
lda (ZPPtr1) at end of ARGS[] ?
|
||
beq .9
|
||
|
||
>LDYA ZPPtr1
|
||
.8 clc
|
||
rts
|
||
|
||
.9 sec
|
||
rts
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE /A2OSX.SRC/SYS/KERNEL.S.ARG
|
||
LOAD /A2OSX.SRC/SYS/KERNEL.S
|
||
ASM
|