Author |
Message |
- Joined: 23 Nov 2016
- Posts: 16
- Location: Argentina
|
How does bankmapping really works on the SMS ?
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,
|
|
|
- Site Admin
- Joined: 19 Oct 1999
- Posts: 14745
- Location: London
|
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.
|
|
|
- Joined: 23 Nov 2016
- Posts: 16
- Location: Argentina
|
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 ?
|
|
|
- Joined: 05 Sep 2013
- Posts: 3828
- Location: Stockholm, Sweden
|
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...
|
|
|
- Site Admin
- Joined: 19 Oct 1999
- Posts: 14745
- Location: London
|
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.
|
|
|
- Joined: 23 Nov 2016
- Posts: 16
- Location: Argentina
|
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 ?
|
|
|