aboutsummaryrefslogtreecommitdiff
path: root/source/sdd1.c
blob: 3a46ec92522612ed918391f9171a735cc30f1b9e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include "../copyright"

#include "snes9x.h"
#include "memmap.h"
#include "sdd1.h"
#include "display.h"

void S9xSetSDD1MemoryMap(uint32_t bank, uint32_t value)
{
   bank = 0xc00 + bank * 0x100;
   value = value * 1024 * 1024;
   int32_t c;
   for (c = 0; c < 0x100; c += 16)
   {
      uint8_t* block = &Memory.ROM [value + (c << 12)];
      int32_t i;

      for (i = c; i < c + 16; i++)
         Memory.Map [i + bank] = block;
   }
}

void S9xResetSDD1()
{
   memset(&Memory.FillRAM [0x4800], 0, 4);
   int32_t i;
   for (i = 0; i < 4; i++)
   {
      Memory.FillRAM [0x4804 + i] = i;
      S9xSetSDD1MemoryMap(i, i);
   }
}

void S9xSDD1PostLoadState()
{
   int32_t i;
   for (i = 0; i < 4; i++)
      S9xSetSDD1MemoryMap(i, Memory.FillRAM [0x4804 + i]);
}