It is currently Mon Oct 20, 2014 5:45 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Fri Jul 25, 2008 9:50 am 
Offline
User avatar
 WWW  Profile

Joined: Wed Jan 09, 2008 10:23 am
Posts: 359
Location: Glasgow, Scotland
Hi guys,

What I am looking for is a way to obtain the parameters passed to a program. E.g. if I do *MYPROG FILENAME how do I get the filename?

Kind regards,

Francis.


Top
 
PostPosted: Fri Jul 25, 2008 10:59 am 
Offline
User avatar
 Profile

Joined: Mon Jan 07, 2008 6:46 pm
Posts: 380
Location: Málaga, Spain
OSARGS is your friend (AUG P337)!

Code:
 10 osargs_block=&70
 20 FOR N%=0 TO 2 STEP 2
 30 P%=&900
 40 [OPT N%
 50 .start
 60 LDA #1
 70 LDX #osargs_block
 80 LDY #0
 90 JSR &FFDA
100 LDY #0
110 .printloop
120 LDA (osargs_block),Y
130 CMP #13
140 BEQ finished
150 JSR &FFEE
160 INY
170 BNE loop
180 .finished
190 JMP &FFE3
200 ]:NEXT
210 OSCLI "SAVE CAMELS 900 "+STR$~P%


Code:
>*CAMELS HAVE BEAUTIFUL POUTING LIPS
HAVE BEAUTIFUL POUTING LIPS
>


Hope that helps :)


Top
 
PostPosted: Fri Jul 25, 2008 12:25 pm 
Offline
User avatar
 WWW  Profile

Joined: Wed Jan 09, 2008 10:23 am
Posts: 359
Location: Glasgow, Scotland
Thanks Rich! I thought that it was something to do with OSARGS, but I couldn't get my head around how to implement it.

It may be that I was just tired when I was originally looking at the docs, but it's so much more simple when you see written down in code. :)

Kind regards,

Francis.


Top
 
PostPosted: Fri Jul 25, 2008 12:35 pm 
Offline
User avatar
 Profile

Joined: Mon Jan 07, 2008 6:46 pm
Posts: 380
Location: Málaga, Spain
Nah, I don't really think it's very well explained in the AUG - that's why I had to knock up a test to see if my understanding was right! It doesn't seem to actually mention what is returned, or how it's terminated :?


Top
 
PostPosted: Fri Jul 25, 2008 12:37 pm 
Offline
User avatar
 WWW  Profile

Joined: Wed Jan 09, 2008 10:23 am
Posts: 359
Location: Glasgow, Scotland
I'm glad it wasn't just me then! :lol:

Kind regards,

Francis.


Top
 
PostPosted: Fri Jul 25, 2008 4:13 pm 
Offline
User avatar
 WWW  Profile

Joined: Wed Jan 09, 2008 10:23 am
Posts: 359
Location: Glasgow, Scotland
Hi Rich,

There was an error in your code so I have posted a fixed version:

Code:
 10 osargs_block=&70
 20 FOR N%=0 TO 2 STEP 2
 30 P%=&900
 40 [OPT N%
 50 .start
 60 LDA #1
 70 LDX #osargs_block
 80 LDY #0
 90 JSR &FFDA
100 LDY #0
110 .printloop
120 LDA (osargs_block),Y
130 CMP #13
140 BEQ finished
150 JSR &FFEE
160 INY
170 BNE printloop
180 .finished
190 JMP &FFE3
200 ]:NEXT
210 OSCLI "SAVE CAMELS 900 "+STR$~P%

It was just the printloop/loop label that was astray.

Kind regards,

Francis.


Top
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron