Re: Switching to R43 frustration
Posted: Wed Jul 19, 2023 2:18 am
So, I'm back on the project I had to put on hold for being too unable to figure out the cult that is the file indexes.
The first FA used on a file needs to be unique in the range of 0 to 14. As a purist, I would never use 0. It's just wrong. Always burn the 0 entry. But that's just a personal peeve of mine, 0 should be reserved for "not connected / unused."
If the Command Channel is used for a subsequent command instruction for that channel, it also has to be unique. It makes SENSE to use 15 as it's guaranteed to only be needed for the one command function and it will be released. So you can basically reuse 15 at will for this purpose.
After that... I'm thinking you should never use LOAD or SAVE. Just OPEN the connection and use CHKIN or CHKOUT to decide at that point if it's reading or writing, do the reads or writes... then close the file.
I Think OPEN is supposed to set the carry flag on fail, but it doesn't. So if you're trying to read, what you do is set the A to $FF before you start reading and after you pull in the first 2 bytes (The location header, which you should use even if you're not using the LOAD command to do it automatically.) then you can test those bytes against $FF... they're either going to be the expected address, or $FFFF Not the address? Close the file and roll with whatever failure handling you want.
I don't think it matters if you have one leading / or two. Either condition means "From root." and the omission of it means "From the stored path." But here's the rub... YOU don't get direct access to the path. It seems to be private to the implementation and there's no interface except for changing the current path with the command channel using CD. When you do that, you can get the new path. But you gotta remember it in parallel to the system.
If I'm wrong on that, and there IS a direct KERNAL call for that, tell me!
I think I've found a "bug"? There is nothing stopping you from changing directory with the .. directory when you are already at the root. It won't be in the directory list, and the system will stop you from actually modifying the path, but I suspect the hostfs implementation lets that slide and breaks some kind of sync with the system. If I can find a better bug trail I'll post it.
The first FA used on a file needs to be unique in the range of 0 to 14. As a purist, I would never use 0. It's just wrong. Always burn the 0 entry. But that's just a personal peeve of mine, 0 should be reserved for "not connected / unused."
If the Command Channel is used for a subsequent command instruction for that channel, it also has to be unique. It makes SENSE to use 15 as it's guaranteed to only be needed for the one command function and it will be released. So you can basically reuse 15 at will for this purpose.
After that... I'm thinking you should never use LOAD or SAVE. Just OPEN the connection and use CHKIN or CHKOUT to decide at that point if it's reading or writing, do the reads or writes... then close the file.
I Think OPEN is supposed to set the carry flag on fail, but it doesn't. So if you're trying to read, what you do is set the A to $FF before you start reading and after you pull in the first 2 bytes (The location header, which you should use even if you're not using the LOAD command to do it automatically.) then you can test those bytes against $FF... they're either going to be the expected address, or $FFFF Not the address? Close the file and roll with whatever failure handling you want.
I don't think it matters if you have one leading / or two. Either condition means "From root." and the omission of it means "From the stored path." But here's the rub... YOU don't get direct access to the path. It seems to be private to the implementation and there's no interface except for changing the current path with the command channel using CD. When you do that, you can get the new path. But you gotta remember it in parallel to the system.
If I'm wrong on that, and there IS a direct KERNAL call for that, tell me!
I think I've found a "bug"? There is nothing stopping you from changing directory with the .. directory when you are already at the root. It won't be in the directory list, and the system will stop you from actually modifying the path, but I suspect the hostfs implementation lets that slide and breaks some kind of sync with the system. If I can find a better bug trail I'll post it.