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
M/C functions for reading zxpand directory contents
M/C functions for reading zxpand directory contents
- Attachments
-
- scat.zip
- software cat. or scat for short :)
- (480 Bytes) Downloaded 188 times
Re: M/C functions for reading zxpand directory contents
Fan bloomin tastic, just what i was after for my ZXtrackprogram
Andy
Andy
what's that Smell.... smells like fresh flux and solder fumes...
Re: M/C functions for reading zxpand directory contents
Now I couldn't possibly have been thinking that when I was playing with pt3demo last night, could I??
You want the source, Andy?
You want the source, Andy?
Re: M/C functions for reading zxpand directory contents
Ooo Ooo yes please...
Andy
Andy
what's that Smell.... smells like fresh flux and solder fumes...
Re: M/C functions for reading zxpand directory contents
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
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
Re: M/C functions for reading zxpand directory contents
Fan dabby dozy.... I'll have a proper look this evening, only poped home for lunch.
Andy
Andy
what's that Smell.... smells like fresh flux and solder fumes...