source refactor 2

This commit is contained in:
dborth 2008-09-02 01:55:56 +00:00
parent 47fb364fc0
commit fb1190b4fd
139 changed files with 0 additions and 16553 deletions

View File

@ -1,4 +0,0 @@
cp Makefile.gc Makefile
make
rm Makefile
rm -d build/*.*

View File

@ -1,4 +0,0 @@
cp Makefile.wii Makefile
make
rm Makefile
rm build/*.*

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
<pd><ViewState><e p="fceugc" x="true"></e><e p="fceugc\input" x="false"></e><e p="fceugc\iplfont" x="false"></e><e p="fceugc\mappers" x="false"></e><e p="fceugc\ngc" x="false"></e><e p="fceugc\boards" x="false"></e><e p="fceugc\common" x="false"></e><e p="fceugc\makefiles" x="true"></e><e p="fceugc\roms" x="false"></e><e p="fceugc\source" x="false"></e><e p="fceugc\sz" x="false"></e><e p="fceugc\mbshare" x="false"></e></ViewState></pd>

View File

@ -1,229 +0,0 @@
¸,ø¤°`°¤ø,¸¸,ø¤°`°¤ø,¸,ø¤°`°¤ø,¸¸,ø¤°`°¤ø,¸,ø¤°`°¤ø,¸¸,ø¤°`°¤ø,¸,ø¤°`°¤ø,¸¸,ø¤
- FCE Ultra GameCube Edition -
Version 1.0.8x
(Under GPL License)
Softdev, 2006
¸,ø¤°`°¤ø,¸¸,ø¤°`°¤ø,¸,ø¤°`°¤ø,¸¸,ø¤°`°¤ø,¸,ø¤°`°¤ø,¸¸,ø¤°`°¤ø,¸,ø¤°`°¤ø,¸¸,ø¤
-=[ Explanation ]=-
FCE Ultra GC is a modified port of the FCE Ultra 0.98.12 Nintendo Entertainment
system for x86 (Windows/Linux) PC's. In English you can play NES games on your
GameCube using either a softmod and/or modchip from a DVD or via a networked
connection to your PC. If you're unfamiliar with what softmods/modchips please
visit the site listed at the bottom of this document.
-=[ What's New? ]=-
* XenoGC Support (GC-Linux Homebrew DVD Compatibility)
-=[ Features ]=-
* NES Compatibility Based on v0.98.12
* Sound Filters
* Graphics Filters (GX Chipset, Cheesy and 2x)
* 1-2 Player Support
* Real Time Saving (RTS) from Memory Card
* Load Games from ISO9660 DVD
* Supports Joilet Filesystem w/Relaxed Options
* Fast Load from Qoob or Viper
* GX Graphic Filter Added - Super Fast/Smooth
* Joilet FileSystem Support for DVD
* Memory Card Idle Bug Fixed
-=[ Supported Mappers ]=-
Mappers are the way the Nintendo handles switching from ROM/VROM so the more
that are supported the more games will work.
000 . 112 . 113 . 114 . 117 . 15 . 151 . 16 . 17 . 18 . 180 . 182 . 184 . 187
189 . 193 . 200 . 201 . 202 . 203 . 208 . 21 . 22 . 225 . 226 . 227 . 228 . 229
23 . 230 . 231 . 232 . 234 . 235 . 240 . 241 . 242 . 244 . 246 . 248 . 24 . 26
25 . 255 . 32 . 33 . 40 . 41 . 42 . 43 . 46 . 50 . 51 . 57 . 58 . 59
6 . 60 . 61 . 62 . 65 . 67 . 68 . 69 . 71 . 72 . 73 . 75 . 76 . 77
79 . 8 . 80 . 82 . 83 . 85 . 86 . 88 . 89 . 91 . 92 . 95 . 97 . 99
-=[ Requirements ]=-
* Softmod and/or Hardmod
* DVD Burner and/or Broad Band Adapter
* Some NES ROMS - http://www.pdroms.de
-=[ Usage - Preparation ]=-
You can either put FCEU GC onto a DVD with various ROM files or inject the ROM(s) into
the emulator. Either way FCEU GC comes without a ROM file in it and you must first
inject one before you can burn a disc. I would suggest if you're using a SoftMod to
inject the ROM(s) and create many DOL files as it will cut down on the swapping of
discs. Note that the ROMS must be unzipped and be in the iNES format (.NES)
-[ Injecting the ROM ]-
These instructions are for Windows users and if you're running Linux I'm sure
you wont even need most of these instructions and can figure out how to work
it yourself.
(a) Extract the FCEUGCv108.ZIP and ROMS archives into "C:\NES"
(a) Goto the Start Menu and pick "RUN" then type in "CMD"
(b) Type in "C:\" then press ENTER (Changes to the "C" drive)
(c) Type in "CD\NES" then press ENTER (Changes to the "C:\NES" Folder)
(d) Type in "DIR" then press ENTER (Lists all the files in the Folder)
(e) Type in "FCEUINJECT (rom_name.nes) (output_name.dol)" and press ENTER
Example - "FCEUINJECT Tetris.nes Tetris.dol"
(f) Put the Tetris.dol (or whatever you named it) on the media you use for
SoftMod Booting (SD Card, DVD, etc)
If you're going to be creating a DVD for use with ModChips were you can use
the DVD loading selection menu then you'll only need to create ONE .DOL file,
but if you're using a softmod you may want to create more then one .DOL file.
-[ Creating the DVD ]-
(a) Load Nero Burning ROM and pick NEW then DVD then DVD-ROM (ISO)
(b) Make sure Multi-Session is set to NO
(c) Under the ISO tab set these following options:
File system: ISO 9660 Only or ISO 9660 + Joliet
File name length (ISO): Max. of 31 chars (Level 2)
Character set (ISO): ISO 9660 (Standard ISO CD-ROM)
Relax Restrictions: Check all except "Do not add the ';1' ISO file"
(d) Under the Label TAB enter in the DVD name (anything you want)
(e) Click the NEW button
(f) Put the ROMNAME.DOL*** file in the main directory (under the little CD)
(g) Right Click in the DVD Window and pick "Create Folder"
**(h) Make a Folder named "A", "B", "C", etc
(i) Drag and Drop the .NES roms into the main dir or **folders
(j) Pick "Recorder" then "Burn Compilation"
(k) Pick your speed and make sure to pick "Finalize DVD"
If "Finalize DVD" is grayed out don't worry
(l) Hit burn and wait a while
* = You can chose ISO9660 by itself or with Joliet and it doesn't matter
if you're using a Viper GC or other solution
** = Creating folders based on filenames makes for easier loading if you
have a bunch of roms on the DVD
*** = This is the DOL file you make with the injection method
-=[ Usage - Emulator ]=-
To load the FCEUGC.DOL or any other DOL file(s) you've put NES roms into please
refer to the Mod That Cube -FAQ- (http://modthatcube.pxn-os.com) to see how to load
DOL files using your SoftMod and/or Modchip.
Once you load FCEU GC the ROM injected into the emulator will automatically load so
you can play it. If you would like to load another ROM you're going to have to access
the "Configuration Menu" by pressing "Z" on the GameCube controller.
-=[ Usage - Controls ]=-
Analog = UP / DOWN / LEFT / RIGHT
D-PAD = UP / DOWN / LEFT / RIGHT
Select = X
Start = START / PAUSE
A Button = A
B Button = B
Z Button = Configuration Menu
L & R = Return to SDLOAD (SDLoad Users Only)
-=[ Usage - Configuration Menu ]=-
To access the Configuration Menu simply press "Z" while the emulator is running.
To access any of the options press "A" and to press the B button to "Quick Exit"
the current sub-menu you may be in.
-[ Emulator Options ]-
Screen Scaler - How to scale the screen: GX, Cheesy or 2x
Palette - The colors used while viewing the game:
Default . loopy . quor . chris . matt
pasofami . crashman . mess . zaphod-cv
zaphod-smb . vs-drmar . vs-cv . vs-smb
Stop DVD Motor - If you're going to be playing a game for a while you might as
well stop the DVD motor to save the life of the DVD drive
Timing - NTSC or PAL (Depends if you're running a PAL or NTSC game)
Reset NES - This will RESET the Emulator
-[ Save Game Manager ]-
If you would like to save in your game simply pick which card to save to
and then save it. Later on if you would like to load your save just load
the game you had saved in and then pick "Load Game State".
Save Game State CARD A - Will do a Real Time Save of your current position
Load Game State CARD A - Will load your previous Real Time Save
Save Game State CARD B - Will do a Real Time Save of your current position
Load Game State CARD B - Will load your previous Real Time Save
-[ Game Information ]-
Displays various technical information about the game including:
ROM Size . VROM Size . iNES CRC . Mapper . Mirroring
-[ Load New ROM ]-
This will bring up a file browser showing the .NES files you have on
the DVD in the GameCube. If you're using a Qoob or Viper chip the
emulator will fastload the disc, otherwise you will have to swap
discs with an original one. After the file menu comes up simply select
you game and press "A" to load it.
Controls in File Menu:
A button - Play Selected ROM Image
D-Pad UP - Scroll Up Filename List
D-Pad DOWN - Scroll Down Filename List
D-Pad RIGHT - Skip List Page Forward
D-Pad LEFT - Skip List Page Backward
Analog Pad UP - Fast Scroll Up Filename List
Analog Pad DOWN - Fast Scroll Down Filename List
¸,ø¤°`°¤ø,¸¸,ø¤°`°¤ø,¸,ø¤°`°¤ø,¸¸,ø¤°`°¤ø,¸,ø¤°`°¤ø,¸¸,ø¤°`°¤ø,¸,ø¤°`°¤ø,¸¸,ø¤
-=[ Credits ]=-
GameCube Port/Coding - SoftDev
Original FCE by BERO
FCE Ultra by Xodnizel
DevkitPPC / LibOGC by Wntrmute & Shagkur
DVD Codes Courtesy of The NinjaMod Team
ZLIB by Jean-loup Gailly
IPLFont by Qoob Team
Beta Testers ...
brakken
mithos
luciddream
Special Thanks To ...
HonkeyKong
¸,ø¤°`°¤ø,¸¸,ø¤°`°¤ø,¸,ø¤°`°¤ø,¸¸,ø¤°`°¤ø,¸,ø¤°`°¤ø,¸¸,ø¤°`°¤ø,¸,ø¤°`°¤ø,¸¸,ø¤
Disclaimer - Use at your own RISK!
¸,ø¤°`°¤ø,¸¸,ø¤°`°¤ø,¸,ø¤°`°¤ø,¸¸,ø¤°`°¤ø,¸,ø¤°`°¤ø,¸¸,ø¤°`°¤ø,¸,ø¤°`°¤ø,¸¸,ø¤
Documentation Written by Brakken (brakken@tehskeen.com)
¸,ø¤°`°¤ø,¸¸,ø¤°`°¤ø,¸,ø¤°`°¤ø,¸¸,ø¤°`°¤ø,¸,ø¤°`°¤ø,¸¸,ø¤°`°¤ø,¸,ø¤°`°¤ø,¸¸,ø¤
Official Homepage
http://www.tehskeen.net
Official Help Forums
http://www.tehskeen.net/forums/forumdisplay.php?f=34
Mod That Cube -FAQ-
http://modthatcube.pxn-os.com
¸,ø¤°`°¤ø,¸¸,ø¤°`°¤ø,¸,ø¤°`°¤ø,¸¸,ø¤°`°¤ø,¸,ø¤°`°¤ø,¸¸,ø¤°`°¤ø,¸,ø¤°`°¤ø,¸¸,ø¤

View File

@ -1,60 +0,0 @@
- FCE Ultra GameCube Edition -
Hello again! This great emulator, for this great console was in "el olvido",
so, again, I've decided to add it some new changes to make it a little most complete,
please, keep source code when you made a change, this is an open source project.
This new version have asako and _svpe_ lastest added options.
Enjoy it!
Askot.
What's new [20080331]
+[Askot]
- Fixed/changed SDCARD slot selection for searching roms, at
start you will be prompted for this option.
- Code cleanup.
+[dsbomb]
- Added Wii mode support.
- Give a "Bad cartridge" error instead of locking up.
- Joystick fixes due to libogc r14's changed stick values
- Rearranged menu to make more sense, and consistent with Snes9x
- Add "Reboot" menu option
- Removed "." directory from SD card listing, it's pointless
- Expand DVD reading to DVD9 size (once DVDs are working again)
- Added option to go back a menu by pressing B.
What's new? Askot [20080326]
- Added saving state in SD Card (State files will be saved in root of SDCARD).
*Note: I can't make it work to save in root:\fceu\saves, so help needed.
- Added SDCARD slot selection for searching roms, meaning, you can search roms
from SDCARD SLOT A & SLOT B (Beta, meaning, buggy, but works).
- For standarization, you must create folders root:\fceu\roms to read NES
roms files from SDCARD.
- Added C-Left to call Menu.
- Reading files from SD Card it's faster, now they're called from cache
after first reading.
- Menu in saving STATE file changed to choose SLOT, DEVICE, Save STATE,
Load STATE, Return to previous.
- Added option PSO/SD Reload to menu, still works (START+B+X)
- Modified controls when going into the rom selection menu (DVD or
SDCARD):
+ Use B to quit selection list.
+ Use L/R triggrers or Pad Left/Right to go down/up one full page.
- Some menu rearrangment and a little of sourcecode cleanup:
+ Everytime you pressed B button on any option, playgame started, not anymore
until you select Play Game option.
What's new? asako [20070831]
- modify mmc3 code for Chinese pirated rom
- add some Chinese pirated rom mappers
What's new? _svpe_ [20070607]
- Wii support (PAL50 fix, 1.35GiB restriction removed)
- 7zip ROM loading support from the DVD (not from a SD card!!)
- dvd_read fix (the read data was always copied to readbuffer instead of *dst)
- slower file selection when using the D-Pad (I didn't like the selection to go
as fast as in the latest release)

View File

@ -1,17 +0,0 @@
====This is CP950 big5 code=====
我想這大概是第一個在GAMECUBE的主機上可以跑對岸中國的盜版的任天堂模擬器。
基本上是修改 fceugc070607 的原始碼然後增加一些對中國的盜版ROM的支援。
我測式過太空戰士1、2跟三國誌-中原之霸者2、吞食天地1這些是可以執行的
有部份不能執行如 中原之霸者1有些怪怪的如 勇者鬥惡龍2、3、4(可能是rom本
身的問題)這是些是名作的部份其它非名作的中文ROM大多沒什麼問題。
最後請大家支持台灣加入聯合國,謝謝。
其它有指教的請
Email:asakous@gmail.com
==========================

View File

@ -1,363 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 1998 BERO
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
static uint8 latche;
static DECLFW(Mapper2_write)
{
latche=V;
ROM_BANK16(0x8000,V);
}
void Mapper2_init(void)
{
SetWriteHandler(0x8000,0xFFFF,Mapper2_write);
AddExState(&latche, 1, 0, "LATC");
}
static DECLFW(Mapper3_write)
{
VROM_BANK8(V);
latche=V;
}
void Mapper3_init(void)
{
SetWriteHandler(0x8000,0xFFFF,Mapper3_write);
AddExState(&latche, 1, 0, "LATC");
}
static DECLFW(Mapper7_write)
{
ROM_BANK32(V&0xF);
onemir((V>>4)&1);
latche=V;
}
void Mapper7_init(void)
{
onemir(0);
ROM_BANK32(0);
SetWriteHandler(0x8000,0xFFFF,Mapper7_write);
AddExState(&latche, 1, 0, "LATC");
}
void Mapper243_init(void)
{
}
static DECLFW(Mapper11_write)
{
ROM_BANK32(V&0xF);
VROM_BANK8(V>>4);
latche=V;
}
void Mapper11_init(void)
{
ROM_BANK32(0);
SetWriteHandler(0x8000,0xFFFF,Mapper11_write);
AddExState(&latche, 1, 0, "LATC");
}
void Mapper144_init(void)
{
ROM_BANK32(0);
SetWriteHandler(0x8001,0xFFFF,Mapper11_write);
AddExState(&latche, 1, 0, "LATC");
}
static DECLFW(Mapper13_write)
{
setchr4r(0x10,0x1000,V&3);
setprg32(0x8000,(V>>4)&3);
latche=V;
}
static void Mapper13_StateRestore(int version)
{
setchr4r(0x10,0x0000,0);
setchr4r(0x10,0x1000,latche&3);
setprg32(0x8000,(latche>>4)&3);
}
void Mapper13_init(void)
{
SetWriteHandler(0x8000,0xFFFF,Mapper13_write);
GameStateRestore=Mapper13_StateRestore;
AddExState(&latche, 1, 0, "LATC");
AddExState(MapperExRAM, 16384, 0, "CHRR");
SetupCartCHRMapping(0x10, MapperExRAM, 16384, 1);
latche=0;
Mapper13_StateRestore(FCEU_VERSION_NUMERIC);
}
static DECLFW(Mapper34_write)
{
switch(A)
{
case 0x7FFD:ROM_BANK32(V);break;
case 0x7FFE:VROM_BANK4(0x0000,V);break;
case 0x7fff:VROM_BANK4(0x1000,V);break;
}
if(A>=0x8000)
ROM_BANK32(V);
}
void Mapper34_init(void)
{
ROM_BANK32(0);
SetWriteHandler(0x7ffd,0xffff,Mapper34_write);
}
DECLFW(Mapper66_write)
{
VROM_BANK8(V&0xF);
ROM_BANK32((V>>4));
latche=V;
}
void Mapper66_init(void)
{
ROM_BANK32(0);
SetWriteHandler(0x6000,0xffff,Mapper66_write);
AddExState(&latche, 1, 0, "LATC");
}
DECLFW(Mapper152_write)
{
ROM_BANK16(0x8000,(V>>4)&0x7);
VROM_BANK8(V&0xF);
onemir((V>>7)&1); /* Saint Seiya...hmm. */
latche=V;
}
void Mapper152_init(void)
{
onemir(0);
SetWriteHandler(0x6000,0xffff,Mapper152_write);
AddExState(&latche, 1, 0, "LATC");
}
static DECLFW(Mapper70_write)
{
ROM_BANK16(0x8000,V>>4);
VROM_BANK8(V&0xF);
latche=V;
}
void Mapper70_init(void)
{
SetWriteHandler(0x6000,0xffff,Mapper70_write);
AddExState(&latche, 1, 0, "LATC");
}
/* Should be two separate emulation functions for this "mapper". Sigh. URGE TO KILL RISING. */
static DECLFW(Mapper78_write)
{
//printf("$%04x:$%02x\n",A,V&0x8);
ROM_BANK16(0x8000,V&0x7);
VROM_BANK8(V>>4);
onemir((V>>3)&1);
latche=V;
}
void Mapper78_init(void)
{
SetWriteHandler(0x8000,0xffff,Mapper78_write);
AddExState(&latche, 1, 0, "LATC");
}
DECLFW(Mapper87_write)
{
VROM_BANK8(V>>1);
latche=V;
}
void Mapper87_init(void)
{
SetWriteHandler(0x6000,0xffff,Mapper87_write);
AddExState(&latche, 1, 0, "LATC");
}
DECLFW(Mapper93_write)
{
ROM_BANK16(0x8000,V>>4);
MIRROR_SET(V&1);
latche=V;
}
void Mapper93_init(void)
{
SetWriteHandler(0x8000,0xffff,Mapper93_write);
AddExState(&latche, 1, 0, "LATC");
}
DECLFW(Mapper94_write)
{
ROM_BANK16(0x8000,V>>2);
latche=V;
}
void Mapper94_init(void)
{
SetWriteHandler(0x8000,0xffff,Mapper94_write);
AddExState(&latche, 1, 0, "LATC");
}
/* I might want to add some code to the mapper 96 PPU hook function
to not change CHR banks if the attribute table is being accessed,
if I make emulation a little more accurate in the future.
*/
static uint8 M96LA;
static DECLFW(Mapper96_write)
{
latche=V;
setprg32(0x8000,V&3);
setchr4r(0x10,0x0000,(latche&4)|M96LA);
setchr4r(0x10,0x1000,(latche&4)|3);
}
static void FP_FASTAPASS(1) M96Hook(uint32 A)
{
if((A&0x3000)!=0x2000) return;
//if((A&0x3ff)>=0x3c0) return;
M96LA=(A>>8)&3;
setchr4r(0x10,0x0000,(latche&4)|M96LA);
}
static void M96Sync(int v)
{
setprg32(0x8000,latche&3);
setchr4r(0x10,0x0000,(latche&4)|M96LA);
setchr4r(0x10,0x1000,(latche&4)|3);
}
void Mapper96_init(void)
{
SetWriteHandler(0x8000,0xffff,Mapper96_write);
PPU_hook=M96Hook;
AddExState(&latche, 1, 0, "LATC");
AddExState(&M96LA, 1, 0, "LAVA");
SetupCartCHRMapping(0x10, MapperExRAM, 32768, 1);
latche=M96LA=0;
M96Sync(0);
setmirror(MI_0);
GameStateRestore=M96Sync;
}
static DECLFW(Mapper140_write)
{
VROM_BANK8(V&0xF);
ROM_BANK32((V>>4)&0xF);
}
void Mapper140_init(void)
{
ROM_BANK32(0);
SetWriteHandler(0x6000,0x7FFF,Mapper140_write);
}
static void M185Sync(int version)
{
int x;
// DumpMem("out",0x8000,0xFFFF);
// exit(1);
// if(mapbyte1[0]==0x15)
if(!(mapbyte1[0]&3))
// if(!(mapbyte1[0]==0x21))
{
for(x=0;x<8;x++)
setchr1r(0x10,x<<10,0);
}
else
setchr8(0);
}
static DECLFW(Mapper185_write)
{
mapbyte1[0]=V;
M185Sync(0);
//printf("Wr: $%04x:$%02x, $%04x\n",A,V,X.PC);
}
void Mapper185_init(void)
{
memset(MapperExRAM,0xFF,1024);
MapStateRestore=M185Sync;
mapbyte1[0]=0;
M185Sync(0);
SetupCartCHRMapping(0x10,MapperExRAM,1024,0);
SetWriteHandler(0x8000,0xFFFF,Mapper185_write);
}
static DECLFW(M156Write)
{
if(A>=0xc000 && A<=0xC003)
VROM_BANK1((A&3)*1024,V);
else if(A>=0xc008 && A<=0xc00b)
VROM_BANK1(0x1000+(A&3)*1024,V);
if(A==0xc010) ROM_BANK16(0x8000,V);
// printf("$%04x:$%02x\n",A,V);
}
void Mapper156_init(void)
{
onemir(0);
SetWriteHandler(0xc000,0xc010,M156Write);
}
#ifdef moo
static DECLFW(Mapper157_write)
{
printf("$%04x:$%02x\n",A,V);
if(A<0xc000)
setprg16(0xc000,V);
}
static DECLFR(m157rd)
{
printf("Rd: $%04x\n",A);
}
void Mapper157_init(void)
{
SetWriteHandler(0x4020,0xffff,Mapper157_write);
SetReadHandler(0x4020,0x7fff,m157rd);
}
#endif
static DECLFW(m107w)
{
ROM_BANK32((V>>1)&0x3);
VROM_BANK8(V&0x7);
}
void Mapper107_init(void)
{
SetWriteHandler(0x8000,0xffff,m107w);
}

