M/C functions for reading zxpand directory contents

Any discussions related to the creation of new hardware or software for the ZX80 or ZX81
Post Reply
sirmorris
Posts: 2811
Joined: Thu May 08, 2008 5:45 pm

M/C functions for reading zxpand directory contents

Post by sirmorris »

Here's a couple of functions which may be useful. It's V0.1 at the moment, the later code will have a couple of must-have features... But for now this is a way to read directory contents from a zxpand card one file at a time. I could have done it so it reads the whole lot in one go, but this way needs less memory. I might change this if demand is there.

The directory data is written directly into A$. The next version will let you specify which string to use though.

You have 2 functions, roughly equivalent to 'find first file' and 'find next file'.

If A$ is not defined or empty when you call 'find first file' then the contents of the current working directory will be returned.
If A$ contains a relative or absolute directory path, then content from the appropriate directory will be returned.

If the requested directory is empty, then A$ will be untouched and USR will return 0 which indicates no files are present. Otherwise A$ will contain the name of the first file or sub-folder and 65535 will be returned.

Now you should repeatedly call 'find next file', which will return 65535 and a name in A$, else 0.

Job done!


'find first file' = 16514
'find next file' = 16516

Example program follows. I am considering making a code suite for memory at 8K. Or REM. Or above RAMTOP. Or just relocatable so you can stick it wherever you want :)

C
Attachments
scat.zip
software cat. or scat for short :)
(480 Bytes) Downloaded 188 times
User avatar
Andy Rea
Posts: 1606
Joined: Fri May 09, 2008 2:48 pm
Location: Planet Earth
Contact:

Re: M/C functions for reading zxpand directory contents

Post by Andy Rea »

Fan bloomin tastic, just what i was after for my ZXtrackprogram

Andy
what's that Smell.... smells like fresh flux and solder fumes...
sirmorris
Posts: 2811
Joined: Thu May 08, 2008 5:45 pm

Re: M/C functions for reading zxpand directory contents

Post by sirmorris »

Now I couldn't possibly have been thinking that when I was playing with pt3demo last night, could I?? 8-)

You want the source, Andy?
User avatar
Andy Rea
Posts: 1606
Joined: Fri May 09, 2008 2:48 pm
Location: Planet Earth
Contact:

Re: M/C functions for reading zxpand directory contents

Post by Andy Rea »

Ooo Ooo yes please... :D

Andy
what's that Smell.... smells like fresh flux and solder fumes...
sirmorris
Posts: 2811
Joined: Thu May 08, 2008 5:45 pm

Re: M/C functions for reading zxpand directory contents

Post by sirmorris »

There you go, it assembles with tasm.

It's about as minimalist as I can get it. I would like to use the routines in ROM, but I didn't get my act together and use entry vectors .. .well they're the luxury of the byte-rich so I guess I shouldn't be so hard on myself ;)


C
Attachments
main.zip
(2.82 KiB) Downloaded 171 times
User avatar
Andy Rea
Posts: 1606
Joined: Fri May 09, 2008 2:48 pm
Location: Planet Earth
Contact:

Re: M/C functions for reading zxpand directory contents

Post by Andy Rea »

Fan dabby dozy.... I'll have a proper look this evening, only poped home for lunch.

Andy
what's that Smell.... smells like fresh flux and solder fumes...
Post Reply