It is currently Tue Jul 23, 2019 1:58 am

All times are UTC - 7 hours



Forum rules





Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: Mapper 35
PostPosted: Thu Jun 27, 2019 2:31 am 
Offline

Joined: Tue Feb 07, 2017 2:03 am
Posts: 733
So I was trying to put Fire Emblem 4 into my Super Regenerator and I hit a few issues. Namely I didn't support HiROM yet, but as I added HiROM I still hit issues. The ROM is 8MB, and well HiROM only supports 6 apparently. Then I found for 8MB you need SA-1, however this is not SA-1. Upon digging into the header I found
Mapper 35
Cart Type 02

So its "fast" ROM, which rules out SA-1, its has no expansion RAM, and its mapper 35. I can't find anywhere that specifies what 35 actually is and how it maps in 8MB. Anybody know of a source?


Top
 Profile  
 
 Post subject: Re: Mapper 35
PostPosted: Thu Jun 27, 2019 4:30 am 
Offline

Joined: Tue Feb 07, 2017 2:03 am
Posts: 733
So its probably 25 just at 3.58Mhz.. which gives 7.5MB which explains why the end part of the ROM file is 00

However the map in figure 2-21-4 has in then ROM map numbers going both ways???

so
banks 3e-3f is 3e-3f on the ROM
banks 40-7D is 00-3D on the ROM
banks c0-ff is 3f-7E on the ROM

then
00-3e is mirror of the upper 32K of 40-7D
80-BF is mirror of the upper 32K of C0-FF

?


Top
 Profile  
 
 Post subject: Re: Mapper 35
PostPosted: Thu Jun 27, 2019 9:59 am 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 8488
Location: Seattle
Layout $25 puts the 4 MiB accessed at banks $C0-$FF first the in file (and mirrored at $80-$BF), followed by the 3.9 MiB accessed at $40-$7D (and mirrored at $00-$3D), followed by the last 128 KiB that are partially blocked and partially accessible only via $3E and $3F.

This is why the header in the file shows up at offset 0x40FFB0, because the header is required to be right below the hardware-required vectors.


Top
 Profile  
 
 Post subject: Re: Mapper 35
PostPosted: Thu Jun 27, 2019 12:58 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 9:28 pm
Posts: 4156
Location: A world gone mad
I think everyone's covered the details so far, but I'll say this:

Oziphantom wrote:
So I was trying to put Fire Emblem 4 into my Super Regenerator and I hit a few issues. Namely I didn't support HiROM yet, but as I added HiROM I still hit issues. The ROM is 8MB, and well HiROM only supports 6 apparently. Then I found for 8MB you need SA-1 ...

To be clear here: most mode 21 (HiROM) PCBs only support up to 32mbits (4MByte) of wired addressing space. Nintendo's own official documentation outlines this fact repeatedly throughout everything (from PCB documentation to memory map layouts later on in the same doc).