View File

@ -1,52 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
DECLFW(Mapper112_write)
{
switch(A)
{
case 0xe000:MIRROR_SET(V&1);break;
case 0x8000:mapbyte1[0]=V;break;
case 0xa000:switch(mapbyte1[0])
{
case 0:ROM_BANK8(0x8000,V);break;
case 1:ROM_BANK8(0xA000,V);break;
case 2: V&=0xFE;VROM_BANK1(0,V);
VROM_BANK1(0x400,(V+1));break;
case 3: V&=0xFE;VROM_BANK1(0x800,V);
VROM_BANK1(0xC00,(V+1));break;
case 4:VROM_BANK1(0x1000,V);break;
case 5:VROM_BANK1(0x1400,V);break;
case 6:VROM_BANK1(0x1800,V);break;
case 7:VROM_BANK1(0x1c00,V);break;
}
break;
}
}
void Mapper112_init(void)
{
SetWriteHandler(0x8000,0xffff,Mapper112_write);
}

View File

@ -1,50 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
/* I'm getting the feeling this is another "jam two different bank
switching hardwares into one mapper".
*/
/* HES 4-in-1 */
DECLFW(Mapper113_write)
{
ROM_BANK32((V>>3)&7);
VROM_BANK8(V&7);
//printf("$%04x:$%02x\n",A,V);
}
/* Deathbots */
DECLFW(Mapper113_writeh)
{
//printf("$%04x:$%02x\n",A,V);
ROM_BANK32(V&0x7);
//VROM_BANK8((V>>4)&0x7);
}
void Mapper113_init(void)
{
ROM_BANK32(0);
SetWriteHandler(0x4020,0x7fff,Mapper113_write);
SetWriteHandler(0x8000,0xffff,Mapper113_writeh);
}

View File

@ -1,99 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
#define master mapbyte3[0]
#define incmd mapbyte3[1]
static void dochr(void)
{
VROM_BANK2(0x0000,(mapbyte2[0]>>1));
VROM_BANK2(0x0800,(mapbyte2[2]>>1));
VROM_BANK1(0x1000,mapbyte2[6]);
VROM_BANK1(0x1400,mapbyte2[1]);
VROM_BANK1(0x1800,mapbyte2[7]);
VROM_BANK1(0x1c00,mapbyte2[3]);
}
void doprg()
{
if(master&0x80)
{
ROM_BANK16(0x8000,master&0x1F);
}
else
{
ROM_BANK8(0x8000,mapbyte2[4]);
ROM_BANK8(0xa000,mapbyte2[5]);
}
}
static DECLFW(Mapper114_write)
{
if(A<=0x7FFF)
{
master=V;
doprg();
}
else if(A==0xe003) IRQCount=V;
else if(A==0xe002) X6502_IRQEnd(FCEU_IQEXT);
else switch(A&0xE000)
{
case 0x8000:MIRROR_SET(V&1);break;
case 0xa000:mapbyte1[0]=V;incmd=1;break;
case 0xc000:
if(!incmd) break;
mapbyte2[mapbyte1[0]&0x7]=V;
switch(mapbyte1[0]&0x7)
{
case 0x0: case 1: case 2: case 3: case 6: case 7:
dochr();break;
case 0x4:
case 0x5:doprg();break;
}
incmd=0;
break;
}
}
static void Mapper114_hb(void)
{
if(IRQCount)
{
IRQCount--;
if(!IRQCount)
{
X6502_IRQBegin(FCEU_IQEXT);
//printf("IRQ: %d\n",scanline);
}
}
}
void Mapper114_init(void)
{
GameHBIRQHook=Mapper114_hb;
SetWriteHandler(0x6000,0xffff,Mapper114_write);
SetReadHandler(0x4020,0x7fff,0);
}

View File

@ -1,70 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
DECLFW(Mapper117_write)
{
//if(A>=0xc000)
//printf("$%04x:$%02x, %d,%d\n",A,V,scanline,timestamp);
switch(A)
{
case 0xc001:IRQLatch=V;break;
case 0xc003:IRQCount=IRQLatch;IRQa|=2;break;
case 0xe000:IRQa&=~1;IRQa|=V&1;X6502_IRQEnd(FCEU_IQEXT);break;
case 0xc002:X6502_IRQEnd(FCEU_IQEXT);break;
case 0xa000:VROM_BANK1(0x0000,V);break;
case 0xa001:VROM_BANK1(0x0400,V);break;
case 0xa002:VROM_BANK1(0x0800,V);break;
case 0xa003:VROM_BANK1(0x0c00,V);break;
case 0xa004:VROM_BANK1(0x1000,V);break;
case 0xa005:VROM_BANK1(0x1400,V);break;
case 0xa006:VROM_BANK1(0x1800,V);break;
case 0xa007:VROM_BANK1(0x1c00,V);break;
case 0x8000:ROM_BANK8(0x8000,V);break;
case 0x8001:ROM_BANK8(0xa000,V);break;
case 0x8002:ROM_BANK8(0xc000,V);break;
case 0x8003:ROM_BANK8(0xe000,V);break;
}
}
static void Mapper117_hb(void)
{
//if(scanline==0x40) X6502_IRQBegin(FCEU_IQEXT);
//return;
if(IRQa==3 && IRQCount)
{
IRQCount--;
if(!IRQCount)
{
IRQa&=1;
X6502_IRQBegin(FCEU_IQEXT);
}
}
}
void Mapper117_init(void)
{
GameHBIRQHook=Mapper117_hb;
SetWriteHandler(0x8000,0xffff,Mapper117_write);
}

View File

@ -1,73 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2003 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
static void Sync(void)
{
int x;
setmirror(((mapbyte1[0]>>6)&1)^1);
switch(mapbyte1[1]&0x3)
{
case 0x0:
for(x=0;x<4;x++)
setprg8(0x8000+x*8192,(((mapbyte1[0]&0x7F)<<1)+x)^(mapbyte1[0]>>7));
break;
case 0x2:
for(x=0;x<4;x++)
setprg8(0x8000+x*8192,((mapbyte1[0]&0x7F)<<1)+(mapbyte1[0]>>7));
break;
case 0x1:
case 0x3:
for(x=0;x<4;x++)
{
unsigned int b;
b=mapbyte1[0]&0x7F;
if(x>=2 && !(mapbyte1[1]&0x2))
b=0x7F;
setprg8(0x8000+x*8192,(x&1)+((b<<1)^(mapbyte1[0]>>7)));
}
break;
}
}
static DECLFW(Mapper15_write)
{
mapbyte1[0]=V;
mapbyte1[1]=A&3;
Sync();
}
static void StateRestore(int version)
{
Sync();
}
void Mapper15_init(void)
{
mapbyte1[0]=mapbyte1[1]=0;
Sync();
GameStateRestore=StateRestore;
SetWriteHandler(0x8000,0xFFFF,Mapper15_write);
}

View File

@ -1,41 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
DECLFW(Mapper151_write)
{
switch(A&0xF000)
{
case 0x8000:ROM_BANK8(0x8000,V);break;
case 0xA000:ROM_BANK8(0xA000,V);break;
case 0xC000:ROM_BANK8(0xC000,V);break;
case 0xe000:VROM_BANK4(0x0000,V);break;
case 0xf000:VROM_BANK4(0x1000,V);break;
}
}
void Mapper151_init(void)
{
SetWriteHandler(0x8000,0xffff,Mapper151_write);
}

View File

@ -1,305 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 1998 BERO
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
static void FP_FASTAPASS(1) BandaiIRQHook(int a)
{
if(IRQa)
{
IRQCount-=a;
if(IRQCount<0)
{
X6502_IRQBegin(FCEU_IQEXT);
//printf("IRQ: %d, %d\n",scanline,timestamp);
IRQa=0;
IRQCount=0xFFFF;
}
}
}
static DECLFW(Mapper16_write)
{
A&=0xF;
if(A<=0x7)
VROM_BANK1(A<<10,V);
else if(A==0x8)
ROM_BANK16(0x8000,V);
else switch(A) {
case 0x9: switch(V&3) {
case 0x00:MIRROR_SET2(1);break;
case 0x01:MIRROR_SET2(0);break;
case 0x02:onemir(0);break;
case 0x03:onemir(1);break;
}
break;
case 0xA:X6502_IRQEnd(FCEU_IQEXT);
IRQa=V&1;
IRQCount=IRQLatch;
break;
case 0xB:IRQLatch&=0xFF00;
IRQLatch|=V;
break;
case 0xC:IRQLatch&=0xFF;
IRQLatch|=V<<8;
break;
case 0xD: break;/* Serial EEPROM control port */
}
}
// Famicom jump 2:
// 0-7: Lower bit of data selects which 256KB PRG block is in use.
// This seems to be a hack on the developers' part, so I'll make emulation
// of it a hack(I think the current PRG block would depend on whatever the
// lowest bit of the CHR bank switching register that corresponds to the
// last CHR address read).
static void PRGO(void)
{
uint32 base=(mapbyte1[0]&1)<<4;
ROM_BANK16(0x8000,(mapbyte2[0]&0xF)|base);
ROM_BANK16(0xC000,base|0xF);
}
static DECLFW(Mapper153_write)
{
A&=0xF;
if(A<=0x7)
{
mapbyte1[A&7]=V;
PRGO();
}
else if(A==0x8)
{
mapbyte2[0]=V;
PRGO();
}
else switch(A) {
case 0x9: switch(V&3) {
case 0x00:MIRROR_SET2(1);break;
case 0x01:MIRROR_SET2(0);break;
case 0x02:onemir(0);break;
case 0x03:onemir(1);break;
}
break;
case 0xA:X6502_IRQEnd(FCEU_IQEXT);
IRQa=V&1;
IRQCount=IRQLatch;
break;
case 0xB:IRQLatch&=0xFF00;
IRQLatch|=V;
break;
case 0xC:IRQLatch&=0xFF;
IRQLatch|=V<<8;
break;
}
}
void Mapper16_init(void)
{
MapIRQHook=BandaiIRQHook;
SetWriteHandler(0x6000,0xFFFF,Mapper16_write);
}
void Mapper153_init(void)
{
MapIRQHook=BandaiIRQHook;
SetWriteHandler(0x8000,0xFFFF,Mapper153_write);
/* This mapper/board seems to have WRAM at $6000-$7FFF, so I'll let the
main ines code take care of that memory region. */
}
static uint8 BarcodeData[256];
static int BarcodeReadPos;
static int BarcodeCycleCount;
static uint32 BarcodeOut;
int FCEUI_DatachSet(const uint8 *rcode)
{
int prefix_parity_type[10][6] = {
{0,0,0,0,0,0}, {0,0,1,0,1,1}, {0,0,1,1,0,1}, {0,0,1,1,1,0},
{0,1,0,0,1,1}, {0,1,1,0,0,1}, {0,1,1,1,0,0}, {0,1,0,1,0,1},
{0,1,0,1,1,0}, {0,1,1,0,1,0}
};
int data_left_odd[10][7] = {
{0,0,0,1,1,0,1}, {0,0,1,1,0,0,1}, {0,0,1,0,0,1,1}, {0,1,1,1,1,0,1},
{0,1,0,0,0,1,1}, {0,1,1,0,0,0,1}, {0,1,0,1,1,1,1}, {0,1,1,1,0,1,1},
{0,1,1,0,1,1,1}, {0,0,0,1,0,1,1}
};
int data_left_even[10][7] = {
{0,1,0,0,1,1,1}, {0,1,1,0,0,1,1}, {0,0,1,1,0,1,1}, {0,1,0,0,0,0,1},
{0,0,1,1,1,0,1}, {0,1,1,1,0,0,1}, {0,0,0,0,1,0,1}, {0,0,1,0,0,0,1},
{0,0,0,1,0,0,1}, {0,0,1,0,1,1,1}
};
int data_right[10][7] = {
{1,1,1,0,0,1,0}, {1,1,0,0,1,1,0}, {1,1,0,1,1,0,0}, {1,0,0,0,0,1,0},
{1,0,1,1,1,0,0}, {1,0,0,1,1,1,0}, {1,0,1,0,0,0,0}, {1,0,0,0,1,0,0},
{1,0,0,1,0,0,0}, {1,1,1,0,1,0,0}
};
uint8 code[13+1];
uint32 tmp_p=0;
int i, j;
int len;
for(i=len=0;i<13;i++)
{
if(!rcode[i]) break;
if((code[i]=rcode[i]-'0') > 9)
return(0);
len++;
}
if(len!=13 && len!=12 && len!=8 && len!=7) return(0);
#define BS(x) BarcodeData[tmp_p]=x;tmp_p++
for(j=0;j<32;j++)
{
BS(0x00);
}
/* Left guard bars */
BS(1); BS(0); BS(1);
if(len==13 || len==12)
{
uint32 csum;
for(i=0;i<6;i++)
if(prefix_parity_type[code[0]][i])
{
for(j=0;j<7;j++)
{
BS(data_left_even[code[i+1]][j]);
}
}
else
for(j=0;j<7;j++)
{
BS(data_left_odd[code[i+1]][j]);
}
/* Center guard bars */
BS(0); BS(1); BS(0); BS(1); BS(0);
for(i=7;i<12;i++)
for(j=0;j<7;j++)
{
BS(data_right[code[i]][j]);
}
csum=0;
for(i=0;i<12;i++) csum+=code[i]*((i&1)?3:1);
csum=(10-(csum%10))%10;
//printf("%d\n",csum);
for(j=0;j<7;j++)
{
BS(data_right[csum][j]);
}
}
else if(len==8 || len==7)
{
uint32 csum=0;
for(i=0;i<7;i++) csum+=(i&1)?code[i]:(code[i]*3);
csum=(10-(csum%10))%10;
for(i=0;i<4;i++)
for(j=0;j<7;j++)
{
BS(data_left_odd[code[i]][j]);
}
/* Center guard bars */
BS(0); BS(1); BS(0); BS(1); BS(0);
for(i=4;i<7;i++)
for(j=0;j<7;j++)
{
BS(data_right[code[i]][j]);
}
for(j=0;j<7;j++)
{ BS(data_right[csum][j]);}
}
/* Right guard bars */
BS(1); BS(0); BS(1);
for(j=0;j<32;j++)
{
BS(0x00);
}
BS(0xFF);
#undef BS
BarcodeReadPos=0;
BarcodeOut=0x8;
BarcodeCycleCount=0;
return(1);
}
static void FP_FASTAPASS(1) BarcodeIRQHook(int a)
{
BandaiIRQHook(a);
BarcodeCycleCount+=a;
if(BarcodeCycleCount >= 1000)
{
BarcodeCycleCount -= 1000;
if(BarcodeData[BarcodeReadPos]==0xFF)
{
BarcodeOut=0;
}
else
{
BarcodeOut=(BarcodeData[BarcodeReadPos]^1)<<3;
BarcodeReadPos++;
}
}
}
static DECLFR(Mapper157_read)
{
uint8 ret;
ret=BarcodeOut;
return(ret);
}
void Mapper157_init(void)
{
FCEUGameInfo->cspecial = SIS_DATACH;
MapIRQHook=BarcodeIRQHook;
SetWriteHandler(0x6000,0xFFFF,Mapper16_write);
SetReadHandler(0x6000,0x7FFF,Mapper157_read);
BarcodeData[0]=0xFF;
BarcodeReadPos=0;
BarcodeOut=0;
BarcodeCycleCount=0;
}

View File

@ -1,74 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
static void FP_FASTAPASS(1) FFEIRQHook(int a)
{
if(IRQa)
{
IRQCount+=a;
if(IRQCount>=0x10000)
{
X6502_IRQBegin(FCEU_IQEXT);
IRQa=0;
IRQCount=0;
}
}
}
DECLFW(Mapper17_write)
{
switch(A){
default:
break;
case 0x42FE:
onemir((V>>4)&1);
break;
case 0x42FF:
MIRROR_SET((V>>4)&1);
break;
case 0x4501:IRQa=V&1;X6502_IRQEnd(FCEU_IQEXT);break;
case 0x4502:IRQCount&=0xFF00;IRQCount|=V;X6502_IRQEnd(FCEU_IQEXT);break;
case 0x4503:IRQCount&=0x00FF;IRQCount|=V<<8;IRQa=1;X6502_IRQEnd(FCEU_IQEXT);break;
case 0x4504: ROM_BANK8(0x8000,V);break;
case 0x4505: ROM_BANK8(0xA000,V);break;
case 0x4506: ROM_BANK8(0xC000,V);break;
case 0x4507: ROM_BANK8(0xE000,V);break;
case 0x4510: VROM_BANK1(0x0000,V);break;
case 0x4511: VROM_BANK1(0x0400,V);break;
case 0x4512: VROM_BANK1(0x0800,V);break;
case 0x4513: VROM_BANK1(0x0C00,V);break;
case 0x4514: VROM_BANK1(0x1000,V);break;
case 0x4515: VROM_BANK1(0x1400,V);break;
case 0x4516: VROM_BANK1(0x1800,V);break;
case 0x4517: VROM_BANK1(0x1C00,V);break;
}
}
void Mapper17_init(void)
{
MapIRQHook=FFEIRQHook;
SetWriteHandler(0x4020,0x5fff,Mapper17_write);
}

