There's a couple of ways to get HuC set up. Fortunately, it's an independent compiler so it doesn't rely on anything else, unlike virtually all other toolchains. I'm going to describe the way I do things, and I'll also explain why I deviate from the "normal" way it's done.
First of all, download it from zeograd.com. Unzip all the files to somewhere you will remember for later. Now, the best thing to do is to make a
copy of the files you're going to need for your project.
Create a project folder. I personally have it set up like this:
C:\pceprojects\projectnameso if you have a project called MyLeetThing, you would have
C:\pceprojects\MyLeetThingNow, copy the required files
into this directory. You will need, at the very least, the contents of
include/pce inside the HuC files. I always copy the files themselves, not the folder. If you plan on making CDs, you will also need
overlay.h that is just in
include/. That's all the library files. Now you'll need the compiler files. At least, you will need
huc and
pceas. These are in the
bin/ directory. If you plan on making CDs, you will also need
isolink. You won't need
pcxtool or
nesasm.
The reason I copy the files like this is because I quite often modify the library, and different games have different library requirements. You could always put the executables in your path somewhere if you want. Anyway, once you have the files copied into your project directory, you can start making your project.
If you're making a hucard project, it's pitifully easy to get something running quickly. Making a CD project is a hell of a lot more involved so I won't get into that here. Just make a C file (no C++ here, folks), call it whatever you want. So, you could make like
MyAwesomeGame.c.
There's only one major detail for your source: you need to
#include "huc.h". Also,
main() doesn't take any arguments... sorry, no argv/argc here.
Everything else... is up to you.
HuC uses a limited form of SmallC. One of the most immediately noticeable details of this is how functions are used. To make a function in "normal", modern C, you would do this:
void function MyFunkyFunc(int argument1, char argument2)
However, here in HuC land, you would do it more like this:
function MyFunkyFunc(argument1, argument2)
int argument1;
char argument2;
If you're used to modern C, that takes some getting used to.
Compiling... to make a Hucard, the only thing you really need to do is this from the command line:
huc MyAwesomeGame.cand that will give you
MyAwesomeGame.pce as long as nothing's broken. You can then run it in any PCE emulator. I prefer
Mednafen for accuracy.
I hope this all helps.
EDIT: Jumping the gun a lil bit... if you want to make CDs, there are a
lot more steps. First of all, you create what are called "overlays". There are two main types: executable and data. Executable overlays contain program code, data overlays contain... well, data. Your first overlay is going to be overlay 1. This needs to be an executable overlay, as it will be the one that is run when the system card loads the CD.
If you want to share data between executable overlays, you need to create a new file called
globals.h. This will contain any variables that you want to be available to all of your programs. You can also put useful
#defines here too... I do that a lot, it's useful for making a list of overlays, for example.
Compiling for CD is also different. What you do now are compile overlays rather than ROMs. So:
huc -scd -over MyAwesomeGame.cwill create
MyAwesomeGame.ovl as a System 3 overlay (you can use -cd to make a System 2 overlay, but the HuC overhead is too big to do anything serious in System 2 except for making a cderror program, so it's best to stick with System 3). After that, you need to link it using
isolink:
isolink MyAwesomeGame.iso MyAwesomeGame.ovlwhich will make an ISO that you can run in an emulator, or burn to CD.
You can also make a cuesheet with a warning track, game music files, etc...