English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 11 May 2010, 15:34   #1
oRBIT
Zone Friend
 
Join Date: Apr 2006
Location: Gothenburg/Sweden
Age: 44
Posts: 272
Using ReadArgs() from asm

I was checking out dos/ReadArgs() but came to the conclusion that I don't understand much of the parameters it would require.
My program expects just a single parameter which should be a filename (incl path, if that matters). What should I provide in the template-parameter that ReadArgs() requires?

Thanks in advance
oRBIT is offline  
Old 11 May 2010, 16:00   #2
thomas
Registered User
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 5,946
Code:
	move.l	#template,d1
	move.l	#filename,d2
	moveq	#0,d3
	move.l	DOSBase,a6
	jsr	-798(a6)


template:
	dc.b	"FILE/A",0
filename:
	dc.l	0
The result in D0 is a pointer which you have to pass to FreeArgs when you are done. If D0 is 0, something went wrong and IoErr() will return the reason (which you can then pass to PrintFault() to inform the user). If D0 is non-zero, the longword at filename is filled with a pointer to the file name.


Quote:
What should I provide in the template-parameter that ReadArgs() requires?
The template is what you would expect when you enter commandname ? in a shell window. It has to follow certain syntax rules which are described in the autodocs.

Quote:
My program expects just a single parameter which should be a filename (incl path, if that matters).
You'll get what the user enters. If you need an absolute path, you have to determine it yourself (for example with NameFromLock).

Last edited by thomas; 11 May 2010 at 16:08.
thomas is offline  
Old 11 May 2010, 16:03   #3
oRBIT
Zone Friend
 
Join Date: Apr 2006
Location: Gothenburg/Sweden
Age: 44
Posts: 272
Cool, thanks alot, will try that.. By the way, how did you know about "FILE/A"? What's FILE in this context? Just a name? Or some kind of parametername?
oRBIT is offline  
Old 11 May 2010, 16:04   #4
StingRay
move.l #$c0ff33,throat

StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,374
FILE is the filename and /A means that it is required, i.e. no filename given -> error.

Here's an example from one of my tools:
Code:
TEMPLATE	dc.b	"DISKFILE/A,DIR,WP=WRITEPITCHES/S,SPLIT/S,SH=SAVEHEADER/S",0
Might make it a bit more clear. DISKFILE is a filename for a diskimage and the only parameter that is required, WP,S and SH are optional switches (thus the /S).
StingRay is offline  
Old 11 May 2010, 16:11   #5
thomas
Registered User
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 5,946
Quote:
Originally Posted by oRBIT View Post
Cool, thanks alot, will try that.. By the way, how did you know about "FILE/A"? What's FILE in this context? Just a name? Or some kind of parametername?
I've edited my first post. Please also read the autodocs. FILE is just a name you can specify. It's also a keyword the user can enter to rearrange the arguments (if you had more than one). "/A" means the argument is required.
thomas is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need an ASM manual VoltureX Coders. General 2 17 November 2011 15:24
for ASM programmers meynaf Coders. General 29 05 August 2010 10:00
6502 Asm pmc Coders. General 21 06 November 2008 09:37
ASM Uni Course BippyM Coders. Tutorials 27 18 September 2008 10:37
Looking Barfly asm Oneillsite Coders. General 4 25 September 2006 20:27

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 14:57.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Page generated in 0.06530 seconds with 13 queries