Introduction
The HuC6280 addresses 64 KB, but through eight mapping registers it reaches a 2 MB physical space of 256 banks of 8 KB. A game’s ROM is the first banks; the work RAM, the backup memory and the chip registers are banks of their own. The logical map and the registers are on the HuC6280 registers page; this page is the card’s side of it.
Banks
A .pce file is the ROM as 8 KB banks, numbered from 0 (after any copier header). Bank n is shown by a mapping register holding
n; the first bank is at $E000 at reset. Up to 128 banks (1 MB) fit the card’s space, $00-$7F. A program remaps registers while it runs, with lda #n and
tam #mask, so which bank is at a logical address depends on what ran before; the viewer shows bank 0 at $E000 and one chosen bank at a chosen segment.
The physical banks
| Banks | What is there |
|---|---|
$00-$7F | The HuCard. |
$80-$87 | Not on a plain system. On a PC Engine CD: 64 KB of RAM (PCEdev wiki, CPU memory map). The Super System Card and the Arcade Card also add RAM and registers; their bank numbers are not given by the sources read. |
$88-$F6 | Unmapped on the systems the PCEdev wiki lists (its row reads $88-$F7); an expansion port device or a HuCard can map them. |
$F7 | Backup (save game) memory, where the system has it. (The PCEdev wiki lists $F7 as unmapped; the jspce core puts its backup RAM here, physical $1EE000, so this row follows jspce, not the wiki.) |
$F8 | Work RAM, 8 KB: the zero page ($2000 logical) and the stack ($2100). |
$F9-$FB | Mirrors of $F8 on the PC Engine; the SuperGrafx has more RAM. |
$FC-$FE | Nothing. |
$FF | The hardware page. |
The hardware page
Bank $FF holds the chip registers; with the first mapping register set to $FF they are at the start of the logical map. Each block repeats through its 1 KB.
| Offset | Block | What it is |
|---|---|---|
$0000-$03FF | VDC | HuC6270 video display controller, 4 registers. The address register is at $0000 and the data at $0002 (low) and $0003 (high). st0, st1 and st2 write these. |
$0400-$07FF | VCE | HuC6260 video colour encoder, 8 registers: control at $0400, the colour table address at $0402-$0403, the colour data at $0404-$0405. |
$0800-$0BFF | PSG | Programmable sound generator: $0800 channel select, $0801 main amplitude, $0802-$0803 frequency, $0804 channel control, $0805 left and right volume, $0806 waveform, $0807 noise, $0808-$0809 LFO. |
$0C00-$0FFF | Timer | 2 registers: reload value at $0C00, start and stop at $0C01. |
$1000-$13FF | I/O | The input/output port (the joypads), 1 register. |
$1400-$17FF | Interrupt controller | 4 registers: $1402 disables interrupts (bit 0 timer, bit 1 IRQ1, bit 2 IRQ2), $1403 holds the request status. |
$1800-$1FFF | (CD) | Unmapped on a plain system. The PC Engine CD’s interface registers start at $1800. |
The SuperGrafx replaces the first block by two video controllers and a priority controller. The VDC register numbers (selected with st0): 00 memory address write, 01 memory address read,
02 VRAM data, 05 control, 06 raster counter, 07 and 08 background scroll, 09 memory width, 0A-0E the sync and display registers, 0F DMA control, 10 DMA source, 11 DMA destination, 12 DMA length, 13 sprite table address.
Vectors
| Logical address | Vector |
|---|---|
$FFF6 | IRQ2, and BRK |
$FFF8 | IRQ1, the video display controller |
$FFFA | TIQ, the timer |
$FFFC | NMI |
$FFFE | Reset |
Each is a 16-bit address, low byte first, read through the mapping register of the top segment. On a card that is the last ten bytes of the first bank: file offset $1FF6.
The Street Fighter II mapper
The 2.5 MB card of Street Fighter II Champion Edition is the one common card with a mapper. In MAME’s description, the first 512 KB of the ROM are banks $00-$3F and stay;
banks $40-$7F (the logical window a program maps there) show one of four 512 KB parts after them, and a write to $1FF0, $1FF1, $1FF2 or $1FF3
chooses the part from the low two bits of the address. The first of the four is selected at reset. A file of exactly 2.5 MB is taken as this card.
| File bytes | Physical banks |
|---|---|
| $000000-$07FFFF (512 KB) | $00-$3F, always |
| $080000-$0FFFFF | $40-$7F when part 0 is chosen (write to $1FF0) |
| $100000-$17FFFF | $40-$7F when part 1 is chosen ($1FF1) |
| $180000-$1FFFFF | $40-$7F when part 2 is chosen ($1FF2) |
| $200000-$27FFFF | $40-$7F when part 3 is chosen ($1FF3) |
MAME’s addresses here are physical addresses of the card’s 1 MB space (banks $00-$7F), so the write to $1FF0-$1FF3 is a write into bank $00
at offset $1FF0, which is logical $FFF0-$FFF3 when bank 0 is at $E000; only the low two bits of the address matter. The registers are read from MAME’s source
(pce_sf2_device: set_entry(0) at reset, set_entry(offset & 3) on a write); no hardware document was read.
Populous’s card has 32 KB of RAM at physical $080000-$087FFF (banks $40-$43) and is known by the text “POPULOUS” at ROM offset $1F26 (MAME). The CD-ROM System Card is a 256 KB ROM
with the text “PC Engine CD-ROM SYSTEM” at offset $3FFB6 (MAME); MAME tells the version 3 cards, which add 192 KB of RAM, by the text “VER. 3.” at $29D1 (Japanese) or $29C4 (American).
The viewer notes the first two texts and does not model any of them.
Cards smaller than 1 MB
MAME builds the card’s 1 MB space from eight 128 KB blocks (rom_map_setup), so a smaller ROM is repeated. Block k of the space (physical banks $10·k to $10·k+$F) shows
128 KB block map[k] of the file:
| ROM size | map[0..7] | Meaning |
|---|---|---|
384 KB ($60000) | 0, 1, 0, 1, 2, 2, 2, 2 | the first 256 KB twice, then the last 128 KB four times (physical $40-$7F) |
192 KB ($30000) | 0, 1, 2, 2, 0, 1, 2, 2 | the 192 KB twice, the last 128 KB of each copy doubled (some demos) |
| any other size | 0, 1, 2 … for each whole 128 KB, then repeated | MAME fills the remaining blocks with copies of the earlier ones, so a power-of-two size (128, 256, 512 KB) repeats to fill 1 MB |
A file that is not a whole number of 128 KB blocks (such as 216 KB) is outside what these rules say; the viewer shows its banks at their own numbers. MAME also has a card type for the Tennokoe backup-memory
adapter (8 KB of battery RAM at $080000, locked by a write to $0F0000); it is named here only. The viewer applies the 384 KB and 192 KB maps to the “physical bank” column and to the code view’s physical addresses.
Not described
Known, not yet covered
- Reference: the Arcade Card’s registers, the CD-ROM interface, the SuperGrafx’s registers, the exact bank numbers the expansion hardware uses, the Tennokoe adapter’s details, and the mirroring of ROMs that are not a whole number of 128 KB blocks. The 384 KB, 192 KB and power-of-two layouts rest on MAME’s source only (no hardware document).
Unknown
- Reference: the bits of the joypad port and of the timer and interrupt registers beyond the few named above; the meaning of the VDC’s sync and display registers is not described.
Links
Reference
- CPU memory map – the PCEdev wiki: the banks, the hardware page and the vectors
- Memory Mapping – the physical map by address
- HuC6280 assembly programming for the PC Engine – Chibi Akumas: the register lists of the colour encoder, the sound generator and the interrupt controller
- pce_rom.cpp – MAME: the Street Fighter II and Populous cards