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

All times are UTC [ DST ]




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: DFS test in BASIC
PostPosted: Sat Jun 18, 2011 11:45 pm 
Offline
Site Admin
User avatar
 Profile

Joined: Wed Dec 19, 2007 10:46 pm
Posts: 779
Hi,

Is there a simple test I can use in BASIC to determine whether a DFS is present without using PAGE?

Sam.


Top
 
 Post subject: Re: DFS test in BASIC
PostPosted: Sun Jun 19, 2011 2:47 am 
Offline
Site Admin
User avatar
 Profile

Joined: Wed Dec 19, 2007 10:46 pm
Posts: 779
Actually, it doesn't look like I need this anyway. Though it be handy to know anyway if anyone has any ideas?

Sam.


Top
 
 Post subject: Re: DFS test in BASIC
PostPosted: Sun Jun 19, 2011 10:33 am 
Offline
Site Admin
User avatar
 Profile

Joined: Wed Dec 19, 2007 10:46 pm
Posts: 779
I woke up with the obvious idea of using ON ERROR. Must remember to sleep on it next time!

Sam.


Top
 
 Post subject: Re: DFS test in BASIC
PostPosted: Sun Jun 19, 2011 12:32 pm 
Offline
Site Admin
User avatar
 Profile

Joined: Wed Dec 19, 2007 10:46 pm
Posts: 779
hmm ... actually that doesn't quite do what I want. That'll tell me if a DFS is present but not whether it's the currently selected filing system which I think is what I'm really after.

Is there a memory location I can query which will tell me?

Sam.


Top
 
 Post subject: Re: DFS test in BASIC
PostPosted: Sun Jun 19, 2011 1:02 pm 
Offline
User avatar
 Profile

Joined: Sun Jun 28, 2009 11:37 pm
Posts: 55
OSARGS 0,0 will do that...

Code:
A%=0:Y%=0:FS%=USR&FFDA AND&FF

FS% now contains the current file system.

See here for a list of values http://beebwiki.jonripley.com/OSARGS


Top
 
 Post subject: Re: DFS test in BASIC
PostPosted: Sun Jun 19, 2011 1:05 pm 
Offline
 Profile

Joined: Sun May 02, 2010 2:07 pm
Posts: 42
blast typed too slow.

Anyway 'A' will then return the current filing system, figured you might be using machine code.


Top
 
 Post subject: Re: DFS test in BASIC
PostPosted: Sun Jun 19, 2011 2:15 pm 
Offline
Site Admin
User avatar
 Profile

Joined: Wed Dec 19, 2007 10:46 pm
Posts: 779
Thanks, Pauls!

PaulDv's code is exactly what I was looking for. It's going in a BASIC menu, so that fits the bill perfectly.

Sam.


Top
 
 Post subject: Re: DFS test in BASIC
PostPosted: Mon Aug 08, 2011 3:18 am 
Offline
 Profile

Joined: Sat Aug 22, 2009 7:45 pm
Posts: 34
Samwise wrote:
PaulDv's code is exactly what I was looking for. It's going in a BASIC menu, so that fits the bill perfectly.
You shouldn't unnessessarily restrict your program's functionality when it's running on DFS unless it's absolutely neccessary. Especially, don't make your program jump through complicated hoops for DFS when non-specific filing systems calls do the job just as well. I've seen abominations of code that effectively do:
IF (NOT DFS) THEN use API to read directory
ELSE VDU 21, *CAT, VDU 6, peek memory

when the correct code is just... use API to read directory.

Also, as some filing systems that respond with fs=4 have more functionality than Acorn DFS (eg HDFS, WatfordDFS), and some filing systems that respond with fs<>4 actually have the same functionality as DFS (eg RetroRAMFS), in some cases a better test is: dfs%=FNfile("$",5)<>2. See the Wiki article.

(PS: Is there any way to get inline code in the above paragraph, not having appear as a seperate paragraph?)


Top
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 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