There may be some unique PCBs that extend that to 48mbit (6MBytes) -- technically this is certainly possible depending on how the PCB is wired for extending the ROM-to-addressing space -- but they do not appear to be officially documented. (Nintendo, however, is known to have made some boards for specific developers (read: games) that are not officially documented but were in fact used for those games in final release. I do not know if this is relevant to the game you're looking at.)

For things larger than 32mbit (4MByte), you are expected to use mode 25 -- which supports up to 64mbit (8MByte) of addressing space. Mode 35 is just mode 25 but with high-speed (3.58MHz / fastROM) support. So what you're looking at is a mode 25 game. Sadly, Nintendo did not document production 64mbit boards in their docs (well, sort of; more on that in a moment.)

For development (read: PCBs supporting EPROMs natively), you're supposed to request an SHVC-8PV5B-64M board -- note the "-64M" part. However, in official documentation, refer to page 1-2-28 describing SHVC-8PV5B, and read the very fine print for some amusement: "The earlier 8PV5B PCB version can use up to 64mbit ROM, but do not exist 32mbit on this PCB (DSW1 pin 7 off)." In other words: some of the earlier developer PCBs allowed up to 64mbit "by chance" via extra traces that Nintendo later pulled for whatever reason. I believe this also applied to some production (mask ROM) PCBs.

An alternate approach is to use the SA-1 chip, which is a whole separate and unique beast of its own and will drive you absolutely insane. It is not "just a mapper" chip. If you ever encounter projects with this thing, my advice is to avoid them if you value your sanity.

So we're back to the question: what is the memory map for mode 25? The answer is actually on page 2-21-5 (figure 2-21-4), as you discovered. This diagram is "hard to understand" because of what all is mapped where non-linearly. lidnariq covered it tersely, but here's the mapping:

Bank $C0-FF, $0000-FFFF: first 32mbit of ROM -- supports fastROM / 3.58MHz
Bank $40-7D, $0000-FFFF: next 32mbit of ROM, sans the last 128KB of ROM (this is because of banks $7E-7F being the work RAM area)
Bank $3E-3F, $8000-FFFF: 64KB portion of the aforementioned 128KB of ROM -- not sure if the penultimate 64KB of ROM or the final/last 64KB; suspect penultimate. lidnariq, can you confirm/speculate?

And now for the mirroring (mirrored areas are denoted with a ' (apostrophe) after their description in the diagram; hard to see though):

Bank $00-3D, $8000-FFFF: upper half of banks $40-7D (this is needed for CPU vectors in bank $00, etc.
Bank $80-BF, $8000-FFFF: upper half of banks $C0-FF -- supports fastROM / 3.58MHz

And finally, battery-backed SRAM and DSP (don't know if this game has DSP or not, but SRAM almost certainly since it's an RPG):

Bank $00-0F, $6000-7FFF: DSP region (up to 128KB)
Bank $B0-BF, $6000-7FFF: battery-backed SRAM on cartridge (up to 128KB in size)

Hope this helps, and apologies if this confuses things at all.


Top
 Profile  
 
 Post subject: Re: Mapper 35
PostPosted: Thu Jun 27, 2019 1:23 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 8488
Location: Seattle
koitsu wrote:
Bank $3E-3F, $8000-FFFF: 64KB portion of the aforementioned 128KB of ROM -- not sure if the penultimate 64KB of ROM or the final/last 64KB; suspect penultimate. lidnariq, can you confirm/speculate?
"Both".

CPU address $3E8000 has what would be at CPU address $7E8000 if it were addressable. So it's a 32KiB hole, followed by 32 KiB, followed by another 32KiB hole, followed by the final 32 KiB.


Top
 Profile  
 
 Post subject: Re: Mapper 35
PostPosted: Thu Jun 27, 2019 1:48 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 9:28 pm
Posts: 4156
Location: A world gone mad
Oh, I think I understand. Wow, talk about not well explained at all (in docs or here), and wonderfully misleading (in the case of your reply; I say that respectfully despite sounding judgy). Please correct me if I'm wrong, but:

Of the 128KB portion of ROM that gets "lost", you do in fact "lose" 64KB of it, but not linearly. In other words, of the 128KB that normally would have ended up in bank $7E-7F:

The first 32KB portion gets lost -- effectively mapped no where**
The next 32KB portion gets mapped to $3E8000-FFFF
The next 32KB portion gets lost -- effectively mapped no where**
The final 32KB portion gets mapped to $3F8000-FFFF

Honestly considering that 8MBytes for a SNES game is huge to begin with, "losing" 64KB of ROM does not seem particularly painful.

** -- It would technically get mapped to $3E0000-7FFF and $3F0000-7FFF but that is not the case due to the system mappings/mirroring that take priority, including the "RESERVED AREA" (refer to doc). So, you lose this portion.


Top
 Profile  
 
 Post subject: Re: Mapper 35
PostPosted: Fri Jun 28, 2019 12:39 am 
Offline

Joined: Tue Feb 07, 2017 2:03 am
Posts: 733
Cart is $02 so no DSP.
The ROM has the header at 00ffb0 which is what made me think that it was the lower half.. however looking at it it also has the same header at 40ffb0 so I guess somebody at Intelligent System had no idea what Nintendo wanted either so just but it in both places ;)

The Diagrams are nice, but would it have killed somebody at Nintendo to make a normal map with the raw numbers in it..

Thanks for all your help ;)


Top
 Profile  
 
 Post subject: Re: Mapper 35
PostPosted: Fri Jun 28, 2019 4:25 am 
Offline
User avatar

Joined: Sun Sep 19, 2004 9:28 pm
Posts: 4156
Location: A world gone mad
Oziphantom wrote:
The Diagrams are nice, but would it have killed somebody at Nintendo to make a normal map with the raw numbers in it..

Well, to be fair, a ton of people over the years have done exactly this. I've seen more text-based SNES memory maps that I'd care to recall; I can distinctly remember AT LEAST six different ones. Every one of them is terrible in one way or another, so someone else comes along and makes another that's terrible in other ways, rinse lather repeat for 25+ years. Some others on the forum have even done (visual) ones where the address lines are tied into it all and it's just a huge mess (IMO), particularly for people doing RE or programming. It's why I actually just type out things out how I do -- I look at the official visuals and explain them one per line -- because (IMO) it's just easier to depict the ranges that way. But historically of "all the terrible text ones", SiMKiN's were the best but bizarre/confusing in other ways. I still think the overall format was OK though, just that the descriptions were weird. You'll also notice there's no mode 25 -- because nobody had those cartridges at that time, and copiers/etc. at the time did not do 64mbit anyway (16/24/32mbit was it) -- so nobody even knew it existed. It wasn't documented by Nintendo until one of their last/final revisions either. :D But there is a 48mbit mode 21, which I think is on some particular PCB model where the traces were added or left in place (whichever/whatever).

That's the thing nobody really thought of at the time -- that the PCBs would vary. We've since learned that. That's why byuu did his manifest format and the like (not something I like as everyone knows, but I understand what he was going for there). There's so fricking many. But in general, unless you're working with a weird game, it's probably using one of the 5 or 6 main ones.

In all seriousness Nintendo's visual maps are good as long as you can understand the nomenclature/nuances (like the apostrophe being used for mirror indication). Otherwise, the best free visuals are the ones Tepples did fairly recently for modes 20 and 21, and a general-purpose one. The only downside to the ones he did is that they're incredibly tiny if used on a larger monitor -- but that's intended as he wants them viewable on older laptops with lower resolutions. (I'm not big on putting $0000 at the top and $FFFF at the bottom either, prefer the reverse, but we discussed that in another thread and it's a matter of preference so I let it alone.) They're certainly a ton better than the earlier one he made.


Top
 Profile  
 
 Post subject: Re: Mapper 35
PostPosted: Fri Jun 28, 2019 9:18 am 
Offline

Joined: Tue Feb 07, 2017 2:03 am
Posts: 733
Oh for showing what the SNES sees, they are fine, they are the same as say the C64 PRG diagrams, just they have 256x memory to cover.

I was thinking more for.
Code:
BTW (20 LOROM - 32Mb)
SNES               ROM
00:8000-00:FFFF -> 000000-007FFF
01:8000-01:FFFF -> 008000-00FFFF
02:8000-00:FFFF -> 010000-017FFF
....
5E:8000-5E:FFFF -> 2F0000-2F7FFF
5F:8000-5F:FFFF -> 2F8000-2FFFFF
80:8000-80:FFFF -> 000000-007FFF
....
DF:8000-DF:FFFF -> 2F8000-2FFFFF

A nice numerical map of SNES view to actual ROM space, although back then we cared more about which ROM it was more than a strict linear space, but even having a map of space to ROM number would help. Rather then this is what the SNES sees, burn roms plug them in and write code to see if you see what you want to see.

And yes standard nomenclature for such diagrams is FFFF at top, you go up in memory ;)

