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 | |
23 | |
24 | void FP_FASTAPASS(1) IREMIRQHook(int a) |
25 | { |
26 | if(IRQa) |
27 | { |
28 | IRQCount-=a; |
d97315ac |
29 | if(IRQCount<-4) |
c62d2810 |
30 | { |
d97315ac |
31 | X6502_IRQBegin(FCEU_IQEXT); |
c62d2810 |
32 | IRQa=0; |
33 | IRQCount=0xFFFF; |
34 | } |
35 | } |
36 | } |
37 | |
d97315ac |
38 | static DECLFW(Mapper65_write) |
c62d2810 |
39 | { |
d97315ac |
40 | //if(A>=0x9000 && A<=0x9006) |
41 | // printf("$%04x:$%02x, %d\n",A,V,scanline); |
42 | switch(A) |
43 | { |
44 | //default: printf("$%04x:$%02x\n",A,V); |
45 | // break; |
46 | case 0x8000:ROM_BANK8(0x8000,V);break; |
47 | // case 0x9000:printf("$%04x:$%02x\n",A,V);MIRROR_SET2((V>>6)&1);break; |
48 | case 0x9001:MIRROR_SET(V>>7);break; |
49 | case 0x9003:IRQa=V&0x80;X6502_IRQEnd(FCEU_IQEXT);break; |
50 | case 0x9004:IRQCount=IRQLatch;break; |
51 | case 0x9005: IRQLatch&=0x00FF; |
52 | IRQLatch|=V<<8; |
53 | break; |
54 | case 0x9006: IRQLatch&=0xFF00;IRQLatch|=V; |
55 | break; |
56 | case 0xB000:VROM_BANK1(0x0000,V);break; |
57 | case 0xB001:VROM_BANK1(0x0400,V);break; |
58 | case 0xB002:VROM_BANK1(0x0800,V);break; |
59 | case 0xB003:VROM_BANK1(0x0C00,V);break; |
60 | case 0xB004:VROM_BANK1(0x1000,V);break; |
61 | case 0xB005:VROM_BANK1(0x1400,V);break; |
62 | case 0xB006:VROM_BANK1(0x1800,V);break; |
63 | case 0xB007:VROM_BANK1(0x1C00,V);break; |
64 | case 0xa000:ROM_BANK8(0xA000,V);break; |
65 | case 0xC000:ROM_BANK8(0xC000,V);break; |
c62d2810 |
66 | } |
d97315ac |
67 | //MIRROR_SET2(1); |
c62d2810 |
68 | } |
69 | |
70 | void Mapper65_init(void) |
71 | { |
72 | MapIRQHook=IREMIRQHook; |
73 | SetWriteHandler(0x8000,0xffff,Mapper65_write); |
74 | } |