Intial commit
This commit is contained in:
57
README.md
Normal file
57
README.md
Normal file
@@ -0,0 +1,57 @@
|
||||
# H8/536 ROM Decompiler
|
||||
|
||||
This repo now includes a standalone Python helper for the H8/536 ROM image:
|
||||
|
||||
```powershell
|
||||
python h8536_decompiler.py ROM\M27C512@DIP28_1.BIN --out build\rom_decompiled.asm --json build\rom_decompiled.json
|
||||
```
|
||||
|
||||
On this machine the Windows `python.exe` entry is a Microsoft Store launcher stub, so validation was run with WSL:
|
||||
|
||||
```powershell
|
||||
ubuntu.exe run python3 h8536_decompiler.py --out build/rom_decompiled.asm --json build/rom_decompiled.json
|
||||
```
|
||||
|
||||
## What It Does
|
||||
|
||||
- Decodes the H8/500 instruction set used by the H8/536.
|
||||
- Reads the H8/536 minimum-mode vector table from the ROM.
|
||||
- Recursively traces reachable code from reset, interrupt, and trap vectors.
|
||||
- Emits labels for branch and call targets.
|
||||
- Annotates H8/536 on-chip register accesses such as `P1DDR`, `SYSCR1`, `WCR`, and timer/SCI/A-D registers.
|
||||
- Handles the E-clock transfer instructions `MOVFPE` and `MOVTPE`.
|
||||
|
||||
The generated listing is written to:
|
||||
|
||||
```text
|
||||
build/rom_decompiled.asm
|
||||
```
|
||||
|
||||
The optional JSON output is useful for scripts or later analysis:
|
||||
|
||||
```text
|
||||
build/rom_decompiled.json
|
||||
```
|
||||
|
||||
## Useful Options
|
||||
|
||||
```powershell
|
||||
python h8536_decompiler.py --help
|
||||
```
|
||||
|
||||
- `--mode min|max`: vector format. This ROM appears to be minimum mode; `min` is the default.
|
||||
- `--entry H'1234`: add an extra entry point to recursive tracing.
|
||||
- `--linear`: linear-sweep the selected range instead of tracing from vectors.
|
||||
- `--start H'1000 --end H'D100`: constrain the decode range.
|
||||
- `--br H'FE`: resolve short absolute `@aa:8` operands through a known base-register value.
|
||||
|
||||
## Code Layout
|
||||
|
||||
- `h8536_decompiler.py`: compatibility wrapper for the CLI.
|
||||
- `h8536/cli.py`: argument parsing and end-to-end orchestration.
|
||||
- `h8536/decoder.py`: instruction and effective-address decoding.
|
||||
- `h8536/tables.py`: manual-derived opcode/vector/register tables.
|
||||
- `h8536/vectors.py`: exception vector parsing.
|
||||
- `h8536/analysis.py`: recursive tracing, linear sweep, and labels.
|
||||
- `h8536/render.py`: assembly and JSON output.
|
||||
- `h8536/model.py`, `h8536/rom.py`, `h8536/formatting.py`: shared data structures and helpers.
|
||||
Reference in New Issue
Block a user