View File

@ -1,80 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
#define K4buf mapbyte2
#define K4buf2 mapbyte3
void FP_FASTAPASS(1) JalecoIRQHook(int a)
{
if(IRQa && IRQCount)
{
IRQCount-=a;
if(IRQCount<=0)
{
X6502_IRQBegin(FCEU_IQEXT);
IRQCount=0;
IRQa=0;
}
}
}
DECLFW(Mapper18_write)
{
A&=0xF003;
if(A>=0x8000 && A<=0x9001)
{
int x=((A>>1)&1)|((A-0x8000)>>11);
K4buf2[x]&=(0xF0)>>((A&1)<<2);
K4buf2[x]|=(V&0xF)<<((A&1)<<2);
ROM_BANK8(0x8000+(x<<13),K4buf2[x]);
}
else if(A>=0xa000 && A<=0xd003)
{
int x=((A>>1)&1)|((A-0xA000)>>11);
K4buf[x]&=(0xF0)>>((A&1)<<2);
K4buf[x]|=(V&0xF)<<((A&1)<<2);
VROM_BANK1(x<<10,K4buf[x]);
}
else switch(A)
{
case 0xe000:IRQLatch&=0xFFF0;IRQLatch|=(V&0x0f);break;
case 0xe001:IRQLatch&=0xFF0F;IRQLatch|=(V&0x0f)<<4;break;
case 0xe002:IRQLatch&=0xF0FF;IRQLatch|=(V&0x0f)<<8;break;
case 0xe003:IRQLatch&=0x0FFF;IRQLatch|=(V&0x0f)<<12;break;
case 0xf000:IRQCount=IRQLatch;
break;
case 0xf001:IRQa=V&1;
X6502_IRQEnd(FCEU_IQEXT);
break;
case 0xf002:MIRROR_SET2(V&1);
if(V&2) onemir(0);
break;
}
}
void Mapper18_init(void)
{
SetWriteHandler(0x8000,0xffff,Mapper18_write);
MapIRQHook=JalecoIRQHook;
}

View File

@ -1,14 +0,0 @@
#include "mapinc.h"
DECLFW(Mapper180_write)
{
ROM_BANK16(0xC000,V);
}
void Mapper180_init(void)
{
SetWriteHandler(0x8000,0xffff,Mapper180_write);
}

View File

@ -1,48 +0,0 @@
#include "mapinc.h"
static DECLFW(Mapper182_write)
{
switch(A&0xf003)
{
case 0xe003:IRQCount=V;IRQa=1;X6502_IRQEnd(FCEU_IQEXT);break;
case 0x8001:MIRROR_SET(V&1);break;
case 0xA000:mapbyte1[0]=V;break;
case 0xC000:
switch(mapbyte1[0]&7)
{
case 0:VROM_BANK2(0x0000,V>>1);break;
case 1:VROM_BANK1(0x1400,V);break;
case 2:VROM_BANK2(0x0800,V>>1);break;
case 3:VROM_BANK1(0x1c00,V);break;
case 4:ROM_BANK8(0x8000,V);break;
case 5:ROM_BANK8(0xA000,V);break;
case 6:VROM_BANK1(0x1000,V);break;
case 7:VROM_BANK1(0x1800,V);break;
}
break;
}
}
void blop(void)
{
if(IRQa)
{
if(IRQCount)
{
IRQCount--;
if(!IRQCount)
{
IRQa=0;
X6502_IRQBegin(FCEU_IQEXT);
}
}
}
}
void Mapper182_init(void)
{
SetWriteHandler(0x8000,0xFFFF,Mapper182_write);
GameHBIRQHook=blop;
}

View File

@ -1,15 +0,0 @@
#include "mapinc.h"
DECLFW(Mapper184_write)
{
VROM_BANK4(0x0000,V);
VROM_BANK4(0x1000,(V>>4));
}
void Mapper184_init(void)
{
SetWriteHandler(0x6000,0xffff,Mapper184_write);
}

View File

@ -1,162 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2003 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
static uint8 LastWr;
static uint8 ExtMode;
static uint8 cmd;
static uint8 DRegs[8];
static uint32 count=0;
static uint32 last=0;
static int safe=0;
static uint8 poofish;
static void Sync(void)
{
int x;
uint32 base=0;
if(cmd&0x80) base=0x1000;
setchr2(0x0000^base,(0x100|DRegs[0])>>1);
setchr2(0x0800^base,(0x100|DRegs[1])>>1);
for(x=0;x<4;x++)
setchr1((0x1000^base)+x*0x400,DRegs[2+x]);
if(ExtMode&0x80)
{
if(ExtMode&0x20)
setprg32(0x8000,(ExtMode&0x1F)>>1);
else
{
setprg16(0x8000,(ExtMode&0x1F));
setprg16(0xc000,(ExtMode&0x1F));
}
}
else
{
setprg8(0x8000,DRegs[6]);
setprg8(0xc000,~1);
setprg8(0xa000,DRegs[7]);
setprg8(0xe000,~0);
}
}
static DECLFW(M187Write)
{
LastWr=V;
if(A==0x5000)
ExtMode=V;
Sync();
}
static DECLFW(M187HWrite)
{
//if(A==0x8003 && X.PC<0x800) FCEUI_DumpMem("dmp",0x0000,0xFFFF);
//printf("$%04x:$%02x, %04x\n",A,V,X.PC);
LastWr=V;
if(A==0x8003)
{
if(V==0x28 || V==0x2A)
poofish=V;
}
else if(A==0x8000) poofish=0;
switch(A)
{
case 0xc000:IRQLatch=IRQCount=V;break;
case 0xc001:IRQCount=IRQLatch;last=count=0;break;
case 0xe000:IRQa=0;X6502_IRQEnd(FCEU_IQEXT);break;
case 0xe001:IRQa=1;break;
case 0xa000:MIRROR_SET(V&1);break;
case 0x8000:cmd=V;safe=1;break;
case 0x8001:
if(safe)
{
//printf("Cmd: %d, %02x, %04x\n",cmd&0x7,V,X.PC);
DRegs[cmd&7]=V;
Sync();
safe=0;
}
if(poofish==0x28) setprg8(0xc000,0x17);
break;
}
}
static DECLFR(ProtRead)
{
switch(LastWr&0x3)
{
case 0x1:
case 0x0: return(0x80);
case 0x2: return(0x42);
}
return(0);
}
static void M187Power(void)
{
SetWriteHandler(0x5000,0x5fff,M187Write);
SetWriteHandler(0x8000,0xFFFF,M187HWrite);
SetReadHandler(0x5000,0x5FFF,ProtRead);
SetWriteHandler(0x6000,0x7FFF,M187Write);
SetReadHandler(0x8000,0xffff,CartBR);
Sync();
}
static void sl(void)
{
if(IRQa)
{
if(IRQCount>=0)
{
IRQCount--;
if(IRQCount<0)
{
X6502_IRQBegin(FCEU_IQEXT);
}
}
}
}
static void FP_FASTAPASS(1) foo(uint32 A)
{
if((A&0x2000) && !(last&0x2000))
{
count++;
if(count==42)
{
sl();
count=0;
}
}
last=A;
}
void Mapper187_Init(CartInfo *info)
{
info->Power=M187Power;
//GameHBIRQHook=sl;
PPU_hook=foo;
}

View File

@ -1,55 +0,0 @@
/* Is this an MMC3 workalike piece of hardware, with the addition of
a register at $4120 or does it have only partial MMC3 functionality?
A good test would be to see if commands 6 and 7 can change PRG banks
and of course test the regs >=$c000, on the real cart.
*/
#include "mapinc.h"
#define cmd mapbyte1[0]
static DECLFW(Mapper189_write)
{
//if(A>=0xc000) printf("$%04x:$%02x\n",A,V);
if((A&0xF100)==0x4100) ROM_BANK32(V>>4);
else if((A&0xF100)==0x6100) ROM_BANK32(V&3);
else switch(A&0xE001)
{
case 0xa000:MIRROR_SET(V&1);break;
case 0x8000:cmd=V;break;
case 0x8001:switch(cmd&7)
{
case 0:VROM_BANK2(0x0000,V>>1);break;
case 1:VROM_BANK2(0x0800,V>>1);break;
case 2:VROM_BANK1(0x1000,V);break;
case 3:VROM_BANK1(0x1400,V);break;
case 4:VROM_BANK1(0x1800,V);break;
case 5:VROM_BANK1(0x1C00,V);break;
}
case 0xc000:IRQLatch=V;break;
case 0xc001:IRQCount=IRQLatch;break;
case 0xe000:IRQa=0;X6502_IRQEnd(FCEU_IQEXT);break;
case 0xe001:IRQa=1;break;
break;
}
}
void m189irq(void)
{
if(IRQa)
{
if(IRQCount)
{
IRQCount--;
if(!IRQCount) X6502_IRQBegin(FCEU_IQEXT);
}
}
}
void Mapper189_init(void)
{
GameHBIRQHook=m189irq;
SetWriteHandler(0x4120,0xFFFF,Mapper189_write);
SetReadHandler(0x6000,0x7FFF,0);
ROM_BANK32(0);
}

View File

@ -1,20 +0,0 @@
#include "mapinc.h"
static DECLFW(m193w)
{
//printf("$%04x:$%02x\n",A,V);
switch(A&3)
{
case 0:VROM_BANK4(0x0000,V>>2);break;
case 1:VROM_BANK2(0x1000,V>>1);break;
case 2:VROM_BANK2(0x1800,V>>1);break;
case 3:ROM_BANK8(0x8000,V);break;
}
}
void Mapper193_init(void)
{
ROM_BANK32(~0);
SetWriteHandler(0x4018,0x7fff,m193w);
SetReadHandler(0x4018,0x7fff,0);
}

View File

@ -1,36 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2003 CaH4e3
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
static DECLFW(Mapper200_write)
{
// FCEU_printf("%04x, %02x\n",A,V);
ROM_BANK16(0x8000,A&0x07);
ROM_BANK16(0xC000,A&0x07);
VROM_BANK8(A&0x07);
MIRROR_SET((A&0x08)>>3);
}
void Mapper200_init(void)
{
SetWriteHandler(0x8000,0xffff,Mapper200_write);
}

View File

@ -1,44 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2003 CaH4e3
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
static DECLFW(Mapper201_write)
{
// FCEU_printf("%04x, %02x\n",A,V);
if (A&0x08)
{
ROM_BANK32(A&0x03);
VROM_BANK8(A&0x03);
}
else
{
ROM_BANK32(0);
VROM_BANK8(0);
}
}
void Mapper201_init(void)
{
ROM_BANK32(0);
VROM_BANK8(0);
SetWriteHandler(0x8000,0xffff,Mapper201_write);
}

View File

@ -1,39 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2003 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
static DECLFW(Mapper202_write)
{
int tmp=(A>>1)&0x7;
MIRROR_SET(A&1);
ROM_BANK16(0x8000,tmp);
ROM_BANK16(0xc000,tmp+(((tmp&0x6)==0x6)?1:0));
VROM_BANK8(tmp);
}
void Mapper202_init(void)
{
ROM_BANK16(0x8000,0);
ROM_BANK16(0xc000,0);
VROM_BANK8(0);
SetWriteHandler(0x8000,0xFFFF,Mapper202_write);
}

View File

@ -1,36 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2003 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
static DECLFW(Mapper203_write)
{
ROM_BANK16(0x8000,(V>>2)&3);
ROM_BANK16(0xc000,(V>>2)&3);
VROM_BANK8(V&3);
}
void Mapper203_init(void)
{
ROM_BANK16(0x8000,0);
ROM_BANK16(0xc000,0);
VROM_BANK8(0);
SetWriteHandler(0x8000,0xFFFF,Mapper203_write);
}

View File

