Programming With HuC
The standard HuC installation can produce normal hucard ROM images as well as regular CD and Super CD ISO images.
Developing A HuCard ROM
HuCards are limited to 1mb in size (8 megabits). To generate a HuCard ROM image, use the following syntax from the command line:
This will generate sourcename.pce, which is a standard PC Engine ROM image.
Flash Cart Considerations
By default, HuC builds ROM images with a standard header. Some flash carts do not work well with these images. To generate a ROM image without a header, you will need to do the compile and assemble
huc -s sourcename.c
This will generate, among other things, sourcename.s, which you can then pass to the assembler using the following method:
pceas -raw sourcename.s
This will generate sourcename.pce without the header.
Developing A CDROM
CDROMs use a different overall methodology. First of all, all CDROM games are divided into overlays. Generally speaking, overlays come in two kinds: executable and data. Second of all, executable
overlays have to fit into the system card RAM (64KB for system 1 and 2, 256KB for system 3). When developing overlays for system 3, the first overlay has a limit of 192KB rather than 256KB due to
the 64kb warning screen subprogram that is also part of that overlay. Data overlays have no such restrictions. To generate an overlay use the following syntax:
huc -scd -over sourcename.c
This will generate a Super CD overlay called sourcename.ovl. To build a regular CD overlay instead, use -cd instead of -scd. You can have up to 50 overlays in total. In order to create an ISO,
you use the isolink program:
isolink myiso.iso sourcename.ovl anythingextra.ovl
This will generate myiso.iso and the CD will boot with the code in sourcename.ovl.
CD projects would be rather useless without variable sharing between executable overlays. In order to share variables between overlays, create a globals.h file in your project. You do not
need to #include this file; it's included automatically. Everything inside this header will be available to all overlays in your project. HuCard projects do not need this file.
HuC has a number of directives that can be used to include various resources into your project.
#include inserts a header or a source code into the program. To use HuC, you will need to #include the huc.h header into every program.
HuC supports the char and int variable types. char is 8-bit unsigned (0 to 255) and int is 16-bit signed (-32768 to 32767). Single-dimension arrays are