Skip to main content

R65 Project Tool (r65x)

r65x is the R65 project management and asset pipeline tool. It provides project scaffolding, font generation, data compression, and bitmap-to-tile conversion for SNES development.

r65x --help
r65x <command> --help

r65x init — Create a new project

Scaffolds a complete SNES project with source files, standard library, Makefile, and documentation.

r65x init --platform snes my_game

Arguments:

ArgumentDescription
--platform snesTarget platform (required, currently only snes)
directoryProject directory name to create

r65x fontgen — Generate SNES font tiles

Renders a TrueType monospace font into SNES tile data with 3-color anti-aliased output (background, edge, solid). Prints an R65 array literal to stdout that can be pasted or redirected into a .r65 source file.

# Use default font (DejaVu Sans Mono Bold)
r65x fontgen > src/lib/my_font.r65

# Use a custom font
r65x fontgen --font path/to/font.ttf > src/lib/my_font.r65

# Preview tiles as ASCII art
r65x fontgen --preview

Options:

OptionDefaultDescription
--font PATHDejaVu Sans Mono BoldPath to a .ttf font file
--size NautoFont point size (0 = auto-detect best fit for 8x8 tiles)
--color {2,4,8}2Bits per pixel: 2 (4 colors), 4 (16 colors), 8 (256 colors)
--low-thresh N20Grayscale threshold for anti-aliased edges (0-255)
--high-thresh N80Grayscale threshold for solid body (0-255)
--boldoffMake font bolder (can be repeated: --bold --bold)
--previewoffPrint ASCII art preview of all tiles to stderr

Example workflow:

# Generate font and redirect to a source file
r65x fontgen --font /usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf \
--color 2 > src/lib/my_font.r65

# Include in your program
# include!("lib/my_font.r65")

r65x packer — Data compression

Encodes and decodes binary files using various SNES-era compression algorithms. Useful for compressing tilesets, tilemaps, and other large data before embedding in ROM.

# Compress
r65x packer pack data.bin -o data.lz4 -x lz4

# Decompress
r65x packer unpack data.lz4 -o data.bin -x lz4

Arguments:

ArgumentDescription
pack or unpackAction (compress or decompress)
input.binInput file path
-o, --outputOutput file path (required)
-x, --encodingCompression algorithm (required)
-f, --fullsizeWrite full data, ignoring destination file size

Supported algorithms:

AlgorithmDescription
aplibaPLib compression
byte_rleByte-level run-length encoding
halHAL Laboratory compression (Kirby, etc.)
lz1LZ variant 1
lz2LZ variant 2
lz3LZ variant 3
lz4LZ variant 4
lz5LZ variant 5
lz19LZ variant 19
lz77Standard LZ77
rle1Run-length encoding variant 1
rle2Run-length encoding variant 2

Example: compress a tileset for ROM inclusion:

# Compress tileset
r65x packer pack assets/tiles.bin -o build/tiles.lz5 -x lz5

# Include compressed data in R65 source
# static TILES_LZ5 = include_bytes!("../build/tiles.lz5");

The game code is then responsible for decompressing at runtime into VRAM or RAM.


r65x bmp2chr — Bitmap to SNES tile conversion

Converts an indexed bitmap image (.bmp) into SNES CHR tile data. Supports all SNES color depths and tile formats.

r65x bmp2chr sprite_sheet.bmp -o sprites.chr -b4

Arguments:

ArgumentDescription
input.bmpInput indexed bitmap file
-o, --outputOutput .chr file path (required)

Format options (pick one):

FlagColorsDescription
-b242bpp planar (backgrounds, fonts)
-b383bpp planar
-b4164bpp planar (sprites, most backgrounds)
-b82568bpp planar
-l242bpp linear
-l4164bpp linear
-l82568bpp linear
-m7256Mode 7 (8bpp, 1 byte per pixel)

Additional options:

FlagDescription
-p, --paletteAlso output a .pal color palette file
-t, --tilemapDe-duplicate tiles and output a .tilemap file
-f, --fullsizeWrite full bitmap data (ignore CHR file size limits)

Example: convert a 4bpp sprite sheet with palette:

r65x bmp2chr assets/player.bmp -o build/player.chr -b4 --palette
# Produces: build/player.chr and build/player.pal

Example: convert background with tile deduplication:

r65x bmp2chr assets/level1_bg.bmp -o build/level1.chr -b2 --tilemap
# Produces: build/level1.chr and build/level1.tilemap

Input requirements:

  • The bitmap must be an indexed-color .bmp file (not RGB)
  • Tile dimensions are 8x8 pixels; the image dimensions should be multiples of 8
  • The number of colors in the palette must match the chosen bit depth (e.g., 16 or fewer colors for -b4)

Typical asset pipeline

A common SNES project workflow combines these tools:

# 1. Create project
r65x init --platform snes my_game
cd my_game

# 2. Convert art assets
r65x bmp2chr assets/sprites.bmp -o build/sprites.chr -b4 --palette
r65x bmp2chr assets/background.bmp -o build/bg.chr -b2 --tilemap

# 3. Compress large assets
r65x packer pack build/bg.chr -o build/bg.lz4 -x lz4

# 4. Generate font
r65x fontgen > src/lib/my_font.r65

# 5. Build ROM
make

In the R65 source, reference the converted assets:

// Include raw CHR data
static SPRITES = include_bytes!("sprites.chr");

// Include compressed data (decompress at runtime)
static BG_TILES_LZ4 = include_bytes!("bg.lz4");