blob: 10623bd8aa88e4eb8b9389d78e4e9180f6d05abd (
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
/*===================================================================*/
/* */
/* Mapper 97 (74161/32 Irem) */
/* */
/*===================================================================*/
/*-------------------------------------------------------------------*/
/* Initialize Mapper 97 */
/*-------------------------------------------------------------------*/
void Map97_Init()
{
/* Initialize Mapper */
MapperInit = Map97_Init;
/* Write to Mapper */
MapperWrite = Map97_Write;
/* Write to SRAM */
MapperSram = Map0_Sram;
/* Write to APU */
MapperApu = Map0_Apu;
/* Read from APU */
MapperReadApu = Map0_ReadApu;
/* Callback at VSync */
MapperVSync = Map0_VSync;
/* Callback at HSync */
MapperHSync = Map0_HSync;
/* Callback at PPU */
MapperPPU = Map0_PPU;
/* Callback at Rendering Screen ( 1:BG, 0:Sprite ) */
MapperRenderScreen = Map0_RenderScreen;
/* Set SRAM Banks */
SRAMBANK = SRAM;
/* Set ROM Banks */
ROMBANK0 = ROMLASTPAGE( 1 );
ROMBANK1 = ROMLASTPAGE( 0 );
ROMBANK2 = ROMPAGE( 0 );
ROMBANK3 = ROMPAGE( 1 );
/* Set PPU Banks */
if ( NesHeader.byVRomSize > 0 )
{
for ( int nPage = 0; nPage < 8; ++nPage )
PPUBANK[ nPage ] = VROMPAGE( nPage );
InfoNES_SetupChr();
}
/* Set up wiring of the interrupt pin */
K6502_Set_Int_Wiring( 1, 1 );
}
/*-------------------------------------------------------------------*/
/* Mapper 97 Write Function */
/*-------------------------------------------------------------------*/
void Map97_Write( WORD wAddr, BYTE byData )
{
/* Set ROM Banks */
if ( wAddr < 0xc000 )
{
BYTE byPrgBank = byData & 0x0f;
byPrgBank <<= 1;
byPrgBank %= ( NesHeader.byRomSize << 1 );
ROMBANK2 = ROMPAGE( byPrgBank );
ROMBANK3 = ROMPAGE( byPrgBank + 1 );
if ( ( byData & 0x80 ) == 0 )
{
InfoNES_Mirroring( 0 );
} else {
InfoNES_Mirroring( 1 );
}
}
}
|