Need some help compiling INERTIA

Door Gregory

Master (178)

afbeelding van Gregory

18-12-2019, 19:12

I want to take some bab-steps in the C-language and I found a website that gave some pointers on how to compile a MSX-game.
http://andrear.altervista.org/home/inertia.php
I use SDCC 3.6.0.
In step 3 it's mentioned to replace crt0,o in lib/z80/crt0.o
However there is no crt0.o file in that directory, there's just the following files:
crt0.rel ; z80.lib ; z80.save
So what do I have to do with this crt0.o-file?

The next step is to go into sdcc/msx/inertia directory and compile.
If I look in that directory, there are a lot of .c files ( main.c, msx.c, msxio.c,...).
So I don't really know what files I need to compile and what the commandline instruction should be. I have seen something like:
'sdcc -mz80 --no-std-crt0 --vc --code-loc 16384 main.c'

But I don't know if that is the correct instruction for this example.
So I hope someone can help me along and push me in the right direction so I can compile my first C-program.

Aangemeld of registreer om reacties te plaatsen

Van pgimeno

Champion (302)

afbeelding van pgimeno

19-12-2019, 02:56

I typed 'make' and it built and ran fine.

Disclaimer: I'm on Linux. I had SDCC installed from my distribution. I don't have a crt0.o in this compiler, yet it still worked all the same.

To ensure it builds, first type 'make clean', as the zipfile comes with all files generated by the build, and 'make' won't find any files that need building in these conditions.

I had to change the makefile to remove the path and the .exe suffix, since they are in the system path. You may need to edit it too, or not. You may need to set the environment variable SDCC_HOME if you don't edit it.

The makefile requires some standard POSIX utilities: dd and (GNU) awk. This probably means you need a POSIX-type shell like msys or Cygwin.

And of course, you need make (preferably the GNU version).

Or you can run it from Linux as I did. Debian comes with sdcc, so I presume Ubuntu does too.

Van Gregory

Master (178)

afbeelding van Gregory

19-12-2019, 17:58

Hey, thanks for your input.
I found UnixUtils and I put make, dd, rm,sed and gawk in the same directory as the inertia files.
When I type 'make clean', I get: 'make: ***No rule to make 'target' clean'. Stop.
So my build stops in a hurry.

Can you maybe give some more info on how to change the make-files.?

Van Gregory

Master (178)

afbeelding van Gregory

19-12-2019, 18:04

I would also like to give you the payh the way it's on my system:
Program Files --> SDCC --> MSX --> Inertia (files)

Van pgimeno

Champion (302)

afbeelding van pgimeno

19-12-2019, 19:18

Gregory wrote:

Hey, thanks for your input.
I found UnixUtils and I put make, dd, rm,sed and gawk in the same directory as the inertia files.
When I type 'make clean', I get: 'make: ***No rule to make 'target' clean'. Stop.
So my build stops in a hurry.

Can you maybe give some more info on how to change the make-files.?

When I unzip inertia.zip, a file called 'Makefile' is decompressed. You need to execute 'make' from the directory where this file is. make will try to open Makefile in the current directory. If it does not work that way for you, there's a problem, and I don't know how to help you.

I edited the makefile with the following changes:

I changed this line:
CC='$(SDCC_HOME)'/bin/sdcc.exe
to:
CC=sdcc

I also changed this line:
MAKEBIN='$(SDCC_HOME)'/bin/makebin
to:
MAKEBIN=makebin

After that, it worked for me in Linux. That is not necessary for 'make clean' though.