Search the Community
Showing results for tags 'file io'.
I think I'm trying to learn on too many fronts at once here, and I'm starting to go blind on the information I'm trying to absorb - lol.... So reading a file into RAM,VRAM,HIRAM is relatively straightforward using kernal calls. However, I'm a stubborn guy and I don't like the idea of having to pad my files with 2 dummy bytes because of the assumed PRG header, especially when the Kernal easily ignores these and loads the file wherever you tell it to. So I'm trying to write my own loadbin() function that will actually read the first two bytes of the file by using OPEN, CHKIN, and CHRIN. My code is as follows: However, the data I get back seems like some random byte repeated however many times I do cbm_k_getin(); The values returned by cbm_k_open() and chkin(0) are 172, and 3. I'm trying to track down what those return values mean, but just in case I'm doing something dumb and one of the wizards here can easily point out my folly, I thought I'd post here while I keep digging on my own... My understanding is that the first zero in setlfs is just the "file handle ID" - I could make it be 7 or 3 or whatever, so long as it isn't already in use elsewhere, and I'm consistent in chkin() and close(). I also think the second zero in setlfs() "extra address" that gets all the nuance of what the kernal will do.... and this is still kind of opaque to me - ... so, is this a fool's errand? Will CHRIN also skip the first two bytes of a PRG file, or does this seem like the way to achieve my goal? (edited to add: I'm using the host FS and not SDcard images)