@ -1,139 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2003 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
static uint8 PRGSel;
static uint8 PBuf[4],PSel;
static uint8 cmd;
static uint8 DRegs[8];
static uint32 count=0;
static uint32 last=0;
static DECLFW(M208Write1)
{
PRGSel=(V&0x1)|((V>>3)&0x2);
setprg32(0x8000,PRGSel);
}
static DECLFW(M208Write2)
{
static uint8 lut[256]={
0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59,0x59, 0x49, 0x19, 0x09, 0x59, 0x49, 0x19, 0x09,
0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59,0x51, 0x41, 0x11, 0x01, 0x51, 0x41, 0x11, 0x01,
0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59,0x59, 0x49, 0x19, 0x09, 0x59, 0x49, 0x19, 0x09,
0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59,0x51, 0x41, 0x11, 0x01, 0x51, 0x41, 0x11, 0x01,
0x00, 0x10, 0x40, 0x50, 0x00, 0x10, 0x40, 0x50,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x08, 0x18, 0x48, 0x58, 0x08, 0x18, 0x48, 0x58,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x10, 0x40, 0x50, 0x00, 0x10, 0x40, 0x50,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x08, 0x18, 0x48, 0x58, 0x08, 0x18, 0x48, 0x58,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59,0x58, 0x48, 0x18, 0x08, 0x58, 0x48, 0x18, 0x08,
0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59,0x50, 0x40, 0x10, 0x00, 0x50, 0x40, 0x10, 0x00,
0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59,0x58, 0x48, 0x18, 0x08, 0x58, 0x48, 0x18, 0x08,
0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59,0x50, 0x40, 0x10, 0x00, 0x50, 0x40, 0x10, 0x00,
0x01, 0x11, 0x41, 0x51, 0x01, 0x11, 0x41, 0x51,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x09, 0x19, 0x49, 0x59, 0x09, 0x19, 0x49, 0x59,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x11, 0x41, 0x51, 0x01, 0x11, 0x41, 0x51,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x09, 0x19, 0x49, 0x59, 0x09, 0x19, 0x49, 0x59,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
if(A<=0x57FF) PSel=V;
else
PBuf[(A&0x03)]=V^lut[PSel];
}
static DECLFR(M208Read)
{
return(PBuf[(A&0x3)]);
}
static void Sync(void)
{
int x;
setchr2(0x0000,DRegs[0]>>1);
setchr2(0x0800,DRegs[1]>>1);
for(x=0;x<4;x++)
setchr1(0x1000+x*0x400,DRegs[2+x]);
}
static DECLFW(M208HWrite)
{
switch(A&0xe001)
{
case 0xc000:IRQLatch=IRQCount=V;break;
case 0xc001:IRQCount=IRQLatch;last=count=0;break;
case 0xe000:IRQa=0;X6502_IRQEnd(FCEU_IQEXT);break;
case 0xe001:IRQa=1;break;
case 0x8000:cmd=V;break;
case 0x8001:DRegs[cmd&7]=V;
Sync();
break;
}
}
static void M208Power(void)
{
PRGSel=3;
setprg32(0x8000,3);
SetWriteHandler(0x4800,0x4FFF,M208Write1);
SetWriteHandler(0x5000,0x5fff,M208Write2);
SetWriteHandler(0x8000,0xFFFF,M208HWrite);
SetReadHandler(0x5800,0x5FFF,M208Read);
SetReadHandler(0x8000,0xffff,CartBR);
}
static void sl(void)
{
if(IRQa)
{
if(IRQCount>=0)
{
IRQCount--;
if(IRQCount<0)
{
X6502_IRQBegin(FCEU_IQEXT);
}
}
}
}
static void FP_FASTAPASS(1) foo(uint32 A)
{
if((A&0x2000) && !(last&0x2000))
{
count++;
if(count==42)
{
sl();
count=0;
}
}
last=A;
}
void Mapper208_Init(CartInfo *info)
{
info->Power=M208Power;
//GameHBIRQHook=sl;
PPU_hook=foo;
}

View File

@ -1,106 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
#define K4buf mapbyte2
#define K4IRQ mapbyte1[1]
#define K4sel mapbyte1[0]
static int acount=0;
DECLFW(Mapper21_write)
{
A|=((A>>5)&0xF);
if((A&0xF000)==0xA000)
ROM_BANK8(0xA000,V);
else if((A&0xF000)==0x8000)
{
if(K4sel&2)
ROM_BANK8(0xC000,V);
else
ROM_BANK8(0x8000,V);
}
else if(A>=0xb000 && A<=0xefff)
{
A&=0xF006;
{
int x=((A>>2)&1)|((A-0xB000)>>11);
K4buf[x]&=(0xF0)>>((A&2)<<1);
K4buf[x]|=(V&0xF)<<((A&2)<<1);
VROM_BANK1(x<<10,K4buf[x]);
}
}
else switch(A&0xF006)
{
case 0x9000:
switch(V&0x3)
{
case 0:MIRROR_SET(0);break;
case 1:MIRROR_SET(1);break;
case 2:onemir(0);break;
case 3:onemir(1);break;
}
break;
case 0x9006:
case 0x9004:
case 0x9002:if((K4sel&2)!=(V&2))
{
uint8 swa;
swa=PRGBankList[0];
ROM_BANK8(0x8000,PRGBankList[2]);
ROM_BANK8(0xc000,swa);
}
K4sel=V;
break;
case 0xf000:IRQLatch&=0xF0;IRQLatch|=V&0xF;break;
case 0xf002:IRQLatch&=0x0F;IRQLatch|=V<<4;break;
case 0xf004:IRQCount=IRQLatch;acount=0;
IRQa=V&2;K4IRQ=V&1;
X6502_IRQEnd(FCEU_IQEXT);
break;
case 0xf006:IRQa=K4IRQ;X6502_IRQEnd(FCEU_IQEXT);break;
}
}
static void FP_FASTAPASS(1) KonamiIRQHook(int a)
{
#define LCYCS ((227*2)+1)
//#define LCYCS 341
if(IRQa)
{
// acount+=a*3;
acount+=a*4;
if(acount>=LCYCS)
{
doagainbub:acount-=LCYCS;IRQCount++;
if(IRQCount&0x100) {X6502_IRQBegin(FCEU_IQEXT);IRQCount=IRQLatch;}
if(acount>=LCYCS) goto doagainbub;
}
}
}
void Mapper21_init(void)
{
SetWriteHandler(0x8000,0xffff,Mapper21_write);
MapIRQHook=KonamiIRQHook;
}

View File

@ -1,63 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
#define K4buf mapbyte2
DECLFW(Mapper22_write)
{
if(A<=0xAFFF)
{
switch(A&0xF000)
{
case 0x8000:ROM_BANK8(0x8000,V);break;
case 0xa000:ROM_BANK8(0xA000,V);break;
case 0x9000:switch(V&3)
{
case 0x00:MIRROR_SET2(1);break;
case 0x01:MIRROR_SET2(0);break;
case 0x02:onemir(0);break;
case 0x03:onemir(1);break;
}
break;
}
}
else
{
A&=0xF003;
if(A>=0xb000 && A<=0xe003)
{
int x=(A&1)|((A-0xB000)>>11);
K4buf[x]&=(0xF0)>>((A&2)<<1);
K4buf[x]|=(V&0xF)<<((A&2)<<1);
VROM_BANK1(x<<10,K4buf[x]>>1);
}
}
}
void Mapper22_init(void)
{
SetWriteHandler(0x8000,0xffff,Mapper22_write);
}

View File

@ -1,87 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
#define reg1 mapbyte1[0]
#define reg2 mapbyte1[1]
#define reg3 mapbyte1[2]
#define reg4 mapbyte1[3]
DECLFR(A110in1read)
{
switch(A&0x3)
{
case 0:return reg1;break;
case 1:return reg2;break;
case 2:return reg3;break;
case 3:return reg4;break;
}
return 0xF;
}
DECLFW(A110in1regwr)
{
switch(A&0x3)
{
case 0:reg1=V&0xF;break;
case 1:reg2=V&0xF;break;
case 2:reg3=V&0xF;break;
case 3:reg4=V&0xF;break;
}
}
DECLFW(Mapper225_write)
{
int banks=0;
MIRROR_SET((A>>13)&1);
if(A&0x4000)
banks=1;
else
banks=0;
VROM_BANK8(((A&0x003f)+(banks<<6)));
if(A&0x1000)
{
if(A&0x40)
{
ROM_BANK16(0x8000,((((((A>>7)&0x1F)+(banks<<5)))<<1)+1));
ROM_BANK16(0xC000,((((((A>>7)&0x1F)+(banks<<5)))<<1)+1));
}
else
{
ROM_BANK16(0x8000,(((((A>>7)&0x1F)+(banks<<5)))<<1));
ROM_BANK16(0xC000,(((((A>>7)&0x1F)+(banks<<5)))<<1));
}
}
else
{
ROM_BANK32(((((A>>7)&0x1F)+(banks<<5))));
}
}
void Mapper225_init(void)
{
SetWriteHandler(0x8000,0xffff,Mapper225_write);
SetReadHandler(0x5800,0x5fff,A110in1read);
SetWriteHandler(0x5800,0x5fff,A110in1regwr);
}

View File

@ -1,105 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
#define rg mapbyte1
static void DoPRG(void)
{
int32 b=((rg[0]>>1)&0xF) | ((rg[0]>>3)&0x10) | ((rg[1]&1)<<5);
if(rg[0]&0x20) // 16 KB
{
ROM_BANK16(0x8000,(b<<1)|(rg[0]&1));
ROM_BANK16(0xC000,(b<<1)|(rg[0]&1));
}
else
ROM_BANK32(b);
}
static DECLFW(Mapper226_write)
{
rg[A&1]=V;
DoPRG();
if(A&1)
{
if(rg[1]&2)
PPUCHRRAM=0; // Write protected.
else
PPUCHRRAM=0xFF; // Not write protected.
}
else
MIRROR_SET2((rg[0]>>6)&1);
}
static void M26Reset(void)
{
rg[0]=rg[1]=0;
DoPRG();
PPUCHRRAM=0xFF;
MIRROR_SET2(0);
}
static void M26Restore(int version)
{
DoPRG();
if(rg[1]&2)
PPUCHRRAM=0; // Write protected.
else
PPUCHRRAM=0xFF; // Not write protected.
MIRROR_SET2((rg[0]>>6)&1);
}
void Mapper226_init(void)
{
SetWriteHandler(0x8000,0xffff,Mapper226_write);
MapperReset=M26Reset;
GameStateRestore=M26Restore;
M26Reset();
}
#ifdef OLD // What the heck is this??
DECLFW(Mapper226_write)
{
MIRROR_SET((A>>13)&1);
VROM_BANK8(A&0x7F);
if(A&0x1000)
{
if(A&0x40)
{
ROM_BANK16(0x8000,(((A>>7))<<1)+1);
ROM_BANK16(0xC000,(((A>>7))<<1)+1);
}
else
{
ROM_BANK16(0x8000,(((A>>7))<<1));
ROM_BANK16(0xC000,(((A>>7))<<1));
}
}
else
{
ROM_BANK32(A>>7);
}
}
void Mapper226_init(void)
{
SetWriteHandler(0x8000,0xffff,Mapper226_write);
}
#endif

View File

@ -1,79 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
#define rg mapbyte1
static void DoSync(uint32 A)
{
int32 p=((A>>3)&0xF) | ((A>>4)&0x10);
rg[0]=A;
rg[1]=A>>8;
MIRROR_SET((A>>1)&1);
if(A&1) //32 KB
{
ROM_BANK32(p);
}
else //16 KB
{
ROM_BANK16(0x8000,(p<<1)|((A&4)>>2));
ROM_BANK16(0xc000,(p<<1)|((A&4)>>2));
}
if(A&0x80)
{
PPUCHRRAM=0;
}
else
{
PPUCHRRAM=0xFF;
if(A&0x200)
ROM_BANK16(0xC000,(p<<1)|7);
else
ROM_BANK16(0xC000,(p<<1)&(~7));
}
}
static DECLFW(Mapper227_write)
{
rg[A&1]=V;
DoSync(A);
}
static void M227Reset(void)
{
rg[0]=rg[1]=0;
DoSync(0);
}
static void M227Restore(int version)
{
DoSync(rg[0]|(rg[1]<<8));
}
void Mapper227_init(void)
{
SetWriteHandler(0x8000,0xffff,Mapper227_write);
MapperReset=M227Reset;
GameStateRestore=M227Restore;
M227Reset();
}

View File

@ -1,53 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
static DECLFW(Mapper228_write)
{
uint32 page,pagel,pageh;
MIRROR_SET((A>>13)&1);
page=(A>>7)&0x3F;
//printf("%04x\n",A);
if((page&0x30)==0x30)
page-=0x10;
pagel=pageh=(page<<1) + (((A>>6)&1)&((A>>5)&1));
pageh+=((A>>5)&1)^1;
ROM_BANK16(0x8000,pagel);
ROM_BANK16(0xC000,pageh);
VROM_BANK8( (V&0x3) | ((A&0xF)<<2) );
}
static void A52Reset(void)
{
Mapper228_write(0,0);
}
void Mapper228_init(void)
{
MapperReset=A52Reset;
A52Reset();
SetWriteHandler(0x8000,0xffff,Mapper228_write);
}

View File

@ -1,48 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
DECLFW(Mapper229_write)
{
if(A>=0x8000)
{
MIRROR_SET((A>>5)&1);
if(!(A&0x1e))
{
ROM_BANK32(0);
}
else
{
ROM_BANK16(0x8000,A&0x1f);
ROM_BANK16(0xC000,A&0x1f);
}
VROM_BANK8(A);
}
}
void Mapper229_init(void)
{
SetWriteHandler(0x8000,0xffff,Mapper229_write);
}

View File

@ -1,102 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
#define K4buf mapbyte2
#define K4IRQ mapbyte1[1]
#define K4sel mapbyte1[0]
static int acount=0;
static DECLFW(Mapper23_write)
{
if((A&0xF000)==0x8000)
{
if(K4sel&2)
ROM_BANK8(0xC000,V);
else
ROM_BANK8(0x8000,V);
}
else if((A&0xF000)==0xA000)
ROM_BANK8(0xA000,V);
else
{
A|=((A>>2)&0x3)|((A>>4)&0x3)|((A>>6)&0x3);
A&=0xF003;
if(A>=0xb000 && A<=0xe003)
{
int x=((A>>1)&1)|((A-0xB000)>>11);
K4buf[x]&=(0xF0)>>((A&1)<<2);
K4buf[x]|=(V&0xF)<<((A&1)<<2);
VROM_BANK1(x<<10,K4buf[x]);
}
else
switch(A)
{
case 0xf000:X6502_IRQEnd(FCEU_IQEXT);IRQLatch&=0xF0;IRQLatch|=V&0xF;break;
case 0xf001:X6502_IRQEnd(FCEU_IQEXT);IRQLatch&=0x0F;IRQLatch|=V<<4;break;
case 0xf002:X6502_IRQEnd(FCEU_IQEXT);acount=0;IRQCount=IRQLatch;IRQa=V&2;K4IRQ=V&1;break;
case 0xf003:X6502_IRQEnd(FCEU_IQEXT);IRQa=K4IRQ;break;
case 0x9001:
case 0x9002:
case 0x9003:
if((K4sel&2)!=(V&2))
{
uint8 swa;
swa=PRGBankList[0];
ROM_BANK8(0x8000,PRGBankList[2]);
ROM_BANK8(0xc000,swa);
}
K4sel=V;
break;
case 0x9000:
switch(V&0x3)
{
case 0:MIRROR_SET(0);break;
case 1:MIRROR_SET(1);break;
case 2:onemir(0);break;
case 3:onemir(1);break;
}
break;
}
}
}
void FP_FASTAPASS(1) KonamiIRQHook2(int a)
{
#define LCYCS 341
if(IRQa)
{
acount+=a*3;
if(acount>=LCYCS)
{
doagainbub:acount-=LCYCS;IRQCount++;
if(IRQCount&0x100) {X6502_IRQBegin(FCEU_IQEXT);IRQCount=IRQLatch;}
if(acount>=LCYCS) goto doagainbub;
}
}
}
void Mapper23_init(void)
{
SetWriteHandler(0x8000,0xffff,Mapper23_write);
MapIRQHook=KonamiIRQHook2;
}

View File

@ -1,62 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2003 CaH4e3
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
#define rom_sw mapbyte1[0]
void Mapper230_Reset(void)
{
rom_sw ^= 1; //1 - rom_sw;
if( rom_sw ) {
ROM_BANK16(0x8000,0);
ROM_BANK16(0xc000,7);
} else {
ROM_BANK16(0x8000,8);
ROM_BANK16(0xc000,39);
}
MIRROR_SET2(1);
}
static DECLFW(Mapper230_write)
{
if( rom_sw ) {
ROM_BANK16( 0x8000, V&0x07 );
} else {
if( V & 0x20 ) {
ROM_BANK16( 0x8000, (V&0x1F)+8 );
ROM_BANK16( 0xc000, (V&0x1F)+8 );
} else {
ROM_BANK32( ((V&0x1E) >> 1) + 4 );
}
MIRROR_SET2( ((V & 0x40) >> 6) );
}
}
void Mapper230_init(void)
{
ROM_BANK16(0x8000,0);
ROM_BANK16(0xc000,7);
SetWriteHandler(0x8000, 0xffff, Mapper230_write);
MapperReset = Mapper230_Reset;
rom_sw = 1;
}

View File

@ -1,41 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2003 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
static DECLFW(Mapper231_write)
{
if(A&0x20)
ROM_BANK32((A>>1)&0xF);
else
{
ROM_BANK16(0x8000,(A&0x1E));
ROM_BANK16(0xc000,(A&0x1E));
}
MIRROR_SET((A>>7)&1);
}
void Mapper231_init(void)
{
ROM_BANK16(0x8000,0);
ROM_BANK16(0xc000,0);
SetWriteHandler(0x8000,0xffff,Mapper231_write);
}

View File

@ -1,50 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
static void DoIt(void)
{
ROM_BANK16(0x8000,(mapbyte1[1]&3) | ((mapbyte1[0]&0x18)>>1));
ROM_BANK16(0xc000,3|(((mapbyte1[0])&0x18)>>1));
}
DECLFW(Mapper232_write)
{
if(A<=0x9FFF)
mapbyte1[0]=V;
else
mapbyte1[1]=V;
DoIt();
}
static void QuattroReset(void)
{
mapbyte1[0]=0x18;
DoIt();
}
void Mapper232_init(void)
{
SetWriteHandler(0x6000,0xffff,Mapper232_write);
MapperReset=QuattroReset;
QuattroReset();
}

View File

@ -1,107 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
#define r1 mapbyte1[0]
#define r2 mapbyte1[1]
static void DoBS(void)
{
if(r1&0x40)
{
ROM_BANK32((r1&0xE)|(r2&1));
VROM_BANK8( ((r1&0xE)<<2) | ((r2>>4)&7) );
}
else
{
ROM_BANK32(r1&0xF);
VROM_BANK8( ((r1&0xF)<<2) | ((r2>>4)&3) );
}
}
static void R1Set(uint8 V)
{
if(r1) return;
r1=V;
MIRROR_SET(V>>7);
DoBS();
}
static void R2Set(uint8 V)
{
r2=V;
DoBS();
}
DECLFW(R1W)
{
R1Set(V);
}
DECLFR(R1R)
{
uint8 r=CartBR(A);
R1Set(r);
return r;
}
DECLFW(R2W)
{
R2Set(V);
}
DECLFR(R2R)
{
uint8 r=CartBR(A);
R2Set(r);
return r;
}
static void M15Restore(int version)
{
DoBS();
MIRROR_SET(r1>>7);
}
static void M15Reset(void)
{
r1=r2=0;
DoBS();
MIRROR_SET(0);
}
void Mapper234_init(void)
{
SetWriteHandler(0xff80,0xff9f,R1W);
SetReadHandler(0xff80,0xff9f,R1R);
SetWriteHandler(0xffe8,0xfff7,R2W);
SetReadHandler(0xffe8,0xfff7,R2R);
SetReadHandler(0x6000,0x7FFF,0);
SetWriteHandler(0x6000,0x7FFF,0);
M15Reset();
GameStateRestore=M15Restore;
MapperReset=M15Reset;
}

View File

@ -1,53 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
static DECLFW(Mapper235_write)
{
uint32 m;
int z;
if(A&0x400)
onemir(0);
else
setmirror(((A>>13)&1)^1);
m=A&0x1f;
z=(A>>8)&3;
if(A&0x800)
{
setprg16r(0x10|z,0x8000,(m<<1)|((A>>12)&1));
setprg16r(0x10|z,0xC000,(m<<1)|((A>>12)&1));
}
else
setprg32r(0x10|z,0x8000,m);
}
void Mapper235_init(void)
{
/* Fixme: Possible crashy bug if header is bad. */
SetupCartPRGMapping(0x10,PRGptr[0],1024*1024,0);
SetupCartPRGMapping(0x12,PRGptr[0]+1024*1024,1024,0);
setprg32r(0x10,0x8000,0);
SetReadHandler(0x8000,0xffff,CartBROB);
SetWriteHandler(0x8000,0xffff,Mapper235_write);
}

View File

@ -1,39 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
DECLFW(Mapper240_write)
{
if(A<0x8000)
{
ROM_BANK32(V>>4);
VROM_BANK8(V&0xF);
}
}
void Mapper240_init(void)
{
SetWriteHandler(0x4020,0x5fff,Mapper240_write);
SetWriteHandler(0x8000,0xffff,Mapper240_write);
}

View File

@ -1,26 +0,0 @@
#include "mapinc.h"
static DECLFW(M241wr)
{
if(A<0x8000)
{
// printf("$%04x:$%02x, $%04x\n",A,V,X.PC);
}
else
ROM_BANK32(V);
}
static DECLFR(M241rd)
{
//DumpMem("out",0x8000,0xffff);
//printf("Rd: $%04x, $%04x\n",A,X.PC);
return(0x50);
}
void Mapper241_init(void)
{
ROM_BANK32(0);
SetWriteHandler(0x5000,0x5fff,M241wr);
SetWriteHandler(0x8000,0xFFFF,M241wr);
SetReadHandler(0x4020,0x5fff,M241rd);
}

View File

@ -1,41 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
DECLFW(Mapper242_write)
{
ROM_BANK32((A>>3)&0xF);
switch(V&3)
{
case 0:MIRROR_SET(0);break;
case 1:MIRROR_SET(1);break;
case 2:onemir(0);break;
case 3:onemir(1);break;
}
}
void Mapper242_init(void)
{
ROM_BANK32(0);
SetWriteHandler(0x8000,0xffff,Mapper242_write);
}

View File

@ -1,38 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2003 CaH4e3
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
static DECLFW(Mapper244_write_1)
{
ROM_BANK32((A-0x8065)&0x03);
}
static DECLFW(Mapper244_write_2)
{
VROM_BANK8((A-0x80A5)&0x07);
}
void Mapper244_init(void)
{
ROM_BANK32(0);
SetWriteHandler(0x8065,0x80a4,Mapper244_write_1);
SetWriteHandler(0x80a5,0x80e4,Mapper244_write_2);
}

View File

@ -1,44 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
DECLFW(Mapper246_write)
{
switch(A&0xF007)
{
case 0x6000:ROM_BANK8(0x8000,V);break;
case 0x6001:ROM_BANK8(0xA000,V);break;
case 0x6002:ROM_BANK8(0xC000,V);break;
case 0x6003:ROM_BANK8(0xE000,V);break;
case 0x6004:VROM_BANK2(0x0000,V);break;
case 0x6005:VROM_BANK2(0x0800,V);break;
case 0x6006:VROM_BANK2(0x1000,V);break;
case 0x6007:VROM_BANK2(0x1800,V);break;
}
}
void Mapper246_init(void)
{
SetWriteHandler(0x4020,0x67ff,Mapper246_write);
SetWriteHandler(0x8000,0xffff,Mapper246_write);
}

View File

@ -1,90 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
#define cmd mapbyte1[0]
#define lpa mapbyte1[1]
#define prgl mapbyte2
static void PRGSynco(void)
{
if(lpa&0x80)
{
ROM_BANK16(0x8000,lpa&0xF);
}
else
{
ROM_BANK8(0x8000,prgl[0]&0x1F);
ROM_BANK8(0xa000,prgl[1]&0x1F);
}
}
static DECLFW(Mapper248_writelow)
{
lpa=V;
PRGSynco();
}
static DECLFW(Mapper248_write)
{
switch(A&0xF001)
{
case 0xa000:MIRROR_SET(V&1);break; // Not sure if this is right. Mirroring may be hard wired...
case 0xc000:IRQLatch=V;break;
case 0xc001:IRQCount=IRQLatch;break;
case 0xe000:IRQa=0;X6502_IRQEnd(FCEU_IQEXT);break;
case 0xe001:IRQa=1;break;
case 0x8000:cmd=V;break;
case 0x8001:switch(cmd&7)
{
case 0:VROM_BANK2(0x000,V>>1);break;
case 1:VROM_BANK2(0x800,V>>1);break;
case 2:VROM_BANK1(0x1000,V);break;
case 3:VROM_BANK1(0x1400,V);break;
case 4:VROM_BANK1(0x1800,V);break;
case 5:VROM_BANK1(0x1c00,V);break;
case 6:prgl[0]=V;PRGSynco();break;
case 7:prgl[1]=V;PRGSynco();break;
}
break;
}
}
static void Mapper248_hb(void)
{
if(IRQa)
{
IRQCount--;
if(IRQCount<0)
{
X6502_IRQBegin(FCEU_IQEXT);
IRQCount=IRQLatch;
}
}
}
void Mapper248_init(void)
{
SetWriteHandler(0x6000,0x6fff,Mapper248_writelow);
SetWriteHandler(0x8000,0xffff,Mapper248_write);
GameHBIRQHook=Mapper248_hb;
}

View File

@ -1,369 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
static void (*sfun[3])(void);
#define vrctemp mapbyte1[0]
#define VPSG2 mapbyte3
#define VPSG mapbyte2
static void DoSQV1(void);
static void DoSQV2(void);
static void DoSawV(void);
static int swaparoo;
static int acount=0;
static void FP_FASTAPASS(1) KonamiIRQHook(int a)
{
#define LCYCS 341
// #define LCYCS ((227*2)+1)
if(IRQa)
{
acount+=a*3;
if(acount>=LCYCS)
{
doagainbub:acount-=LCYCS;IRQCount++;
if(IRQCount==0x100)
{
X6502_IRQBegin(FCEU_IQEXT);
IRQCount=IRQLatch;
}
if(acount>=LCYCS) goto doagainbub;
}
}
}
static DECLFW(VRC6SW)
{
A&=0xF003;
if(A>=0x9000 && A<=0x9002)
{
VPSG[A&3]=V;
if(sfun[0]) sfun[0]();
}
else if(A>=0xa000 && A<=0xa002)
{
VPSG[4|(A&3)]=V;
if(sfun[1]) sfun[1]();
}
else if(A>=0xb000 && A<=0xb002)
{
VPSG2[A&3]=V;
if(sfun[2]) sfun[2]();
}
}
static DECLFW(Mapper24_write)
{
if(swaparoo)
A=(A&0xFFFC)|((A>>1)&1)|((A<<1)&2);
if(A>=0x9000 && A<=0xb002)
{
VRC6SW(A,V);
return;
}
A&=0xF003;
// if(A>=0xF000) printf("%d, %d, $%04x:$%02x\n",scanline,timestamp,A,V);
switch(A&0xF003)
{
case 0x8000:ROM_BANK16(0x8000,V);break;
case 0xB003:
switch(V&0xF)
{
case 0x0:MIRROR_SET2(1);break;
case 0x4:MIRROR_SET2(0);break;
case 0x8:onemir(0);break;
case 0xC:onemir(1);break;
}
break;
case 0xC000:ROM_BANK8(0xC000,V);break;
case 0xD000:VROM_BANK1(0x0000,V);break;
case 0xD001:VROM_BANK1(0x0400,V);break;
case 0xD002:VROM_BANK1(0x0800,V);break;
case 0xD003:VROM_BANK1(0x0c00,V);break;
case 0xE000:VROM_BANK1(0x1000,V);break;
case 0xE001:VROM_BANK1(0x1400,V);break;
case 0xE002:VROM_BANK1(0x1800,V);break;
case 0xE003:VROM_BANK1(0x1c00,V);break;
case 0xF000:IRQLatch=V;
//acount=0;
break;
case 0xF001:IRQa=V&2;
vrctemp=V&1;
if(V&2)
{
IRQCount=IRQLatch;
acount=0;
}
X6502_IRQEnd(FCEU_IQEXT);
break;
case 0xf002:IRQa=vrctemp;
X6502_IRQEnd(FCEU_IQEXT);break;
case 0xF003:break;
}
}
static int32 CVBC[3];
static int32 vcount[3];
static int32 dcount[2];
static INLINE void DoSQV(int x)
{
int32 V;
int32 amp=(((VPSG[x<<2]&15)<<8)*6/8)>>4;
int32 start,end;
start=CVBC[x];
end=(SOUNDTS<<16)/soundtsinc;
if(end<=start) return;
CVBC[x]=end;
if(VPSG[(x<<2)|0x2]&0x80)
{
if(VPSG[x<<2]&0x80)
{
for(V=start;V<end;V++)
Wave[V>>4]+=amp;
}
else
{
int32 thresh=(VPSG[x<<2]>>4)&7;
int32 freq=((VPSG[(x<<2)|0x1]|((VPSG[(x<<2)|0x2]&15)<<8))+1)<<17;
for(V=start;V<end;V++)
{
if(dcount[x]>thresh) /* Greater than, not >=. Important. */
Wave[V>>4]+=amp;
vcount[x]-=nesincsize;
while(vcount[x]<=0) /* Should only be <0 in a few circumstances. */
{
vcount[x]+=freq;
dcount[x]=(dcount[x]+1)&15;
}
}
}
}
}
static void DoSQV1(void)
{
DoSQV(0);
}
static void DoSQV2(void)
{
DoSQV(1);
}
static void DoSawV(void)
{
int V;
int32 start,end;
start=CVBC[2];
end=(SOUNDTS<<16)/soundtsinc;
if(end<=start) return;
CVBC[2]=end;
if(VPSG2[2]&0x80)
{
static int32 saw1phaseacc=0;
uint32 freq3;
static uint8 b3=0;
static int32 phaseacc=0;
static uint32 duff=0;
freq3=(VPSG2[1]+((VPSG2[2]&15)<<8)+1);
for(V=start;V<end;V++)
{
saw1phaseacc-=nesincsize;
if(saw1phaseacc<=0)
{
int32 t;
rea:
t=freq3;
t<<=18;
saw1phaseacc+=t;
phaseacc+=VPSG2[0]&0x3f;
b3++;
if(b3==7)
{
b3=0;
phaseacc=0;
}
if(saw1phaseacc<=0)
goto rea;
duff=(((phaseacc>>3)&0x1f)<<4)*6/8;
}
Wave[V>>4]+=duff;
}
}
}
static INLINE void DoSQVHQ(int x)
{
int32 V;
int32 amp=((VPSG[x<<2]&15)<<8)*6/8;
if(VPSG[(x<<2)|0x2]&0x80)
{
if(VPSG[x<<2]&0x80)
{
for(V=CVBC[x];V<SOUNDTS;V++)
WaveHi[V]+=amp;
}
else
{
int32 thresh=(VPSG[x<<2]>>4)&7;
for(V=CVBC[x];V<SOUNDTS;V++)
{
if(dcount[x]>thresh) /* Greater than, not >=. Important. */
WaveHi[V]+=amp;
vcount[x]--;
if(vcount[x]<=0) /* Should only be <0 in a few circumstances. */
{
vcount[x]=(VPSG[(x<<2)|0x1]|((VPSG[(x<<2)|0x2]&15)<<8))+1;
dcount[x]=(dcount[x]+1)&15;
}
}
}
}
CVBC[x]=SOUNDTS;
}
static void DoSQV1HQ(void)
{
DoSQVHQ(0);
}
static void DoSQV2HQ(void)
{
DoSQVHQ(1);
}
static void DoSawVHQ(void)
{
static uint8 b3=0;
static int32 phaseacc=0;
int32 V;
if(VPSG2[2]&0x80)
{
for(V=CVBC[2];V<SOUNDTS;V++)
{
WaveHi[V]+=(((phaseacc>>3)&0x1f)<<8)*6/8;
vcount[2]--;
if(vcount[2]<=0)
{
vcount[2]=(VPSG2[1]+((VPSG2[2]&15)<<8)+1)<<1;
phaseacc+=VPSG2[0]&0x3f;
b3++;
if(b3==7)
{
b3=0;
phaseacc=0;
}
}
}
}
CVBC[2]=SOUNDTS;
}
void VRC6Sound(int Count)
{
int x;
DoSQV1();
DoSQV2();
DoSawV();
for(x=0;x<3;x++)
CVBC[x]=Count;
}
void VRC6SoundHQ(void)
{
DoSQV1HQ();
DoSQV2HQ();
DoSawVHQ();
}
void VRC6SyncHQ(int32 ts)
{
int x;
for(x=0;x<3;x++) CVBC[x]=ts;
}
static void VRC6_ESI(void)
{
GameExpSound.RChange=VRC6_ESI;
GameExpSound.Fill=VRC6Sound;
GameExpSound.HiFill=VRC6SoundHQ;
GameExpSound.HiSync=VRC6SyncHQ;
memset(CVBC,0,sizeof(CVBC));
memset(vcount,0,sizeof(vcount));
memset(dcount,0,sizeof(dcount));
if(FSettings.SndRate)
{
if(FSettings.soundq>=1)
{
sfun[0]=DoSQV1HQ;
sfun[1]=DoSQV2HQ;
sfun[2]=DoSawVHQ;
}
else
{
sfun[0]=DoSQV1;
sfun[1]=DoSQV2;
sfun[2]=DoSawV;
}
}
else
memset(sfun,0,sizeof(sfun));
}
void Mapper24_init(void)
{
SetWriteHandler(0x8000,0xffff,Mapper24_write);
VRC6_ESI();
MapIRQHook=KonamiIRQHook;
swaparoo=0;
}
void Mapper26_init(void)
{
SetWriteHandler(0x8000,0xffff,Mapper24_write);
VRC6_ESI();
MapIRQHook=KonamiIRQHook;
swaparoo=1;
}
void NSFVRC6_Init(void)
{
VRC6_ESI();
SetWriteHandler(0x8000,0xbfff,VRC6SW);
}

View File

@ -1,100 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
#define K4buf mapbyte2
#define K4IRQ mapbyte1[1]
#define K4sel mapbyte1[0]
static int acount=0;
static DECLFW(Mapper25_write)
{
A=(A&0xF003)|((A&0xC)>>2);
if((A&0xF000)==0xA000)
ROM_BANK8(0xA000,V);
else if(A>=0xB000 && A<=0xEFFF)
{
int x=(A&1)|((A-0xB000)>>11);
K4buf[x]&=(0xF0)>>((A&2)<<1);
K4buf[x]|=(V&0xF)<<((A&2)<<1);
VROM_BANK1(x<<10,K4buf[x]);
}
else if((A&0xF000)==0x8000)
{
if(K4sel&2)
ROM_BANK8(0xC000,V);
else
ROM_BANK8(0x8000,V);
}
else switch(A)
{
case 0x9000:switch(V&0x3)
{
case 0:MIRROR_SET(0);break;
case 1:MIRROR_SET(1);break;
case 2:onemir(0);break;
case 3:onemir(1);break;
}
break;
case 0x9001:if((K4sel&2)!=(V&2))
{
uint8 swa;
swa=PRGBankList[0];
ROM_BANK8(0x8000,PRGBankList[2]);
ROM_BANK8(0xc000,swa);
}
K4sel=V;
break;
case 0xf000:IRQLatch&=0xF0;IRQLatch|=V&0xF;break;
case 0xf002:IRQLatch&=0x0F;IRQLatch|=V<<4;break;
case 0xf001:IRQCount=IRQLatch;IRQa=V&2;K4IRQ=V&1;acount=0;X6502_IRQEnd(FCEU_IQEXT);break;
case 0xf003:IRQa=K4IRQ;X6502_IRQEnd(FCEU_IQEXT);break;
}
}
static void FP_FASTAPASS(1) KonamiIRQHook(int a)
{
// #define LCYCS ((227*2))
#define LCYCS 341
if(IRQa)
{
acount+=a*3;
// acount+=a*4;
if(acount>=LCYCS)
{
doagainbub:acount-=LCYCS;IRQCount++;
if(IRQCount&0x100)
{//acount=0;
X6502_IRQBegin(FCEU_IQEXT);IRQCount=IRQLatch;
}
if(acount>=LCYCS) goto doagainbub;
}
}
}
void Mapper25_init(void)
{
SetWriteHandler(0x8000,0xffff,Mapper25_write);
MapIRQHook=KonamiIRQHook;
}

View File

@ -1,67 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
static DECLFW(Mapper255_write)
{
uint32 pbank=(A>>7)&0x1F;
uint32 cbank=A&0x3F;
uint32 rbank=(A>>14)&1;
// printf("$%04x:$%02x\n",A,V);
// printf("%2x:%2x:%2x,%2x\n",pbank,cbank,rbank,(A&0x40)>>6);
if(A&0x1000)
{
ROM_BANK16(0x8000,((pbank|(rbank<<5))<<1)|((A&0x40)>>6));
ROM_BANK16(0xc000,((pbank|(rbank<<5))<<1)|((A&0x40)>>6));
}
else
{
ROM_BANK32(pbank|(rbank<<5));
}
MIRROR_SET((A>>13)&1);
VROM_BANK8((rbank<<6)|cbank);
}
static DECLFW(Mapper255_wl)
{
// printf("Wr: $%04x:$%02x\n",A,V);
mapbyte1[A&3]=V&0xF;
}
static DECLFR(Mapper255_read)
{
//printf("Rd: $%04x\n",A);
return(mapbyte1[A&3]); //|(X.DB&0xF0));
}
void Mapper255_init(void)
{
mapbyte1[0]=mapbyte1[1]=0xF;
ROM_BANK32(0);
VROM_BANK8(0);
SetWriteHandler(0x5800,0x5FFF,Mapper255_wl);
SetWriteHandler(0x8000,0xffff,Mapper255_write);
SetReadHandler(0x5800,0x5FFF,Mapper255_read);
}

View File

@ -1,69 +0,0 @@
#include "mapinc.h"
static uint32 regchr[9];
static DECLFW(Mapper27_write)
{
A&=0xF00F;
int regnum;
if((A>=0xB000) && (A<=0xE003)) {
regnum=((((A>>12)+1)&0x03)<<1)|((A&0x02)>>1);
if(A&1)
regchr[regnum]=(regchr[regnum]&0x00F)|(V<<4);
else
regchr[regnum]=(regchr[regnum]&0x1F0)|(V&0xF);
VROM_BANK1(regnum<<10,regchr[regnum]);
}
switch(A)
{
case 0x8000: ROM_BANK8(0x8000|((regchr[8]&2)<<13),V); break;
case 0xA000: ROM_BANK8(0xa000,V); break;
case 0x9000: switch(V&3){
case 0:setmirror(MI_V);break;
case 1:setmirror(MI_H);break;
case 2:setmirror(MI_0);break;
case 3:setmirror(MI_1);break;
}
case 0x9002: regchr[8]=V; break;
case 0xF000: //X6502_IRQEnd(FCEU_IQEXT);
IRQLatch=(IRQLatch&0xF0)|(V&0x0F);
break;
case 0xF001: //X6502_IRQEnd(FCEU_IQEXT);
IRQLatch=(IRQLatch&0x0F)|((V&0xF)<<4);
break;
case 0xF003: IRQa=((IRQa&0x1)<<1)|(IRQa&0x1);
X6502_IRQEnd(FCEU_IQEXT);
break;
case 0xF002: IRQa=V&3;
if(IRQa&0x02) IRQCount=IRQLatch-1;
// X6502_IRQEnd(FCEU_IQEXT);
break;
}
// if((A&0xF000)==0xF000) FCEU_printf("$%04x:$%02x, %d\n",A,V, scanline);
}
static void Mapper27_hb(void)
{
// FCEU_printf("%02x-%d,%d,%d\n",scanline,IRQa,IRQCount,IRQLatch);
if(IRQa&0x2){
if(IRQCount==0xFF){
X6502_IRQBegin(FCEU_IQEXT);
IRQCount=IRQLatch+1;
} else {
IRQCount++;
}
}
}
void Mapper27_init(void)
{
int i;
for (i=0; i<9; i++) {
regchr[i]=0;
}
IRQa=0;
IRQCount=IRQLatch=0;
SetWriteHandler(0x8000,0xffff,Mapper27_write);
GameHBIRQHook=Mapper27_hb;
}

View File

@ -1,53 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
#define IREMCon mapbyte1[0]
static DECLFW(Mapper32_write)
{
switch(A>>12)
{
case 0x8:
mapbyte1[1]=V;
if(IREMCon) {ROM_BANK8(0xc000,V);ROM_BANK8(0x8000,~1);}
else {ROM_BANK8(0x8000,V);ROM_BANK8(0xc000,~1);}
break;
case 0x9:IREMCon=(V>>1)&1;
if(IREMCon) {ROM_BANK8(0xc000,mapbyte1[1]);ROM_BANK8(0x8000,~1);}
else {ROM_BANK8(0x8000,mapbyte1[1]); ROM_BANK8(0xc000,~1);}
MIRROR_SET(V&1);
break;
case 0xa:ROM_BANK8(0xA000,V);
break;
}
if((A&0xF000)==0xb000)
VROM_BANK1((A&0x7)<<10,V);
}
void Mapper32_init(void)
{
ROM_BANK16(0x8000,0);
ROM_BANK16(0xc000,~0);
SetWriteHandler(0x8000,0xffff,Mapper32_write);
}

View File

@ -1,79 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
static int is48;
static DECLFW(Mapper33_write)
{
A&=0xF003;
if(A>=0xA000 && A<=0xA003)
VROM_BANK1(0x1000+((A&3)<<10),V);
else switch(A)
{
case 0x8000:if(!is48) MIRROR_SET((V>>6)&1);
ROM_BANK8(0x8000,V);
break;
case 0x8001:ROM_BANK8(0xA000,V); break;
case 0x8002:VROM_BANK2(0x0000,V);break;
case 0x8003:VROM_BANK2(0x0800,V);break;
}
}
static DECLFW(Mapper48_HiWrite)
{
switch(A&0xF003)
{
case 0xc000:IRQLatch=V;break;
case 0xc001:IRQCount=IRQLatch;break;
case 0xc003:IRQa=0;X6502_IRQEnd(FCEU_IQEXT);break;
case 0xc002:IRQa=1;break;
case 0xe000:MIRROR_SET((V>>6)&1);break;
}
}
static void heho(void)
{
if(IRQa)
{
IRQCount++;
if(IRQCount==0x100)
{
X6502_IRQBegin(FCEU_IQEXT);
IRQa=0;
}
}
}
void Mapper33_init(void)
{
SetWriteHandler(0x8000,0xffff,Mapper33_write);
is48=0;
}
void Mapper48_init(void)
{
SetWriteHandler(0x8000,0xffff,Mapper33_write);
SetWriteHandler(0xc000,0xffff,Mapper48_HiWrite);
GameHBIRQHook=heho;
is48=1;
}

View File

@ -1,58 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
static DECLFW(Mapper40_write)
{
switch(A&0xe000)
{
case 0x8000:IRQa=0;IRQCount=0;X6502_IRQEnd(FCEU_IQEXT);break;
case 0xa000:IRQa=1;break;
case 0xe000:ROM_BANK8(0xc000,V&7);break;
}
}
static void FP_FASTAPASS(1) Mapper40IRQ(int a)
{
if(IRQa)
{
if(IRQCount<4096)
IRQCount+=a;
else
{
IRQa=0;
X6502_IRQBegin(FCEU_IQEXT);
}
}
}
void Mapper40_init(void)
{
ROM_BANK8(0x6000,(~0)-1);
ROM_BANK8(0x8000,(~0)-3);
ROM_BANK8(0xa000,(~0)-2);
SetWriteHandler(0x8000,0xffff,Mapper40_write);
SetReadHandler(0x6000,0x7fff,CartBR);
MapIRQHook=Mapper40IRQ;
}

View File

@ -1,57 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
#define calreg mapbyte1[0]
#define calchr mapbyte1[1]
DECLFW(Mapper41_write)
{
if(A<0x8000)
{
ROM_BANK32(A&7);
MIRROR_SET((A>>5)&1);
calreg=A;
calchr&=0x3;
calchr|=(A>>1)&0xC;
VROM_BANK8(calchr);
}
else if(calreg&0x4)
{
calchr&=0xC;
calchr|=A&3;
VROM_BANK8(calchr);
}
}
static void M41Reset(void)
{
calreg=calchr=0;
}
void Mapper41_init(void)
{
MapperReset=M41Reset;
ROM_BANK32(0);
SetWriteHandler(0x8000,0xffff,Mapper41_write);
SetWriteHandler(0x6000,0x67ff,Mapper41_write);
}

View File

@ -1,62 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
static DECLFW(Mapper42_write)
{
switch(A&0xe003)
{
case 0xe000:mapbyte1[0]=V;ROM_BANK8(0x6000,V&0xF);break;
case 0xe001:MIRROR_SET((V>>3)&1);break;
case 0xe002:IRQa=V&2;if(!IRQa) IRQCount=0;X6502_IRQEnd(FCEU_IQEXT);break;
}
}
static void FP_FASTAPASS(1) Mapper42IRQ(int a)
{
if(IRQa)
{
IRQCount+=a;
if(IRQCount>=32768) IRQCount-=32768;
if(IRQCount>=24576)
X6502_IRQBegin(FCEU_IQEXT);
else
X6502_IRQEnd(FCEU_IQEXT);
}
}
static void Mapper42_StateRestore(int version)
{
ROM_BANK8(0x6000,mapbyte1[0]&0xF);
}
void Mapper42_init(void)
{
ROM_BANK8(0x6000,0);
ROM_BANK32(~0);
SetWriteHandler(0x6000,0xffff,Mapper42_write);
SetReadHandler(0x6000,0x7fff,CartBR);
MapStateRestore=Mapper42_StateRestore;
MapIRQHook=Mapper42IRQ;
}

View File

@ -1,75 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
static DECLFW(Mapper43_write)
{
//printf("$%04x:$%02x\n",A,V);
if((A&0x8122)==0x8122)
{
X6502_IRQEnd(FCEU_IQEXT);
if(V&2) IRQa=1;
else
IRQCount=IRQa=0;
}
}
static DECLFW(M43Low)
{
int transo[8]={4,3,4,4,4,7,5,6};
A&=0xF0FF;
if(A==0x4022)
setprg8(0x6000,transo[V&7]);
//printf("$%04x:$%02x\n",A,V);
}
static void FP_FASTAPASS(1) M43Ho(int a)
{
IRQCount+=a;
if(IRQa)
if(IRQCount>=4096)
{
X6502_IRQBegin(FCEU_IQEXT);
}
}
//static DECLFR(boo)
//{
// printf("$%04x\n",A);
// return( ROM[0x2000*8 +0x1000 +(A-0x5000)]);
//}
void Mapper43_init(void)
{
setprg4(0x5000,16);
setprg8(0x6000,2);
setprg8(0x8000,1);
setprg8(0xa000,0);
setprg8(0xc000,4);
setprg8(0xe000,9);
SetWriteHandler(0x8000,0xffff,Mapper43_write);
SetWriteHandler(0x4020,0x7fff,M43Low);
//SetReadHandler(0x5000,0x5fff,boo);
SetReadHandler(0x6000,0xffff,CartBR);
MapIRQHook=M43Ho;
}

View File

@ -1,48 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
#define A64reg mapbyte1[0]
#define A64wr mapbyte1[1]
DECLFW(Mapper46_writel)
{
A64reg=V;
ROM_BANK32((A64wr&1)+((A64reg&0xF)<<1));
VROM_BANK8(((A64wr>>4)&7)+((A64reg&0xF0)>>1));
}
DECLFW(Mapper46_write)
{
A64wr=V;
ROM_BANK32((V&1)+((A64reg&0xF)<<1));
VROM_BANK8(((V>>4)&7)+((A64reg&0xF0)>>1));
}
void Mapper46_init(void)
{
MIRROR_SET(0);
ROM_BANK32(0);
SetWriteHandler(0x8000,0xffff,Mapper46_write);
SetWriteHandler(0x6000,0x7fff,Mapper46_writel);
}

View File

@ -1,75 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
static void FP_FASTAPASS(1) Mapper50IRQ(int a)
{
if(IRQa)
{
if(IRQCount<4096)
IRQCount+=a;
else
{
IRQa=0;
X6502_IRQBegin(FCEU_IQEXT);
}
}
}
static void M50Restore(int version)
{
setprg8(0xc000,mapbyte1[0]);
}
static DECLFW(M50W)
{
if((A&0xD060)==0x4020)
{
if(A&0x100)
{
IRQa=V&1;
if(!IRQa) IRQCount=0;
X6502_IRQEnd(FCEU_IQEXT);
}
else
{
V=((V&1)<<2)|((V&2)>>1)|((V&4)>>1)|(V&8);
mapbyte1[0]=V;
setprg8(0xc000,V);
}
}
}
void Mapper50_init(void)
{
SetWriteHandler(0x4020,0x5fff,M50W);
SetReadHandler(0x6000,0xffff,CartBR);
MapStateRestore=M50Restore;
MapIRQHook=Mapper50IRQ;
setprg8(0x6000,0xF);
setprg8(0x8000,0x8);
setprg8(0xa000,0x9);
setprg8(0xc000,0x0);
setprg8(0xe000,0xB);
}

View File

@ -1,66 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
#define mode mapbyte1[0]
#define page mapbyte1[1]
static uint32 Get8K(uint32 A)
{
uint32 bank;
bank=(page<<2)|((A>>13)&1);
if(A&0x4000 && !(mode&1)) bank|=0xC;
if(!(A&0x8000)) bank|=0x20;
if(mode==2) bank|=2;
else bank|=(A>>13)&2;
return(bank);
}
static void Synco(void)
{
uint32 x;
if(mapbyte1[0]<=2)
MIRROR_SET2(1);
else
MIRROR_SET2(0);
for(x=0x6000;x<0x10000;x+=8192)
ROM_BANK8(x,Get8K(x));
}
static DECLFW(Write)
{
if(A&0x8000) mapbyte1[1]=V&0xF;
else mapbyte1[0]=(mapbyte1[0]&2)|((V>>1)&1);
if(A&0x4000) mapbyte1[0]=(mapbyte1[0]&1)|((V>>3)&2);
Synco();
}
void Mapper51_init(void)
{
SetWriteHandler(0x6000,0xFFFF,Write);
SetReadHandler(0x6000,0xFFFF,CartBR);
mapbyte1[0]=1;
mapbyte1[1]=0;
Synco();
}

View File

@ -1,49 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
static DECLFW(Mapper57_write)
{
A&=0x8800;
if(A==0x8800)
{
mapbyte1[0]=V;
if(V&0x80)
ROM_BANK32(2|(V>>6));
else
{
ROM_BANK16(0x8000,(V>>5)&3);
ROM_BANK16(0xc000,(V>>5)&3);
}
MIRROR_SET((V&0x8)>>3);
}
else
mapbyte1[1]=V;
VROM_BANK8((mapbyte1[1]&3)|(mapbyte1[0]&7)|((mapbyte1[0]&0x10)>>1));
//printf("$%04x:$%02x\n",A,V);
}
void Mapper57_init(void)
{
SetWriteHandler(0x8000,0xffff,Mapper57_write);
}

View File

@ -1,43 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
static DECLFW(M58Write)
{
//printf("$%04x:$%02x\n",A,V);
if(A&0x40)
{
ROM_BANK16(0x8000,(A&0x07));
ROM_BANK16(0xc000,(A&0x07));
}
else
ROM_BANK32((A&0x06)>>1);
VROM_BANK8((A&0x38)>>3);
MIRROR_SET2((V&2)>>1);
}
void Mapper58_init(void)
{
ROM_BANK32(0);
VROM_BANK8(0);
SetWriteHandler(0x8000,0xFFFF,M58Write);
}

View File

@ -1,47 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
static int ay;
static DECLFW(Mapper59_write)
{
//printf("$%04x:$%02x\n",A,V);
setprg32(0x8000,(A&0x70)>>4);
setchr8(A&0x7);
//if(A&0x100)
// setprg32r(0x10,0x8000,0);
ay=A;
MIRROR_SET2((A&0x8)>>3);
}
static DECLFR(m59rd)
{
if(ay&0x100) return(0);
else
return(CartBR(A));
}
void Mapper59_init(void)
{
setprg32(0x8000,0);
SetReadHandler(0x8000,0xffff,m59rd);
SetWriteHandler(0x8000,0xffff,Mapper59_write);
}

View File

@ -1,76 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
#define FVRAM_BANK8(A,V) {VPage[0]=VPage[1]=VPage[2]=VPage[3]=VPage[4]=VPage[5]=VPage[6]=VPage[7]=V?&MapperExRAM[(V)<<13]-(A):&CHRRAM[(V)<<13]-(A);CHRBankList[0]=((V)<<3);CHRBankList[1]=((V)<<3)+1;CHRBankList[2]=((V)<<3)+2;CHRBankList[3]=((V)<<3)+3;CHRBankList[4]=((V)<<3)+4;CHRBankList[5]=((V)<<3)+5;CHRBankList[6]=((V)<<3)+6;CHRBankList[7]=((V)<<3)+7;PPUCHRRAM=0xFF;}
static void FP_FASTAPASS(1) FFEIRQHook(int a)
{
if(IRQa)
{
IRQCount+=a;
if(IRQCount>=0x10000)
{
X6502_IRQBegin(FCEU_IQEXT);
IRQa=0;
IRQCount=0;
}
}
}
DECLFW(Mapper6_write)
{
if(A<0x8000)
{
switch(A){
case 0x42FF:MIRROR_SET((V>>4)&1);break;
case 0x42FE:onemir((V>>3)&2);break;
case 0x4501:IRQa=0;X6502_IRQEnd(FCEU_IQEXT);break;
case 0x4502:IRQCount&=0xFF00;IRQCount|=V;break;
case 0x4503:IRQCount&=0xFF;IRQCount|=V<<8;IRQa=1;break;
}
} else {
ROM_BANK16(0x8000,V>>2);
FVRAM_BANK8(0x0000,V&3);
}
}
void Mapper6_StateRestore(int version)
{
int x;
for(x=0;x<8;x++)
if(PPUCHRRAM&(1<<x))
{
if(CHRBankList[x]>7)
VPage[x]=&MapperExRAM[(CHRBankList[x]&31)*0x400]-(x*0x400);
else VPage[x]=&CHRRAM[(CHRBankList[x]&7)*0x400]-(x*0x400);
}
}
void Mapper6_init(void)
{
MapIRQHook=FFEIRQHook;
ROM_BANK16(0xc000,7);
SetWriteHandler(0x4020,0x5fff,Mapper6_write);
SetWriteHandler(0x8000,0xffff,Mapper6_write);
MapStateRestore=Mapper6_StateRestore;
}

View File

@ -1,40 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2003 CaH4e3
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
#define mCount mapbyte1[0]
static DECLFW(Mapper60_write)
{
VROM_BANK8(mCount);
ROM_BANK16(0x8000,mCount);
ROM_BANK16(0xc000,mCount);
mCount++;
mCount&=0x03;
}
void Mapper60_init(void)
{
mCount=0;
SetWriteHandler(0x8000,0xFFFF,Mapper60_write);
}

View File

@ -1,54 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
static DECLFW(Mapper61_write)
{
// printf("$%04x:$%02x\n",A,V);
switch(A&0x30)
{
case 0x00:
case 0x30:
ROM_BANK32(A&0xF);
break;
case 0x20:
case 0x10:
ROM_BANK16(0x8000,((A&0xF)<<1)| (((A&0x20)>>4)) );
ROM_BANK16(0xC000,((A&0xF)<<1)| (((A&0x20)>>4)) );
break;
}
#ifdef moo
if(!(A&0x10))
ROM_BANK32(A&0xF);
else
{
ROM_BANK16(0x8000,((A&0xF)<<1)| (((A&0x10)>>4)^1) );
ROM_BANK16(0xC000,((A&0xF)<<1)| (((A&0x10)>>4)^1) );
}
#endif
MIRROR_SET((A&0x80)>>7);
}
void Mapper61_init(void)
{
SetWriteHandler(0x8000,0xffff,Mapper61_write);
}

View File

@ -1,41 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2003 CaH4e3
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
static DECLFW(Mapper62_write)
{
VROM_BANK8(((A&0x1F)<<2)|(V&0x03));
if ((A&0x20)>>5) {
ROM_BANK16(0x8000,(A&0x40)|((A>>8)&0x3F));
ROM_BANK16(0xc000,(A&0x40)|((A>>8)&0x3F));
}
else
ROM_BANK32(((A&0x40)|((A>>8)&0x3F))>>1);
MIRROR_SET((A&0x80)>>7);
}
void Mapper62_init(void)
{
SetWriteHandler(0x8000,0xffff, Mapper62_write);
ROM_BANK32(0);
}

View File

@ -1,74 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
void FP_FASTAPASS(1) IREMIRQHook(int a)
{
if(IRQa)
{
IRQCount-=a;
if(IRQCount<-4)
{
X6502_IRQBegin(FCEU_IQEXT);
IRQa=0;
IRQCount=0xFFFF;
}
}
}
static DECLFW(Mapper65_write)
{
//if(A>=0x9000 && A<=0x9006)
// printf("$%04x:$%02x, %d\n",A,V,scanline);
switch(A)
{
//default: printf("$%04x:$%02x\n",A,V);
// break;
case 0x8000:ROM_BANK8(0x8000,V);break;
// case 0x9000:printf("$%04x:$%02x\n",A,V);MIRROR_SET2((V>>6)&1);break;
case 0x9001:MIRROR_SET(V>>7);break;
case 0x9003:IRQa=V&0x80;X6502_IRQEnd(FCEU_IQEXT);break;
case 0x9004:IRQCount=IRQLatch;break;
case 0x9005: IRQLatch&=0x00FF;
IRQLatch|=V<<8;
break;
case 0x9006: IRQLatch&=0xFF00;IRQLatch|=V;
break;
case 0xB000:VROM_BANK1(0x0000,V);break;
case 0xB001:VROM_BANK1(0x0400,V);break;
case 0xB002:VROM_BANK1(0x0800,V);break;
case 0xB003:VROM_BANK1(0x0C00,V);break;
case 0xB004:VROM_BANK1(0x1000,V);break;
case 0xB005:VROM_BANK1(0x1400,V);break;
case 0xB006:VROM_BANK1(0x1800,V);break;
case 0xB007:VROM_BANK1(0x1C00,V);break;
case 0xa000:ROM_BANK8(0xA000,V);break;
case 0xC000:ROM_BANK8(0xC000,V);break;
}
//MIRROR_SET2(1);
}
void Mapper65_init(void)
{
MapIRQHook=IREMIRQHook;
SetWriteHandler(0x8000,0xffff,Mapper65_write);
}

View File

@ -1,78 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
#define suntoggle mapbyte1[0]
static DECLFW(Mapper67_write)
{
A&=0xF800;
if((A&0x800) && A<=0xb800)
{
VROM_BANK2((A-0x8800)>>1,V);
}
else switch(A)
{
case 0xc800:
case 0xc000:if(!suntoggle)
{
IRQCount&=0xFF;
IRQCount|=V<<8;
}
else
{
IRQCount&=0xFF00;
IRQCount|=V;
}
suntoggle^=1;
break;
case 0xd800:suntoggle=0;IRQa=V&0x10;X6502_IRQEnd(FCEU_IQEXT);break;
case 0xe800:switch(V&3)
{
case 0:MIRROR_SET2(1);break;
case 1:MIRROR_SET2(0);break;
case 2:onemir(0);break;
case 3:onemir(1);break;
}
break;
case 0xf800:ROM_BANK16(0x8000,V);break;
}
}
static void FP_FASTAPASS(1) SunIRQHook(int a)
{
if(IRQa)
{
IRQCount-=a;
if(IRQCount<=0)
{
X6502_IRQBegin(FCEU_IQEXT);
IRQa=0;
IRQCount=0xFFFF;
}
}
}
void Mapper67_init(void)
{
SetWriteHandler(0x8000,0xffff,Mapper67_write);
MapIRQHook=SunIRQHook;
}

View File

@ -1,104 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
static void Fixerit(void)
{
switch(mapbyte2[0]&3)
{
case 0:vnapage[0]=vnapage[2]=CHRptr[0]+(((mapbyte1[0]|128)&CHRmask1[0])<<10);
vnapage[1]=vnapage[3]=CHRptr[0]+(((mapbyte1[1]|128)&CHRmask1[0])<<10);
break;
case 1:vnapage[0]=vnapage[1]=CHRptr[0]+(((mapbyte1[0]|128)&CHRmask1[0])<<10);
vnapage[2]=vnapage[3]=CHRptr[0]+(((mapbyte1[1]|128)&CHRmask1[0])<<10);
break;
case 2:vnapage[0]=vnapage[1]=vnapage[2]=vnapage[3]=CHRptr[0]+(((mapbyte1[0]|128)&CHRmask1[0])<<10);
break;
case 3:vnapage[0]=vnapage[1]=vnapage[2]=vnapage[3]=CHRptr[0]+(((mapbyte1[1]|128)&CHRmask1[0])<<10);
break;
}
}
DECLFW(Mapper68_write)
{
A&=0xF000;
if(A>=0x8000 && A<=0xB000)
{
VROM_BANK2((A-0x8000)>>1,V);
}
else switch(A)
{
case 0xc000:mapbyte1[0]=V;
if(VROM_size && mapbyte2[0]&0x10)
Fixerit();
break;
case 0xd000:mapbyte1[1]=V;
if(VROM_size && mapbyte2[0]&0x10)
Fixerit();
break;
case 0xe000: mapbyte2[0]=V;
if(!(V&0x10))
{
switch(V&3)
{
case 0:MIRROR_SET2(1);break;
case 1:MIRROR_SET2(0);break;
case 2:onemir(0);break;
case 3:onemir(1);break;
}
}
else if(VROM_size)
{
Fixerit();
PPUNTARAM=0;
}
break;
case 0xf000: ROM_BANK16(0x8000,V);break;
}
}
static void Mapper68_StateRestore(int version)
{
if(!(mapbyte2[0]&0x10))
{
switch(mapbyte2[0]&3)
{
case 0:MIRROR_SET(0);break;
case 1:MIRROR_SET(1);break;
case 2:onemir(0);break;
case 3:onemir(1);break;
}
}
else if(VROM_size)
{
Fixerit();
PPUNTARAM=0;
}
}
void Mapper68_init(void)
{
SetWriteHandler(0x8000,0xffff,Mapper68_write);
MapStateRestore=Mapper68_StateRestore;
}

View File

@ -1,252 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
static void AYSound(int Count);
static void AYSoundHQ(void);
static void DoAYSQ(int x);
static void DoAYSQHQ(int x);
#define sunselect mapbyte1[0]
#define sungah mapbyte1[1]
static uint8 sunindex;
static DECLFW(SUN5BWRAM)
{
if((sungah&0xC0)==0xC0)
(WRAM-0x6000)[A]=V;
}
static DECLFR(SUN5AWRAM)
{
if((sungah&0xC0)==0x40)
return X.DB;
return CartBR(A);
}
static DECLFW(Mapper69_SWL)
{
sunindex=V%14;
}
static DECLFW(Mapper69_SWH)
{
int x;
GameExpSound.Fill=AYSound;
GameExpSound.HiFill=AYSoundHQ;
if(FSettings.SndRate);
switch(sunindex)
{
case 0:
case 1:
case 8:if(FSettings.soundq>=1) DoAYSQHQ(0); else DoAYSQ(0);break;
case 2:
case 3:
case 9:if(FSettings.soundq>=1) DoAYSQHQ(1); else DoAYSQ(1);break;
case 4:
case 5:
case 10:if(FSettings.soundq>=1) DoAYSQHQ(2); else DoAYSQ(2);break;
case 7:
for(x=0;x<2;x++)
if(FSettings.soundq>=1) DoAYSQHQ(x); else DoAYSQ(x);
break;
}
MapperExRAM[sunindex]=V;
}
static DECLFW(Mapper69_write)
{
switch(A&0xE000)
{
case 0x8000:sunselect=V;break;
case 0xa000:
sunselect&=0xF;
if(sunselect<=7)
VROM_BANK1(sunselect<<10,V);
else
switch(sunselect&0x0f)
{
case 8:
sungah=V;
if(V&0x40)
{
if(V&0x80) // Select WRAM
setprg8r(0x10,0x6000,0);
}
else
setprg8(0x6000,V);
break;
case 9:ROM_BANK8(0x8000,V);break;
case 0xa:ROM_BANK8(0xa000,V);break;
case 0xb:ROM_BANK8(0xc000,V);break;
case 0xc:
switch(V&3)
{
case 0:MIRROR_SET2(1);break;
case 1:MIRROR_SET2(0);break;
case 2:onemir(0);break;
case 3:onemir(1);break;
}
break;
case 0xd:IRQa=V;X6502_IRQEnd(FCEU_IQEXT);break;
case 0xe:IRQCount&=0xFF00;IRQCount|=V;X6502_IRQEnd(FCEU_IQEXT);break;
case 0xf:IRQCount&=0x00FF;IRQCount|=V<<8;X6502_IRQEnd(FCEU_IQEXT);break;
}
break;
}
}
static int32 vcount[3];
static int32 dcount[3];
static int CAYBC[3];
static void DoAYSQ(int x)
{
int32 freq=((MapperExRAM[x<<1]|((MapperExRAM[(x<<1)+1]&15)<<8))+1)<<(4+17);
int32 amp=(MapperExRAM[0x8+x]&15)<<2;
int32 start,end;
int V;
amp+=amp>>1;
start=CAYBC[x];
end=(SOUNDTS<<16)/soundtsinc;
if(end<=start) return;
CAYBC[x]=end;
if(amp)
for(V=start;V<end;V++)
{
if(dcount[x])
Wave[V>>4]+=amp;
vcount[x]-=nesincsize;
while(vcount[x]<=0)
{
dcount[x]^=1;
vcount[x]+=freq;
}
}
}
static void DoAYSQHQ(int x)
{
int32 V;
int32 freq=((MapperExRAM[x<<1]|((MapperExRAM[(x<<1)+1]&15)<<8))+1)<<4;
int32 amp=(MapperExRAM[0x8+x]&15)<<6;
amp+=amp>>1;
if(!(MapperExRAM[0x7]&(1<<x)))
{
for(V=CAYBC[x];V<SOUNDTS;V++)
{
if(dcount[x])
WaveHi[V]+=amp;
vcount[x]--;
if(vcount[x]<=0)
{
dcount[x]^=1;
vcount[x]=freq;
}
}
}
CAYBC[x]=SOUNDTS;
}
static void AYSound(int Count)
{
int x;
DoAYSQ(0);
DoAYSQ(1);
DoAYSQ(2);
for(x=0;x<3;x++)
CAYBC[x]=Count;
}
static void AYSoundHQ(void)
{
DoAYSQHQ(0);
DoAYSQHQ(1);
DoAYSQHQ(2);
}
static void AYHiSync(int32 ts)
{
int x;
for(x=0;x<3;x++)
CAYBC[x]=ts;
}
static void FP_FASTAPASS(1) SunIRQHook(int a)
{
if(IRQa)
{
IRQCount-=a;
if(IRQCount<=0)
{X6502_IRQBegin(FCEU_IQEXT);IRQa=0;IRQCount=0xFFFF;}
}
}
void Mapper69_StateRestore(int version)
{
if(mapbyte1[1]&0x40)
{
if(mapbyte1[1]&0x80) // Select WRAM
setprg8r(0x10,0x6000,0);
}
else
setprg8(0x6000,mapbyte1[1]);
}
void Mapper69_ESI(void)
{
GameExpSound.RChange=Mapper69_ESI;
GameExpSound.HiSync=AYHiSync;
memset(dcount,0,sizeof(dcount));
memset(vcount,0,sizeof(vcount));
memset(CAYBC,0,sizeof(CAYBC));
}
void NSFAY_Init(void)
{
sunindex=0;
SetWriteHandler(0xc000,0xdfff,Mapper69_SWL);
SetWriteHandler(0xe000,0xffff,Mapper69_SWH);
Mapper69_ESI();
}
void Mapper69_init(void)
{
sunindex=0;
SetupCartPRGMapping(0x10,WRAM,8192,1);
SetWriteHandler(0x8000,0xbfff,Mapper69_write);
SetWriteHandler(0xc000,0xdfff,Mapper69_SWL);
SetWriteHandler(0xe000,0xffff,Mapper69_SWH);
SetWriteHandler(0x6000,0x7fff,SUN5BWRAM);
SetReadHandler(0x6000,0x7fff,SUN5AWRAM);
Mapper69_ESI();
MapIRQHook=SunIRQHook;
MapStateRestore=Mapper69_StateRestore;
}

View File

@ -1,41 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
DECLFW(Mapper71_write)
{
switch(A&0xF000)
{
case 0xF000:
case 0xE000:
case 0xD000:
case 0xC000:ROM_BANK16(0x8000,V);break;
case 0x9000:onemir((V>>3)&2);break;
}
}
void Mapper71_init(void)
{
SetWriteHandler(0x4020,0xffff,Mapper71_write);
}

View File

@ -1,37 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
DECLFW(Mapper72_write)
{
mapbyte1[0]=V;
if(V&0x80)
ROM_BANK16(0x8000,V&0xF);
if(V&0x40)
VROM_BANK8(V&0xF);
}
void Mapper72_init(void)
{
SetWriteHandler(0x6000,0xffff,Mapper72_write);
}

View File

@ -1,60 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
static DECLFW(Mapper73_write)
{
//if(A>=0xd000 && A<=0xdfff)
X6502_IRQEnd(FCEU_IQEXT); /* How are IRQs acknowledged on this chip? */
switch(A&0xF000)
{
//default: printf("$%04x:$%02x\n",A,V);break;
case 0x8000:IRQCount&=0xFFF0;IRQCount|=(V&0xF);break;
case 0x9000:IRQCount&=0xFF0F;IRQCount|=(V&0xF)<<4;break;
case 0xa000:IRQCount&=0xF0FF;IRQCount|=(V&0xF)<<8;break;
case 0xb000:IRQCount&=0x0FFF;IRQCount|=(V&0xF)<<12;break;
case 0xc000:IRQa=V&2;break;
case 0xf000:ROM_BANK16(0x8000,V);break;
}
}
static void FP_FASTAPASS(1) Mapper73IRQHook(int a)
{
if(IRQa)
{
IRQCount+=a;
if(IRQCount>=0xFFFF)
{
IRQCount&=0xFFFF;
IRQa=0;
X6502_IRQBegin(FCEU_IQEXT);
}
}
}
void Mapper73_init(void)
{
SetWriteHandler(0x8000,0xffff,Mapper73_write);
MapIRQHook=Mapper73IRQHook;
}

View File

@ -1,47 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
#define map75sel mapbyte1[0]
#define map75ar mapbyte2
DECLFW(Mapper75_write)
{
switch(A&0xF000)
{
case 0x8000:ROM_BANK8(0x8000,V);break;
case 0x9000:
VROM_BANK4(0x0000,map75ar[0]|((V&2)<<3));
VROM_BANK4(0x1000,map75ar[1]|((V&4)<<2));
map75sel=V;MIRROR_SET(V&1);break;
case 0xa000:ROM_BANK8(0xa000,V);break;
case 0xc000:ROM_BANK8(0xc000,V);break;
case 0xe000:V&=0xF;map75ar[0]=V;V|=(map75sel&2)<<3;VROM_BANK4(0x0000,V);break;
case 0xf000:V&=0xF;map75ar[1]=V;V|=(map75sel&4)<<2;VROM_BANK4(0x1000,V);break;
}
}
void Mapper75_init(void)
{
SetWriteHandler(0x8000,0xffff,Mapper75_write);
}

View File

@ -1,55 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
static DECLFW(Mapper76_write)
{
switch(A&0xE001){
case 0x8000:
MMC3_cmd = V;
break;
case 0x8001:
switch(MMC3_cmd&0x07){
case 2: VROM_BANK2(0x000,V);break;
case 3: VROM_BANK2(0x800,V);break;
case 4: VROM_BANK2(0x1000,V);break;
case 5: VROM_BANK2(0x1800,V);break;
case 6:
if (MMC3_cmd&0x40) ROM_BANK8(0xC000,V);
else ROM_BANK8(0x8000,V);
break;
case 7: ROM_BANK8(0xA000,V);
break;
}
break;
case 0xA000:
MIRROR_SET(V&1);
break;
}
}
void Mapper76_init(void)
{
SetWriteHandler(0x8000,0xffff,Mapper76_write);
}

View File

@ -1,54 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
/* Original code provided by LULU */
static DECLFW(Mapper77_write)
{
mapbyte1[0]=V;
ROM_BANK32(V&0x7);
VROM_BANK2(0x0000, (V&0xf0)>>4);
}
static void Mapper77_StateRestore(int version)
{
int x;
if(version>=7200)
{
ROM_BANK32(mapbyte1[0]&0x7);
VROM_BANK2(0x0000, (mapbyte1[0]&0xf0)>>4);
}
for(x=2;x<8;x++)
VRAM_BANK1(x*0x400,x);
}
void Mapper77_init(void)
{
int x;
ROM_BANK32(0);
for(x=2;x<8;x++)
VRAM_BANK1(x*0x400,x);
SetWriteHandler(0x6000,0xffff,Mapper77_write);
MapStateRestore=Mapper77_StateRestore;
}

View File

@ -1,40 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
DECLFW(Mapper79_write)
{
if(A<0x8000 && ((A^0x4100)==0))
{
ROM_BANK32((V>>3)&1);
}
VROM_BANK8(V);
}
void Mapper79_init(void)
{
ROM_BANK32(~0);
SetWriteHandler(0x8000,0xffff,Mapper79_write);
SetWriteHandler(0x4020,0x5fff,Mapper79_write);
}

View File

@ -1,34 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
static DECLFW(Mapper8_write)
{
ROM_BANK16(0x8000,V>>3);
VROM_BANK8(V&7);
}
void Mapper8_init(void)
{
ROM_BANK32(0);
SetWriteHandler(0x8000,0xFFFF,Mapper8_write);
}

View File

@ -1,100 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
static uint32 lastA;
static int isfu;
static uint8 CCache[8];
static void FP_FASTAPASS(1) Fudou_PPU(uint32 A)
{
static int last=-1;
static uint8 z;
if(A>=0x2000) return;
A>>=10;
lastA=A;
z=CCache[A];
if(z!=last)
{
onemir(z);
last=z;
}
}
static void mira()
{
if(isfu)
{
int x;
CCache[0]=CCache[1]=mapbyte2[0]>>7;
CCache[2]=CCache[3]=mapbyte2[1]>>7;
for(x=0;x<4;x++)
CCache[4+x]=mapbyte2[2+x]>>7;
onemir(CCache[lastA]);
}
else
MIRROR_SET2(mapbyte1[0]&1);
}
static DECLFW(Mapper80_write)
{
switch(A)
{
case 0x7ef0: mapbyte2[0]=V;VROM_BANK2(0x0000,(V>>1)&0x3F);mira();break;
case 0x7ef1: mapbyte2[1]=V;VROM_BANK2(0x0800,(V>>1)&0x3f);mira();break;
case 0x7ef2: mapbyte2[2]=V;VROM_BANK1(0x1000,V);mira();break;
case 0x7ef3: mapbyte2[3]=V;VROM_BANK1(0x1400,V);mira();break;
case 0x7ef4: mapbyte2[4]=V;VROM_BANK1(0x1800,V);mira();break;
case 0x7ef5: mapbyte2[5]=V;VROM_BANK1(0x1c00,V);mira();break;
case 0x7ef6: mapbyte1[0]=V;mira();break;
case 0x7efa:
case 0x7efb: ROM_BANK8(0x8000,V);break;
case 0x7efd:
case 0x7efc: ROM_BANK8(0xA000,V);break;
case 0x7efe:
case 0x7eff: ROM_BANK8(0xC000,V);break;
}
}
static void booga(int version)
{
mira();
}
void Mapper80_init(void)
{
SetWriteHandler(0x4020,0x7fff,Mapper80_write);
MapStateRestore=booga;
isfu=0;
}
void Mapper207_init(void)
{
Mapper80_init();
isfu=1;
PPU_hook=Fudou_PPU;
}

View File

@ -1,62 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
#define ctrl mapbyte1[6]
static void DoCHR(void)
{
int x;
for(x=0;x<2;x++)
VROM_BANK2((x<<11)|((ctrl&2)<<11),mapbyte1[x]>>1);
for(x=0;x<4;x++)
VROM_BANK1((x<<10) | (((ctrl&2)^2)<<11),mapbyte1[2+x]);
}
static DECLFW(Mapper82_write)
{
if(A<=0x7EF5)
{
mapbyte1[A&7]=V;
DoCHR();
}
else
switch(A)
{
case 0x7ef6:ctrl=V&3;
MIRROR_SET2(V&1);
DoCHR();
break;
case 0x7efa:V>>=2;mapbyte2[0]=V;ROM_BANK8(0x8000,V);break;
case 0x7efb:V>>=2;mapbyte2[1]=V;ROM_BANK8(0xa000,V);break;
case 0x7efc:V>>=2;mapbyte2[2]=V;ROM_BANK8(0xc000,V);break;
}
}
void Mapper82_init(void)
{
ROM_BANK8(0xE000,~0);
/* external WRAM might end at $73FF */
SetWriteHandler(0x7ef0,0x7efc,Mapper82_write);
}

View File

@ -1,121 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
void Mapper83_init(void)
{
}
#ifdef MOOCOW
static void FP_FASTAPASS(1) m83IRQHook(int a)
{
if(IRQa)
{
IRQCount-=a;
if(IRQCount<0)
{
X6502_IRQBegin(FCEU_IQEXT);
IRQa=0;
IRQCount=0xFFFF;
}
}
}
static DECLFW(wrlow)
{
mapbyte4[A&3]=V;
}
static DECLFR(rdlow)
{
return mapbyte4[A&3];
}
static void m83prg(void)
{
ROM_BANK16(0x8000,(mapbyte1[0]&0x3F));
ROM_BANK16(0xC000,(mapbyte1[0]&0x30)|0xF);
}
static void m83chr(void)
{
int x;
for(x=0;x<8;x++)
VROM_BANK1(x*0x400,mapbyte2[x]|((mapbyte1[0]&0x30)<<4));
}
static DECLFW(Mapper83_write)
{
//printf("$%04x:$%02x\n",A,V);
switch(A)
{
case 0x8000:
case 0xB000:
case 0xB0FF:
case 0xB1FF:
{
mapbyte1[0]=V;
m83prg();
m83chr();
}
break;
case 0x8100:
switch(V&0x3)
{
case 0x00:MIRROR_SET2(1);break;
case 0x01:MIRROR_SET2(0);break;
case 0x02:onemir(0);break;
case 0x03:onemir(1);break;
}
break;
case 0x8200:IRQCount&=0xFF00;IRQCount|=V;X6502_IRQEnd(FCEU_IQEXT);break;
case 0x8201:IRQa=1;IRQCount&=0xFF;IRQCount|=V<<8;break;
case 0x8300:ROM_BANK8(0x8000,V);break;
case 0x8301:ROM_BANK8(0xA000,V);break;
case 0x8302:ROM_BANK8(0xC000,V);break;
case 0x8310:mapbyte2[0]=V;m83chr();break;
case 0x8311:mapbyte2[1]=V;m83chr();break;
case 0x8312:mapbyte2[2]=V;m83chr();break;
case 0x8313:mapbyte2[3]=V;m83chr();break;
case 0x8314:mapbyte2[4]=V;m83chr();break;
case 0x8315:mapbyte2[5]=V;m83chr();break;
case 0x8316:mapbyte2[6]=V;m83chr();break;
case 0x8317:mapbyte2[7]=V;m83chr();break;
case 0x8318:mapbyte1[1]=V;m83prg();break;
}
// printf("$%04x:$%02x, $%04x\n",A,V,X.PC.W);
}
void Mapper83_init(void)
{
ROM_BANK8(0xc000,0x1e);
ROM_BANK8(0xe000,0x1f);
// MapIRQHook=m83IRQHook;
// SetReadHandler(0x5100,0x5103,rdlow);
// SetWriteHandler(0x5100,0x5103,wrlow);
SetWriteHandler(0x8000,0xffff,Mapper83_write);
mapbyte1[1]=0xF;
}
#endif

View File

@ -1,195 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
#define vrctemp mapbyte1[0]
static uint8 indox;
#include "emu2413.h"
static int acount=0;
static OPLL *VRC7Sound=NULL;
static int dwave=0;
void DoVRC7Sound(void)
{
int32 z,a;
if(FSettings.soundq>=1) return;
z=((SOUNDTS<<16)/soundtsinc)>>4;
a=z-dwave;
moocow(VRC7Sound, &Wave[dwave], a, 1);
dwave+=a;
}
void UpdateOPLNEO(int32 *Wave, int Count)
{
moocow(VRC7Sound, Wave, Count, 4);
}
void UpdateOPL(int Count)
{
int32 z,a;
z=((SOUNDTS<<16)/soundtsinc)>>4;
a=z-dwave;
if(VRC7Sound && a)
moocow(VRC7Sound, &Wave[dwave], a, 1);
dwave=0;
}
static INLINE void DaMirror(int V)
{
int salpo[4]={MI_V,MI_H,MI_0,MI_1};
setmirror(salpo[V&3]);
}
DECLFW(Mapper85_write)
{
A|=(A&8)<<1;
if(A>=0xa000 && A<=0xDFFF)
{
// printf("$%04x, $%04x\n",X.PC,A);
A&=0xF010;
{
int x=((A>>4)&1)|((A-0xA000)>>11);
mapbyte3[x]=V;
setchr1(x<<10,V);
}
}
else if(A==0x9030)
{
if(FSettings.SndRate)
{
OPLL_writeReg(VRC7Sound, indox, V);
GameExpSound.Fill=UpdateOPL;
GameExpSound.NeoFill=UpdateOPLNEO;
}
}
else switch(A&0xF010)
{
case 0x8000:mapbyte2[0]=V;setprg8(0x8000,V);break;
case 0x8010:mapbyte2[1]=V;setprg8(0xa000,V);break;
case 0x9000:mapbyte2[2]=V;setprg8(0xc000,V);break;
case 0x9010:indox=V;break;
case 0xe000:mapbyte2[3]=V;DaMirror(V);break;
case 0xE010:IRQLatch=V;
X6502_IRQEnd(FCEU_IQEXT);
break;
case 0xF000:IRQa=V&2;
vrctemp=V&1;
if(V&2) {IRQCount=IRQLatch;}
acount=0;
X6502_IRQEnd(FCEU_IQEXT);
break;
case 0xf010:if(vrctemp) IRQa=1;
else IRQa=0;
X6502_IRQEnd(FCEU_IQEXT);
break;
}
}
static void FP_FASTAPASS(1) KonamiIRQHook(int a)
{
#define ACBOO 341
// #define ACBOO ((227*2)+1)
if(IRQa)
{
acount+=a*3;
if(acount>=ACBOO)
{
doagainbub:acount-=ACBOO;
IRQCount++;
if(IRQCount&0x100) {X6502_IRQBegin(FCEU_IQEXT);IRQCount=IRQLatch;}
if(acount>=ACBOO) goto doagainbub;
}
}
}
void Mapper85_StateRestore(int version)
{
int x;
if(version<7200)
{
for(x=0;x<8;x++)
mapbyte3[x]=CHRBankList[x];
for(x=0;x<3;x++)
mapbyte2[x]=PRGBankList[x];
mapbyte2[3]=(Mirroring<0x10)?Mirroring:Mirroring-0xE;
}
for(x=0;x<8;x++)
setchr1(x*0x400,mapbyte3[x]);
for(x=0;x<3;x++)
setprg8(0x8000+x*8192,mapbyte2[x]);
DaMirror(mapbyte2[3]);
//LoadOPL();
}
static void M85SC(void)
{
if(VRC7Sound)
OPLL_set_rate(VRC7Sound, FSettings.SndRate);
}
static void M85SKill(void)
{
if(VRC7Sound)
OPLL_delete(VRC7Sound);
VRC7Sound=NULL;
}
static void VRC7SI(void)
{
GameExpSound.RChange=M85SC;
GameExpSound.Kill=M85SKill;
VRC7Sound=OPLL_new(3579545, FSettings.SndRate?FSettings.SndRate:44100);
OPLL_reset(VRC7Sound);
OPLL_reset(VRC7Sound);
}
void NSFVRC7_Init(void)
{
SetWriteHandler(0x9010,0x901F,Mapper85_write);
SetWriteHandler(0x9030,0x903F,Mapper85_write);
VRC7SI();
}
void Mapper85_init(void)
{
MapIRQHook=KonamiIRQHook;
SetWriteHandler(0x8000,0xffff,Mapper85_write);
GameStateRestore=Mapper85_StateRestore;
if(!VROM_size)
SetupCartCHRMapping(0, CHRRAM, 8192, 1);
//AddExState(VRC7Instrument, 16, 0, "VC7I");
//AddExState(VRC7Chan, sizeof(VRC7Chan), 0, "V7CH");
VRC7SI();
}

View File

@ -1,38 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
DECLFW(Mapper86_write)
{
if(A>=0x6000 && A<=0x6fFF)
{
VROM_BANK8((V&3)|((V>>4)&4));
ROM_BANK32((V>>4)&3);
}
else
//if(A!=0x6000)
printf("$%04x:$%02x\n",A,V);
}
void Mapper86_init(void)
{
SetWriteHandler(0x6000,0x6fff,Mapper86_write);
SetWriteHandler(0x4020,0xffff,Mapper86_write);
}

View File

@ -1,62 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
static int mn;
static DECLFW(Mapper88_write)
{
//if(A>=0x8002 || A<0x8000)
//if(A==0xc000)
// printf("$%04x:$%02x\n",A,V);
switch(A&0x8001) //&0xc001)
{
case 0x8000:mapbyte1[0]=V;
if(mn)
onemir((V>>6)&1);
break;
case 0x8001:
switch(mapbyte1[0]&7)
{
case 0:VROM_BANK2(0,V>>1);break;
case 1:VROM_BANK2(0x800,V>>1);break;
case 2:VROM_BANK1(0x1000,V|0x40);break;
case 3:VROM_BANK1(0x1400,V|0x40);break;
case 4:VROM_BANK1(0x1800,V|0x40);break;
case 5:VROM_BANK1(0x1c00,V|0x40);break;
case 6:ROM_BANK8(0x8000,V);break;
case 7:ROM_BANK8(0xA000,V);break;
}
break;
}
}
void Mapper88_init(void)
{
mn=0;
SetWriteHandler(0x8000,0xffff,Mapper88_write);
}
void Mapper154_init(void)
{
mn=1;
SetWriteHandler(0x8000,0xffff,Mapper88_write);
}

View File

@ -1,34 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
DECLFW(Mapper89_write)
{
VROM_BANK8((V&7)|((V>>4)&8));
ROM_BANK16(0x8000,(V>>4)&7);
onemir((V>>3)&1);
}
void Mapper89_init(void)
{
Mirroring=0;
SetWriteHandler(0x8000,0xffff,Mapper89_write);
}

View File

@ -1,59 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
static DECLFW(Mapper91_write)
{
//if(A>=0x7001)
//printf("$%04x:$%02x, %d\n",A,V,scanline);
A&=0xF007;
if(A>=0x6000 && A<=0x6003) VROM_BANK2((A&3)*2048,V);
else switch(A&0xF003)
{
case 0x7000:
case 0x7001:ROM_BANK8(0x8000+(A&1)*8192,V);break;
case 0x7002:IRQa=IRQCount=0;X6502_IRQEnd(FCEU_IQEXT);break;
case 0x7003:IRQa=1;X6502_IRQEnd(FCEU_IQEXT);break;
// default: printf("Iyee: $%04x:$%02x\n",A,V);break;
}
//if(A>=0x7000)
// printf("$%04x:$%02x, %d\n",A,V,scanline);
}
static void Mapper91_hb(void)
{
if(IRQCount<8 && IRQa)
{
IRQCount++;
if(IRQCount>=8)
{
X6502_IRQBegin(FCEU_IQEXT);
}
}
}
void Mapper91_init(void)
{
SetWriteHandler(0x4020,0xFFFF,Mapper91_write);
GameHBIRQHook=Mapper91_hb;
}

View File

@ -1,45 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
/* Original code provided by LULU */
static DECLFW(Mapper92_write)
{
uint8 reg=(A&0xF0)>>4;
uint8 bank=A&0xF;
if(A>=0x9000)
{
if(reg==0xD) ROM_BANK16(0xc000,bank);
else if(reg==0xE) VROM_BANK8(bank);
}
else
{
if(reg==0xB) ROM_BANK16(0xc000,bank);
else if(reg==0x7) VROM_BANK8(bank);
}
}
void Mapper92_init(void)
{
SetWriteHandler(0x8000,0xFFFF,Mapper92_write);
}

View File

@ -1,136 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
static uint8 lastA;
static uint8 DRegs[8];
static uint8 cmd;
static uint8 MirCache[8];
static SFORMAT DB_StateRegs[]={
{DRegs, 8, "DREG"},
{&cmd, 1, "CMD"},
{&lastA, 1, "LAST"},
{0}
};
static void FP_FASTAPASS(1) dragonbust_ppu(uint32 A)
{
static int last=-1;
static uint8 z;
if(A>=0x2000) return;
A>>=10;
lastA=A;
z=MirCache[A];
if(z!=last)
{
onemir(z);
last=z;
}
}
static void toot(void)
{
int x;
MirCache[0]=MirCache[1]=(DRegs[0]>>4)&1;
MirCache[2]=MirCache[3]=(DRegs[1]>>4)&1;
for(x=0;x<4;x++)
MirCache[4+x]=(DRegs[2+x]>>5)&1;
onemir(MirCache[lastA]);
}
static DECLFW(Mapper95_write)
{
switch(A&0xF001)
{
case 0x8000:
cmd = V;
break;
case 0x8001:
switch(cmd&0x07)
{
case 0: DRegs[0]=(V&0x3F)>>1;toot();V>>=1;setchr2(0x0000,V&0x1F);break;
case 1: DRegs[1]=(V&0x3F)>>1;toot();V>>=1;setchr2(0x0800,V&0x1F);break;
case 2: DRegs[2]=V&0x3F;toot();setchr1(0x1000,V&0x1F); break;
case 3: DRegs[3]=V&0x3F;toot();setchr1(0x1400,V&0x1F); break;
case 4: DRegs[4]=V&0x3F;toot();setchr1(0x1800,V&0x1F); break;
case 5: DRegs[5]=V&0x3F;toot();setchr1(0x1C00,V&0x1F); break;
case 6: DRegs[6]=V&0x3F;
setprg8(0x8000,V);
break;
case 7: DRegs[7]=V&0x3F;
setprg8(0xA000,V);
break;
}
break;
}
}
static void DBSync()
{
int x;
setchr2(0x0000,DRegs[0]);
setchr2(0x0800,DRegs[1]);
for(x=0;x<4;x++)
setchr1(0x1000+x*0x400,DRegs[2+x]);
setprg8(0x8000,DRegs[6]);
setprg8(0xa000,DRegs[7]);
toot();
}
static void DBPower(void)
{
memset(DRegs,0x3F,8);
DRegs[0]=DRegs[1]=0x1F;
DBSync();
setprg8(0xc000,0x3E);
setprg8(0xe000,0x3F);
SetReadHandler(0x8000,0xffff,CartBR);
SetWriteHandler(0x8000,0xffff,Mapper95_write);
}
static void StateRestore(int version)
{
DBSync();
}
void Mapper95_Init(CartInfo *info)
{
info->Power=DBPower;
AddExState(DB_StateRegs, ~0, 0, 0);
PPU_hook=dragonbust_ppu;
GameStateRestore=StateRestore;
}

View File

@ -1,42 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
DECLFW(Mapper97_write)
{
ROM_BANK16(0xC000,V&15);
switch(V>>6)
{
case 0:break;
case 1:MIRROR_SET2(0);break;
case 2:MIRROR_SET2(1);break;
case 3:break;
}
}
void Mapper97_init(void)
{
ROM_BANK16(0x8000,~0);
SetWriteHandler(0x8000,0xffff,Mapper97_write);
}

View File

@ -1,37 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
static writefunc oldmorko;
static DECLFW(morko)
{
VROM_BANK8((V>>2)&1);
oldmorko(A,V);
setprg8(0x8000,V&0x4); /* Special for VS Gumshoe */
}
void Mapper99_init(void)
{
ROM_BANK32(0);
oldmorko=GetWriteHandler(0x4016);
SetWriteHandler(0x4016,0x4016,morko);
}

File diff suppressed because it is too large Load Diff

View File

@ -1,134 +0,0 @@
#ifndef _EMU2413_H_
#define _EMU2413_H_
#include "emutypes.h"
#ifdef EMU2413_DLL_EXPORTS
#define EMU2413_API __declspec(dllexport)
#elif defined(EMU2413_DLL_IMPORTS)
#define EMU2413_API __declspec(dllimport)
#else
#define EMU2413_API
#endif
#ifdef __cplusplus
extern "C" {
#endif
#define PI 3.14159265358979323846
enum {OPLL_VRC7_TONE=0} ;
/* voice data */
typedef struct {
e_uint32 TL,FB,EG,ML,AR,DR,SL,RR,KR,KL,AM,PM,WF ;
} OPLL_PATCH ;
/* slot */
typedef struct {
OPLL_PATCH patch;
e_int32 type ; /* 0 : modulator 1 : carrier */
/* OUTPUT */
e_int32 feedback ;
e_int32 output[2] ; /* Output value of slot */
/* for Phase Generator (PG) */
e_uint16 *sintbl ; /* Wavetable */
e_uint32 phase ; /* Phase */
e_uint32 dphase ; /* Phase increment amount */
e_uint32 pgout ; /* output */
/* for Envelope Generator (EG) */
e_int32 fnum ; /* F-Number */
e_int32 block ; /* Block */
e_int32 volume ; /* Current volume */
e_int32 sustine ; /* Sustine 1 = ON, 0 = OFF */
e_uint32 tll ; /* Total Level + Key scale level*/
e_uint32 rks ; /* Key scale offset (Rks) */
e_int32 eg_mode ; /* Current state */
e_uint32 eg_phase ; /* Phase */
e_uint32 eg_dphase ; /* Phase increment amount */
e_uint32 egout ; /* output */
} OPLL_SLOT ;
/* Mask */
#define OPLL_MASK_CH(x) (1<<(x))
/* opll */
typedef struct {
e_uint32 adr ;
e_int32 out ;
#ifndef EMU2413_COMPACTION
e_uint32 realstep ;
e_uint32 oplltime ;
e_uint32 opllstep ;
e_int32 prev, next ;
#endif
/* Register */
e_uint8 LowFreq[6];
e_uint8 HiFreq[6];
e_uint8 InstVol[6];
e_uint8 CustInst[8];
e_int32 slot_on_flag[6 * 2] ;
/* Pitch Modulator */
e_uint32 pm_phase ;
e_int32 lfo_pm ;
/* Amp Modulator */
e_int32 am_phase ;
e_int32 lfo_am ;
e_uint32 quality;
/* Channel Data */
e_int32 patch_number[6];
e_int32 key_status[6] ;
/* Slot */
OPLL_SLOT slot[6 * 2] ;
e_uint32 mask ;
} OPLL ;
/* Create Object */
EMU2413_API OPLL *OPLL_new(e_uint32 clk, e_uint32 rate) ;
EMU2413_API void OPLL_delete(OPLL *) ;
/* Setup */
EMU2413_API void OPLL_reset(OPLL *) ;
EMU2413_API void OPLL_set_rate(OPLL *opll, e_uint32 r) ;
EMU2413_API void OPLL_set_quality(OPLL *opll, e_uint32 q) ;
/* Port/Register access */
EMU2413_API void OPLL_writeIO(OPLL *, e_uint32 reg, e_uint32 val) ;
EMU2413_API void OPLL_writeReg(OPLL *, e_uint32 reg, e_uint32 val) ;
/* Synthsize */
EMU2413_API e_int16 OPLL_calc(OPLL *) ;
/* Misc */
EMU2413_API void OPLL_forceRefresh(OPLL *) ;
/* Channel Mask */
EMU2413_API e_uint32 OPLL_setMask(OPLL *, e_uint32 mask) ;
EMU2413_API e_uint32 OPLL_toggleMask(OPLL *, e_uint32 mask) ;
void moocow(OPLL* opll, e_int32 *buf, e_int32 len, int shift);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,44 +0,0 @@
#ifndef _EMUTYPES_H_
#define _EMUTYPES_H_
#ifndef INLINE
#if defined(_MSC_VER)
#define INLINE __forceinline
#elif defined(__GNUC__)
#define INLINE __inline__
#elif defined(_MWERKS_)
#define INLINE inline
#else
#define INLINE
#endif
#endif
#if defined(EMU_DLL_IMPORTS)
#define EMU2149_DLL_IMPORTS
#define EMU2212_DLL_IMPORTS
#define EMU2413_DLL_IMPORTS
#define EMU8950_DLL_IMPORTS
#define EMU76489_DLL_IMPORTS
#endif
#ifdef __cplusplus
extern "C" {
#endif
typedef unsigned int e_uint;
typedef signed int e_int;
typedef unsigned char e_uint8 ;
typedef signed char e_int8 ;
typedef unsigned short e_uint16 ;
typedef signed short e_int16 ;
typedef unsigned int e_uint32 ;
typedef signed int e_int32 ;
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,12 +0,0 @@
#include "../types.h"
#include "../x6502.h"
#include "../fceu.h"
#include "../ppu.h"
#define INESPRIV
#include "../cart.h"
#include "../ines.h"
#include "../memory.h"
#include "../sound.h"
#include "../state.h"
#include "mapshare.h"
#include <string.h>

View File

@ -1,5 +0,0 @@
void MMC3_hb(void);
#define resetmode mapbyte1[0]
#define MMC3_cmd mapbyte1[1]

View File

@ -1,121 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
#define MMC4reg mapbyte1
#define latcha1 mapbyte2[0]
#define latcha2 mapbyte2[1]
static void FP_FASTAPASS(1) latchcheck(uint32 VAddr)
{
uint8 l,h;
h=VAddr>>8;
if(h>=0x20 || ((h&0xF)!=0xF))
return;
l=VAddr&0xF0;
if(h<0x10)
{
if(l==0xD0)
{
VROM_BANK4(0x0000,MMC4reg[0]);
latcha1=0xFD;
}
else if(l==0xE0)
{
VROM_BANK4(0x0000,MMC4reg[1]);
latcha1=0xFE;
}
}
else
{
if(l==0xD0)
{
VROM_BANK4(0x1000,MMC4reg[2]);
latcha2=0xFD;
}
else if(l==0xE0)
{
VROM_BANK4(0x1000,MMC4reg[3]);
latcha2=0xFE;
}
}
}
DECLFW(Mapper9_write) // $Axxx
{
ROM_BANK8(0x8000,V);
}
DECLFW(Mapper10_write)
{
ROM_BANK16(0x8000,V);
}
DECLFW(Mapper9and10_write)
{
switch(A&0xF000)
{
case 0xB000:
if (latcha1==0xFD) { VROM_BANK4(0x0000,V);}
MMC4reg[0]=V;
break;
case 0xC000:
if (latcha1==0xFE) {VROM_BANK4(0x0000,V);}
MMC4reg[1]=V;
break;
case 0xD000:
if (latcha2==0xFD) {VROM_BANK4(0x1000,V);}
MMC4reg[2]=V;
break;
case 0xE000:
if (latcha2==0xFE) {VROM_BANK4(0x1000,V);}
MMC4reg[3]=V;
break;
case 0xF000:
MIRROR_SET(V&1);
break;
}
}
void Mapper9_init(void)
{
latcha1=0xFE;
latcha2=0xFE;
ROM_BANK8(0xA000,~2);
ROM_BANK8(0x8000,0);
SetWriteHandler(0xA000,0xAFFF,Mapper9_write);
SetWriteHandler(0xB000,0xFFFF,Mapper9and10_write);
PPU_hook=latchcheck;
}
void Mapper10_init(void)
{
latcha1=latcha2=0xFE;
SetWriteHandler(0xA000,0xAFFF,Mapper10_write);
SetWriteHandler(0xB000,0xFFFF,Mapper9and10_write);
PPU_hook=latchcheck;
}

View File

@ -1,79 +0,0 @@
#include "mapinc.h"
static uint8 mode;
static uint8 DRegs[4];
static SFORMAT StateRegs[]=
{
{DRegs, 4, "DREG"},
{0}
};
static void Sync(void)
{
int base, bank;
base = ((DRegs[0]^DRegs[1])&0x10)<<1;
bank = (DRegs[2]^DRegs[3])&0x1f;
if(DRegs[1]&0x08)
{
bank &= 0xfe;
if(mode==0)
{
setprg16(0x8000,base+bank+1);
setprg16(0xC000,base+bank+0);
}
else
{
setprg16(0x8000,base+bank+0);
setprg16(0xC000,base+bank+1);
}
}
else
{
if(DRegs[1]&0x04)
{
setprg16(0x8000,0x1f);
setprg16(0xC000,base+bank);
}
else
{
setprg16(0x8000,base+bank);
if(mode==0)
setprg16(0xC000,0x20);
else
setprg16(0xC000,0x07);
}
}
}
static DECLFW(Mapper167_write)
{
DRegs[(A>>13)&0x03]=V;
Sync();
}
static void StateRestore(int version)
{
Sync();
}
void Mapper166_init(void)
{
mode=1;
DRegs[0]=DRegs[1]=DRegs[2]=DRegs[3]=0;
Sync();
SetWriteHandler(0x8000,0xFFFF,Mapper167_write);
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
void Mapper167_init(void)
{
mode=0;
DRegs[0]=DRegs[1]=DRegs[2]=DRegs[3]=0;
Sync();
SetWriteHandler(0x8000,0xFFFF,Mapper167_write);
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}

View File

@ -1,17 +0,0 @@
/* VRC7 instruments, January 17, 2004 update -Xodnizel */
{0x03, 0x21, 0x04, 0x06, 0x8D, 0xF2, 0x42, 0x17},
{0x13, 0x41, 0x05, 0x0E, 0x99, 0x96, 0x63, 0x12},
{0x31, 0x11, 0x10, 0x0A, 0xF0, 0x9C, 0x32, 0x02},
{0x21, 0x61, 0x1D, 0x07, 0x9F, 0x64, 0x20, 0x27},
{0x22, 0x21, 0x1E, 0x06, 0xF0, 0x76, 0x08, 0x28},
{0x02, 0x01, 0x06, 0x00, 0xF0, 0xF2, 0x03, 0x95},
{0x21, 0x61, 0x1C, 0x07, 0x82, 0x81, 0x16, 0x07},
{0x23, 0x21, 0x1A, 0x17, 0xEF, 0x82, 0x25, 0x15},
{0x25, 0x11, 0x1F, 0x00, 0x86, 0x41, 0x20, 0x11},
{0x85, 0x01, 0x1F, 0x0F, 0xE4, 0xA2, 0x11, 0x12},
{0x07, 0xC1, 0x2B, 0x45, 0xB4, 0xF1, 0x24, 0xF4},
{0x61, 0x23, 0x11, 0x06, 0x96, 0x96, 0x13, 0x16},
{0x01, 0x02, 0xD3, 0x05, 0x82, 0xA2, 0x31, 0x51},
{0x61, 0x22, 0x0D, 0x02, 0xC3, 0x7F, 0x24, 0x05},
{0x21, 0x62, 0x0E, 0x00, 0xA1, 0xA0, 0x44, 0x17},

View File

@ -1,117 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
static uint8 cmd;
static uint8 DRegs[8];
static SFORMAT StateRegs[]=
{
{&cmd, 1, "CMD"},
{DRegs, 8, "DREG"},
{0}
};
static void Sync(void)
{
setprg32(0x8000,(DRegs[0]<<4)|(DRegs[1]&0xF));
setchr8(0);
}
static void StateRestore(int version)
{
Sync();
}
static DECLFW(Write)
{
switch (A&0x7300)
{
case 0x5100: DRegs[0]=V; Sync(); break;
case 0x5000: DRegs[1]=V; Sync(); break;
}
}
static DECLFW(Write2)
{
// FCEU_printf("bs %04x %02x\n",A,V);
switch (A&0x7300)
{
case 0x5200: DRegs[0]=V; Sync(); break;
case 0x5000: DRegs[1]=V; Sync(); break;
}
}
static uint8 WRAM[8192];
static DECLFR(AWRAM)
{
return(WRAM[A-0x6000]);
}
static DECLFW(BWRAM)
{
WRAM[A-0x6000]=V;
}
static void Power(void)
{
memset(DRegs,0,8);
DRegs[1]=0xFF;
cmd=0;
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x4020,0x5FFF,Write);
SetReadHandler(0x6000,0x7FFF,AWRAM);
SetWriteHandler(0x6000,0x7FFF,BWRAM);
Sync();
}
static void M163HB(void)
{
if(scanline==127&&DRegs[1]&0x80)
setchr4(0x0000,1);
}
static void Power2(void)
{
memset(DRegs,0,8);
DRegs[1]=0xFF;
cmd=0;
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x4020,0x5FFF,Write2);
SetReadHandler(0x6000,0x7FFF,AWRAM);
SetWriteHandler(0x6000,0x7FFF,BWRAM);
Sync();
}
void Mapper164_Init(CartInfo *info)
{
info->Power=Power;
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
void Mapper163_Init(CartInfo *info)
{
info->Power=Power2;
GameHBIRQHook=M163HB;
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}

Some files were not shown because too many files have changed in this diff Show More