Thursday, 23 July 2015

The Quest for the MSX cross-compilation


My innocent hope was to get MSX cross compiling c/inline z80 assembler working on my Linux.
I thought it would be fairly simple as I already had it running on the Macintosh, and the Linux is supposed to be the coder's friend.

How wrong I was. Well, I didn't destroy anything in a fit of rage, nor did I have to sleep over this, so in a sense this was pretty successful. Also, what I've done here is comparatively simple to actually having done the groundwork, I'm simply trying to get someone else's solutions to work.

Admittedly, some woes came out of my broken Makefile which I had fiddled to get it work on the Mac, making it less general-purpose in the process.

This is not a how-to, just a recollection of how many annoying stages I had to go through.

The evening went something like this:

-Install sdcc from the repositiories. Find out the inline assembler does not compile.
-Get various z80 compilers and fiddle around with the makefile
-Find out that the sdcc version is too new to handle inline z80 in this way
-Remove sdcc
-Get old sdcc sources which won't compile.
-Mess around trying to configure and build the sources, installing stuff like bison in the process.
-Find out the version is too old or inappropriate to build anyways or something.
-Remove sdcc
-Find out there's a ready made version 2.9 that works.
-Download and copy the stuff to /usr/local/bin
-The MSX stuff starts to compile but needs hex2bin
-Get hex2bin sources
-Compile hex2bin
-Copy the stuff to /usr/local/bin
-Now I get the .com out of it but the .dsk outputting does not work. It requires a small thing called wrdisk.
-Find and get wrdisk
-Compile wrdisk
-Copy the stuff to /usr/local/bin
-Install openmsx from the repository
-Find out it does not load anything from disk without a proper MSX system rom.
-Copy the system rom from Macintosh.
-Spend quarter of an hour trying to figure out how openmsx accepts the system rom. From the unnecessarily complex manuals I find it copies into ~/.openmsx/systemroms, but nobody says how to invoke it
-Make several guesses as to what to pass onto the -machine parameter of openmsx.
-Guess correctly that openmsx -machine Toshiba_HX-10 works, even though that is not the filename.
-Find out that as the Toshiba HX-10 does not have a f*cking disk rom, it won't load the .dsk image.
-Copy the MSX2 FS-A1WSX roms but find out the openmsx won't run it as the files are lacking.
-Find out I've actually used a FS-A1WX rom variant, copy them instead.
-openmsx -machine Panasonic_FS-A1WX finally runs an MSX with a disk rom.
-Triumphantly run openmsx -machine Panasonic_FS-A1WX jaa.dsk to run the compiled file...
...to find out the autoexec expects a different name.
-Fiddle some more with the Makefile to get the proper autoexec from the project folder.
-Wait an eternity for the openmsx to boot up and load the command.com and the autoexec and execute the damn file. Curse the entire platform.
-Profit!

I probably can't even remember all the phases. Add to that the constant figuring out of proper terminal syntax and the appropriate folders. Now I'm spent and can't bother to even make the small piece of code adjustment I was supposed to do...

Wow, it was really worth it...

No comments:

Post a Comment