Skip to main content

ROM cartridges

If you create an amazing Hybrix program and want to share it with others, you can export a ROM cartridge file. The file is a PNG image that uses a steganography algorithm to encode your program as pixel colors.

Tip: To distribute just the music from your project, you can instead export a Jamdac chiptune file.

Creating a ROM cartridge file

  1. Using the Hybrix website, open your project in the development environment.
  2. On the CODE tab, click the "ROM" button at the top of the screen.
  3. Download the resulting file and save it on your computer.
  4. If you share this file with other people, they can play it using the Hybrix ROM Player web page. Unlike the development environment, the ROM Player displays full color graphics including the CRT effect.

The cartridge PNG image will look something like this:

example-rom-cart.png

How Hybrix generates the artwork:

  • The base cartridge picture is always the same, with "HYBRIX.DEV" at the top and "ROM CARTRDIGE" at the bottom.
  • Your project's screenshot appears on the label in the center.
  • The title line shows your Hybrix project name.
  • Your Hybrix user name will appear on the "BY" line.

File format details

  • The steganography algorithm encodes exactly 65,536 ROM data bytes inside the PNG image.
  • The PNG image dimensions are always 250 × 273.
  • The PNG pixels use 24-bit RGB color, encoding one data byte per pixel.
  • The data byte is distributed across the low order bits of the RGB color components: 3 bits in red, 2 bits in green, and 3 bits in blue.
  • The 65,536 encoded pixels form the interior region of the image. The image's outside border is not used to encode any data.
  • This encoding appears as a light "noise" or "static" across the image; for smaller files, random noise is applied to unused pixels to ensure consistent visual appearance.
  • The data bytes store your program after being compressed using the LZMA algorithm.
  • Thus, to fit inside a ROM cartridge, your compressed program must be 65,536 bytes or less. Its actual size can be much larger, depending on how "compressible" your data is. (For example, repeating byte patterns compress better than random bytes.)
  • The data bytes include a 7 byte header that specifies the data length and file version.
  • The data bytes end with an 8 byte checksum taken from a SHA-256 hash. This provides reliable error detection for unfortunate cases where an app or website tries to "enhance" the distributed PNG image, corrupting its encoded ROM data.
  • After decompressing the ROM program, the Hybrix ROM Player loads the program binary at memory address $00C0_0000 and then jumps to that address.