A2osX/SYS/KERNEL.S.ARG.txt

57 lines
1020 B
Plaintext
Raw Normal View History

2017-12-22 21:24:30 +00:00
NEW
PREFIX /A2OSX.BUILD
2017-12-22 21:24:30 +00:00
AUTO 4,1
*/--------------------------------------
2018-06-18 06:22:50 +00:00
* # GetArg
* ## ASM
2018-06-14 15:31:36 +00:00
* **In:**
* A = argument index.
* **Out:**
* CC : success
* Y,A = PTR To Arg[A]
* CS : Out Of Bound
*\--------------------------------------
2018-06-14 15:31:36 +00:00
K.GetArg pha save requested arg#
2016-08-17 06:25:58 +00:00
2018-06-22 06:24:35 +00:00
ldy #S.PS.hARGS
2016-08-17 06:25:58 +00:00
lda (pPs),y
2018-06-21 15:12:10 +00:00
jsr K.GetMemPtr
plx we want 0 ?
2018-06-14 15:31:36 +00:00
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
2017-01-12 17:43:45 +00:00
inc ZPPtr1+1
.5 dex
bne .1 stop here....
lda (ZPPtr1) at end of ARGS[] ?
beq .9
2018-06-14 15:31:36 +00:00
>LDYA ZPPtr1
.8 clc
rts
.9 sec
rts
2016-08-17 06:25:58 +00:00
*--------------------------------------
MAN
SAVE /A2OSX.SRC/SYS/KERNEL.S.ARG
LOAD /A2OSX.SRC/SYS/KERNEL.S
2016-08-17 06:25:58 +00:00
ASM