2017-01-14 21:09:57 +00:00
|
|
|
#include "../copyright"
|
2011-03-06 02:39:25 +00:00
|
|
|
|
|
|
|
#include "snes9x.h"
|
|
|
|
#include "memmap.h"
|
|
|
|
#include "sdd1.h"
|
|
|
|
#include "display.h"
|
|
|
|
|
2014-11-03 14:26:54 +00:00
|
|
|
void S9xSetSDD1MemoryMap(uint32_t bank, uint32_t value)
|
2011-03-06 02:39:25 +00:00
|
|
|
{
|
2017-08-16 04:57:36 +00:00
|
|
|
int32_t c;
|
|
|
|
|
2014-10-29 23:23:30 +00:00
|
|
|
bank = 0xc00 + bank * 0x100;
|
|
|
|
value = value * 1024 * 1024;
|
|
|
|
for (c = 0; c < 0x100; c += 16)
|
|
|
|
{
|
2014-11-03 14:26:54 +00:00
|
|
|
uint8_t* block = &Memory.ROM [value + (c << 12)];
|
2017-01-29 04:55:23 +00:00
|
|
|
int32_t i;
|
2011-03-06 02:39:25 +00:00
|
|
|
|
2014-10-29 23:23:30 +00:00
|
|
|
for (i = c; i < c + 16; i++)
|
|
|
|
Memory.Map [i + bank] = block;
|
|
|
|
}
|
2011-03-06 02:39:25 +00:00
|
|
|
}
|
|
|
|
|
2014-10-29 23:23:30 +00:00
|
|
|
void S9xResetSDD1()
|
2011-03-06 02:39:25 +00:00
|
|
|
{
|
2017-01-29 04:55:23 +00:00
|
|
|
int32_t i;
|
2017-08-16 04:57:36 +00:00
|
|
|
|
|
|
|
memset(&Memory.FillRAM [0x4800], 0, 4);
|
2014-10-29 23:23:30 +00:00
|
|
|
for (i = 0; i < 4; i++)
|
|
|
|
{
|
|
|
|
Memory.FillRAM [0x4804 + i] = i;
|
|
|
|
S9xSetSDD1MemoryMap(i, i);
|
|
|
|
}
|
2011-03-06 02:39:25 +00:00
|
|
|
}
|
|
|
|
|
2014-10-29 23:23:30 +00:00
|
|
|
void S9xSDD1PostLoadState()
|
2011-03-06 02:39:25 +00:00
|
|
|
{
|
2017-01-29 04:55:23 +00:00
|
|
|
int32_t i;
|
2014-10-29 23:23:30 +00:00
|
|
|
for (i = 0; i < 4; i++)
|
|
|
|
S9xSetSDD1MemoryMap(i, Memory.FillRAM [0x4804 + i]);
|
2011-03-06 02:39:25 +00:00
|
|
|
}
|