[Coco] Creating and loading big machine code files into RSDOS
Mark McDougall
msmcdoug at iinet.net.au
Mon Feb 13 21:36:01 EST 2017
On 14/02/2017 9:48 AM, Glen Hewlett wrote:
> Is there an easy way that doesn’t require me to make my own disk
> loader program? It would be amazing if such a feature was built in
> to lwasm.
Here's what I've done in the past... keeping in mind that my development
is done on a PC and the build process creates a floppy disk image as one
of its outputs.
For binary data, it's relatively trivial to write a quick C program that
takes a raw binary chunk of data and turns it into an RSDOS .BIN file
that self-loads directly into whatever page(s) of memory you like.
Essentially all you need to do is inject a handful of bytes into the
file at strategic points and save it as a .BIN file. I'd suggest you run
this program each time as part of your build process, so that you may
modify your raw data file at will throughout development.
For the code, you can do exactly the same, as long as your starting
point is a raw binary image of the assembled code, and not a .BIN file.
If that's not possible, technically you can actually modify the existing
.BIN file, but it's easier to start with a raw image.
I always found this the most convenient as there's no stuffing around
with loaders and such, aside from a 2-line BASIC loader that LOADM's
your data and then your code. Written properly and part of the build
process, it's still possible to resize and move data around, for
example, and not have to change your 'loader' code at all.
In your case, with more than 32KB of binary, it's a little different but
for Lode Runner (demo) and Knight Lore, both less than 32KB, a single
(raw) binary image gets assembled at $8000. That becomes the cartridge
image, and then the above-mentioned C program is run on it to create a
single .BIN file that is subsequently loaded from floppy. The advantage
is the exact same build for both cartridge and floppy versions; less
configuring and no chance of bugs on one format that don't appear on the
other!
Let me know if you want any more details on any part of the process.
Regards,
--
Mark McDougall
<http://retroports.blogspot.com.au>
More information about the Coco
mailing list