Compare commits
No commits in common. "master" and "fceux-2.2.3" have entirely different histories.
master
...
fceux-2.2.
|
@ -1,31 +0,0 @@
|
|||
---
|
||||
name: Bug report
|
||||
about: Create a bug report
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**(please complete the following information):**
|
||||
- OS and Version: [e.g. Windows 10]
|
||||
- Version of FCEUX used (QT or non-QT)
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
|
@ -1,50 +1,21 @@
|
|||
build
|
||||
/vc/defaultconfig/scmrev.h
|
||||
/vc/.vs
|
||||
/vc/vc14_bin_Debug
|
||||
/vc/vc14_obj_Debug
|
||||
/vc/vc14_obj_Release
|
||||
/vc/vc14_obj_PublicRelease
|
||||
/vc/vc10_bin_Debug
|
||||
/vc/vc10_obj_Debug
|
||||
/vc/vc10_obj_Release
|
||||
/vc/vc10_obj_PublicRelease
|
||||
/vc/x64
|
||||
/vc/*.user
|
||||
/vc/*.sdf
|
||||
/vc/*.opensdf
|
||||
/vc/*.suo
|
||||
/vc/ipch
|
||||
/output/auxlib.lua
|
||||
/output/fceux.pdb
|
||||
/output/7z.dll
|
||||
/output/7z_64.dll
|
||||
/output/fceux.exe
|
||||
/output/fceux.exp
|
||||
/output/fceux.lib
|
||||
/output/fceux.cfg
|
||||
/output/sav/*.sav
|
||||
/output/fcs/*.fc*
|
||||
/vc/userconfig/scmrev.h
|
||||
/vc/fceux.zip
|
||||
/vc/fceux64.zip
|
||||
|
||||
# macOS junk
|
||||
.DS_Store
|
||||
|
||||
# linux build output
|
||||
bin
|
||||
src/fceux
|
||||
fceux-net-server
|
||||
# A simulation of Subversion default ignores, generated by reposurgeon.
|
||||
*.o
|
||||
.sconf_temp/
|
||||
.sconsign.dblite
|
||||
.deps
|
||||
.dirstamp
|
||||
/output/movies
|
||||
/output/cheats
|
||||
/output/snaps
|
||||
/output/sav
|
||||
|
||||
# typical CMake build directory
|
||||
/build
|
||||
*.lo
|
||||
*.la
|
||||
*.al
|
||||
*.libs
|
||||
*.so
|
||||
*.so.[0-9]*
|
||||
*.a
|
||||
*.pyc
|
||||
*.pyo
|
||||
*.rej
|
||||
*~
|
||||
*.#*
|
||||
.*.swp
|
||||
.DS_store
|
||||
# Simulated Subversion default ignores end here
|
||||
# The contents of the svn:ignore property on the branch root.
|
||||
/.sconsign.dblite
|
||||
/config.log
|
||||
/.sconf_temp
|
||||
|
|
|
@ -1,70 +0,0 @@
|
|||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "(gdb) Launch (Linux)",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/build/src/fceux",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"MIMode": "gdb",
|
||||
"setupCommands": [
|
||||
{
|
||||
"description": "Enable pretty-printing for gdb",
|
||||
"text": "-enable-pretty-printing",
|
||||
"ignoreFailures": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "(gdb) Core Dump (Linux)",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/build/src/fceux",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"coreDumpPath": "${workspaceFolder}/build/core-fceux",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"MIMode": "gdb",
|
||||
"setupCommands": [
|
||||
{
|
||||
"description": "Enable pretty-printing for gdb",
|
||||
"text": "-enable-pretty-printing",
|
||||
"ignoreFailures": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "(Windows) Launch",
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/build/src/Debug/fceux.exe",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${fileDirname}",
|
||||
"environment": [],
|
||||
"console": "externalTerminal"
|
||||
},
|
||||
{
|
||||
"name": "(lldb) Launch (MacOS)",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/build/src/fceux.app/Contents/MacOS/fceux",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"MIMode": "lldb"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
{
|
||||
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||
// for the documentation about the tasks.json format
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "Build - Incremental",
|
||||
"type": "shell",
|
||||
"command": "${workspaceFolder}/scripts/unix_debug_build.sh",
|
||||
"problemMatcher": [ "$gcc" ],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Build - Full/Clean",
|
||||
"type": "shell",
|
||||
"command": "${workspaceFolder}/scripts/unix_debug_build.sh -B",
|
||||
"problemMatcher": [ "$gcc" ],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": false
|
||||
}
|
||||
}
|
||||
|
||||
]
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
|
||||
cmake_minimum_required(VERSION 3.8)
|
||||
|
||||
project(fceux)
|
||||
|
||||
add_subdirectory( src )
|
||||
|
9
INSTALL
9
INSTALL
|
@ -1,9 +0,0 @@
|
|||
To compile and install FCEUX for SDL, follow the instructions in the README file.
|
||||
|
||||
Users of Microsoft Visual Studio can use the solution files within the vc directory. The Windows XP toolset is required to open and build this solution. If it
|
||||
is not installed, go to "Tools" > "Get Tools and Features". Select "Individual Components" and then install "C++ Windows XP Support for VS 2017 (v141) tools".
|
||||
These solution files will compile FCEUX and some included libraries for full functionality.
|
||||
|
||||
The SDL port build tool of choice has come full circle back to Cmake. The cmake build tool will compile the new Qt version of the SDL GUI.
|
||||
Building of the SDL fceux no longer supports use of the scons build tool.
|
||||
|
159
README
159
README
|
@ -1,159 +0,0 @@
|
|||
FCEUX SDL 2.6.4 SDL README
|
||||
==========================
|
||||
Originally By Lukas Sabota (sf: punkrockguy318)
|
||||
Updated By mjbudd77
|
||||
|
||||
[NOTE: This only applies to Qt/SDL builds]
|
||||
|
||||
https://fceux.com
|
||||
|
||||
Last Modified: April 30, 2023
|
||||
|
||||
Table of Contents
|
||||
-----------------
|
||||
|
||||
1. Requirements
|
||||
2. Installation
|
||||
3. Compile-time options
|
||||
4. GUI
|
||||
5. LUA Scripting
|
||||
5. FAQ
|
||||
6. Contact
|
||||
|
||||
1 - Requirements
|
||||
----------------
|
||||
* sdl2 - Version >= 2.0 (sdl2 >= 2.8 recommended)
|
||||
* cmake - Required to build fceux. (cmake >= 3.8 recommended)
|
||||
* qt5 OR qt6 - (qt version >= 5.11 recommended)
|
||||
- Required Qt Modules: Widgets and OpenGL
|
||||
- Optional Qt Modules: Help
|
||||
* liblua5.1 (optional) - Will statically link internally if the system cannot provide this.
|
||||
* libx264 (optional) - H.264 video encoder for avi recording (recommended)
|
||||
* libx265 (optional) - H.265 video encoder for avi recording (recommended)
|
||||
* ffmpeg libraries (optional) - for avi recording (recommended)
|
||||
* - ffmpeg libraries used: libavcodec libavformat libavutil libswresample libswscale
|
||||
* libarchive (optional) - for 7zip archive support (test with version 3.4.0)
|
||||
* minizip
|
||||
* zlib
|
||||
* openGL
|
||||
* c++ compiler -- you may use g++ from gcc or clang++ from llvm or msvc 2019
|
||||
|
||||
2 - Installation
|
||||
----------------
|
||||
The old scons build system is no longer supported.
|
||||
Fceux can be compiled and built using the cmake build system. To compile, run:
|
||||
|
||||
mkdir build; cd build;
|
||||
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release .. # For a release build
|
||||
|
||||
To build a binary with debug information included in it:
|
||||
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Debug ..
|
||||
|
||||
The Qt version of the GUI builds by default and this is the preferred GUI for use.
|
||||
For those who must have GTK/Gnome style, there is a GTK style plugin for Qt that
|
||||
can be installed to the OS and selected for use via the GUI.
|
||||
The previous GTK version of the GUI is now retired and has been removed from the build.
|
||||
|
||||
The Qt version GUI by far exceeds the old GTK gui in capability and performance.
|
||||
The Qt GUI can build/link against both Qt5 and Qt6. To enable building against Qt6, use -DQT6=1 argument:
|
||||
cmake -DCMAKE_INSTALL_PREFIX=/usr -DQT6=1 -DCMAKE_BUILD_TYPE=Debug ..
|
||||
|
||||
To do the actual compiling:
|
||||
make
|
||||
|
||||
To compile faster with multiple processes in parallel:
|
||||
make -j `nproc`
|
||||
|
||||
After a sucessful compilation, the fceux binary will be generated to
|
||||
./build/src/fceux . You can install fceux to your system with the following command:
|
||||
|
||||
sudo make install
|
||||
|
||||
By default cmake will use an installation prefix of /usr/local.
|
||||
The recommended installation prefix is /usr (this is where the installed fceux.desktop file expects everything to be)
|
||||
|
||||
You can choose to install the lua scripts (located in output/luaScripts) to a directory of your choosing:
|
||||
|
||||
cp -R output/luaScripts /usr/local/some/directory/that/i/will/find/later
|
||||
|
||||
If you would like to do a full clean build a 'make clean' like function, you can do either of following:
|
||||
|
||||
make clean # from inside build directory
|
||||
|
||||
OR:
|
||||
Delete build directory and start over at initial cmake step:
|
||||
rm -rf build;
|
||||
|
||||
3 - Compile-time options
|
||||
------------------------
|
||||
You can enable and disable certain features of fceux at build time.
|
||||
Look in the src/CMakeList.txt file to tweak options.
|
||||
|
||||
4 - GUI
|
||||
-------
|
||||
The Qt GUI is required and automatically builds as part of the build. The Qt GUI is the default.
|
||||
When invoking cmake, Qt6 can be used (instead of Qt5) by specifying a -DQT6=1 on the command line.
|
||||
See above build instructions.
|
||||
OpenGL options:
|
||||
For Linux builds, the OpenGL library preference can be either GLVND or LEGACY (default).
|
||||
To use GLVND OpenGL, add a -DGLVND=1 on the cmake command line.
|
||||
|
||||
Qt Help Engine options:
|
||||
The GUI supports both online and offline documentation options.
|
||||
Online documentation requires an internet connection and a browser.
|
||||
Qt supports an help engine that can read compiled html files (made via the Qt qhelpgenerator tool),
|
||||
these files can reside locally on ones computer and be accessed by the GUI using the Qt help engine module.
|
||||
The Qt help engine is an optional dependency and can be enabled in the build by
|
||||
adding a -DQHELP=1 on the cmake command line.
|
||||
|
||||
Qt Styling Options:
|
||||
The Qt GUI can use custom Qt widget styling by providing it a Qt stylesheet file.
|
||||
Use the GUI config window to set style options.
|
||||
|
||||
5 - LUA Scripting
|
||||
-----------------
|
||||
FCEUX provides a LUA 5.1 engine that allows for in-game scripting capabilities. LUA is enabled either way. It is just a matter of whether LUA is statically linked internally or dynamically linked to a system library.
|
||||
|
||||
A collection of LUA scripts are provided with the source distribuition in the output directory:
|
||||
|
||||
$source_directory/output/luaScripts
|
||||
|
||||
You should be able to run most of the scripts in this directory out of the box. However, some of the the lua scripts require functionality from the "auxlib.lua" library. This file can be copied from "./bin/auxlib.lua" or "./src/auxlib.lua". You will need to place this file in the LUA library search path if a script bombs out looking for auxlib.lua. If the script bombs out, the console output will let you know what the search path are (/usr/local/lib/lua/5.1/ on my particular system). You can simply copy the auxlib to a preferred location to utilize the functions in the auxiliary lua library.
|
||||
|
||||
In addition, some of the lua scripts require functionality from the "iup" GUI library. You can obtain binaries and source for "iup" upstream (http://www.tecgraf.puc-rio.br/iup/), but I would recommend obtaining packages from your Linux distribution if you are able, as it can be difficult to compile or get the binaries working correctly on a given system.
|
||||
|
||||
You will need to add the location that the libiup*.so files to the LUA_CPATH. This can be done with the following command (please note that the location where iup is installed with vary based on how you installed iup):
|
||||
|
||||
export LUA_CPATH="/path/to/iup/lib/lib?51.so;"
|
||||
|
||||
For example, if libiuplua51.so is located in '/usr/lib', you can run the following command before executing fceux to place the library in the search path:
|
||||
|
||||
export LUA_CPATH="/usr/lib/lib?51.so;"
|
||||
|
||||
Finally, if any scripts complaints about "attempt to index global 'iup' (a nil value)", this means that "iup" needs to be explicitly loaded into the script. You can add the following line to the head of script to manually load "iup":
|
||||
|
||||
require("iuplua")
|
||||
|
||||
The latest version of iup (3.5 at the time of writing) is recommended.
|
||||
|
||||
6 - FAQ
|
||||
-------
|
||||
|
||||
* Q. Im having issues with my sound!
|
||||
* A. Try different SDL audio drivers to see if this makes any difference. You can do this by using this command before running fceux:
|
||||
|
||||
export SDL_AUDIODRIVER=driver
|
||||
|
||||
where driver is either: 'pulse' for pulseaudio;' alsa' for ALSA; 'dsp' for OSS; 'esd' for ESD; see SDL documentation for details (http://www.libsdl.org/docs/html/sdlenvvars.html)
|
||||
|
||||
There are sound options that you can tweak at runtime through command line switches:
|
||||
|
||||
* -soundq x internal sound quality hack value (0 off)
|
||||
* -soundrate x sound rate (sane values: 28000 48000
|
||||
* -soundbuffersize x (in ms) sane values (30, 50, 100, 120)
|
||||
|
||||
Running fceux through esddsp is known to fix some audio issues with pulseaudio on some older Ubuntu versions.
|
||||
|
||||
7 - Contact
|
||||
-----------
|
||||
If you have an issue with fceux, report it in the github bug tracker (see fceux at github.com). If you would like to contact the author of this readme personally, e-mail LTsmooth42 <at> gmail <dot> com. You can also check us out at #fceu on irc.freenode.net.
|
|
@ -0,0 +1,76 @@
|
|||
file_list = Split("""
|
||||
cart.cpp
|
||||
cheat.cpp
|
||||
crc32.cpp
|
||||
config.cpp
|
||||
debug.cpp
|
||||
endian.cpp
|
||||
fceu.cpp
|
||||
fds.cpp
|
||||
file.cpp
|
||||
filter.cpp
|
||||
general.cpp
|
||||
ines.cpp
|
||||
input.cpp
|
||||
md5.cpp
|
||||
memory.cpp
|
||||
netplay.cpp
|
||||
nsf.cpp
|
||||
palette.cpp
|
||||
ppu.cpp
|
||||
sound.cpp
|
||||
state.cpp
|
||||
unif.cpp
|
||||
video.cpp
|
||||
vsuni.cpp
|
||||
wave.cpp
|
||||
x6502.cpp
|
||||
movie.cpp
|
||||
unzip.c""")
|
||||
|
||||
Export('file_list')
|
||||
|
||||
SConscript(Split("""
|
||||
boards/SConscript
|
||||
input/SConscript
|
||||
fir/SConscript
|
||||
mappers/SConscript
|
||||
drivers/common/SConscript
|
||||
drivers/pc/SConscript
|
||||
"""))
|
||||
#palettes/SConscript
|
||||
Import('file_list')
|
||||
|
||||
# XXX path separator fixed right now
|
||||
opts = Options()
|
||||
opts.Add('PSS_STYLE', 'Path separator style', 1)
|
||||
opts.Add('LSB_FIRST', 'Least significant byte first?', 1)
|
||||
|
||||
env = Environment(options = opts,
|
||||
CPPDEFINES={'PSS_STYLE' : '${PSS_STYLE}',
|
||||
'LSB_FIRST' : '${LSB_FIRST}'})
|
||||
|
||||
# use sdl-config to get the cflags and libpath
|
||||
import os;
|
||||
sdl_cflags_pipe = os.popen("sdl-config --cflags");
|
||||
sdl_cflags = sdl_cflags_pipe.read();
|
||||
sdl_cflags = sdl_cflags.rstrip(os.linesep);
|
||||
sdl_cflags_pipe.close();
|
||||
|
||||
sdl_libpath = [];
|
||||
sdl_libs = [];
|
||||
|
||||
sdl_libflags_pipe = os.popen("sdl-config --libs");
|
||||
sdl_libflags = sdl_libflags_pipe.read();
|
||||
for flag in sdl_libflags.split(' '):
|
||||
if flag.find("-L") == 0:
|
||||
sdl_libpath.append(flag.strip("-L"));
|
||||
else:
|
||||
sdl_libs.append(flag.strip("-l"));
|
||||
sdl_libflags_pipe.close();
|
||||
|
||||
# add zlib
|
||||
libs = sdl_libs;
|
||||
libs.append('z');
|
||||
|
||||
env.Program('fceu', file_list, CCFLAGS=sdl_cflags, LIBS=libs, LIBPATH=sdl_libpath)
|
73
TODO-SDL
73
TODO-SDL
|
@ -1,73 +0,0 @@
|
|||
Priorities
|
||||
==========
|
||||
* Clean out old unused files - scons build system is dead, cmake is the way to go.
|
||||
* GTK GUI was not cross-platform. A Qt5 version of the GUI has been created to meet this need.
|
||||
The GTK GUI has been retired and is no longer supported.
|
||||
* The Qt GUI has by far exceeded the capabilities of the older GTK version. Below is a GUI capability
|
||||
matrix showing the differences between the two. I HIGHLY RECOMMEND USING THE Qt GUI.
|
||||
* Code cleanup. Lots of compiler warnings with newer GCC. Maybe I'm OCD... but these warnings bother me.
|
||||
|
||||
Features
|
||||
========
|
||||
* Emulator no runs as a separate thread from the GUI. Much improved performance.
|
||||
* Cross platform QT GUI is fully functional
|
||||
|
||||
---------------------------------------------------------------------------------|
|
||||
---------------------- GUI Capability Matrix -----------------------------------|
|
||||
---------------------------------------------------------------------------------|
|
||||
Feature | Qt5 | GTK3 |
|
||||
-----------------------------------------------------|-------------|-------------|
|
||||
Basic game ROM open/run and close via menu functions | YES | YES |
|
||||
Load/save game states | YES | YES |
|
||||
Select and execute Lua script via file browser | YES | YES |
|
||||
Lua Console/Control Window | YES | NO |
|
||||
Screenshot snap/save functionality | YES | YES |
|
||||
Virtual game pad button mapping window | YES | YES |
|
||||
Other input device type button mapping window | NO | NO |
|
||||
Audio mixer / config window | YES | YES |
|
||||
Video config window | YES | YES |
|
||||
OpenGL graphics | YES | YES |
|
||||
Hot key config window | YES | YES |
|
||||
Palette config window | YES | YES |
|
||||
Multi-thread (GUI and emulation on separate threads) | YES | NO |
|
||||
Emulation speed control via menu | YES | NO |
|
||||
Emulation speed control via hotkeys | YES | YES |
|
||||
Fullscreen functionality | YES | YES |
|
||||
AVI/WAV Record Functionality | YES | NO |
|
||||
NES Emulation Power/Reset/Pause functionality | YES | YES |
|
||||
Game genie load/enable capability | YES | YES |
|
||||
Movie record/save/play functionality | YES | YES |
|
||||
Cheat search window | YES | YES |
|
||||
Active Cheat window | YES | YES |
|
||||
RAM Search Window | YES | NO |
|
||||
RAM Watch Window | YES | YES |
|
||||
Memory Watch Window | NO | NO |
|
||||
TAS Editor | YES | NO |
|
||||
6502 Debugger Window | YES | YES |
|
||||
PPU Viewer | YES | NO |
|
||||
Name Table Viewer | YES | NO |
|
||||
Sprite Viewer | YES | NO |
|
||||
NES Palette Editor | YES | NO |
|
||||
Memory Hex Editor | YES | YES |
|
||||
Trace Logger | YES | NO |
|
||||
Code/Data Logger | YES | NO |
|
||||
Game Genie Encoder/Decoder | YES | NO |
|
||||
iNES Header Editor | YES | NO |
|
||||
Built in help pages | YES | NO |
|
||||
Network play (who actually uses this???) | NO | NO |
|
||||
-----------------------------------------------------|-------------|-------------|
|
||||
---------------------------------------------------------------------------------|
|
||||
---------------------------------------------------------------------------------|
|
||||
|
||||
QT
|
||||
===
|
||||
* Clean out rest of old GTK comments and #ifdefs
|
||||
* GUI Debug Tools Pretty Much Done
|
||||
* GUI now compiles in windows as well.
|
||||
|
||||
BUGS
|
||||
====
|
||||
|
||||
DOCS
|
||||
====
|
||||
* Docs REALLY need a cleanup/rewrite
|
45
_config.yml
45
_config.yml
|
@ -1,45 +0,0 @@
|
|||
# jekyll configuration for github pages
|
||||
|
||||
# ignore stuff not part of the website, everything except:
|
||||
# - documentation/
|
||||
# - web/
|
||||
# - fceux.png
|
||||
# - index.html
|
||||
|
||||
exclude:
|
||||
- attic
|
||||
- fceux-server
|
||||
- getSDLKey
|
||||
- gfceu
|
||||
- m4
|
||||
- output
|
||||
- pipelines
|
||||
- src
|
||||
- vc
|
||||
- .gitignore
|
||||
- COPYING
|
||||
- ChangeLog
|
||||
- INSTALL
|
||||
- Makefile.am
|
||||
- NEWS
|
||||
- NewPPUtests.txt
|
||||
- README
|
||||
- STYLE-GUIDELINES-SDL
|
||||
- TODO-SDL
|
||||
- _config.yml
|
||||
- appveyor.yml
|
||||
- autogen.sh
|
||||
- azure-pipelines.yml
|
||||
- changelog.txt
|
||||
- configure.ac
|
||||
- doxygen
|
||||
- fceux.desktop
|
||||
- readme.md
|
||||
- fceux-server/fceux-net-server.exe
|
||||
- vc/BizHawk.Build.Tool.exe
|
||||
- vc/pscp.exe
|
||||
- vc/upx.exe
|
||||
- vc/zip.exe
|
||||
|
||||
# Include all .js and .json files that start with an '_'
|
||||
include: [ "_*.js", "_*.json" ]
|
88
appveyor.yml
88
appveyor.yml
|
@ -1,88 +0,0 @@
|
|||
version: 1.0.{build}
|
||||
|
||||
environment:
|
||||
matrix:
|
||||
|
||||
- job_name: Windows 32
|
||||
appveyor_build_worker_image: Visual Studio 2019
|
||||
|
||||
- job_name: Windows 64
|
||||
appveyor_build_worker_image: Visual Studio 2019
|
||||
|
||||
- job_name: Win64 Qt
|
||||
appveyor_build_worker_image: Visual Studio 2019
|
||||
|
||||
- job_name: Ubuntu
|
||||
appveyor_build_worker_image: Ubuntu2004
|
||||
|
||||
- job_name: MacOS
|
||||
appveyor_build_worker_image: macos-ventura
|
||||
|
||||
for:
|
||||
|
||||
-
|
||||
matrix:
|
||||
only:
|
||||
- job_name: Windows 32
|
||||
|
||||
build_script:
|
||||
- cmd: pipelines/WinAppveyorBuild.bat win32
|
||||
|
||||
-
|
||||
matrix:
|
||||
only:
|
||||
- job_name: Windows 64
|
||||
|
||||
build_script:
|
||||
- cmd: pipelines/WinAppveyorBuild.bat win64
|
||||
|
||||
-
|
||||
matrix:
|
||||
only:
|
||||
- job_name: Win64 Qt
|
||||
|
||||
build_script:
|
||||
- cmd: pipelines/WinAppveyorBuild.bat win64-QtSDL
|
||||
|
||||
-
|
||||
matrix:
|
||||
only:
|
||||
- job_name: Ubuntu
|
||||
|
||||
build_script:
|
||||
- sh: perl pipelines/build.pl linux
|
||||
|
||||
-
|
||||
matrix:
|
||||
only:
|
||||
- job_name: MacOS
|
||||
|
||||
build_script:
|
||||
- sh: perl pipelines/build.pl macOS
|
||||
|
||||
deploy:
|
||||
|
||||
- provider: GitHub
|
||||
tag: interim-build
|
||||
release: interim-build
|
||||
description: 'Interim Builds - Latest auto builds off master branch - commit: $(APPVEYOR_REPO_COMMIT)\nDate: $(APPVEYOR_REPO_COMMIT_TIMESTAMP)'
|
||||
auth_token:
|
||||
secure: pYXqhuxNn7vivsJ6cnWCHlORrTtaWO7fyGOvGFUNKtM2apSY44gjbAhGIlD+OdtF
|
||||
artifact: $(WIN32_ARTIFACT), $(WIN64_ARTIFACT), $(WIN64_QTSDL_ARTIFACT), $(MACOS_ARTIFACT), $(LINUX_ARTIFACT)
|
||||
draft: false
|
||||
prerelease: true
|
||||
force_update: true
|
||||
on:
|
||||
branch: master # release from master branch only
|
||||
APPVEYOR_REPO_TAG: false # never deploy on tag push
|
||||
|
||||
- provider: GitHub
|
||||
description: 'Release Builds - commit: $(APPVEYOR_REPO_COMMIT)'
|
||||
auth_token:
|
||||
secure: pYXqhuxNn7vivsJ6cnWCHlORrTtaWO7fyGOvGFUNKtM2apSY44gjbAhGIlD+OdtF
|
||||
artifact: $(WIN32_ARTIFACT), $(WIN64_ARTIFACT), $(WIN64_QTSDL_ARTIFACT), $(MACOS_ARTIFACT)
|
||||
draft: false
|
||||
prerelease: false
|
||||
force_update: false
|
||||
on:
|
||||
APPVEYOR_REPO_TAG: true # deploy on tag push only
|
|
@ -0,0 +1,72 @@
|
|||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include "../common/args.h"
|
||||
#include "../common/config.h"
|
||||
|
||||
#include "input.h"
|
||||
|
||||
extern FCEUGI *CurGame;
|
||||
|
||||
extern CFGSTRUCT DriverConfig[];
|
||||
extern ARGPSTRUCT DriverArgs[];
|
||||
extern char *DriverUsage;
|
||||
|
||||
void DoDriverArgs(void);
|
||||
uint8 *GetBaseDirectory(void);
|
||||
|
||||
int InitSound(FCEUGI *gi);
|
||||
void WriteSound(int32 *Buffer, int Count);
|
||||
int KillSound(void);
|
||||
uint32 GetMaxSound(void);
|
||||
uint32 GetWriteSound(void);
|
||||
|
||||
void SilenceSound(int s); /* DOS and SDL */
|
||||
|
||||
|
||||
int InitMouse(void);
|
||||
void KillMouse(void);
|
||||
void GetMouseData(uint32 *MouseData);
|
||||
|
||||
int InitJoysticks(void);
|
||||
int KillJoysticks(void);
|
||||
uint32 *GetJSOr(void);
|
||||
|
||||
int InitKeyboard(void);
|
||||
int UpdateKeyboard(void);
|
||||
char *GetKeyboard(void);
|
||||
void KillKeyboard(void);
|
||||
|
||||
int InitVideo(FCEUGI *gi);
|
||||
int KillVideo(void);
|
||||
void BlitScreen(uint8 *XBuf);
|
||||
void LockConsole(void);
|
||||
void UnlockConsole(void);
|
||||
void ToggleFS(); /* SDL */
|
||||
|
||||
int LoadGame(const char *path);
|
||||
int CloseGame(void);
|
||||
int GUI_Init(int argc, char **argv, int (*dofunc)(void));
|
||||
int GUI_Idle(void);
|
||||
int GUI_Update(void);
|
||||
void GUI_Hide(int);
|
||||
void GUI_RequestExit(void);
|
||||
int GUI_SetVideo(int fullscreen, int width, int height);
|
||||
char *GUI_GetKeyboard(void);
|
||||
void GUI_GetMouseState(uint32 *b, int *x, int *y);
|
||||
|
||||
void UpdatePhysicalInput(void);
|
||||
int DTestButton(ButtConfig *bc);
|
||||
int DWaitButton(const uint8 *text, ButtConfig *bc, int wb);
|
||||
int ButtonConfigBegin(void);
|
||||
void ButtonConfigEnd(void);
|
||||
|
||||
void Giggles(int);
|
||||
void DoFun(void);
|
||||
|
||||
int FCEUD_NetworkConnect(void);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -0,0 +1,161 @@
|
|||
#ifdef SDL
|
||||
#include <SDL.h>
|
||||
#define SDLK_A SDLK_a
|
||||
#define SDLK_B SDLK_b
|
||||
#define SDLK_C SDLK_c
|
||||
#define SDLK_D SDLK_d
|
||||
#define SDLK_E SDLK_e
|
||||
#define SDLK_F SDLK_f
|
||||
#define SDLK_G SDLK_g
|
||||
#define SDLK_H SDLK_h
|
||||
#define SDLK_I SDLK_i
|
||||
#define SDLK_J SDLK_j
|
||||
#define SDLK_K SDLK_k
|
||||
#define SDLK_L SDLK_l
|
||||
#define SDLK_M SDLK_m
|
||||
#define SDLK_N SDLK_n
|
||||
#define SDLK_O SDLK_o
|
||||
#define SDLK_P SDLK_p
|
||||
#define SDLK_Q SDLK_q
|
||||
#define SDLK_R SDLK_r
|
||||
#define SDLK_S SDLK_s
|
||||
#define SDLK_T SDLK_t
|
||||
#define SDLK_U SDLK_u
|
||||
#define SDLK_V SDLK_v
|
||||
#define SDLK_W SDLK_w
|
||||
#define SDLK_X SDLK_x
|
||||
#define SDLK_Y SDLK_y
|
||||
#define SDLK_Z SDLK_z
|
||||
#define SDLK_LEFTCONTROL SDLK_LCTRL
|
||||
#define SDLK_RIGHTCONTROL SDLK_RCTRL
|
||||
#define SDLK_LEFTALT SDLK_LALT
|
||||
#define SDLK_RIGHTALT SDLK_RALT
|
||||
#define SDLK_LEFTSHIFT SDLK_LSHIFT
|
||||
#define SDLK_RIGHTSHIFT SDLK_RSHIFT
|
||||
#define SDLK_CURSORDOWN SDLK_DOWN
|
||||
#define SDLK_CURSORUP SDLK_UP
|
||||
#define SDLK_CURSORLEFT SDLK_LEFT
|
||||
#define SDLK_CURSORRIGHT SDLK_RIGHT
|
||||
#define SDLK_ENTER SDLK_RETURN
|
||||
#define SDLK_EQUAL SDLK_EQUALS
|
||||
#define SDLK_APOSTROPHE SDLK_QUOTE
|
||||
#define SDLK_BRACKET_LEFT SDLK_LEFTBRACKET
|
||||
#define SDLK_BRACKET_RIGHT SDLK_RIGHTBRACKET
|
||||
#define SDLK_SCROLLLOCK SDLK_SCROLLOCK /* I guess the SDL people don't like lots of Ls... */
|
||||
#define SDLK_GRAVE SDLK_BACKQUOTE
|
||||
#define MKK(k) SDLK_##k
|
||||
#define MKK_COUNT (SDLK_LAST+1)
|
||||
|
||||
#elif DOS
|
||||
|
||||
#define SCAN_GRAVE 0x29
|
||||
#define SCAN_1 0x02
|
||||
#define SCAN_2 0x03
|
||||
#define SCAN_3 0x04
|
||||
#define SCAN_4 0x05
|
||||
#define SCAN_5 0x06
|
||||
#define SCAN_6 0x07
|
||||
#define SCAN_7 0x08
|
||||
#define SCAN_8 0x09
|
||||
#define SCAN_9 0x0A
|
||||
#define SCAN_0 0x0B
|
||||
#define SCAN_MINUS 0x0C
|
||||
#define SCAN_EQUAL 0x0D
|
||||
#define SCAN_BACKSLASH 0x2B
|
||||
#define SCAN_BACKSPACE 0x0E
|
||||
#define SCAN_TAB 0x0F
|
||||
#define SCAN_Q 0x10
|
||||
#define SCAN_W 0x11
|
||||
#define SCAN_E 0x12
|
||||
#define SCAN_R 0x13
|
||||
#define SCAN_T 0x14
|
||||
#define SCAN_Y 0x15
|
||||
#define SCAN_U 0x16
|
||||
#define SCAN_I 0x17
|
||||
#define SCAN_O 0x18
|
||||
#define SCAN_P 0x19
|
||||
#define SCAN_BRACKET_LEFT 0x1A
|
||||
#define SCAN_BRACKET_RIGHT 0x1B
|
||||
#define SCAN_LOWBACKSLASH 0x2B
|
||||
#define SCAN_CAPSLOCK 0x3A
|
||||
#define SCAN_A 0x1E
|
||||
#define SCAN_S 0x1F
|
||||
#define SCAN_D 0x20
|
||||
#define SCAN_F 0x21
|
||||
#define SCAN_G 0x22
|
||||
#define SCAN_H 0x23
|
||||
#define SCAN_J 0x24
|
||||
#define SCAN_K 0x25
|
||||
#define SCAN_L 0x26
|
||||
#define SCAN_SEMICOLON 0x27
|
||||
#define SCAN_APOSTROPHE 0x28
|
||||
#define SCAN_ENTER 0x1C
|
||||
#define SCAN_LEFTSHIFT 0x2A
|
||||
#define SCAN_Z 0x2C
|
||||
#define SCAN_X 0x2D
|
||||
#define SCAN_C 0x2E
|
||||
#define SCAN_V 0x2F
|
||||
#define SCAN_B 0x30
|
||||
#define SCAN_N 0x31
|
||||
#define SCAN_M 0x32
|
||||
#define SCAN_COMMA 0x33
|
||||
#define SCAN_PERIOD 0x34
|
||||
#define SCAN_SLASH 0x35
|
||||
#define SCAN_RIGHTSHIFT 0x36
|
||||
#define SCAN_LEFTCONTROL 0x1D
|
||||
#define SCAN_LEFTALT 0x38
|
||||
#define SCAN_SPACE 0x39
|
||||
|
||||
/* Extended keys. */
|
||||
#define SCAN_RIGHTALT (0x38|0x80)
|
||||
#define SCAN_RIGHTCONTROL (0x1D|0x80)
|
||||
#define SCAN_BL_INSERT (0x52|0x80)
|
||||
#define SCAN_BL_DELETE (0x53|0x80)
|
||||
#define SCAN_BL_CURSORLEFT (0x4B|0x80)
|
||||
#define SCAN_BL_HOME (0x47|0x80)
|
||||
#define SCAN_BL_END (0x4F|0x80)
|
||||
#define SCAN_BL_CURSORUP (0x48|0x80)
|
||||
#define SCAN_BL_CURSORDOWN (0x50|0x80)
|
||||
#define SCAN_BL_PAGEUP (0x49|0x80)
|
||||
#define SCAN_BL_PAGEDOWN (0x51|0x80)
|
||||
#define SCAN_BL_CURSORRIGHT (0x4D|0x80)
|
||||
|
||||
#define SCAN_SCROLLLOCK 0x46
|
||||
/* Keys often found in the key pad area. */
|
||||
#define SCAN_NUMLOCK 0x45
|
||||
#define SCAN_HOME 0x47
|
||||
#define SCAN_CURSORLEFT 0x4B
|
||||
#define SCAN_END 0x4F
|
||||
#define SCAN_SLASH 0x35
|
||||
#define SCAN_CURSORUP 0x48
|
||||
#define SCAN_CENTER 0x4C
|
||||
#define SCAN_CURSORDOWN 0x50
|
||||
#define SCAN_INSERT 0x52
|
||||
#define SCAN_PAUSE 0xC5
|
||||
#define SCAN_ASTERISK 0x37
|
||||
#define SCAN_PAGEUP 0x49
|
||||
#define SCAN_CURSORRIGHT 0x4D
|
||||
#define SCAN_PAGEDOWN 0x51
|
||||
#define SCAN_DELETE 0x53
|
||||
#define SCAN_KP_MINUS 0x4A
|
||||
#define SCAN_KP_PLUS 0x4E
|
||||
#define SCAN_KP_ENTER 0x1C
|
||||
|
||||
#define SCAN_ESCAPE 0x01
|
||||
#define SCAN_F1 0x3B
|
||||
#define SCAN_F2 0x3C
|
||||
#define SCAN_F3 0x3D
|
||||
#define SCAN_F4 0x3E
|
||||
#define SCAN_F5 0x3F
|
||||
#define SCAN_F6 0x40
|
||||
#define SCAN_F7 0x41
|
||||
#define SCAN_F8 0x42
|
||||
#define SCAN_F9 0x43
|
||||
#define SCAN_F10 0x44
|
||||
#define SCAN_F11 0x57
|
||||
#define SCAN_F12 0x58
|
||||
|
||||
#define MK_COUNT 256
|
||||
#define MK(k) SCAN_##k
|
||||
|
||||
#endif
|
|
@ -0,0 +1,553 @@
|
|||
/* 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 <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <signal.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/stat.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "main.h"
|
||||
#include "throttle.h"
|
||||
|
||||
#include "../common/cheat.h"
|
||||
|
||||
#include "input.h"
|
||||
#include "dface.h"
|
||||
|
||||
extern int32 fps_scale;
|
||||
|
||||
int CloseGame(void);
|
||||
|
||||
static char *soundrecfn=0; /* File name of sound recording. */
|
||||
|
||||
static int ntsccol=0,ntschue=0,ntsctint=0;
|
||||
int soundvol=100;
|
||||
long soundq=0;
|
||||
int _sound=1;
|
||||
long soundrate=48000;
|
||||
#ifdef WIN32
|
||||
long soundbufsize=52;
|
||||
#else
|
||||
long soundbufsize=24;
|
||||
#endif
|
||||
|
||||
#ifdef FRAMESKIP
|
||||
static int frameskip=0;
|
||||
#endif
|
||||
static int inited=0;
|
||||
static int isloaded=0; // Is game loaded?
|
||||
|
||||
int srendlinev[2]={8,0};
|
||||
int erendlinev[2]={231,239};
|
||||
|
||||
|
||||
static uint8 *DrBaseDirectory;
|
||||
|
||||
int eoptions=0;
|
||||
|
||||
static void DriverKill(void);
|
||||
static int DriverInitialize(FCEUGI *gi);
|
||||
int gametype;
|
||||
|
||||
FCEUGI *CurGame=NULL;
|
||||
|
||||
static void ParseGI(FCEUGI *gi)
|
||||
{
|
||||
ParseGIInput(gi);
|
||||
gametype=gi->type;
|
||||
}
|
||||
|
||||
#ifndef EXTGUI
|
||||
void FCEUD_PrintError(char *s)
|
||||
{
|
||||
puts(s);
|
||||
}
|
||||
|
||||
void FCEUD_Message(char *s)
|
||||
{
|
||||
fputs(s,stdout);
|
||||
}
|
||||
#endif
|
||||
|
||||
static char *cpalette=0;
|
||||
static void LoadCPalette(void)
|
||||
{
|
||||
uint8 tmpp[192];
|
||||
FILE *fp;
|
||||
|
||||
if(!(fp=FCEUD_UTF8fopen(cpalette,"rb")))
|
||||
{
|
||||
printf(" Error loading custom palette from file: %s\n",cpalette);
|
||||
return;
|
||||
}
|
||||
fread(tmpp,1,192,fp);
|
||||
FCEUI_SetPaletteArray(tmpp);
|
||||
fclose(fp);
|
||||
}
|
||||
#ifdef EXTGUI
|
||||
extern CFGSTRUCT GUIConfig;
|
||||
#endif
|
||||
static CFGSTRUCT fceuconfig[]={
|
||||
AC(soundrate),
|
||||
AC(soundq),
|
||||
AC(_sound),
|
||||
AC(soundvol),
|
||||
AC(soundbufsize),
|
||||
ACS(cpalette),
|
||||
AC(ntsctint),
|
||||
AC(ntschue),
|
||||
AC(ntsccol),
|
||||
AC(eoptions),
|
||||
ACA(srendlinev),
|
||||
ACA(erendlinev),
|
||||
ADDCFGSTRUCT(InputConfig),
|
||||
ADDCFGSTRUCT(DriverConfig),
|
||||
#ifdef EXTGUI
|
||||
ADDCFGSTRUCT(GUIConfig),
|
||||
#endif
|
||||
ENDCFGSTRUCT
|
||||
};
|
||||
|
||||
static void SaveConfig(void)
|
||||
{
|
||||
char tdir[2048];
|
||||
sprintf(tdir,"%s"PSS"fceu98.cfg",DrBaseDirectory);
|
||||
FCEUI_GetNTSCTH(&ntsctint, &ntschue);
|
||||
SaveFCEUConfig(tdir,fceuconfig);
|
||||
}
|
||||
|
||||
static void LoadConfig(void)
|
||||
{
|
||||
char tdir[2048];
|
||||
sprintf(tdir,"%s"PSS"fceu98.cfg",DrBaseDirectory);
|
||||
FCEUI_GetNTSCTH(&ntsctint, &ntschue); /* Get default settings for if
|
||||
no config file exists. */
|
||||
LoadFCEUConfig(tdir,fceuconfig);
|
||||
InputUserActiveFix();
|
||||
}
|
||||
|
||||
static void CreateDirs(void)
|
||||
{
|
||||
char *subs[7]={"fcs","fcm","snaps","gameinfo","sav","cheats","movie"};
|
||||
char tdir[2048];
|
||||
int x;
|
||||
|
||||
#ifdef WIN32
|
||||
mkdir(DrBaseDirectory);
|
||||
for(x=0;x<6;x++)
|
||||
{
|
||||
sprintf(tdir,"%s"PSS"%s",DrBaseDirectory,subs[x]);
|
||||
mkdir(tdir);
|
||||
}
|
||||
#else
|
||||
mkdir(DrBaseDirectory,S_IRWXU);
|
||||
for(x=0;x<6;x++)
|
||||
{
|
||||
sprintf(tdir,"%s"PSS"%s",DrBaseDirectory,subs[x]);
|
||||
mkdir(tdir,S_IRWXU);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef WIN32
|
||||
static void SetSignals(void (*t)(int))
|
||||
{
|
||||
int sigs[11]={SIGINT,SIGTERM,SIGHUP,SIGPIPE,SIGSEGV,SIGFPE,SIGKILL,SIGALRM,SIGABRT,SIGUSR1,SIGUSR2};
|
||||
int x;
|
||||
for(x=0;x<11;x++)
|
||||
signal(sigs[x],t);
|
||||
}
|
||||
|
||||
static void CloseStuff(int signum)
|
||||
{
|
||||
DriverKill();
|
||||
printf("\nSignal %d has been caught and dealt with...\n",signum);
|
||||
switch(signum)
|
||||
{
|
||||
case SIGINT:printf("How DARE you interrupt me!\n");break;
|
||||
case SIGTERM:printf("MUST TERMINATE ALL HUMANS\n");break;
|
||||
case SIGHUP:printf("Reach out and hang-up on someone.\n");break;
|
||||
case SIGPIPE:printf("The pipe has broken! Better watch out for floods...\n");break;
|
||||
case SIGSEGV:printf("Iyeeeeeeeee!!! A segmentation fault has occurred. Have a fluffy day.\n");break;
|
||||
/* So much SIGBUS evil. */
|
||||
#ifdef SIGBUS
|
||||
#if(SIGBUS!=SIGSEGV)
|
||||
case SIGBUS:printf("I told you to be nice to the driver.\n");break;
|
||||
#endif
|
||||
#endif
|
||||
case SIGFPE:printf("Those darn floating points. Ne'er know when they'll bite!\n");break;
|
||||
case SIGALRM:printf("Don't throw your clock at the meowing cats!\n");break;
|
||||
case SIGABRT:printf("Abort, Retry, Ignore, Fail?\n");break;
|
||||
case SIGUSR1:
|
||||
case SIGUSR2:printf("Killing your processes is not nice.\n");break;
|
||||
}
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void DoArgs(int argc, char *argv[])
|
||||
{
|
||||
int x;
|
||||
|
||||
static ARGPSTRUCT FCEUArgs[]={
|
||||
{"-soundbufsize",0,&soundbufsize,0},
|
||||
{"-soundrate",0,&soundrate,0},
|
||||
{"-soundq",0,&soundq,0},
|
||||
#ifdef FRAMESKIP
|
||||
{"-frameskip",0,&frameskip,0},
|
||||
#endif
|
||||
{"-sound",0,&_sound,0},
|
||||
{"-soundvol",0,&soundvol,0},
|
||||
{"-cpalette",0,&cpalette,0x4001},
|
||||
{"-soundrecord",0,&soundrecfn,0x4001},
|
||||
|
||||
{"-ntsccol",0,&ntsccol,0},
|
||||
{"-pal",0,&eoptions,0x8000|EO_PAL},
|
||||
|
||||
{"-lowpass",0,&eoptions,0x8000|EO_LOWPASS},
|
||||
{"-gg",0,&eoptions,0x8000|EO_GAMEGENIE},
|
||||
{"-no8lim",0,&eoptions,0x8001},
|
||||
{"-snapname",0,&eoptions,0x8000|EO_SNAPNAME},
|
||||
{"-nofs",0,&eoptions,0x8000|EO_NOFOURSCORE},
|
||||
{"-clipsides",0,&eoptions,0x8000|EO_CLIPSIDES},
|
||||
{"-nothrottle",0,&eoptions,0x8000|EO_NOTHROTTLE},
|
||||
{"-slstart",0,&srendlinev[0],0},{"-slend",0,&erendlinev[0],0},
|
||||
{"-slstartp",0,&srendlinev[1],0},{"-slendp",0,&erendlinev[1],0},
|
||||
{0,(int *)InputArgs,0,0},
|
||||
{0,(int *)DriverArgs,0,0},
|
||||
{0,0,0,0}
|
||||
};
|
||||
|
||||
ParseArguments(argc, argv, FCEUArgs);
|
||||
if(cpalette)
|
||||
{
|
||||
if(cpalette[0]=='0')
|
||||
if(cpalette[1]==0)
|
||||
{
|
||||
free(cpalette);
|
||||
cpalette=0;
|
||||
}
|
||||
}
|
||||
FCEUI_SetVidSystem((eoptions&EO_PAL)?1:0);
|
||||
FCEUI_SetGameGenie((eoptions&EO_GAMEGENIE)?1:0);
|
||||
FCEUI_SetLowPass((eoptions&EO_LOWPASS)?1:0);
|
||||
|
||||
FCEUI_DisableSpriteLimitation(eoptions&1);
|
||||
FCEUI_SetSnapName(eoptions&EO_SNAPNAME);
|
||||
|
||||
for(x=0;x<2;x++)
|
||||
{
|
||||
if(srendlinev[x]<0 || srendlinev[x]>239) srendlinev[x]=0;
|
||||
if(erendlinev[x]<srendlinev[x] || erendlinev[x]>239) erendlinev[x]=239;
|
||||
}
|
||||
|
||||
FCEUI_SetRenderedLines(srendlinev[0],erendlinev[0],srendlinev[1],erendlinev[1]);
|
||||
DoDriverArgs();
|
||||
}
|
||||
|
||||
#include "usage.h"
|
||||
|
||||
/* Loads a game, given a full path/filename. The driver code must be
|
||||
initialized after the game is loaded, because the emulator code
|
||||
provides data necessary for the driver code(number of scanlines to
|
||||
render, what virtual input devices to use, etc.).
|
||||
*/
|
||||
int LoadGame(const char *path)
|
||||
{
|
||||
FCEUGI *tmp;
|
||||
|
||||
CloseGame();
|
||||
if(!(tmp=FCEUI_LoadGame(path,1)))
|
||||
return 0;
|
||||
CurGame=tmp;
|
||||
ParseGI(tmp);
|
||||
RefreshThrottleFPS();
|
||||
|
||||
if(!DriverInitialize(tmp))
|
||||
return(0);
|
||||
if(soundrecfn)
|
||||
{
|
||||
if(!FCEUI_BeginWaveRecord(soundrecfn))
|
||||
{
|
||||
free(soundrecfn);
|
||||
soundrecfn=0;
|
||||
}
|
||||
}
|
||||
isloaded=1;
|
||||
#ifdef EXTGUI
|
||||
if(eoptions&EO_AUTOHIDE) GUI_Hide(1);
|
||||
#endif
|
||||
|
||||
FCEUD_NetworkConnect();
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Closes a game. Frees memory, and deinitializes the drivers. */
|
||||
int CloseGame(void)
|
||||
{
|
||||
if(!isloaded) return(0);
|
||||
FCEUI_CloseGame();
|
||||
DriverKill();
|
||||
isloaded=0;
|
||||
CurGame=0;
|
||||
|
||||
if(soundrecfn)
|
||||
FCEUI_EndWaveRecord();
|
||||
|
||||
#ifdef EXTGUI
|
||||
GUI_Hide(0);
|
||||
#endif
|
||||
InputUserActiveFix();
|
||||
return(1);
|
||||
}
|
||||
|
||||
void FCEUD_Update(uint8 *XBuf, int32 *Buffer, int Count);
|
||||
|
||||
void DoFun(void)
|
||||
{
|
||||
uint8 *gfx;
|
||||
int32 *sound;
|
||||
int32 ssize;
|
||||
static int fskipc=0;
|
||||
static int opause=0;
|
||||
|
||||
#ifdef FRAMESKIP
|
||||
fskipc=(fskipc+1)%(frameskip+1);
|
||||
#endif
|
||||
|
||||
if(NoWaiting) {gfx=0;}
|
||||
FCEUI_Emulate(&gfx, &sound, &ssize, fskipc);
|
||||
FCEUD_Update(gfx, sound, ssize);
|
||||
|
||||
if(opause!=FCEUI_EmulationPaused())
|
||||
{
|
||||
opause=FCEUI_EmulationPaused();
|
||||
SilenceSound(opause);
|
||||
}
|
||||
}
|
||||
|
||||
int CLImain(int argc, char *argv[])
|
||||
{
|
||||
int ret;
|
||||
|
||||
if(!(ret=FCEUI_Initialize()))
|
||||
return(0);
|
||||
|
||||
DrBaseDirectory=GetBaseDirectory();
|
||||
FCEUI_SetBaseDirectory(DrBaseDirectory);
|
||||
|
||||
CreateDirs();
|
||||
|
||||
#ifdef EXTGUI
|
||||
if(argc==2 && !strcmp(argv[1],"-help")) // I hope no one has a game named "-help" :b
|
||||
#else
|
||||
if(argc<=1)
|
||||
#endif
|
||||
{
|
||||
ShowUsage(argv[0]);
|
||||
return(0);
|
||||
}
|
||||
|
||||
LoadConfig();
|
||||
DoArgs(argc-2,&argv[1]);
|
||||
FCEUI_SetNTSCTH(ntsccol, ntsctint, ntschue);
|
||||
if(cpalette)
|
||||
LoadCPalette();
|
||||
|
||||
/* All the config files and arguments are parsed now. */
|
||||
#ifdef EXTGUI
|
||||
return(1);
|
||||
|
||||
#else
|
||||
if(!LoadGame(argv[argc-1]))
|
||||
{
|
||||
DriverKill();
|
||||
return(0);
|
||||
}
|
||||
|
||||
while(CurGame)
|
||||
DoFun();
|
||||
|
||||
#if(0)
|
||||
{
|
||||
int x;
|
||||
for(x=1;x<argc;x++)
|
||||
{ LoadGame(argv[x]); while(CurGame) DoFun(); }
|
||||
}
|
||||
#endif
|
||||
|
||||
CloseGame();
|
||||
|
||||
SaveConfig();
|
||||
|
||||
FCEUI_Kill();
|
||||
|
||||
#endif
|
||||
return(1);
|
||||
}
|
||||
|
||||
static int DriverInitialize(FCEUGI *gi)
|
||||
{
|
||||
#ifndef WIN32
|
||||
SetSignals(CloseStuff);
|
||||
#endif
|
||||
|
||||
/* Initialize video before all else, due to some wacko dependencies
|
||||
in the SexyAL code(DirectSound) that need to be fixed.
|
||||
*/
|
||||
|
||||
if(!InitVideo(gi)) return 0;
|
||||
inited|=4;
|
||||
|
||||
if(InitSound(gi))
|
||||
inited|=1;
|
||||
|
||||
if(InitJoysticks())
|
||||
inited|=2;
|
||||
|
||||
if(!InitKeyboard()) return 0;
|
||||
inited|=8;
|
||||
|
||||
InitOtherInput();
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void DriverKill(void)
|
||||
{
|
||||
SaveConfig();
|
||||
|
||||
#ifndef WIN32
|
||||
SetSignals(SIG_IGN);
|
||||
#endif
|
||||
|
||||
if(inited&2)
|
||||
KillJoysticks();
|
||||
if(inited&8)
|
||||
KillKeyboard();
|
||||
if(inited&4)
|
||||
KillVideo();
|
||||
if(inited&1)
|
||||
KillSound();
|
||||
if(inited&16)
|
||||
KillMouse();
|
||||
inited=0;
|
||||
}
|
||||
|
||||
void FCEUD_Update(uint8 *XBuf, int32 *Buffer, int Count)
|
||||
{
|
||||
#ifdef NETWORK
|
||||
extern int FCEUDnetplay;
|
||||
#endif
|
||||
|
||||
int ocount = Count;
|
||||
// apply frame scaling to Count
|
||||
Count = (Count<<8)/fps_scale;
|
||||
if(Count)
|
||||
{
|
||||
int32 can=GetWriteSound();
|
||||
static int uflow=0;
|
||||
int32 tmpcan;
|
||||
|
||||
// don't underflow when scaling fps
|
||||
if(can >= GetMaxSound() && fps_scale<=256) uflow=1; /* Go into massive underflow mode. */
|
||||
|
||||
if(can > Count) can=Count;
|
||||
else uflow=0;
|
||||
|
||||
WriteSound(Buffer,can);
|
||||
|
||||
//if(uflow) puts("Underflow");
|
||||
tmpcan = GetWriteSound();
|
||||
// don't underflow when scaling fps
|
||||
if(fps_scale>256 || ((tmpcan < Count*0.90) && !uflow))
|
||||
{
|
||||
if(XBuf && (inited&4) && !(NoWaiting & 2))
|
||||
BlitScreen(XBuf);
|
||||
Buffer+=can;
|
||||
Count-=can;
|
||||
if(Count)
|
||||
{
|
||||
if(NoWaiting)
|
||||
{
|
||||
can=GetWriteSound();
|
||||
if(Count>can) Count=can;
|
||||
WriteSound(Buffer,Count);
|
||||
}
|
||||
else
|
||||
{
|
||||
while(Count>0)
|
||||
{
|
||||
WriteSound(Buffer,(Count<ocount) ? Count : ocount);
|
||||
Count -= ocount;
|
||||
}
|
||||
}
|
||||
}
|
||||
} //else puts("Skipped");
|
||||
#ifdef NETWORK
|
||||
else if(!NoWaiting && FCEUDnetplay && (uflow || tmpcan >= (Count * 1.8)))
|
||||
{
|
||||
if(Count > tmpcan) Count=tmpcan;
|
||||
while(tmpcan > 0)
|
||||
{
|
||||
// printf("Overwrite: %d\n", (Count <= tmpcan)?Count : tmpcan);
|
||||
WriteSound(Buffer, (Count <= tmpcan)?Count : tmpcan);
|
||||
tmpcan -= Count;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!NoWaiting && (!(eoptions&EO_NOTHROTTLE) || FCEUI_EmulationPaused()))
|
||||
SpeedThrottle();
|
||||
if(XBuf && (inited&4))
|
||||
{
|
||||
BlitScreen(XBuf);
|
||||
}
|
||||
}
|
||||
FCEUD_UpdateInput();
|
||||
//if(!Count && !NoWaiting && !(eoptions&EO_NOTHROTTLE))
|
||||
// SpeedThrottle();
|
||||
//if(XBuf && (inited&4))
|
||||
//{
|
||||
// BlitScreen(XBuf);
|
||||
//}
|
||||
//if(Count)
|
||||
// WriteSound(Buffer,Count,NoWaiting);
|
||||
//FCEUD_UpdateInput();
|
||||
}
|
||||
|
||||
|
||||
/* Maybe ifndef WXWINDOWS would be better? ^_^ */
|
||||
#ifndef EXTGUI
|
||||
FILE *FCEUD_UTF8fopen(const char *fn, const char *mode)
|
||||
{
|
||||
return(fopen(fn,mode));
|
||||
}
|
||||
|
||||
|
||||
#endif
|
|
@ -0,0 +1,432 @@
|
|||
/* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "sdl.h"
|
||||
#include "sdl-opengl.h"
|
||||
#include "../common/vidblit.h"
|
||||
|
||||
#include "sdl-icon.h"
|
||||
#include "dface.h"
|
||||
|
||||
SDL_Surface *screen;
|
||||
SDL_Surface *BlitBuf; // Used as a buffer when using hardware-accelerated blits.
|
||||
SDL_Surface *IconSurface=NULL;
|
||||
|
||||
static int curbpp;
|
||||
static int srendline,erendline;
|
||||
static int tlines;
|
||||
static int inited=0;
|
||||
|
||||
#ifdef OPENGL
|
||||
extern int sdlhaveogl;
|
||||
static int usingogl;
|
||||
static double exs,eys;
|
||||
#else
|
||||
static int exs,eys;
|
||||
#endif
|
||||
static int eefx;
|
||||
|
||||
#define NWIDTH (256-((eoptions&EO_CLIPSIDES)?16:0))
|
||||
#define NOFFSET (eoptions&EO_CLIPSIDES?8:0)
|
||||
|
||||
|
||||
static int paletterefresh;
|
||||
|
||||
/* Return 1 if video was killed, 0 otherwise(video wasn't initialized). */
|
||||
int KillVideo(void)
|
||||
{
|
||||
if(IconSurface)
|
||||
{
|
||||
SDL_FreeSurface(IconSurface);
|
||||
IconSurface=0;
|
||||
}
|
||||
|
||||
if(inited&1)
|
||||
{
|
||||
#ifdef OPENGL
|
||||
if(usingogl)
|
||||
KillOpenGL();
|
||||
else
|
||||
#endif
|
||||
if(curbpp>8)
|
||||
KillBlitToHigh();
|
||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||
inited&=~1;
|
||||
return(1);
|
||||
}
|
||||
inited=0;
|
||||
return(0);
|
||||
}
|
||||
|
||||
static int sponge;
|
||||
|
||||
int InitVideo(FCEUGI *gi)
|
||||
{
|
||||
const SDL_VideoInfo *vinf;
|
||||
int flags=0;
|
||||
|
||||
FCEUI_printf("Initializing video...");
|
||||
|
||||
FCEUI_GetCurrentVidSystem(&srendline,&erendline);
|
||||
|
||||
if(_fullscreen) sponge=Settings.specialfs;
|
||||
else sponge=Settings.special;
|
||||
|
||||
|
||||
#ifdef OPENGL
|
||||
usingogl=0;
|
||||
if(_opengl && sdlhaveogl && !sponge)
|
||||
{
|
||||
flags=SDL_OPENGL;
|
||||
usingogl=1;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef EXTGUI
|
||||
GUI_SetVideo(_fullscreen, 0, 0);
|
||||
#endif
|
||||
|
||||
if(!(SDL_WasInit(SDL_INIT_VIDEO)&SDL_INIT_VIDEO))
|
||||
if(SDL_InitSubSystem(SDL_INIT_VIDEO)==-1)
|
||||
{
|
||||
FCEUD_PrintError(SDL_GetError());
|
||||
return(0);
|
||||
}
|
||||
inited|=1;
|
||||
|
||||
SDL_ShowCursor(0);
|
||||
tlines=erendline-srendline+1;
|
||||
|
||||
vinf=SDL_GetVideoInfo();
|
||||
|
||||
if(vinf->hw_available)
|
||||
flags|=SDL_HWSURFACE;
|
||||
|
||||
if(_fullscreen)
|
||||
flags|=SDL_FULLSCREEN;
|
||||
|
||||
flags|=SDL_HWPALETTE;
|
||||
|
||||
//flags|=SDL_DOUBLEBUF;
|
||||
#ifdef OPENGL
|
||||
if(usingogl)
|
||||
{
|
||||
FCEU_printf("\n Initializing with OpenGL(Use \"-opengl 0\" to disable).\n");
|
||||
if(_doublebuf)
|
||||
SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if(_doublebuf && (flags&SDL_HWSURFACE))
|
||||
flags|=SDL_DOUBLEBUF;
|
||||
|
||||
if(_fullscreen)
|
||||
{
|
||||
int desbpp=_bpp;
|
||||
|
||||
exs=_xscalefs;
|
||||
eys=_yscalefs;
|
||||
eefx=_efxfs;
|
||||
|
||||
#ifdef OPENGL
|
||||
if(!usingogl) {exs=(int)exs;eys=(int)eys;}
|
||||
else desbpp=0;
|
||||
|
||||
if(sponge)
|
||||
{
|
||||
exs=eys=2;
|
||||
if(sponge == 3 || sponge == 4) exs = eys = 3;
|
||||
eefx=0;
|
||||
if(sponge == 1 || sponge == 3) desbpp = 32;
|
||||
}
|
||||
|
||||
|
||||
if( (usingogl && !_stretchx) || !usingogl)
|
||||
#endif
|
||||
if(_xres<NWIDTH*exs || exs <= 0.01)
|
||||
{
|
||||
FCEUD_PrintError("xscale out of bounds.");
|
||||
KillVideo();
|
||||
return(0);
|
||||
}
|
||||
|
||||
#ifdef OPENGL
|
||||
if( (usingogl && !_stretchy) || !usingogl)
|
||||
#endif
|
||||
if(_yres<tlines*eys || eys <= 0.01)
|
||||
{
|
||||
FCEUD_PrintError("yscale out of bounds.");
|
||||
KillVideo();
|
||||
return(0);
|
||||
}
|
||||
|
||||
#ifdef EXTGUI
|
||||
GUI_SetVideo(_fullscreen, _xres, _yres);
|
||||
#endif
|
||||
|
||||
#ifdef OPENGL
|
||||
if(!(screen = SDL_SetVideoMode(_xres, _yres, desbpp, flags)))
|
||||
#else
|
||||
if(!(screen = SDL_SetVideoMode(_xres, _yres, desbpp, flags)))
|
||||
#endif
|
||||
{
|
||||
FCEUD_PrintError(SDL_GetError());
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int desbpp=0;
|
||||
|
||||
exs=_xscale;
|
||||
eys=_yscale;
|
||||
eefx=_efx;
|
||||
|
||||
if(sponge)
|
||||
{
|
||||
exs=eys=2;
|
||||
if(sponge >= 3) exs=eys=3;
|
||||
eefx=0;
|
||||
// SDL's 32bpp->16bpp code is slighty faster than mine, at least :/
|
||||
if(sponge == 1 || sponge == 3) desbpp=32;
|
||||
}
|
||||
|
||||
#ifdef OPENGL
|
||||
if(!usingogl) {exs=(int)exs;eys=(int)eys;}
|
||||
if(exs <= 0.01)
|
||||
{
|
||||
FCEUD_PrintError("xscale out of bounds.");
|
||||
KillVideo();
|
||||
return(0);
|
||||
}
|
||||
if(eys <= 0.01)
|
||||
{
|
||||
FCEUD_PrintError("yscale out of bounds.");
|
||||
KillVideo();
|
||||
return(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef EXTGUI
|
||||
GUI_SetVideo(_fullscreen, (NWIDTH*exs), tlines*eys);
|
||||
#endif
|
||||
|
||||
screen = SDL_SetVideoMode((NWIDTH*exs), tlines*eys, desbpp, flags);
|
||||
}
|
||||
curbpp=screen->format->BitsPerPixel;
|
||||
if(!screen)
|
||||
{
|
||||
FCEUD_PrintError(SDL_GetError());
|
||||
KillVideo();
|
||||
return(0);
|
||||
}
|
||||
//BlitBuf=SDL_CreateRGBSurface(SDL_HWSURFACE,256,240,screen->format->BitsPerPixel,screen->format->Rmask,screen->format->Gmask,screen->format->Bmask,0);
|
||||
|
||||
inited=1;
|
||||
|
||||
FCEU_printf(" Video Mode: %d x %d x %d bpp %s\n",screen->w,screen->h,screen->format->BitsPerPixel,_fullscreen?"full screen":"");
|
||||
if(curbpp!=16 && curbpp!=24 && curbpp!=8 && curbpp!=32)
|
||||
{
|
||||
FCEU_printf(" Sorry, %dbpp modes are not supported by FCE Ultra. Supported bit depths are 8bpp, 16bpp, and 32bpp.\n",curbpp);
|
||||
KillVideo();
|
||||
return(0);
|
||||
}
|
||||
|
||||
if(gi->name)
|
||||
SDL_WM_SetCaption(gi->name,gi->name);
|
||||
else
|
||||
SDL_WM_SetCaption("FCE Ultra","FCE Ultra");
|
||||
|
||||
#ifdef LSB_FIRST
|
||||
IconSurface=SDL_CreateRGBSurfaceFrom((void *)fceu_playicon.pixel_data,32,32,24,32*3,0xFF,0xFF00,0xFF0000,0x00);
|
||||
#else
|
||||
IconSurface=SDL_CreateRGBSurfaceFrom((void *)fceu_playicon.pixel_data,32,32,24,32*3,0xFF0000,0xFF00,0xFF,0x00);
|
||||
#endif
|
||||
|
||||
SDL_WM_SetIcon(IconSurface,0);
|
||||
|
||||
paletterefresh=1;
|
||||
|
||||
if(curbpp>8)
|
||||
#ifdef OPENGL
|
||||
if(!usingogl)
|
||||
#endif
|
||||
InitBlitToHigh(curbpp>>3,screen->format->Rmask,screen->format->Gmask,screen->format->Bmask,eefx,sponge);
|
||||
#ifdef OPENGL
|
||||
if(usingogl)
|
||||
if(!InitOpenGL((eoptions&EO_CLIPSIDES)?8:0,256-((eoptions&EO_CLIPSIDES)?8:0),srendline,erendline+1,exs,eys,eefx,_openglip,_stretchx,_stretchy,screen))
|
||||
{
|
||||
FCEUD_PrintError("Error initializing OpenGL.");
|
||||
KillVideo();
|
||||
return(0);
|
||||
}
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
void ToggleFS(void)
|
||||
{
|
||||
extern FCEUGI *CurGame;
|
||||
KillVideo();
|
||||
_fullscreen=!_fullscreen;
|
||||
|
||||
if(!InitVideo(CurGame))
|
||||
{
|
||||
_fullscreen=!_fullscreen;
|
||||
InitVideo(CurGame);
|
||||
}
|
||||
}
|
||||
|
||||
static SDL_Color psdl[256];
|
||||
void FCEUD_SetPalette(uint8 index, uint8 r, uint8 g, uint8 b)
|
||||
{
|
||||
psdl[index].r=r;
|
||||
psdl[index].g=g;
|
||||
psdl[index].b=b;
|
||||
|
||||
paletterefresh=1;
|
||||
}
|
||||
|
||||
void FCEUD_GetPalette(uint8 index, uint8 *r, uint8 *g, uint8 *b)
|
||||
{
|
||||
*r=psdl[index].r;
|
||||
*g=psdl[index].g;
|
||||
*b=psdl[index].b;
|
||||
}
|
||||
|
||||
static void RedoPalette(void)
|
||||
{
|
||||
#ifdef OPENGL
|
||||
if(usingogl)
|
||||
SetOpenGLPalette((uint8*)psdl);
|
||||
else
|
||||
#endif
|
||||
{
|
||||
if(curbpp>8)
|
||||
SetPaletteBlitToHigh((uint8*)psdl);
|
||||
else
|
||||
{
|
||||
SDL_SetPalette(screen,SDL_PHYSPAL,psdl,0,256);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LockConsole(){}
|
||||
void UnlockConsole(){}
|
||||
void BlitScreen(uint8 *XBuf)
|
||||
{
|
||||
SDL_Surface *TmpScreen;
|
||||
uint8 *dest;
|
||||
int xo=0,yo=0;
|
||||
|
||||
if(!screen) return;
|
||||
|
||||
if(paletterefresh)
|
||||
{
|
||||
RedoPalette();
|
||||
paletterefresh=0;
|
||||
}
|
||||
|
||||
#ifdef OPENGL
|
||||
if(usingogl)
|
||||
{
|
||||
BlitOpenGL(XBuf);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
XBuf+=srendline*256;
|
||||
|
||||
if(BlitBuf) TmpScreen=BlitBuf;
|
||||
else TmpScreen=screen;
|
||||
|
||||
if(SDL_MUSTLOCK(TmpScreen))
|
||||
if(SDL_LockSurface(TmpScreen))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
dest=(uint8*)TmpScreen->pixels;
|
||||
|
||||
if(_fullscreen)
|
||||
{
|
||||
xo=(((TmpScreen->w-NWIDTH*exs))/2);
|
||||
dest+=xo*(curbpp>>3);
|
||||
if(TmpScreen->h>(tlines*eys))
|
||||
{
|
||||
yo=((TmpScreen->h-tlines*eys)/2);
|
||||
dest+=yo*TmpScreen->pitch;
|
||||
}
|
||||
}
|
||||
|
||||
if(curbpp>8)
|
||||
{
|
||||
if(BlitBuf)
|
||||
Blit8ToHigh(XBuf+NOFFSET,dest, NWIDTH, tlines, TmpScreen->pitch,1,1);
|
||||
else
|
||||
Blit8ToHigh(XBuf+NOFFSET,dest, NWIDTH, tlines, TmpScreen->pitch,exs,eys);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(BlitBuf)
|
||||
Blit8To8(XBuf+NOFFSET,dest, NWIDTH, tlines, TmpScreen->pitch,1,1,0,sponge);
|
||||
else
|
||||
Blit8To8(XBuf+NOFFSET,dest, NWIDTH, tlines, TmpScreen->pitch,exs,eys,eefx,sponge);
|
||||
}
|
||||
if(SDL_MUSTLOCK(TmpScreen))
|
||||
SDL_UnlockSurface(TmpScreen);
|
||||
|
||||
if(BlitBuf)
|
||||
{
|
||||
SDL_Rect srect;
|
||||
SDL_Rect drect;
|
||||
|
||||
srect.x=0;
|
||||
srect.y=0;
|
||||
srect.w=NWIDTH;
|
||||
srect.h=tlines;
|
||||
|
||||
drect.x=0;
|
||||
drect.y=0;
|
||||
drect.w=exs*NWIDTH;
|
||||
drect.h=eys*tlines;
|
||||
|
||||
SDL_BlitSurface(BlitBuf, &srect,screen,&drect);
|
||||
}
|
||||
|
||||
SDL_UpdateRect(screen, xo, yo, NWIDTH*exs, tlines*eys);
|
||||
|
||||
if(screen->flags&SDL_DOUBLEBUF)
|
||||
SDL_Flip(screen);
|
||||
}
|
||||
|
||||
uint32 PtoV(uint16 x, uint16 y)
|
||||
{
|
||||
y=(double)y/eys;
|
||||
x=(double)x/exs;
|
||||
if(eoptions&EO_CLIPSIDES)
|
||||
x+=8;
|
||||
y+=srendline;
|
||||
return(x|(y<<16));
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
# C/C++ with GCC
|
||||
# Build your C/C++ project with GCC using make.
|
||||
# Add steps that publish test results, save build artifacts, deploy, and more:
|
||||
# https://docs.microsoft.com/azure/devops/pipelines/apps/c-cpp/gcc
|
||||
|
||||
trigger:
|
||||
- master
|
||||
- development
|
||||
|
||||
pool:
|
||||
vmImage: 'ubuntu-latest'
|
||||
|
||||
steps:
|
||||
- script: |
|
||||
./pipelines/linux_build.sh
|
||||
displayName: 'make'
|
|
@ -0,0 +1,75 @@
|
|||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2006 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 uint8 reg[4];
|
||||
static SFORMAT StateRegs[]=
|
||||
{
|
||||
{reg, 4, "REGS"},
|
||||
{0}
|
||||
};
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setprg32(0x8000,(reg[2]>>2)&1);
|
||||
setchr8(reg[2]&3);
|
||||
}
|
||||
|
||||
static DECLFW(UNL22211WriteLo)
|
||||
{
|
||||
// FCEU_printf("bs %04x %02x\n",A,V);
|
||||
reg[A&3]=V;
|
||||
}
|
||||
|
||||
static DECLFW(UNL22211WriteHi)
|
||||
{
|
||||
// FCEU_printf("bs %04x %02x\n",A,V);
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFR(UNL22211ReadLo)
|
||||
{
|
||||
if(reg[3])
|
||||
return reg[2];
|
||||
else
|
||||
return X.DB;
|
||||
}
|
||||
|
||||
static void UNL22211Power(void)
|
||||
{
|
||||
Sync();
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
SetReadHandler(0x4100,0x4100,UNL22211ReadLo);
|
||||
SetWriteHandler(0x4100,0x4103,UNL22211WriteLo);
|
||||
SetWriteHandler(0x8000,0xFFFF,UNL22211WriteHi);
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
Sync();
|
||||
}
|
||||
|
||||
void UNL22211_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=UNL22211Power;
|
||||
GameStateRestore=StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 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 uint8 reg[8];
|
||||
static uint8 mirror, cmd;
|
||||
static uint8 *WRAM=NULL;
|
||||
|
||||
static SFORMAT StateRegs[]=
|
||||
{
|
||||
{&cmd, 1, "CMD"},
|
||||
{&mirror, 1, "MIRR"},
|
||||
{reg, 8, "REGS"},
|
||||
{0}
|
||||
};
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setmirror(mirror^1);
|
||||
setprg8(0x8000,reg[0]);
|
||||
setprg8(0xA000,reg[1]);
|
||||
setchr2(0x0000,reg[2]>>1);
|
||||
setchr2(0x0800,reg[3]>>1);
|
||||
setchr1(0x1000,reg[4]);
|
||||
setchr1(0x1400,reg[5]);
|
||||
setchr1(0x1800,reg[6]);
|
||||
setchr1(0x1C00,reg[7]);
|
||||
}
|
||||
|
||||
static DECLFW(M112Write)
|
||||
{
|
||||
// FCEU_printf("bs %04x %02x\n",A,V);
|
||||
switch(A)
|
||||
{
|
||||
case 0xe000: mirror=V&1; Sync(); ;break;
|
||||
case 0x8000: cmd=V&7; break;
|
||||
case 0xa000: reg[cmd]=V; Sync(); break;
|
||||
// default: FCEU_printf("bs %04x %02x\n",A,V);
|
||||
}
|
||||
}
|
||||
|
||||
static void M112Close(void)
|
||||
{
|
||||
if(WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
|
||||
static void M112Power(void)
|
||||
{
|
||||
setprg16(0xC000,~0);
|
||||
setprg8r(0x10,0x6000,0);
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
SetWriteHandler(0x8000,0xFFFF,M112Write);
|
||||
SetWriteHandler(0x4020,0x5FFF,M112Write);
|
||||
SetReadHandler(0x6000,0x7FFF,CartBR);
|
||||
SetWriteHandler(0x6000,0x7FFF,CartBW);
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper112_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=M112Power;
|
||||
info->Close=M112Close;
|
||||
GameStateRestore=StateRestore;
|
||||
WRAM=(uint8*)FCEU_gmalloc(8192);
|
||||
SetupCartPRGMapping(0x10,WRAM,8192,1);
|
||||
AddExState(WRAM, 8192, 0, "WRAM");
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
|
@ -0,0 +1,101 @@
|
|||
/* 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 prgreg[4], chrreg[8];
|
||||
static uint8 IRQa, IRQCount, IRQLatch;
|
||||
|
||||
static SFORMAT StateRegs[]=
|
||||
{
|
||||
{&IRQa, 1, "IRQA"},
|
||||
{&IRQCount, 1, "IRQC"},
|
||||
{&IRQLatch, 1, "IRQL"},
|
||||
{prgreg, 4, "PREGS"},
|
||||
{chrreg, 8, "CREGS"},
|
||||
{0}
|
||||
};
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
int i;
|
||||
setprg8(0x8000,prgreg[0]);
|
||||
setprg8(0xa000,prgreg[1]);
|
||||
setprg8(0xc000,prgreg[2]);
|
||||
setprg8(0xe000,prgreg[3]);
|
||||
for(i=0; i<8; i++)
|
||||
setchr1(i<<10,chrreg[i]);
|
||||
}
|
||||
|
||||
static DECLFW(M117Write)
|
||||
{
|
||||
if(A<0x8004)
|
||||
{
|
||||
prgreg[A&3]=V;
|
||||
Sync();
|
||||
}
|
||||
else if((A>=0xA000)&&(A<=0xA007))
|
||||
{
|
||||
chrreg[A&7]=V;
|
||||
Sync();
|
||||
}
|
||||
else 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;
|
||||
}
|
||||
}
|
||||
|
||||
static void M117Power(void)
|
||||
{
|
||||
prgreg[0]=~3; prgreg[1]=~2; prgreg[2]=~1; prgreg[3]=~0;
|
||||
Sync();
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
SetWriteHandler(0x8000,0xFFFF,M117Write);
|
||||
}
|
||||
|
||||
static void M117IRQHook(void)
|
||||
{
|
||||
if(IRQa==3&&IRQCount)
|
||||
{
|
||||
IRQCount--;
|
||||
if(!IRQCount)
|
||||
{
|
||||
IRQa&=1;
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper117_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=M117Power;
|
||||
GameHBIRQHook=M117IRQHook;
|
||||
GameStateRestore=StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
|
@ -0,0 +1,117 @@
|
|||
/* 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,0xFFFF,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,0xFFFF,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);
|
||||
}
|
|
@ -0,0 +1,117 @@
|
|||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 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
|
||||
*
|
||||
* Gimmick Bootleg
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 prg[4];
|
||||
static uint8 chr[8];
|
||||
static uint8 IRQCount;
|
||||
static uint8 IRQPre;
|
||||
static uint8 IRQa;
|
||||
|
||||
static SFORMAT StateRegs[]=
|
||||
{
|
||||
{prg, 4, "PRG"},
|
||||
{chr, 8, "CHR"},
|
||||
{&IRQCount, 1, "IRQCOUNT"},
|
||||
{&IRQPre, 1, "IRQPRE"},
|
||||
{&IRQa, 1, "IRQA"},
|
||||
{0}
|
||||
};
|
||||
|
||||
static void SyncPrg(void)
|
||||
{
|
||||
setprg8(0x6000,0);
|
||||
setprg8(0x8000,prg[0]);
|
||||
setprg8(0xA000,prg[1]);
|
||||
setprg8(0xC000,prg[2]);
|
||||
setprg8(0xE000,~0);
|
||||
}
|
||||
|
||||
static void SyncChr(void)
|
||||
{
|
||||
int i;
|
||||
for(i=0; i<8; i++)
|
||||
setchr1(i<<10,chr[i]);
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
SyncPrg();
|
||||
SyncChr();
|
||||
}
|
||||
|
||||
static DECLFW(M183Write)
|
||||
{
|
||||
if(((A&0xF80C)>=0xB000)&&((A&0xF80C)<=0xE00C))
|
||||
{
|
||||
uint8 index=(((A>>11)-6)|(A>>3))&7;
|
||||
chr[index]=(chr[index]&(0xF0>>(A&4)))|((V&0x0F)<<(A&4));
|
||||
SyncChr();
|
||||
}
|
||||
else switch (A&0xF80C)
|
||||
{
|
||||
case 0x8800: prg[0]=V; SyncPrg(); break;
|
||||
case 0xA800: prg[1]=V; SyncPrg(); break;
|
||||
case 0xA000: prg[2]=V; SyncPrg(); break;
|
||||
case 0x9800: 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;
|
||||
}
|
||||
break;
|
||||
case 0xF000: IRQCount=((IRQCount&0xF0)|(V&0xF)); break;
|
||||
case 0xF004: IRQCount=((IRQCount&0x0F)|((V&0xF)<<4)); break;
|
||||
case 0xF008: IRQa=V; if(!V)IRQPre=0; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||
case 0xF00C: IRQPre=16; break;
|
||||
}
|
||||
}
|
||||
|
||||
static void M183IRQCounter(void)
|
||||
{
|
||||
if(IRQa)
|
||||
{
|
||||
IRQCount++;
|
||||
if((IRQCount-IRQPre)==238)
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
}
|
||||
}
|
||||
|
||||
static void M183Power(void)
|
||||
{
|
||||
IRQPre=IRQCount=IRQa=0;
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
SetWriteHandler(0x8000,0xFFFF,M183Write);
|
||||
SetReadHandler(0x6000,0x7FFF,CartBR);
|
||||
SyncPrg();
|
||||
SyncChr();
|
||||
}
|
||||
|
||||
void Mapper183_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=M183Power;
|
||||
GameHBIRQHook=M183IRQCounter;
|
||||
GameStateRestore=StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
|
@ -0,0 +1,115 @@
|
|||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 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 uint8 *DummyCHR=NULL;
|
||||
static uint8 datareg;
|
||||
static void(*Sync)(void);
|
||||
|
||||
|
||||
static SFORMAT StateRegs[]=
|
||||
{
|
||||
{&datareg, 1, "DREG"},
|
||||
{0}
|
||||
};
|
||||
|
||||
// on off
|
||||
//1 0x0F, 0xF0 - Bird Week
|
||||
//2 0x33, 0x00 - B-Wings
|
||||
//3 0x11, 0x00 - Mighty Bomb Jack
|
||||
//4 0x22, 0x20 - Sansuu 1 Nen, Sansuu 2 Nen
|
||||
//5 0xFF, 0x00 - Sansuu 3 Nen
|
||||
//6 0x21, 0x13 - Spy vs Spy
|
||||
//7 0x20, 0x21 - Seicross
|
||||
|
||||
static void Sync185(void)
|
||||
{
|
||||
// little dirty eh? ;_)
|
||||
if((datareg&3)&&(datareg!=0x13)) // 1, 2, 3, 4, 5, 6
|
||||
setchr8(0);
|
||||
else
|
||||
setchr8r(0x10,0);
|
||||
}
|
||||
|
||||
static void Sync181(void)
|
||||
{
|
||||
if(!(datareg&1)) // 7
|
||||
setchr8(0);
|
||||
else
|
||||
setchr8r(0x10,0);
|
||||
}
|
||||
|
||||
static DECLFW(MWrite)
|
||||
{
|
||||
datareg=V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void MPower(void)
|
||||
{
|
||||
datareg=0;
|
||||
Sync();
|
||||
setprg16(0x8000,0);
|
||||
setprg16(0xC000,~0);
|
||||
SetWriteHandler(0x8000,0xFFFF,MWrite);
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
}
|
||||
|
||||
static void MClose(void)
|
||||
{
|
||||
if(DummyCHR)
|
||||
FCEU_gfree(DummyCHR);
|
||||
DummyCHR=NULL;
|
||||
}
|
||||
|
||||
static void MRestore(int version)
|
||||
{
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper185_Init(CartInfo *info)
|
||||
{
|
||||
int x;
|
||||
Sync=Sync185;
|
||||
info->Power=MPower;
|
||||
info->Close=MClose;
|
||||
GameStateRestore=MRestore;
|
||||
DummyCHR=(uint8*)FCEU_gmalloc(8192);
|
||||
for(x=0;x<8192;x++)
|
||||
DummyCHR[x]=0xff;
|
||||
SetupCartCHRMapping(0x10,DummyCHR,8192,0);
|
||||
AddExState(StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
void Mapper181_Init(CartInfo *info)
|
||||
{
|
||||
int x;
|
||||
Sync=Sync181;
|
||||
info->Power=MPower;
|
||||
info->Close=MClose;
|
||||
GameStateRestore=MRestore;
|
||||
DummyCHR=(uint8*)FCEU_gmalloc(8192);
|
||||
for(x=0;x<8192;x++)
|
||||
DummyCHR[x]=0xff;
|
||||
SetupCartCHRMapping(0x10,DummyCHR,8192,0);
|
||||
AddExState(StateRegs, ~0, 0, 0);
|
||||
}
|
|
@ -0,0 +1,104 @@
|
|||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 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
|
||||
*
|
||||
* Family Study Box by Fukutake Shoten
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 SWRAM[2816];
|
||||
static uint8 *WRAM=NULL;
|
||||
static uint8 regs[4];
|
||||
|
||||
static SFORMAT StateRegs[]=
|
||||
{
|
||||
{regs, 4, "DREG"},
|
||||
{SWRAM, 2816, "SWRAM"},
|
||||
{0}
|
||||
};
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setprg8r(0x10,0x6000,regs[0]>>6);
|
||||
setprg16(0x8000,regs[1]);
|
||||
setprg16(0xc000,0);
|
||||
}
|
||||
|
||||
static DECLFW(M186Write)
|
||||
{
|
||||
if(A&0x4203) regs[A&3]=V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFR(M186Read)
|
||||
{
|
||||
switch(A)
|
||||
{
|
||||
case 0x4200: return 0x00; break;
|
||||
case 0x4201: return 0x00; break;
|
||||
case 0x4202: return 0x40; break;
|
||||
case 0x4203: return 0x00; break;
|
||||
}
|
||||
return 0xFF;
|
||||
}
|
||||
|
||||
static DECLFR(ASWRAM)
|
||||
{
|
||||
return(SWRAM[A-0x4400]);
|
||||
}
|
||||
static DECLFW(BSWRAM)
|
||||
{
|
||||
SWRAM[A-0x4400]=V;
|
||||
}
|
||||
|
||||
static void M186Power(void)
|
||||
{
|
||||
setchr8(0);
|
||||
SetReadHandler(0x6000,0xFFFF,CartBR);
|
||||
SetWriteHandler(0x6000,0xFFFF,CartBW);
|
||||
SetReadHandler(0x4200,0x43FF,M186Read);
|
||||
SetWriteHandler(0x4200,0x43FF,M186Write);
|
||||
SetReadHandler(0x4400,0x4EFF,ASWRAM);
|
||||
SetWriteHandler(0x4400,0x4EFF,BSWRAM);
|
||||
regs[0]=regs[1]=regs[2]=regs[3];
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M186Close(void)
|
||||
{
|
||||
if(WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
WRAM=NULL;
|
||||
}
|
||||
|
||||
static void M186Restore(int version)
|
||||
{
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper186_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=M186Power;
|
||||
info->Close=M186Close;
|
||||
GameStateRestore=M186Restore;
|
||||
WRAM=(uint8*)FCEU_gmalloc(32768);
|
||||
SetupCartPRGMapping(0x10,WRAM,32768,1);
|
||||
AddExState(WRAM, 32768, 0, "WRAM");
|
||||
AddExState(StateRegs, ~0, 0, 0);
|
||||
}
|
|
@ -0,0 +1,105 @@
|
|||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 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"
|
||||
#include "mmc3.h"
|
||||
#include "../sound.h"
|
||||
|
||||
static void M187CW(uint32 A, uint8 V)
|
||||
{
|
||||
if((A&0x1000)==((MMC3_cmd&0x80)<<5))
|
||||
setchr1(A,V|0x100);
|
||||
else
|
||||
setchr1(A,V);
|
||||
}
|
||||
|
||||
static void M187PW(uint32 A, uint8 V)
|
||||
{
|
||||
if(EXPREGS[0]&0x80)
|
||||
{
|
||||
uint8 bank=EXPREGS[0]&0x1F;
|
||||
if(EXPREGS[0]&0x20)
|
||||
setprg32(0x8000,bank>>2);
|
||||
else
|
||||
{
|
||||
setprg16(0x8000,bank);
|
||||
setprg16(0xC000,bank);
|
||||
}
|
||||
}
|
||||
else
|
||||
setprg8(A,V&0x3F);
|
||||
}
|
||||
|
||||
static DECLFW(M187Write8000)
|
||||
{
|
||||
EXPREGS[2]=1;
|
||||
MMC3_CMDWrite(A,V);
|
||||
}
|
||||
|
||||
static DECLFW(M187Write8001)
|
||||
{
|
||||
if(EXPREGS[2])
|
||||
MMC3_CMDWrite(A,V);
|
||||
}
|
||||
|
||||
static DECLFW(M187Write8003)
|
||||
{
|
||||
EXPREGS[2]=0;
|
||||
if(V==0x28)setprg8(0xC000,0x17);
|
||||
else if(V==0x2A)setprg8(0xA000,0x0F);
|
||||
}
|
||||
|
||||
|
||||
static DECLFW(M187WriteLo)
|
||||
{
|
||||
EXPREGS[1]=V;
|
||||
if(A==0x5000)
|
||||
{
|
||||
EXPREGS[0]=V;
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
}
|
||||
}
|
||||
|
||||
static uint8 prot_data[4] = { 0x83, 0x83, 0x42, 0x00 };
|
||||
static DECLFR(M187Read)
|
||||
{
|
||||
return prot_data[EXPREGS[1]&3];
|
||||
}
|
||||
|
||||
static void M187Power(void)
|
||||
{
|
||||
EXPREGS[0]=EXPREGS[1]=EXPREGS[2]=0;
|
||||
GenMMC3Power();
|
||||
Write_IRQFM(0x4017,0x40);
|
||||
SetReadHandler(0x5000,0x5FFF,M187Read);
|
||||
SetWriteHandler(0x5000,0x5FFF,M187WriteLo);
|
||||
SetWriteHandler(0x8000,0x8000,M187Write8000);
|
||||
SetWriteHandler(0x8001,0x8001,M187Write8001);
|
||||
SetWriteHandler(0x8003,0x8003,M187Write8003);
|
||||
}
|
||||
|
||||
void Mapper187_Init(CartInfo *info)
|
||||
{
|
||||
GenMMC3_Init(info, 256, 256, 0, 0);
|
||||
pwrap=M187PW;
|
||||
cwrap=M187CW;
|
||||
info->Power=M187Power;
|
||||
AddExState(EXPREGS, 3, 0, "EXPR");
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 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"
|
||||
#include "mmc3.h"
|
||||
|
||||
static void M189PW(uint32 A, uint8 V)
|
||||
{
|
||||
setprg32(0x8000,EXPREGS[0]&3);
|
||||
}
|
||||
|
||||
static DECLFW(M189Write)
|
||||
{
|
||||
EXPREGS[0]=V|(V>>4); //actually, there is a two versions of 189 mapper with hi or lo bits bankswitching.
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
}
|
||||
|
||||
static void M189Power(void)
|
||||
{
|
||||
EXPREGS[0]=EXPREGS[1]=0;
|
||||
GenMMC3Power();
|
||||
SetWriteHandler(0x4120,0x7FFF,M189Write);
|
||||
}
|
||||
|
||||
void Mapper189_Init(CartInfo *info)
|
||||
{
|
||||
GenMMC3_Init(info, 256, 256, 0, 0);
|
||||
pwrap=M189PW;
|
||||
info->Power=M189Power;
|
||||
AddExState(EXPREGS, 2, 0, "EXPR");
|
||||
}
|
|
@ -0,0 +1,95 @@
|
|||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2006 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
|
||||
*
|
||||
* Dragon Ball Z 2 - Gekishin Freeza! (C)
|
||||
* Dragon Ball Z Gaiden - Saiya Jin Zetsumetsu Keikaku (C)
|
||||
* San Guo Zhi 2 (C)
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
#include "mmc3.h"
|
||||
|
||||
static void M199PW(uint32 A, uint8 V)
|
||||
{
|
||||
setprg8(A,V);
|
||||
setprg8(0xC000,EXPREGS[0]);
|
||||
setprg8(0xE000,EXPREGS[1]);
|
||||
}
|
||||
|
||||
static void M199CW(uint32 A, uint8 V)
|
||||
{
|
||||
setchr1r((V<8)?0x10:0x00,A,V);
|
||||
setchr1r((DRegBuf[0]<8)?0x10:0x00,0x0000,DRegBuf[0]);
|
||||
setchr1r((EXPREGS[2]<8)?0x10:0x00,0x0400,EXPREGS[2]);
|
||||
setchr1r((DRegBuf[1]<8)?0x10:0x00,0x0800,DRegBuf[1]);
|
||||
setchr1r((EXPREGS[3]<8)?0x10:0x00,0x0c00,EXPREGS[3]);
|
||||
}
|
||||
|
||||
static void M199MW(uint8 V)
|
||||
{
|
||||
// FCEU_printf("%02x\n",V);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(M199Write)
|
||||
{
|
||||
if((A==0x8001)&&(MMC3_cmd&8))
|
||||
{
|
||||
// FCEU_printf("%02x=>%02x\n",MMC3_cmd,V);
|
||||
EXPREGS[MMC3_cmd&3]=V;
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
FixMMC3CHR(MMC3_cmd);
|
||||
}
|
||||
else
|
||||
if(A<0xC000)
|
||||
MMC3_CMDWrite(A,V);
|
||||
else
|
||||
MMC3_IRQWrite(A,V);
|
||||
}
|
||||
|
||||
static void M199Power(void)
|
||||
{
|
||||
EXPREGS[0]=~1;
|
||||
EXPREGS[1]=~0;
|
||||
EXPREGS[2]=1;
|
||||
EXPREGS[3]=3;
|
||||
GenMMC3Power();
|
||||
SetWriteHandler(0x8000,0xFFFF,M199Write);
|
||||
}
|
||||
|
||||
void Mapper199_Init(CartInfo *info)
|
||||
{
|
||||
int CHRRAMSize=1024*8;
|
||||
GenMMC3_Init(info, 512, 256, 8, info->battery);
|
||||
cwrap=M199CW;
|
||||
pwrap=M199PW;
|
||||
mwrap=M199MW;
|
||||
info->Power=M199Power;
|
||||
CHRRAM=(uint8*)FCEU_gmalloc(CHRRAMSize);
|
||||
SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSize, 1);
|
||||
AddExState(CHRRAM, CHRRAMSize, 0, "CHRR");
|
||||
AddExState(EXPREGS, 4, 0, "EXPR");
|
||||
}
|
|
@ -0,0 +1,83 @@
|
|||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 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"
|
||||
#include "mmc3.h"
|
||||
|
||||
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
|
||||
};
|
||||
|
||||
static void M208PW(uint32 A, uint8 V)
|
||||
{
|
||||
setprg32(0x8000,EXPREGS[5]);
|
||||
}
|
||||
|
||||
static DECLFW(M208Write)
|
||||
{
|
||||
EXPREGS[5]=(V&0x1)|((V>>3)&0x2);
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
}
|
||||
|
||||
static DECLFW(M208ProtWrite)
|
||||
{
|
||||
if(A<=0x57FF)
|
||||
EXPREGS[4]=V;
|
||||
else
|
||||
EXPREGS[(A&0x03)]=V^lut[EXPREGS[4]];
|
||||
}
|
||||
|
||||
static DECLFR(M208ProtRead)
|
||||
{
|
||||
return(EXPREGS[(A&0x3)]);
|
||||
}
|
||||
|
||||
static void M208Power(void)
|
||||
{
|
||||
EXPREGS[5]=3;
|
||||
GenMMC3Power();
|
||||
SetWriteHandler(0x4800,0x4FFF,M208Write);
|
||||
SetWriteHandler(0x5000,0x5fff,M208ProtWrite);
|
||||
SetReadHandler(0x5800,0x5FFF,M208ProtRead);
|
||||
SetReadHandler(0x8000,0xffff,CartBR);
|
||||
}
|
||||
|
||||
void Mapper208_Init(CartInfo *info)
|
||||
{
|
||||
GenMMC3_Init(info, 128, 256, 0, 0);
|
||||
pwrap=M208PW;
|
||||
info->Power=M208Power;
|
||||
AddExState(EXPREGS, 6, 0, "EXPR");
|
||||
}
|
|
@ -0,0 +1,103 @@
|
|||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 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 uint8 IRQCount, IRQPre;
|
||||
static uint8 IRQa;
|
||||
static uint8 prg_reg[2];
|
||||
static uint8 chr_reg[8];
|
||||
|
||||
static SFORMAT StateRegs[]=
|
||||
{
|
||||
{&IRQCount, 1, "IRQC"},
|
||||
{&IRQa, 1, "IRQA"},
|
||||
{prg_reg, 2, "PRG"},
|
||||
{chr_reg, 8, "CHR"},
|
||||
{0}
|
||||
};
|
||||
|
||||
static void M222IRQ(void)
|
||||
{
|
||||
if(IRQa)
|
||||
{
|
||||
IRQCount++;
|
||||
if((IRQCount)>=240)
|
||||
{
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
IRQa=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
int i;
|
||||
setprg8(0x8000,prg_reg[0]);
|
||||
setprg8(0xA000,prg_reg[1]);
|
||||
for(i=0; i<8; i++)
|
||||
setchr1(i<<10,chr_reg[i]);
|
||||
}
|
||||
|
||||
static DECLFW(M222Write)
|
||||
{
|
||||
switch(A&0xF003)
|
||||
{
|
||||
case 0x8000: prg_reg[0]=V; break;
|
||||
case 0xA000: prg_reg[1]=V; break;
|
||||
case 0xB000: chr_reg[0]=V; break;
|
||||
case 0xB002: chr_reg[1]=V; break;
|
||||
case 0xC000: chr_reg[2]=V; break;
|
||||
case 0xC002: chr_reg[3]=V; break;
|
||||
case 0xD000: chr_reg[4]=V; break;
|
||||
case 0xD002: chr_reg[5]=V; break;
|
||||
case 0xE000: chr_reg[6]=V; break;
|
||||
case 0xE002: chr_reg[7]=V; break;
|
||||
// case 0xF000: FCEU_printf("%04x:%02x %d\n",A,V,scanline); IRQa=V; if(!V)IRQPre=0; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||
// / case 0xF001: FCEU_printf("%04x:%02x %d\n",A,V,scanline); IRQCount=V; break;
|
||||
// case 0xF002: FCEU_printf("%04x:%02x %d\n",A,V,scanline); break;
|
||||
// case 0xD001: IRQa=V; X6502_IRQEnd(FCEU_IQEXT); FCEU_printf("%04x:%02x %d\n",A,V,scanline); break;
|
||||
case 0xC001: IRQPre=0; FCEU_printf("%04x:%02x %d\n",A,V,scanline); break;
|
||||
case 0xF000: IRQPre=8; IRQCount=V; IRQa=V; X6502_IRQEnd(FCEU_IQEXT); FCEU_printf("%04x:%02x %d\n",A,V,scanline); break;
|
||||
default: FCEU_printf("%04x:%02x %d\n",A,V,scanline);
|
||||
}
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M222Power(void)
|
||||
{
|
||||
setprg16(0xC000,~0);
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
SetWriteHandler(0x8000,0xFFFF,M222Write);
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper222_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=M222Power;
|
||||
GameHBIRQHook=M222IRQ;
|
||||
GameStateRestore=StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 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 uint16 cmdreg;
|
||||
static SFORMAT StateRegs[]=
|
||||
{
|
||||
{&cmdreg, 2, "CMDREG"},
|
||||
{0}
|
||||
};
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
if(cmdreg&0x400)
|
||||
setmirror(MI_0);
|
||||
else
|
||||
setmirror(((cmdreg>>13)&1)^1);
|
||||
if(cmdreg&0x800)
|
||||
{
|
||||
setprg16(0x8000,((cmdreg&0x300)>>3)|((cmdreg&0x1F)<<1)|((cmdreg>>12)&1));
|
||||
setprg16(0xC000,((cmdreg&0x300)>>3)|((cmdreg&0x1F)<<1)|((cmdreg>>12)&1));
|
||||
}
|
||||
else
|
||||
setprg32(0x8000,((cmdreg&0x300)>>4)|(cmdreg&0x1F));
|
||||
}
|
||||
|
||||
static DECLFW(M235Write)
|
||||
{
|
||||
cmdreg=A;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M235Power(void)
|
||||
{
|
||||
setchr8(0);
|
||||
SetWriteHandler(0x8000,0xFFFF,M235Write);
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
cmdreg=0;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M235Restore(int version)
|
||||
{
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper235_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=M235Power;
|
||||
GameStateRestore=M235Restore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2006 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 uint8 reg;
|
||||
static uint8 IRQCount, IRQa;
|
||||
|
||||
static SFORMAT StateRegs[]=
|
||||
{
|
||||
{&IRQCount, 1, "IRQC"},
|
||||
{&IRQa, 1, "IRQA"},
|
||||
{®, 1, "REG"},
|
||||
{0}
|
||||
};
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setprg4(0x5000,16);
|
||||
setprg8(0x6000,2);
|
||||
setprg8(0x8000,1);
|
||||
setprg8(0xa000,0);
|
||||
setprg8(0xc000,reg);
|
||||
setprg8(0xe000,9);
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
static DECLFW(M43Write)
|
||||
{
|
||||
int transo[8]={4,3,4,4,4,7,5,6};
|
||||
switch(A&0xf1ff)
|
||||
{
|
||||
case 0x4022: reg=transo[V&7]; Sync(); break;
|
||||
case 0x8122: IRQa=V&1; IRQCount=0; break;
|
||||
}
|
||||
}
|
||||
|
||||
static void M43Power(void)
|
||||
{
|
||||
reg=0;
|
||||
Sync();
|
||||
// SetReadHandler(0x5000,0x5fff,CartBR);
|
||||
SetReadHandler(0x5000,0xffff,CartBR);
|
||||
SetWriteHandler(0x4020,0xffff,M43Write);
|
||||
}
|
||||
|
||||
static void M43Reset(void)
|
||||
{
|
||||
}
|
||||
|
||||
static void FP_FASTAPASS(1) M43IRQHook(int a)
|
||||
{
|
||||
IRQCount+=a;
|
||||
if(IRQa)
|
||||
if(IRQCount>=4096)
|
||||
{
|
||||
IRQa=0;
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
}
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper43_Init(CartInfo *info)
|
||||
{
|
||||
info->Reset=M43Reset;
|
||||
info->Power=M43Power;
|
||||
MapIRQHook=M43IRQHook;
|
||||
GameStateRestore=StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 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 uint8 prg_reg;
|
||||
static uint8 chr_reg;
|
||||
static uint8 hrd_flag;
|
||||
|
||||
static SFORMAT StateRegs[]=
|
||||
{
|
||||
{&hrd_flag, 1, "DIPSW"},
|
||||
{&prg_reg, 1, "PRG"},
|
||||
{&chr_reg, 1, "CHR"},
|
||||
{0}
|
||||
};
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
if(prg_reg&0x80)
|
||||
setprg32(0x8000,prg_reg>>6);
|
||||
else
|
||||
{
|
||||
setprg16(0x8000,(prg_reg>>5)&3);
|
||||
setprg16(0xC000,(prg_reg>>5)&3);
|
||||
}
|
||||
setmirror((prg_reg&8)>>3);
|
||||
setchr8((chr_reg&3)|(prg_reg&7)|((prg_reg&0x10)>>1));
|
||||
}
|
||||
|
||||
static DECLFR(M57Read)
|
||||
{
|
||||
return hrd_flag;
|
||||
}
|
||||
|
||||
static DECLFW(M57Write)
|
||||
{
|
||||
if((A&0x8800)==0x8800)
|
||||
prg_reg=V;
|
||||
else
|
||||
chr_reg=V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M57Power(void)
|
||||
{
|
||||
prg_reg=0;
|
||||
chr_reg=0;
|
||||
hrd_flag=0;
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
SetWriteHandler(0x8000,0xFFFF,M57Write);
|
||||
SetReadHandler(0x6000,0x6000,M57Read);
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M57Reset()
|
||||
{
|
||||
hrd_flag++;
|
||||
hrd_flag&=3;
|
||||
FCEU_printf("Select Register = %02x\n",hrd_flag);
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper57_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=M57Power;
|
||||
info->Reset=M57Reset;
|
||||
GameStateRestore=StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 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"
|
||||
#include "mmc3.h"
|
||||
|
||||
static uint8 lut[4] = { 0x00, 0x02, 0x02, 0x03 };
|
||||
|
||||
static DECLFW(UNL6035052ProtWrite)
|
||||
{
|
||||
EXPREGS[0]=lut[V&3];
|
||||
}
|
||||
|
||||
static DECLFR(UNL6035052ProtRead)
|
||||
{
|
||||
return EXPREGS[0];
|
||||
}
|
||||
|
||||
static void UNL6035052Power(void)
|
||||
{
|
||||
GenMMC3Power();
|
||||
SetWriteHandler(0x4020,0x7FFF,UNL6035052ProtWrite);
|
||||
SetReadHandler(0x4020,0x7FFF,UNL6035052ProtRead);
|
||||
}
|
||||
|
||||
void UNL6035052_Init(CartInfo *info)
|
||||
{
|
||||
GenMMC3_Init(info, 128, 256, 0, 0);
|
||||
info->Power=UNL6035052Power;
|
||||
AddExState(EXPREGS, 6, 0, "EXPR");
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 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 uint16 cmdreg;
|
||||
static uint8 invalid_data;
|
||||
static SFORMAT StateRegs[]=
|
||||
{
|
||||
{&invalid_data, 1, "INVD"},
|
||||
{&cmdreg, 2, "CMDREG"},
|
||||
{0}
|
||||
};
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setprg16r((cmdreg&0x060)>>5,0x8000,(cmdreg&0x01C)>>2);
|
||||
setprg16r((cmdreg&0x060)>>5,0xC000,(cmdreg&0x200)?(~0):0);
|
||||
setmirror(((cmdreg&2)>>1)^1);
|
||||
}
|
||||
|
||||
static DECLFR(UNL8157Read)
|
||||
{
|
||||
if(invalid_data&&cmdreg&0x100)
|
||||
return 0xFF;
|
||||
else
|
||||
return CartBR(A);
|
||||
}
|
||||
|
||||
static DECLFW(UNL8157Write)
|
||||
{
|
||||
cmdreg=A;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void UNL8157Power(void)
|
||||
{
|
||||
setchr8(0);
|
||||
SetWriteHandler(0x8000,0xFFFF,UNL8157Write);
|
||||
SetReadHandler(0x8000,0xFFFF,UNL8157Read);
|
||||
cmdreg=0x200;
|
||||
invalid_data=1;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void UNL8157Reset(void)
|
||||
{
|
||||
cmdreg=0;
|
||||
invalid_data^=1;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void UNL8157Restore(int version)
|
||||
{
|
||||
Sync();
|
||||
}
|
||||
|
||||
void UNL8157_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=UNL8157Power;
|
||||
info->Reset=UNL8157Reset;
|
||||
GameStateRestore=UNL8157Restore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 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"
|
||||
#include "mmc3.h"
|
||||
|
||||
static uint8 cmdin;
|
||||
static uint8 UNL8237_perm[8] = {0, 2, 6, 1, 7, 3, 4, 5};
|
||||
|
||||
static void UNL8237CW(uint32 A, uint8 V)
|
||||
{
|
||||
setchr1(A,((EXPREGS[1]&4)<<6)|V);
|
||||
}
|
||||
|
||||
static void UNL8237PW(uint32 A, uint8 V)
|
||||
{
|
||||
if(EXPREGS[0]&0x80)
|
||||
{
|
||||
if(EXPREGS[0]&0x20)
|
||||
setprg32(0x8000,(EXPREGS[0]&0xF)>>1);
|
||||
else
|
||||
{
|
||||
setprg16(0x8000,(EXPREGS[0]&0x1F));
|
||||
setprg16(0xC000,(EXPREGS[0]&0x1F));
|
||||
}
|
||||
}
|
||||
else
|
||||
setprg8(A,V&0x3F);
|
||||
}
|
||||
|
||||
static DECLFW(UNL8237Write)
|
||||
{
|
||||
if((A&0xF000)==0xF000)
|
||||
IRQCount=V;
|
||||
else if((A&0xF000)==0xE000)
|
||||
X6502_IRQEnd(FCEU_IQEXT);
|
||||
else switch(A&0xE001)
|
||||
{
|
||||
case 0x8000: setmirror(((V|(V>>7))&1)^1); break;
|
||||
case 0xA000: MMC3_CMDWrite(0x8000,(V&0xC0)|(UNL8237_perm[V&7])); cmdin=1; break;
|
||||
case 0xC000: if(cmdin)
|
||||
{
|
||||
MMC3_CMDWrite(0x8001,V);
|
||||
cmdin=0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(UNL8237ExWrite)
|
||||
{
|
||||
switch(A)
|
||||
{
|
||||
case 0x5000: EXPREGS[0]=V; FixMMC3PRG(MMC3_cmd); break;
|
||||
case 0x5001: EXPREGS[1]=V; FixMMC3CHR(MMC3_cmd); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void UNL8237Power(void)
|
||||
{
|
||||
IRQa=1;
|
||||
EXPREGS[0]=EXPREGS[1]=0;
|
||||
GenMMC3Power();
|
||||
SetWriteHandler(0x8000,0xFFFF,UNL8237Write);
|
||||
SetWriteHandler(0x5000,0x7FFF,UNL8237ExWrite);
|
||||
}
|
||||
|
||||
void UNL8237_Init(CartInfo *info)
|
||||
{
|
||||
GenMMC3_Init(info, 256, 256, 0, 0);
|
||||
cwrap=UNL8237CW;
|
||||
pwrap=UNL8237PW;
|
||||
info->Power=UNL8237Power;
|
||||
AddExState(EXPREGS, 3, 0, "EXPR");
|
||||
AddExState(&cmdin, 1, 0, "CMDIN");
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 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 uint8 reg[8];
|
||||
static uint8 mirror, cmd, is154;
|
||||
|
||||
static SFORMAT StateRegs[]=
|
||||
{
|
||||
{&cmd, 1, "CMD"},
|
||||
{&mirror, 1, "MIRR"},
|
||||
{reg, 8, "REGS"},
|
||||
{0}
|
||||
};
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setchr2(0x0000,reg[0]>>1);
|
||||
setchr2(0x0800,reg[1]>>1);
|
||||
setchr1(0x1000,reg[2]|0x40);
|
||||
setchr1(0x1400,reg[3]|0x40);
|
||||
setchr1(0x1800,reg[4]|0x40);
|
||||
setchr1(0x1C00,reg[5]|0x40);
|
||||
setprg8(0x8000,reg[6]);
|
||||
setprg8(0xA000,reg[7]);
|
||||
}
|
||||
|
||||
static void MSync(void)
|
||||
{
|
||||
if(is154)setmirror(MI_0+(mirror&1));
|
||||
}
|
||||
|
||||
static DECLFW(M88Write)
|
||||
{
|
||||
switch(A&0x8001)
|
||||
{
|
||||
case 0x8000: cmd=V&7; mirror=V>>6; MSync(); break;
|
||||
case 0x8001: reg[cmd]=V; Sync(); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void M88Power(void)
|
||||
{
|
||||
setprg16(0xC000,~0);
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
SetWriteHandler(0x8000,0xFFFF,M88Write);
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
Sync();
|
||||
MSync();
|
||||
}
|
||||
|
||||
void Mapper88_Init(CartInfo *info)
|
||||
{
|
||||
is154=0;
|
||||
info->Power=M88Power;
|
||||
GameStateRestore=StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
void Mapper154_Init(CartInfo *info)
|
||||
{
|
||||
is154=1;
|
||||
info->Power=M88Power;
|
||||
GameStateRestore=StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
|
@ -0,0 +1,512 @@
|
|||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
* Copyright (C) 2005 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 DEBUG90
|
||||
|
||||
// Mapper 090 is simpliest mapper hardware and have not extended nametable control and latched chr banks in 4k mode
|
||||
// Mapper 209 much compicated hardware with decribed above features disabled by default and switchable by command
|
||||
// Mapper 211 the same mapper 209 but with forced nametable control
|
||||
|
||||
static int is209;
|
||||
static int is211;
|
||||
|
||||
static uint8 IRQMode; // from $c001
|
||||
static uint8 IRQPre; // from $c004
|
||||
static uint8 IRQPreSize; // from $c007
|
||||
static uint8 IRQCount; // from $c005
|
||||
static uint8 IRQXOR; // Loaded from $C006
|
||||
static uint8 IRQa; // $c002, $c003, and $c000
|
||||
|
||||
static uint8 mul[2];
|
||||
static uint8 regie;
|
||||
static uint8 regie2;
|
||||
|
||||
static uint8 tkcom[4];
|
||||
static uint8 prgb[4];
|
||||
static uint8 chrlow[8];
|
||||
static uint8 chrhigh[8];
|
||||
|
||||
static uint8 chr[2];
|
||||
|
||||
static uint16 names[4];
|
||||
static uint8 tekker;
|
||||
|
||||
static SFORMAT Tek_StateRegs[]={
|
||||
{&IRQMode, 1, "IRQMODE"},
|
||||
{&IRQPre, 1, "IRQPRE"},
|
||||
{&IRQPreSize, 1, "IRQPRESIZE"},
|
||||
{&IRQCount, 1, "IRQC"},
|
||||
{&IRQXOR, 1, "IRQXOR"},
|
||||
{&IRQa, 1, "IRQa"},
|
||||
{mul, 2, "MUL"},
|
||||
{®ie, 1, "REGI"},
|
||||
{tkcom, 4, "TKCO"},
|
||||
{prgb, 4, "PRGB"},
|
||||
{chr, 2, "CHRLATCH"},
|
||||
{chrlow, 4, "CHRL"},
|
||||
{chrhigh, 8, "CHRH"},
|
||||
{&names[0], 2|FCEUSTATE_RLSB, "NMS0"},
|
||||
{&names[1], 2|FCEUSTATE_RLSB, "NMS1"},
|
||||
{&names[2], 2|FCEUSTATE_RLSB, "NMS2"},
|
||||
{&names[3], 2|FCEUSTATE_RLSB, "NMS3"},
|
||||
{&tekker, 1, "TEKR"},
|
||||
{0}
|
||||
};
|
||||
|
||||
static void mira(void)
|
||||
{
|
||||
if((tkcom[0]&0x20&&is209)||is211)
|
||||
{
|
||||
int x;
|
||||
if(tkcom[0]&0x40) // Name tables are ROM-only
|
||||
{
|
||||
for(x=0;x<4;x++)
|
||||
setntamem(CHRptr[0]+(((names[x])&CHRmask1[0])<<10),0,x);
|
||||
}
|
||||
else // Name tables can be RAM or ROM.
|
||||
{
|
||||
for(x=0;x<4;x++)
|
||||
{
|
||||
if((tkcom[1]&0x80)==(names[x]&0x80)) // RAM selected.
|
||||
setntamem(NTARAM+((names[x]&0x1)<<10),1,x);
|
||||
else
|
||||
setntamem(CHRptr[0]+(((names[x])&CHRmask1[0])<<10),0,x);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(tkcom[1]&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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void tekprom(void)
|
||||
{
|
||||
uint32 bankmode=((tkcom[3]&6)<<5);
|
||||
switch(tkcom[0]&7)
|
||||
{
|
||||
case 00: if(tkcom[0]&0x80)
|
||||
setprg8(0x6000,(((prgb[3]<<2)+3)&0x3F)|bankmode);
|
||||
setprg32(0x8000,0x0F|((tkcom[3]&6)<<3));
|
||||
break;
|
||||
case 01: if(tkcom[0]&0x80)
|
||||
setprg8(0x6000,(((prgb[3]<<1)+1)&0x3F)|bankmode);
|
||||
setprg16(0x8000,(prgb[1]&0x1F)|((tkcom[3]&6)<<4));
|
||||
setprg16(0xC000,0x1F|((tkcom[3]&6)<<4));
|
||||
break;
|
||||
case 03: // bit reversion
|
||||
case 02: if(tkcom[0]&0x80)
|
||||
setprg8(0x6000,(prgb[3]&0x3F)|bankmode);
|
||||
setprg8(0x8000,(prgb[0]&0x3F)|bankmode);
|
||||
setprg8(0xa000,(prgb[1]&0x3F)|bankmode);
|
||||
setprg8(0xc000,(prgb[2]&0x3F)|bankmode);
|
||||
setprg8(0xe000,0x3F|bankmode);
|
||||
break;
|
||||
case 04: if(tkcom[0]&0x80)
|
||||
setprg8(0x6000,(((prgb[3]<<2)+3)&0x3F)|bankmode);
|
||||
setprg32(0x8000,(prgb[3]&0x0F)|((tkcom[3]&6)<<3));
|
||||
break;
|
||||
case 05: if(tkcom[0]&0x80)
|
||||
setprg8(0x6000,(((prgb[3]<<1)+1)&0x3F)|bankmode);
|
||||
setprg16(0x8000,(prgb[1]&0x1F)|((tkcom[3]&6)<<4));
|
||||
setprg16(0xC000,(prgb[3]&0x1F)|((tkcom[3]&6)<<4));
|
||||
break;
|
||||
case 07: // bit reversion
|
||||
case 06: if(tkcom[0]&0x80)
|
||||
setprg8(0x6000,(prgb[3]&0x3F)|bankmode);
|
||||
setprg8(0x8000,(prgb[0]&0x3F)|bankmode);
|
||||
setprg8(0xa000,(prgb[1]&0x3F)|bankmode);
|
||||
setprg8(0xc000,(prgb[2]&0x3F)|bankmode);
|
||||
setprg8(0xe000,(prgb[3]&0x3F)|bankmode);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void tekvrom(void)
|
||||
{
|
||||
int x, bank=0, mask=0xFFFF;
|
||||
if(!(tkcom[3]&0x20))
|
||||
{
|
||||
bank=(tkcom[3]&1)|((tkcom[3]&0x18)>>2);
|
||||
switch (tkcom[0]&0x18)
|
||||
{
|
||||
case 0x00: bank<<=5; mask=0x1F; break;
|
||||
case 0x08: bank<<=6; mask=0x3F; break;
|
||||
case 0x10: bank<<=7; mask=0x7F; break;
|
||||
case 0x18: bank<<=8; mask=0xFF; break;
|
||||
}
|
||||
}
|
||||
switch(tkcom[0]&0x18)
|
||||
{
|
||||
case 0x00: // 8KB
|
||||
setchr8(((chrlow[0]|(chrhigh[0]<<8))&mask)|bank);
|
||||
break;
|
||||
case 0x08: // 4KB
|
||||
// for(x=0;x<8;x+=4)
|
||||
// setchr4(x<<10,((chrlow[x]|(chrhigh[x]<<8))&mask)|bank);
|
||||
setchr4(0x0000,((chrlow[chr[0]]|(chrhigh[chr[0]]<<8))&mask)|bank);
|
||||
setchr4(0x1000,((chrlow[chr[1]]|(chrhigh[chr[1]]<<8))&mask)|bank);
|
||||
break;
|
||||
case 0x10: // 2KB
|
||||
for(x=0;x<8;x+=2)
|
||||
setchr2(x<<10,((chrlow[x]|(chrhigh[x]<<8))&mask)|bank);
|
||||
break;
|
||||
case 0x18: // 1KB
|
||||
for(x=0;x<8;x++)
|
||||
setchr1(x<<10,((chrlow[x]|(chrhigh[x]<<8))&mask)|bank);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(M90TekWrite)
|
||||
{
|
||||
FCEU_printf("bs %04x %02x\n",A,V);
|
||||
switch(A&0x5805)
|
||||
{
|
||||
case 0x5800: mul[0]=V; break;
|
||||
case 0x5801: mul[1]=V; break;
|
||||
case 0x5803: regie=V; break;
|
||||
// case 0x5803: regie2=V; break;
|
||||
// default: regie=V; break;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFR(M90TekRead)
|
||||
{
|
||||
switch(A&0x5805)
|
||||
{
|
||||
case 0x5000: return tekker;
|
||||
case 0x5800: return (mul[0]*mul[1]);
|
||||
case 0x5801: return((mul[0]*mul[1])>>8);
|
||||
case 0x5803: return (regie);
|
||||
// case 0x5804: return (regie2);
|
||||
}
|
||||
return(0xff);
|
||||
}
|
||||
|
||||
static DECLFW(M90PRGWrite)
|
||||
{
|
||||
FCEU_printf("bs %04x %02x\n",A,V);
|
||||
prgb[A&3]=V;
|
||||
tekprom();
|
||||
}
|
||||
|
||||
static DECLFW(M90CHRlowWrite)
|
||||
{
|
||||
FCEU_printf("bs %04x %02x\n",A,V);
|
||||
chrlow[A&7]=V;
|
||||
tekvrom();
|
||||
}
|
||||
|
||||
static DECLFW(M90CHRhiWrite)
|
||||
{
|
||||
FCEU_printf("bs %04x %02x\n",A,V);
|
||||
chrhigh[A&7]=V;
|
||||
tekvrom();
|
||||
}
|
||||
|
||||
static DECLFW(M90NTWrite)
|
||||
{
|
||||
FCEU_printf("bs %04x %02x\n",A,V);
|
||||
if(A&4)
|
||||
{
|
||||
names[A&3]&=0x00FF;
|
||||
names[A&3]|=V<<8;
|
||||
}
|
||||
else
|
||||
{
|
||||
names[A&3]&=0xFF00;
|
||||
names[A&3]|=V;
|
||||
}
|
||||
mira();
|
||||
}
|
||||
|
||||
static DECLFW(M90IRQWrite)
|
||||
{
|
||||
FCEU_printf("bs %04x %02x\n",A,V);
|
||||
switch(A&7)
|
||||
{
|
||||
case 00: //FCEU_printf("%s IRQ (C000)\n",V&1?"Enable":"Disable");
|
||||
IRQa=V&1;if(!(V&1)) X6502_IRQEnd(FCEU_IQEXT);break;
|
||||
case 02: //FCEU_printf("Disable IRQ (C002) scanline=%d\n", scanline);
|
||||
IRQa=0;X6502_IRQEnd(FCEU_IQEXT);break;
|
||||
case 03: //FCEU_printf("Enable IRQ (C003) scanline=%d\n", scanline);
|
||||
IRQa=1;break;
|
||||
case 01: IRQMode=V;
|
||||
// FCEU_printf("IRQ Count method: ");
|
||||
// switch (IRQMode&3)
|
||||
// {
|
||||
// case 00: FCEU_printf("M2 cycles\n");break;
|
||||
// case 01: FCEU_printf("PPU A12 toggles\n");break;
|
||||
// case 02: FCEU_printf("PPU reads\n");break;
|
||||
// case 03: FCEU_printf("Writes to CPU space\n");break;
|
||||
// }
|
||||
// FCEU_printf("Counter prescaler size: %s\n",(IRQMode&4)?"3 bits":"8 bits");
|
||||
// FCEU_printf("Counter prescaler size adjust: %s\n",(IRQMode&8)?"Used C007":"Normal Operation");
|
||||
// if((IRQMode>>6)==2) FCEU_printf("Counter Down\n");
|
||||
// else if((IRQMode>>6)==1) FCEU_printf("Counter Up\n");
|
||||
// else FCEU_printf("Counter Stopped\n");
|
||||
break;
|
||||
case 04: //FCEU_printf("Pre Counter Loaded and Xored wiht C006: %d\n",V^IRQXOR);
|
||||
IRQPre=V^IRQXOR;break;
|
||||
case 05: //FCEU_printf("Main Counter Loaded and Xored wiht C006: %d\n",V^IRQXOR);
|
||||
IRQCount=V^IRQXOR;break;
|
||||
case 06: //FCEU_printf("Xor Value: %d\n",V);
|
||||
IRQXOR=V;break;
|
||||
case 07: //if(!(IRQMode&8)) FCEU_printf("C001 is clear, no effect applied\n");
|
||||
// else if(V==0xFF) FCEU_printf("Prescaler is changed for 12bits\n");
|
||||
// else FCEU_printf("Counter Stopped\n");
|
||||
IRQPreSize=V;break;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(M90ModeWrite)
|
||||
{
|
||||
FCEU_printf("bs %04x %02x\n",A,V);
|
||||
tkcom[A&3]=V;
|
||||
tekprom();
|
||||
tekvrom();
|
||||
mira();
|
||||
|
||||
#ifdef DEBUG90
|
||||
switch (A&3)
|
||||
{
|
||||
case 00: FCEU_printf("Main Control Register:\n");
|
||||
FCEU_printf(" PGR Banking mode: %d\n",V&7);
|
||||
FCEU_printf(" CHR Banking mode: %d\n",(V>>3)&3);
|
||||
FCEU_printf(" 6000-7FFF addresses mapping: %s\n",(V&0x80)?"Yes":"No");
|
||||
FCEU_printf(" Nametable control: %s\n",(V&0x20)?"Enabled":"Disabled");
|
||||
if(V&0x20)
|
||||
FCEU_printf(" Nametable can be: %s\n",(V&0x40)?"ROM Only":"RAM or ROM");
|
||||
break;
|
||||
case 01: FCEU_printf("Mirroring mode: ");
|
||||
switch (V&3)
|
||||
{
|
||||
case 0: FCEU_printf("Vertical\n");break;
|
||||
case 1: FCEU_printf("Horizontal\n");break;
|
||||
case 2: FCEU_printf("Nametable 0 only\n");break;
|
||||
case 3: FCEU_printf("Nametable 1 only\n");break;
|
||||
}
|
||||
FCEU_printf("Mirroring flag: %s\n",(V&0x80)?"On":"Off");
|
||||
break;
|
||||
case 02: if((((tkcom[0])>>5)&3)==1)
|
||||
FCEU_printf("Nametable ROM/RAM select mode: %d\n",V>>7);
|
||||
break;
|
||||
case 03:
|
||||
FCEU_printf("CHR Banking mode: %s\n",(V&0x20)?"Entire CHR ROM":"256Kb Switching mode");
|
||||
if(!(V&0x20)) FCEU_printf("256K CHR bank number: %02x\n",(V&1)|((V&0x18)>>2));
|
||||
FCEU_printf("512K PRG bank number: %d\n",(V&6)>>1);
|
||||
FCEU_printf("CHR Bank mirroring: %s\n",(V&0x80)?"Swapped":"Normal operate");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static DECLFW(M90DummyWrite)
|
||||
{
|
||||
FCEU_printf("bs %04x %02x\n",A,V);
|
||||
}
|
||||
|
||||
static void CCL(void)
|
||||
{
|
||||
if((IRQMode>>6) == 1) // Count Up
|
||||
{
|
||||
IRQCount++;
|
||||
if((IRQCount == 0) && IRQa)
|
||||
{
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
}
|
||||
}
|
||||
else if((IRQMode>>6) == 2) // Count down
|
||||
{
|
||||
IRQCount--;
|
||||
if((IRQCount == 0xFF) && IRQa)
|
||||
{
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void ClockCounter(void)
|
||||
{
|
||||
uint8 premask;
|
||||
|
||||
if(IRQMode & 0x4)
|
||||
premask = 0x7;
|
||||
else
|
||||
premask = 0xFF;
|
||||
if((IRQMode>>6) == 1) // Count up
|
||||
{
|
||||
IRQPre++;
|
||||
if((IRQPre & premask) == 0) CCL();
|
||||
}
|
||||
else if((IRQMode>>6) == 2) // Count down
|
||||
{
|
||||
IRQPre--;
|
||||
if((IRQPre & premask) == premask) CCL();
|
||||
}
|
||||
}
|
||||
|
||||
void FP_FASTAPASS(1) CPUWrap(int a)
|
||||
{
|
||||
int x;
|
||||
if((IRQMode&3)==0) for(x=0;x<a;x++) ClockCounter();
|
||||
}
|
||||
|
||||
static void SLWrap(void)
|
||||
{
|
||||
int x;
|
||||
if((IRQMode&3)==1) for(x=0;x<8;x++) ClockCounter();
|
||||
}
|
||||
|
||||
static uint32 lastread;
|
||||
static void FP_FASTAPASS(1) M90PPU(uint32 A)
|
||||
{
|
||||
if((IRQMode&3)==2)
|
||||
{
|
||||
if(lastread!=A)
|
||||
{
|
||||
ClockCounter();
|
||||
ClockCounter();
|
||||
}
|
||||
lastread=A;
|
||||
}
|
||||
|
||||
if(is209)
|
||||
{
|
||||
uint8 l,h;
|
||||
h=A>>8;
|
||||
if(h<0x20&&((h&0x0F)==0xF))
|
||||
{
|
||||
l=A&0xF0;
|
||||
if(l==0xD0)
|
||||
{
|
||||
chr[(h&0x10)>>4]=((h&0x10)>>2);
|
||||
tekvrom();
|
||||
}
|
||||
else if(l==0xE0)
|
||||
{
|
||||
chr[(h&0x10)>>4]=((h&0x10)>>2)|2;
|
||||
tekvrom();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
chr[0]=0;
|
||||
chr[1]=4;
|
||||
}
|
||||
}
|
||||
|
||||
static void togglie()
|
||||
{
|
||||
tekker+=0x40;
|
||||
tekker&=0xC0;
|
||||
FCEU_printf("tekker=%02x\n",tekker);
|
||||
memset(tkcom,0x00,sizeof(tkcom));
|
||||
memset(prgb,0xff,sizeof(prgb));
|
||||
tekprom();
|
||||
tekvrom();
|
||||
}
|
||||
|
||||
static void M90Restore(int version)
|
||||
{
|
||||
tekprom();
|
||||
tekvrom();
|
||||
mira();
|
||||
}
|
||||
|
||||
static void M90Power(void)
|
||||
{
|
||||
SetWriteHandler(0x5000,0x5fff,M90TekWrite);
|
||||
SetWriteHandler(0x8000,0x8ff0,M90PRGWrite);
|
||||
SetWriteHandler(0x9000,0x9fff,M90CHRlowWrite);
|
||||
SetWriteHandler(0xA000,0xAfff,M90CHRhiWrite);
|
||||
SetWriteHandler(0xB000,0xBfff,M90NTWrite);
|
||||
SetWriteHandler(0xC000,0xCfff,M90IRQWrite);
|
||||
SetWriteHandler(0xD000,0xD5ff,M90ModeWrite);
|
||||
SetWriteHandler(0xE000,0xFfff,M90DummyWrite);
|
||||
|
||||
|
||||
SetReadHandler(0x5000,0x5fff,M90TekRead);
|
||||
SetReadHandler(0x6000,0xffff,CartBR);
|
||||
|
||||
mul[0]=mul[1]=regie=0xFF;
|
||||
|
||||
memset(tkcom,0x00,sizeof(tkcom));
|
||||
memset(prgb,0xff,sizeof(prgb));
|
||||
memset(chrlow,0xff,sizeof(chrlow));
|
||||
memset(chrhigh,0xff,sizeof(chrhigh));
|
||||
memset(names,0x00,sizeof(names));
|
||||
|
||||
if(is211)
|
||||
tekker=0xC0;
|
||||
else
|
||||
tekker=0x00;
|
||||
|
||||
tekprom();
|
||||
tekvrom();
|
||||
}
|
||||
|
||||
|
||||
void Mapper90_Init(CartInfo *info)
|
||||
{
|
||||
is211=0;
|
||||
is209=0;
|
||||
info->Reset=togglie;
|
||||
info->Power=M90Power;
|
||||
PPU_hook=M90PPU;
|
||||
MapIRQHook=CPUWrap;
|
||||
GameHBIRQHook2=SLWrap;
|
||||
GameStateRestore=M90Restore;
|
||||
AddExState(Tek_StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
void Mapper209_Init(CartInfo *info)
|
||||
{
|
||||
is211=0;
|
||||
is209=1;
|
||||
info->Reset=togglie;
|
||||
info->Power=M90Power;
|
||||
PPU_hook=M90PPU;
|
||||
MapIRQHook=CPUWrap;
|
||||
GameHBIRQHook2=SLWrap;
|
||||
GameStateRestore=M90Restore;
|
||||
AddExState(Tek_StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
void Mapper211_Init(CartInfo *info)
|
||||
{
|
||||
is211=1;
|
||||
info->Reset=togglie;
|
||||
info->Power=M90Power;
|
||||
PPU_hook=M90PPU;
|
||||
MapIRQHook=CPUWrap;
|
||||
GameHBIRQHook2=SLWrap;
|
||||
GameStateRestore=M90Restore;
|
||||
AddExState(Tek_StateRegs, ~0, 0, 0);
|
||||
}
|
|
@ -0,0 +1,125 @@
|
|||
/* 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"
|
||||
#include "../ines.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 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 void Sync()
|
||||
{
|
||||
setchr2(0x0000,DRegs[0]&0x1F);
|
||||
setchr2(0x0800,DRegs[1]&0x1F);
|
||||
setchr1(0x1000,DRegs[2]&0x1F);
|
||||
setchr1(0x1400,DRegs[3]&0x1F);
|
||||
setchr1(0x1800,DRegs[4]&0x1F);
|
||||
setchr1(0x1C00,DRegs[5]&0x1F);
|
||||
setprg8(0x8000,DRegs[6]&0x1F);
|
||||
setprg8(0xa000,DRegs[7]&0x1F);
|
||||
toot();
|
||||
}
|
||||
|
||||
static DECLFW(Mapper95_write)
|
||||
{
|
||||
switch(A&0xF001)
|
||||
{
|
||||
case 0x8000: cmd = V; break;
|
||||
case 0x8001:
|
||||
switch(cmd&0x07)
|
||||
{
|
||||
case 0: DRegs[0]=(V&0x3F)>>1; break;
|
||||
case 1: DRegs[1]=(V&0x3F)>>1; break;
|
||||
case 2: DRegs[2]=V&0x3F; break;
|
||||
case 3: DRegs[3]=V&0x3F; break;
|
||||
case 4: DRegs[4]=V&0x3F; break;
|
||||
case 5: DRegs[5]=V&0x3F; break;
|
||||
case 6: DRegs[6]=V&0x3F; break;
|
||||
case 7: DRegs[7]=V&0x3F; break;
|
||||
}
|
||||
Sync();
|
||||
}
|
||||
}
|
||||
|
||||
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 DBPower(void)
|
||||
{
|
||||
memset(DRegs,0x3F,8);
|
||||
DRegs[0]=DRegs[1]=0x1F;
|
||||
|
||||
Sync();
|
||||
|
||||
setprg8(0xc000,0x3E);
|
||||
setprg8(0xe000,0x3F);
|
||||
|
||||
SetReadHandler(0x8000,0xffff,CartBR);
|
||||
SetWriteHandler(0x8000,0xffff,Mapper95_write);
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper95_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=DBPower;
|
||||
AddExState(DB_StateRegs, ~0, 0, 0);
|
||||
PPU_hook=dragonbust_ppu;
|
||||
GameStateRestore=StateRestore;
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
fceu_SOURCES += boards/01-222.cpp
|
||||
fceu_SOURCES += boards/112.cpp
|
||||
fceu_SOURCES += boards/117.cpp
|
||||
fceu_SOURCES += boards/164.cpp
|
||||
fceu_SOURCES += boards/183.cpp
|
||||
fceu_SOURCES += boards/185.cpp
|
||||
fceu_SOURCES += boards/186.cpp
|
||||
fceu_SOURCES += boards/187.cpp
|
||||
fceu_SOURCES += boards/189.cpp
|
||||
fceu_SOURCES += boards/199.cpp
|
||||
fceu_SOURCES += boards/208.cpp
|
||||
fceu_SOURCES += boards/222.cpp
|
||||
fceu_SOURCES += boards/235.cpp
|
||||
fceu_SOURCES += boards/43.cpp
|
||||
fceu_SOURCES += boards/57.cpp
|
||||
fceu_SOURCES += boards/603-5052.cpp
|
||||
fceu_SOURCES += boards/8157.cpp
|
||||
fceu_SOURCES += boards/8237.cpp
|
||||
fceu_SOURCES += boards/88.cpp
|
||||
fceu_SOURCES += boards/90.cpp
|
||||
fceu_SOURCES += boards/95.cpp
|
||||
fceu_SOURCES += boards/__dummy_mapper.cpp
|
||||
fceu_SOURCES += boards/a9711.cpp
|
||||
fceu_SOURCES += boards/addrlatch.cpp
|
||||
fceu_SOURCES += boards/bmc13in1jy110.cpp
|
||||
fceu_SOURCES += boards/bmc42in1r.cpp
|
||||
fceu_SOURCES += boards/bmc64in1nr.cpp
|
||||
fceu_SOURCES += boards/bmc70in1.cpp
|
||||
fceu_SOURCES += boards/bonza.cpp
|
||||
fceu_SOURCES += boards/datalatch.cpp
|
||||
fceu_SOURCES += boards/deirom.cpp
|
||||
fceu_SOURCES += boards/dream.cpp
|
||||
fceu_SOURCES += boards/edu2000.cpp
|
||||
fceu_SOURCES += boards/fk23c.cpp
|
||||
fceu_SOURCES += boards/h2288.cpp
|
||||
fceu_SOURCES += boards/karaoke.cpp
|
||||
fceu_SOURCES += boards/kof97.cpp
|
||||
fceu_SOURCES += boards/konami-qtai.cpp
|
||||
fceu_SOURCES += boards/malee.cpp
|
||||
fceu_SOURCES += boards/mapinc.h"
|
||||
fceu_SOURCES += boards/mmc1.cpp
|
||||
fceu_SOURCES += boards/mmc3.cpp
|
||||
fceu_SOURCES += boards/mmc3.h"
|
||||
fceu_SOURCES += boards/mmc5.cpp
|
||||
fceu_SOURCES += boards/n-c22m.cpp
|
||||
fceu_SOURCES += boards/n106.cpp
|
||||
fceu_SOURCES += boards/novel.cpp
|
||||
fceu_SOURCES += boards/sachen.cpp
|
||||
fceu_SOURCES += boards/sheroes.cpp
|
||||
fceu_SOURCES += boards/sl1632.cpp
|
||||
fceu_SOURCES += boards/subor.cpp
|
||||
fceu_SOURCES += boards/super24.cpp
|
||||
fceu_SOURCES += boards/supervision.cpp
|
||||
fceu_SOURCES += boards/t-262.cpp
|
||||
fceu_SOURCES += boards/tengen.cpp
|
|
@ -0,0 +1,61 @@
|
|||
Import('file_list')
|
||||
my_list = Split("""
|
||||
01-222.cpp
|
||||
112.cpp
|
||||
117.cpp
|
||||
164.cpp
|
||||
183.cpp
|
||||
185.cpp
|
||||
186.cpp
|
||||
187.cpp
|
||||
189.cpp
|
||||
199.cpp
|
||||
208.cpp
|
||||
222.cpp
|
||||
235.cpp
|
||||
43.cpp
|
||||
57.cpp
|
||||
603-5052.cpp
|
||||
8157.cpp
|
||||
8237.cpp
|
||||
88.cpp
|
||||
90.cpp
|
||||
95.cpp
|
||||
a9711.cpp
|
||||
addrlatch.cpp
|
||||
bmc13in1jy110.cpp
|
||||
bmc42in1r.cpp
|
||||
bmc64in1nr.cpp
|
||||
bmc70in1.cpp
|
||||
bonza.cpp
|
||||
datalatch.cpp
|
||||
deirom.cpp
|
||||
dream.cpp
|
||||
__dummy_mapper.cpp
|
||||
edu2000.cpp
|
||||
fk23c.cpp
|
||||
h2288.cpp
|
||||
karaoke.cpp
|
||||
kof97.cpp
|
||||
konami-qtai.cpp
|
||||
malee.cpp
|
||||
mmc1.cpp
|
||||
mmc3.cpp
|
||||
mmc5.cpp
|
||||
n106.cpp
|
||||
n-c22m.cpp
|
||||
novel.cpp
|
||||
sachen.cpp
|
||||
sheroes.cpp
|
||||
sl1632.cpp
|
||||
subor.cpp
|
||||
super24.cpp
|
||||
supervision.cpp
|
||||
t-262.cpp
|
||||
tengen.cpp
|
||||
""")
|
||||
for x in range(len(my_list)):
|
||||
my_list[x] = 'boards/' + my_list[x]
|
||||
file_list = my_list + file_list
|
||||
|
||||
Export('file_list')
|
|
@ -0,0 +1,96 @@
|
|||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2006 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 uint8 reg[8];
|
||||
/*
|
||||
static uint8 *WRAM=NULL;
|
||||
static uint32 WRAMSIZE;
|
||||
static uint8 *CHRRAM=NULL;
|
||||
static uint32 CHRRAMSIZE;
|
||||
*/
|
||||
|
||||
static SFORMAT StateRegs[]=
|
||||
{
|
||||
{reg, 8, "REGS"},
|
||||
{0}
|
||||
};
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
}
|
||||
|
||||
static DECLFW(MNNNWrite)
|
||||
{
|
||||
}
|
||||
|
||||
static void MNNNPower(void)
|
||||
{
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
SetWriteHandler(0x8000,0xFFFF,MNNNWrite);
|
||||
}
|
||||
|
||||
static void MNNNReset(void)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
static void MNNNClose(void)
|
||||
{
|
||||
if(WRAM)
|
||||
FCEU_gfree(WRAM);
|
||||
if(CHRRAM)
|
||||
FCEU_gfree(CHRRAM);
|
||||
WRAM=CHRRAM=NULL;
|
||||
}
|
||||
*/
|
||||
|
||||
static void MNNNIRQHook(void)
|
||||
{
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
Sync();
|
||||
}
|
||||
|
||||
void MapperNNN_Init(CartInfo *info)
|
||||
{
|
||||
info->Reset=MNNNReset;
|
||||
info->Power=MNNNPower;
|
||||
// info->Close=MNNNClose;
|
||||
GameHBIRQHook=MNNNIRQHook;
|
||||
GameStateRestore=StateRestore;
|
||||
/*
|
||||
CHRRAMSIZE=8192;
|
||||
CHRRAM=(uint8*)FCEU_gmalloc(CHRRAMSIZE);
|
||||
SetupCartPRGMapping(0x10,CHRRAM,CHRRAMSIZE,1);
|
||||
AddExState(CHRRAM, CHRRAMSIZE, 0, "WRAM");
|
||||
*/
|
||||
/*
|
||||
WRAMSIZE=8192;
|
||||
WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||
SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1);
|
||||
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||
*/
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 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"
|
||||
#include "mmc3.h"
|
||||
|
||||
static uint8 m_perm[8] = {0, 1, 0, 3, 0, 5, 6, 7};
|
||||
|
||||
static void UNLA9711PW(uint32 A, uint8 V)
|
||||
{
|
||||
if(EXPREGS[0]&0x20)
|
||||
{
|
||||
uint8 bank=EXPREGS[0]&0x1F;
|
||||
if(EXPREGS[0]&0x20)
|
||||
setprg32(0x8000,bank>>2);
|
||||
else
|
||||
{
|
||||
// setprg16(0x8000,bank);
|
||||
setprg16(0xC000,bank);
|
||||
}
|
||||
}
|
||||
else
|
||||
setprg8(A,V&0x3F);
|
||||
}
|
||||
|
||||
static DECLFW(UNLA9711Write8000)
|
||||
{
|
||||
// FCEU_printf("bs %04x %02x\n",A,V);
|
||||
// if(V&0x80)
|
||||
// MMC3_CMDWrite(A,V);
|
||||
// else
|
||||
// MMC3_CMDWrite(A,m_perm[V&7]);
|
||||
if(V!=0x86) MMC3_CMDWrite(A,V);
|
||||
}
|
||||
|
||||
static DECLFW(UNLA9711WriteLo)
|
||||
{
|
||||
FCEU_printf("bs %04x %02x\n",A,V);
|
||||
EXPREGS[0]=V;
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
}
|
||||
|
||||
static void UNLA9711Power(void)
|
||||
{
|
||||
EXPREGS[0]=EXPREGS[1]=EXPREGS[2]=0;
|
||||
GenMMC3Power();
|
||||
SetWriteHandler(0x5000,0x5FFF,UNLA9711WriteLo);
|
||||
// SetWriteHandler(0x8000,0xbfff,UNLA9711Write8000);
|
||||
}
|
||||
|
||||
void UNLA9711_Init(CartInfo *info)
|
||||
{
|
||||
GenMMC3_Init(info, 256, 256, 0, 0);
|
||||
pwrap=UNLA9711PW;
|
||||
info->Power=UNLA9711Power;
|
||||
AddExState(EXPREGS, 3, 0, "EXPR");
|
||||
}
|
|
@ -0,0 +1,151 @@
|
|||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2006 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 uint16 latche, latcheinit;
|
||||
static uint16 addrreg0, addrreg1;
|
||||
static void(*WSync)(void);
|
||||
static readfunc defread;
|
||||
|
||||
static DECLFW(LatchWrite)
|
||||
{
|
||||
// FCEU_printf("%04x:%02x\n",A,V);
|
||||
latche=A;
|
||||
WSync();
|
||||
}
|
||||
|
||||
static void LatchPower(void)
|
||||
{
|
||||
latche=latcheinit;
|
||||
WSync();
|
||||
SetReadHandler(0x8000,0xFFFF,defread);
|
||||
SetWriteHandler(addrreg0,addrreg1,LatchWrite);
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
WSync();
|
||||
}
|
||||
|
||||
static void Latch_Init(CartInfo *info, void (*proc)(void), readfunc func, uint16 init, uint16 adr0, uint16 adr1)
|
||||
{
|
||||
latcheinit=init;
|
||||
addrreg0=adr0;
|
||||
addrreg1=adr1;
|
||||
WSync=proc;
|
||||
if(func)
|
||||
defread=func;
|
||||
else
|
||||
defread=CartBR;
|
||||
info->Power=LatchPower;
|
||||
GameStateRestore=StateRestore;
|
||||
AddExState(&latche, 2, 0, "LATC");
|
||||
}
|
||||
|
||||
//------------------ UNLCC21 ---------------------------
|
||||
|
||||
static void UNLCC21Sync(void)
|
||||
{
|
||||
setprg32(0x8000,0);
|
||||
setchr8(latche&1);
|
||||
setmirror(MI_0+((latche&2)>>1));
|
||||
|
||||
}
|
||||
|
||||
void UNLCC21_Init(CartInfo *info)
|
||||
{
|
||||
Latch_Init(info, UNLCC21Sync, 0, 0, 0x8000, 0xFFFF);
|
||||
}
|
||||
|
||||
//------------------ BMCD1038 ---------------------------
|
||||
|
||||
static uint8 dipswitch;
|
||||
static void BMCD1038Sync(void)
|
||||
{
|
||||
if(latche&0x80)
|
||||
{
|
||||
setprg16(0x8000,(latche&0x70)>>4);
|
||||
setprg16(0xC000,(latche&0x70)>>4);
|
||||
}
|
||||
else
|
||||
setprg32(0x8000,(latche&0x60)>>5);
|
||||
setchr8(latche&7);
|
||||
setmirror(((latche&8)>>3)^1);
|
||||
}
|
||||
|
||||
static DECLFR(BMCD1038Read)
|
||||
{
|
||||
if(latche&0x100)
|
||||
return dipswitch;
|
||||
else
|
||||
return CartBR(A);
|
||||
}
|
||||
|
||||
static void BMCD1038Reset(void)
|
||||
{
|
||||
dipswitch++;
|
||||
dipswitch&=3;
|
||||
}
|
||||
|
||||
void BMCD1038_Init(CartInfo *info)
|
||||
{
|
||||
Latch_Init(info, BMCD1038Sync, BMCD1038Read, 0, 0x8000, 0xFFFF);
|
||||
info->Reset=BMCD1038Reset;
|
||||
AddExState(&dipswitch, 1, 0, "DIPSW");
|
||||
}
|
||||
|
||||
|
||||
//------------------ Map 058 ---------------------------
|
||||
|
||||
static void BMCGK192Sync(void)
|
||||
{
|
||||
if(latche&0x40)
|
||||
{
|
||||
setprg16(0x8000,latche&7);
|
||||
setprg16(0xC000,latche&7);
|
||||
}
|
||||
else
|
||||
setprg32(0x8000,(latche>>1)&3);
|
||||
setchr8((latche>>3)&7);
|
||||
setmirror(((latche&0x80)>>7)^1);
|
||||
}
|
||||
|
||||
void BMCGK192_Init(CartInfo *info)
|
||||
{
|
||||
Latch_Init(info, BMCGK192Sync, 0, 0, 0x8000, 0xFFFF);
|
||||
}
|
||||
|
||||
//------------------ Map 200 ---------------------------
|
||||
|
||||
static void M200Sync(void)
|
||||
{
|
||||
// FCEU_printf("A\n");
|
||||
setprg16(0x8000,latche&7);
|
||||
setprg16(0xC000,latche&7);
|
||||
setchr8(latche&7);
|
||||
setmirror((latche&8)>>3);
|
||||
}
|
||||
|
||||
void Mapper200_Init(CartInfo *info)
|
||||
{
|
||||
Latch_Init(info, M200Sync, 0, 0xff, 0x8000, 0xFFFF);
|
||||
}
|
||||
|
|
@ -0,0 +1,103 @@
|
|||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 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
|
||||
*
|
||||
* BMC 42-in-1 reset switch
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 bank_mode;
|
||||
static uint8 bank_value;
|
||||
static uint8 prgb[4];
|
||||
static SFORMAT StateRegs[]=
|
||||
{
|
||||
{0}
|
||||
};
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
FCEU_printf("%02x: %02x %02x\n", bank_mode, bank_value, prgb[0]);
|
||||
switch(bank_mode&7)
|
||||
{
|
||||
case 0:
|
||||
setprg32(0x8000,bank_value&7); break;
|
||||
case 1:
|
||||
setprg16(0x8000,((8+(bank_value&7))>>1)+prgb[1]);
|
||||
setprg16(0xC000,(bank_value&7)>>1);
|
||||
case 4:
|
||||
setprg32(0x8000,8+(bank_value&7)); break;
|
||||
case 5:
|
||||
setprg16(0x8000,((8+(bank_value&7))>>1)+prgb[1]);
|
||||
setprg16(0xC000,((8+(bank_value&7))>>1)+prgb[3]);
|
||||
case 2:
|
||||
setprg8(0x8000,prgb[0]>>2);
|
||||
setprg8(0xa000,prgb[1]);
|
||||
setprg8(0xc000,prgb[2]);
|
||||
setprg8(0xe000,~0);
|
||||
break;
|
||||
case 3:
|
||||
setprg8(0x8000,prgb[0]);
|
||||
setprg8(0xa000,prgb[1]);
|
||||
setprg8(0xc000,prgb[2]);
|
||||
setprg8(0xe000,prgb[3]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(BMC13in1JY110Write)
|
||||
{
|
||||
FCEU_printf("%04x:%04x\n",A,V);
|
||||
switch(A)
|
||||
{
|
||||
case 0x8000:
|
||||
case 0x8001:
|
||||
case 0x8002:
|
||||
case 0x8003: prgb[A&3]=V; break;
|
||||
case 0xD000: bank_mode=V; break;
|
||||
case 0xD001: setmirror(V&3);
|
||||
case 0xD002: break;
|
||||
case 0xD003: bank_value=V; break;
|
||||
}
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void BMC13in1JY110Power(void)
|
||||
{
|
||||
prgb[0]=prgb[1]=prgb[2]=prgb[3]=0;
|
||||
bank_mode=0;
|
||||
bank_value=0;
|
||||
setprg32(0x8000,0);
|
||||
setchr8(0);
|
||||
SetWriteHandler(0x8000,0xFFFF,BMC13in1JY110Write);
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
Sync();
|
||||
}
|
||||
|
||||
void BMC13in1JY110_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=BMC13in1JY110Power;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
GameStateRestore=StateRestore;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,110 @@
|
|||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 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
|
||||
*
|
||||
* BMC 42-in-1 reset switch
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
extern uint32 ROM_size;
|
||||
static uint8 hrd_sw;
|
||||
static uint8 latche;
|
||||
static SFORMAT StateRegs[]=
|
||||
{
|
||||
{&hrd_sw, 1, "DIPSW"},
|
||||
{&latche, 1, "LATCHE"},
|
||||
{&hrd_sw, 1, "HRDSW"},
|
||||
{0}
|
||||
};
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
/* if(!(latche&0x02))
|
||||
setprg32r(0,0x8000,(latche&0x3F)>>1);
|
||||
else
|
||||
{
|
||||
setprg16r(0,0x8000,latche&0x3f);
|
||||
setprg16r(0,0xC000,latche&0x3f);
|
||||
}
|
||||
*/
|
||||
if(!(latche&0x20))
|
||||
setprg32r(hrd_sw,0x8000,(latche>>1)&0x0f);
|
||||
else
|
||||
{
|
||||
setprg16r(hrd_sw,0x8000,latche&0x1f);
|
||||
setprg16r(hrd_sw,0xC000,latche&0x1f);
|
||||
}
|
||||
setmirror((latche>>6)&1);
|
||||
}
|
||||
|
||||
static DECLFW(BMC42in1rWrite)
|
||||
{
|
||||
latche=V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void BMC42in1rReset(void)
|
||||
{
|
||||
hrd_sw^=1;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void BMC42in1rPower(void)
|
||||
{
|
||||
latche=0;
|
||||
hrd_sw=0;
|
||||
setchr8(0);
|
||||
Sync();
|
||||
SetWriteHandler(0x8000,0xFFFF,BMC42in1rWrite);
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
Sync();
|
||||
}
|
||||
|
||||
void BMC42in1r_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=BMC42in1rPower;
|
||||
info->Reset=BMC42in1rReset;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
GameStateRestore=StateRestore;
|
||||
}
|
||||
|
||||
static void M226Power(void)
|
||||
{
|
||||
if(ROM_size==64)
|
||||
SetupCartPRGMapping(1,PRGptr[0]+512*1024,512,0);
|
||||
latche=0;
|
||||
hrd_sw=0;
|
||||
setchr8(0);
|
||||
Sync();
|
||||
SetWriteHandler(0x8000,0xFFFF,BMC42in1rWrite);
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
}
|
||||
|
||||
void Mapper226_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=M226Power;
|
||||
info->Reset=BMC42in1rReset;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
GameStateRestore=StateRestore;
|
||||
}
|
||||
|
|
@ -0,0 +1,93 @@
|
|||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 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
|
||||
*
|
||||
* BMC 42-in-1 reset switch
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 regs[4];
|
||||
|
||||
static SFORMAT StateRegs[]=
|
||||
{
|
||||
{regs, 4, "REGS"},
|
||||
{0}
|
||||
};
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
if(regs[0]&0x80)
|
||||
{
|
||||
if(regs[1]&0x80)
|
||||
setprg32(0x8000,regs[1]&0x1F);
|
||||
else
|
||||
{
|
||||
int bank=((regs[1]&0x1f)<<1)|((regs[1]>>6)&1);
|
||||
setprg16(0x8000,bank);
|
||||
setprg16(0xC000,bank);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int bank=((regs[1]&0x1f)<<1)|((regs[1]>>6)&1);
|
||||
setprg16(0xC000,bank);
|
||||
}
|
||||
if(regs[0]&0x20)
|
||||
setmirror(MI_H);
|
||||
else
|
||||
setmirror(MI_V);
|
||||
setchr8((regs[2]<<2)|((regs[0]>>1)&3));
|
||||
}
|
||||
|
||||
static DECLFW(BMC64in1nrWriteLo)
|
||||
{
|
||||
regs[A&3]=V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(BMC64in1nrWriteHi)
|
||||
{
|
||||
regs[3]=V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void BMC64in1nrPower(void)
|
||||
{
|
||||
regs[0]=0x80;
|
||||
regs[1]=0x43;
|
||||
regs[2]=regs[3]=0;
|
||||
Sync();
|
||||
SetWriteHandler(0x5000,0x5003,BMC64in1nrWriteLo);
|
||||
SetWriteHandler(0x8000,0xFFFF,BMC64in1nrWriteHi);
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
Sync();
|
||||
}
|
||||
|
||||
void BMC64in1nr_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=BMC64in1nrPower;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
GameStateRestore=StateRestore;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,130 @@
|
|||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 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 uint8 is_large_banks, hw_switch;
|
||||
static uint8 large_bank;
|
||||
static uint8 prg_bank;
|
||||
static uint8 chr_bank;
|
||||
static uint8 bank_mode;
|
||||
static uint8 mirroring;
|
||||
static SFORMAT StateRegs[]=
|
||||
{
|
||||
{&large_bank, 1, "LB"},
|
||||
{&hw_switch, 1, "DIPSW"},
|
||||
{&prg_bank, 1, "PRG"},
|
||||
{&chr_bank, 1, "CHR"},
|
||||
{&bank_mode, 1, "BM"},
|
||||
{&mirroring, 1, "MIRR"},
|
||||
{0}
|
||||
};
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
switch (bank_mode)
|
||||
{
|
||||
case 0x00:
|
||||
case 0x10: setprg16(0x8000,large_bank|prg_bank);
|
||||
setprg16(0xC000,large_bank|7);
|
||||
break;
|
||||
case 0x20: setprg32(0x8000,(large_bank|prg_bank)>>1);
|
||||
break;
|
||||
case 0x30: setprg16(0x8000,large_bank|prg_bank);
|
||||
setprg16(0xC000,large_bank|prg_bank);
|
||||
break;
|
||||
}
|
||||
setmirror(mirroring);
|
||||
if(!is_large_banks)
|
||||
setchr8(chr_bank);
|
||||
}
|
||||
|
||||
static DECLFR(BMC70in1Read)
|
||||
{
|
||||
if(bank_mode==0x10)
|
||||
// if(is_large_banks)
|
||||
return CartBR((A&0xFFF0)|hw_switch);
|
||||
// else
|
||||
// return CartBR((A&0xFFF0)|hw_switch);
|
||||
else
|
||||
return CartBR(A);
|
||||
}
|
||||
|
||||
static DECLFW(BMC70in1Write)
|
||||
{
|
||||
if(A&0x4000)
|
||||
{
|
||||
bank_mode=A&0x30;
|
||||
prg_bank=A&7;
|
||||
}
|
||||
else
|
||||
{
|
||||
mirroring=((A&0x20)>>5)^1;
|
||||
if(is_large_banks)
|
||||
large_bank=(A&3)<<3;
|
||||
else
|
||||
chr_bank=A&7;
|
||||
}
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void BMC70in1Reset(void)
|
||||
{
|
||||
bank_mode=0;
|
||||
large_bank=0;
|
||||
Sync();
|
||||
hw_switch++;
|
||||
hw_switch&=0xf;
|
||||
}
|
||||
|
||||
static void BMC70in1Power(void)
|
||||
{
|
||||
setchr8(0);
|
||||
bank_mode=0;
|
||||
large_bank=0;
|
||||
Sync();
|
||||
SetReadHandler(0x8000,0xFFFF,BMC70in1Read);
|
||||
SetWriteHandler(0x8000,0xffff,BMC70in1Write);
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
Sync();
|
||||
}
|
||||
|
||||
void BMC70in1_Init(CartInfo *info)
|
||||
{
|
||||
is_large_banks=0;
|
||||
hw_switch=0xd;
|
||||
info->Power=BMC70in1Power;
|
||||
info->Reset=BMC70in1Reset;
|
||||
GameStateRestore=StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
void BMC70in1B_Init(CartInfo *info)
|
||||
{
|
||||
is_large_banks=1;
|
||||
hw_switch=0x6;
|
||||
info->Power=BMC70in1Power;
|
||||
info->Reset=BMC70in1Reset;
|
||||
GameStateRestore=StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
|
@ -0,0 +1,139 @@
|
|||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 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 uint8 prg_reg;
|
||||
static uint8 chr_reg;
|
||||
|
||||
static uint8 sim0reg, sim0bit, sim0byte, sim0parity, sim0bcnt;
|
||||
static uint16 sim0data;
|
||||
static uint8 sim0array[128] =
|
||||
{
|
||||
0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
|
||||
0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
|
||||
0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
|
||||
0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
|
||||
0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
|
||||
0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
|
||||
0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
|
||||
0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0xAA,
|
||||
};
|
||||
|
||||
static SFORMAT StateRegs[]=
|
||||
{
|
||||
{&prg_reg, 1, "PREG"},
|
||||
{&chr_reg, 1, "CREG"},
|
||||
{0}
|
||||
};
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setprg32(0x8000, prg_reg);
|
||||
setchr8(chr_reg);
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(M216WriteHi)
|
||||
{
|
||||
// FCEU_printf("%04x:%04x\n",A,V);
|
||||
prg_reg=A&1;
|
||||
chr_reg=(A&0x0E)>>1;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(M216Write5000)
|
||||
{
|
||||
// FCEU_printf("WRITE: %04x:%04x\n",A,V);
|
||||
sim0reg=V;
|
||||
if(!sim0reg)
|
||||
{
|
||||
sim0bit=sim0byte=sim0parity=0;
|
||||
sim0data=sim0array[0];
|
||||
sim0bcnt=0x80;
|
||||
}
|
||||
else if(sim0reg&0x20)
|
||||
{
|
||||
sim0bcnt=0x20;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFR(M216Read5000)
|
||||
{
|
||||
if(sim0reg&0x60)
|
||||
{
|
||||
sim0reg=(sim0reg^(sim0reg<<1))&0x40;
|
||||
return sim0reg;
|
||||
}
|
||||
else
|
||||
{
|
||||
uint8 sim0out=0;
|
||||
if(sim0bit<8)
|
||||
{
|
||||
// sim0data=((sim0array[sim0byte]<<(sim0bit))&0x80)>>1;
|
||||
sim0out=(sim0data&1)<<6;
|
||||
sim0data>>=1;
|
||||
sim0bit++;
|
||||
sim0parity+=sim0data;
|
||||
}
|
||||
else if(sim0bit==8)
|
||||
{
|
||||
sim0bit++;
|
||||
sim0out=sim0parity&1;
|
||||
}
|
||||
else if(sim0bit==9)
|
||||
{
|
||||
if(sim0byte==sim0bcnt)
|
||||
sim0out=0x60;
|
||||
else
|
||||
{
|
||||
sim0bit=0;
|
||||
sim0byte++;
|
||||
sim0data=sim0array[sim0byte];
|
||||
sim0out=0;
|
||||
}
|
||||
}
|
||||
// FCEU_printf("READ: %04x (%04x-%02x,%04x)\n",A,X.PC,sim0out,sim0byte);
|
||||
return sim0out;
|
||||
}
|
||||
}
|
||||
|
||||
static void Power(void)
|
||||
{
|
||||
prg_reg = 0;
|
||||
chr_reg = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
SetWriteHandler(0x8000,0xFFFF,M216WriteHi);
|
||||
SetWriteHandler(0x5000,0x5000,M216Write5000);
|
||||
SetReadHandler(0x5000,0x5000,M216Read5000);
|
||||
}
|
||||
|
||||
|
||||
void Mapper216_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=Power;
|
||||
GameStateRestore=StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
|
@ -0,0 +1,350 @@
|
|||
/* 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 latche, latcheinit;
|
||||
static uint16 addrreg0, addrreg1;
|
||||
static void(*WSync)(void);
|
||||
|
||||
static DECLFW(LatchWrite)
|
||||
{
|
||||
// FCEU_printf("bs %04x %02x\n",A,V);
|
||||
latche=V;
|
||||
WSync();
|
||||
}
|
||||
|
||||
static void LatchPower(void)
|
||||
{
|
||||
latche=latcheinit;
|
||||
WSync();
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
SetWriteHandler(addrreg0,addrreg1,LatchWrite);
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
WSync();
|
||||
}
|
||||
|
||||
static void Latch_Init(CartInfo *info, void (*proc)(void), uint8 init, uint16 adr0, uint16 adr1)
|
||||
{
|
||||
latcheinit=init;
|
||||
addrreg0=adr0;
|
||||
addrreg1=adr1;
|
||||
WSync=proc;
|
||||
info->Power=LatchPower;
|
||||
GameStateRestore=StateRestore;
|
||||
AddExState(&latche, 1, 0, "LATC");
|
||||
}
|
||||
|
||||
//------------------ CPROM ---------------------------
|
||||
|
||||
static void CPROMSync(void)
|
||||
{
|
||||
setchr4(0x0000,0);
|
||||
setchr4(0x1000,latche&3);
|
||||
setprg16(0x8000,0);
|
||||
setprg16(0xC000,1);
|
||||
}
|
||||
|
||||
void CPROM_Init(CartInfo *info)
|
||||
{
|
||||
Latch_Init(info, CPROMSync, 0, 0x8000, 0xFFFF);
|
||||
}
|
||||
|
||||
//------------------ Map 184 ---------------------------
|
||||
|
||||
static void M184Sync(void)
|
||||
{
|
||||
setchr4(0x0000,latche);
|
||||
setchr4(0x1000,latche>>4);
|
||||
setprg16(0x8000,0);
|
||||
setprg16(0xC000,1);
|
||||
}
|
||||
|
||||
void Mapper184_Init(CartInfo *info)
|
||||
{
|
||||
Latch_Init(info, M184Sync, 0, 0x6000, 0x7FFF);
|
||||
}
|
||||
|
||||
//------------------ CNROM ---------------------------
|
||||
|
||||
static void CNROMSync(void)
|
||||
{
|
||||
setchr8(latche&3);
|
||||
setprg16(0x8000,0);
|
||||
setprg16(0xC000,1);
|
||||
}
|
||||
|
||||
void CNROM_Init(CartInfo *info)
|
||||
{
|
||||
Latch_Init(info, CNROMSync, 0, 0x8000, 0xFFFF);
|
||||
}
|
||||
|
||||
//------------------ ANROM ---------------------------
|
||||
|
||||
static void ANROMSync()
|
||||
{
|
||||
setprg32(0x8000,latche&0xf);
|
||||
setmirror(MI_0+((latche>>4)&1));
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
void ANROM_Init(CartInfo *info)
|
||||
{
|
||||
Latch_Init(info, ANROMSync, 0, 0x8000, 0xFFFF);
|
||||
}
|
||||
|
||||
//------------------ Map 70 ---------------------------
|
||||
|
||||
static void M70Sync()
|
||||
{
|
||||
setprg16(0x8000,latche>>4);
|
||||
setprg16(0xc000,~0);
|
||||
setchr8(latche&0xf);
|
||||
}
|
||||
|
||||
void Mapper70_Init(CartInfo *info)
|
||||
{
|
||||
Latch_Init(info, M70Sync, 0, 0x8000, 0xFFFF);
|
||||
}
|
||||
|
||||
//------------------ Map 152 ---------------------------
|
||||
|
||||
static void M152Sync()
|
||||
{
|
||||
setprg16(0x8000,(latche>>4)&7);
|
||||
setprg16(0xc000,~0);
|
||||
setchr8(latche&0xf);
|
||||
setmirror(MI_0+((latche>>7)&1)); /* Saint Seiya...hmm. */
|
||||
}
|
||||
|
||||
void Mapper152_Init(CartInfo *info)
|
||||
{
|
||||
Latch_Init(info, M152Sync, 0, 0x8000, 0xFFFF);
|
||||
}
|
||||
|
||||
//------------------ Map 78 ---------------------------
|
||||
/* Should be two separate emulation functions for this "mapper". Sigh. URGE TO KILL RISING. */
|
||||
static void M78Sync()
|
||||
{
|
||||
setprg16(0x8000,(latche&7));
|
||||
setprg16(0xc000,~0);
|
||||
setchr8(latche>>4);
|
||||
setmirror(MI_0+((latche>>3)&1));
|
||||
}
|
||||
|
||||
void Mapper78_Init(CartInfo *info)
|
||||
{
|
||||
Latch_Init(info, M78Sync, 0, 0x8000, 0xFFFF);
|
||||
}
|
||||
|
||||
//------------------ MHROM ---------------------------
|
||||
|
||||
static void MHROMSync(void)
|
||||
{
|
||||
setprg32(0x8000,latche>>4);
|
||||
setchr8(latche&0xf);
|
||||
}
|
||||
|
||||
void MHROM_Init(CartInfo *info)
|
||||
{
|
||||
Latch_Init(info, MHROMSync, 0, 0x8000, 0xFFFF);
|
||||
}
|
||||
|
||||
void Mapper140_Init(CartInfo *info)
|
||||
{
|
||||
Latch_Init(info, MHROMSync, 0, 0x6000, 0x7FFF);
|
||||
}
|
||||
|
||||
void Mapper240_Init(CartInfo *info)
|
||||
{
|
||||
Latch_Init(info, MHROMSync, 0, 0x4020, 0x5FFF);
|
||||
// need SRAM.
|
||||
}
|
||||
|
||||
//------------------ Map 87 ---------------------------
|
||||
|
||||
static void M87Sync(void)
|
||||
{
|
||||
setprg16(0x8000,0);
|
||||
setprg16(0xC000,1);
|
||||
setchr8(latche>>1);
|
||||
}
|
||||
|
||||
void Mapper87_Init(CartInfo *info)
|
||||
{
|
||||
Latch_Init(info, M87Sync, ~0, 0x6000, 0xFFFF);
|
||||
}
|
||||
|
||||
//------------------ Map 11 ---------------------------
|
||||
|
||||
static void M11Sync(void)
|
||||
{
|
||||
setprg32(0x8000,latche&0xf);
|
||||
setchr8(latche>>4);
|
||||
}
|
||||
|
||||
void Mapper11_Init(CartInfo *info)
|
||||
{
|
||||
Latch_Init(info, M11Sync, 0, 0x8000, 0xFFFF);
|
||||
}
|
||||
|
||||
void Mapper144_Init(CartInfo *info)
|
||||
{
|
||||
Latch_Init(info, M11Sync, 0, 0x8001, 0xFFFF);
|
||||
}
|
||||
|
||||
//------------------ UNROM ---------------------------
|
||||
|
||||
static void UNROMSync(void)
|
||||
{
|
||||
setprg16(0x8000,latche);
|
||||
setprg16(0xc000,~0);
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
void UNROM_Init(CartInfo *info)
|
||||
{
|
||||
Latch_Init(info, UNROMSync, 0, 0x8000, 0xFFFF);
|
||||
}
|
||||
|
||||
//------------------ Map 93 ---------------------------
|
||||
|
||||
static void SSUNROMSync(void)
|
||||
{
|
||||
setprg16(0x8000,latche>>4);
|
||||
setprg16(0xc000,~0);
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
void SUNSOFT_UNROM_Init(CartInfo *info)
|
||||
{
|
||||
Latch_Init(info, SSUNROMSync, 0, 0x8000, 0xFFFF);
|
||||
}
|
||||
|
||||
//------------------ Map 94 ---------------------------
|
||||
|
||||
static void M94Sync(void)
|
||||
{
|
||||
setprg16(0x8000,latche>>2);
|
||||
setprg16(0xc000,~0);
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
void Mapper94_Init(CartInfo *info)
|
||||
{
|
||||
Latch_Init(info, M94Sync, 0, 0x8000, 0xFFFF);
|
||||
}
|
||||
|
||||
//------------------ Map 180 ---------------------------
|
||||
|
||||
static void M180Sync(void)
|
||||
{
|
||||
setprg16(0x8000,0);
|
||||
setprg16(0xc000,latche);
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
void Mapper180_Init(CartInfo *info)
|
||||
{
|
||||
Latch_Init(info, M180Sync, 0, 0x8000, 0xFFFF);
|
||||
}
|
||||
|
||||
//------------------ Map 107 ---------------------------
|
||||
|
||||
static void M107Sync(void)
|
||||
{
|
||||
setprg32(0x8000,(latche>>1)&3);
|
||||
setchr8(latche&7);
|
||||
}
|
||||
|
||||
void Mapper107_Init(CartInfo *info)
|
||||
{
|
||||
Latch_Init(info, M107Sync, ~0, 0x8000, 0xFFFF);
|
||||
}
|
||||
|
||||
//------------------ Map 113 ---------------------------
|
||||
|
||||
static void M113Sync(void)
|
||||
{
|
||||
setprg32(0x8000,(latche>>3)&7);
|
||||
setchr8(((latche>>3)&8)|(latche&7));
|
||||
// setmirror(latche>>7); // only for HES 6in1
|
||||
}
|
||||
|
||||
void Mapper113_Init(CartInfo *info)
|
||||
{
|
||||
Latch_Init(info, M113Sync, 0, 0x4100, 0x7FFF);
|
||||
}
|
||||
|
||||
//------------------ A65AS ---------------------------
|
||||
|
||||
// actually, there is two cart in one... First have extra mirroring
|
||||
// mode (one screen) and 32K bankswitching, second one have only
|
||||
// 16 bankswitching mode and normal mirroring... But there is no any
|
||||
// correlations between modes and they can be used in one mapper code.
|
||||
|
||||
static void BMCA65ASSync(void)
|
||||
{
|
||||
if(latche&0x40)
|
||||
setprg32(0x8000,(latche>>1)&0x0F);
|
||||
else
|
||||
{
|
||||
setprg16(0x8000,((latche&0x30)>>1)|(latche&7));
|
||||
setprg16(0xC000,((latche&0x30)>>1)|7);
|
||||
}
|
||||
setchr8(0);
|
||||
if(latche&0x80)
|
||||
setmirror(MI_0+(((latche>>5)&1)));
|
||||
else
|
||||
setmirror(((latche>>3)&1)^1);
|
||||
}
|
||||
|
||||
void BMCA65AS_Init(CartInfo *info)
|
||||
{
|
||||
Latch_Init(info, BMCA65ASSync, 0, 0x8000, 0xFFFF);
|
||||
}
|
||||
|
||||
//------------------ NROM ---------------------------
|
||||
|
||||
#ifdef DEBUG_MAPPER
|
||||
static DECLFW(WriteHandler)
|
||||
{
|
||||
FCEU_printf("bs %04x %02x\n",A,V);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void NROMPower(void)
|
||||
{
|
||||
setprg16(0x8000,0);
|
||||
setprg16(0xC000,~0);
|
||||
setchr8(0);
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
#ifdef DEBUG_MAPPER
|
||||
SetWriteHandler(0x4020,0xFFFF,WriteHandler);
|
||||
#endif
|
||||
}
|
||||
|
||||
void NROM_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=NROMPower;
|
||||
}
|
|
@ -0,0 +1,82 @@
|
|||
/* 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 DEI_StateRegs[]=
|
||||
{
|
||||
{&cmd, 1, "CMD"},
|
||||
{DRegs, 8, "DREG"},
|
||||
{0}
|
||||
};
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
int x;
|
||||
setchr2(0x0000,DRegs[0]);
|
||||
setchr2(0x0800,DRegs[1]);
|
||||
for(x=0;x<4;x++)
|
||||
setchr1(0x1000+(x<<10),DRegs[2+x]);
|
||||
setprg8(0x8000,DRegs[6]);
|
||||
setprg8(0xa000,DRegs[7]);
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(DEIWrite)
|
||||
{
|
||||
switch(A&0x8001)
|
||||
{
|
||||
case 0x8000: cmd=V&0x07; break;
|
||||
case 0x8001: if(cmd<=0x05)
|
||||
V&=0x3F;
|
||||
else
|
||||
V&=0x0F;
|
||||
if(cmd<=0x01) V>>=1;
|
||||
DRegs[cmd&0x07]=V;
|
||||
Sync();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void DEIPower(void)
|
||||
{
|
||||
setprg8(0xc000,0xE);
|
||||
setprg8(0xe000,0xF);
|
||||
cmd=0;
|
||||
memset(DRegs,0,8);
|
||||
Sync();
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
SetWriteHandler(0x8000,0xFFFF,DEIWrite);
|
||||
}
|
||||
|
||||
|
||||
void DEIROM_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=DEIPower;
|
||||
GameStateRestore=StateRestore;
|
||||
AddExState(&DEI_StateRegs, ~0, 0, 0);
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 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 uint8 latche;
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setprg16(0x8000,latche);
|
||||
setprg16(0xC000,8);
|
||||
}
|
||||
|
||||
static DECLFW(DREAMWrite)
|
||||
{
|
||||
latche=V&7;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void DREAMPower(void)
|
||||
{
|
||||
latche=0;
|
||||
Sync();
|
||||
setchr8(0);
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
SetWriteHandler(0x5020,0x5020,DREAMWrite);
|
||||
}
|
||||
|
||||
static void Restore(int version)
|
||||
{
|
||||
Sync();
|
||||
}
|
||||
|
||||
void DreamTech01_Init(CartInfo *info)
|
||||
{
|
||||
GameStateRestore=Restore;
|
||||
info->Power=DREAMPower;
|
||||
AddExState(&latche, 1, 0, "LATCH");
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue