I have 1MiB of data I'd like accessible to a program. Obviously, this can't all be loaded into memory at one time, I'd like to be able to load it into ram in chunks of ~1KiB. Has anyone done something like this before?
As far as I can tell, my options are to load an entire file into ram using LOAD, or I can read the file byte by byte using CHRIN. Doing a seek and then a bunch of CHRIN should work, but there doesn't seem to be a seek command (at least for commodore), and using CHRIN to seek is not going to be fast enough (or, at least I assume it wouldn't be).
One strategy I've come up with is to split the file up into 256 chunks of 4KiB, then load files individually. But this is suboptimal for two reason--- first there's a big mess of data files, and second each file needs to contain 4KiB of data, but LOAD needs an extra 2 byte header which will effectively double the disk space needed on a filesystem with 4K blocks. (it's also using bigger blocks than I wanted to use, but that's not really a big deal).
Question
lamb-duh
I have 1MiB of data I'd like accessible to a program. Obviously, this can't all be loaded into memory at one time, I'd like to be able to load it into ram in chunks of ~1KiB. Has anyone done something like this before?
As far as I can tell, my options are to load an entire file into ram using LOAD, or I can read the file byte by byte using CHRIN. Doing a seek and then a bunch of CHRIN should work, but there doesn't seem to be a seek command (at least for commodore), and using CHRIN to seek is not going to be fast enough (or, at least I assume it wouldn't be).
One strategy I've come up with is to split the file up into 256 chunks of 4KiB, then load files individually. But this is suboptimal for two reason--- first there's a big mess of data files, and second each file needs to contain 4KiB of data, but LOAD needs an extra 2 byte header which will effectively double the disk space needed on a filesystem with 4K blocks. (it's also using bigger blocks than I wanted to use, but that's not really a big deal).
Is there something better I don't know about?
Edited by lamb-duhLink to comment
Share on other sites
39 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.