ROM Mirroring (SNES)

Discussion in 'Modding and Hacking - Consoles and Electronics' started by jaskamakkara, Mar 19, 2018.

  1. jaskamakkara

    jaskamakkara Tinkering in the dark

    Joined:
    Aug 23, 2013
    Messages:
    140
    Likes Received:
    5
    I'm having a little difficulty deciding how to mirror oddly-sized ROMs for the SNES when burning onto 32Mb PROMs.

    Say I have a ROM thats 20Mb in size (2.5MB). Is it best to mirror the last 4Mb onto the back, making it 24Mb, then copy the last 8Mb of the new file onto the back to make 32Mb (in other words, copying the last 4Mb of the original file onto the end 3 times!)? or is it best to copy the last 12Mb of the original file onto the end to make 4Mb?

    My feeling is that I should do the first option, but I'm not sure. I know that it doesn't matter too much for most games, but some ROMs can detect mirroring and use it as a form of copy protection.

    Thanks for any help.
     
    Last edited: Mar 19, 2018
  2. Bad_Ad84

    Bad_Ad84 The Tick

    Joined:
    May 26, 2011
    Messages:
    8,613
    Likes Received:
    1,383
    You dont need to mirror it.
     
  3. jaskamakkara

    jaskamakkara Tinkering in the dark

    Joined:
    Aug 23, 2013
    Messages:
    140
    Likes Received:
    5
    Well, that's not strictly true TBH - I have had games (King of Demons, was it? Or maybe Demon's Crest) that didn't work until I mirrored the ROM - I just can't remember for the life of me how I mirrored it since it was years ago that I made them.
     
  4. jaskamakkara

    jaskamakkara Tinkering in the dark

    Joined:
    Aug 23, 2013
    Messages:
    140
    Likes Received:
    5
    You're right though that it's usually unnecessary, I just tend to double up 16Mb ROMs and quadruple 8Mb ROMs just as a "best practice" thing.

    I get that for something like 12Mb, you should copy the last 4Mb then double up the resulting file to 32Mb, I'm just confused with the 20Mb file as to whether it's best to do the 3xfinal 4Mb copy, or just copy the last 12Mb of the original file...
     
  5. jaskamakkara

    jaskamakkara Tinkering in the dark

    Joined:
    Aug 23, 2013
    Messages:
    140
    Likes Received:
    5
    Just to add to my point, I've heard that non-mirrored versions of FFV with the Eng translation (which is a 20Mb file BTW) will crash after the opening screen. Not sure if this is true, though.
     
  6. Bad_Ad84

    Bad_Ad84 The Tick

    Joined:
    May 26, 2011
    Messages:
    8,613
    Likes Received:
    1,383
    Any that require mirroring are exception to the rule. 99% dont require any sort of mirroring - that rom space doesnt exist as far as the game is concerned.

    If you have one that needs mirroring in this way (I have personally yet to see one), your first option is correct
     
    Traace likes this.
  7. jaskamakkara

    jaskamakkara Tinkering in the dark

    Joined:
    Aug 23, 2013
    Messages:
    140
    Likes Received:
    5
    OK thanks :)
     
  8. TriMesh

    TriMesh Site Supporter 2013-2017

    Joined:
    Jul 3, 2008
    Messages:
    2,364
    Likes Received:
    783
    If you want to replicate the exact behavior of the original cartridge, then you need to know which board it used. For example Street Fighter II Turbo is a 20Mb game, but might have two different mirroring schemes depending what board it was built on.

    The early carts were built on a SHVC-3J0N board with 3 ROM chips - they were mirrored like this:

    8Mbit - ROM chip 0
    8Mbit - ROM chip 1
    4Mbit - ROM chip 2
    4Mbit - Mirror of ROM chip 2
    8Mbit - Bus open

    The later ones built on a SHVC-BJ0N board with 2 ROM chips, and were mirrored like this:
    16 Mbit - ROM chip 0
    4 Mbit - ROM chip 1
    12Mbit - 3 mirrors of ROM chip 1

    So it's a hard question to answer...
     
    Last edited: Mar 19, 2018
    Pikmin and HyperGHZ like this.
  9. MottZilla

    MottZilla Champion of the Forum

    Joined:
    Feb 1, 2006
    Messages:
    5,073
    Likes Received:
    112
    The only games I'm aware of that care about proper mirroring are Mega Man X and Demon's Crest. Both utilize the mirroring effect as copy protection against Copier/Backup Devices of the time period. Demon's Crest on a 32mbit ROM should be doubled up. Mega Man X as TriMesh detailed might be a bit more complicated. But that's a very common game. Is anyone else aware of any other game to actually rely on proper ROM mirroring behavior? I'm fairly sure these are the only two.
     
  10. Pikmin

    Pikmin Resolute Member

    Joined:
    Dec 24, 2009
    Messages:
    936
    Likes Received:
    95
    Secret of Mana doesn’t work if not expanded to 32 mbit, if a chip that size is used.
    I've seen two different types, the 2 chip (2x 8mbit) version and a single one with 36 pins (so 32mbit?)

    Demon’s Crest/Blazon has also got SRAM protection from memory
     
    Last edited: Mar 19, 2018
  11. zzattack

    zzattack Spirited Member

    Joined:
    Nov 19, 2014
    Messages:
    161
    Likes Received:
    62
    Given what you wrote it is true. Any game >16MB written on a 32mbit chip will never require mirroring.
     
  12. Pikmin

    Pikmin Resolute Member

    Joined:
    Dec 24, 2009
    Messages:
    936
    Likes Received:
    95
    zzattack is it programmer related?
    As I said, if I burn the Secret of Mana which is 2 megabytes on a 32mbit chip without using Lunar expand, the game will not work.
     
  13. zzattack

    zzattack Spirited Member

    Joined:
    Nov 19, 2014
    Messages:
    161
    Likes Received:
    62
    No. All lunar expand does is pad the file with zeroes and patch the game header to reflect the new size. I think there's another reason your game didn't work.
     
  14. jaskamakkara

    jaskamakkara Tinkering in the dark

    Joined:
    Aug 23, 2013
    Messages:
    140
    Likes Received:
    5
    Fair enough. I only raised the question since I remember having to do it once and I wasn't sure how to do it on other games. Since it's not necessary in all but a couple of cases it's not really an issue. Thanks, everyone
     
  15. MottZilla

    MottZilla Champion of the Forum

    Joined:
    Feb 1, 2006
    Messages:
    5,073
    Likes Received:
    112
    If you put a 16mbit game on a 32mbit memory you need to copy the data or tie the highest address line to ground instead of connecting it normally. It's easier to just duplicate the data on the chip than to change your adapter or wiring. When I said the only games that care about "proper" mirroring I mean that they will detect incorrect memory mapping and enable copy protection measures. Other games can still crash if you do not have ROM mapped properly.

    If your memory in 32 megabit and the game is HiROM and runs at $C0 and higher banks then I think if you don't duplicate the 16mbit of data into the second half of the memory then these banks will be missing and the game will quickly crash. So again, you must fill your memory to capacity by simulating the mirroring that would happen on the original cartridge. You might get away without it in some cases but it's not advisable when it is so easy to do.
     
    Pikmin likes this.
  16. Pikmin

    Pikmin Resolute Member

    Joined:
    Dec 24, 2009
    Messages:
    936
    Likes Received:
    95
    Thanks, I understand that they are two separate things now.
    I was aware of region protection, SRAM protection but didn't know there are games with mirror protection too
     
  17. Ice Man

    Ice Man Member

    Joined:
    Dec 4, 2017
    Messages:
    9
    Likes Received:
    0
    There's no such thing as mirror protection or mirroring for the SNES. There's mapping: LoROM, HiROM, ExHiROM.
    I've build many SNES games, never really used Lunar Expand and ALL of them work fine.
    The problem you guys are encountering is simple.
    Example: King of Demons is 1.5MB in size and you probably tried to swap address lines using a tool so you can use 2x 27c801 and swap pin 24 <-> 31 instead of the classic connection scheme.
    The tool does not work with 512KB files, therefore you have to expand the ROM to 2MB first.
    This is not a protection of the game or problem of the games or Lunar Expand or your connection but rather the tool not swapping out the address lines properly with 512KB files.

    As for Secret of Mana being 2MB and programmed on a 4MB chip. I never really had such issue doing that with many games. What chip are you even using for that? 27c322, 29F032/29F033 or even MX29L3211?
     
  18. jaskamakkara

    jaskamakkara Tinkering in the dark

    Joined:
    Aug 23, 2013
    Messages:
    140
    Likes Received:
    5
    No. This is a problem that presents when simply burning the ROM file onto a flash ROM like a 29f033. The problem is that the game checks if the upper banks of ROM contain a mirror of the game data, if they don't then copy protection kicks in.
     
  19. Ice Man

    Ice Man Member

    Joined:
    Dec 4, 2017
    Messages:
    9
    Likes Received:
    0
    That's new to me. Like I said. I never had such issue.
    Perhaps try grounding A21 (Pin 39) from the 29F033. If that won't help, connect it to 5V.
    This way only the first 16MBit will be available and there shouldn't be any problems.
     
  20. jaskamakkara

    jaskamakkara Tinkering in the dark

    Joined:
    Aug 23, 2013
    Messages:
    140
    Likes Received:
    5
    Well, connecting it to GND would give you the bottom 2MB and pulling it high would give you the top 2MB, so it would depend on where you burned the ROM within the EEPROM. Also, that won't help in the case of the 1.5MB games since I am assuming the game is looking in the top 512kB of ROM for the mirrored data - clamping down A21 won't matter, the only way to get a mirror of the last 512kB of the ROM into that last 512kB of space (of the top/bottom 2MB, whichever you chose) is to burn it in there (EDIT - unless you do some more decoding to check if the game is looking in the top 512kB, but why do that if you can simply burn a few extra bytes when programming).
     

Share This Page