[Close window]

MSX - The I.N.E.R.T.I.A. Howto

How to install sdcc compiler, additional tools and files, I.N.E.R.T.I.A. source code, and how to compile it. Instructions are for Windows, but similar steps could be done on Linux machines. Please also note that I need some feedback from you to know if suggested steps effectively work! Thanks in advance.

1. install sdcc

Download the executable installer from http://sdcc.sourceforge.net. If you have "limited user" privileges under Windows, you may want to install it in your own directories instead of the usual "Program Files" folder, to have full access to sdcc tree and do any kind of mess on it. I know it's not very good style, but it's a bit easier to manage.

2. install split

You'll also need to add to the sdcc/bin directory the free GNU utility named split, version for Windows. SDCC builds a binary image of 64KB, and our 16KB ROM lies in the 2nd quarter of the image. So we'll split file in four chunks and retrieve the second one, naming it "inertia.rom".

I found a Windows version of GNU split searching on Google for "UnxUtils"; you can download the binaries from http://sourceforge.net/projects/unxutils.

Note: any file utility allowing to "cut" a binary file could be used there; a good alternative may be the (more general) dd file manipulation utility, which requires a bit of commandline options: input and output file name, block size, offset... both dd and split are available in the UnxUtils package.

3. replace crt0.o

When you build an executable with a C compiler, it usually adds module crt0.o as a header to the linked executable file. You'll have to replace standard lib/z80/crt0.o with one explicitly designed to work as an MSX ROM header. Original author of this file is the Japanese MSX user Boukichi, I just added at bottom the standard initrleblock routine, I think it's needed for sdcc to handle correctly static strings and arrays of strings.

Warning: crt0.o contains the hardcoded value of 0x4000 as starting address for the ROM. If you want to build for instance ROMS starting at 0x8000, you'll need to change that hardcoded value accordingly.

[Download here crt0.o, object file to build a 16KB ROM at 0x4000]
[Download here crt0msx.s, source file to build a 16KB ROM at 0x4000]

4. add sdcc-msx.bat startup file

It's easier to start work with sdcc by simply clicking an icon. I wrote my simple batch startup file and put it in main sdcc directory, you may use it too. Just remember to change the full sdcc/bin pathname according to your installing path. To check a correct startup file, you could type sdcc on command line (you should see the help screen for options).

[Download here sdcc-msx.bat file].

5. extract I.N.E.R.T.I.A. sources

Go to sdcc main directory and simply unpack the source tree from zip file. Your sdcc tree should now be something like this:

[Download here ZIP file with sources]

6. compile!

If all steps were right, you could now start sdcc, go into sdcc/msx/inertia directory, and try compiling. You may also want to have a look inside make.bat, to see what options were passed to the compiler and how the final ROM image was obtained.

Hope you enjoy and build without too much pain. Please drop me a line to confirm that everything works as expected, thanks in advance.

Andrea