emuforge

The SPC7110

The SPC7110 decompresses data, reads a large data ROM, and multiplies and divides. In one game it has a clock beside it, the RTC-4513. Momotarou Dentetsu Happy, Super Power League 4 and Tengai Makyou Zero have one. These games test the chip themselves, which makes them the best test that this core has for a chip (below).

It is in crates/snes-spc7110. This chip was worked out by people who shared what they found. It could not be here without them:

Used for
neviksti, his program DecompTest.c and his posts in "SPC7110 Reverse Engineering Project" (2008)mode 0, and the arithmetic coder with its table, which all three modes use. This is a port, with his permission. He also measured how $4800 and bank $50 are read, and what the counter does
Andreas Naive, jolly_codger, caitsith2, kammedo and others in that threadthey worked it out with him. What is whose is in the crate's credits
Charles MacDonaldhe looked at all banks on a console with Tengai Makyou Zero, which gave the memory map. neviksti quotes it in that thread
Dark Force, The Dumper and kammedo, their documentthe registers and the ROM's map
Martin Korth's fullsnes, the sections named "SNES Cart SPC7110"the registers, the data port, the multiplier, and modes 1 and 2, which are our own code, written from its description
Epson, the RTC-4513's data sheetthe clock's registers and its leap years

What the main processor sees

The file is two ROMs. The first 1 MB is the program, and what follows is data, which has its own address space.

AddressWhat is there
$4800, and all of bank $50the next decompressed byte
$4801-$480Cthe decompression
$4810-$4818, $481Athe data port
$4820-$482Fthe multiplier and the divider
$4830bit 7 turns on the cartridge's RAM. It is off at first
$4831-$4833which 1 MB of the data ROM is at $D0-$DF, $E0-$EF and $F0-$FF. They are 0, 1 and 2 at first
$4834only kept. What it does is not known
$4840-$4842the clock: select, data and ready
$6000-$7FFFthe cartridge's RAM, 8 KB, if it is on
$00-$1F, $80-$9F: $8000-$FFFF, and $C0-$CFthe program ROM
$20-$3F, $A0-$BF: $8000-$FFFFthe data ROM, as in $E0-$FF. That these are its upper halves is a guess
$D0-$FFthe data ROM, in three blocks

The registers and the RAM are in banks $00-$3F and $80-$BF. The rest, such as $40-$4F and $51-$7D, is open bus.

Decompression

A directory in the data ROM has four bytes for each entry: a mode, and where the data is. The game writes where the directory is ($4801-$4803), which entry it wants ($4804) and how many bytes to skip ($4805-$4806). Writing $4806 starts. Then it reads the bytes one by one at $4800, or copies them with DMA. Each read lowers a counter in $4809-$480A, which stops nothing. Bit 7 of $480C says that there is data, and reading it clears that.

ModeForWhere it is from
0bytesneviksti's program (a port)
1tiles with 2 bits for each pixelour own, from fullsnes, with neviksti's coder
2tiles with 4 bits for each pixelour own, from fullsnes, with neviksti's coder

An unknown mode gives zeros, and the chip counts it for reports.

The data port

$4811-$4813 are an address in the data ROM. $4810 reads a byte there and moves on by 1, or by a step. $481A reads at the address and an offset. $4818 is the mode, which says what is added where and with which sign. It only counts once both bytes of the offset ($4814-$4815) have been written.

It gives 0 at first. fullsnes says this with "reportedly", and that writing something other than 0 to $4813 turns it on. The games' own test shows that both $4810 and $481A are 0 at first. It also shows that the port can be turned on another way: the test writes 0 to its registers, and can then read data. Here, any write to $4811-$4818 turns it on, which is a guess. Until then, a read changes nothing.

The clock

fullsnes has Tengai Makyou Zero as the only game with an RTC-4513. Its kind of cartridge is $F9. The main processor selects the clock with $4840 and sends a command and an address through $4841. Then it reads or writes one 4-bit register after another: seconds, minutes, hours, day, month, year, the day of the week, and three registers of control bits. $4842 always says that it is ready.

It can be stopped, held, reset and adjusted to the nearest minute, and it has 12-hour and 24-hour modes, leap years and flags for a lost time, for a change while it is selected and for its interrupt. No source says that its interrupt goes anywhere in the cartridge, so it does not interrupt the main processor. A clock that was never set shows the player's time. What its battery keeps is on the page about cartridges. Where fullsnes contradicts itself about which way round STOP works, "1 stops it" is used, which Dark Force's document has too.

