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 | |
24 | |
25 | DECLFW(Mapper43_write) |
26 | { |
27 | uint32 m; |
28 | int z; |
29 | |
30 | if(A&0x400) |
31 | onemir(0); |
32 | else |
33 | MIRROR_SET((A>>13)&1); |
34 | m=A&0x1f; |
35 | |
36 | z=(A>>8)&3; |
37 | |
38 | switch(CHRmask8[0]) |
39 | { |
40 | default: |
41 | case 0xFF: |
42 | if(z&2) |
43 | m|=0x20; |
44 | break; |
45 | case 0x1FF: |
46 | m|=z<<5; |
47 | break; |
48 | } |
49 | |
50 | if(A&0x800) |
51 | { |
52 | ROM_BANK16(0x8000,(m<<1)|((A&0x1000)>>12)); |
53 | ROM_BANK16(0xC000,(m<<1)|((A&0x1000)>>12)); |
54 | } |
55 | else |
56 | ROM_BANK32(m); |
c0bf6f9f |
57 | X6502_Rebase(); |
c62d2810 |
58 | } |
59 | |
60 | void Mapper43_init(void) |
61 | { |
62 | ROM_BANK32(0); |
63 | SetWriteHandler(0x8000,0xffff,Mapper43_write); |
64 | } |