Sega Genesis rom/sram address mapping

Discussion of development of software for any "obsolete" computer or video game system.
Sik
Posts: 1589
Joined: Thu Aug 12, 2010 3:43 am

Re: Sega Genesis rom/sram address mapping

Post by Sik » Sat Sep 13, 2014 12:04 am

Byte-wide access only (try doing a word access on an odd address and the 68000 will yell at you at the very least). Though looking again at Tiido's diagram, it *is* just using the bottom bit... (honestly I don't know any game that actually cares about the SRAM protection anyway)

User avatar
getafixx
Posts: 364
Joined: Tue Dec 04, 2012 3:28 pm
Location: Canada

Re: Sega Genesis rom/sram address mapping

Post by getafixx » Sat Sep 13, 2014 11:47 am

lidnariq wrote: Maybe I'm confused, what exactly are you trying to do?
Is it "use a single 4MiB/2MiW ROM on a board while retaining this battery-backed save RAM" ?
In that case, you'd use either socket—as far as I know, all of D0…D15 and A1…A19 are connected to both—and connect the new PROM's /CE from the output of the 74'08. You may also need to connect A20 and A21 from the cartridge edge to the PROM.

i.e. ROM1 has /CE
and ROM2 has /CE
and you want something that is low if either are low.
Yeah I was just trying to get a 32Mbit cart to run just as one chip instead of needing two of them. I ordered a few 74HC08 chips, so I'll try it out hopefully next week.

Thanks again for your help guys!

Sik
Posts: 1589
Joined: Thu Aug 12, 2010 3:43 am

Re: Sega Genesis rom/sram address mapping

Post by Sik » Sat Sep 13, 2014 2:22 pm

Not an expert in electronics but a random thought: with a flip-flop (for the $A130xx register) and a 4-way multiplexer, couldn't you just get away with using the multiplexer as a decoder?

00 = low half of ROM (enable ROM)
01 = low half of ROM (enable ROM)
10 = high half of ROM (enable ROM)
11 = SRAM (enable SRAM)

(where bit 0 is the latch and bit 1 is the MSB of the address)

Although I'd imagine that if there wasn't something wrong with this that they'd have probably used that method for starters (unless 4MB ROMs were more expensive than two 2MB ones back then... I know many games are 2MB+1MB, including some games using SRAM, and in that case you indeed need two ROMs).

lidnariq
Posts: 9127
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: Sega Genesis rom/sram address mapping

Post by lidnariq » Sat Sep 13, 2014 4:55 pm

Looking at the depopulated boards at romlab ("ps4cart1", "ps4cart2"), the schematic does seem to be what TµEE drew.

Only problem I can see with using a '153 in this way is that we have three inputs (/CE0, Q0, A21), and when the '153's /E input is deasserted it drives all its outputs low, not high: the opposite of what we need.

User avatar
TmEE
Posts: 741
Joined: Wed Feb 13, 2008 9:10 am
Location: Estonia, Rapla city (50 and 60Hz compatible :P)
Contact:

Re: Sega Genesis rom/sram address mapping

Post by TmEE » Sun Sep 14, 2014 3:48 am

Image

User avatar
getafixx
Posts: 364
Joined: Tue Dec 04, 2012 3:28 pm
Location: Canada

Re: Sega Genesis rom/sram address mapping

Post by getafixx » Tue Sep 16, 2014 12:30 pm

Ok so parts came in, and TmEE's design works great! The rewiring makes it not worth it, but it proves the concept works. So, if its really just changing how the 74'74 and 74'139 is wired, why didn't Sega do this? It would have cut down on the cost of the extra maskrom and PCB size (slightly), unless of course 32Mbit roms were just too expensive back then.

Thanks for the all the help guys!

Sik
Posts: 1589
Joined: Thu Aug 12, 2010 3:43 am

Re: Sega Genesis rom/sram address mapping

Post by Sik » Tue Sep 16, 2014 4:27 pm

getafixx wrote:unless of course 32Mbit roms were just too expensive back then.
Very likely the reason. I already mentioned that many games were actually 3MB (basically 2MB+1MB).

User avatar
MottZilla
Posts: 2832
Joined: Wed Dec 06, 2006 8:18 pm

Re: Sega Genesis rom/sram address mapping

Post by MottZilla » Sat Sep 20, 2014 12:14 pm

I don't recall too many Genesis games being 32 megabits anyway. There are some but there are far more 24 megs and less. I had a list once as I was curious because you could find some older Copier units that had 24 megabits of DRAM but not as many with 32.

Sonic 3D Blast, Ultimate Mortal Kombat 3. Those are the only two games that spring to mind that were that large on Genesis. Oh and then you have Super Street Fighter 2 which was 40 megs I think.

There are far more that are 24 megs. Perhaps because the SNES seemed to be supported longer, there are alot more 32 meg games that could be listed for it.

Bretmi
Posts: 3
Joined: Wed May 29, 2019 9:59 am

Re: Sega Genesis rom/sram address mapping

Post by Bretmi » Wed May 29, 2019 10:04 am

Did someone still play Sega Genesis games? I download the games I extract the games and the emulator can't find them or if he sees the file it cant be played. I use only RetroArch emulator.