The games' own test

With an empty save memory, all five files show a test of the chip (SPC7110 CHECK PROGRAM) in place of the game. It tests the chip in two parts, and wants to be turned off and on between them.

PartWhat it testsWhat it says here
1REG INIT: each register at power-onOK. Until the data port was fixed, it said NG
S-RAM DATA BUS, S-RAM ADDR BUS, S-RAM R/W: the RAMOK
D-PORT ACC, D-PORT B+O+S: the data portOK
MUL, DIVOK
C-LENGTHOK. From its name, it tests the length of what is decompressed. That was not looked at
RTC TIME, in Tengai Makyou Zero onlyOK
2S-RAM BACKUP: the RAM after being offOK, also without a save
RTC BACKUP, in Tengai Makyou Zero only: the clock after being offOK

What the first part did when it failed, and how it was found, is in how it was made.

How to see it

This is what the games did with the files of 6ac98a1. Each run was of a private program that presses the buttons itself, and the console was turned off and on with the battery put back. In the app, it was the same:

  1. Turn it on with no save. Part 1 runs and ends with ALL OK, and asks to be turned off. Tengai Makyou Zero asks for this in Japanese.
  2. Press a button. Without any press, the RAM stays as it was. With the script's presses (Start, A and B in turns), sixteen bytes of $11 were written at the end of the RAM. This is the mark that the game looks for when it is turned on. In the app, A alone is enough, which is also what Tengai Makyou Zero asks for.
  3. Turn it off and on. With the mark, the games say PUSH B BUTTON. Tengai Makyou Zero says so in Japanese, and also that its save is broken, as that is what is in a new cartridge.
  4. Press B. Part 2 runs, says ALL OK, and asks to be turned off again. In a run in which the script pressed A before B, part 1 came again.
  5. Turn it off and on again, and the game starts. Momotarou Dentetsu Happy and Super Power League 4 came to their menus, with sound. They showed 615 and 994 different pictures in 8,200 frames, which include the tests. Tengai Makyou Zero (three files) asks the player to set the date and the time, and the script did not get past that. It showed 76.

In the app

On 2026-12-01, Tengai Makyou Zero went through this in the app's Linux package (2dc121c), with real key presses, and the app was closed each time. A, and part 1 said ALL OK. The save had 8,216 bytes: the RAM and the clock. After a restart the game asked for B, and part 2 said ALL OK, with RTC BACKUP OK. After another one, its title appeared.

S-RAM BACKUP shows less than it seems. Pressing B before part 1 had run also gave part 2. The app had kept no save, and that line still said OK, but RTC BACKUP said NG. So only the second one can tell that something was kept. That the RAM is kept is shown by the mark, which the game finds after a restart.

Pictures of all of these were looked at, small. A player of these games has to do the same, as on a console.

What is a guess, and what is not there

  • How long anything takes. Each result is there at once. The chip has no interrupt.
  • The bytes to skip. If bit 1 of $480B is set, they are skipped 2 times as often in mode 1 and 4 times in mode 2. The wiki's version of Dark Force's document has this with question marks. If a game shows wrong tiles, this is the first thing to look at. $480B does nothing else.
  • Registers that are only described for writing give what was written. Bank $58, where MacDonald saw a "data port", is open bus.
  • While the RAM is off, it is open bus. ROM and RAM that are smaller than their place repeat.
  • Multiplying and dividing: bit 0 of $482E chooses signed numbers, and writing it resets nothing. Documents differ on that.
  • For the clock: day 0 of the week is Monday. Times and dates that cannot be, 12-hour midnight, what RESET does to the second and how long the interrupt flag stays. rtc.rs lists them all.

What was tested: fullsnes' example text decompresses correctly in all three modes, and each mode gives data of every kind and length back that our own compressors made. This does not show that modes 1 and 2 are right for all data. neviksti's part was compared with his own program, built from his file: 2,000 runs with made-up data gave the same 20,070,137 bytes. The clock goes through each day of a century, and the port, the arithmetic, the map and the RAM have tests of their own.

From commit 019fda0af379. Edit this page