## 1) What you need

- Python 3.8 or newer installed on your computer.
- The script: `rcd_apply.py`.
- Your eight patched disk images (e.g., `ILCITY1E.DSK` … `ILCITY8E.DSK`).
- The patch recipe file: `.rcd` (e.g., `icrom.rcd`).

## 2) Install Python

### Windows

1. Download Python from python.org.
2. Important: check “Add Python to PATH” during setup.
3. Finish install, then open Command Prompt or PowerShell.
4. Verify: `python --version` (or use `py --version`).

### macOS

1. Download macOS installer from python.org and run it.
2. Open Terminal, verify: `python3 --version`.

### Linux

1. Most distros already include Python 3. Verify: `python3 --version`.
2. If missing, install via your package manager (e.g., Ubuntu: `sudo apt install python3`).

## 3) Get your files ready

Put `rcd_apply.py`, your `.rcd` file, and all eight `.DSK` files in the same folder, or note their exact paths.

    MyFolder\
      rcd_apply.py
      icrom.rcd
      ILCITY1E.DSK
      ILCITY2E.DSK
      ILCITY3E.DSK
      ILCITY4E.DSK
      ILCITY5E.DSK
      ILCITY6E.DSK
      ILCITY7E.DSK
      ILCITY8E.DSK

## 4) Run the tool

### Windows (Command Prompt or PowerShell)

    cd "C:\path\to\MyFolder"
    python rcd_apply.py icrom.rcd ILCITY1E.DSK ILCITY2E.DSK ILCITY3E.DSK ILCITY4E.DSK ILCITY5E.DSK ILCITY6E.DSK ILCITY7E.DSK ILCITY8E.DSK -o IllusionCity_TurboR.rom
    # If 'python' doesn't work, try the launcher:
    py rcd_apply.py icrom.rcd ILCITY1E.DSK ILCITY2E.DSK ILCITY3E.DSK ILCITY4E.DSK ILCITY5E.DSK ILCITY6E.DSK ILCITY7E.DSK ILCITY8E.DSK -o IllusionCity_TurboR.rom

### macOS

    cd "/path/to/MyFolder"
    python3 rcd_apply.py icrom.rcd ILCITY1E.DSK ILCITY2E.DSK ILCITY3E.DSK ILCITY4E.DSK ILCITY5E.DSK ILCITY6E.DSK ILCITY7E.DSK ILCITY8E.DSK -o IllusionCity_TurboR.rom

### Linux

    cd "/path/to/MyFolder"
    python3 rcd_apply.py icrom.rcd ILCITY1E.DSK ILCITY2E.DSK ILCITY3E.DSK ILCITY4E.DSK ILCITY5E.DSK ILCITY6E.DSK ILCITY7E.DSK ILCITY8E.DSK -o IllusionCity_TurboR.rom

Tip: If any path contains spaces, wrap it in quotes, e.g. `"C:\Games\Illusion City\ILCITY1E.DSK"`.

## 5) Command-line parameters

Positional 1
`RCD` file (e.g., `icrom.rcd`)
Positional 2–9
Eight `.DSK` files in order (1→8)
`-o`, `--out`
(Optional) Output ROM filename. Default: `reconstructed.rom`
`-v`, `--verbose`
Print each step (`COPY`, `LITERAL`, `RLE`) while applying
`--strict`
Treat any SHA-256 mismatch as an error (non-zero exit code)
`--delete-on-mismatch`
Delete the output file if final ROM SHA mismatch occurs

### What the script does

- Reads the `.rcd` recipe.
- Verifies each disk’s SHA-256 (if hashes are present in the recipe) and shows expected vs actual.
- Rebuilds the ROM file by copying blocks from the disks, writing literals, and filling repeated bytes.
- Writes the ROM to `-o` (or `reconstructed.rom` by default).
- Computes final ROM SHA-256 and shows expected vs actual.

## 6) Expected output

    Disk 1 SHA256 | expected: 1111...aaaa
                     actual  : 1111...aaaa
    ...
    Wrote IllusionCity_TurboR.rom (4,194,304 bytes).
    ROM SHA256     | expected: a1b2c3...deadbeef
                     actual  : a1b2c3...deadbeef

If the hashes match, you’re done—load the ROM in your emulator or on real hardware.

## 7) Troubleshooting

### “python is not recognized” (Windows)

- Re-run the Python installer and check Add Python to PATH, or use the launcher: `py`.

### File not found / path errors

- Use quotes around paths with spaces.
- Verify you’re in the correct folder: `cd <folder>`. List files: `dir` (Windows) / `ls` (macOS/Linux).

### Disk SHA256 mismatch

- Ensure you’re using the exact patched disk set that the `.rcd` expects.
- Redownload/recopy the disks; avoid mixing regions/versions.
- You can run without strict mode to still produce a file, but it may be invalid.

### ROM SHA256 mismatch

- Usually means the disks don’t match the recipe or files are corrupted.
- Try again with `-v` to see what’s being applied.
- Use `--strict` to make mismatches fail the build clearly.

### Permission denied / cannot write output

- Choose a folder where you have write permissions (e.g., Desktop or Documents).
- On macOS/Linux, you may need `chmod +x` only for binaries; not required for `.py`.

## 8) FAQ

Q: Do I need to install extra Python packages?
No. The script uses only the Python standard library.

Q: Can I rename the output file?
Yes—use `-o MyROM.rom`.

Q: Does the order of the disks matter?
Yes. Pass them in order (1 through 8) to match the recipe.

Q: Can I run this without an internet connection?
Yes. Everything is local.

Need help? Provide the exact command you ran and the full console output so we can diagnose quickly.