1 | /*****************************************************************************\ |
2 | Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. |
3 | This file is licensed under the Snes9x License. |
4 | For further information, consult the LICENSE file in the root directory. |
5 | \*****************************************************************************/ |
6 | |
7 | #include "snes9x.h" |
8 | #include "memmap.h" |
9 | #include "sdd1.h" |
10 | #include "display.h" |
11 | |
12 | |
13 | void S9xSetSDD1MemoryMap (uint32 bank, uint32 value) |
14 | { |
15 | bank = 0xc00 + bank * 0x100; |
16 | value = value * 1024 * 1024; |
17 | |
18 | for (int c = 0; c < 0x100; c += 16) |
19 | { |
20 | uint8 *block = &Memory.ROM[value + (c << 12)]; |
21 | for (int i = c; i < c + 16; i++) |
22 | Memory.Map[i + bank] = block; |
23 | } |
24 | } |
25 | |
26 | void S9xResetSDD1 (void) |
27 | { |
28 | memset(&Memory.FillRAM[0x4800], 0, 4); |
29 | for (int i = 0; i < 4; i++) |
30 | { |
31 | Memory.FillRAM[0x4804 + i] = i; |
32 | S9xSetSDD1MemoryMap(i, i); |
33 | } |
34 | } |
35 | |
36 | void S9xSDD1PostLoadState (void) |
37 | { |
38 | for (int i = 0; i < 4; i++) |
39 | S9xSetSDD1MemoryMap(i, Memory.FillRAM[0x4804 + i]); |
40 | } |
41 | |