From 017b802e26f507bedce15b324eda301ac68eb960 Mon Sep 17 00:00:00 2001 From: Kaminari Kagemusha Date: Fri, 14 Aug 2026 15:51:36 +0200 Subject: [PATCH 1/9] Rename things.todo to doc/huc/things.todo Obsolete TODO notes from HuC4. --- things.todo => doc/huc/things.todo | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename things.todo => doc/huc/things.todo (100%) diff --git a/things.todo b/doc/huc/things.todo similarity index 100% rename from things.todo rename to doc/huc/things.todo From 4739a10baded670b5f2df3e8f4855c78ab311ff7 Mon Sep 17 00:00:00 2001 From: Kaminari Kagemusha Date: Fri, 14 Aug 2026 15:53:50 +0200 Subject: [PATCH 2/9] Rename whats.new to doc/huc/whats.new Release notes for HuC4. --- whats.new => doc/huc/whats.new | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename whats.new => doc/huc/whats.new (100%) diff --git a/whats.new b/doc/huc/whats.new similarity index 100% rename from whats.new rename to doc/huc/whats.new From de25b7bb1362978df93507e68cd7c8baa9426a6a Mon Sep 17 00:00:00 2001 From: Kaminari Kagemusha Date: Fri, 14 Aug 2026 15:56:18 +0200 Subject: [PATCH 3/9] Rename README to doc/huc/huc4_doc.txt Obsolete README from an early version of HuC4. --- README => doc/huc/huc4_doc.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename README => doc/huc/huc4_doc.txt (100%) diff --git a/README b/doc/huc/huc4_doc.txt similarity index 100% rename from README rename to doc/huc/huc4_doc.txt From c5285963bf801fc7ffec37f6673d9d1430dc303d Mon Sep 17 00:00:00 2001 From: Kaminari Kagemusha Date: Fri, 14 Aug 2026 15:57:28 +0200 Subject: [PATCH 4/9] Rename huc_doc.htm to huc3_doc.htm Changed file name from "huc_doc" to "huc3_doc". --- doc/huc/{huc_doc.htm => huc3_doc.htm} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename doc/huc/{huc_doc.htm => huc3_doc.htm} (100%) diff --git a/doc/huc/huc_doc.htm b/doc/huc/huc3_doc.htm similarity index 100% rename from doc/huc/huc_doc.htm rename to doc/huc/huc3_doc.htm From 4ac9abe0669c02dcfec6371d3ab9c9cff3d7596d Mon Sep 17 00:00:00 2001 From: Kaminari Kagemusha Date: Fri, 14 Aug 2026 16:37:13 +0200 Subject: [PATCH 5/9] Create README.md New README presentation for HuCC. --- README.md | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 00000000..f58d34a4 --- /dev/null +++ b/README.md @@ -0,0 +1,62 @@ + + +What is HuC? +------------ + +HuC is a C compiler for the NEC PC Engine consoles (CoreGrafx/TurboGrafx), initially developed by David Michel around 1999. HuC was an upgraded version of Ron Cain's SmallC, and as such it inherited most of SmallC's limitations. + + +What is HuCC? +------------- + +HuCC is a replacement for HuC that leverages the improvements made in the toolchain over the last few years. It incorporates some of the PC Engine knowledge and techniques that weren't uncovered until after the original HuC developers stopped maintaining their toolkit around 2005. + +At its core, HuCC is still the same HuC compiler, and is 90+% compatible with existing HuC projects, but it uses a rewritten library, and a very different underlying code-generation scheme to provide a 20%-40% reduction in the size of the generated code, with a significant boost in performance (which will depend upon the type of C code that is used in the project). + +The latest automated builds of HuCC for Windows, Linux and MacOS are available [here](https://github.com/pce-devel/huc/releases/). HuCC's archive also includes the last published version of HuC4. + + +What are the new features in HuCC? +---------------------------------- + +HuCC natively supports the SuperGrafx. + +HuC's legacy `scroll()` function has been superseded by a new optional `scroll_split()` function that is much faster, supports more scrolling regions, and supports both background layers on the SuperGrafx. + +HuCC also implements color fading functions, as well as a brand new tilemapping function that massively improves upon HuC's legacy `#inctile` macro. + +From a C language point-of-view, the big new "feature" is that function-pointers are now working again after being broken for 20+ years. That will allow C developers to implement game-entity behaviors in a faster and much more sensible way than the `switch()` statements, which HuC developers have traditionally had to use. + +`switch()` statements are also twice as fast as HuC, for those very common times when function-pointers would be inappropriate. When the `case` values are sequential, HuCC can now optimize the `switch()` into a simple jump table instead of a set of comparisons, making the code even faster. + +You can also now create C const arrays that contain the *bank* of data labels (such as sprites), to complement the existing ability to create C const arrays that contain the 16-bit *address* of data labels (such as sprites). This finally allows developers to create arrays of C `far` pointers to data in their HuCARD or CD overlay. + +C's structures were added to HuC4 by Ulrich Hecht around 2015, taken from the `struct` support added to SmallC back in the late 1980s, though it is a somewhat limited implementation. In particular, you can't statically initialize structures; you can only initialize individual variables and single-dimension arrays. + +Individual global, static and "-fno-recursive" structs were fairly fast in HuC4, thanks to some cunning but slightly naughty tricks that Uli implemented. But both arrays of structs and pointers to structs are pretty slow. + +HuCC is really only going to give you decent results if you use arrays of values (chars, ints or pointers). This is the classic 6502 recommendation to use "structs made of arrays" instead of "arrays made of structs". + +The main thing to remember is that you really want to keep array sizes <= 256-bytes, and structure sizes <= 256-bytes if you're going to use pointers. Pointers themselves should be put in zero-page. Try as hard as you can to avoid using the stack (i.e. parameters to functions and local variables). In HuCC, the stack goes in zero-page and is very small. + + +What is the focus of HuCC? +-------------------------- + +The primary focus for compiled code has been upon improving the existing code-generation so that things like function parameters, local variables, array accesses and conditional statements are no longer the complete embarrassment that they used to be. + +The other focus has been on switching away from the restrictive [MagicKit](http://magicengine.com/mkit/) library and program structure, which made it so incredibly hard for assembly language developers to add new capabilities to the HuC library that C developers could then use. + +The program structure that HuCC uses by default is based upon how the original PC Engine development studios wrote the most complex games for the console, such as ***The Legend of Xanadu*** and ***Anearth Fantasy Stories***, rather than MagicKit's use of a model similar to how early HuCARD games were written. + +HuCC uses a modular library where virtually everything is optional and can be easily replaced, including the entire default program structure, should an adventurous developer really wish to do so. + + +Where can I get help with using HuCC? +------------------------------------- + +Help can be found on the [PC Engine Forum](https://pcengine.proboards.com/) as well as on [PC Engine Fans](https://www.pcenginefans.com/). + +If you prefer the Discord interface, here is an invite to the [HuCC Development](https://discord.gg/Pv85Tv5ft2) channel. + +For an exhaustive list of functions supported by HuCC, check the [HuCC Function Reference](https://github.com/pce-devel/huc/blob/master/doc/hucc/hucc-function-reference.md) document. From 06c463e820d39d272e6bd46e88217e7f3f314794 Mon Sep 17 00:00:00 2001 From: Kaminari Kagemusha Date: Fri, 14 Aug 2026 19:38:21 +0200 Subject: [PATCH 6/9] Update README.md Added link to Small-C (Wikipedia). --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f58d34a4..531c7af0 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ What is HuC? ------------ -HuC is a C compiler for the NEC PC Engine consoles (CoreGrafx/TurboGrafx), initially developed by David Michel around 1999. HuC was an upgraded version of Ron Cain's SmallC, and as such it inherited most of SmallC's limitations. +HuC is a C compiler for the NEC PC Engine consoles (CoreGrafx/TurboGrafx), initially developed by David Michel around 1999. HuC was an upgraded version of Ron Cain's [Small-C](https://en.wikipedia.org/wiki/Small-C), and as such it inherited most of Small-C's limitations. What is HuCC? From 468b9ce2b12f0a09ab41b287544a6f54a256177a Mon Sep 17 00:00:00 2001 From: Kaminari Kagemusha Date: Fri, 14 Aug 2026 19:43:39 +0200 Subject: [PATCH 7/9] Update README.md Fixed typo. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 531c7af0..e6c94f82 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ From a C language point-of-view, the big new "feature" is that function-pointers You can also now create C const arrays that contain the *bank* of data labels (such as sprites), to complement the existing ability to create C const arrays that contain the 16-bit *address* of data labels (such as sprites). This finally allows developers to create arrays of C `far` pointers to data in their HuCARD or CD overlay. -C's structures were added to HuC4 by Ulrich Hecht around 2015, taken from the `struct` support added to SmallC back in the late 1980s, though it is a somewhat limited implementation. In particular, you can't statically initialize structures; you can only initialize individual variables and single-dimension arrays. +C's structures were added to HuC4 by Ulrich Hecht around 2015, taken from the `struct` support added to Small-C back in the late 1980s, though it is a somewhat limited implementation. In particular, you can't statically initialize structures; you can only initialize individual variables and single-dimension arrays. Individual global, static and "-fno-recursive" structs were fairly fast in HuC4, thanks to some cunning but slightly naughty tricks that Uli implemented. But both arrays of structs and pointers to structs are pretty slow. From 9349b655037de2d04ee3f3ccc7d341366b80b638 Mon Sep 17 00:00:00 2001 From: Kaminari Kagemusha Date: Fri, 14 Aug 2026 20:03:33 +0200 Subject: [PATCH 8/9] Update hucc-function-reference.md Fixed some typos. --- doc/hucc/hucc-function-reference.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/hucc/hucc-function-reference.md b/doc/hucc/hucc-function-reference.md index d063c77a..c378f922 100644 --- a/doc/hucc/hucc-function-reference.md +++ b/doc/hucc/hucc-function-reference.md @@ -22,7 +22,7 @@ Extracts a **map** in block format. Maximum map size is 128x128 blocks (i.e. 256 `#inctile( identifier_name, "filename", begin_x, begin_y, col, row );` This is a legacy directive for the older Tile and Map Functions from HuC3/4. Extracts one or more **16x16 tile** patterns from a map file. Extracts '*col*' columns and '*row*' rows of 16x16 tiles, starting at position '*begin_x*' and '*begin_y*' (in pixels). This legacy tile format is limited to one palette of 16 colors per tile. This old directive is mostly useful for maps built with editors like Mappy (FMP format) or Pro Motion (STM format), although you can use it with the `#incmap` directive as well. -- **Warning:** 16x16 tiles must not be confused with the newer metatiles (aka. blocks). +- **Warning:** 16x16 tiles must not be confused with the newer metatiles (a.k.a. blocks). `#incspr( identifier_name, "filename", begin_x, begin_y, col, row );` Extracts one or more **sprite** patterns (16x16 pixels) from a picture file. Extracts '*col*' columns and '*row*' rows of sprites (in sprite units), starting at position '*begin_x*' and '*begin_y*' (in pixels). @@ -31,10 +31,10 @@ Extracts one or more **sprite** patterns (16x16 pixels) from a picture file. Ext Extracts one or more **sub-palettes** (groups of 16 contiguous colors) from a picture file. Up to 32 sub-palettes can be imported: 16 for tiles (0-15), 16 for sprites (16-31). `#incchrpal( identifier_name, "filename" );` -Creates a palette lookup table for legacy HuC maps, directly from a character (tile) picture file. This is a legacy directive for the older Tile and Map Functions. +Creates a palette lookup table for legacy HuC maps, directly from a tile picture file (8x8 format). This is a legacy directive for the older Tile and Map Functions. `#inctilepal( identifier_name, "filename" );` -Creates a palette lookup table for legacy HuC maps, directly from a block (metatile) picture file. This is a legacy directive for the older Tile and Map Functions. +Creates a palette lookup table for legacy HuC maps, directly from a tile picture file (16x16 format). This is a legacy directive for the older Tile and Map Functions. `#incsprpal( identifier_name, "filename" );` Creates a palette lookup table for legacy HuC maps, directly from a sprite picture file. This is a legacy directive for the older Tile and Map Functions. From a7ab6e08567f002decaa9723d35e933e9123af37 Mon Sep 17 00:00:00 2001 From: Kaminari Kagemusha Date: Fri, 14 Aug 2026 21:50:52 +0200 Subject: [PATCH 9/9] Update README.md Made some wording changes and added a Contributors paragraph. --- README.md | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e6c94f82..dc2ded7f 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,6 @@ What is HuC? HuC is a C compiler for the NEC PC Engine consoles (CoreGrafx/TurboGrafx), initially developed by David Michel around 1999. HuC was an upgraded version of Ron Cain's [Small-C](https://en.wikipedia.org/wiki/Small-C), and as such it inherited most of Small-C's limitations. - What is HuCC? ------------- @@ -31,14 +30,13 @@ From a C language point-of-view, the big new "feature" is that function-pointers You can also now create C const arrays that contain the *bank* of data labels (such as sprites), to complement the existing ability to create C const arrays that contain the 16-bit *address* of data labels (such as sprites). This finally allows developers to create arrays of C `far` pointers to data in their HuCARD or CD overlay. -C's structures were added to HuC4 by Ulrich Hecht around 2015, taken from the `struct` support added to Small-C back in the late 1980s, though it is a somewhat limited implementation. In particular, you can't statically initialize structures; you can only initialize individual variables and single-dimension arrays. +C structures were added to HuC4 by Ulrich Hecht around 2015, taken from the `struct` support added to Small-C back in the late 1980s, though it is a somewhat limited implementation. In particular, you can't statically initialize structures; you can only initialize individual variables and single-dimension arrays. Individual global, static and "-fno-recursive" structs were fairly fast in HuC4, thanks to some cunning but slightly naughty tricks that Uli implemented. But both arrays of structs and pointers to structs are pretty slow. HuCC is really only going to give you decent results if you use arrays of values (chars, ints or pointers). This is the classic 6502 recommendation to use "structs made of arrays" instead of "arrays made of structs". -The main thing to remember is that you really want to keep array sizes <= 256-bytes, and structure sizes <= 256-bytes if you're going to use pointers. Pointers themselves should be put in zero-page. Try as hard as you can to avoid using the stack (i.e. parameters to functions and local variables). In HuCC, the stack goes in zero-page and is very small. - +The main thing to remember is that you really want to keep array and structure sizes <= 256 bytes. If you're going to use pointers, then declare/define them in zero-page with `__zp`. Try as hard as you can to avoid using the stack (i.e. parameters to functions and local variables). In HuCC, the stack goes in zero-page and is very small. What is the focus of HuCC? -------------------------- @@ -60,3 +58,17 @@ Help can be found on the [PC Engine Forum](https://pcengine.proboards.com/) as w If you prefer the Discord interface, here is an invite to the [HuCC Development](https://discord.gg/Pv85Tv5ft2) channel. For an exhaustive list of functions supported by HuCC, check the [HuCC Function Reference](https://github.com/pce-devel/huc/blob/master/doc/hucc/hucc-function-reference.md) document. + + +Main contributors over the years +-------------------------------- + +- David Michel +- Dave Shadoff +- Paul Clifford +- Olivier Jolly +- Xavier Carmona +- Rick Leverton +- Ulrich Hecht +- Artemio Urbina +- John Brandwood