c62d2810 |
1 | /* FCE Ultra - NES/Famicom Emulator |
2 | * |
3 | * Copyright notice for this file: |
4 | * Copyright (C) 2002 Ben Parnell |
5 | * |
6 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License as published by |
8 | * the Free Software Foundation; either version 2 of the License, or |
9 | * (at your option) any later version. |
10 | * |
11 | * This program is distributed in the hope that it will be useful, |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | * GNU General Public License for more details. |
15 | * |
16 | * You should have received a copy of the GNU General Public License |
17 | * along with this program; if not, write to the Free Software |
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
19 | */ |
20 | |
21 | #include "mapinc.h" |
22 | |
23 | #define CHRRAM (GameMemBlock+16) |
24 | |
25 | static void DoSuper(void) |
26 | { |
27 | setprg8r((GameMemBlock[0]&0xC)>>2,0x6000,((GameMemBlock[0]&0x3)<<4)|0xF); |
28 | if(GameMemBlock[0]&0x10) |
29 | { |
30 | setprg16r((GameMemBlock[0]&0xC)>>2,0x8000,((GameMemBlock[0]&0x3)<<3)|(GameMemBlock[1]&7)); |
31 | setprg16r((GameMemBlock[0]&0xC)>>2,0xc000,((GameMemBlock[0]&0x3)<<3)|7); |
32 | } |
33 | else |
34 | setprg32r(4,0x8000,0); |
35 | |
36 | setmirror(((GameMemBlock[0]&0x20)>>5)^1); |
c0bf6f9f |
37 | X6502_Rebase(); |
c62d2810 |
38 | } |
39 | |
40 | static DECLFW(SuperWrite) |
41 | { |
42 | if(!(GameMemBlock[0]&0x10)) |
43 | { |
44 | GameMemBlock[0]=V; |
45 | DoSuper(); |
46 | } |
47 | } |
48 | |
49 | static DECLFW(SuperHi) |
50 | { |
c0bf6f9f |
51 | GameMemBlock[1]=V; |
c62d2810 |
52 | DoSuper(); |
53 | } |
54 | |
55 | static void SuperReset(void) |
56 | { |
57 | SetWriteHandler(0x6000,0x7FFF,SuperWrite); |
58 | SetWriteHandler(0x8000,0xFFFF,SuperHi); |
c0bf6f9f |
59 | SetReadHandler(0x6000,0xFFFF,CartBR); |
c62d2810 |
60 | GameMemBlock[0]=GameMemBlock[1]=0; |
61 | setprg32r(4,0x8000,0); |
62 | setvram8(CHRRAM); |
63 | } |
64 | |
65 | static void SuperRestore(int version) |
66 | { |
67 | DoSuper(); |
68 | } |
69 | |
70 | void Supervision16_Init(void) |
71 | { |
72 | AddExState(&GameMemBlock[0], 1, 0,"L1"); |
73 | AddExState(&GameMemBlock[1], 1, 0,"L2"); |
74 | AddExState(CHRRAM, 8192, 0, "CHRR"); |
75 | BoardPower=SuperReset; |
76 | GameStateRestore=SuperRestore; |
77 | } |