This commit is contained in:
ekeeke31 2007-08-17 17:31:33 +00:00
parent 0711a6f9d8
commit bb5d6137a2
4 changed files with 2 additions and 331 deletions

BIN
source/docs/eeprom.doc Normal file

Binary file not shown.

View File

@ -1,329 +0,0 @@
Here are some notes about EEPROM emulation, which is used in a few Sega Genesis Cartridge as external Backup RAM.
The protocol used to communicate (read/write) with serial EEPROM is explained below:
1/ from 68000 cpu (MASTER), which is running the ROM program, each EEPROM can be managed using only two single lines:
- /SDA is the DATA line, used to send/receive data (READ/WRITE)
- /SCL is the CLOCK line used to synchronize the EEPROM cycles (WRITE ONLY)
2/ each line is mapped in the 68000 address space at a specific address as one specific bit (see game mappers below)
and can be set at LOW (bit=0) or HIGH (bit=1) state.
3/ each READ/WRITE operation must be initiated with a START condition and terminated by a STOP condition:
- START condition is set when /SDA is changed from HIGH to LOW while /SCL remaining HIGH
- STOP condition is set when /SDA is changed from LOW to HIGH while /SCL remaining HIGH
4/ Following the START condition, the Master send one or more 8-bit word through the /SDA line to specify the address
that must be read or write.
Each bit write requires one clock cycle, managed by changing /SCL line state.
There are 3 known EEPROM Modes, each one using different addressing protocol:
- Mode 1 EEPROMs (24C01 only) have a maximal size of 128bytes (7bits address) and need only one address word.
The 7 first bits specify the memory address to be read/write and the 8th bit indicates if the operation type (READ or WRITE)
- Mode 2 EEPROMs (24C01 to 24C16) can be linked together (8 slave devices max.), that means in fact one 24C16, two 24C08, four 24C04,
or eight 24C02/24C01, for a maximal size of 2 Kbytes (11bits address max.).
A first word is needed: the first 4 bits are fixed and, depending on the EEPROM size, the next 3bits specify the device address
and eventually the one (24C04), two (24C08) or three (24C16) upper bits of the memory address to be read/write.
As before, the 8th bit specifies the type of the operation (READ or WRITE)
Then a second word is needed to specify the eight lower bits of the address to be read/write.
- Mode 3 EEPROMS (24C32 and more) work quite the Type 2 EEPROMS excepted that the maximal address size is 64 Kbytes (16bits address max.)
The first word is like in the previous type, bits d3-d1 always specifying the slave device address (8 linked devices max.)
The second word specifies the upper bits of the address to be read/write.
A third word specifies the eight lower bits of the address to be read/write.
NOTE: In Mode2 and Mode3, before a READ operation, only the SLAVE ADDRESS WORD will be sent, the EEPROM contains an address counter
that maintains the address of the last word to be accessed (from a previous READ or WRITE operation)
5/ Each time a 8bits word has been written (which requires eight clock cycles), the receiver (could be EEPROM or MASTER) send an acknowledge
to the sender by setting /SDA line LOW during the 9th cycle (ACK cycle).
6/ After a WRITE SEQUENCE has been initiated, the MASTER will sent DATA as one or more sequences of 8bits words.
After each written word, the EEPROM must send a ACK and increment the address for the next data word to be written.
Word address will roll up to base address when maximal writepage size has been reached.
If the Master send a STOP condition, the WRITE operation ends.
Otherwise the WRITE operation continues to next address.
7/ After a READ SEQUENCE has been initiated, the MASTER will read DATA as one or more sequence of 8bits words.
After each received word, the MASTER will send a ACK and the EEPROM will increment the address of the next data word to be read.
Word address will roll up to 0 when maximal memory size has been reached.
If the Master does not send a ACK during the 9th cycle, the READ operation ends and the EEPROM waits for STOP condition.
Otherwise, the READ operation continue to next address.
This is pretty how I emulate EEPROM access in Genesis Plus (see eeprom.c for technical details).
Thanks a lot to 8bitWizard from Spriteminds.net forums which initially give indications about the various EEPROM types and mappers
that can be found in Sega Genesis games.
Here are some links to datasheets with should explain everything better than me and my crappy english ;)
MODE1 (24C01 only):
http://www.icmic.com/datasheets/X24C01.pdf
MODE2 (24C01 - 24C16):
http://www.atmel.com/dyn/resources/prod_documents/doc0180.pdf
MODE3 (24C32 and more):
http://www.phys.hawaii.edu/~bryce/component_data/24LC65-ISM.pdf
Below are the Sega Genesis games that I found using serial EEPROM as external Backup RAM.
I also give their specific caracteristics (mapper, size, ...), determined when testing my emulation code.
EkeEke
July 2007
-------------------------------------------------------
ACCLAIM (81)
-------------------------------------------------------
NBA Jam (UE)
NBA Jam (J)
------------
T-081326
T-81033
header OK ($200001-$200001)
TYPE: 8BITS WORD ADDRESS
SIZE_MASK: 0xFF (24C02)
PAGE_MASK: 0x03
SDA_IN : 0x200000 (bit 0)
SDA_OUT: 0x200000 (bit 1)
SCL : 0x200000 (bit 1)
NB: this game uses a different EEPROM mapper than any other Acclaim games.
Blockbuster World Video Game Championship II (U)
NBA Jam Tournament Edition (JUE)
------------------------------------------------
T-81406
header KO
TYPE: TYPE: 8BITS WORD ADDRESS
SIZE_MASK: 0xFF (24C02)
PAGE_MASK: 0x03
SDA_IN : 0x200001 (bit 0)
SDA_OUT: 0x200001 (bit 0)
SCL : 0x200000 (bit 0)
NB: Rev 00 of the game has buggy eeprom support and game backup does not seem to work fine, only Rev01
version will correctly save game data.
For history, Steve Snake, the author of Kega, one of the best Genesis emulator for Win32 platforms, is
the one who originally developped this game.
I assume that he released himself later some kind of patch to fix the backup support.
(from the header informations, rev01 has been released in 2002, eight years after rev00 !)
NFL Quarterback Club (JUE)
-----------------------------
T-081276
header OK ($200000-$200001)
TYPE: TYPE: 8BITS WORD ADDRESS
SIZE_MASK: 0xFF (24C02)
PAGE_MASK: 0x03
SDA_IN : 0x200001 (bit 0)
SDA_OUT: 0x200001 (bit 0)
SCL : 0x200000 (bit 0)
NFL Quarterback Club 96 (UE)
-----------------------------
T-081586
header OK ($200000-$200001)
TYPE: TYPE: 8BITS WORD ADDRESS
SIZE_MASK: 0x7FF (24C16)
PAGE_MASK: 0x07
SDA_IN : 0x200001 (bit 0)
SDA_OUT: 0x200001 (bit 0)
SCL : 0x200000 (bit 0)
College Slam (U)
----------------
T-81576
header OK ($200001-$200001)
TYPE: 16BITS WORD ADDRESS
SIZE_MASK: 0x1FFF (24C64)
PAGE_MASK: 0x07
SDA_IN : 0x200001 (bit 0)
SDA_OUT: 0x200001 (bit 0)
SCL : 0x200000 (bit 0)
Frank Thomas Big Hurt Baseball (UE)
----------------
T-81476
header OK ($200000-$200001)
TYPE: 16BITS WORD ADDRESS
SIZE_MASK: 0x1FFF (24C64)
PAGE_MASK: 0x07
SDA_IN : 0x200001 (bit 0)
SDA_OUT: 0x200001 (bit 0)
SCL : 0x200000 (bit 0)
-------------------------------------------------------
CAPCOM (12)
-------------------------------------------------------
Megaman - The Wily Wars (E)
Rockman Mega World (J) [alt]
----------------
T-12046
T-12053 (checksum = 0xEA80)
header OK ($200001-$200001)
TYPE: 7BITS WORD ADDRESS
SIZE_MASK: 0x7F (24C01)
PAGE_MASK: 0x03
SDA_IN : 0x200001 (bit 0)
SDA_OUT: 0x200001 (bit 0)
SCL : 0x200001 (bit 1)
NOTE: the original version of Rockman Mega World (J) uses traditional SRAM, header gives $200000-$203FFF range
the alternate version uses a 128bytes serial EEPROM (X24C01)
the two versions share the same GAME NAME and PRODUCT ID
-------------------------------------------------------
Electronic Arts (50)
-------------------------------------------------------
NHLPA Hockey 93 (UE)
----------------
T-50396
header KO
TYPE: 7BITS WORD ADDRESS
SIZE_MASK: 0x7F (24C01)
PAGE_MASK: 0x03
SDA_IN : 0x200000 (bit 7)
SDA_OUT: 0x200000 (bit 7)
SCL : 0x200000 (bit 6)
Rings of Power (UE)
----------------
T-50176
header KO
TYPE: 7BITS WORD ADDRESS
SIZE_MASK: 0x7F (24C01)
PAGE_MASK: 0x03
SDA_IN : 0x200000 (bit 7)
SDA_OUT: 0x200000 (bit 7)
SCL : 0x200000 (bit 6)
-------------------------------------------------------
SEGA
-------------------------------------------------------
Evander 'Real Deal' Holyfield's Boxing (JUE)
----------------------------------
MK-1215
header OK ($200001-$200001)
TYPE: 7BITS WORD ADDRESS
SIZE_MASK: 0x7F (24C01)
PAGE_MASK: 0x03
SDA_IN : 0x200001 (bit 0)
SDA_OUT: 0x200001 (bit 0)
SCL : 0x200001 (bit 1)
Greatest Heavyweights of the Ring (U)
Greatest Heavyweights of the Ring (J)
Greatest Heavyweights of the Ring (E)
-----------------------------
MK-1228
G-5538
PR-1993
header OK ($200001-$200001)
TYPE: 7BITS WORD ADDRESS
SIZE_MASK: 0x7F (24C01)
PAGE_MASK: 0x03
SDA_IN : 0x200001 (bit 0)
SDA_OUT: 0x200001 (bit 0)
SCL : 0x200001 (bit 1)
Wonder Boy in Monster World (UE)
Wonder Boy V - Monster World III (J)
----------------
G-4060
header OK ($200001-$200001)
TYPE: 7BITS WORD ADDRESS
SIZE_MASK: 0x7F (24C01)
PAGE_MASK: 0x03
SDA_IN : 0x200001 (bit 0)
SDA_OUT: 0x200001 (bit 0)
SCL : 0x200001 (bit 1)
-------------------------------------------------------
CODEMASTERS
-------------------------------------------------------
Micro Machines 2 - Turbo Tournament (E) (J-Cart)
------------------------------------------------
T-120096-50
header KO
TYPE: TYPE: 8BITS WORD ADDRESS
SIZE_MASK: 0x3FF (24C08)
PAGE_MASK: 0x0F
SDA_IN : 0x300000 (bit 0)
SDA_OUT: 0x380001 (bit 7)
SCL : 0x300000 (bit 1)
NB: this game needs the external RAM to be initialized with 0xFF otherwise it won't initialize memory with correct data.
Micro Machines Military (E) (J-Cart)
------------------------------------
00000000-00 (checksum = 0x168B or 0xCEE0)
header KO
TYPE: TYPE: 8BITS WORD ADDRESS
SIZE_MASK: 0x3FF (24C08)
PAGE_MASK: 0x0F
SDA_IN : 0x300000 (bit 0)
SDA_OUT: 0x380001 (bit 7)
SCL : 0x300000 (bit 1)
Micro Machines Turbo Tournament 96 (E) (J-Cart)
------------------------------------------------
00000000-00 (checksum = 0x165E or 0x2C41)
header KO
TYPE: TYPE: 8BITS WORD ADDRESS
SIZE_MASK: 0x7FF (24C16)
PAGE_MASK: 0xF
SDA_IN : 0x300000 (bit 0)
SDA_OUT: 0x380001 (bit 7)
SCL : 0x300000 (bit 1)

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* Serial EEPROM support for Sega Genesis games * Serial EEPROM support for Sega Genesis games
* *
* Copyright (C) 2007 EkeEKe * Copyright (C) 2007 EkeEke
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View File

@ -18,7 +18,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* *
* *
* Freeze State support (added by EkeEke for the Gamecube's port - Feb,2007) * Freeze State support (added by EkeEke for Gamecube's port - Feb,2007)
* *
***************************************************************************/ ***************************************************************************/
#include "shared.h" #include "shared.h"