File: sdd1.cpp

package info (click to toggle)
libretro-snes9x 1.63%2Bdfsg-1
  • links: PTS, VCS
  • area: non-free
  • in suites: forky, sid, trixie
  • size: 8,972 kB
  • sloc: cpp: 86,293; ansic: 6,630; sh: 3,237; makefile: 637
file content (40 lines) | stat: -rw-r--r-- 1,023 bytes parent folder | download | duplicates (2)
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
40
/*****************************************************************************\
     Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
                This file is licensed under the Snes9x License.
   For further information, consult the LICENSE file in the root directory.
\*****************************************************************************/

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


void S9xSetSDD1MemoryMap (uint32 bank, uint32 value)
{
	bank = 0xc00 + bank * 0x100;
	value = value * 1024 * 1024;

	for (int c = 0; c < 0x100; c += 16)
	{
		uint8	*block = &Memory.ROM[value + (c << 12)];
		for (int i = c; i < c + 16; i++)
			Memory.Map[i + bank] = block;
	}
}

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

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