RCD v1 — ROM Creation Data Format

Text-based, deterministic, extensible patch recipe

1. Overview

RCD is a plain UTF-8 text format describing how to reconstruct a ROM image from one or more source disk images (for Illusion City Turbo-R, 8 disks). It is human-readable, diff-friendly, and designed for deterministic rebuilds verified by SHA-256 hashes.

2. File layout

Magic (required)
RCDv1
ROM hash (optional)
ROM_SHA256 <64 hex chars>
Disk hash lines (0..N)
DISK_SHA256 <disk-id 1..8> <64 hex chars>
Records
One per line (see below). Order matters.
Comments
# to end of line; blank lines allowed.

3. Record types

COPY

Copy bytes from a disk into the ROM.

COPY rom_off=0x000000 d=3 disk_off=0x001200 len=0x000080

LITERAL

Insert explicit bytes (hex) into the ROM.

LITERAL rom_off=0x010000 data=4B4F4E414D49

RLE

Fill a region with a repeated single byte (ideal for 0xFF/0x00 tails).

RLE rom_off=0x7F0000 byte=0xFF len=0x010000

4. EBNF grammar

file            = wsp* "RCDv1" wsp* eol
                  ( wsp* rom_sha256 eol )?
                  ( wsp* disk_sha256 eol )*
                  ( wsp* eol )*
                  ( record_line )* ;

rom_sha256      = "ROM_SHA256" wsp+ hex64 ;
disk_sha256     = "DISK_SHA256" wsp+ disk_id wsp+ hex64 ;

record_line     = wsp* record wsp* eol ;
record          = copy_record | literal_record | rle_record ;

copy_record     = "COPY"    wsp+ kv_pair ( wsp+ kv_pair )* ;
literal_record  = "LITERAL" wsp+ kv_pair ( wsp+ kv_pair )* ;
rle_record      = "RLE"     wsp+ kv_pair ( wsp+ kv_pair )* ;

kv_pair         = key "=" value ;
key             = ident ;
value           = hexnum | decnum | hexbytes | hexbyte ;

(* COPY:    rom_off=<hex/dec> d=<dec> disk_off=<hex/dec> len=<hex/dec> *)
(* LITERAL: rom_off=<hex/dec> data=<HEXBYTES> *)
(* RLE:     rom_off=<hex/dec> byte=<hex/dec 0..255> len=<hex/dec> *)

ident           = alpha ( alpha | digit | "_" )* ;
disk_id         = decnum ;
hex64           = hexdig{64} ;
hexbytes        = hexdig hexdig ( hexdig hexdig )* ;
hexbyte         = hexnum ;  (* semantic range 0..255 *)
hexnum          = "0x" hexdig+ ;
decnum          = digit+ ;

alpha           = "A".."Z" | "a".."z" ;
digit           = "0".."9" ;
hexdig          = digit | "A".."F" | "a".."f" ;

wsp             = " " | "\t" ;
eol             = [# to end of line is a comment] newline ;
newline         = "\r\n" | "\n" | "\r" ;

Note: Comments start with # and run to end of line. Parsers should ignore unknown key=value pairs to ease forward compatibility (unless a future version says otherwise).

5. Semantics & constraints

6. Example

RCDv1
ROM_SHA256 0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF
DISK_SHA256 1 1111111111111111111111111111111111111111111111111111111111111111
DISK_SHA256 2 2222222222222222222222222222222222222222222222222222222222222222

COPY    rom_off=0x000000 d=1 disk_off=0x000000 len=0x010000
LITERAL rom_off=0x010000 data=4B4F4E414D49
RLE     rom_off=0x7F0000 byte=0xFF len=0x010000

7. Extensibility

8. Validator checks (recommended)

© RCD v1. This document describes the format used by rcd_make.py and rcd_apply.py (RLE-aware). It is suitable for reimplementation in other languages and build tools.