I was thinking of porting this to SA-1, the AI sometimes pauses for a while and this game is loooooonnnnnng so speeding up AI would be a great improvement in the long wrong, I understand its a whole extra CPU with custom Banking system, shared memory even/odd cycle penalties and DMA special cases... I've programmed the PS2 and 3 it doesn't scare me :D But maybe the lack of docs does ;)


Top
 Profile  
 
 Post subject: Re: Mapper 35
PostPosted: Fri Jun 28, 2019 10:24 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 21511
Location: NE Indiana, USA (NTSC)
A table in that format:
Code:
ExHiROM (mode $25/$35, up to 64 Mbit)

S-CPU            ROM (.sfc)
008000-00FFFF -> 408000-40FFFF
018000-01FFFF -> 418000-41FFFF
028000-02FFFF -> 428000-42FFFF
...
3E8000-3EFFFF -> 7E8000-7EFFFF
3F8000-3FFFFF -> 7F8000-7FFFFF
400000-7DFFFF -> 400000-7DFFFF
808000-80FFFF -> 008000-00FFFF
818000-81FFFF -> 018000-01FFFF
828000-82FFFF -> 028000-02FFFF
....
BF8000-BFFFFF -> 3F8000-3FFFFF
C00000-FFFFFF -> 000000-3FFFFF


The .sfc ROM image does not include the 512-byte SMC/SWC header. ROM $7E0000-$7E7FFF and $7F0000-$7F7FFF are not mapped anywhere in S-CPU address space. Existing licensed ExHiROM games are 48 Mbit and thus stop at $5FFFFF.

_________________
Pin Eight | Twitter | GitHub | Patreon


Top
 Profile  
 
 Post subject: Re: Mapper 35
PostPosted: Sat Jun 29, 2019 12:49 am 
Offline

Joined: Tue Feb 07, 2017 2:03 am
Posts: 733
Perhaps it makes more sense to go the other way
Code:
ExHiROM 25/35
ROM           SNES
000000-007FFF C00000-C07FFF
008000-00FFFF C08000-C0FFFF 808000-80FFFF
010000-017FFF C10000-C17FFF
018000-01FFFF C18000-C1FFFF 818000-81FFFF
....
3E0000-3E7FFF FE0000-FE7FFF
3E8000-3EFFFF FF8000-FFFFFF DE8000-DEFFFF
3F0000-3F7FFF FF0000-FF7FFF
3F8000-3FFFFF FF8000-FFFFFF DF8000-DFFFFF
400000-407FFF 400000-407FFF
408000-40FFFF 408000-40FFFF 008000-00FFFF
410000-417FFF 410000-417FFF
418000-41FFFF 418000-41FFFF 018000-01FFFF
....
7C0000-7C7FFF 7C0000-7C7FFF
7C8000-7CFFFF 7C8000-7CFFFF 3C8000-3CFFFF
7D0000-7D7FFF 7D0000-7D7FFF
7D8000-7DFFFF 7D8000-7DFFFF 3D8000-3DFFFF
7E0000-7E7FFF UNMAPPED
7E8000-7EFFFF 3E8000-3EFFFF
7F0000-7F7FFF UNMAPPED
7F8000-7FFFFF 3F8000-3FFFFF


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group