docs: minor updates to zorro_bus, game_reversing, expansion

This commit is contained in:
Ilia Sharin 2026-05-12 22:04:26 -04:00
parent 9f5d9de1ed
commit 7960cbdf25
3 changed files with 9 additions and 120 deletions

View file

@ -37,99 +37,11 @@ Zorro II cards appear in the 16 MB address space. RAM cards are configured into
Zorro III extends into the 32-bit address space, allowing large RAM cards (32128 MB) and fast peripherals. Requires a 32-bit CPU (68030+) and OS support.
## AutoConfig Protocol
## AutoConfig
AutoConfig allows the OS to discover and configure cards without jumpers:
Zorro uses **AutoConfig** — a hardware plug-and-play protocol that lets the OS discover, size, and map expansion boards at boot without jumpers. Each board presents a 256-byte ROM at the configuration address (`$E80000` for Zorro II, `$FF000000` for Zorro III) containing its manufacturer ID, product code, size, and type. The OS walks the `/CFGIN`/`/CFGOUT` daisy chain, reads each ROM, assigns a base address, and tells the board to relocate.
```mermaid
sequenceDiagram
participant OS as AmigaOS (expansion.library)
participant Card as Zorro Card
OS->>Card: Read $E80000 (config space)
Card-->>OS: Manufacturer ID (16-bit)
OS->>Card: Read $E80002
Card-->>OS: Product ID, flags
OS->>Card: Read board size, type
OS->>OS: AllocAbs() / ConfigBoard()
OS->>Card: Write base address
Card-->>OS: Card configured, moves off $E80000
```
**Key AutoConfig registers** (read from $E80000$E8007F before configuration):
| Offset | Content |
|---|---|
| $00 | er_Type (board type: RAM/IO, Zorro II/III) |
| $02 | er_Product (product ID) |
| $04 | er_Flags |
| $06 | er_Reserved03 |
| $08$0A | er_Manufacturer (16-bit) |
| $0C$0F | er_SerialNumber |
| $10$11 | er_InitDiagVec (diagnostic ROM vector) |
**Board types** (`er_Type` bits):
```c
#define ERT_TYPEMASK 0xC0
#define ERT_ZORROII 0xC0 /* Zorro II card */
#define ERT_ZORROIII 0x80 /* Zorro III card */
#define ERTB_MEMLIST 5 /* board is RAM, add to free list */
#define ERTB_DIAGVALID 4 /* DiagArea ROM is valid */
#define ERTB_CHAINEDCONFIG 3 /* more boards to configure */
```
## expansion.library
AmigaOS provides `expansion.library` to manage Zorro configuration:
```c
#include <libraries/expansion.h>
#include <clib/expansion_protos.h>
/* Find a configured board by manufacturer/product */
struct ConfigDev *cd = NULL;
while ((cd = FindConfigDev(cd, MANUF_ID, PROD_ID)) != NULL) {
APTR base = cd->cd_BoardAddr;
ULONG size = cd->cd_BoardSize;
/* use board at base */
}
```
**Key structures:**
```c
struct ConfigDev {
struct Node cd_Node;
UBYTE cd_Flags;
UBYTE cd_Pad;
struct ExpansionRom cd_Rom; /* copy of autoconfig ROM area */
APTR cd_BoardAddr; /* configured base address */
ULONG cd_BoardSize;
UWORD cd_SlotAddr;
UWORD cd_SlotSize;
APTR cd_Driver;
struct ConfigDev *cd_NextCD;
ULONG cd_Unused[4];
};
```
## DiagArea — Card ROM
Cards with `ERTB_DIAGVALID` have a small ROM (DiagArea) that the OS calls during boot:
```c
struct DiagArea {
UBYTE da_Config; /* flags */
UBYTE da_Flags;
UWORD da_Size;
UWORD da_DiagPoint; /* offset to diagnostic code */
UWORD da_BootPoint; /* offset to boot code */
UWORD da_Name; /* offset to name string */
UWORD da_Reserved01;
UWORD da_Reserved02;
};
```
The boot vector is called by `ConfigChain()` during the early boot sequence — this is how SCSI controllers install their filesystem handlers.
See [AutoConfig Protocol](autoconfig.md) for the full hardware-level specification — CFGIN/CFGOUT mechanics, nibble-pair ROM format, size codes, shut-up behavior, and FPGA implementation notes. See [expansion.library](../../11_libraries/expansion.md) for the software API (`FindConfigDev`, `ConfigBoard`, `ConfigDev` structure) and manufacturer ID tables.
## Real-World Performance & Bottlenecks

