|
Joined: Jun 2008
Posts: 205
Senior Member
|
Senior Member
Joined: Jun 2008
Posts: 205 |
great! I was waiting for that since forever!!!! Ah, should have asked me if(mapper == LoROM) {
xml << " <rom>\n";
xml << " <map mode='linear' address='00-7f:8000-ffff'/>\n";
xml << " <map mode='linear' address='80-ff:8000-ffff'/>\n";
xml << " </rom>\n";
if(ram_size > 0) {
xml << " <ram size='" << strhex(ram_size) << "'>\n";
//20-3f|a0-bf probably isn't mapped, just being paranoid ...
xml << " <map mode='linear' address='20-3f:6000-7fff'/>\n";
xml << " <map mode='linear' address='a0-bf:6000-7fff'/>\n";
if((rom_size > 0x200000) || (ram_size > 32 * 1024)) {
xml << " <map mode='linear' address='70-7f:0000-7fff'/>\n";
xml << " <map mode='linear' address='f0-ff:0000-7fff'/>\n";
} else {
xml << " <map mode='linear' address='70-7f:0000-ffff'/>\n";
xml << " <map mode='linear' address='f0-ff:0000-ffff'/>\n";
}
xml << " </ram>\n";
}
} Note how when ROM size > 2MB or RAM size > 32KB, ROM is mapped to 70-7f|f0-ff:8000-ffff. This is required for Fire Emblem: Torakia 776, otherwise the graphics will be corrupted. And when you have a ROM size <= 2MB and RAM size <= 32KB, you have to map RAM to 70-7f|f0-ff:8000-ffff. This is required to save your progress in Ys 3: Wanderers from Ys. Thank Nach for that observation.
|
|
|
|
Joined: Jan 2006
Posts: 3,691
Very Senior Member
|
Very Senior Member
Joined: Jan 2006
Posts: 3,691 |
I knew. if you remember, the first thing I asked to borrow from bsnes was the cart mapping code but I never found a game requiring that specific part so I was always mapping the whole 70-7f:0000-ffff as SRAM (and, to be fair, I only remembered about this possible source of problems last week).
actually we are also diverging a bit more for SRAM (no "paranoid part" in MESS), but I might consider switching to your approach now that we have finally found issues due to SRAM mapping, and hence I have test cases...
EDIT: improved SRAM mapping for large LoROM carts. As a result, I was able to progress a bit in Tokimeki Memorial (still no text, but the game didn't freeze at the first selection...)
in a few days, when I'm back from a work trip, I'll try to make our SRAM handling the same as bsnes
|
|
|
|
Joined: Jun 2008
Posts: 205
Senior Member
|
Senior Member
Joined: Jun 2008
Posts: 205 |
but I never found a game requiring that specific part so I was always mapping the whole 70-7f:0000-ffff as SRAM Yeah, I tend to do most of these things for a reason Please don't hesitate to ask if you are about to diverge on something. Never know, it may be a bug in my code.
|
|
|
|
Joined: Jan 2006
Posts: 3,691
Very Senior Member
|
Very Senior Member
Joined: Jan 2006
Posts: 3,691 |
Note how when ROM size > 2MB or RAM size > 32KB, ROM is mapped to 70-7f|f0-ff:8000-ffff. This is required for Fire Emblem: Torakia 776, otherwise the graphics will be corrupted.
And when you have a ROM size <= 2MB and RAM size <= 32KB, you have to map RAM to 70-7f|f0-ff:8000-ffff. This is required to save your progress in Ys 3: Wanderers from Ys.
Thank Nach for that observation. while we are at this, byuu, I have a question about LinearMap of cartram (cartrom is understood). Say a cart has 32k of SRAM, and we map it "linearly" in 64k (0x1000) of memory. what happens if a write occurs at 0xc00? does the cart save the value written there? and how, given it only have 32k of SRAM? or does the upper half (0x800-0x1000) become RAM (i.e. it gets written and read, but not saved at exit)? this is the last missing bit to make our handling the same as yours... EDIT: as you can see, I haven't hesitated
|
|
|
|
Joined: Sep 2009
Posts: 15
Member
|
Member
Joined: Sep 2009
Posts: 15 |
You can fix the text by fixing the snes_cart.small_sram == SNES_MODE_20 typo in snescart.c.
|
|
|
|
Joined: Jan 2006
Posts: 3,691
Very Senior Member
|
Very Senior Member
Joined: Jan 2006
Posts: 3,691 |
d'oh... I should not code while preparing my luggage...
thanks a lot: we finally have text in Tokimeki and Wizardry Gaiden starts :party:
Last edited by etabeta78; 04/12/10 08:53 AM.
|
|
|
|
Joined: Dec 2005
Posts: 330
Senior Member
|
Senior Member
Joined: Dec 2005
Posts: 330 |
while we are at this, byuu, I have a question about LinearMap of cartram (cartrom is understood). Say a cart has 32k of SRAM, and we map it "linearly" in 64k (0x1000) of memory. what happens if a write occurs at 0xc00? does the cart save the value written there? and how, given it only have 32k of SRAM? or does the upper half (0x800-0x1000) become RAM (i.e. it gets written and read, but not saved at exit)? I would guess that it's most likely mirrored...
|
|
|
|
Joined: Jan 2006
Posts: 3,691
Very Senior Member
|
Very Senior Member
Joined: Jan 2006
Posts: 3,691 |
I would expect the same, but I would like to know the exact behavior of byuu's MapLinear. because for mirroring the writes I would have expected something like (bogus example for our 64k at 0x70)
map(MapLinear, 0x70, 0x70, 0x0000, 0x0fff, memory::cartram, 0x0000, 0x07ff);
and I find in bsnes something like
map(MapLinear, 0x70, 0x70, 0x0000, 0x0fff, memory::cartram);
with no mention of the behavior of writes to mirrored addresses (the last 2 parameters are used to say the program to ignore higher bits...)
|
|
|
|
Joined: Aug 2009
Posts: 1,250 Likes: 171
Very Senior Member
|
OP
Very Senior Member
Joined: Aug 2009
Posts: 1,250 Likes: 171 |
Last edited by Kale; 04/12/10 01:39 PM.
|
|
|
|
Joined: Dec 1999
Posts: 1,180 Likes: 2
Very Senior Member
|
Very Senior Member
Joined: Dec 1999
Posts: 1,180 Likes: 2 |
Great work Tokimeki graphics are not quite 100% in-game though:
|
|
|
4 members (ameath, Kale, robcfg, 1 invisible),
519
guests, and
1
robot. |
Key:
Admin,
Global Mod,
Mod
|
|
Forums9
Topics9,320
Posts121,930
Members5,074
|
Most Online1,283 Dec 21st, 2022
|
|
These forums are sponsored by Superior Solitaire, an ad-free card game collection for macOS and iOS. Download it today!
|
|
|
|