Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Platform:PC Engine

From ReverseEngineering.wiki
Platform
Developer NEC, Hudson Soft
Versions PC Engine (1987), TurboGrafx-16 (1989), CD-ROM2 / Super CD-ROM2 / Arcade Card add-ons, SuperGrafx (1989)
Endianness little
Website https://www.mesen.ca/
On this wiki Facts · Code · Notes · Topics

NEC / Hudson's console (PC Engine 1987 JP, TurboGrafx-16 1989 NA): a Hudson HuC6280 (65C02 core at 1.79 or 7.16 MHz with a built-in 8-register bank mapper, timer and PSG) with the HuC6270 VDC and HuC6260 VCE video chips; games on HuCards and, with the CD-ROM2 add-on, on CD.

Overview

  • CPU: Hudson HuC6280, a 65C02-compatible core with extra instructions (block transfers, TAM/TMA to write and read the MPR registers, ST0/ST1/ST2 to the VDC). The CPU starts in slow mode (1.79 MHz) and can switch to 7.16 MHz; Mesen2 runs ExecSlow as four fast steps (PceMemoryManager.cpp).
  • Address spaces: the CPU has a 16-bit logical address space split into eight 8 KiB pages. Each page is mapped by one 8-bit MPR (memory paging register) to one of 256 physical banks of 8 KiB, so the physical space is 2 MiB (21 bits). Page index = (addr & 0xE000) >> 13, physical address = MPR[page] << 13 | (addr & 0x1FFF) (PceMemoryManager.h, Read).
  • Power on: MPR7 is 0 (so the reset vector is read from ROM bank 0 at 0xE000-0xFFFF); the other MPRs are undefined on real hardware (Mesen2 comment: randomised optionally).
  • Video: HuC6270 VDC (VRAM, sprites, backgrounds) and HuC6260 VCE (palette); the SuperGrafx adds a second VDC and the VPC priority chip (PceVpc). Sound: 6-channel PSG inside the HuC6280.
  • Dumps: HuCards are described on Format:PC Engine HuCard ROM image.

Physical bank map (MPR values)

Banks Contents
0x00-0x7F HuCard ROM (1 MiB window)
0x40-0x5F Populous card: 32 KiB card RAM (Mesen2 PceMemoryManager)
0x68-0x7F Super / Arcade CD-ROM2: 192 KiB (0x30000 bytes) card RAM
0x80-0x87 CD-ROM2 unit RAM, 64 KiB (PceCdRom::InitMemoryBanks)
0xF7 backup RAM (BRAM) of the CD-ROM unit, can be locked
0xF8-0xFB work RAM, 8 KiB (SuperGrafx: 32 KiB), mirrored over the four banks
0xFF hardware page, see below

Hardware page (bank 0xFF, CPU address 0x0000-0x1FFF in that bank)

Offset Device (PceMemoryManager::ReadRegister)
0x0000-0x03FF VDC (via VPC)
0x0400-0x07FF VCE
0x0800-0x0BFF PSG
0x0C00-0x0FFF timer
0x1000-0x13FF I/O port (joypad; bit 6 = region: set on TurboGrafx-16, bit 7 clear when a CD-ROM unit is attached)
0x1400-0x17FF interrupt disable (offset 2) and request (offset 3) registers
0x1800-0x1BFF CD-ROM unit registers

The usual way in is lda #$FF; tam #$01 to put the hardware page at CPU 0x0000, and tam #$02 with #$F8 for work RAM at 0x2000. The operand of TAM/TMA is a bitmask choosing the MPR (bit n = MPRn): Mesen2 passes it as regSelect to SetMprValue / GetMprValue (Core/PCE/PceCpu.Instructions.cpp, PceMemoryManager.cpp, commit b9fa69ddc6). TAM stores A into every MPR whose bit is set; TMA ORs together the selected MPRs; an operand of 0 is a no-op for TAM and TMA returns the last value written by TAM.

Vectors

At the top of the page mapped by MPR7 (PceCpu.h): IRQ2/BRK 0xFFF6, IRQ1 (VDC) 0xFFF8, timer 0xFFFA, NMI 0xFFFC, reset 0xFFFE.

CD-ROM system card

CD games run from a System Card (BIOS) loaded as a HuCard-like ROM; Mesen2 loads the firmware before the disc (PceConsole::LoadFirmware) and sets the card RAM to 0x30000 bytes for Super CD-ROM2 / Arcade Card, 0x8000 for Populous. The disc is accessed over a SCSI bus emulation (CdRom/PceScsiBus), with ADPCM and CD audio fader registers in the 0x1800 range. RAM sizes in Mesen2 (commit b9fa69ddc6): the CD-ROM2 unit has 64 KiB of work RAM (_cdromRamSize = 0x10000 in PceCdRom.cpp, mapped at banks 0x80-0x87); Super CD-ROM2 adds 192 KiB of card RAM (cardRamSize = 0x30000 in PceConsole.cpp, banks 0x68-0x7F), which the Arcade Card setup also has; and the Arcade Card adds 2 MiB of its own RAM (ArcadeRamMemSize = 0x200000 in PceArcadeCard.h).

Related

Platform:Nintendo Entertainment System and Platform:Super Nintendo Entertainment System (competitors with 6502-family CPUs), Platform:Sega Mega Drive.

Code & repositories

  • https://github.com/SourMesen/Mesen2 @ b9fa69ddc6d0a331fb103fdb5eef6904305703c2 · license: GPL-3.0 (declared by the contributor; GitHub's detector did not recognize LICENSE)
    Multi-system emulator with debugger; Core/SMS (Sega mapper, Codemasters), Core/PCE (MPR banking, SF2 mapper, CD-ROM), Core/WS (cart footer parsing)
    Tested on: source read, not run: read the source, not built · checked 2026-10-18