File pointers in CC65!
File pointers in CC65!
So for some reason I only now started playing with CC65's file i/o.
And... it looks like it just works. I haven't tried *real* things yet, but this opens up my horizons.
File pointers in CC65!
R38? SD image or host FS?
I suspect either 38 or 39 will work if using SD.... I'll be dealing with file IO fairly soon myself and any advice you have will be most helpful.
File pointers in CC65!
R38 appears to work with an SD image.
I'm going to try opendir() to read directory contents next.
File pointers in CC65!
I'm going to need to either read a file byte by byte or else just pull pieces in at a time, so if cc65's fread () works right out of the box, that will be quite nice. I presume this code fails when using the host FS?
File pointers in CC65!
Yes, only the load and save functions work on the emulator's filesystem.
Standard I/O and POSIX I/O work on the SD filesystem as the standards say that they should. However, subdirectories don't exist in CBM DOS. Therefore, those functions might not work in CMNDR DOS as you would expect.
File pointers in CC65!
R38
I've just attempted to write a file to the SD image... and I think it works.
Yes, it works. Just don't mount the image on your computers file system at the same time you're running code on the X16 to modify that image.
File pointers in CC65!
4 hours ago, Greg King said:
Yes, only the load and save functions work on the emulator's filesystem.
Standard I/O and POSIX I/O work on the SD filesystem as the standards say that they should. However, subdirectories don't exist in CBM DOS. Therefore, those functions might not work in CMNDR DOS as you would expect.
I will be attempting directory reads next, so I'll find out what happens.
I know it's no guarantee, but 16DOS knows to at least acknowledge the existence of dirs.
File pointers in CC65!
How many files can a directory have? Is it typical for the image filesystem?
I'll go check.
"CBM-DOS for FAT32 SD cards"
Well let's see what FAT32 can handle first. (268 million files for 32kb clusters).
And now to see if we have any limitations on that.
-
- Posts: 952
- Joined: Fri Mar 19, 2021 9:06 pm
File pointers in CC65!
FAT32 has a limit of 65536 files in a given directory, but!
Two are already used for the current and parent (. & ..) entries in subdirectories but not the root.
If a file has a simple 8.3 file name, then it only takes one entry. If a file has a long file name, it takes a variable number of entries (one extra entry per 13 characters in the LFN).
File pointers in CC65!
45 minutes ago, Scott Robison said:
FAT32 has a limit of 65536 files in a given directory, but!
Two are already used for the current and parent (. & ..) entries in subdirectories but not the root.
If a file has a simple 8.3 file name, then it only takes one entry. If a file has a long file name, it takes a variable number of entries (one extra entry per 13 characters in the LFN).
Thank you for ALL of that. The 8.3 AND the 2^16 - 3 limits. That helps me plan.
So let's see. The filenames I want to use will be larger than 8.3. Call it two entries.
Maximum files per directory is therefore around 32,700.
Not a problem at all.