more cleanups
[fceu.git] / banksw.h
CommitLineData
c62d2810 1/* FCE Ultra - NES/Famicom Emulator
2 *
3 * Copyright notice for this file:
4 * Copyright (C) 1998 Bero
5 * Copyright (C) 2002 Ben Parnell
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22void FASTAPASS(2) VRAM_BANK1(uint32 A, uint8 V)
23{
24 V&=7;
25 PPUCHRRAM|=(1<<(A>>10));
26 CHRBankList[(A)>>10]=V;
27 VPage[(A)>>10]=&CHRRAM[V<<10]-(A);
28}
29
30void FASTAPASS(2) VRAM_BANK4(uint32 A, uint32 V)
31{
32 V&=1;
33 PPUCHRRAM|=(0xF<<(A>>10));
34 CHRBankList[(A)>>10]=(V<<2);
35 CHRBankList[((A)>>10)+1]=(V<<2)+1;
36 CHRBankList[((A)>>10)+2]=(V<<2)+2;
37 CHRBankList[((A)>>10)+3]=(V<<2)+3;
38 VPage[(A)>>10]=&CHRRAM[V<<10]-(A);
39}
40
41void FASTAPASS(2) VROM_BANK1(uint32 A,uint32 V)
42{
43 setchr1(A,V);
44 CHRBankList[(A)>>10]=V;
45}
46
47void FASTAPASS(2) VROM_BANK2(uint32 A,uint32 V)
48{
49 setchr2(A,V);
50 CHRBankList[(A)>>10]=(V<<1);
51 CHRBankList[((A)>>10)+1]=(V<<1)+1;
52}
53
54void FASTAPASS(2) VROM_BANK4(uint32 A, uint32 V)
55{
56 setchr4(A,V);
57 CHRBankList[(A)>>10]=(V<<2);
58 CHRBankList[((A)>>10)+1]=(V<<2)+1;
59 CHRBankList[((A)>>10)+2]=(V<<2)+2;
60 CHRBankList[((A)>>10)+3]=(V<<2)+3;
61}
62
63void FASTAPASS(1) VROM_BANK8(uint32 V)
64{
65 setchr8(V);
66 CHRBankList[0]=(V<<3);
67 CHRBankList[1]=(V<<3)+1;
68 CHRBankList[2]=(V<<3)+2;
69 CHRBankList[3]=(V<<3)+3;
70 CHRBankList[4]=(V<<3)+4;
71 CHRBankList[5]=(V<<3)+5;
72 CHRBankList[6]=(V<<3)+6;
73 CHRBankList[7]=(V<<3)+7;
74}
75
76void FASTAPASS(2) ROM_BANK8(uint32 A, uint32 V)
77{
78 setprg8(A,V);
79 if(A>=0x8000)
80 PRGBankList[((A-0x8000)>>13)]=V;
81}
82
83void FASTAPASS(2) ROM_BANK16(uint32 A, uint32 V)
84{
85 setprg16(A,V);
86 if(A>=0x8000)
87 {
88 PRGBankList[((A-0x8000)>>13)]=V<<1;
89 PRGBankList[((A-0x8000)>>13)+1]=(V<<1)+1;
90 }
91}
92
5232c20c 93void FASTAPASS(2) ROM_BANK32(uint32 V)
c62d2810 94{
95 setprg32(0x8000,V);
96 PRGBankList[0]=V<<2;
97 PRGBankList[1]=(V<<2)+1;
98 PRGBankList[2]=(V<<2)+2;
99 PRGBankList[3]=(V<<2)+3;
100}
101