# piece-emu

> Built from commit 3effc4a043e0 on 2026-11-24. The current build: https://abdess.github.io/retrobios/version.json

Source: https://abdess.github.io/retrobios/emulators/piece/

piece-emu emulates Aquaplus PIECE.

**About this profile**

| Detail | Value |
|---|---|
| Type | libretro |
| Classification | Official port |
| Source | [https://github.com/autch/piece-emu](https://github.com/autch/piece-emu) |
| Version | 0.3, stated in [`src/libretro/piece_libretro.cpp`](https://github.com/autch/piece-emu/blob/9aedad032c5d06a8c6d7cf74142a2b9ac32d77ac/src/libretro/piece_libretro.cpp) |
| Revision | [autch/piece-emu@9aedad032c5d](https://github.com/autch/piece-emu/commit/9aedad032c5d06a8c6d7cf74142a2b9ac32d77ac) |
| Run by | [Batocera](https://abdess.github.io/retrobios/platforms/batocera/), [EmuDeck](https://abdess.github.io/retrobios/platforms/emudeck/), [Lakka](https://abdess.github.io/retrobios/platforms/lakka/), [RetroArch](https://abdess.github.io/retrobios/platforms/retroarch/), [RetroDECK](https://abdess.github.io/retrobios/platforms/retrodeck/), [RetroPie](https://abdess.github.io/retrobios/platforms/retropie/) |
| Profiled | 2026-11-09 |
| Profile | [YAML](https://github.com/Abdess/retrobios/blob/main/emulators/piece.yml), [JSON](https://abdess.github.io/retrobios/api/v1/emulators/piece.json) |
| Cores | piece |
| Systems | [Aquaplus PIECE](https://abdess.github.io/retrobios/systems/aquaplus/#piece) |

**Platform details**

-

**flash_image:**

  - format: PFI
  - header_size: 40
  - flash_base: 0xC00000
  - sector_size: 4096
  - source_ref: [`src/pfi_format.h:22-47`](https://github.com/autch/piece-emu/blob/9aedad032c5d06a8c6d7cf74142a2b9ac32d77ac/src/pfi_format.h#L22-L47), [`src/debug/pfi_loader_blob.cpp:20-91`](https://github.com/autch/piece-emu/blob/9aedad032c5d06a8c6d7cf74142a2b9ac32d77ac/src/debug/pfi_loader_blob.cpp#L20-L91)

-

**kernel_source:**

  - name: PieceSystem 1.20 updater
  - url: [https://aquaplus.jp/piece/dl/update120.exe](https://aquaplus.jp/piece/dl/update120.exe)
  - archive: LHA self-extracting executable
  - members: {'path': 'piece/update/all.bin', 'size': 516096, 'flash': '512 KB factory units', 'command': 'mkpfi -512kb piece/update/all.bin piece.pfi'}, {'path': 'piece/update/2mb/all.bin', 'size': 516096, 'flash': '2 MB modified units', 'command': 'mkpfi -2mb piece/update/2mb/all.bin piece.pfi'}
  - source_ref: [`src/tools/mkpfi.c:14`](https://github.com/autch/piece-emu/blob/9aedad032c5d06a8c6d7cf74142a2b9ac32d77ac/src/tools/mkpfi.c#L14), [`src/tools/mkpfi.c:88-95`](https://github.com/autch/piece-emu/blob/9aedad032c5d06a8c6d7cf74142a2b9ac32d77ac/src/tools/mkpfi.c#L88-L95), [`src/tools/mkpfi.c:115-135`](https://github.com/autch/piece-emu/blob/9aedad032c5d06a8c6d7cf74142a2b9ac32d77ac/src/tools/mkpfi.c#L115-L135)

**Technical notes**

Aquaplus P/ECE emulator (EPSON S1C33209 SoC, S1C33000 CPU core) by Autch. The repository ships an SDL3 standalone, a headless runner and the libretro core, all built from the same core, soc, board and system sources ([`src/libretro/CMakeLists.txt:17-57`](https://github.com/autch/piece-emu/blob/9aedad032c5d06a8c6d7cf74142a2b9ac32d77ac/src/libretro/CMakeLists.txt#L17-L57)).

The content is a P/ECE Flash Image (.pfi): a 40-byte PFIHEADER carrying the SYSTEMINFO block, then the raw flash contents at the stored offset ([`src/pfi_format.h:22-47`](https://github.com/autch/piece-emu/blob/9aedad032c5d06a8c6d7cf74142a2b9ac32d77ac/src/pfi_format.h#L22-L47)). retro_get_system_info sets need_fullpath to false, so the frontend hands the file over as a memory blob ([`src/libretro/piece_libretro.cpp:231`](https://github.com/autch/piece-emu/blob/9aedad032c5d06a8c6d7cf74142a2b9ac32d77ac/src/libretro/piece_libretro.cpp#L231)). retro_load_game checks the PFI signature and SYSTEMINFO.size == 32, sizes SRAM and flash from SYSTEMINFO, copies the flash bytes into an SST39VF flash device and starts the CPU at the reset vector read from flash base 0xC00000 ([`src/libretro/piece_libretro.cpp:271-362`](https://github.com/autch/piece-emu/blob/9aedad032c5d06a8c6d7cf74142a2b9ac32d77ac/src/libretro/piece_libretro.cpp#L271-L362), [`src/debug/pfi_loader_blob.cpp:20-49`](https://github.com/autch/piece-emu/blob/9aedad032c5d06a8c6d7cf74142a2b9ac32d77ac/src/debug/pfi_loader_blob.cpp#L20-L49), [`58-91`](https://github.com/autch/piece-emu/blob/9aedad032c5d06a8c6d7cf74142a2b9ac32d77ac/src/debug/pfi_loader_blob.cpp#L58-L91)). The P/ECE kernel, its PFFS file system and the installed applications (.pex) all live in that flash image. The bus maps internal IRAM, external SRAM, external flash and I/O only ([`src/core/bus.hpp:75-79`](https://github.com/autch/piece-emu/blob/9aedad032c5d06a8c6d7cf74142a2b9ac32d77ac/src/core/bus.hpp#L75-L79) and [`src/core/bus.hpp:239`](https://github.com/autch/piece-emu/blob/9aedad032c5d06a8c6d7cf74142a2b9ac32d77ac/src/core/bus.hpp#L239)). The core carries no embedded boot code, and retro_set_environment registers core options and nothing else ([`src/libretro/piece_libretro.cpp:204-218`](https://github.com/autch/piece-emu/blob/9aedad032c5d06a8c6d7cf74142a2b9ac32d77ac/src/libretro/piece_libretro.cpp#L204-L218)). No environment call asks for the system directory.

RETRO_MEMORY_SAVE_RAM exposes the whole flash as a PFI image (original header, then the flash bytes, re-copied sector by sector when the kernel writes), so the frontend's .srm is itself a bootable .pfi ([`src/libretro/piece_libretro.cpp:334-352`](https://github.com/autch/piece-emu/blob/9aedad032c5d06a8c6d7cf74142a2b9ac32d77ac/src/libretro/piece_libretro.cpp#L334-L352), [`538-564`](https://github.com/autch/piece-emu/blob/9aedad032c5d06a8c6d7cf74142a2b9ac32d77ac/src/libretro/piece_libretro.cpp#L538-L564), [`614-624`](https://github.com/autch/piece-emu/blob/9aedad032c5d06a8c6d7cf74142a2b9ac32d77ac/src/libretro/piece_libretro.cpp#L614-L624)). A stored .srm with a valid header replaces the flash on the first frame ([`src/libretro/piece_libretro.cpp:398-420`](https://github.com/autch/piece-emu/blob/9aedad032c5d06a8c6d7cf74142a2b9ac32d77ac/src/libretro/piece_libretro.cpp#L398-L420)).

A .pfi is produced from the official Aquaplus PieceSystem 1.20 updater with the bundled mkpfi. mkpfi checks the "Piece Kernel Program" signature at offset 8 of all.bin, writes the boot vector 0x00C02004 into sector 0, leaves sector 1 blank and copies all.bin from sector 2 ([`src/tools/mkpfi.c:14`](https://github.com/autch/piece-emu/blob/9aedad032c5d06a8c6d7cf74142a2b9ac32d77ac/src/tools/mkpfi.c#L14), [`88-95`](https://github.com/autch/piece-emu/blob/9aedad032c5d06a8c6d7cf74142a2b9ac32d77ac/src/tools/mkpfi.c#L88-L95), [`115-135`](https://github.com/autch/piece-emu/blob/9aedad032c5d06a8c6d7cf74142a2b9ac32d77ac/src/tools/mkpfi.c#L115-L135)). A fresh image boots to the launcher with startup.pex, date.pex and gamepad.pex installed, and games are added with pfar.

No BIOS or firmware files required.

## Next steps

- [Get the files](https://abdess.github.io/retrobios/which-pack/), for the setup in use
- [Every system](https://abdess.github.io/retrobios/systems/), and the files each one needs
- [When a game does not start](https://abdess.github.io/retrobios/wiki/troubleshooting/)

Data as of 24 November 2026.