View file

@ -664,9 +664,11 @@ Documenting the internal structure of unreleased or poorly documented games cont
## FAQ
### Q1: IRA vs Ghidra — which should I use?
### Q1: IRA vs Ghidra vs IDA Pro — which should I use?
Use **IRA** when you need re-assemblable source code or are working with pure hand-written assembly. Use **Ghidra** when you need cross-references, decompilation, or the game was written in C. Many RE projects use both: Ghidra for exploration, IRA for final patch generation.
Use **IRA** when you need re-assemblable source code or are working with pure hand-written assembly. Use **Ghidra** (free, open-source) when you need cross-references, decompilation, or the game was written in C. Use **IDA Pro** (commercial) when you need the best 68k processor module, advanced scripting, or are working with obfuscated or packed binaries that benefit from its debugger integration. Many RE projects use two or even all three: Ghidra or IDA for exploration, IRA for final patch generation.
See [Ghidra Setup](../ghidra_setup.md) and [IDA Pro Setup](../ida_setup.md) for configuration details.
### Q2: How do I handle a game with no readable strings?

View file

@ -88,34 +88,9 @@ The system requires no handshake signal — once the base address is written, th
The board presents its identity at the configuration address. Each logical byte is read via **two even-address accesses** (nibble-pair format): the high nibble from bits `D7D4` at `offset`, the low nibble from bits `D7D4` at `offset + 2`. This allows boards to use cheap 4-bit PROMs. All fields except `er_Type` are stored **inverted** in the ROM (XOR `$FF`) — an empty bus reads `$FF`, which inverts to `$00`, cleanly signaling "no more boards."
See [AutoConfig Protocol — Nibble-Pair Format](../01_hardware/common/autoconfig.md#the-nibble-pair-format--logical-inversion) for the full physical-to-logical address map.
The ROM encodes bus type (Zorro II vs III), memory vs I/O classification, board size, manufacturer ID (16-bit), product ID (8-bit), serial number (32-bit), and an optional DiagArea vector. The lower nibble of `er_Type` is a size code that maps to different byte sizes on Zorro II and Zorro III.
| Offset | Register | Bits | Description |
|---|---|---|---|
| $00 | `er_Type` | 7:6 | Board type: `11`=Zorro II, `10`=Zorro III |
| $00 | `er_Type` | 5 | Memory board (1) or I/O board (0) |
| $00 | `er_Type` | 4 | Chain bit — more boards follow |
| $00 | `er_Type` | 3:0 | Size code (see table below) |
| $02 | `er_Product` | 7:0 | Product number (0255) |
| $04 | `er_Flags` | 7 | Can be shut up (mapped out) |
| $04 | `er_Flags` | 5 | Board's memory is free (add to system pool) |
| $04 | `er_Flags` | 4 | `er_InitDiagVec` is valid (`ERFB_DIAGVALID`) |
| $08/$0A | `er_Manufacturer` | 15:0 | Manufacturer ID (assigned by Commodore) |
| $0C$12 | `er_SerialNumber` | 31:0 | Serial number (unique per board) |
| $20/$22 | `er_InitDiagVec` | 15:0 | Offset to optional boot ROM (DiagArea) |
### Size Code
| Code | Zorro II Size | Zorro III Size |
|---|---|---|
| $0 | 8 MB | 16 MB |
| $1 | 64 KB | 32 MB |
| $2 | 128 KB | 64 MB |
| $3 | 256 KB | 128 MB |
| $4 | 512 KB | 256 MB |
| $5 | 1 MB | 512 MB |
| $6 | 2 MB | 1 GB |
| $7 | 4 MB | — |
See [AutoConfig Protocol — Data Structures & Register Tables](../01_hardware/common/autoconfig.md#data-structures--register-tables) for the complete ROM layout, size code matrix, and `er_Flags` bit definitions.
---