Add tileset1 sample with custom CHR ROM tileset#85
Conversation
jonathanpeppers
commented
Feb 14, 2026
- Custom CHR tileset from 8bitworkshop's tileset1.c preset
- Font data padded to ASCII positions (tile 0x41 = 'A', etc.)
- Uses pal_bg, vram_adr, vram_write, ppu_on_all
- Added chr_tileset1.s for per-sample CHR ROM in tests
- Python script to generate CHR from tileset data
- All 166 tests passing
- Custom CHR tileset from 8bitworkshop's tileset1.c preset - Font data padded to ASCII positions (tile 0x41 = 'A', etc.) - Uses pal_bg, vram_adr, vram_write, ppu_on_all - Added chr_tileset1.s for per-sample CHR ROM in tests - Python script to generate CHR from tileset data - All 166 tests passing Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This pull request adds a new "tileset1" sample demonstrating custom CHR ROM tileset usage, based on 8bitworkshop's tileset1.c preset. The implementation replaces the original's CHR RAM approach with CHR ROM, padding the tileset so ASCII character codes map directly to tile indices (tiles 0x00-0x1F are blank, 0x20+ contain the font).
Changes:
- New tileset1 sample using
pal_bg,vram_adr,vram_write, andppu_on_allNES APIs - Custom CHR ROM tileset with 8KB padding and ASCII-aligned character data
- Python script (gen_chr_tileset1.py) to generate CHR .s files from tileset hex data
- Test coverage for both debug and release builds with per-sample chr_tileset1.s file
- Documentation updates showing tileset1 moved from "Feasible" to "Already Implemented" status
Reviewed changes
Copilot reviewed 9 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| samples/tileset1/Program.cs | Main C# sample code displaying text with custom tileset |
| samples/tileset1/tileset1.csproj | Sample project configuration |
| samples/tileset1/tileset1.c | Reference C code for comparison (has issues) |
| samples/tileset1/chr_generic.s | Custom 8KB CHR ROM data (1025 lines) |
| scripts/gen_chr_tileset1.py | Python script generating CHR .s files from hex data |
| src/dotnes.tests/TranspilerTests.cs | Added test cases for tileset1 debug/release |
| src/dotnes.tests/TranspilerTests.Write.tileset1.verified.bin | Verified ROM output (binary) |
| src/dotnes.tests/Data/tileset1.debug.dll | Debug build test DLL |
| src/dotnes.tests/Data/tileset1.release.dll | Release build test DLL |
| src/dotnes.tests/Data/chr_tileset1.s | Per-sample CHR data for tests |
| samples/samples.sln | Added tileset1 project to solution |
| docs/8bitworkshop-samples.md | Updated documentation marking tileset1 as implemented |
| tileset1.nes | Sample ROM output (root directory, should be in samples/tileset1/) |
| void main(void) | ||
| { | ||
| // set palette colors (from tileset1.c palSprites) | ||
| pal_bg(palSprites); |
There was a problem hiding this comment.
The reference to 'palSprites' is undefined. The palette data should be defined as a byte array (e.g., const unsigned char palSprites[] = {...}) to match the usage in the C# Program.cs where it's defined as byte[] palette. This reference file won't compile as-is on 8bitworkshop.
| // Include the tileset data | ||
| #include "tileset1.c" |
There was a problem hiding this comment.
The include directive on line 8 is recursive - it includes the file itself. This should probably include a separate header file with the tileset data (e.g., "tileset1_data.c" or similar), or remove this include entirely if the palette data is supposed to be defined elsewhere. As written, this would cause a compilation error.
| // Include the tileset data | |
| #include "tileset1.c" | |
| // Tileset / palette data is defined elsewhere (e.g., in CHR ROM or another module) | |
| extern const unsigned char palSprites[]; |