[Link to an HTML document offering download of infringing copies of works copyrighted to Disney and Warner Bros. removed. --MOD]

poorstudenthobbyist
Posts: 57
Joined: Fri Jun 24, 2016 4:20 pm

Re: Sega Genesis rom/sram address mapping

Post by poorstudenthobbyist » Thu Feb 13, 2020 6:55 am

Sorry to bump such an old thread, but is there a good resource for Sega Genesis memory mapping anywhere? I'm having a hard time finding dev manuals or anything like that.

Judging by the posts I've seen, it looks like the logic for games larger than 2MB to just skip the SRAM section in the beginning of the second 2MB section of memory, from $200000 to $20FFFF. Does this mean there's a garbage section of memory on the low byte regions of the PROM in this area for every game larger than 2MB? It looks like the logic just disables reading from the second 2MB chip, but doesn't do anything to be able to access this section of memory stored on the cartridge.

So is the max size of a game then actually a bit less less than 4MB? And the max SRAM a game could theoretically use is 64KB, even though the most (that I've seen so far anyway) is 32KB?

Also, just for my clarification to make sure I'm thinking correctly - $200000 is the first address of the SRAM - is this the low byte only? Because $200000 addresses directly to the EPROM would return sixteen bits, not 8, implying $200000 is the start of the second 4MB, not 2MB. And I know the 256K SRAM for the Genesis is only an 8 bit bus, and as was stated before, it uses the low byte. This means something like $200000 is low byte, $200001 is high byte? That's the even/odd nomenclature I've seen, right? I'm assuming this is reflected in the wiring of the PROM to the Genesis.

tepples
Posts: 21875
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Sega Genesis rom/sram address mapping

Post by tepples » Thu Feb 13, 2020 10:10 am

Games larger than 2 MiB that have battery-backed SRAM have a mapper to switch $200000-$3FFFFF between the upper 1 or 2 MiB of ROM and the SRAM.

The 68K architecture is big-endian: $1234 is stored as 12 34. This means $200000 is high and $200001 is low.

poorstudenthobbyist
Posts: 57
Joined: Fri Jun 24, 2016 4:20 pm

Re: Sega Genesis rom/sram address mapping

Post by poorstudenthobbyist » Thu Feb 13, 2020 5:48 pm

Ok I got you there, that means every other address space from $200000 to $20FFFF is dedicated to SRAM right? $200001, 3, 5, etc. (low end of word) goes to SRAM, the evens are part of ROM.

So in actuality, it's FFFF divided by 2, giving 256Kbit of SRAM space, right? That's the part I forgot.

Is the memory in the PROM at address $200001 unused then, because that address is dedicated for SRAM?

lidnariq
Posts: 9127
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: Sega Genesis rom/sram address mapping

Post by lidnariq » Thu Feb 13, 2020 6:19 pm

poorstudenthobbyist wrote:
Thu Feb 13, 2020 5:48 pm
(low end of word) goes to SRAM, the evens are part of ROM.
No. For games larger than 2MB, the game has to change at run-time whether it can access RAM or ROM. The normal wiring doesn't provide the ability to access ROM and RAM in an interleaved manner.

For OEM PCBs, I have been told that a number of cartridges also wire the ROM in "reverse-endian" manner (i.e. JEDEC D0 is connected to 68k D8 and vice versa), although the RAM is still connected to D0-D7.
So in actuality, it's FFFF divided by 2, giving 256Kbit of SRAM space, right? That's the part I forgot.
It turns out the 68k in the Genesis doesn't even have a A0 pin.

tepples
Posts: 21875
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Sega Genesis rom/sram address mapping

Post by tepples » Thu Feb 13, 2020 7:07 pm

Write one value to $A130F1, and $000000-$3FFFFF is ROM. Write another value, and $000000-$1FFFFF is ROM and $200000-$3FFFFF is RAM.

Further reading: "Saving progress with SRAM: Games larger than 2MB" and "MOVEP instruction: Using movep to read/write SRAM" on Plutiedev

poorstudenthobbyist
Posts: 57
Joined: Fri Jun 24, 2016 4:20 pm

Re: Sega Genesis rom/sram address mapping

Post by poorstudenthobbyist » Thu Feb 13, 2020 7:24 pm

tepples wrote:
Thu Feb 13, 2020 7:07 pm
Write one value to $A130F1, and $000000-$3FFFFF is ROM. Write another value, and $000000-$1FFFFF is ROM and $200000-$3FFFFF is RAM.

Further reading: "Saving progress with SRAM: Games larger than 2MB" and "MOVEP instruction: Using movep to read/write SRAM" on Plutiedev
Oh! So basically, the region between $200000 and $20FFFF can access RAM OR ROM then, based on the code? And anytime the value at $A130F1 is changed to switch between the RAM or ROM in this address space, the /TIME line is pulsed, which is what the logic in the diagrams above takes care of. Right?

I feel very silly now. I will blame it on reading the thread on a small phone screen, mostly in the morning haha
*insecure chuckle* :|

I just started reading about Genesis games yesterday. Seems like they're a bit easier to deal with than SNES.

Post Reply