From some times now, we have C compilers for 68K modified to output Genesis rom.
I was always looking for a good IDE.
I know Stef's using Code::Blocks but ...I just don't like it myself.
Since I use Eclipse at work, I tried to use it at home too!
Here is how to do it.
Don't forget, you'll have to test yourself which one between Eclipse and Code::Blocks suits your need!
For Eclipse, I think you sould try Yoxos Ondemand , it allows you to download an all-in-one page (Eclipse + CDT Plugin + other plugins of your choice)
So, select Eclipse C/C++ Development Tools (CDT), accept to add Eclipse core files and then, Start Download
You now have 2 Zip files : GenDevKit04 and eclipseXXXXX.zip
Create a directory for Genesis development only, WITHOUT space or special chars (got some problems with them so...avoid!)
Unzip your 2 files there, rename GenDevKit one as "sdk" and create a directory called "projects".
You're now ready!
Setup
Open eclipse
Browse to your "projects" folder and don't forget to check the "Use this as the default and do not ask again"
The workspace is where every project created on Eclipse will be physically created / saved.
The first time I launched Eclipse, I was totally lost when I saw this screen :
Don't panic ! You just need to click the "Workbench" button.
There, select Windows>Preferences...
First, select General>Workspace and click this damn 'Save automatically before build' checkbox
Optionnaly, you could uncheck the 'Build automatically' if you have a low powered PC (or use Vista)
In, C/C++ > Environment, add your SDK\bin path
Be sure "Append variables to native environnement" is selected
That's all, your workspace is now correctly installed !
►Part 2 : First demo
Stef's partic
Stef's GenDevKit comes with a demo called "partic".
Follow these steps to compile it under Eclipse
First we need to create a project called "partic" with File>New>Project...
Create a "General" project
Call it "partic"
You could see "Use default location" is check and where your project "partic" will be save (for me e:/megadrive/projects/partic"
You must now add your source files.
Right click on your project and select "Import..."
Select General>File system...
Browse to your sdk\sample\partic folder
Select all the files and add them
We must also add the makefile
Same thing but browse to yout sdk\bin folder
Only add "makefile.gen"
Rename "makefile.gen" as "makefile"
Update makefile
The makefile included in Stef's GenDevKit is perfect for classic use.
But I updated it to be more flexible
It's very easy, I really dislike hard coded path so I used a variable to store GenDevKit path!
Here it comes :
#use only / and \ on path
GDK= D:/dev/megadrive/sdk/
CC= $(GDK)bin/gcc
OBJC= $(GDK)bin/objcopy
ASMZ80= $(GDK)bin/asmz80
BINTOC= $(GDK)bin/bintoc
I choose Eclipse CDT because, in fact, it handles makefile project.
So, all the power is only in this makefile. Eclipse doesn't care of which compiler, which system you compile for, etc... yes, you could use this same environment to develop for PSP if you want!
But for that, we must have a "Makefile project"
At this time we have a "General project" so....
Right click on project, New>Convert to a C/C++ Make Project
We came from C language so be sure to select it
At this time, Eclipse could ask you to switch to C/C++ perspective, answer yes since we need a view from this perspective
You know have a "Make" view (it must be full right ), right click on 'partic' to add a target
You can now add your "Make" target
Some info for future use Target name is the name shown on the Make view Make Target is the target (!) asked to make like 'all','clean', 'debug'....leave it blank by default
Build comand is the command to call
So, if you want, you'll be easily able to call something like
make -f mymakefile
make clean
Right click on the 'partic' target you just created and select 'Build target'
(optionnal if you checked 'Build automatically')
et voilà!
Now, if you want, you can make some change to partic code.
All you need to do is right click on partic Make target and...Build target!
►Part 3 : Debugging
As you should know, Gens KMod lacks some features to be a 'really' debugger like trace, breakpoint.
It's why I added 2 ways to inspect your value : debug register and watchers.
The debug register is a new register I added to let you send informations from your code to Gens KMod console.
The watchers lets you 'watch' rom or ram addresses.
If the debug register is easy to use, the watcher is only usable for hacking an existing game...since your code-defined variable addresses change each time you compile.
You so have to find each of your variable addresses and enter each one in watchers list....very boring!
While talking with Fonzie about a way to do this, he talked me about map.exe and nm.exe, after some hours, nm2wch was born.
This little tool is very useful : it creates the watcher list for you !
First you need nm.exe from binutils package, since it's not included in GenDevKit.
Then nm2wch for my website.
Copy these two tools in sdk\bin and modify your makefile
These lines
- create a textfile describing your variables (rom.nm)
- convert this formatted textfile to a GensKMod watcher file
Unfortunatly, we have a problem : nm can't output directly to a textfile, it's why I use >rom.nm
But this command will produce an error if you try to build your makefile make: /bin/sh: Command not found
What is /bin/sh ?!! sh.exe is the default shell gcc is looking for.
We could download and copy it on our sdk\bin folder OR, for Windows users, change the default shell to existing one adding a single line at the top of the makefile
SHELL = c:/windows/system32/cmd.exe
Ok now, if your makefile successfully produce your rom with its linked rom.wch, launch Gens Kmod 0.7b+
Be sure "Auto load watchers & structures" is selected in Options>Debug...
Open your rom and open the watchers window : all your variables are here, you can now easily follow their values while playing !
►Part 4 : Setup additional tools
Maccer
Maccer is a tool I can't live without !
I often produce my gfx or sound files with my own tools, so I use Maccer to include them.
It's a replacement for 'bintoc', included in GenDevKit.
I made my own version of Maccer to support every Genesis C compilers.
For more info and to download it, see MaccerX page
UCON64
I use UCON64 to fix the checksum, pad the rom and convert it to a SMD file.
If you have a backup device, you also could send the produced rom directly to your backup device!
It's a replacement for 'objcopy', included in GenDevKit.
Just download and unzip it to our sdk\bin folder and modify the makefile to use it
$(UCON)=$(GDk)bin/ucon64/ucon64
GenRes
GenRes is my last gift to the genny dev scene.
If you already made some Windows development, you should be familiar with WinRes. GenRes is similar.
Throught a resource file, you can define resource to be used in your game.
Include bitmap, sound and much more WITHOUT additional tools.
You no longer need b2t or mmm, they are now available throught GenRes.
And if you want to add support to your own resource, just write the plugin needed !
Oh, and since a lot of you use Pascal's genitile, I wrote a plugin to access genitile features from GenRes.
For more info and to download it, see GenRes page.