c62d2810 |
1 | /* FCE Ultra - NES/Famicom Emulator |
2 | * |
3 | * Copyright notice for this file: |
d97315ac |
4 | * Copyright (C) 2002 Xodnizel |
c62d2810 |
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 | |
d97315ac |
23 | static uint8 cmd0, cmd1; |
c62d2810 |
24 | |
25 | static void DoSuper(void) |
26 | { |
d97315ac |
27 | setprg8r((cmd0&0xC)>>2,0x6000,((cmd0&0x3)<<4)|0xF); |
28 | if(cmd0&0x10) |
c62d2810 |
29 | { |
d97315ac |
30 | setprg16r((cmd0&0xC)>>2,0x8000,((cmd0&0x3)<<3)|(cmd1&7)); |
31 | setprg16r((cmd0&0xC)>>2,0xc000,((cmd0&0x3)<<3)|7); |
c62d2810 |
32 | } |
33 | else |
34 | setprg32r(4,0x8000,0); |
d97315ac |
35 | setmirror(((cmd0&0x20)>>5)^1); |
c62d2810 |
36 | } |
37 | |
38 | static DECLFW(SuperWrite) |
39 | { |
d97315ac |
40 | if(!(cmd0&0x10)) |
c62d2810 |
41 | { |
d97315ac |
42 | cmd0=V; |
c62d2810 |
43 | DoSuper(); |
44 | } |
45 | } |
46 | |
47 | static DECLFW(SuperHi) |
48 | { |
d97315ac |
49 | cmd1=V; |
c62d2810 |
50 | DoSuper(); |
51 | } |
52 | |
53 | static void SuperReset(void) |
54 | { |
55 | SetWriteHandler(0x6000,0x7FFF,SuperWrite); |
56 | SetWriteHandler(0x8000,0xFFFF,SuperHi); |
d97315ac |
57 | SetReadHandler(0x6000,0xFFFF,CartBR); |
58 | cmd0=cmd1=0; |
c62d2810 |
59 | setprg32r(4,0x8000,0); |
d97315ac |
60 | setchr8(0); |
c62d2810 |
61 | } |
62 | |
63 | static void SuperRestore(int version) |
64 | { |
65 | DoSuper(); |
66 | } |
67 | |
d97315ac |
68 | void Supervision16_Init(CartInfo *info) |
c62d2810 |
69 | { |
d97315ac |
70 | AddExState(&cmd0, 1, 0,"L1"); |
71 | AddExState(&cmd1, 1, 0,"L2"); |
72 | info->Power=SuperReset; |
c62d2810 |
73 | GameStateRestore=SuperRestore; |
74 | } |