Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - How does bankmapping really works on the SMS ?

Reply to topic
Author Message
  • Joined: 23 Nov 2016
  • Posts: 16
  • Location: Argentina
Reply with quote
How does bankmapping really works on the SMS ?
Post Posted: Tue Dec 06, 2016 5:14 pm
So Im trying to do my own SMS emulator, and have most things hooked up.

Now, something Im not really understanding.

When games use FFFC/FFFD/FFFF for bankmapping, everything works ok.

But some games like to use DFFC/DFFD/DFFF .. which because of mirroring should do the same as the "regular" registers, right ?

Now, for example, on other games like Alex Kidd, at start, it tries to reset all ram (C000-DFFF), which according my logic will also reset all 3 banks to 0, which is wrong.

If I omit the mirroring, I break other games (Time Soldiers for example, I think).

So what's the accurate way the SMS works ?
Thanks,
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14745
  • Location: London
Reply with quote
Post Posted: Tue Dec 06, 2016 6:30 pm
The mapper only responds to writes to $fffc-f. The system RAM is also mirrored at these addresses so writes to $ffff can be read back from $dfff and also from $ffff, in both cases the RAM responds. The mapper does not respond to writes to $dffc-f.
  View user's profile Send private message Visit poster's website
  • Joined: 23 Nov 2016
  • Posts: 16
  • Location: Argentina
Reply with quote
Post Posted: Tue Dec 06, 2016 6:39 pm
Thanks, so to clarify, you can write to addresses DFFD, DFFE and DFFF, but you can't read that data back, because you will get the banks, right ?
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 3828
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Tue Dec 06, 2016 7:21 pm
RAM is mirrored, and you can read back bytes from it.
Mapper address aren't, and you really can't read from mappers, but you can read the RAM contents at the same address, which contains the same values, after you've written something there...
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14745
  • Location: London
Reply with quote
Post Posted: Wed Dec 07, 2016 12:25 am
Let's take $dfff and $ffff as an example, the rest are analogous.

If I write to $dfff, the mapper ignores it and the data is stored in RAM (at offset $1fff in the RAM chip).
If I write to $ffff, the mapper changes the page and the data is stored to RAM (at offset $1fff in the RAM chip).
If I read from $dfff, the mapper ignores it and the data is returned from RAM (from offset $1fff in the RAM chip).
If I read from $ffff, the mapper ignores it and the data is returned from RAM (from offset $1fff in the RAM chip).

So $dfff and $ffff contain the last thing written to $ffff, by virtue of the RAM mirroring, but only if we make sure not to write to $dfff. The mapper is write only.
  View user's profile Send private message Visit poster's website
  • Joined: 23 Nov 2016
  • Posts: 16
  • Location: Argentina
Reply with quote
Post Posted: Wed Dec 07, 2016 7:38 pm
Very clear explanation, I will implement it that way.

I assume that also happens to that config control register (FFFC), right ?
  View user's profile Send private message Visit poster's website
Reply to topic



Back to the top of this page

Back to SMS Power!