46 Commits

Author SHA1 Message Date
clobber 1b76eae51e Update to FCEUX 2.6.3 2022-12-16 17:49:38 -07:00
clobber 4db4639569 Update to FCEUX 2.6.2 2022-12-16 17:34:24 -07:00
clobber 1e9dc7ee26 Update to FCEUX 2.6.1 2022-12-16 17:28:16 -07:00
clobber e62374c88d Update to FCEUX 2.6.0 2022-12-16 17:23:14 -07:00
clobber c4ea492891 Update to FCEUX 2.5.0 2022-12-16 16:58:06 -07:00
clobber 4b460d1cb8 Update to FCEUX 2.4.0 2022-12-16 16:44:41 -07:00
clobber 14cfd5c93c Update to FCEUX 2.3.0 2022-12-16 16:32:10 -07:00
C.W. Betts 14a65ab35d Minor Xcode maintenance.
Remove the ~attic directory.
2021-03-22 01:02:58 -06:00
C.W. Betts 46d186d251 Poke the plists: get the development language from Xcode build. 2020-10-01 01:51:37 -06:00
C.W. Betts b1a06da5ba Fix locations of the system plugin headers.
Minor Xcode maintenance.
2020-10-01 01:26:41 -06:00
C.W. Betts 7bd6e5ea8b Update language resources.
This quiets warnings in newer Xcode releases.

Also update framework locations.
2020-01-07 16:36:20 -07:00
clobber 9d79c1a4a5 Bump version for sparkle updater. Core is still 2.2.3 2018-12-08 23:22:48 -06:00
clobber c1271716eb Add support for Raw cheat formats 2018-12-08 23:22:32 -06:00
clobber cd166c0561 Bump version for sparkle updater. Core is still 2.2.3 2018-11-25 16:15:16 -06:00
clobber dd9e1c3cee Cleanup 2018-11-25 16:14:41 -06:00
clobber 28ae039566 Add display mode change support 2018-11-23 00:54:14 -06:00
clobber 33026a6424 Cleanup 2018-11-22 21:11:38 -06:00
clobber 10e4d8fd38 Build fix for latest Clang.
cheat.cpp:219:30: error: ordered comparison between pointer and zero ('char *' and 'int')
2018-04-05 02:11:16 -05:00
clobber 2758d42404 Use -fileSystemRepresentation instead of -UTF8String for file names 2017-08-16 23:42:32 -05:00
Rudy Richter 0fa341d5c1 these should be uint32_t not uint8_t 2017-07-20 20:54:58 -04:00
Rudy Richter 5bfdfc26d4 Use spaces 2017-07-20 08:50:47 -04:00
mrvacbob 22d81842fa Enable direct-rendering 2017-07-20 01:35:09 -07:00
clobber cf62e4485d Update to FCEUX 2.2.3 2016-07-29 20:19:00 -05:00
clobber 386ca2848a Bump version for sparkle updater. Core is still 2.2.2 2016-07-01 10:50:05 -05:00
clobber a8a134743c Limit rewind buffer to 60 seconds to reduce memory use 2016-06-30 01:31:34 -05:00
clobber 8e623dcfa7 Clean up deprecated methods. 2015-12-12 17:04:18 -08:00
Alexander Strange 5592177ae5 Update projects - fix debug builds, make deployment 10.11, enable objc-arc properly, build faster 2015-10-17 13:04:19 -07:00
clobber 426ffab330 Turn off GCC_NO_COMMON_BLOCKS 2015-10-09 19:32:22 -05:00
Christoph Leimbrock a5655e1561 Fix some warning and adjust project settings. 2015-10-06 22:04:33 +02:00
clobber 40753990cf Enabled cheat support 2015-07-25 03:38:56 -05:00
clobber c2fc9285f3 Fix PAR
We don't have left/right overscan borders or crop the top/bottom scanlines for the drawing area like a real NTSC TV, instead we display the entire PPU framebuffer 256x240 pixel picture. On a 4:3 TV, the NES would have a 8:7 Pixel Aspect Ratio so we must maintain that by correcting the width to 256 * 8/7 PAR (~1.143:1), so 292x240 non-square pixels. This gives us the same look as a 4:3 TV with the proper PAR for NES, without overscan.

Docs: http://wiki.nesdev.com/w/index.php/Overscan
Test ROM: https://github.com/christopherpow/nes-test-roms/tree/master/tvpassfail
2015-05-25 11:58:53 -05:00
clobber 14dc02a2b2 Add fourscore-supported homebrew entry
Battle City (Japan) (4 Players Hack) http://www.romhacking.net/hacks/2142/
2015-05-24 01:15:01 -05:00
clobber 51f7a17553 Add some notable fourscore-supported homebrew entries
Bomberman 3 http://tempect.de/senil/games.html
K.Y.F.F. http://slydogstudios.org/index.php/k-y-f-f/
Super PakPak http://wiki.nesdev.com/w/index.php/Super_PakPak
2015-05-21 01:51:47 -05:00
clobber fbac02e25a Fix some JP 4-player entries 2015-05-21 01:51:09 -05:00
clobber 972d43dc05 Update internal db entries for known Zapper supported games 2015-05-08 15:41:43 -05:00
clobber bcbef6a03a Adjust pointer coords for 4:3 aspect ratio correction 2015-04-26 18:08:34 -05:00
clobber 9d3ff770e4 Automatically support 3-4 players where available 2015-04-26 18:04:33 -05:00
clobber e9c3efd23f Support zapper, hyper shot and arkanoid controller 2015-04-20 21:55:48 -05:00
clobber 9e543bbbec Create the battery saves dir 2015-03-15 19:13:05 -05:00
Kyle Lacy 465031eb8c Add plist properties to support rewinding 2015-03-01 22:34:13 -08:00
Kyle Lacy 8a31b32c94 Implement state serialization/deserialization 2015-03-01 17:41:32 -08:00
Christoph Leimbrock d31dfd6af3 Fix debug build by enabling dead code stripping. 2015-03-01 14:17:54 +01:00
clobber 98acf529e8 Update to FCEUX 2.2.2 2015-02-27 03:58:36 -06:00
clobber e5e1a41c77 Add error: parameter to -loadFileAtPath: method. 2014-02-08 14:22:44 -08:00
Alexander Strange b775c7e099 Compilation speed: enable modules 2014-01-19 22:29:27 -08:00
clobber e552d8e794 Update spakle update URL and remove DSA key 2013-12-21 21:50:03 -06:00
571 changed files with 97879 additions and 53858 deletions
-647
View File
@@ -1,647 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">1060</int>
<string key="IBDocument.SystemVersion">11C74</string>
<string key="IBDocument.InterfaceBuilderVersion">1938</string>
<string key="IBDocument.AppKitVersion">1138.23</string>
<string key="IBDocument.HIToolboxVersion">567.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="NS.object.0">1938</string>
</object>
<array key="IBDocument.IntegratedClassDependencies">
<string>NSTextField</string>
<string>NSCustomObject</string>
<string>NSMatrix</string>
<string>NSStepper</string>
<string>NSNumberFormatter</string>
<string>NSCustomView</string>
<string>NSButtonCell</string>
<string>NSStepperCell</string>
<string>NSTextFieldCell</string>
</array>
<array key="IBDocument.PluginDependencies">
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</array>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
<integer value="1" key="NS.object.0"/>
</object>
<array class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<object class="NSCustomObject" id="1001">
<string key="NSClassName">GBAControlsPreference</string>
</object>
<object class="NSCustomObject" id="1003">
<string key="NSClassName">FirstResponder</string>
</object>
<object class="NSCustomObject" id="1004">
<string key="NSClassName">NSApplication</string>
</object>
<object class="NSCustomView" id="1005">
<reference key="NSNextResponder"/>
<int key="NSvFlags">268</int>
<array class="NSMutableArray" key="NSSubviews">
<object class="NSTextField" id="529444683">
<reference key="NSNextResponder" ref="1005"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{168, 260}, {101, 17}}</string>
<reference key="NSSuperview" ref="1005"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="806786179"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="262381886">
<int key="NSCellFlags">68288064</int>
<int key="NSCellFlags2">272630784</int>
<string key="NSContents">Show bindings:</string>
<object class="NSFont" key="NSSupport" id="385894065">
<string key="NSName">LucidaGrande</string>
<double key="NSSize">13</double>
<int key="NSfFlags">1044</int>
</object>
<reference key="NSControlView" ref="529444683"/>
<object class="NSColor" key="NSBackgroundColor" id="976045936">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">controlColor</string>
<object class="NSColor" key="NSColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
</object>
</object>
<object class="NSColor" key="NSTextColor" id="522026884">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">controlTextColor</string>
<object class="NSColor" key="NSColor" id="909323645">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MAA</bytes>
</object>
</object>
</object>
</object>
<object class="NSMatrix" id="806786179">
<reference key="NSNextResponder" ref="1005"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{274, 259}, {168, 18}}</string>
<reference key="NSSuperview" ref="1005"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<bool key="NSEnabled">YES</bool>
<int key="NSNumRows">1</int>
<int key="NSNumCols">2</int>
<array class="NSMutableArray" key="NSCells">
<object class="NSButtonCell" id="165264936">
<int key="NSCellFlags">-2080244224</int>
<int key="NSCellFlags2">0</int>
<string key="NSContents">Keyboard</string>
<reference key="NSSupport" ref="385894065"/>
<reference key="NSControlView" ref="806786179"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">0</int>
<object class="NSButtonImageSource" key="NSAlternateImage" id="671804640">
<string key="NSImageName">NSRadioButton</string>
</object>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
<int key="NSPeriodicDelay">200</int>
<int key="NSPeriodicInterval">25</int>
</object>
<object class="NSButtonCell" id="223753203">
<int key="NSCellFlags">67239424</int>
<int key="NSCellFlags2">0</int>
<string key="NSContents">Gamepad</string>
<reference key="NSSupport" ref="385894065"/>
<reference key="NSControlView" ref="806786179"/>
<int key="NSTag">1</int>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">0</int>
<object class="NSImage" key="NSNormalImage">
<int key="NSImageFlags">549453824</int>
<string key="NSSize">{18, 18}</string>
<array class="NSMutableArray" key="NSReps">
<array>
<integer value="0"/>
<object class="NSBitmapImageRep">
<object class="NSData" key="NSTIFFRepresentation">
<bytes key="NS.bytes">TU0AKgAABRgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAADwRERGLJycnySsrK/A1NTXw
IyMjyRwcHIsJCQk8AAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFFRUVdVBQUOCoqKj/
29vb//n5+f/6+vr/2tra/6qqqv9UVFTgHx8fdQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUZGRl5
dXV198PDw//8/Pz////////////////////////////U1NT/fHx89yUlJXkAAAAFAAAAAAAAAAAAAAAA
AAAAAxEREUZqamrmtbW1/+3t7f/+/v7//v7+//7+/v/9/f3//f39//39/f/39/f/xMTE/3d3d+YZGRlG
AAAAAwAAAAAAAAAAAAAACkJCQqGtra3/xsbG/+vr6//y8vL/9fX1//X19f/z8/P/9fX1//Ly8v/u7u7/
0tLS/6+vr/9KSkqhAAAACgAAAAAAAAAAAAAAF3h4eN2/v7//z8/P/93d3f/q6ur/7+/v/+/v7//w8PD/
7e3t/+3t7f/i4uL/zs7O/8XFxf98fHzdAAAAFwAAAAAAAAADAAAAJKSkpPjOzs7/2dnZ/+Dg4P/i4uL/
5eXl/+bm5v/n5+f/5eXl/+Li4v/e3t7/2tra/9DQ0P+srKz4AAAAJAAAAAMAAAADAAAALrCwsPrW1tb/
3t7e/+Tk5P/p6en/6+vr/+zs7P/p6en/6+vr/+fn5//k5OT/4ODg/9nZ2f+zs7P6AAAALgAAAAMAAAAD
AAAALp2dnezg4OD/5eXl/+rq6v/u7u7/8PDw//Dw8P/x8fH/8PDw/+7u7v/q6ur/5ubm/+Hh4f+ZmZns
AAAALgAAAAMAAAADAAAAJG5ubs/l5eX/6enp/+/v7//y8vL/9vb2//r6+v/5+fn/9/f3//b29v/x8fH/
6+vr/+Tk5P9ra2vPAAAAJAAAAAMAAAAAAAAAFy4uLpPCwsL67Ozs//Pz8//5+fn//v7+//7+/v/+/v7/
/v7+//v7+//19fX/8PDw/8LCwvosLCyTAAAAFwAAAAAAAAAAAAAACgAAAENfX1/S5OTk/vn5+f/+/v7/
///////////////////////////8/Pz/5ubm/l9fX9IAAABDAAAACgAAAAAAAAAAAAAAAwAAABcAAABl
YmJi3NLS0v3////////////////////////////////V1dX9ZGRk3AAAAGUAAAAXAAAAAwAAAAAAAAAA
AAAAAAAAAAUAAAAfAAAAZTMzM8KAgIDwv7+//O3t7f/t7e3/v7+//ICAgPAzMzPCAAAAZQAAAB8AAAAF
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAFwAAAEMAAAB3AAAAnwAAALMAAACzAAAAnwAAAHcAAABD
AAAAFwAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAoAAAAXAAAAJAAAAC4AAAAu
AAAAJAAAABcAAAAKAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAwAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgEAAAMAAAABABIAAAEB
AAMAAAABABIAAAECAAMAAAAEAAAFxgEDAAMAAAABAAEAAAEGAAMAAAABAAIAAAERAAQAAAABAAAACAES
AAMAAAABAAEAAAEVAAMAAAABAAQAAAEWAAMAAAABABIAAAEXAAQAAAABAAAFEAEcAAMAAAABAAEAAAFS
AAMAAAABAAEAAAFTAAMAAAAEAAAFzodzAAcAABEgAAAF1gAAAAAACAAIAAgACAABAAEAAQABAAARIGFw
cGwCAAAAbW50clJHQiBYWVogB9kABQANAAAAOwAMYWNzcEFQUEwAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAPbWAAEAAAAA0y1hcHBsvQkfoRizoa3hZ+SMa9pbkwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAOclhZWgAAASwAAAAUZ1hZWgAAAUAAAAAUYlhZWgAAAVQAAAAUd3RwdAAAAWgAAAAUY2hhZAAA
AXwAAAAsclRSQwAAAagAAAAOZ1RSQwAAAbgAAAAOYlRSQwAAAcgAAAAOdmNndAAAAdgAAAYSbmRpbgAA
B+wAAAY+ZGVzYwAADiwAAABkZHNjbQAADpAAAAJCbW1vZAAAENQAAAAoY3BydAAAEPwAAAAkWFlaIAAA
AAAAAGVxAAA6MQAACZZYWVogAAAAAAAAaloAAK9yAAAa+VhZWiAAAAAAAAAnCwAAFncAAK6WWFlaIAAA
AAAAAPNSAAEAAAABFs9zZjMyAAAAAAABDEIAAAXe///zJgAAB5IAAP2R///7ov///aMAAAPcAADAbGN1
cnYAAAAAAAAAAQHNAABjdXJ2AAAAAAAAAAEBzQAAY3VydgAAAAAAAAABAc0AAHZjZ3QAAAAAAAAAAAAD
AQAAAgAAACEAcgDsAYICNQMBA/0FJAZqB84JXwsFDNYOxBDCEtwU8hczGWQbpx3qICsiciSnJuEpDys6
LUcvNjEdMwc07jbSOLI6jDxZPiE/5kGeQ1JE/UadSDdJyktZTNROVU/CUTJSmVP7VVlWulgOWV9asFv0
XTRecl+mYN5iEWNGZHNlnWbCZ+ZpCmopa0ZsXm12bo1voHCvcb9y0HPhdPF2AHcOeB55MHo2exl77nzC
fZZ+cX9IgCKA/YHagruDnoSAhWmGU4c/iC+JIYoWiw2MBYz/jf2O/o//kQGSA5MGlAaU+5XilsaXq5iS
mXeaYptRnD6dLZ4enxCgBKD4oeyi4KPVpMeluqawp52ojal8qmyrV6xArSiuD67+sACxB7ILsw60DbUM
tgu3B7f/uPS56breu9C8wb2wvp+/isB3wWbCVcNExDXFJcYYxw3IAsj4yenKwMuIzEzNDs3PzpDPT9AO
0MnRhNI/0vnTr9Rm1R3V09aL10LX+Nit2WLaGNrP24bcPdz03bDeZd8M35ngJOCt4TnhxuJU4uPjdeQH
5JjlLOXA5lPm5ud56Azon+ky6cTqU+rj63TsBeyT7SHtr+477sXvUu/g8Grw8/F68gLyjPMW86D0KPSu
9TL1tfYv9qL3Dfdm9774C/hF+H74uPjx+WT53vrU/H3+i///AAAAJAB8AQIBkAJAAxQD/gUjBlwHuQk7
CtIMiw5jEEoSOhRCFloYfRqhHMce7iEeI0slZCeEKZQrcy0kLsgwcTIaM8I1aTcOOKo6QjvaPW0+/ECI
Qg1Di0UFRnxH50lWSrVMFE1uTsNQFlFqUrJT91U9VnZXr1jjWhNbRFxtXZtew1/mYQZiJGNDZF9leGaO
Z6VovGnPauFr820Ibh5vMnBKcVxydnOQdKF1iHZldzx4F3j1edN6sXuRfHB9Vn46fx6ABIDsgdaCwIOr
hJaFgoZuh1qISIk3iiWLEov/jOuN1Y6/j6OQh5FsklKTN5QflQqV85bel8qYtpmkmpGbf5xsnVmeRZ8y
oB+hCqH0ouCjzaS0pZumhKdoqFqpZqp7q4ismq2krq2vvbDFscyyzrPRtNa12LbZt9m427nYutm73rzh
vea+77/1wQDCDcMbxCrFL8YdxvnHz8ikyXrKUcspzADM1s2szoPPWtAv0QPR19Kr03/UU9Ul1fTWv9eN
2FrZJtnw2rjbgtxI3Qfdtt5k3xHfwOBv4R/hzeJ64ynj1+SD5S7l1uZ95yTnyehu6RHpsOpR6vHrjuwq
7MbtYe377pHvKO/C8Fjw7PF/8hLyqPM+89L0YvTx9YH2EPae9yT3nPgY+KD5MfnU+pH7Z/xj/YT+m/8g
/1j/j//H//8AAAAVAEoAmQEBAXEB9QKOAzwEAATbBdMG2wgACSwKdwvHDSUOig/6EXES5RRZFcsXOBik
GgobZxy+HgsfUCCYId8jJyRqJakm4ygbKU8qfiurLNIt9i8WMDIxSzJWM2c0cDV3Nnw3fDh6OXk6cjto
PGU9ZD5mP2ZAX0FaQlJDTERBRTNGIUcQSABI7knZSsNLrkyYTYBOZk9PUDhRJFIOUvlT5FTQVb5WpFd6
WEpZFVniWrFbgFxPXRxd6l66X4lgVmElYfRiwmORZGBlLGX5ZsZnkWhfaSxp+GrDa41sVm0bbdVuhm8w
b9lwgnEmcc1ydXMac790ZXUJda92VXb6d6F4SXjyeZt6SHr1e6N8U30Gfbp+bX8kf9uAlYFTgg+CzIOK
hESFAIW+hnuHN4fziK+JbYoqiueLpIxijR6N246bj1qQG5DbkZuSXpMhk+SUqJVrljSXApfRmJ+Zb5pA
mxOb5Zy3nYueYp85oBGg6qHFoqGjgqRkpUWmJ6cJp+2o06m6qqGriKx0rV6uSa83sCOxD7IAsvKz47TZ
tc22w7e3uLS5q7qlu6C8m72Yvpe/k8CNwYrCh8OGxIDFecZ1x3DIZslmynrLk8ynzbbOus/B0MHRwNLJ
09XU3dXz1xrYStmD2sjcM92u30rhBeLm5PrnYuoP7S/w5/WS+6X//wAAbmRpbgAAAAAAAAY2AACVRgAA
Vs8AAFKpAACRTgAAKBAAABVgAABQDQAAVDkAAtwoAAKo9QABczMAAwEAAAIAAAAYADIATQBmAH4AlgCu
AMYA3QD0AQwBIgE6AVABaAF/AZcBrgHGAd8B+AIQAigCQgJcAnYCkAKrAsYC4gL/AxsDOANVA3QDkwOz
A9MD8wQVBDcEWgR9BKMEyQTyBRwFRwVzBZ8FzAX5BigGVwaHBrgG6QccB1AHhge9B/QILAhmCKII3gkc
CVsJnAnfCiMKaQqwCvkLQwuSC+EMMAyFDNoNMA2JDeQOQQ6gDv4PYA/GEC0QlBEAEXAR4RJUEs0TRBO/
FDwUuRU7Fb8WRxbSF10X6xh9GREZqRpDGt4bfRwhHMUdbB4SHrwfZyAVIMUhdCIlIuIjxiSyJaEmiid5
KGcpVypEKzAsIC0LLfYu4S/KMLMxnDKDM200VTU7NiI3Cjf0ON45yzq+O8c82z3uPwFAGUEpQjlDTURf
RXJGhUeYSK5JxUrdS/tNGU41T15QhVGwUtpUEVVIVoVXxFjmWf9bIFxBXWhelV/AYPBiJmNkZKRl5Wcr
aHZpxWsWbG9txW8acHRxy3MmdIB113cweIl543tyfSN+4oClgm6EO4YVh/WJ1YvGjbiPr5Gmk6GVp5et
mbGbuJ3Dn8Oh36SSp1uqGKzTr4CyNLTft5m6VL0Uv9/CvMWQyH7LcM570XXUkde72t3eA+FJ5Kfohu2W
9XX5NPrX++382f2m/qH//wAAABYAMQBLAGYAfgCXALAAyADgAPgBEQEpAUEBWQFxAYoBowG9AdYB8AIK
AiQCPgJZAnQCkAKsAskC5gMEAyIDQANfA38DngPAA+IEBAQnBEoEbwSWBMAE7wUfBVEFhAW3BesGIAZW
BowGxAb8BzYHcQeuB+wIKghqCKsI7gkxCXYJvQoFCk8KmwroCzYLiAvbDC4MhgzfDTkNlg31DlUOuA8a
D4EP6xBWEMIRNBGnEhwSlRMQE4sUDBSLFQ4VlRYeFqsXORfIGFsY8BmJGiMavhtcG/4coR1FHekejh83
H94giyE0Id8iiyNeJD8lKCYOJvQn3ijHKbQqnCuILHYtYy5RL0AwLzEiMhQzCTQBNPc17zbqN+g46Tnu
OvQ8BT0YPis/QEBYQWtCgUOaRLFFzEblSAFJH0o/S2FMiE2sTtZQBFEzUmBTl1TSVgtXTVh4WYRak1ur
XL5d3F78YBZhOmJgY45kvWXqZxxoUmmKasJsAW0+bndvs3DwcihzZ3Shddl3EnhLeYV633xiffd/j4En
gr+EWIX5h5uJO4rhjI6OPI/tkaCTV5UZluWYrpp+nFWeMqAOof6kKKZfqJKqxa0Br0Kxg7PQti+4krsC
vXnAB8KUxTbH3sqSzV/QHtL81ebYxNut3rnhxuTf6I/r2e6c8Ofy1PRz9fj3tP//AAAAJQBPAHgAoADH
AOwBEgE2AVwBgAGlAcsB8QIYAj8CZwKPArkC5AMQAz4DbAOdA84EAgQ3BG4EqATjBSIFYwWlBegGLQZz
BrsHBQdSB6EH8ghFCJsI8wlNCasKCwpuCtQLPAusDBsMjw0GDYAN/g6ADwIPihAXEKIRLRG5EkcS3BNx
FAsUpRVFFegWkRc7F+YYlxlLGgEauht2HDcc+B27Hn0fRCALINYhnyJrI04kPSU0JionIigdKRwqHSse
LCctLi46L0kwWTFwMogzpjTDNeQ3Cjg0OWM6mzv3PWk+4EBkQeVDckUBRpZILEnGS19M+k6PUChRvFNL
VOBWb1f+WYVbElygXjhfy2FjYv9koWZAZ+NpimszbOJui3A5ceVzmHVFdvV4qHpdfAR9pH9KgO6CkoQ0
hdyHg4kkisaMa44Nj62RSJLhlH6WHpe7mVWa8ZyOniufwqFhovuklaY2p9KpZ6sFrJmuM6/LsWmy+LSV
tiy3xLlduvS8i74ov8nBZ8MHxKTGT8f5yZ7LTM0Czp3QG9Ge0yrUv9Zn2AjZudtr3Q7eruBX4ezjbeTk
5lPnuekU6lDrg+yt7cbu0e/U8MbxtfKQ82z0LPTr9Z72SPby94j4HPiv+S/5qvok+p77Avtm+8r8LvyH
/NH9G/1l/a/9+v5N/rn/Jv+S//8AAGRlc2MAAAAAAAAACkNvbG9yIExDRAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AABtbHVjAAAAAAAAABIAAAAMbmJOTwAAABIAAADocHRQVAAAABYAAAD6c3ZTRQAAABAAAAEQZmlGSQAA
ABAAAAEgZGFESwAAABwAAAEwemhDTgAAAAwAAAFMZnJGUgAAABYAAAFYamFKUAAAAA4AAAFuZW5VUwAA
ABIAAAF8cGxQTAAAABIAAAGOcHRCUgAAABgAAAGgZXNFUwAAABIAAAG4emhUVwAAAA4AAAHKcnVSVQAA
ACQAAAHYa29LUgAAAAwAAAH8ZGVERQAAABAAAAIIbmxOTAAAABYAAAIYaXRJVAAAABQAAAIuAEYAYQBy
AGcAZQAtAEwAQwBEAEwAQwBEACAAYQAgAEMAbwByAGUAcwBGAOQAcgBnAC0ATABDAEQAVgDkAHIAaQAt
AEwAQwBEAEwAQwBEAC0AZgBhAHIAdgBlAHMAawDmAHIAbV9pgnIAIABMAEMARABMAEMARAAgAGMAbwB1
AGwAZQB1AHIwqzDpMPwAIABMAEMARABDAG8AbABvAHIAIABMAEMARABLAG8AbABvAHIAIABMAEMARABM
AEMARAAgAEMAbwBsAG8AcgBpAGQAbwBMAEMARAAgAGMAbwBsAG8Acl9pgnJtsmZ2mG95OlZoBCYEMgQ1
BEIEPQQ+BDkAIAQWBBoALQQ0BDgEQQQ/BDsENQQ5zuy37AAgAEwAQwBEAEYAYQByAGIALQBMAEMARABL
AGwAZQB1AHIAZQBuAC0ATABDAEQATABDAEQAIABjAG8AbABvAHIAaQAAbW1vZAAAAAAAAAYQAACchAAA
AADDleyhAAAAAAAAAAAAAAAAAAAAAHRleHQAAAAAQ29weXJpZ2h0IEFwcGxlLCBJbmMuLCAyMDA5AA</bytes>
</object>
</object>
</array>
</array>
<object class="NSColor" key="NSColor" id="704877333">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MCAwAA</bytes>
</object>
</object>
<reference key="NSAlternateImage" ref="671804640"/>
<int key="NSPeriodicDelay">400</int>
<int key="NSPeriodicInterval">75</int>
</object>
</array>
<string key="NSCellSize">{82, 18}</string>
<string key="NSIntercellSpacing">{4, 2}</string>
<int key="NSMatrixFlags">1151868928</int>
<string key="NSCellClass">NSActionCell</string>
<object class="NSButtonCell" key="NSProtoCell" id="541574678">
<int key="NSCellFlags">67239424</int>
<int key="NSCellFlags2">0</int>
<string key="NSContents">Radio</string>
<reference key="NSSupport" ref="385894065"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">0</int>
<object class="NSImage" key="NSNormalImage">
<int key="NSImageFlags">549453824</int>
<string key="NSSize">{18, 18}</string>
<array class="NSMutableArray" key="NSReps">
<array>
<integer value="0"/>
<object class="NSBitmapImageRep">
<object class="NSData" key="NSTIFFRepresentation">
<bytes key="NS.bytes">TU0AKgAABRgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAADwRERGLJycnySsrK/A1NTXw
IyMjyRwcHIsJCQk8AAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFFRUVdVBQUOCoqKj/
29vb//n5+f/6+vr/2tra/6qqqv9UVFTgHx8fdQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUZGRl5
dXV198PDw//8/Pz////////////////////////////U1NT/fHx89yUlJXkAAAAFAAAAAAAAAAAAAAAA
AAAAAxEREUZqamrmtbW1/+3t7f/+/v7//v7+//7+/v/9/f3//f39//39/f/39/f/xMTE/3d3d+YZGRlG
AAAAAwAAAAAAAAAAAAAACkJCQqGtra3/xsbG/+vr6//y8vL/9fX1//X19f/z8/P/9fX1//Ly8v/u7u7/
0tLS/6+vr/9KSkqhAAAACgAAAAAAAAAAAAAAF3h4eN2/v7//z8/P/93d3f/q6ur/7+/v/+/v7//w8PD/
7e3t/+3t7f/i4uL/zs7O/8XFxf98fHzdAAAAFwAAAAAAAAADAAAAJKSkpPjOzs7/2dnZ/+Dg4P/i4uL/
5eXl/+bm5v/n5+f/5eXl/+Li4v/e3t7/2tra/9DQ0P+srKz4AAAAJAAAAAMAAAADAAAALrCwsPrW1tb/
3t7e/+Tk5P/p6en/6+vr/+zs7P/p6en/6+vr/+fn5//k5OT/4ODg/9nZ2f+zs7P6AAAALgAAAAMAAAAD
AAAALp2dnezg4OD/5eXl/+rq6v/u7u7/8PDw//Dw8P/x8fH/8PDw/+7u7v/q6ur/5ubm/+Hh4f+ZmZns
AAAALgAAAAMAAAADAAAAJG5ubs/l5eX/6enp/+/v7//y8vL/9vb2//r6+v/5+fn/9/f3//b29v/x8fH/
6+vr/+Tk5P9ra2vPAAAAJAAAAAMAAAAAAAAAFy4uLpPCwsL67Ozs//Pz8//5+fn//v7+//7+/v/+/v7/
/v7+//v7+//19fX/8PDw/8LCwvosLCyTAAAAFwAAAAAAAAAAAAAACgAAAENfX1/S5OTk/vn5+f/+/v7/
///////////////////////////8/Pz/5ubm/l9fX9IAAABDAAAACgAAAAAAAAAAAAAAAwAAABcAAABl
YmJi3NLS0v3////////////////////////////////V1dX9ZGRk3AAAAGUAAAAXAAAAAwAAAAAAAAAA
AAAAAAAAAAUAAAAfAAAAZTMzM8KAgIDwv7+//O3t7f/t7e3/v7+//ICAgPAzMzPCAAAAZQAAAB8AAAAF
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAFwAAAEMAAAB3AAAAnwAAALMAAACzAAAAnwAAAHcAAABD
AAAAFwAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAoAAAAXAAAAJAAAAC4AAAAu
AAAAJAAAABcAAAAKAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAwAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQEAAAMAAAABABIAAAEB
AAMAAAABABIAAAECAAMAAAAEAAAFugEDAAMAAAABAAEAAAEGAAMAAAABAAIAAAERAAQAAAABAAAACAES
AAMAAAABAAEAAAEVAAMAAAABAAQAAAEWAAMAAAABABIAAAEXAAQAAAABAAAFEAEcAAMAAAABAAEAAAFS
AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</object>
</object>
</array>
</array>
<reference key="NSColor" ref="704877333"/>
</object>
<reference key="NSAlternateImage" ref="671804640"/>
<int key="NSPeriodicDelay">400</int>
<int key="NSPeriodicInterval">75</int>
</object>
<reference key="NSSelectedCell" ref="165264936"/>
<reference key="NSBackgroundColor" ref="976045936"/>
<object class="NSColor" key="NSCellBackgroundColor" id="129773243">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
</object>
<reference key="NSFont" ref="385894065"/>
</object>
<object class="NSTextField" id="51944759">
<reference key="NSNextResponder" ref="1005"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{17, 260}, {84, 17}}</string>
<reference key="NSSuperview" ref="1005"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="901629501"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="183918644">
<int key="NSCellFlags">68288064</int>
<int key="NSCellFlags2">272630784</int>
<string key="NSContents">Show player:</string>
<reference key="NSSupport" ref="385894065"/>
<reference key="NSControlView" ref="51944759"/>
<reference key="NSBackgroundColor" ref="976045936"/>
<reference key="NSTextColor" ref="522026884"/>
</object>
</object>
<object class="NSTextField" id="901629501">
<reference key="NSNextResponder" ref="1005"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{106, 258}, {36, 22}}</string>
<reference key="NSSuperview" ref="1005"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="983722867"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="324146376">
<int key="NSCellFlags">-1804468671</int>
<int key="NSCellFlags2">-1874852864</int>
<string key="NSContents"/>
<reference key="NSSupport" ref="385894065"/>
<object class="NSNumberFormatter" key="NSFormatter" id="733863002">
<dictionary class="NSMutableDictionary" key="NS.attributes">
<boolean value="NO" key="allowsFloats"/>
<integer value="1040" key="formatterBehavior"/>
<object class="NSLocale" key="locale">
<string key="NS.identifier"/>
</object>
<real value="4" key="maximum"/>
<integer value="1" key="maximumIntegerDigits"/>
<real value="1" key="minimum"/>
<integer value="1" key="minimumIntegerDigits"/>
<real value="1" key="roundingIncrement"/>
</dictionary>
<string key="NS.positiveformat">#1</string>
<string key="NS.negativeformat">#1</string>
<nil key="NS.positiveattrs"/>
<nil key="NS.negativeattrs"/>
<nil key="NS.zero"/>
<nil key="NS.nil"/>
<object class="NSAttributedString" key="NS.nan">
<string key="NSString">NaN</string>
<dictionary key="NSAttributes"/>
</object>
<real value="1" key="NS.min"/>
<real value="4" key="NS.max"/>
<object class="NSDecimalNumberHandler" key="NS.rounding">
<int key="NS.roundingmode">3</int>
<bool key="NS.raise.overflow">YES</bool>
<bool key="NS.raise.underflow">YES</bool>
<bool key="NS.raise.dividebyzero">YES</bool>
</object>
<string key="NS.decimal">.</string>
<string key="NS.thousand">,</string>
<bool key="NS.hasthousands">NO</bool>
<bool key="NS.localized">NO</bool>
<bool key="NS.allowsfloats">NO</bool>
</object>
<reference key="NSControlView" ref="901629501"/>
<bool key="NSDrawsBackground">YES</bool>
<object class="NSColor" key="NSBackgroundColor">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">textBackgroundColor</string>
<reference key="NSColor" ref="129773243"/>
</object>
<object class="NSColor" key="NSTextColor">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">textColor</string>
<reference key="NSColor" ref="909323645"/>
</object>
</object>
</object>
<object class="NSStepper" id="983722867">
<reference key="NSNextResponder" ref="1005"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{147, 255}, {19, 27}}</string>
<reference key="NSSuperview" ref="1005"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="529444683"/>
<bool key="NSEnabled">YES</bool>
<object class="NSStepperCell" key="NSCell" id="180178058">
<int key="NSCellFlags">654848</int>
<int key="NSCellFlags2">0</int>
<reference key="NSControlView" ref="983722867"/>
<double key="NSValue">1</double>
<double key="NSMinValue">1</double>
<double key="NSMaxValue">4</double>
<double key="NSIncrement">1</double>
<bool key="NSValueWraps">YES</bool>
</object>
</object>
</array>
<string key="NSFrameSize">{600, 300}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="51944759"/>
<string key="NSClassName">OEGameControllerView</string>
</object>
</array>
<object class="IBObjectContainer" key="IBDocument.Objects">
<array class="NSMutableArray" key="connectionRecords">
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">view</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="1005"/>
</object>
<int key="connectionID">2</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">showedBindingsChanged:</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="806786179"/>
</object>
<int key="connectionID">9</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">bindingType</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="806786179"/>
</object>
<int key="connectionID">10</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">playerField</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="901629501"/>
</object>
<int key="connectionID">24</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">playerStepper</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="983722867"/>
</object>
<int key="connectionID">25</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">showedBindingsChanged:</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="983722867"/>
</object>
<int key="connectionID">26</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">showedBindingsChanged:</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="901629501"/>
</object>
<int key="connectionID">27</int>
</object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects">
<object class="IBObjectRecord">
<int key="objectID">0</int>
<array key="object" id="0"/>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="1001"/>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="1003"/>
<reference key="parent" ref="0"/>
<string key="objectName">First Responder</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-3</int>
<reference key="object" ref="1004"/>
<reference key="parent" ref="0"/>
<string key="objectName">Application</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">1</int>
<reference key="object" ref="1005"/>
<array class="NSMutableArray" key="children">
<reference ref="529444683"/>
<reference ref="806786179"/>
<reference ref="51944759"/>
<reference ref="901629501"/>
<reference ref="983722867"/>
</array>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">3</int>
<reference key="object" ref="529444683"/>
<array class="NSMutableArray" key="children">
<reference ref="262381886"/>
</array>
<reference key="parent" ref="1005"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">4</int>
<reference key="object" ref="806786179"/>
<array class="NSMutableArray" key="children">
<reference ref="223753203"/>
<reference ref="541574678"/>
<reference ref="165264936"/>
</array>
<reference key="parent" ref="1005"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">5</int>
<reference key="object" ref="223753203"/>
<reference key="parent" ref="806786179"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">6</int>
<reference key="object" ref="541574678"/>
<reference key="parent" ref="806786179"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">7</int>
<reference key="object" ref="165264936"/>
<reference key="parent" ref="806786179"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">8</int>
<reference key="object" ref="262381886"/>
<reference key="parent" ref="529444683"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">15</int>
<reference key="object" ref="51944759"/>
<array class="NSMutableArray" key="children">
<reference ref="183918644"/>
</array>
<reference key="parent" ref="1005"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">16</int>
<reference key="object" ref="901629501"/>
<array class="NSMutableArray" key="children">
<reference ref="324146376"/>
</array>
<reference key="parent" ref="1005"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">17</int>
<reference key="object" ref="983722867"/>
<array class="NSMutableArray" key="children">
<reference ref="180178058"/>
</array>
<reference key="parent" ref="1005"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">18</int>
<reference key="object" ref="180178058"/>
<reference key="parent" ref="983722867"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">19</int>
<reference key="object" ref="324146376"/>
<array class="NSMutableArray" key="children">
<reference ref="733863002"/>
</array>
<reference key="parent" ref="901629501"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">20</int>
<reference key="object" ref="733863002"/>
<reference key="parent" ref="324146376"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">21</int>
<reference key="object" ref="183918644"/>
<reference key="parent" ref="51944759"/>
</object>
</array>
</object>
<dictionary class="NSMutableDictionary" key="flattenedProperties">
<string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="-3.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="1.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="15.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="16.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="17.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="18.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="19.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES" key="20.IBNumberFormatterLocalizesFormatMetadataKey"/>
<string key="20.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="21.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="3.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="4.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="5.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="6.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="7.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="8.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<int key="maxID">27</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
<object class="IBPartialClassDescription">
<string key="className">OEGameControllerView</string>
<string key="superclassName">NSView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/OEGameControllerView.h</string>
</object>
</object>
</array>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
<real value="1060" key="NS.object.0"/>
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string>
<real value="4200" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
</data>
</archive>
Binary file not shown.
File diff suppressed because it is too large Load Diff
+740 -301
View File
File diff suppressed because it is too large Load Diff
+22 -8
View File
@@ -3,13 +3,13 @@
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string>FCEUX</string>
<key>CFBundleIdentifier</key>
<string>org.openemu.${PRODUCT_NAME:identifier}</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
@@ -17,15 +17,31 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<string>2.6.3</string>
<key>NSPrincipalClass</key>
<string>OEGameCoreController</string>
<key>OEGameCoreClass</key>
<string>FCEUGameCore</string>
<key>OEGameCoreOptions</key>
<dict>
<key>openemu.system.nes</key>
<dict>
<key>OEGameCoreRewindBufferSeconds</key>
<integer>60</integer>
<key>OEGameCoreRewindInterval</key>
<integer>0</integer>
<key>OEGameCoreSupportsCheatCode</key>
<true/>
<key>OEGameCoreSupportsDisplayModeChange</key>
<true/>
<key>OEGameCoreSupportsRewinding</key>
<true/>
</dict>
</dict>
<key>OEGameCorePlayerCount</key>
<string>2</string>
<string>4</string>
<key>OEProjectURL</key>
<string>http://sourceforge.net/projects/fceumm/</string>
<string>https://github.com/TASEmulators/fceux</string>
<key>OESystemIdentifiers</key>
<array>
<string>openemu.system.nes</string>
@@ -33,8 +49,6 @@
<key>SUEnableAutomaticChecks</key>
<string>1</string>
<key>SUFeedURL</key>
<string>http://openemu.org/updater/fceu_appcast.xml</string>
<key>SUPublicDSAKeyFile</key>
<string>dsa_pub.pem</string>
<string>https://raw.github.com/OpenEmu/OpenEmu-Update/master/fceu_appcast.xml</string>
</dict>
</plist>
-9
View File
@@ -1,9 +0,0 @@
build_now: 'YES'
create_core_path: 'YES'
download_base_url: http://github.com/downloads/openemu/openemu
release_notes_base_url: http://openemu.org/category/releasenotes/fceux/
appcast_basefolder: '/Users/jweinberg/Desktop/Appcast'
appcast_xml_name: 'fceux_appcast.xml'
keychain_privkey_name: 'Sparkle Private Key'
css_file_name: 'rnotes.css'
bundle_extension: 'oecoreplugin'
-20
View File
@@ -1,20 +0,0 @@
-----BEGIN PUBLIC KEY-----
MIIDOjCCAi0GByqGSM44BAEwggIgAoIBAQD/nSuLzikeU6MrymSPr34AiU2RDJz6
0pm/3PPs27f6QTtbUAvGC13q6XWrE3HJU8Gz7RM0EJZGpiwb86LgqOJhjfQ7WKse
uaGdbHnvJEFsGqpKX7rnUWaWO3HAsKzDx4HzJqKupFEbTbzXl/GT3JMm+a3PXA3S
kyATydRPrX583Ih8iHO1zQs1pwp2AnUvaQXvp4QOLFWheH5napkDZBjc9B7H38dg
f4c0QqEXJw0lJbG26FxhpOWMiXwpWpOHSfb+XtmzpeTDIHxKPLMEdf2wc+xNC/M9
GdVBfM7+hCEhl1JGqNWPpT7ZzciX8Cxg+5/MIfx+BQ7xQ4wo1SN7y1bZAhUAuBcT
+ZsHbLXlR3uGHLIMg8boUKcCggEAGKgD56/tB6siFr5zEY+RTozPLmbBEcvhz5/p
hAQo7z7ODimZAA1MN1J7Hv7o1S5D9dpZuOnGhiXaN3Z50WdePb9LVH7twrB8v3Xn
ZOEHpumYNcYhvXrIx8LbhnMZmU27xSnrOQF9UfokRxGnXkNmlIwjT0NWqZCqQZwM
wVj1Bgld3YV7CpGTF3aGM6a0pk9LBB71PoczXAx0Cum87ouXXy3c8F/82RF9tgXE
ZBQ+7K2QXYPv9smbYDB+ZlsQ4VTOi3AReG5AeHTVWha3uaSFxY5vKpfau31iMRuT
b1VQ2HVynBpemwhAw4FFvj5dm94aN0Rrvq9BKM09DL4zoOlLogOCAQUAAoIBAE8B
I8z38GdbtswSoSV5JZ9z9cBMj/7x/sHi5ED9v1M8MD6AcxJSbo2cbK98xA3A9U22
6XFHthGReVLa0dyN3Ov+GhBdf8b4CBuebAAS4z8du2EvUFtwDUHorLIo2Qtq2SYR
wpznpB9+3g+z+8GZbzZkdm2mFBKa6GItj82qfEHwxB40aEBx7uQXzM3TH0rV8sMq
u91aAVUQuoiG2/IYWc5O34kKMlHUTt6+uuJiSG0ax8ysWE5XltCfSh/VJcGrzKU6
ZjGBzh8j5+KSXgoe9TuKlsnN5HDCZKaFTCvrxq889HJj0/ks4UrIF+meEyJvDt4P
O4HHoKRtUdLEBMcY0JA=
-----END PUBLIC KEY-----
+2
View File
@@ -0,0 +1,2 @@
/* Localized versions of Info.plist keys */
-109
View File
@@ -1,109 +0,0 @@
DEBUG = 0
ifeq ($(platform),)
platform = unix
ifeq ($(shell uname -a),)
platform = win
else ifneq ($(findstring MINGW,$(shell uname -a)),)
platform = win
else ifneq ($(findstring Darwin,$(shell uname -a)),)
platform = osx
else ifneq ($(findstring win,$(shell uname -a)),)
platform = win
endif
endif
ifeq ($(platform), unix)
TARGET := libsnes.so
fpic := -fPIC
SHARED := -shared -Wl,--version-script=libsnes-fceumm/link.T
ENDIANNESS_DEFINES = -DLSB_FIRST -DLOCAL_LE=1
else ifeq ($(platform), osx)
TARGET := libsnes.dylib
fpic := -fPIC
SHARED := -dynamiclib
ENDIANNESS_DEFINES = -DLSB_FIRST -DLOCAL_LE=1
CFLAGS += -DHAVE_ASPRINTF
else ifeq ($(platform), ps3)
TARGET := libsnes.a
CC = ppu-lv2-gcc
AR = ppu-lv2-ar
PLATFORM_DEFINES := -D__CELLOS_LV2
else ifeq ($(platform), snc-ps3)
TARGET := libsnes.a
CC = ps3ppusnc
AR = ps3snarl
PLATFORM_DEFINES := -D__CELLOS_LV2
else ifeq ($(platform), xenon)
TARGET := libsnes.a
CC = xenon-gcc
AR = xenon-ar
PLATFORM_DEFINES := -D__LIBXENON__
CFLAGS += -DHAVE_ASPRINTF
else ifeq ($(platform), wii)
TARGET := libsnes.a
CC = powerpc-eabi-gcc
AR = powerpc-eabi-ar
PLATFORM_DEFINES := -DGEKKO -mrvl -mcpu=750 -meabi -mhard-float
CFLAGS += -DHAVE_ASPRINTF
else
TARGET := snes.dll
CC = gcc
SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=libsnes-fceumm/link.T
ENDIANNESS_DEFINES = -DLSB_FIRST -DLOCAL_LE=1
endif
ifeq ($(DEBUG), 1)
CFLAGS += -O0 -g
else
CFLAGS += -O3 -DNDEBUG
endif
LIBSNES_DIR := ./libsnes-fceumm
FCEU_DIR := ./src-fceumm
UTILS_DIR := ./utils
FCEU_SRC_DIRS := $(LIBSNES_DIR) $(FCEU_DIR) $(FCEU_DIR)/boards $(FCEU_DIR)/input $(FCEU_DIR)/mappers $(FCEU_DIR)/utils $(UTILS_DIR)/zlib
FCEU_CSRCS := $(foreach dir,$(FCEU_SRC_DIRS),$(wildcard $(dir)/*.c))
FCEU_COBJ := $(FCEU_CSRCS:.c=.o)
OBJS := $(FCEU_COBJ)
FCEU_DEFINES := -D__LIBSNES__ -DSOUND_QUALITY=0 -DPATH_MAX=1024 -DINLINE=inline -DPSS_STYLE=1 $(PLATFORM_DEFINES)
ifeq ($(platform), snc-ps3)
CODE_DEFINES =
WARNING_DEFINES =
else
CODE_DEFINES = -std=gnu99
WARNING_DEFINES = -Wno-write-strings
endif
CFLAGS += $(CODE_DEFINES) $(fpic) $(WARNING_DEFINES) $(FCEU_DEFINES) $(ENDIANNESS_DEFINES)
LDFLAGS += -lm
INCDIRS := -I$(LIBSNES_DIR) -I$(FCEU_DIR) -I$(FCEU_DIR)/input -I$(FCEU_DIR)/boards -I$(FCEU_DIR)/mappers -I$(UTILS_DIR)/zlib
LIBS :=
$(TARGET): $(OBJS)
ifeq ($(platform), ps3)
$(AR) rcs $@ $(OBJS)
else ifeq ($(platform), snc-ps3)
$(AR) rcs $@ $(OBJS)
else ifeq ($(platform), xenon)
$(AR) rcs $@ $(OBJS)
else ifeq ($(platform), wii)
$(AR) rcs $@ $(OBJS)
else
$(CC) -o $@ $(SHARED) $(OBJS) $(LDFLAGS) $(LIBS)
endif
%.o: %.c
$(CC) -c -o $@ $< $(CFLAGS) $(INCDIRS)
clean:
rm -f $(OBJS)
rm -f $(TARGET)
.PHONY: clean
-160
View File
@@ -1,160 +0,0 @@
#!/bin/sh
FORMAT=libsnes
START_DIR=`pwd`
#******************
# PROGRAM FUNCTIONS
#******************
function clean_fceux()
{
make -f Makefile.libsnes-fceux clean
}
function clean_fceumm()
{
make -f Makefile.libsnes-fceumm clean
}
function make_libsnes_fceumm()
{
make -f Makefile.libsnes-fceumm
}
function make_libsnes_fceumm_debug()
{
make -f Makefile.libsnes-fceumm DEBUG=1
}
function make_libsnes_fceux()
{
make -f Makefile.libsnes-fceux
}
function make_libsnes_fceux_debug()
{
make -f Makefile.libsnes-fceux DEBUG=1
}
#******************
# DISPLAY FUNCTIONS
#******************
function title()
{
echo ""
echo "***********************"
echo "COMPILER SCRIPT FOR $FORMAT"
echo "***********************"
}
function display_clean_fceumm()
{
echo "clean_fceumm Clean the object files"
}
function display_clean_fceux()
{
echo "clean_fceux Clean the object files"
}
function display_make_fceux()
{
echo "make_fceux Compile libsnes library for FCEUx"
}
function display_make_fceux_debug()
{
echo "make_fceux_debug Compile DEBUG libsnes library for FCEUx"
}
function display_make_fceumm()
{
echo "make_fceumm Compile libsnes library for FCEUmm"
}
function display_make_fceumm_debug()
{
echo "make_fceumm_debug Compile DEBUG libsnes library for FCEUmm"
}
function display_all_options()
{
display_clean_fceux
display_clean_fceumm
display_make_fceux
display_make_fceux_debug
display_make_fceumm
display_make_fceumm_debug
}
function display_usage()
{
echo "Usage: compile_libsnes.sh [options]"
echo "Options:"
display_all_options
}
#***********************
# MAIN CONTROL FLOW LOOP
#***********************
title
if [ ! -n "$1" ]; then
display_usage
else
for i in "$@"
do
if [ "$i" = "help" ]; then
display_usage
fi
if [ "$i" = "clean_fceux" ]; then
echo ""
echo "*************************************"
echo "DOING:"
display_clean_fceux
echo "*************************************"
clean_fceux
fi
if [ "$i" = "clean_fceumm" ]; then
echo ""
echo "*************************************"
echo "DOING:"
display_clean_fceumm
echo "*************************************"
clean_fceumm
fi
if [ "$i" = "make_fceux" ]; then
echo ""
echo "*************************************"
echo "DOING:"
display_make_fceux
echo "*************************************"
make_libsnes_fceux
fi
if [ "$i" = "make_fceux_debug" ]; then
echo ""
echo "*************************************"
echo "DOING:"
display_make_fceux_debug
echo "*************************************"
make_libsnes_fceux_debug
fi
if [ "$i" = "make_fceumm" ]; then
echo ""
echo "*************************************"
echo "DOING:"
display_make_fceumm
echo "*************************************"
make_libsnes_fceumm
fi
if [ "$i" = "make_fceumm_debug" ]; then
echo ""
echo "*************************************"
echo "DOING:"
display_make_fceumm_debug
echo "*************************************"
make_libsnes_fceumm_debug
fi
done
fi
-658
View File
@@ -1,658 +0,0 @@
#include <stdio.h>
#include <stdint.h>
#ifndef _MSC_VER
#include <stdbool.h>
#else
#define TRUE 1
#define FALSE 0
typedef unsigned char bool;
#endif
#include <stdlib.h>
#include <string.h>
#ifdef _MSC_VER
#define snprintf _snprintf
#endif
#define LIBSNES_CORE 1
#if defined(_MSC_VER) && defined(LIBSNES_CORE)
#define EXPORT __declspec(dllexport)
#else
#define EXPORT
#endif
#include "libsnes.h"
/* emulator-specific includes */
#include "../src-fceumm/fceu.h"
#include "../src-fceumm/myendian.h"
#include "../src-fceumm/input.h"
#include "../src-fceumm/state.h"
#include "../src-fceumm/ppu.h"
#include "../src-fceumm/cart.h"
#include "../src-fceumm/x6502.h"
#include "../src-fceumm/git.h"
#include "../src-fceumm/palette.h"
#include "../src-fceumm/sound.h"
#include "../src-fceumm/file.h"
#include "../src-fceumm/cheat.h"
#include "../src-fceumm/ines.h"
#include "../src-fceumm/unif.h"
#include "../src-fceumm/fds.h"
#include <string.h>
#include "memstream.h"
static snes_video_refresh_t video_cb = NULL;
static snes_audio_sample_t audio_cb = NULL;
static snes_input_poll_t poll_cb = NULL;
static snes_input_state_t input_cb = NULL;
/* emulator-specific variables */
static uint16_t palette[256];
static int32 *sound = 0;
static int32 ssize = 0;
static uint8 *gfx = 0;
static uint32 JSReturn[2];
static uint32 current_palette = 0;
/* extern forward decls.*/
extern FCEUGI *FCEUGameInfo;
extern uint8 *XBuf;
extern CartInfo iNESCart;
extern CartInfo UNIFCart;
/* emulator-specific callback functions */
const char * GetKeyboard(void) { return ""; }
void FCEUD_SetPalette(unsigned char index, unsigned char r, unsigned char g, unsigned char b)
{
r >>= 3;
g >>= 3;
b >>= 3;
palette[index] = (r << 10) | (g << 5) | (b << 0);
}
bool FCEUD_ShouldDrawInputAids() { return 1; }
void FCEUD_PrintError(const char *c) { }
void FCEUD_Message(const char *text) { }
void FCEUD_SoundToggle() { FCEUI_SetSoundVolume(256); }
void FCEUD_VideoChanged() {}
#define MAX_PAH 1024
/*palette for FCEU*/
#define MAXPAL 13
struct st_palettes {
char name[32];
char desc[32];
unsigned int data[64];
};
struct st_palettes palettes[] = {
{ "asqrealc", "AspiringSquire's Real palette",
{ 0x6c6c6c, 0x00268e, 0x0000a8, 0x400094,
0x700070, 0x780040, 0x700000, 0x621600,
0x442400, 0x343400, 0x005000, 0x004444,
0x004060, 0x000000, 0x101010, 0x101010,
0xbababa, 0x205cdc, 0x3838ff, 0x8020f0,
0xc000c0, 0xd01474, 0xd02020, 0xac4014,
0x7c5400, 0x586400, 0x008800, 0x007468,
0x00749c, 0x202020, 0x101010, 0x101010,
0xffffff, 0x4ca0ff, 0x8888ff, 0xc06cff,
0xff50ff, 0xff64b8, 0xff7878, 0xff9638,
0xdbab00, 0xa2ca20, 0x4adc4a, 0x2ccca4,
0x1cc2ea, 0x585858, 0x101010, 0x101010,
0xffffff, 0xb0d4ff, 0xc4c4ff, 0xe8b8ff,
0xffb0ff, 0xffb8e8, 0xffc4c4, 0xffd4a8,
0xffe890, 0xf0f4a4, 0xc0ffc0, 0xacf4f0,
0xa0e8ff, 0xc2c2c2, 0x202020, 0x101010 }
},
{ "loopy", "Loopy's palette",
{ 0x757575, 0x271b8f, 0x0000ab, 0x47009f,
0x8f0077, 0xab0013, 0xa70000, 0x7f0b00,
0x432f00, 0x004700, 0x005100, 0x003f17,
0x1b3f5f, 0x000000, 0x000000, 0x000000,
0xbcbcbc, 0x0073ef, 0x233bef, 0x8300f3,
0xbf00bf, 0xe7005b, 0xdb2b00, 0xcb4f0f,
0x8b7300, 0x009700, 0x00ab00, 0x00933b,
0x00838b, 0x000000, 0x000000, 0x000000,
0xffffff, 0x3fbfff, 0x5f97ff, 0xa78bfd,
0xf77bff, 0xff77b7, 0xff7763, 0xff9b3b,
0xf3bf3f, 0x83d313, 0x4fdf4b, 0x58f898,
0x00ebdb, 0x000000, 0x000000, 0x000000,
0xffffff, 0xabe7ff, 0xc7d7ff, 0xd7cbff,
0xffc7ff, 0xffc7db, 0xffbfb3, 0xffdbab,
0xffe7a3, 0xe3ffa3, 0xabf3bf, 0xb3ffcf,
0x9ffff3, 0x000000, 0x000000, 0x000000 }
},
{ "quor", "Quor's palette",
{ 0x3f3f3f, 0x001f3f, 0x00003f, 0x1f003f,
0x3f003f, 0x3f0020, 0x3f0000, 0x3f2000,
0x3f3f00, 0x203f00, 0x003f00, 0x003f20,
0x003f3f, 0x000000, 0x000000, 0x000000,
0x7f7f7f, 0x405f7f, 0x40407f, 0x5f407f,
0x7f407f, 0x7f4060, 0x7f4040, 0x7f6040,
0x7f7f40, 0x607f40, 0x407f40, 0x407f60,
0x407f7f, 0x000000, 0x000000, 0x000000,
0xbfbfbf, 0x809fbf, 0x8080bf, 0x9f80bf,
0xbf80bf, 0xbf80a0, 0xbf8080, 0xbfa080,
0xbfbf80, 0xa0bf80, 0x80bf80, 0x80bfa0,
0x80bfbf, 0x000000, 0x000000, 0x000000,
0xffffff, 0xc0dfff, 0xc0c0ff, 0xdfc0ff,
0xffc0ff, 0xffc0e0, 0xffc0c0, 0xffe0c0,
0xffffc0, 0xe0ffc0, 0xc0ffc0, 0xc0ffe0,
0xc0ffff, 0x000000, 0x000000, 0x000000 }
},
{ "chris", "Chris Covell's palette",
{ 0x808080, 0x003DA6, 0x0012B0, 0x440096,
0xA1005E, 0xC70028, 0xBA0600, 0x8C1700,
0x5C2F00, 0x104500, 0x054A00, 0x00472E,
0x004166, 0x000000, 0x050505, 0x050505,
0xC7C7C7, 0x0077FF, 0x2155FF, 0x8237FA,
0xEB2FB5, 0xFF2950, 0xFF2200, 0xD63200,
0xC46200, 0x358000, 0x058F00, 0x008A55,
0x0099CC, 0x212121, 0x090909, 0x090909,
0xFFFFFF, 0x0FD7FF, 0x69A2FF, 0xD480FF,
0xFF45F3, 0xFF618B, 0xFF8833, 0xFF9C12,
0xFABC20, 0x9FE30E, 0x2BF035, 0x0CF0A4,
0x05FBFF, 0x5E5E5E, 0x0D0D0D, 0x0D0D0D,
0xFFFFFF, 0xA6FCFF, 0xB3ECFF, 0xDAABEB,
0xFFA8F9, 0xFFABB3, 0xFFD2B0, 0xFFEFA6,
0xFFF79C, 0xD7E895, 0xA6EDAF, 0xA2F2DA,
0x99FFFC, 0xDDDDDD, 0x111111, 0x111111 }
},
{ "matt", "Matthew Conte's palette",
{ 0x808080, 0x0000bb, 0x3700bf, 0x8400a6,
0xbb006a, 0xb7001e, 0xb30000, 0x912600,
0x7b2b00, 0x003e00, 0x00480d, 0x003c22,
0x002f66, 0x000000, 0x050505, 0x050505,
0xc8c8c8, 0x0059ff, 0x443cff, 0xb733cc,
0xff33aa, 0xff375e, 0xff371a, 0xd54b00,
0xc46200, 0x3c7b00, 0x1e8415, 0x009566,
0x0084c4, 0x111111, 0x090909, 0x090909,
0xffffff, 0x0095ff, 0x6f84ff, 0xd56fff,
0xff77cc, 0xff6f99, 0xff7b59, 0xff915f,
0xffa233, 0xa6bf00, 0x51d96a, 0x4dd5ae,
0x00d9ff, 0x666666, 0x0d0d0d, 0x0d0d0d,
0xffffff, 0x84bfff, 0xbbbbff, 0xd0bbff,
0xffbfea, 0xffbfcc, 0xffc4b7, 0xffccae,
0xffd9a2, 0xcce199, 0xaeeeb7, 0xaaf7ee,
0xb3eeff, 0xdddddd, 0x111111, 0x111111 }
},
{ "pasofami", "PasoFami/99 palette",
{ 0x7f7f7f, 0x0000ff, 0x0000bf, 0x472bbf,
0x970087, 0xab0023, 0xab1300, 0x8b1700,
0x533000, 0x007800, 0x006b00, 0x005b00,
0x004358, 0x000000, 0x000000, 0x000000,
0xbfbfbf, 0x0078f8, 0x0058f8, 0x6b47ff,
0xdb00cd, 0xe7005b, 0xf83800, 0xe75f13,
0xaf7f00, 0x00b800, 0x00ab00, 0x00ab47,
0x008b8b, 0x000000, 0x000000, 0x000000,
0xf8f8f8, 0x3fbfff, 0x6b88ff, 0x9878f8,
0xf878f8, 0xf85898, 0xf87858, 0xffa347,
0xf8b800, 0xb8f818, 0x5bdb57, 0x58f898,
0x00ebdb, 0x787878, 0x000000, 0x000000,
0xffffff, 0xa7e7ff, 0xb8b8f8, 0xd8b8f8,
0xf8b8f8, 0xfba7c3, 0xf0d0b0, 0xffe3ab,
0xfbdb7b, 0xd8f878, 0xb8f8b8, 0xb8f8d8,
0x00ffff, 0xf8d8f8, 0x000000, 0x000000 }
},
{ "crashman", "CrashMan's palette",
{ 0x585858, 0x001173, 0x000062, 0x472bbf,
0x970087, 0x910009, 0x6f1100, 0x4c1008,
0x371e00, 0x002f00, 0x005500, 0x004d15,
0x002840, 0x000000, 0x000000, 0x000000,
0xa0a0a0, 0x004499, 0x2c2cc8, 0x590daa,
0xae006a, 0xb00040, 0xb83418, 0x983010,
0x704000, 0x308000, 0x207808, 0x007b33,
0x1c6888, 0x000000, 0x000000, 0x000000,
0xf8f8f8, 0x267be1, 0x5870f0, 0x9878f8,
0xff73c8, 0xf060a8, 0xd07b37, 0xe09040,
0xf8b300, 0x8cbc00, 0x40a858, 0x58f898,
0x00b7bf, 0x787878, 0x000000, 0x000000,
0xffffff, 0xa7e7ff, 0xb8b8f8, 0xd8b8f8,
0xe6a6ff, 0xf29dc4, 0xf0c0b0, 0xfce4b0,
0xe0e01e, 0xd8f878, 0xc0e890, 0x95f7c8,
0x98e0e8, 0xf8d8f8, 0x000000, 0x000000 }
},
{ "mess", "MESS palette",
{ 0x747474, 0x24188c, 0x0000a8, 0x44009c,
0x8c0074, 0xa80010, 0xa40000, 0x7c0800,
0x402c00, 0x004400, 0x005000, 0x003c14,
0x183c5c, 0x000000, 0x000000, 0x000000,
0xbcbcbc, 0x0070ec, 0x2038ec, 0x8000f0,
0xbc00bc, 0xe40058, 0xd82800, 0xc84c0c,
0x887000, 0x009400, 0x00a800, 0x009038,
0x008088, 0x000000, 0x000000, 0x000000,
0xfcfcfc, 0x3cbcfc, 0x5c94fc, 0x4088fc,
0xf478fc, 0xfc74b4, 0xfc7460, 0xfc9838,
0xf0bc3c, 0x80d010, 0x4cdc48, 0x58f898,
0x00e8d8, 0x000000, 0x000000, 0x000000,
0xfcfcfc, 0xa8e4fc, 0xc4d4fc, 0xd4c8fc,
0xfcc4fc, 0xfcc4d8, 0xfcbcb0, 0xfcd8a8,
0xfce4a0, 0xe0fca0, 0xa8f0bc, 0xb0fccc,
0x9cfcf0, 0x000000, 0x000000, 0x000000 }
},
{ "zaphod-cv", "Zaphod's VS Castlevania palette",
{ 0x7f7f7f, 0xffa347, 0x0000bf, 0x472bbf,
0x970087, 0xf85898, 0xab1300, 0xf8b8f8,
0xbf0000, 0x007800, 0x006b00, 0x005b00,
0xffffff, 0x9878f8, 0x000000, 0x000000,
0xbfbfbf, 0x0078f8, 0xab1300, 0x6b47ff,
0x00ae00, 0xe7005b, 0xf83800, 0x7777ff,
0xaf7f00, 0x00b800, 0x00ab00, 0x00ab47,
0x008b8b, 0x000000, 0x000000, 0x472bbf,
0xf8f8f8, 0xffe3ab, 0xf87858, 0x9878f8,
0x0078f8, 0xf85898, 0xbfbfbf, 0xffa347,
0xc800c8, 0xb8f818, 0x7f7f7f, 0x007800,
0x00ebdb, 0x000000, 0x000000, 0xffffff,
0xffffff, 0xa7e7ff, 0x5bdb57, 0xe75f13,
0x004358, 0x0000ff, 0xe7005b, 0x00b800,
0xfbdb7b, 0xd8f878, 0x8b1700, 0xffe3ab,
0x00ffff, 0xab0023, 0x000000, 0x000000 }
},
{ "zaphod-smb", "Zaphod's VS SMB palette",
{ 0x626a00, 0x0000ff, 0x006a77, 0x472bbf,
0x970087, 0xab0023, 0xab1300, 0xb74800,
0xa2a2a2, 0x007800, 0x006b00, 0x005b00,
0xffd599, 0xffff00, 0x009900, 0x000000,
0xff66ff, 0x0078f8, 0x0058f8, 0x6b47ff,
0x000000, 0xe7005b, 0xf83800, 0xe75f13,
0xaf7f00, 0x00b800, 0x5173ff, 0x00ab47,
0x008b8b, 0x000000, 0x91ff88, 0x000088,
0xf8f8f8, 0x3fbfff, 0x6b0000, 0x4855f8,
0xf878f8, 0xf85898, 0x595958, 0xff009d,
0x002f2f, 0xb8f818, 0x5bdb57, 0x58f898,
0x00ebdb, 0x787878, 0x000000, 0x000000,
0xffffff, 0xa7e7ff, 0x590400, 0xbb0000,
0xf8b8f8, 0xfba7c3, 0xffffff, 0x00e3e1,
0xfbdb7b, 0xffae00, 0xb8f8b8, 0xb8f8d8,
0x00ff00, 0xf8d8f8, 0xffaaaa, 0x004000 }
},
{ "vs-drmar", "VS Dr. Mario palette",
{ 0x5f97ff, 0x000000, 0x000000, 0x47009f,
0x00ab00, 0xffffff, 0xabe7ff, 0x000000,
0x000000, 0x000000, 0x000000, 0x000000,
0xe7005b, 0x000000, 0x000000, 0x000000,
0x5f97ff, 0x000000, 0x000000, 0x000000,
0x000000, 0x8b7300, 0xcb4f0f, 0x000000,
0xbcbcbc, 0x000000, 0x000000, 0x000000,
0x000000, 0x000000, 0x000000, 0x000000,
0x00ebdb, 0x000000, 0x000000, 0x000000,
0x000000, 0xff9b3b, 0x000000, 0x000000,
0x83d313, 0x000000, 0x3fbfff, 0x000000,
0x0073ef, 0x000000, 0x000000, 0x000000,
0x00ebdb, 0x000000, 0x000000, 0x000000,
0x000000, 0x000000, 0xf3bf3f, 0x000000,
0x005100, 0x000000, 0xc7d7ff, 0xffdbab,
0x000000, 0x000000, 0x000000, 0x000000 }
},
{ "vs-cv", "VS Castlevania palette",
{ 0xaf7f00, 0xffa347, 0x008b8b, 0x472bbf,
0x970087, 0xf85898, 0xab1300, 0xf8b8f8,
0xf83800, 0x007800, 0x006b00, 0x005b00,
0xffffff, 0x9878f8, 0x00ab00, 0x000000,
0xbfbfbf, 0x0078f8, 0xab1300, 0x6b47ff,
0x000000, 0xe7005b, 0xf83800, 0x6b88ff,
0xaf7f00, 0x00b800, 0x6b88ff, 0x00ab47,
0x008b8b, 0x000000, 0x000000, 0x472bbf,
0xf8f8f8, 0xffe3ab, 0xf87858, 0x9878f8,
0x0078f8, 0xf85898, 0xbfbfbf, 0xffa347,
0x004358, 0xb8f818, 0x7f7f7f, 0x007800,
0x00ebdb, 0x000000, 0x000000, 0xffffff,
0xffffff, 0xa7e7ff, 0x5bdb57, 0x6b88ff,
0x004358, 0x0000ff, 0xe7005b, 0x00b800,
0xfbdb7b, 0xffa347, 0x8b1700, 0xffe3ab,
0xb8f818, 0xab0023, 0x000000, 0x007800 }
},
{ "vs-smb", "VS SMB/VS Ice Climber palette",
{ 0xaf7f00, 0x0000ff, 0x008b8b, 0x472bbf,
0x970087, 0xab0023, 0x0000ff, 0xe75f13,
0xbfbfbf, 0x007800, 0x5bdb57, 0x005b00,
0xf0d0b0, 0xffe3ab, 0x00ab00, 0x000000,
0xbfbfbf, 0x0078f8, 0x0058f8, 0x6b47ff,
0x000000, 0xe7005b, 0xf83800, 0xf87858,
0xaf7f00, 0x00b800, 0x6b88ff, 0x00ab47,
0x008b8b, 0x000000, 0x000000, 0x3fbfff,
0xf8f8f8, 0x006b00, 0x8b1700, 0x9878f8,
0x6b47ff, 0xf85898, 0x7f7f7f, 0xe7005b,
0x004358, 0xb8f818, 0x0078f8, 0x58f898,
0x00ebdb, 0xfbdb7b, 0x000000, 0x000000,
0xffffff, 0xa7e7ff, 0xb8b8f8, 0xf83800,
0xf8b8f8, 0xfba7c3, 0xffffff, 0x00ffff,
0xfbdb7b, 0xffa347, 0xb8f8b8, 0xb8f8d8,
0xb8f818, 0xf8d8f8, 0x000000, 0x007800 }
}
};
unsigned snes_library_revision_major(void)
{
return 1;
}
unsigned snes_library_revision_minor(void)
{
return 3;
}
const char *snes_library_id(void)
{
return "FCEUNext";
}
void snes_set_video_refresh(snes_video_refresh_t cb)
{
video_cb = cb;
}
void snes_set_audio_sample(snes_audio_sample_t cb)
{
audio_cb = cb;
}
void snes_set_input_poll(snes_input_poll_t cb)
{
poll_cb = cb;
}
void snes_set_input_state(snes_input_state_t cb)
{
input_cb = cb;
}
void snes_set_controller_port_device(bool a, unsigned b)
{}
static char g_basename[1024];
void snes_set_cartridge_basename(const char * path_)
{
char path[1024], *split;
strncpy(path, path_, sizeof(path));
split = strrchr(path_, '/');
if (!split) split = strrchr(path_, '\\');
if (split)
{
int len_filename, len_split;
strncpy(g_basename, split + 1, sizeof(g_basename));
len_filename = strlen(path_);
len_split = strlen(split);
}
else
{
strncpy(g_basename, path_, sizeof(path_));
}
fprintf(stderr, "BASENAME: %s\n", g_basename);
}
/* SSNES extension.*/
static snes_environment_t environ_cb;
void snes_set_environment(snes_environment_t cb) { environ_cb = cb; }
void snes_init(void)
{
if (environ_cb)
{
struct snes_geometry geom = { 256, 240, 256, 240 };
environ_cb(SNES_ENVIRONMENT_SET_GEOMETRY, &geom);
}
}
static void emulator_set_input(void)
{
FCEUI_SetInput(0, SI_GAMEPAD, &JSReturn[0], 0);
FCEUI_SetInput(1, SI_GAMEPAD, &JSReturn[0], 0);
}
static void emulator_set_custom_palette (void)
{
if (current_palette == 0 )
{
FCEU_ResetPalette(); /* Do palette reset*/
}
else
{
/* Now setup this palette*/
uint8 i,r,g,b;
for ( i = 0; i < 64; i++ )
{
r = palettes[current_palette-1].data[i] >> 16;
g = ( palettes[current_palette-1].data[i] & 0xff00 ) >> 8;
b = ( palettes[current_palette-1].data[i] & 0xff );
FCEUD_SetPalette( i, r, g, b);
FCEUD_SetPalette( i+64, r, g, b);
FCEUD_SetPalette( i+128, r, g, b);
FCEUD_SetPalette( i+192, r, g, b);
}
}
}
static void fceu_init(void)
{
emulator_set_input();
emulator_set_custom_palette();
FCEUD_SoundToggle();
}
void snes_term(void) {}
void snes_power(void)
{
PowerNES();
}
void snes_reset(void)
{
ResetNES();
}
typedef struct
{
unsigned snes;
unsigned nes;
} keymap;
static const keymap bindmap[] = {
{ SNES_DEVICE_ID_JOYPAD_A, JOY_A },
{ SNES_DEVICE_ID_JOYPAD_B, JOY_B },
{ SNES_DEVICE_ID_JOYPAD_SELECT, JOY_SELECT },
{ SNES_DEVICE_ID_JOYPAD_START, JOY_START },
{ SNES_DEVICE_ID_JOYPAD_UP, JOY_UP },
{ SNES_DEVICE_ID_JOYPAD_DOWN, JOY_DOWN },
{ SNES_DEVICE_ID_JOYPAD_LEFT, JOY_LEFT },
{ SNES_DEVICE_ID_JOYPAD_RIGHT, JOY_RIGHT },
};
static void update_input(void)
{
unsigned i;
unsigned char pad[2];
pad[0] = 0;
pad[1] = 0;
poll_cb();
for ( i = 0; i < 8; i++)
pad[0] |= input_cb(SNES_PORT_1, SNES_DEVICE_JOYPAD, 0, bindmap[i].snes) ? bindmap[i].nes : 0;
for ( i = 0; i < 8; i++)
pad[1] |= input_cb(SNES_PORT_2, SNES_DEVICE_JOYPAD, 0, bindmap[i].snes) ? bindmap[i].nes : 0;
JSReturn[0] = pad[0] | (pad[1] << 8);
}
EXPORT void snes_run(void)
{
unsigned i, y, x, ssize;
uint8_t *gfx;
static uint16_t video_out[1024 * 240];
ssize = 0;
FCEUI_Emulate(&gfx, &sound, &ssize);
gfx = XBuf;
for ( y = 0; y < 240; y++)
for ( x = 0; x < 256; x++, gfx++)
video_out[y * 1024 + x] = palette[*gfx];
video_cb(video_out, 256, 240);
update_input();
for ( i = 0; i < ssize; i++)
audio_cb(sound[i] & 0xffff, sound[i] & 0xffff);
}
static unsigned serialize_size = 0;
unsigned snes_serialize_size(void)
{
if (serialize_size == 0)
{
/* Something arbitrarily big.*/
uint8_t *buffer = (uint8_t*)malloc(1000000);
memstream_set_buffer(buffer, 1000000);
FCEUSS_Save();
serialize_size = memstream_get_last_size();
free(buffer);
}
return serialize_size;
}
bool snes_serialize(uint8_t *data, unsigned size)
{
if (size != snes_serialize_size())
return FALSE;
memstream_set_buffer(data, size);
FCEUSS_Save();
return TRUE;
}
bool snes_unserialize(const uint8_t *data, unsigned size)
{
if (size != snes_serialize_size())
return FALSE;
memstream_set_buffer((uint8_t*)data, size);
FCEUSS_Load();
return TRUE;
}
void snes_cheat_reset(void) {}
void snes_cheat_set(unsigned a, bool b, const char* c) { }
bool snes_load_cartridge_normal(const char* a, const uint8_t *rom_data, unsigned rom_size)
{
const char *full_path;
struct snes_system_timing timing;
if (!environ_cb)
{
fprintf(stderr, "Environment callback not set. Cannot continue ...\n");
return FALSE;
}
if (!environ_cb(SNES_ENVIRONMENT_GET_FULLPATH, &full_path) || !full_path)
{
fprintf(stderr, "GET_FULLPATH extension not supported. Cannot continue ...\n");
return FALSE;
}
FCEUI_Initialize();
FCEUI_SetSoundVolume(256);
//FCEUI_Sound(32050);
FCEUI_Sound(48000);
FCEUGameInfo = FCEUI_LoadGame(full_path);
fceu_init();
//timing.sample_rate = 32050.0;
timing.sample_rate = 48000;
if (FSettings.PAL)
timing.fps = 838977920.0/16777215.0;
else
timing.fps = 1008307711.0/16777215.0;
environ_cb(SNES_ENVIRONMENT_SET_TIMING, &timing);
return TRUE;
}
bool snes_load_cartridge_bsx_slotted(
const char* a, const uint8_t* b, unsigned c,
const char* d, const uint8_t* e, unsigned f
)
{ return FALSE; }
bool snes_load_cartridge_bsx(
const char* a, const uint8_t * b, unsigned c,
const char* d, const uint8_t * e, unsigned f
)
{ return FALSE; }
bool snes_load_cartridge_sufami_turbo(
const char* a, const uint8_t* b, unsigned c,
const char* d, const uint8_t* e, unsigned f,
const char* g, const uint8_t* h, unsigned i
)
{ return FALSE; }
bool snes_load_cartridge_super_game_boy(
const char* a, const uint8_t* b, unsigned c,
const char* d, const uint8_t* e, unsigned f
)
{ return FALSE; }
void snes_unload_cartridge(void)
{
FCEUI_CloseGame();
}
bool snes_get_region(void)
{
return FSettings.PAL ? SNES_REGION_PAL : SNES_REGION_NTSC;
}
uint8_t *snes_get_memory_data(unsigned id)
{
if (id != SNES_MEMORY_CARTRIDGE_RAM)
return NULL;
if (iNESCart.battery)
return iNESCart.SaveGame[0];
if (UNIFCart.battery)
return UNIFCart.SaveGame[0];
return 0;
}
unsigned snes_get_memory_size(unsigned id)
{
if (id != SNES_MEMORY_CARTRIDGE_RAM)
return 0;
if (iNESCart.battery)
return iNESCart.SaveGameLen[0];
if (UNIFCart.battery)
return UNIFCart.SaveGameLen[0];
return 0;
}
-162
View File
@@ -1,162 +0,0 @@
#ifndef LIBSNES_HPP
#define LIBSNES_HPP
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
#define SNES_PORT_1 0
#define SNES_PORT_2 1
#define SNES_DEVICE_NONE 0
#define SNES_DEVICE_JOYPAD 1
#define SNES_DEVICE_MULTITAP 2
#define SNES_DEVICE_MOUSE 3
#define SNES_DEVICE_SUPER_SCOPE 4
#define SNES_DEVICE_JUSTIFIER 5
#define SNES_DEVICE_JUSTIFIERS 6
#define SNES_DEVICE_ID_JOYPAD_B 0
#define SNES_DEVICE_ID_JOYPAD_Y 1
#define SNES_DEVICE_ID_JOYPAD_SELECT 2
#define SNES_DEVICE_ID_JOYPAD_START 3
#define SNES_DEVICE_ID_JOYPAD_UP 4
#define SNES_DEVICE_ID_JOYPAD_DOWN 5
#define SNES_DEVICE_ID_JOYPAD_LEFT 6
#define SNES_DEVICE_ID_JOYPAD_RIGHT 7
#define SNES_DEVICE_ID_JOYPAD_A 8
#define SNES_DEVICE_ID_JOYPAD_X 9
#define SNES_DEVICE_ID_JOYPAD_L 10
#define SNES_DEVICE_ID_JOYPAD_R 11
#define SNES_DEVICE_ID_MOUSE_X 0
#define SNES_DEVICE_ID_MOUSE_Y 1
#define SNES_DEVICE_ID_MOUSE_LEFT 2
#define SNES_DEVICE_ID_MOUSE_RIGHT 3
#define SNES_DEVICE_ID_SUPER_SCOPE_X 0
#define SNES_DEVICE_ID_SUPER_SCOPE_Y 1
#define SNES_DEVICE_ID_SUPER_SCOPE_TRIGGER 2
#define SNES_DEVICE_ID_SUPER_SCOPE_CURSOR 3
#define SNES_DEVICE_ID_SUPER_SCOPE_TURBO 4
#define SNES_DEVICE_ID_SUPER_SCOPE_PAUSE 5
#define SNES_DEVICE_ID_JUSTIFIER_X 0
#define SNES_DEVICE_ID_JUSTIFIER_Y 1
#define SNES_DEVICE_ID_JUSTIFIER_TRIGGER 2
#define SNES_DEVICE_ID_JUSTIFIER_START 3
#define SNES_REGION_NTSC 0
#define SNES_REGION_PAL 1
#define SNES_MEMORY_CARTRIDGE_RAM 0
#define SNES_MEMORY_CARTRIDGE_RTC 1
#define SNES_MEMORY_BSX_RAM 2
#define SNES_MEMORY_BSX_PRAM 3
#define SNES_MEMORY_SUFAMI_TURBO_A_RAM 4
#define SNES_MEMORY_SUFAMI_TURBO_B_RAM 5
#define SNES_MEMORY_GAME_BOY_RAM 6
#define SNES_MEMORY_GAME_BOY_RTC 7
#define SNES_MEMORY_WRAM 100
#define SNES_MEMORY_APURAM 101
#define SNES_MEMORY_VRAM 102
#define SNES_MEMORY_OAM 103
#define SNES_MEMORY_CGRAM 104
/* SSNES extension. Not required to be implemented for a working implementation.*/
#define SNES_ENVIRONMENT_GET_FULLPATH 0 /* const char ***/
#define SNES_ENVIRONMENT_SET_GEOMETRY 1 /* const struct snes_geometry **/
#define SNES_ENVIRONMENT_SET_PITCH 2 /* const unsigned **/
#define SNES_ENVIRONMENT_GET_OVERSCAN 3 /* bool * -- Boolean value whether or not the implementation should use overscan.*/
#define SNES_ENVIRONMENT_SET_TIMING 4 /* const struct snes_system_timing * -- Set exact timings of the system.*/
/* Used primarily for video recording*/
struct snes_geometry
{
unsigned base_width; /* Nominal video width of system.*/
unsigned base_height; /* Nominal video height of system.*/
unsigned max_width; /* Maximum possible width of system.*/
unsigned max_height; /* Maximum possible height of system.*/
};
struct snes_system_timing
{
double fps;
double sample_rate;
};
typedef bool (*snes_environment_t)(unsigned cmd, void *data);
/* Must be called before calling snes_init().*/
void snes_set_environment(snes_environment_t);
typedef void (*snes_video_refresh_t)(const uint16_t *data, unsigned width, unsigned height);
typedef void (*snes_audio_sample_t)(uint16_t left, uint16_t right);
typedef void (*snes_input_poll_t)(void);
typedef int16_t (*snes_input_state_t)(bool port, unsigned device, unsigned index, unsigned id);
unsigned snes_library_revision_major(void);
unsigned snes_library_revision_minor(void);
const char *snes_library_id(void);
void snes_set_video_refresh(snes_video_refresh_t);
void snes_set_audio_sample(snes_audio_sample_t);
void snes_set_input_poll(snes_input_poll_t);
void snes_set_input_state(snes_input_state_t);
void snes_set_controller_port_device(bool port, unsigned device);
void snes_set_cartridge_basename(const char *basename);
void snes_init(void);
void snes_term(void);
void snes_power(void);
void snes_reset(void);
void snes_run(void);
unsigned snes_serialize_size(void);
bool snes_serialize(uint8_t *data, unsigned size);
bool snes_unserialize(const uint8_t *data, unsigned size);
void snes_cheat_reset(void);
void snes_cheat_set(unsigned index, bool enabled, const char *code);
bool snes_load_cartridge_normal(
const char *rom_xml, const uint8_t *rom_data, unsigned rom_size
);
bool snes_load_cartridge_bsx_slotted(
const char *rom_xml, const uint8_t *rom_data, unsigned rom_size,
const char *bsx_xml, const uint8_t *bsx_data, unsigned bsx_size
);
bool snes_load_cartridge_bsx(
const char *rom_xml, const uint8_t *rom_data, unsigned rom_size,
const char *bsx_xml, const uint8_t *bsx_data, unsigned bsx_size
);
bool snes_load_cartridge_sufami_turbo(
const char *rom_xml, const uint8_t *rom_data, unsigned rom_size,
const char *sta_xml, const uint8_t *sta_data, unsigned sta_size,
const char *stb_xml, const uint8_t *stb_data, unsigned stb_size
);
bool snes_load_cartridge_super_game_boy(
const char *rom_xml, const uint8_t *rom_data, unsigned rom_size,
const char *dmg_xml, const uint8_t *dmg_data, unsigned dmg_size
);
void snes_unload_cartridge(void);
bool snes_get_region(void);
uint8_t* snes_get_memory_data(unsigned id);
unsigned snes_get_memory_size(unsigned id);
#ifdef __cplusplus
}
#endif
#endif
-133
View File
@@ -1,133 +0,0 @@
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include "memstream.h"
static uint8_t *g_buffer = NULL;
static size_t g_size = 0;
static size_t g_last_file_size = 0;
struct memstream
{
uint8_t *m_buf;
size_t m_size;
size_t m_ptr;
size_t m_max_ptr;
bool writing;
};
static void memstream_update_ptr(memstream_t *stream)
{
if (stream->m_ptr > stream->m_max_ptr)
stream->m_max_ptr = stream->m_ptr;
}
static void memstream_init(memstream_t *stream, uint8_t *buffer, size_t max_size, bool writing)
{
stream->m_buf = buffer;
stream->m_size = max_size;
stream->m_ptr = 0;
stream->m_max_ptr = 0;
stream->writing = writing;
}
void memstream_set_buffer(uint8_t *buffer, size_t size)
{
g_buffer = buffer;
g_size = size;
}
size_t memstream_get_last_size(void)
{
return g_last_file_size;
}
memstream_t *memstream_open(bool writing)
{
memstream_t *stream;
if (!g_buffer || !g_size)
return NULL;
stream = (memstream_t*)calloc(1, sizeof(*stream));
memstream_init(stream, g_buffer, g_size, writing);
g_buffer = NULL;
g_size = 0;
return stream;
}
void memstream_close(memstream_t *stream)
{
g_last_file_size = stream->writing ? stream->m_max_ptr : stream->m_size;
free(stream);
}
size_t memstream_read(memstream_t *stream, void *data, size_t bytes)
{
size_t avail = stream->m_size - stream->m_ptr;
if (bytes > avail)
bytes = avail;
memcpy(data, stream->m_buf + stream->m_ptr, bytes);
stream->m_ptr += bytes;
memstream_update_ptr(stream);
return bytes;
}
size_t memstream_write(memstream_t *stream, const void *data, size_t bytes)
{
size_t avail = stream->m_size - stream->m_ptr;
if (bytes > avail)
bytes = avail;
memcpy(stream->m_buf + stream->m_ptr, data, bytes);
stream->m_ptr += bytes;
memstream_update_ptr(stream);
return bytes;
}
int memstream_seek(memstream_t *stream, int offset, int whence)
{
size_t ptr;
if (whence == SEEK_SET)
ptr = offset;
else if (whence == SEEK_CUR)
ptr = stream->m_ptr + offset;
else if (whence == SEEK_END)
ptr = (stream->writing ? stream->m_max_ptr : stream->m_size) + offset;
else
return -1;
if (ptr <= stream->m_size)
{
stream->m_ptr = ptr;
return 0;
}
else
return -1;
}
size_t memstream_pos(memstream_t *stream)
{
return stream->m_ptr;
}
int memstream_getc(memstream_t *stream)
{
if (stream->m_ptr >= stream->m_size)
return EOF;
else
return stream->m_buf[stream->m_ptr++];
memstream_update_ptr(stream);
}
void memstream_putc(memstream_t *stream, int c)
{
if (stream->m_ptr < stream->m_size)
stream->m_buf[stream->m_ptr++] = c;
memstream_update_ptr(stream);
}
-30
View File
@@ -1,30 +0,0 @@
#ifndef __MEMSTREAM_H
#define __MEMSTREAM_H
#include <stddef.h>
#include <stdint.h>
#ifndef _MSC_VER
#include <stdbool.h>
#else
#define TRUE 1
#define FALSE 0
typedef unsigned char bool;
#endif
typedef struct memstream memstream_t;
memstream_t *memstream_open(bool writing);
void memstream_close(memstream_t *stream);
size_t memstream_read(memstream_t *stream, void *data, size_t bytes);
size_t memstream_write(memstream_t *stream, const void *data, size_t bytes);
int memstream_getc(memstream_t *stream);
void memstream_putc(memstream_t *stream, int c);
char *memstream_gets(memstream_t *stream, char *buffer, size_t len);
size_t memstream_pos(memstream_t *stream);
int memstream_seek(memstream_t *stream, int offset, int whence);
void memstream_set_buffer(uint8_t *buffer, size_t size);
size_t memstream_get_last_size(void);
#endif
-103
View File
@@ -1,103 +0,0 @@
/* 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
* TXC mappers, originally much complex banksitching
*/
#include "mapinc.h"
static uint8 reg[4], cmd, is172, is173;
static SFORMAT StateRegs[]=
{
{reg, 4, "REGS"},
{&cmd, 1, "CMD"},
{0}
};
static void Sync(void)
{
setprg32(0x8000,(reg[2]>>2)&1);
if(is172)
setchr8((((cmd^reg[2])>>3)&2)|(((cmd^reg[2])>>5)&1)); /* 1991 DU MA Racing probably CHR bank sequence is WRONG, so it is possible to*/
/* rearrange CHR banks for normal UNIF board and mapper 172 is unneccessary*/
else
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);*/
cmd=V;
Sync();
}
static DECLFR(UNL22211ReadLo)
{
return (reg[1]^reg[2])|(is173?0x01:0x40);
/* 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)
{
is172=0;
is173=0;
info->Power=UNL22211Power;
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
void Mapper172_Init(CartInfo *info)
{
is172=1;
is173=0;
info->Power=UNL22211Power;
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
void Mapper173_Init(CartInfo *info)
{
is172=0;
is173=1;
info->Power=UNL22211Power;
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
-128
View File
@@ -1,128 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2007 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
*
* FDS Conversion
*
*/
#include "mapinc.h"
static uint8 reg0, reg1, reg2;
static uint8 *WRAM=NULL;
static uint32 WRAMSIZE;
static SFORMAT StateRegs[]=
{
{&reg0, 1, "REG0"},
{&reg1, 1, "REG1"},
{&reg2, 1, "REG2"},
{0}
};
static void Sync(void)
{
setchr8(0);
setprg8(0x8000,0xc);
setprg8(0xe000,0xf);
if(reg2&0x10)
{
setprg8(0x6000,reg0);
setprg8(0xa000,0xd);
setprg8(0xc000,0xe);
}
else
{
setprg8r(0x10,0x6000,0);
setprg4(0xa000,(0xd<<1));
setprg2(0xb000,(0xd<<2)+2);
setprg2r(0x10,0xb800,4);
setprg2r(0x10,0xc000,5);
setprg2r(0x10,0xc800,6);
setprg2r(0x10,0xd000,7);
setprg2(0xd800,(0xe<<2)+3);
}
setmirror(reg1^1);
}
static DECLFW(M103RamWrite0)
{
WRAM[A&0x1FFF]=V;
}
static DECLFW(M103RamWrite1)
{
WRAM[0x2000+((A-0xB800)&0x1FFF)]=V;
}
static DECLFW(M103Write0)
{
reg0=V&0xf;
Sync();
}
static DECLFW(M103Write1)
{
reg1=(V>>3)&1;
Sync();
}
static DECLFW(M103Write2)
{
reg2=V;
Sync();
}
static void M103Power(void)
{
reg0=reg1=0; reg2=0;
Sync();
SetReadHandler(0x6000,0x7FFF,CartBR);
SetWriteHandler(0x6000,0x7FFF,M103RamWrite0);
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0xB800,0xD7FF,M103RamWrite1);
SetWriteHandler(0x8000,0x8FFF,M103Write0);
SetWriteHandler(0xE000,0xEFFF,M103Write1);
SetWriteHandler(0xF000,0xFFFF,M103Write2);
}
static void M103Close(void)
{
if(WRAM)
free(WRAM);
WRAM=NULL;
}
static void StateRestore(int version)
{
Sync();
}
void Mapper103_Init(CartInfo *info)
{
info->Power=M103Power;
info->Close=M103Close;
GameStateRestore=StateRestore;
WRAMSIZE=16384;
WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1);
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
AddExState(&StateRegs, ~0, 0, 0);
}
-119
View File
@@ -1,119 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2007 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[16], IRQa;
static uint32 IRQCount;
static uint8 *WRAM=NULL;
static uint32 WRAMSIZE;
static SFORMAT StateRegs[]=
{
{&IRQa, 1, "IRQA"},
{&IRQCount, 4, "IRQCOUNT"},
{reg, 16, "REGS"},
{0}
};
static void Sync(void)
{
setchr1(0x0000,reg[0]&0xfe);
setchr1(0x0400,reg[1]|1);
setchr1(0x0800,reg[2]&0xfe);
setchr1(0x0c00,reg[3]|1);
setchr1(0x1000,reg[4]);
setchr1(0x1400,reg[5]);
setchr1(0x1800,reg[6]);
setchr1(0x1c00,reg[7]);
setprg8r(0x10,0x6000,0);
setprg8(0x8000,(reg[0x8]&0xf)|0x10);
setprg8(0xA000,(reg[0x9]&0x1f));
setprg8(0xC000,(reg[0xa]&0x1f));
setprg8(0xE000,(reg[0xb]&0xf)|0x10);
setmirror((reg[0xc]&1)^1);
}
static DECLFW(M106Write)
{
A&=0xF;
switch(A)
{
case 0xD: IRQa=0; IRQCount=0; X6502_IRQEnd(FCEU_IQEXT); break;
case 0xE: IRQCount=(IRQCount&0xFF00)|V; break;
case 0xF: IRQCount=(IRQCount&0x00FF)|(V<<8); IRQa=1; break;
default: reg[A]=V; Sync(); break;
}
}
static void M106Power(void)
{
reg[8]=reg[9]=reg[0xa]=reg[0xb]=-1;
Sync();
SetReadHandler(0x6000,0x7FFF,CartBR);
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x6000,0x7FFF,CartBW);
SetWriteHandler(0x8000,0xFFFF,M106Write);
}
static void M106Reset(void)
{
}
static void M106Close(void)
{
if(WRAM)
free(WRAM);
WRAM=NULL;
}
void M106CpuHook(int a)
{
if(IRQa)
{
IRQCount+=a;
if(IRQCount>0x10000)
{
X6502_IRQBegin(FCEU_IQEXT);
IRQa=0;
}
}
}
static void StateRestore(int version)
{
Sync();
}
void Mapper106_Init(CartInfo *info)
{
info->Reset=M106Reset;
info->Power=M106Power;
info->Close=M106Close;
MapIRQHook=M106CpuHook;
GameStateRestore=StateRestore;
WRAMSIZE=8192;
WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1);
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
AddExState(&StateRegs, ~0, 0, 0);
}
-94
View File
@@ -1,94 +0,0 @@
/* 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
* NTDEC, ASDER games
*/
#include "mapinc.h"
static uint8 reg[8];
static uint8 mirror, cmd, bank;
static uint8 *WRAM=NULL;
static SFORMAT StateRegs[]=
{
{&cmd, 1, "CMD"},
{&mirror, 1, "MIRR"},
{&bank, 1, "BANK"},
{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,((bank&0x10)<<4)|reg[4]);
setchr1(0x1400,((bank&0x20)<<3)|reg[5]);
setchr1(0x1800,((bank&0x40)<<2)|reg[6]);
setchr1(0x1C00,((bank&0x80)<<1)|reg[7]);
}
static DECLFW(M112Write)
{
switch(A)
{
case 0xe000: mirror=V&1; Sync(); ;break;
case 0x8000: cmd=V&7; break;
case 0xa000: reg[cmd]=V; Sync(); break;
case 0xc000: bank=V; Sync(); break;
}
}
static void M112Close(void)
{
if(WRAM)
free(WRAM);
WRAM = NULL;
}
static void M112Power(void)
{
bank=0;
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);
}
-349
View File
@@ -1,349 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2011 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
*
* SL12 Protected 3-in-1 mapper hardware (VRC2, MMC3, MMC1)
* the same as 603-5052 board (TODO: add reading registers, merge)
* SL1632 2-in-1 protected board, similar to SL12 (TODO: find difference)
*
* Known PCB:
*
* Garou Densetsu Special (G0904.PCB, Huang-1, GAL dip: W conf.)
* Kart Fighter (008, Huang-1, GAL dip: W conf.)
* Somari (008, C5052-13, GAL dip: P conf., GK2-P/GK2-V maskroms)
* Somari (008, Huang-1, GAL dip: W conf., GK1-P/GK1-V maskroms)
* AV Mei Shao Nv Zhan Shi ()
* Samurai Spirits (Full version) (Huang-1, GAL dip: unk conf. GS-2A/GS-4A maskroms)
* Contra Fighter (603-5052 board, C5052-3, GAL dip: unk conf. SC603-A/SCB603-B maskroms)
*
*/
#include "mapinc.h"
static uint8 mode;
static uint8 vrc2_chr[8], vrc2_prg[2], vrc2_mirr;
static uint8 mmc3_regs[10], mmc3_ctrl, mmc3_mirr;
static uint8 IRQCount,IRQLatch,IRQa;
static uint8 IRQReload;
static uint8 mmc1_regs[4], mmc1_buffer, mmc1_shift;
static SFORMAT StateRegs[]=
{
{&mode, 1, "MODE"},
{vrc2_chr, 8, "VRC2CHR"},
{vrc2_prg, 2, "VRC2PRG"},
{&vrc2_mirr, 1, "VRC2MIR"},
{mmc3_regs, 10, "MMC3REGS"},
{&mmc3_ctrl, 1, "MMC3CTRL"},
{&mmc3_mirr, 1, "MMC3MIR"},
{&IRQReload, 1, "IRQR"},
{&IRQCount, 1, "IRQC"},
{&IRQLatch, 1, "IRQL"},
{&IRQa, 1, "IRQA"},
{mmc1_regs, 4, "MMC1REGS"},
{&mmc1_buffer, 1, "MMC1BUF"},
{&mmc1_shift, 1, "MMC1MIR"},
{0}
};
static void SyncPRG(void)
{
switch(mode & 3) {
case 0:
setprg8(0x8000, vrc2_prg[0]);
setprg8(0xA000, vrc2_prg[1]);
setprg8(0xC000, ~1);
setprg8(0xE000, ~0);
break;
case 1: {
uint32 swap = (mmc3_ctrl >> 5) & 2;
setprg8(0x8000, mmc3_regs[6 + swap]);
setprg8(0xA000, mmc3_regs[7]);
setprg8(0xC000, mmc3_regs[6 + (swap ^ 2)]);
setprg8(0xE000, mmc3_regs[9]);
break;
}
case 2:
case 3: {
uint8 bank = mmc1_regs[3] & 0xF;
if(mmc1_regs[0] & 8)
{
if(mmc1_regs[0] & 4)
{
setprg16(0x8000, bank);
setprg16(0xC000, 0x0F);
}
else
{
setprg16(0x8000, 0);
setprg16(0xC000, bank);
}
}
else
setprg32(0x8000, bank >> 1);
break;
}
}
}
static void SyncCHR(void)
{
uint32 base = (mode & 4) << 6;
switch(mode & 3) {
case 0:
setchr1(0x0000, base|vrc2_chr[0]);
setchr1(0x0400, base|vrc2_chr[1]);
setchr1(0x0800, base|vrc2_chr[2]);
setchr1(0x0c00, base|vrc2_chr[3]);
setchr1(0x1000, base|vrc2_chr[4]);
setchr1(0x1400, base|vrc2_chr[5]);
setchr1(0x1800, base|vrc2_chr[6]);
setchr1(0x1c00, base|vrc2_chr[7]);
break;
case 1: {
uint32 swap = (mmc3_ctrl & 0x80) << 5;
setchr1(0x0000 ^ swap, base|((mmc3_regs[0])&0xFE));
setchr1(0x0400 ^ swap, base|(mmc3_regs[0]|1));
setchr1(0x0800 ^ swap, base|((mmc3_regs[1])&0xFE));
setchr1(0x0c00 ^ swap, base|(mmc3_regs[1]|1));
setchr1(0x1000 ^ swap, base|mmc3_regs[2]);
setchr1(0x1400 ^ swap, base|mmc3_regs[3]);
setchr1(0x1800 ^ swap, base|mmc3_regs[4]);
setchr1(0x1c00 ^ swap, base|mmc3_regs[5]);
break;
}
case 2:
case 3:
if(mmc1_regs[0]&0x10)
{
setchr4(0x0000, mmc1_regs[1]);
setchr4(0x1000, mmc1_regs[2]);
}
else
setchr8(mmc1_regs[1] >> 1);
break;
}
}
static void SyncMIR(void)
{
switch(mode & 3) {
case 0: {
setmirror((vrc2_mirr&1)^1);
break;
}
case 1: {
setmirror((mmc3_mirr&1)^1);
break;
}
case 2:
case 3: {
switch(mmc1_regs[0]&3) {
case 0: setmirror(MI_0); break;
case 1: setmirror(MI_1); break;
case 2: setmirror(MI_V); break;
case 3: setmirror(MI_H); break;
}
break;
}
}
}
static void Sync(void)
{
SyncPRG();
SyncCHR();
SyncMIR();
}
static DECLFW(UNLSL12ModeWrite)
{
/* FCEU_printf("%04X:%02X\n",A,V);*/
if((A & 0x4100) == 0x4100) {
mode = V;
if(A&1) { /* hacky hacky, there are two configuration modes on SOMARI HUANG-1 PCBs*/
/* Solder pads with P1/P2 shorted called SOMARI P,*/
/* Solder pads with W1/W2 shorted called SOMARI W*/
/* Both identical 3-in-1 but W wanted MMC1 registers*/
/* to be reset when switch to MMC1 mode P one - doesn't*/
/* There is issue with W version of Somari at starting copyrights*/
mmc1_regs[0] = 0xc;
mmc1_regs[3] = 0;
mmc1_buffer = 0;
mmc1_shift = 0;
}
Sync();
}
}
static DECLFW(UNLSL12Write)
{
/* FCEU_printf("%04X:%02X\n",A,V);*/
switch(mode & 3) {
case 0: {
if((A>=0xB000)&&(A<=0xE003))
{
int32 ind=((((A&2)|(A>>10))>>1)+2)&7;
int32 sar=((A&1)<<2);
vrc2_chr[ind]=(vrc2_chr[ind]&(0xF0>>sar))|((V&0x0F)<<sar);
SyncCHR();
}
else
switch(A&0xF000) {
case 0x8000: vrc2_prg[0] = V; SyncPRG(); break;
case 0xA000: vrc2_prg[1] = V; SyncPRG(); break;
case 0x9000: vrc2_mirr = V; SyncMIR(); break;
}
break;
}
case 1: {
switch(A & 0xE001) {
case 0x8000: {
uint8 old_ctrl = mmc3_ctrl;
mmc3_ctrl = V;
if((old_ctrl&0x40) != (mmc3_ctrl&0x40))
SyncPRG();
if((old_ctrl&0x80) != (mmc3_ctrl&0x80))
SyncCHR();
break;
}
case 0x8001:
mmc3_regs[mmc3_ctrl & 7] = V;
if((mmc3_ctrl & 7) < 6)
SyncCHR();
else
SyncPRG();
break;
case 0xA000:
mmc3_mirr = V;
SyncMIR();
break;
case 0xC000:
IRQLatch = V;
break;
case 0xC001:
IRQReload = 1;
break;
case 0xE000:
X6502_IRQEnd(FCEU_IQEXT);
IRQa=0;
break;
case 0xE001:
IRQa=1;
break;
}
break;
}
case 2:
case 3: {
if(V & 0x80)
{
mmc1_regs[0] |= 0xc;
mmc1_buffer = mmc1_shift = 0;
SyncPRG();
}
else
{
uint8 n = (A >> 13) - 4;
mmc1_buffer |= (V & 1) << (mmc1_shift++);
if(mmc1_shift == 5)
{
mmc1_regs[n] = mmc1_buffer;
mmc1_buffer = mmc1_shift = 0;
switch(n) {
case 0: SyncMIR();
case 2: SyncCHR();
case 3:
case 1: SyncPRG();
}
}
}
break;
}
}
}
static void UNLSL12HBIRQ(void)
{
if((mode & 3) == 1)
{
int32 count = IRQCount;
if(!count || IRQReload)
{
IRQCount = IRQLatch;
IRQReload = 0;
}
else
IRQCount--;
if(!IRQCount)
{
if(IRQa)
X6502_IRQBegin(FCEU_IQEXT);
}
}
}
static void StateRestore(int version)
{
Sync();
}
static void UNLSL12Power(void)
{
mode = 0;
vrc2_chr[0] = ~0;
vrc2_chr[1] = ~0;
vrc2_chr[2] = ~0;
vrc2_chr[3] = ~0; /* W conf. of Somari wanted CHR3 has to be set to BB bank (or similar), but doesn't do that directly*/
vrc2_chr[4] = 4;
vrc2_chr[5] = 5;
vrc2_chr[6] = 6;
vrc2_chr[7] = 7;
vrc2_prg[0] = 0;
vrc2_prg[1] = 1;
vrc2_mirr = 0;
mmc3_regs[0] = 0;
mmc3_regs[1] = 2;
mmc3_regs[2] = 4;
mmc3_regs[3] = 5;
mmc3_regs[4] = 6;
mmc3_regs[5] = 7;
mmc3_regs[6] = ~3;
mmc3_regs[7] = ~2;
mmc3_regs[8] = ~1;
mmc3_regs[9] = ~0;
mmc3_ctrl = mmc3_mirr = IRQCount = IRQLatch = IRQa = 0;
mmc1_regs[0] = 0xc;
mmc1_regs[1] = 0;
mmc1_regs[2] = 0;
mmc1_regs[3] = 0;
mmc1_buffer = 0;
mmc1_shift = 0;
Sync();
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x4100,0x7FFF,UNLSL12ModeWrite);
SetWriteHandler(0x8000,0xFFFF,UNLSL12Write);
}
void UNLSL12_Init(CartInfo *info)
{
info->Power = UNLSL12Power;
GameHBIRQHook = UNLSL12HBIRQ;
GameStateRestore = StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
-104
View File
@@ -1,104 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
static uint8 prgreg[4], chrreg[8], mirror;
static uint8 IRQa, IRQCount, IRQLatch;
static SFORMAT StateRegs[]=
{
{&IRQa, 1, "IRQA"},
{&IRQCount, 1, "IRQC"},
{&IRQLatch, 1, "IRQL"},
{prgreg, 4, "PREGS"},
{chrreg, 8, "CREGS"},
{&mirror, 1, "MREG"},
{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]);
setmirror(mirror^1);
}
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;
case 0xd000: mirror=V&1;
}
}
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);
}
-126
View File
@@ -1,126 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2007-2008 Mad Dumper, 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
* Panda prince pirate.
* MK4, MK6, A9711 board
* 6035052 seems to be the same too, but with prot array in reverse
* A9746 seems to be the same too, check
* 187 seems to be the same too, check (A98402 board)
*/
#include "mapinc.h"
#include "mmc3.h"
static void Sync()
{
switch(EXPREGS[5]&0x3F)
{
case 0x20: EXPREGS[7] = 1; EXPREGS[0]=EXPREGS[6]; break;
case 0x29: EXPREGS[7] = 1; EXPREGS[0]=EXPREGS[6]; break;
case 0x26: EXPREGS[7] = 0; EXPREGS[0]=EXPREGS[6]; break;
case 0x2B: EXPREGS[7] = 1; EXPREGS[0]=EXPREGS[6]; break;
case 0x2C: EXPREGS[7] = 1; if(EXPREGS[6]) EXPREGS[0]=EXPREGS[6]; break;
case 0x3F: EXPREGS[7] = 1; EXPREGS[0]=EXPREGS[6]; break;
case 0x28: EXPREGS[7] = 0; EXPREGS[1]=EXPREGS[6]; break;
case 0x2A: EXPREGS[7] = 0; EXPREGS[2]=EXPREGS[6]; break;
case 0x2F: break;
default: EXPREGS[5] = 0; break;
}
}
static void M121CW(uint32 A, uint8 V)
{
if((A&0x1000)==((MMC3_cmd&0x80)<<5))
setchr1(A,V|0x100);
else
setchr1(A,V);
}
static void M121PW(uint32 A, uint8 V)
{
if(EXPREGS[5]&0x3F)
{
/* FCEU_printf("prot banks: %02x %02x %02x %02x\n",V,EXPREGS[2],EXPREGS[1],EXPREGS[0]);*/
setprg8(A,V&0x3F);
setprg8(0xE000,EXPREGS[0]);
setprg8(0xC000,EXPREGS[1]);
setprg8(0xA000,EXPREGS[2]);
}
else
{
/* FCEU_printf("gen banks: %04x %02x\n",A,V);*/
setprg8(A,V&0x3F);
}
}
static DECLFW(M121Write)
{
/* FCEU_printf("write: %04x:%04x\n",A&0xE003,V);*/
switch(A&0xE003)
{
case 0x8000: /*EXPREGS[5] = 0;*/
/* FCEU_printf("gen: %02x\n",V);*/
MMC3_CMDWrite(A,V);
FixMMC3PRG(MMC3_cmd);
break;
case 0x8001: EXPREGS[6] = ((V&1)<<5)|((V&2)<<3)|((V&4)<<1)|((V&8)>>1)|((V&0x10)>>3)|((V&0x20)>>5);
/* FCEU_printf("bank: %02x (%02x)\n",V,EXPREGS[6]);*/
if(!EXPREGS[7]) Sync();
MMC3_CMDWrite(A,V);
FixMMC3PRG(MMC3_cmd);
break;
case 0x8003: EXPREGS[5] = V;
/* EXPREGS[7] = 0;*/
/* FCEU_printf("prot: %02x\n",EXPREGS[5]);*/
Sync();
MMC3_CMDWrite(0x8000,V);
FixMMC3PRG(MMC3_cmd);
break;
}
}
static uint8 prot_array[16] = { 0x83, 0x83, 0x42, 0x00 };
static DECLFW(M121LoWrite)
{
EXPREGS[4] = prot_array[V&3]; /* 0x100 bit in address seems to be switch arrays 0, 2, 2, 3 (Contra Fighter)*/
/* FCEU_printf("write: %04x:%04x\n",A,V);*/
}
static DECLFR(M121Read)
{
/* FCEU_printf("read: %04x->\n",A,EXPREGS[0]);*/
return EXPREGS[4];
}
static void M121Power(void)
{
EXPREGS[5] = 0;
GenMMC3Power();
SetReadHandler(0x5000,0x5FFF,M121Read);
SetWriteHandler(0x5000,0x5FFF,M121LoWrite);
SetWriteHandler(0x8000,0x9FFF,M121Write);
}
void Mapper121_Init(CartInfo *info)
{
GenMMC3_Init(info, 128, 256, 8, 0);
pwrap=M121PW;
cwrap=M121CW;
info->Power=M121Power;
AddExState(EXPREGS, 8, 0, "EXPR");
}
-79
View File
@@ -1,79 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2009 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
*
* 7-in-1 Darkwing Duck, Snake, MagicBlock (PCB marked as "12 in 1")
*/
#include "mapinc.h"
static uint8 reg[4];
static SFORMAT StateRegs[]=
{
{reg, 4, "REGS"},
{0}
};
static void Sync(void)
{
uint8 bank = (reg[3]&3)<<3;
setchr4(0x0000, (reg[1]>>3)|(bank<<2));
setchr4(0x1000, (reg[2]>>3)|(bank<<2));
if(reg[3]&8)
{
setprg32(0x8000,((reg[2]&7)>>1)|bank);
}
else
{
setprg16(0x8000, (reg[1]&7)|bank);
setprg16(0xc000, 7|bank);
}
setmirror(((reg[3]&4)>>2)^1);
}
static DECLFW(BMC12IN1Write)
{
switch(A)
{
case 0xafff: reg[0] = V; break;
case 0xbfff: reg[1] = V; break;
case 0xdfff: reg[2] = V; break;
case 0xefff: reg[3] = V; break;
}
Sync();
}
static void BMC12IN1Power(void)
{
reg[0]=reg[1]=reg[2]=reg[3]=0;
Sync();
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x8000,0xFFFF,BMC12IN1Write);
}
static void StateRestore(int version)
{
Sync();
}
void BMC12IN1_Init(CartInfo *info)
{
info->Power=BMC12IN1Power;
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
-119
View File
@@ -1,119 +0,0 @@
/* 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 latchea;
static uint8 latched;
static uint8 *WRAM=NULL;
static uint32 WRAMSIZE;
static SFORMAT StateRegs[]=
{
{&latchea, 2, "LATCHEA"},
{&latched, 1, "LATCHED"},
{0}
};
static void Sync(void)
{
int i;
setmirror(((latched>>6)&1)^1);
switch(latchea)
{
case 0x8000:
for(i=0;i<4;i++)
setprg8(0x8000+(i<<13),(((latched&0x7F)<<1)+i)^(latched>>7));
break;
case 0x8002:
for(i=0;i<4;i++)
setprg8(0x8000+(i<<13),((latched&0x7F)<<1)+(latched>>7));
break;
case 0x8001:
case 0x8003:
for(i=0;i<4;i++)
{
unsigned int b;
b=latched&0x7F;
if(i>=2 && !(latchea&0x2))
i=0x7F;
setprg8(0x8000+(i<<13),(i&1)+((b<<1)^(latched>>7)));
}
break;
}
}
static DECLFW(M15Write)
{
latchea=A;
latched=V;
Sync();
}
static void StateRestore(int version)
{
Sync();
}
static void M15Power(void)
{
latchea=0x8000;
latched=0;
setchr8(0);
setprg8r(0x10,0x6000,0);
SetReadHandler(0x6000,0x7FFF,CartBR);
SetWriteHandler(0x6000,0x7FFF,CartBW);
SetWriteHandler(0x8000,0xFFFF,M15Write);
SetReadHandler(0x8000,0xFFFF,CartBR);
Sync();
}
static void M15Reset(void)
{
latchea=0x8000;
latched=0;
Sync();
}
static void M15Close(void)
{
if(WRAM)
free(WRAM);
WRAM=NULL;
}
void Mapper15_Init(CartInfo *info)
{
info->Power=M15Power;
info->Reset=M15Reset;
info->Close=M15Close;
GameStateRestore=StateRestore;
WRAMSIZE=8192;
WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1);
if(info->battery)
{
info->SaveGame[0]=WRAM;
info->SaveGameLen[0]=WRAMSIZE;
}
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
AddExState(&StateRegs, ~0, 0, 0);
}
-112
View File
@@ -1,112 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2009 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
*
* DIS23C01 DAOU ROM CONTROLLER, Korea
* Metal Force (K)
* Buzz and Waldog (K)
* General's Son (K)
*
*/
#include "mapinc.h"
static uint8 chrlo[8], chrhi[8], prg, mirr, mirrisused = 0;
static uint8 *WRAM=NULL;
static uint32 WRAMSIZE;
static SFORMAT StateRegs[]=
{
{&prg, 1, "PREG"},
{chrlo, 8, "CREGSLO"},
{chrhi, 8, "CREGSHI"},
{&mirr, 1, "MIRR"},
{0}
};
static void Sync(void)
{
uint32 i;
for(i=0; i<8; i++)
setchr1(i<<10, chrlo[i]|(chrhi[i] << 8));
setprg8r(0x10,0x6000,0);
setprg16(0x8000,prg);
setprg16(0xC000,~0);
if(mirrisused)
setmirror(mirr ^ 1);
else
setmirror(MI_0);
}
static DECLFW(M156Write)
{
switch(A) {
case 0xC000:
case 0xC001:
case 0xC002:
case 0xC003: chrlo[A&3] = V; Sync(); break;
case 0xC004:
case 0xC005:
case 0xC006:
case 0xC007: chrhi[A&3] = V; Sync(); break;
case 0xC008:
case 0xC009:
case 0xC00A:
case 0xC00B: chrlo[4+(A&3)] = V; Sync(); break;
case 0xC00C:
case 0xC00D:
case 0xC00E:
case 0xC00F: chrhi[4+(A&3)] = V; Sync(); break;
case 0xC010: prg = V; Sync(); break;
case 0xC014: mirr = V; mirrisused = 1; Sync(); break;
}
}
static void M156Power(void)
{
Sync();
SetReadHandler(0x6000,0xFFFF,CartBR);
SetWriteHandler(0x6000,0x7FFF,CartBW);
SetWriteHandler(0xC000,0xCFFF,M156Write);
}
static void M156Close(void)
{
if(WRAM)
free(WRAM);
WRAM=NULL;
}
static void StateRestore(int version)
{
Sync();
}
void Mapper156_Init(CartInfo *info)
{
info->Power=M156Power;
info->Close=M156Close;
WRAMSIZE=8192;
WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1);
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
-238
View File
@@ -1,238 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel 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 laststrobe, trigger;
static uint8 reg[8];
static uint8 *WRAM=NULL;
static uint32 WRAMSIZE;
static void(*WSync)(void);
static SFORMAT StateRegs[]=
{
{&laststrobe, 1, "STB"},
{&trigger, 1, "TRG"},
{reg, 8, "REGS"},
{0}
};
static void Sync(void)
{
setprg8r(0x10,0x6000,0);
setprg32(0x8000,(reg[0]<<4)|(reg[1]&0xF));
setchr8(0);
}
static void StateRestore(int version)
{
WSync();
}
static DECLFR(ReadLow)
{
switch (A&0x7700)
{
case 0x5100: return reg[2]|reg[0]|reg[1]|reg[3]^0xff; break;
case 0x5500: if(trigger)
return reg[2]|reg[1]; /* Lei Dian Huang Bi Ka Qiu Chuan Shuo (NJ046) may broke other games*/
else
return 0;
}
return 4;
}
static void M163HB(void)
{
if(reg[1]&0x80)
{
if(scanline==239)
{
setchr4(0x0000,0);
setchr4(0x1000,0);
}
else if(scanline==127)
{
setchr4(0x0000,1);
setchr4(0x1000,1);
}
/* Hu Lu Jin Gang (NJ039) (Ch) [!] don't like it */
/*
if(scanline>=127)
{
setchr4(0x0000,1);
setchr4(0x1000,1);
}
else
{
setchr4(0x0000,0);
setchr4(0x1000,0);
}
*/
}
}
static DECLFW(Write)
{
switch (A&0x7300)
{
case 0x5100: reg[0]=V; WSync(); break;
case 0x5000: reg[1]=V; WSync(); break;
case 0x5200: reg[3]=V; WSync(); break;
case 0x5300: reg[2]=V; break;
}
}
static void Power(void)
{
memset(reg,0,8);
reg[1]=0xFF;
SetWriteHandler(0x5000,0x5FFF,Write);
SetReadHandler(0x6000,0xFFFF,CartBR);
SetWriteHandler(0x6000,0x7FFF,CartBW);
WSync();
}
static void Close(void)
{
if(WRAM)
free(WRAM);
WRAM=NULL;
}
void Mapper164_Init(CartInfo *info)
{
info->Power=Power;
info->Close=Close;
WSync = Sync;
WRAMSIZE = 8192;
WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1);
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
if(info->battery)
{
info->SaveGame[0]=WRAM;
info->SaveGameLen[0]=WRAMSIZE;
}
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
static DECLFW(Write2)
{
if(A==0x5101)
{
if(laststrobe&&!V)
{
trigger^=1;
}
laststrobe=V;
}else if(A==0x5100&&V==6) /*damn thoose protected games*/
setprg32(0x8000,3);
else
switch (A&0x7300)
{
case 0x5200: reg[0]=V; WSync(); break;
case 0x5100: reg[3]=V; WSync(); break;
case 0x5000: reg[1]=V; WSync(); if(!(reg[1]&0x80)&&(scanline<128)) setchr8(0); /* setchr8(0); */ break;
case 0x5300: reg[2]=V; break;
}
}
static void Power2(void)
{
memset(reg,0,8);
laststrobe=1;
SetReadHandler(0x5000,0x5FFF,ReadLow);
SetWriteHandler(0x5000,0x5FFF,Write2);
SetReadHandler(0x6000,0xFFFF,CartBR);
SetWriteHandler(0x6000,0x7FFF,CartBW);
WSync();
}
void Mapper163_Init(CartInfo *info)
{
info->Power=Power2;
info->Close=Close;
WSync = Sync;
GameHBIRQHook=M163HB;
WRAMSIZE = 8192;
WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1);
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
if(info->battery)
{
info->SaveGame[0]=WRAM;
info->SaveGameLen[0]=WRAMSIZE;
}
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
static void Sync3(void)
{
setchr8(0);
setprg8r(0x10,0x6000,0);
setprg32(0x8000,(reg[0]&0xe)|((reg[1]>>1)&1)|((reg[2]&15)<<4));
}
static DECLFW(Write3)
{
/* FCEU_printf("bs %04x %02x\n",A,V);*/
reg[(A>>8)&3]=V;
WSync();
}
static void Power3(void)
{
memset(reg,0,8);
SetWriteHandler(0x5000,0x5FFF,Write3);
SetReadHandler(0x6000,0xFFFF,CartBR);
SetWriteHandler(0x6000,0x7FFF,CartBW);
WSync();
}
void UNLFS304_Init(CartInfo *info)
{
info->Power=Power3;
info->Close=Close;
WSync = Sync3;
WRAMSIZE = 8192;
WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1);
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
if(info->battery)
{
info->SaveGame[0]=WRAM;
info->SaveGameLen[0]=WRAMSIZE;
}
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
-89
View File
@@ -1,89 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2009 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
*
* RacerMate Chalenge II
*
*/
#include "mapinc.h"
static uint8 reg;
static uint8 *CHRRAM=NULL;
static uint32 CHRRAMSIZE;
static SFORMAT StateRegs[]=
{
{&reg, 1, "REGS"},
{0}
};
static void Sync(void)
{
setchr4r(0x10,0x0000,0);
setchr4r(0x10,0x1000,reg&0x0f);
setprg16(0x8000,reg>>6);
setprg16(0xc000,~0);
}
static DECLFW(M168Write)
{
reg=V;
Sync();
}
static DECLFW(M168Dummy)
{
}
static void M168Power(void)
{
reg=0;
Sync();
SetWriteHandler(0x4020,0x7fff,M168Dummy);
SetWriteHandler(0xB000,0xB000,M168Write);
SetWriteHandler(0xF000,0xF000,M168Dummy);
SetWriteHandler(0xF080,0xF080,M168Dummy);
SetReadHandler(0x8000,0xFFFF,CartBR);
}
static void MNNNClose(void)
{
if(CHRRAM)
free(CHRRAM);
CHRRAM=NULL;
}
static void StateRestore(int version)
{
Sync();
}
void Mapper168_Init(CartInfo *info)
{
info->Power=M168Power;
info->Close=MNNNClose;
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
CHRRAMSIZE=8192*8;
CHRRAM=(uint8*)FCEU_gmalloc(CHRRAMSIZE);
SetupCartCHRMapping(0x10,CHRRAM,CHRRAMSIZE,1);
AddExState(CHRRAM, CHRRAMSIZE, 0, "CRAM");
}
-69
View File
@@ -1,69 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2011 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 SFORMAT StateRegs[]=
{
{&reg, 1, "REGS"},
{0}
};
static void Sync(void)
{
setprg16(0x8000, 0);
setprg16(0xc000,~0);
setchr8(0);
}
static DECLFW(M170ProtW)
{
reg = V << 1 & 0x80;
}
static DECLFR(M170ProtR)
{
return reg | (X.DB & 0x7F);
}
static void M170Power(void)
{
Sync();
SetWriteHandler(0x6502,0x6502,M170ProtW);
SetWriteHandler(0x7000,0x7000,M170ProtW);
SetReadHandler(0x7001,0x7001,M170ProtR);
SetReadHandler(0x7777,0x7777,M170ProtR);
SetReadHandler(0x8000,0xFFFF,CartBR);
}
static void StateRestore(int version)
{
Sync();
}
void Mapper170_Init(CartInfo *info)
{
info->Power=M170Power;
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
-88
View File
@@ -1,88 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2007 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, delay, mirr;
static SFORMAT StateRegs[]=
{
{&reg, 1, "REG"},
{&mirr, 1, "MIRR"},
{0}
};
static void Sync(void)
{
setchr8(reg);
if(!delay)
{
setprg16(0x8000,reg);
setprg8(0xC000,reg << 1);
}
setprg8(0xE000,(reg << 1) + 1);
setmirror(((mirr&4)>>2)^1);
}
static DECLFW(M175Write1)
{
mirr = V;
delay = 1;
Sync();
}
static DECLFW(M175Write2)
{
reg = V & 0x0F;
delay = 1;
Sync();
}
static DECLFR(M175Read)
{
if(A==0xFFFC)
{
delay = 0;
Sync();
}
return CartBR(A);
}
static void M175Power(void)
{
reg = mirr = delay = 0;
SetReadHandler(0x8000,0xFFFF,M175Read);
SetWriteHandler(0x8000,0x8000,M175Write1);
SetWriteHandler(0xA000,0xA000,M175Write2);
Sync();
}
static void StateRestore(int version)
{
Sync();
}
void Mapper175_Init(CartInfo *info)
{
info->Power=M175Power;
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
-89
View File
@@ -1,89 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2007 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, chr;
static uint8 *WRAM=NULL;
static uint32 WRAMSIZE;
static SFORMAT StateRegs[]=
{
{&prg, 1, "PRG"},
{&chr, 1, "CHR"},
{0}
};
static void Sync(void)
{
setprg8r(0x10,0x6000,0);
setprg32(0x8000,prg>>1);
setchr8(chr);
}
static DECLFW(M176Write1)
{
prg = V;
Sync();
}
static DECLFW(M176Write2)
{
chr = V;
Sync();
}
static void M176Power(void)
{
prg = ~0;
SetReadHandler(0x6000,0x7fff,CartBR);
SetWriteHandler(0x6000,0x7fff,CartBW);
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x5ff1,0x5ff1,M176Write1);
SetWriteHandler(0x5ff2,0x5ff2,M176Write2);
Sync();
}
static void M176Close(void)
{
if(WRAM)
free(WRAM);
WRAM=NULL;
}
static void StateRestore(int version)
{
Sync();
}
void Mapper176_Init(CartInfo *info)
{
info->Power=M176Power;
info->Close=M176Close;
GameStateRestore=StateRestore;
WRAMSIZE=8192;
WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1);
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
AddExState(&StateRegs, ~0, 0, 0);
}
-87
View File
@@ -1,87 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2007 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 *WRAM=NULL;
static uint32 WRAMSIZE;
static SFORMAT StateRegs[]=
{
{&reg, 1, "REG"},
{0}
};
static void Sync(void)
{
setchr8(0);
setprg8r(0x10,0x6000,0);
setprg32(0x8000,reg&0x1f);
setmirror(((reg&0x20)>>5)^1);
}
static DECLFW(M177Write)
{
reg=V;
Sync();
}
static void M177Power(void)
{
reg=0;
Sync();
SetReadHandler(0x6000,0x7fff,CartBR);
SetWriteHandler(0x6000,0x7fff,CartBW);
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x8000,0xFFFF,M177Write);
}
static void M177Close(void)
{
if(WRAM)
free(WRAM);
WRAM=NULL;
}
static void StateRestore(int version)
{
Sync();
}
void Mapper177_Init(CartInfo *info)
{
info->Power=M177Power;
info->Close=M177Close;
GameStateRestore=StateRestore;
WRAMSIZE=8192;
WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1);
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
if(info->battery)
{
info->SaveGame[0]=WRAM;
info->SaveGameLen[0]=WRAMSIZE;
}
AddExState(&StateRegs, ~0, 0, 0);
}
-104
View File
@@ -1,104 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2007 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
*
* San Guo Zhong Lie Zhuan (Ch)
* win200, etc
*
*/
#include "mapinc.h"
static uint8 reg[4];
static uint8 *WRAM=NULL;
static uint32 WRAMSIZE;
static SFORMAT StateRegs[]=
{
{reg, 4, "REGS"},
{0}
};
static void Sync(void)
{
uint8 bank = (reg[2]&3)<<3;
setmirror((reg[0]&1)^1);
setprg8r(0x10,0x6000,0);
setchr8(0);
if(reg[0]&2)
{
setprg16(0x8000,(reg[1]&7)|bank);
setprg16(0xC000,((~0)&7)|bank);
}
else
{
setprg16(0x8000,(reg[1]&6)|bank);
setprg16(0xC000,(reg[1]&6)|bank|1);
}
}
static DECLFW(M178Write)
{
reg[A&3]=V;
Sync();
}
static void M178Power(void)
{
reg[0]=1;
reg[1]=0;
reg[2]=0;
reg[3]=0;
Sync();
SetReadHandler(0x6000,0x7FFF,CartBR);
SetWriteHandler(0x6000,0x7FFF,CartBW);
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x4800,0x4803,M178Write);
}
static void M178Close(void)
{
if(WRAM)
free(WRAM);
WRAM=NULL;
}
static void StateRestore(int version)
{
Sync();
}
void Mapper178_Init(CartInfo *info)
{
info->Power=M178Power;
info->Close=M178Close;
GameStateRestore=StateRestore;
WRAMSIZE=8192;
WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1);
if(info->battery)
{
info->SaveGame[0]=WRAM;
info->SaveGameLen[0]=WRAMSIZE;
}
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
AddExState(&StateRegs, ~0, 0, 0);
}
-117
View File
@@ -1,117 +0,0 @@
/* 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 (VRC4 mapper)
*/
#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))
{
int 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);
}
-115
View File
@@ -1,115 +0,0 @@
/* 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)
free(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);
}
-104
View File
@@ -1,104 +0,0 @@
/* 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)
free(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);
}
-102
View File
@@ -1,102 +0,0 @@
/* 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
*
* A98402 board, A9711, A9746 similar
* King of Fighters 96, The (Unl), Street Fighter Zero 2 (Unl)
*
*/
#include "mapinc.h"
#include "mmc3.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)
{
if(EXPREGS[0]&0x40)
setprg32(0x8000,bank>>2);
else
setprg32(0x8000,bank>>1); /* hacky hacky! two mappers in one! need real hw carts to test*/
}
else
{
setprg16(0x8000,bank);
setprg16(0xC000,bank);
}
}
else
setprg8(A,V&0x3F);
}
static DECLFW(M187Write8000)
{
EXPREGS[1]=1;
MMC3_CMDWrite(A,V);
}
static DECLFW(M187Write8001)
{
if(EXPREGS[1])
MMC3_CMDWrite(A,V);
}
static DECLFW(M187WriteLo)
{
if((A==0x5000)||(A==0x6000))
{
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]=0;
GenMMC3Power();
SetReadHandler(0x5000,0x5FFF,M187Read);
SetWriteHandler(0x5000,0x6FFF,M187WriteLo);
SetWriteHandler(0x8000,0x8000,M187Write8000);
SetWriteHandler(0x8001,0x8001,M187Write8001);
}
void Mapper187_Init(CartInfo *info)
{
GenMMC3_Init(info, 256, 256, 0, 0);
pwrap=M187PW;
cwrap=M187CW;
info->Power=M187Power;
AddExState(EXPREGS, 3, 0, "EXPR");
}
-78
View File
@@ -1,78 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2009 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
* MEGA-SOFT WAR IN THE GULF
*/
#include "mapinc.h"
static uint8 reg[8];
static uint8 mirror, cmd, bank;
static SFORMAT StateRegs[]=
{
{&cmd, 1, "CMD"},
{&mirror, 1, "MIRR"},
{&bank, 1, "BANK"},
{reg, 8, "REGS"},
{0}
};
static void Sync(void)
{
setmirror(mirror^1);
setprg8(0x8000,reg[3]);
setprg8(0xA000,0xD);
setprg8(0xC000,0xE);
setprg8(0xE000,0xF);
setchr4(0x0000,reg[0]>>2);
setchr2(0x1000,reg[1]>>1);
setchr2(0x1800,reg[2]>>1);
}
static DECLFW(M193Write)
{
reg[A&3]=V;
Sync();
}
static void M193Power(void)
{
bank=0;
Sync();
SetWriteHandler(0x6000,0x6003,M193Write);
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x8000,0xFFFF,CartBW);
}
static void M193Reset(void)
{
}
static void StateRestore(int version)
{
Sync();
}
void Mapper193_Init(CartInfo *info)
{
info->Reset=M193Reset;
info->Power=M193Power;
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
-107
View File
@@ -1,107 +0,0 @@
/* 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 uint8 *CHRRAM=NULL;
static uint32 CHRRAMSIZE;
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))
{
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);
}
static void M199Close(void)
{
if(CHRRAM)
free(CHRRAM);
CHRRAM=NULL;
}
void Mapper199_Init(CartInfo *info)
{
GenMMC3_Init(info, 512, 256, 8, info->battery);
cwrap=M199CW;
pwrap=M199PW;
mwrap=M199MW;
info->Power=M199Power;
info->Close=M199Close;
CHRRAMSIZE=8192;
CHRRAM=(uint8*)FCEU_gmalloc(CHRRAMSIZE);
SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1);
AddExState(CHRRAM, CHRRAMSIZE, 0, "CHRR");
AddExState(EXPREGS, 4, 0, "EXPR");
}
-83
View File
@@ -1,83 +0,0 @@
/* 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");
}
-106
View File
@@ -1,106 +0,0 @@
/* 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
* (VRC4 mapper)
*/
#include "mapinc.h"
static uint8 IRQCount;/*, IRQPre;*/
static uint8 IRQa;
static uint8 prg_reg[2];
static uint8 chr_reg[8];
static uint8 mirr;
static SFORMAT StateRegs[]=
{
{&IRQCount, 1, "IRQC"},
{&IRQa, 1, "IRQA"},
{prg_reg, 2, "PRG"},
{chr_reg, 8, "CHR"},
{&mirr, 1, "MIRR"},
{0}
};
static void M222IRQ(void)
{
if(IRQa)
{
IRQCount++;
if(IRQCount>=238)
{
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]);
setmirror(mirr^1);
}
static DECLFW(M222Write)
{
switch(A&0xF003)
{
case 0x8000: prg_reg[0]=V; break;
case 0x9000: mirr=V&1; 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=16; FCEU_printf("%04x:%02x %d\n",A,V,scanline); break;*/
case 0xF000: IRQa=IRQCount=V; if(scanline<240) IRQCount-=8; else IRQCount+=4; X6502_IRQEnd(FCEU_IQEXT); break;
}
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);
}
-98
View File
@@ -1,98 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2011 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
*
* PCB-018 board, discrete multigame cart 110-in-1
*
*/
#include "mapinc.h"
static uint8 prot[4], prg, mode, chr, mirr;
static SFORMAT StateRegs[]=
{
{prot, 4, "PROT"},
{&prg, 1, "PRG"},
{&chr, 1, "CHR"},
{&mode, 1, "MODE"},
{&mirr, 1, "MIRR"},
{0}
};
static void Sync(void)
{
if(mode)
{
setprg16(0x8000,prg);
setprg16(0xC000,prg);
}
else
setprg32(0x8000,prg>>1);
setchr8(chr);
setmirror(mirr);
}
static DECLFW(M225Write)
{
uint32 bank = (A >> 14) & 1;
mirr = (A >> 13) & 1;
mode = (A >> 12) & 1;
chr = (A & 0x3f) | (bank << 6);
prg = ((A >> 6) & 0x3f) | (bank << 6);
Sync();
}
static DECLFW(M225LoWrite)
{
}
static DECLFR(M225LoRead)
{
}
static void M225Power(void)
{
prg = 0;
mode = 0;
Sync();
SetReadHandler(0x5000,0x5fff,M225LoRead);
SetWriteHandler(0x5000,0x5fff,M225LoWrite);
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x8000,0xFFFF,M225Write);
}
static void M225Reset(void)
{
prg = 0;
mode = 0;
Sync();
}
static void StateRestore(int version)
{
Sync();
}
void Mapper225_Init(CartInfo *info)
{
info->Reset=M225Reset;
info->Power=M225Power;
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
-204
View File
@@ -1,204 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2007 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 is23;
static uint16 IRQCount;
static uint8 IRQLatch,IRQa;
static uint8 prgreg[2];
static uint8 chrreg[8];
static uint8 regcmd, irqcmd, mirr, big_bank;
static uint16 acount=0;
static uint8 *WRAM=NULL;
static uint32 WRAMSIZE;
static SFORMAT StateRegs[]=
{
{prgreg, 2, "PRGREGS"},
{chrreg, 8, "CHRREGS"},
{&regcmd, 1, "REGCMD"},
{&irqcmd, 1, "IRQCMD"},
{&mirr, 1, "MIRR"},
{&big_bank, 1, "MIRR"},
{&IRQCount, 2, "IRQC"},
{&IRQLatch, 1, "IRQL"},
{&IRQa, 1, "IRQA"},
{0}
};
static void Sync(void)
{
if(regcmd&2)
{
setprg8(0xC000,prgreg[0]|big_bank);
setprg8(0x8000,((~1)&0x1F)|big_bank);
}
else
{
setprg8(0x8000,prgreg[0]|big_bank);
setprg8(0xC000,((~1)&0x1F)|big_bank);
}
setprg8(0xA000,prgreg[1]|big_bank);
setprg8(0xE000,((~0)&0x1F)|big_bank);
if(UNIFchrrama)
setchr8(0);
else
{
uint8 i;
for(i=0; i<8; i++)
setchr1(i<<10, chrreg[i]);
}
switch(mirr&0x3)
{
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(M23Write)
{
/* FCEU_printf("%04x:%04x\n",A,V);*/
A|=((A>>2)&0x3)|((A>>4)&0x3)|((A>>6)&0x3); /* actually there is many-in-one mapper source, some pirate or*/
/* licensed games use various address bits for registers*/
A&=0xF003;
if((A>=0xB000)&&(A<=0xE003))
{
if(UNIFchrrama)
big_bank=(V&8)<<2; /* my personally many-in-one feature ;) just for support pirate cart 2-in-1*/
else
{
uint16 i=((A>>1)&1)|((A-0xB000)>>11);
chrreg[i]&=(0xF0)>>((A&1)<<2);
chrreg[i]|=(V&0xF)<<((A&1)<<2);
}
Sync();
}
else
switch(A&0xF003)
{
case 0x8000:
case 0x8001:
case 0x8002:
case 0x8003: if(is23)
prgreg[0]=V&0x1F;
Sync();
break;
case 0xA000:
case 0xA001:
case 0xA002:
case 0xA003: if(is23)
prgreg[1]=V&0x1F;
else
{
prgreg[0]=(V<<1)&0x1F;
prgreg[1]=((V<<1)&0x1F)|1;
}
Sync();
break;
case 0x9000:
case 0x9001: if(V!=0xFF) mirr=V; Sync(); break;
case 0x9002:
case 0x9003: regcmd=V; Sync(); break;
case 0xF000: X6502_IRQEnd(FCEU_IQEXT); IRQLatch&=0xF0; IRQLatch|=V&0xF; break;
case 0xF001: X6502_IRQEnd(FCEU_IQEXT); IRQLatch&=0x0F; IRQLatch|=V<<4; break;
case 0xF002: X6502_IRQEnd(FCEU_IQEXT); acount=0; IRQCount=IRQLatch; IRQa=V&2; irqcmd=V&1; break;
case 0xF003: X6502_IRQEnd(FCEU_IQEXT); IRQa=irqcmd; break;
}
}
static void M23Power(void)
{
big_bank=0x20;
Sync();
setprg8r(0x10,0x6000,0); /* another many-in-one code, WRAM actually contain only WaiWaiWorld game*/
SetReadHandler(0x6000,0x7FFF,CartBR);
SetWriteHandler(0x6000,0x7FFF,CartBW);
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x8000,0xFFFF,M23Write);
}
void M23IRQHook(int a)
{
#define LCYCS 341
if(IRQa)
{
acount+=a*3;
if(acount>=LCYCS)
{
while(acount>=LCYCS)
{
acount-=LCYCS;
IRQCount++;
if(IRQCount&0x100)
{
X6502_IRQBegin(FCEU_IQEXT);
IRQCount=IRQLatch;
}
}
}
}
}
static void StateRestore(int version)
{
Sync();
}
static void M23Close(void)
{
if(WRAM)
free(WRAM);
}
void Mapper23_Init(CartInfo *info)
{
is23=1;
info->Power=M23Power;
info->Close=M23Close;
MapIRQHook=M23IRQHook;
GameStateRestore=StateRestore;
WRAMSIZE=8192;
WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1);
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
AddExState(&StateRegs, ~0, 0, 0);
}
void UNLT230_Init(CartInfo *info)
{
is23=0;
info->Power=M23Power;
info->Close=M23Close;
MapIRQHook=M23IRQHook;
GameStateRestore=StateRestore;
WRAMSIZE=8192;
WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1);
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
AddExState(&StateRegs, ~0, 0, 0);
}
-70
View File
@@ -1,70 +0,0 @@
/* 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);
}
-166
View File
@@ -1,166 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2009 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
*
* TODO: cram disable cases! (Shen Hua Jian Yun III cannot boot with CRAM enabled)
*/
#include "mapinc.h"
static uint8 chrlo[8], chrhi[8], prg[2], mirr;
static int32 IRQa, IRQCount, IRQLatch, IRQClock;
static uint8 *WRAM=NULL;
static uint32 WRAMSIZE;
static uint8 *CHRRAM=NULL;
static uint32 CHRRAMSIZE;
static SFORMAT StateRegs[]=
{
{chrlo, 8, "CHRLO"},
{chrhi, 8, "CHRHI"},
{prg, 2, "PRGR"},
{&mirr, 1, "MIRR"},
{&IRQa, 4, "IRQA"},
{&IRQCount, 4, "IRQC"},
{&IRQLatch, 4, "IRQL"},
{&IRQClock, 4, "IRQCL"},
{0}
};
static void Sync(void)
{
uint8 i;
setprg8r(0x10,0x6000,0);
setprg8(0x8000,prg[0]);
setprg8(0xa000,prg[1]);
setprg8(0xc000,~1);
setprg8(0xe000,~0);
for(i=0; i<8; i++)
{
uint32 chr = chrlo[i]|(chrhi[i]<<8);
if((chr==4)||(chr==5))
setchr1r(0x10,i<<10,chr&1);
else
setchr1(i<<10,chr);
}
switch(mirr)
{
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(M253Write)
{
if((A>=0xB000)&&(A<=0xE00C))
{
uint8 ind=((((A&8)|(A>>8))>>3)+2)&7;
uint8 sar=A&4;
chrlo[ind]=(chrlo[ind]&(0xF0>>sar))|((V&0x0F)<<sar);
if(A&4)
chrhi[ind]=V>>4;
Sync();
}
else
switch(A)
{
case 0x8010: prg[0]=V; Sync(); break;
case 0xA010: prg[1]=V; Sync(); break;
case 0x9400: mirr=V&3; Sync(); break;
case 0xF000: IRQLatch = (IRQLatch & 0xF0) | (V & 0x0F); break;
case 0xF004: IRQLatch = (IRQLatch & 0x0F) | (V << 4); break;
case 0xF008:
IRQa = V&3;
if(IRQa&2)
{
IRQCount = IRQLatch;
IRQClock = 0;
}
X6502_IRQEnd(FCEU_IQEXT);
break;
}
}
static void M253Power(void)
{
Sync();
SetReadHandler(0x6000,0x7FFF,CartBR);
SetWriteHandler(0x6000,0x7FFF,CartBW);
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x8000,0xFFFF,M253Write);
}
static void M253Close(void)
{
if(WRAM)
free(WRAM);
if(CHRRAM)
free(CHRRAM);
WRAM=CHRRAM=NULL;
}
static void M253IRQ(int cycles)
{
if(IRQa&2)
{
if((IRQClock+=cycles)>=0x71)
{
IRQClock -= 0x71;
if(IRQCount==0xFF)
{
IRQCount = IRQLatch;
IRQa = IRQa|((IRQa&1)<<1);
X6502_IRQBegin(FCEU_IQEXT);
}
else
IRQCount++;
}
}
}
static void StateRestore(int version)
{
Sync();
}
void Mapper253_Init(CartInfo *info)
{
info->Power=M253Power;
info->Close=M253Close;
MapIRQHook=M253IRQ;
GameStateRestore=StateRestore;
CHRRAMSIZE=4096;
CHRRAM=(uint8*)FCEU_gmalloc(CHRRAMSIZE);
SetupCartCHRMapping(0x10,CHRRAM,CHRRAMSIZE,1);
AddExState(CHRRAM, CHRRAMSIZE, 0, "CRAM");
WRAMSIZE=8192;
WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1);
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
if(info->battery)
{
info->SaveGame[0]=WRAM;
info->SaveGameLen[0]=WRAMSIZE;
}
AddExState(&StateRegs, ~0, 0, 0);
}
-110
View File
@@ -1,110 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2007 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], IRQa;
static int16 IRQCount, IRQPause;
static int16 Count = 0x0000;
static SFORMAT StateRegs[]=
{
{reg, 4, "REGS"},
{&IRQa, 1, "IRQA"},
{&IRQCount, 2, "IRQC"},
{0}
};
static void Sync(void)
{
setprg32(0x8000,0);
setchr8(0);
}
/*#define Count 0x1800*/
#define Pause 0x010
static DECLFW(UNL3DBlockWrite)
{
switch(A)
{
/*4800 32*/
/*4900 37*/
/*4a00 01*/
/*4e00 18*/
case 0x4800: reg[0]=V; break;
case 0x4900: reg[1]=V; break;
case 0x4a00: reg[2]=V; break;
case 0x4e00: reg[3]=V; IRQCount=Count; IRQPause=Pause; IRQa=1; X6502_IRQEnd(FCEU_IQEXT); break;
}
}
static void UNL3DBlockPower(void)
{
Sync();
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x4800,0x4E00,UNL3DBlockWrite);
}
static void UNL3DBlockReset(void)
{
Count+=0x10;
FCEU_printf("Count=%04x\n",Count);
}
static void UNL3DBlockIRQHook(int a)
{
if(IRQa)
{
if(IRQCount>0)
{
IRQCount-=a;
}
else
{
if(IRQPause>0)
{
IRQPause-=a;
X6502_IRQBegin(FCEU_IQEXT);
}
else
{
IRQCount=Count;
IRQPause=Pause;
X6502_IRQEnd(FCEU_IQEXT);
}
}
}
}
static void StateRestore(int version)
{
Sync();
}
void UNL3DBlock_Init(CartInfo *info)
{
info->Power=UNL3DBlockPower;
info->Reset=UNL3DBlockReset;
MapIRQHook=UNL3DBlockIRQHook;
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
-70
View File
@@ -1,70 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2008 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
*/
/* actually cart ID is 811120-C, sorry ;) K-3094 - another ID*/
#include "mapinc.h"
#include "mmc3.h"
static uint8 reset_flag = 0;
static void BMC411120CCW(uint32 A, uint8 V)
{
setchr1(A,V|((EXPREGS[0]&3)<<7));
}
static void BMC411120CPW(uint32 A, uint8 V)
{
if(EXPREGS[0]&(8|reset_flag))
setprg32(0x8000,((EXPREGS[0]>>4)&3)|(0x0C));
else
setprg8(A,(V&0x0F)|((EXPREGS[0]&3)<<4));
}
static DECLFW(BMC411120CLoWrite)
{
EXPREGS[0] = A;
FixMMC3PRG(MMC3_cmd);
FixMMC3CHR(MMC3_cmd);
}
static void BMC411120CReset(void)
{
EXPREGS[0]=0;
reset_flag ^=4;
MMC3RegReset();
}
static void BMC411120CPower(void)
{
EXPREGS[0] = 0;
GenMMC3Power();
SetWriteHandler(0x6000,0x7FFF,BMC411120CLoWrite);
}
void BMC411120C_Init(CartInfo *info)
{
GenMMC3_Init(info, 128, 128, 8, 0);
pwrap=BMC411120CPW;
cwrap=BMC411120CCW;
info->Power=BMC411120CPower;
info->Reset=BMC411120CReset;
AddExState(EXPREGS, 1, 0, "EXPR");
}
-94
View File
@@ -1,94 +0,0 @@
/* 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
*
* FDS Conversion
*
*/
#include "mapinc.h"
static uint8 reg;
static uint32 IRQCount, IRQa;
static SFORMAT StateRegs[]=
{
{&IRQCount, 4, "IRQC"},
{&IRQa, 1, "IRQA"},
{&reg, 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; X6502_IRQEnd(FCEU_IQEXT); 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 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);
}
-92
View File
@@ -1,92 +0,0 @@
/* 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);
}
-179
View File
@@ -1,179 +0,0 @@
/* 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 chr_reg[4];
static uint8 kogame, prg_reg, nt1, nt2, mirr;
static uint8 *WRAM=NULL;
static uint32 WRAMSIZE, count;
static SFORMAT StateRegs[]=
{
{&nt1, 1, "NT1"},
{&nt2, 1, "NT2"},
{&mirr, 1, "MIRR"},
{&prg_reg, 1, "PRG"},
{&kogame, 1, "KOGAME"},
{&count, 4, "COUNT"},
{chr_reg, 4, "CHR"},
{0}
};
static void M68NTfix(void)
{
if((!UNIFchrrama)&&(mirr&0x10))
{
PPUNTARAM = 0;
switch(mirr&3)
{
case 0: vnapage[0]=vnapage[2]=CHRptr[0]+(((nt1|128)&CHRmask1[0])<<10);
vnapage[1]=vnapage[3]=CHRptr[0]+(((nt2|128)&CHRmask1[0])<<10);
break;
case 1: vnapage[0]=vnapage[1]=CHRptr[0]+(((nt1|128)&CHRmask1[0])<<10);
vnapage[2]=vnapage[3]=CHRptr[0]+(((nt2|128)&CHRmask1[0])<<10);
break;
case 2: vnapage[0]=vnapage[1]=vnapage[2]=vnapage[3]=CHRptr[0]+(((nt1|128)&CHRmask1[0])<<10);
break;
case 3: vnapage[0]=vnapage[1]=vnapage[2]=vnapage[3]=CHRptr[0]+(((nt2|128)&CHRmask1[0])<<10);
break;
}
}
else
switch(mirr&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 Sync(void)
{
setchr2(0x0000,chr_reg[0]);
setchr2(0x0800,chr_reg[1]);
setchr2(0x1000,chr_reg[2]);
setchr2(0x1800,chr_reg[3]);
setprg8r(0x10,0x6000,0);
setprg16r((PRGptr[1])?kogame:0,0x8000,prg_reg);
setprg16(0xC000,~0);
}
static DECLFR(M68Read)
{
if(!(kogame&8))
{
count++;
if(count==1784)
setprg16r(0,0x8000,prg_reg);
}
return CartBR(A);
}
static DECLFW(M68WriteLo)
{
if(!V)
{
count = 0;
setprg16r((PRGptr[1])?kogame:0,0x8000,prg_reg);
}
CartBW(A,V);
}
static DECLFW(M68WriteCHR)
{
chr_reg[(A>>12)&3]=V;
Sync();
}
static DECLFW(M68WriteNT1)
{
nt1 = V;
M68NTfix();
}
static DECLFW(M68WriteNT2)
{
nt2 = V;
M68NTfix();
}
static DECLFW(M68WriteMIR)
{
mirr = V;
M68NTfix();
}
static DECLFW(M68WriteROM)
{
prg_reg = V&7;
kogame = ((V>>3)&1)^1;
Sync();
}
static void M68Power(void)
{
prg_reg = 0;
kogame = 0;
Sync();
M68NTfix();
SetReadHandler(0x6000,0x7FFF,CartBR);
SetReadHandler(0x8000,0xBFFF,M68Read);
SetReadHandler(0xC000,0xFFFF,CartBR);
SetWriteHandler(0x8000,0xBFFF,M68WriteCHR);
SetWriteHandler(0xC000,0xCFFF,M68WriteNT1);
SetWriteHandler(0xD000,0xDFFF,M68WriteNT2);
SetWriteHandler(0xE000,0xEFFF,M68WriteMIR);
SetWriteHandler(0xF000,0xFFFF,M68WriteROM);
SetWriteHandler(0x6000,0x6000,M68WriteLo);
SetWriteHandler(0x6001,0x7FFF,CartBW);
}
static void M68Close(void)
{
if(WRAM)
free(WRAM);
WRAM=NULL;
}
static void StateRestore(int version)
{
Sync();
M68NTfix();
}
void Mapper68_Init(CartInfo *info)
{
info->Power=M68Power;
info->Close=M68Close;
GameStateRestore=StateRestore;
WRAMSIZE=8192;
WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1);
if(info->battery)
{
info->SaveGame[0]=WRAM;
info->SaveGameLen[0]=WRAMSIZE;
}
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
AddExState(&StateRegs, ~0, 0, 0);
}
-81
View File
@@ -1,81 +0,0 @@
/* 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);
}
-206
View File
@@ -1,206 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2011 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
*
* Super Game (Sugar Softec) protected mapper
* Pocahontas 2 (Unl) [U][!], etc.
* TODO: 9in1 LION KING HANGS!
*/
#include "mapinc.h"
#include "mmc3.h"
static uint8 cmdin;
static uint8 regperm[8][8] =
{
{0, 1, 2, 3, 4, 5, 6, 7},
{0, 2, 6, 1, 7, 3, 4, 5},
{0, 5, 4, 1, 7, 2, 6, 3}, /* unused*/
{0, 6, 3, 7, 5, 2, 4, 1},
{0, 2, 5, 3, 6, 1, 7, 4},
{0, 1, 2, 3, 4, 5, 6, 7}, /* empty*/
{0, 1, 2, 3, 4, 5, 6, 7}, /* empty*/
{0, 1, 2, 3, 4, 5, 6, 7}, /* empty*/
};
static uint8 adrperm[8][8] =
{
{0, 1, 2, 3, 4, 5, 6, 7},
{3, 2, 0, 4, 1, 5, 6, 7},
{0, 1, 2, 3, 4, 5, 6, 7}, /* unused*/
{5, 0, 1, 2, 3, 7, 6, 4},
{3, 1, 0, 5, 2, 4, 6, 7},
{0, 1, 2, 3, 4, 5, 6, 7}, /* empty*/
{0, 1, 2, 3, 4, 5, 6, 7}, /* empty*/
{0, 1, 2, 3, 4, 5, 6, 7}, /* empty*/
};
static void UNL8237CW(uint32 A, uint8 V)
{
if(EXPREGS[0]&0x40)
setchr1(A,((EXPREGS[1]&0xc)<<6)|(V&0x7F)|((EXPREGS[1]&0x20)<<2));
else
setchr1(A,((EXPREGS[1]&0xc)<<6)|V);
}
static void UNL8237PW(uint32 A, uint8 V)
{
if(EXPREGS[0]&0x40)
{
uint8 sbank = (EXPREGS[1]&0x10);
if(EXPREGS[0]&0x80)
{
uint8 bank = ((EXPREGS[1]&3)<<4)|(EXPREGS[0]&0x7)|(sbank>>1);
if(EXPREGS[0]&0x20)
setprg32(0x8000,bank>>1);
else
{
setprg16(0x8000,bank);
setprg16(0xC000,bank);
}
}
else
setprg8(A,((EXPREGS[1]&3)<<5)|(V&0x0F)|sbank);
}
else
{
if(EXPREGS[0]&0x80)
{
uint8 bank = ((EXPREGS[1]&3)<<4)|(EXPREGS[0]&0xF);
if(EXPREGS[0]&0x20)
setprg32(0x8000,bank>>1);
else
{
setprg16(0x8000,bank);
setprg16(0xC000,bank);
}
}
else
setprg8(A,((EXPREGS[1]&3)<<5)|(V&0x1F));
}
}
static void UNL8237ACW(uint32 A, uint8 V)
{
if(EXPREGS[0]&0x40)
setchr1(A,((EXPREGS[1]&0xE)<<7)|(V&0x7F)|((EXPREGS[1]&0x20)<<2));
else
setchr1(A,((EXPREGS[1]&0xE)<<7)|V);
}
static void UNL8237APW(uint32 A, uint8 V)
{
if(EXPREGS[0]&0x40)
{
uint8 sbank = (EXPREGS[1]&0x10);
if(EXPREGS[0]&0x80)
{
uint8 bank = ((EXPREGS[1]&3)<<4)|((EXPREGS[1]&8)<<3)|(EXPREGS[0]&0x7)|(sbank>>1);
if(EXPREGS[0]&0x20) {
/* FCEU_printf("8000:%02X\n",bank>>1);*/
setprg32(0x8000,bank>>1);
}
else
{
/* FCEU_printf("8000-C000:%02X\n",bank);*/
setprg16(0x8000,bank);
setprg16(0xC000,bank);
}
}
else {
/* FCEU_printf("%04x:%02X\n",A,((EXPREGS[1]&3)<<5)|((EXPREGS[1]&8)<<4)|(V&0x0F)|sbank);*/
setprg8(A,((EXPREGS[1]&3)<<5)|((EXPREGS[1]&8)<<4)|(V&0x0F)|sbank);
}
}
else
{
if(EXPREGS[0]&0x80)
{
uint8 bank = ((EXPREGS[1]&3)<<4)|((EXPREGS[1]&8)<<3)|(EXPREGS[0]&0xF);
if(EXPREGS[0]&0x20) {
/* FCEU_printf("8000:%02X\n",(bank>>1)&0x07);*/
setprg32(0x8000,bank>>1);
}
else
{
/* FCEU_printf("8000-C000:%02X\n",bank&0x0F);*/
setprg16(0x8000,bank);
setprg16(0xC000,bank);
}
}
else {
/* FCEU_printf("%04X:%02X\n",A,(((EXPREGS[1]&3)<<5)|((EXPREGS[1]&8)<<4)|(V&0x1F))&0x1F);*/
setprg8(A,((EXPREGS[1]&3)<<5)|((EXPREGS[1]&8)<<4)|(V&0x1F));
}
}
}
static DECLFW(UNL8237Write)
{
uint8 dat = V;
uint8 adr = adrperm[EXPREGS[2]][((A>>12)&6)|(A&1)];
uint16 addr = (adr & 1)|((adr & 6)<<12)|0x8000;
if(adr < 4)
{
if(!adr)
dat = (dat & 0xC0)|(regperm[EXPREGS[2]][dat & 7]);
MMC3_CMDWrite(addr,dat);
}
else
MMC3_IRQWrite(addr,dat);
}
static DECLFW(UNL8237ExWrite)
{
switch(A)
{
case 0x5000: EXPREGS[0]=V; FixMMC3PRG(MMC3_cmd); break;
case 0x5001: EXPREGS[1]=V; FixMMC3PRG(MMC3_cmd); FixMMC3CHR(MMC3_cmd); break;
case 0x5007: EXPREGS[2]=V; break;
}
}
static void UNL8237Power(void)
{
EXPREGS[0]=EXPREGS[2]=0;
EXPREGS[1]=3;
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");
}
void UNL8237A_Init(CartInfo *info)
{
GenMMC3_Init(info, 256, 256, 0, 0);
cwrap=UNL8237ACW;
pwrap=UNL8237APW;
info->Power=UNL8237Power;
AddExState(EXPREGS, 3, 0, "EXPR");
AddExState(&cmdin, 1, 0, "CMDIN");
}
-80
View File
@@ -1,80 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2008 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
*/
/* M-022 MMC3 based 830118C T-106 4M + 4M*/
#include "mapinc.h"
#include "mmc3.h"
static void BMC830118CCW(uint32 A, uint8 V)
{
setchr1(A,(V&0x7F)|((EXPREGS[0]&0x0c)<<5));
}
static void BMC830118CPW(uint32 A, uint8 V)
{
if((EXPREGS[0]&0x0C)==0x0C)
{
if(A==0x8000)
{
setprg8(A,(V&0x0F)|((EXPREGS[0]&0x0c)<<2));
setprg8(0xC000,(V&0x0F)|0x32);
}
else if(A==0xA000)
{
setprg8(A,(V&0x0F)|((EXPREGS[0]&0x0c)<<2));
setprg8(0xE000,(V&0x0F)|0x32);
}
}
else
{
setprg8(A,(V&0x0F)|((EXPREGS[0]&0x0c)<<2));
}
}
static DECLFW(BMC830118CLoWrite)
{
EXPREGS[0] = V;
FixMMC3PRG(MMC3_cmd);
FixMMC3CHR(MMC3_cmd);
}
static void BMC830118CReset(void)
{
EXPREGS[0]=0;
MMC3RegReset();
}
static void BMC830118CPower(void)
{
EXPREGS[0] = 0;
GenMMC3Power();
SetWriteHandler(0x6800,0x68FF,BMC830118CLoWrite);
}
void BMC830118C_Init(CartInfo *info)
{
GenMMC3_Init(info, 128, 128, 8, 0);
pwrap=BMC830118CPW;
cwrap=BMC830118CCW;
info->Power=BMC830118CPower;
info->Reset=BMC830118CReset;
AddExState(EXPREGS, 1, 0, "EXPR");
}
-87
View File
@@ -1,87 +0,0 @@
/* 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);
}
-124
View File
@@ -1,124 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
static uint8 lastA;
static uint8 DRegs[8];
static uint8 cmd;
static uint8 MirCache[8];
static SFORMAT DB_StateRegs[]={
{DRegs, 8, "DREG"},
{&cmd, 1, "CMD"},
{&lastA, 1, "LAST"},
{0}
};
static void 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 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;
}
-94
View File
@@ -1,94 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2007 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
*
* FDS Conversion
*
*/
#include "mapinc.h"
static uint8 reg;
static uint8 *WRAM=NULL;
static uint32 WRAMSIZE;
static SFORMAT StateRegs[]=
{
{&reg, 1, "REGS"},
{0}
};
static void Sync(void)
{
setprg8r(0x10,0x6000,0);
setprg32(0x8000,reg&1);
setchr8(0);
}
static DECLFW(UNLKS7012Write)
{
/* FCEU_printf("bs %04x %02x\n",A,V);*/
switch(A)
{
case 0xE0A0: reg=0; Sync(); break;
case 0xEE36: reg=1; Sync(); break;
}
}
static void UNLKS7012Power(void)
{
reg = ~0;
Sync();
SetReadHandler(0x6000,0x7FFF,CartBR);
SetWriteHandler(0x6000,0x7FFF,CartBW);
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x8000,0xFFFF,UNLKS7012Write);
}
static void UNLKS7012Reset(void)
{
reg = ~0;
Sync();
}
static void StateRestore(int version)
{
Sync();
}
static void UNLKS7012Close(void)
{
if(WRAM)
free(WRAM);
WRAM=NULL;
}
void UNLKS7012_Init(CartInfo *info)
{
info->Power=UNLKS7012Power;
info->Reset=UNLKS7012Reset;
info->Close=UNLKS7012Close;
WRAMSIZE=8192;
WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1);
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
-84
View File
@@ -1,84 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2011 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
*
* Just another pirate cart with pirate mapper, instead of original MMC1
* Kaiser Highway Star
*
*/
#include "mapinc.h"
static uint8 reg, mirr;
static SFORMAT StateRegs[]=
{
{&reg, 1, "REGS"},
{&mirr, 1, "MIRR"},
{0}
};
static void Sync(void)
{
setprg16(0x8000,reg);
setprg16(0xc000,~0);
setmirror(mirr);
setchr8(0);
}
static DECLFW(UNLKS7013BLoWrite)
{
reg = V;
Sync();
}
static DECLFW(UNLKS7013BHiWrite)
{
mirr = (V & 1) ^ 1;
Sync();
}
static void UNLKS7013BPower(void)
{
reg = 0;
mirr = 0;
Sync();
SetWriteHandler(0x6000,0x7FFF,UNLKS7013BLoWrite);
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x8000,0xFFFF,UNLKS7013BHiWrite);
}
static void UNLKS7013BReset(void)
{
reg = 0;
Sync();
}
static void StateRestore(int version)
{
Sync();
}
void UNLKS7013B_Init(CartInfo *info)
{
info->Power=UNLKS7013BPower;
info->Reset=UNLKS7013BReset;
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
-134
View File
@@ -1,134 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2007 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
*
* FDS Conversion
*
*/
#include "mapinc.h"
static uint8 reg, mirr;
static int32 IRQa, IRQCount, IRQLatch;
static uint8 *WRAM=NULL;
static uint32 WRAMSIZE;
static SFORMAT StateRegs[]=
{
{&mirr, 1, "MIRR"},
{&reg, 1, "REGS"},
{&IRQa, 4, "IRQA"},
{&IRQCount, 4, "IRQC"},
{&IRQLatch, 4, "IRQL"},
{0}
};
static void Sync(void)
{
setprg16(0x8000,reg);
setprg16(0xC000,2);
setmirror(mirr);
}
static DECLFW(UNLKS7017Write)
{
/* FCEU_printf("bs %04x %02x\n",A,V);*/
if((A & 0xFF00) == 0x4A00)
{
reg = ((A >> 2) & 3)|((A >> 4) & 4);
}
else if ((A & 0xFF00) == 0x5100)
{
Sync();
}
else if (A == 0x4020)
{
X6502_IRQEnd(FCEU_IQEXT);
IRQCount&=0xFF00;
IRQCount|=V;
}
else if (A == 0x4021)
{
X6502_IRQEnd(FCEU_IQEXT);
IRQCount&=0xFF;
IRQCount|=V<<8;
IRQa = 1;
}
else if (A == 0x4025)
{
mirr = ((V & 8) >> 3) ^ 1;
}
}
static DECLFR(FDSRead4030)
{
X6502_IRQEnd(FCEU_IQEXT);
return X.IRQlow&FCEU_IQEXT?1:0;
}
static void UNL7017IRQ(int a)
{
if(IRQa)
{
IRQCount-=a;
if(IRQCount<=0)
{
IRQa=0;
X6502_IRQBegin(FCEU_IQEXT);
}
}
}
static void UNLKS7017Power(void)
{
Sync();
setchr8(0);
setprg8r(0x10,0x6000,0);
SetReadHandler(0x6000,0x7FFF,CartBR);
SetWriteHandler(0x6000,0x7FFF,CartBW);
SetReadHandler(0x8000,0xFFFF,CartBR);
SetReadHandler(0x4030,0x4030,FDSRead4030);
SetWriteHandler(0x4020,0x5FFF,UNLKS7017Write);
}
static void UNLKS7017Close(void)
{
if(WRAM)
free(WRAM);
WRAM=NULL;
}
static void StateRestore(int version)
{
Sync();
}
void UNLKS7017_Init(CartInfo *info)
{
info->Power=UNLKS7017Power;
info->Close=UNLKS7017Close;
MapIRQHook=UNL7017IRQ;
WRAMSIZE=8192;
WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1);
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
-97
View File
@@ -1,97 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2007 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
*
* FDS Conversion
*
*/
#include "mapinc.h"
static uint8 reg[8], cmd, IRQa = 0, isirqused = 0;
static int32 IRQCount;
static SFORMAT StateRegs[]=
{
{&cmd, 1, "CMD"},
{reg, 8, "REGS"},
{&IRQa, 1, "IRQA"},
{&IRQCount, 4, "IRQC"},
{0}
};
static void Sync(void)
{
setprg8(0x6000,reg[4]);
setprg8(0x8000,reg[1]);
setprg8(0xA000,reg[2]);
setprg8(0xC000,reg[3]);
setprg8(0xE000,~0);
setchr8(0);
}
static DECLFW(UNLKS7032Write)
{
/* FCEU_printf("bs %04x %02x\n",A,V);*/
switch(A&0xF000)
{
/* case 0x8FFF: reg[4]=V; Sync(); break;*/
case 0x8000: X6502_IRQEnd(FCEU_IQEXT); IRQCount=(IRQCount&0x000F)|(V&0x0F); isirqused = 1; break;
case 0x9000: X6502_IRQEnd(FCEU_IQEXT); IRQCount=(IRQCount&0x00F0)|((V&0x0F)<<4); isirqused = 1; break;
case 0xA000: X6502_IRQEnd(FCEU_IQEXT); IRQCount=(IRQCount&0x0F00)|((V&0x0F)<<8); isirqused = 1; break;
case 0xB000: X6502_IRQEnd(FCEU_IQEXT); IRQCount=(IRQCount&0xF000)|(V<<12); isirqused = 1; break;
case 0xC000: if(isirqused) { X6502_IRQEnd(FCEU_IQEXT); IRQa=1; } break;
case 0xE000: cmd=V&7; break;
case 0xF000: reg[cmd]=V; Sync(); break;
}
}
static void UNLSMB2JIRQHook(int a)
{
if(IRQa)
{
IRQCount+=a;
if(IRQCount>=0xFFFF)
{
IRQa=0;
IRQCount=0;
X6502_IRQBegin(FCEU_IQEXT);
}
}
}
static void UNLKS7032Power(void)
{
Sync();
SetReadHandler(0x6000,0x7FFF,CartBR);
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x4020,0xFFFF,UNLKS7032Write);
}
static void StateRestore(int version)
{
Sync();
}
void UNLKS7032_Init(CartInfo *info)
{
info->Power=UNLKS7032Power;
MapIRQHook=UNLSMB2JIRQHook;
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
-135
View File
@@ -1,135 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2011 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
*
* FDS Conversion
*
*/
#include "mapinc.h"
static uint8 reg[8], cmd;
static uint8 *WRAM=NULL;
static uint32 WRAMSIZE;
static void(*WSync)(void);
static SFORMAT StateRegs[]=
{
{&cmd, 1, "CMD"},
{reg, 8, "REGS"},
{0}
};
static void SyncKS7037(void)
{
setprg4r(0x10,0x6000,0);
setprg4(0x7000,15);
setprg8(0x8000,reg[6]);
setprg4(0xA000,~3);
setprg4r(0x10,0xB000,1);
setprg8(0xC000,reg[7]);
setprg8(0xE000,~0);
setchr8(0);
setmirrorw(reg[2]&1,reg[4]&1,reg[3]&1,reg[5]&1);
}
static void SyncLH10(void)
{
setprg8(0x6000,~1);
setprg8(0x8000,reg[6]);
setprg8(0xA000,reg[7]);
setprg8r(0x10,0xC000,0);
setprg8(0xE000,~0);
setchr8(0);
setmirror(0);
}
static DECLFW(UNLKS7037Write)
{
switch(A & 0xE001)
{
case 0x8000: cmd = V & 7; break;
case 0x8001: reg[cmd] = V; WSync(); break;
}
}
static void UNLKS7037Power(void)
{
reg[0]=reg[1]=reg[2]=reg[3]=reg[4]=reg[5]=reg[6]=reg[7]=0;
WSync();
SetReadHandler(0x6000,0xFFFF,CartBR);
SetWriteHandler(0x6000,0x7FFF,CartBW);
SetWriteHandler(0x8000,0x9FFF,UNLKS7037Write);
SetWriteHandler(0xA000,0xBFFF,CartBW);
SetWriteHandler(0xC000,0xFFFF,UNLKS7037Write);
}
static void LH10Power(void)
{
reg[0]=reg[1]=reg[2]=reg[3]=reg[4]=reg[5]=reg[6]=reg[7]=0;
WSync();
SetReadHandler(0x6000,0xFFFF,CartBR);
SetWriteHandler(0x8000,0xBFFF,UNLKS7037Write);
SetWriteHandler(0xC000,0xDFFF,CartBW);
SetWriteHandler(0xE000,0xFFFF,UNLKS7037Write);
}
static void Close(void)
{
if(WRAM)
free(WRAM);
WRAM=NULL;
}
static void StateRestore(int version)
{
WSync();
}
void UNLKS7037_Init(CartInfo *info)
{
info->Power=UNLKS7037Power;
info->Close=Close;
WSync = SyncKS7037;
WRAMSIZE=8192;
WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1);
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
void LH10_Init(CartInfo *info)
{
info->Power=LH10Power;
info->Close=Close;
WSync = SyncLH10;
WRAMSIZE=8192;
WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1);
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
-104
View File
@@ -1,104 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2011 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
*
* FDS Conversion
*
*/
#include "mapinc.h"
static uint8 reg[16], reset0 = 0, reset1 = 0;
static SFORMAT StateRegs[]=
{
{reg, 16, "PRG"},
{0}
};
static void Sync(void)
{
setprg2(0x6000,reg[4]); /* A.0, 9.1, 9.2*/
setprg2(0x6800,reg[5]); /* 8.0, 9.3*/
setprg2(0x7000,reg[6]); /* 8.1*/
setprg2(0x7800,reg[7]); /* 8.2*/
setprg2(0x8000,reg[0]); /* 8.3*/
setprg2(0x8800,reg[1]); /* 9.0*/
setprg2(0x9000,reg[2]); /* C.2, 3.2, 7.3*/
setprg2(0x9800,reg[3]); /* C.3*/
setprg2(0xA000,0x34); /* D.0*/
setprg2(0xA800,0x35); /* D.1*/
setprg2(0xB000,0x36); /* D.2*/
setprg2(0xB800,0x37); /* D.3*/
setprg2(0xC000,0x28); /* WTF?*/
setprg2(0xC800,0x29); /* A.1*/
setprg2(0xD000,0x2A); /* A.2*/
setprg2(0xD800,0x2B); /* A.3*/
setprg2(0xE000,0x2C); /* B.0*/
setprg2(0xE800,0x2D); /* B.1*/
setprg2(0xF000,0x2E); /* B.2*/
setprg2(0xF800,0x2F); /* B.3*/
setchr8(0);
setmirror(MI_V);
}
static DECLFW(UNLKS7057Write)
{
/* FCEU_printf("%04X:%02X\n",A,V);*/
switch(A) {
case 0x9000: reg[16] = V; Sync(); break;
case 0xB000: reg[0] = (reg[0] & 0xF0) | (V & 0x0F); Sync(); break;
case 0xB001: reg[0] = (reg[0] & 0x0F) | (V << 4); Sync(); break;
case 0xB002: reg[1] = (reg[1] & 0xF0) | (V & 0x0F); Sync(); break;
case 0xB003: reg[1] = (reg[1] & 0x0F) | (V << 4); Sync(); break;
case 0xC000: reg[2] = (reg[2] & 0xF0) | (V & 0x0F); Sync(); break;
case 0xC001: reg[2] = (reg[2] & 0x0F) | (V << 4); Sync(); break;
case 0xC002: reg[3] = (reg[3] & 0xF0) | (V & 0x0F); Sync(); break;
case 0xC003: reg[3] = (reg[3] & 0x0F) | (V << 4); Sync(); break;
case 0xD000: reg[4] = (reg[4] & 0xF0) | (V & 0x0F); Sync(); break;
case 0xD001: reg[4] = (reg[4] & 0x0F) | (V << 4); Sync(); break;
case 0xD002: reg[5] = (reg[5] & 0xF0) | (V & 0x0F); Sync(); break;
case 0xD003: reg[5] = (reg[5] & 0x0F) | (V << 4); Sync(); break;
case 0xE000: reg[6] = (reg[6] & 0xF0) | (V & 0x0F); Sync(); break;
case 0xE001: reg[6] = (reg[6] & 0x0F) | (V << 4); Sync(); break;
case 0xE002: reg[7] = (reg[7] & 0xF0) | (V & 0x0F); Sync(); break;
case 0xE003: reg[7] = (reg[7] & 0x0F) | (V << 4); Sync(); break;
}
}
static void UNLKS7057Power(void)
{
reset1++;
FCEU_printf("reset1 %02x\n",reset1);
Sync();
SetReadHandler(0x6000,0xFFFF,CartBR);
SetWriteHandler(0x8000,0xFFFF,UNLKS7057Write);
}
static void UNLKS7057Reset(void)
{
reset0++;
FCEU_printf("reset0 %02x\n",reset0);
Sync();
}
void UNLKS7057_Init(CartInfo *info)
{
info->Power=UNLKS7057Power;
info->Reset=UNLKS7057Reset;
AddExState(&StateRegs, ~0, 0, 0);
}
-124
View File
@@ -1,124 +0,0 @@
#include "__serial.h"
HANDLE SerialPort = NULL; // Handle of SerialPort itself.
BOOL SerialOpen(int port, int baud)
{
HANDLE Comport;
DCB myDCB;
COMMTIMEOUTS CTout;
char str[100];
if (port > 9)
sprintf(str, "\\\\.\\COM%d", port);
else
sprintf(str, "COM%d", port);
// Open the serial port
if ((Comport = CreateFile(str, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL)) == INVALID_HANDLE_VALUE)
return FALSE;
// Configure Serial port (Setup Comm)
// Buffer sizes
if (!SetupComm(Comport, 128, 128))
return FALSE;
// Setup DCB using current values
if (!GetCommState(Comport, &myDCB))
return FALSE;
myDCB.fInX = FALSE; // Turn off xon/xoff handler
myDCB.fOutX = FALSE;
myDCB.fOutxDsrFlow = FALSE;
myDCB.fOutxCtsFlow = FALSE; // no hardware flow control.
myDCB.BaudRate = baud;
myDCB.DCBlength = sizeof(DCB);
myDCB.fBinary = 1;
myDCB.fParity = 0;
myDCB.fDtrControl = DTR_CONTROL_DISABLE;
myDCB.fDsrSensitivity = 0;
myDCB.fTXContinueOnXoff = 1;
myDCB.fNull = 0;
myDCB.fRtsControl = RTS_CONTROL_DISABLE;
myDCB.fDummy2 = 0;
myDCB.wReserved = 0;
myDCB.Parity = NOPARITY;
myDCB.StopBits = ONESTOPBIT;
myDCB.wReserved1 = 0;
myDCB.ByteSize = 8;
if (!SetCommState(Comport, &myDCB))
return FALSE;
// Set timeouts
CTout.ReadIntervalTimeout = 0xffffffff;
CTout.ReadTotalTimeoutMultiplier = 0;
CTout.ReadTotalTimeoutConstant = 0;
CTout.WriteTotalTimeoutMultiplier = 0;
CTout.WriteTotalTimeoutConstant = 5000; // don't hang if CTS is locked, for example
SetCommTimeouts(Comport, &CTout);
EscapeCommFunction(Comport, SETDTR);
PurgeComm(Comport, PURGE_TXCLEAR | PURGE_RXCLEAR);
SerialPort = Comport;
return TRUE;
}
void SerialClose(void)
{
if (SerialPort == NULL) return;
PurgeComm(SerialPort, PURGE_TXCLEAR | PURGE_RXCLEAR);
CloseHandle(SerialPort);
SerialPort = NULL;
}
BOOL SerialSendChar(int c)
{
DWORD cr;
if(WriteFile(SerialPort, &c, 1, (LPDWORD)&cr, NULL) && cr)
return TRUE;
else
return FALSE;
}
int SerialIsOpen(void)
{
return (SerialPort != NULL);
}
int SerialGetChar(void)
{
uint8 ch;
DWORD cr;
if (SerialPort != NULL) {
if (ReadFile(SerialPort, &ch, 1, (LPDWORD)&cr, NULL) && cr)
return (int)ch;
}
return EOF;
}
void SendCmd(uint8 *cmd, int size)
{
int i;
for(i=0; i<size; i++) {
SerialSendChar(cmd[i]);
}
}
int ReadResp(uint8 *resp, int size)
{
int i = 0, sum = 0, data;
while(i < size) {
while ((data = SerialGetChar()) == EOF) {}
resp[i] = data & 0xff;
sum += (data & 0xff);
i++;
}
return sum;
}
-20
View File
@@ -1,20 +0,0 @@
#ifndef __SERIAL_H
#define __SERIAL_H
#include <stdio.h>
#include "../types.h"
void SendCmd(uint8 *cmd, int size);
int ReadResp(uint8 *resp, int size);
#define SEND(cmd) SendCmd((uint8 *)&cmd[0], sizeof(cmd))
#define GET(buf, size) ReadResp((uint8 *)&buf, size)
#define SENDGET(cmd, buf, size) SEND(cmd); GET(buf, size)
BOOL SerialOpen(int port, int baud);
void SerialClose(void);
BOOL SerialSendChar(int c);
int SerialIsOpen(void);
int SerialGetChar(void);
#endif
-80
View File
@@ -1,80 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2007 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 DECLFW(UNLA9746Write)
{
/* FCEU_printf("write raw %04x:%02x\n",A,V);*/
switch (A&0xE003)
{
case 0x8000: EXPREGS[1]=V; EXPREGS[0]=0; break;
case 0x8002: EXPREGS[0]=V; EXPREGS[1]=0; break;
case 0x8001: {
uint8 bits_rev = ((V&0x20)>>5)|((V&0x10)>>3)|((V&0x08)>>1)|((V&0x04)<<1);
switch(EXPREGS[0])
{
case 0x26: setprg8(0x8000, bits_rev); break;
case 0x25: setprg8(0xA000, bits_rev); break;
case 0x24: setprg8(0xC000, bits_rev); break;
case 0x23: setprg8(0xE000, bits_rev); break;
}
switch(EXPREGS[1])
{
case 0x0a:
case 0x08: EXPREGS[2] = (V << 4); break;
case 0x09: setchr1(0x0000, EXPREGS[2]|(V >> 1)); break;
case 0x0b: setchr1(0x0400, EXPREGS[2]|(V >> 1)|1); break;
case 0x0c:
case 0x0e: EXPREGS[2] = (V << 4); break;
case 0x0d: setchr1(0x0800, EXPREGS[2]|(V >> 1)); break;
case 0x0f: setchr1(0x0c00, EXPREGS[2]|(V >> 1)|1); break;
case 0x10:
case 0x12: EXPREGS[2] = (V << 4); break;
case 0x11: setchr1(0x1000, EXPREGS[2]|(V >> 1)); break;
case 0x14:
case 0x16: EXPREGS[2] = (V << 4); break;
case 0x15: setchr1(0x1400, EXPREGS[2]|(V >> 1)); break;
case 0x18:
case 0x1a: EXPREGS[2] = (V << 4); break;
case 0x19: setchr1(0x1800, EXPREGS[2]|(V >> 1)); break;
case 0x1c:
case 0x1e: EXPREGS[2] = (V << 4); break;
case 0x1d: setchr1(0x1c00, EXPREGS[2]|(V >> 1)); break;
}
}
break;
}
}
static void UNLA9746Power(void)
{
GenMMC3Power();
SetWriteHandler(0x8000,0xbfff,UNLA9746Write);
}
void UNLA9746_Init(CartInfo *info)
{
GenMMC3_Init(info, 128, 256, 0, 0);
info->Power=UNLA9746Power;
AddExState(EXPREGS, 6, 0, "EXPR");
}
-74
View File
@@ -1,74 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2011 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
*
* FDS Conversion
*
*/
#include "mapinc.h"
static uint8 reg, mirr;
static SFORMAT StateRegs[]=
{
{&reg, 1, "REG"},
{&mirr, 1, "MIRR"},
{0}
};
static void Sync(void)
{
setprg8(0x6000, reg);
setprg32r(1, 0x8000, 0);
setchr8(0);
setmirror(mirr);
}
static DECLFW(AC08Mirr)
{
mirr = ((V&8)>>3)^1;
Sync();
}
static DECLFW(AC08Write)
{
reg = V & 15;
Sync();
}
static void AC08Power(void)
{
reg = 0;
Sync();
SetReadHandler(0x6000,0xFFFF,CartBR);
SetWriteHandler(0x4025,0x4025,AC08Mirr);
SetWriteHandler(0x8000,0xFFFF,AC08Write);
}
static void StateRestore(int version)
{
Sync();
}
void AC08_Init(CartInfo *info)
{
info->Power=AC08Power;
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
-253
View File
@@ -1,253 +0,0 @@
/* 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 LatchReset(void)
{
latche=latcheinit;
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;
info->Reset=LatchReset;
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");
}
/*------------------ UNL43272 ---------------------------*/
/* mapper much complex, including 16K bankswitching */
static void UNL43272Sync(void)
{
if((latche&0x81) == 0x81)
{
setprg32(0x8000,(latche&0x38)>>3);
}
else
FCEU_printf("unrecognized command %04!\n",latche);
setchr8(0);
setmirror(0);
}
static DECLFR(UNL43272Read)
{
if(latche&0x400)
return CartBR(A & 0xFE);
else
return CartBR(A);
}
static void UNL43272Reset(void)
{
latche = 0;
UNL43272Sync();
}
void UNL43272_Init(CartInfo *info)
{
Latch_Init(info, UNL43272Sync, UNL43272Read, 0x81, 0x8000, 0xFFFF);
info->Reset=UNL43272Reset;
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);
}
/*------------------ 190in1 ---------------------------*/
static void BMC190in1Sync(void)
{
setprg16(0x8000,(latche>>2)&0x07);
setprg16(0xC000,(latche>>2)&0x07);
setchr8((latche>>2)&0x07);
setmirror((latche&1)^1);
}
void BMC190in1_Init(CartInfo *info)
{
Latch_Init(info, BMC190in1Sync, 0, 0, 0x8000, 0xFFFF);
}
/*-------------- BMC810544-C-A1 ------------------------*/
static void BMC810544CA1Sync(void)
{
uint32 bank = latche>>7;
if(latche&0x40)
setprg32(0x8000,bank);
else
{
setprg16(0x8000,(bank<<1)|((latche>>5)&1));
setprg16(0xC000,(bank<<1)|((latche>>5)&1));
}
setchr8(latche&0x0f);
setmirror(((latche>>4)&1)^1);
}
void BMC810544CA1_Init(CartInfo *info)
{
Latch_Init(info, BMC810544CA1Sync, 0, 0, 0x8000, 0xFFFF);
}
/*-------------- BMCNTD-03 ------------------------*/
static void BMCNTD03Sync(void)
{
/* 1PPP Pmcc spxx xccc*/
/* 1000 0000 0000 0000 v*/
/* 1001 1100 0000 0100 h*/
/* 1011 1010 1100 0100*/
uint32 prg = ((latche>>10)&0x1e);
uint32 chr = ((latche&0x0300)>>5)|(latche&7);
if(latche&0x80)
{
setprg16(0x8000,prg|((latche>>6)&1));
setprg16(0xC000,prg|((latche>>6)&1));
}
else
setprg32(0x8000,prg>>1);
setchr8(chr);
setmirror(((latche>>10)&1)^1);
}
void BMCNTD03_Init(CartInfo *info)
{
Latch_Init(info, BMCNTD03Sync, 0, 0, 0x8000, 0xFFFF);
}
-107
View File
@@ -1,107 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2007 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
*
* Super Bros. Pocker Mali (VRC4 mapper)
*/
#include "mapinc.h"
static uint8 IRQCount;/*, IRQPre;*/
static uint8 IRQa;
static uint8 prg_reg[2];
static uint8 chr_reg[8];
static uint8 mirr;
static SFORMAT StateRegs[]=
{
{&IRQCount, 1, "IRQC"},
{&IRQa, 1, "IRQA"},
{prg_reg, 2, "PRG"},
{chr_reg, 8, "CHR"},
{&mirr, 1, "MIRR"},
{0}
};
static void Sync(void)
{
int i;
setprg8(0x8000,prg_reg[0]);
setprg8(0xA000,prg_reg[1]);
setprg8(0xC000,~1);
setprg8(0xE000,~0);
for(i=0; i<8; i++)
setchr1(i<<10,chr_reg[i]);
setmirror(mirr^1);
}
static DECLFW(UNLAX5705Write)
{
/* if((A>=0xA008)&&(A<=0xE003))*/
/* {*/
/* int ind=(((A>>11)-6)|(A&1))&7;*/
/* int sar=((A&2)<<1);*/
/* chr_reg[ind]=(chr_reg[ind]&(0xF0>>sar))|((V&0x0F)<<sar);*/
/* SyncChr();*/
/* }*/
/* else */
switch(A&0xF00F)
{
case 0x8000: prg_reg[0]=((V&2)<<2)|((V&8)>>2)|(V&5); break; /* EPROM dump have mixed PRG and CHR banks, data lines to mapper seems to be mixed*/
case 0x8008: mirr=V&1; break;
case 0xA000: prg_reg[1]=((V&2)<<2)|((V&8)>>2)|(V&5); break;
case 0xA008: chr_reg[0]=(chr_reg[0]&0xF0)|(V&0x0F); break;
case 0xA009: chr_reg[0]=(chr_reg[0]&0x0F)|((((V&4)>>1)|((V&2)<<1)|(V&0x09))<<4); break;
case 0xA00A: chr_reg[1]=(chr_reg[1]&0xF0)|(V&0x0F); break;
case 0xA00B: chr_reg[1]=(chr_reg[1]&0x0F)|((((V&4)>>1)|((V&2)<<1)|(V&0x09))<<4); break;
case 0xC000: chr_reg[2]=(chr_reg[2]&0xF0)|(V&0x0F); break;
case 0xC001: chr_reg[2]=(chr_reg[2]&0x0F)|((((V&4)>>1)|((V&2)<<1)|(V&0x09))<<4); break;
case 0xC002: chr_reg[3]=(chr_reg[3]&0xF0)|(V&0x0F); break;
case 0xC003: chr_reg[3]=(chr_reg[3]&0x0F)|((((V&4)>>1)|((V&2)<<1)|(V&0x09))<<4); break;
case 0xC008: chr_reg[4]=(chr_reg[4]&0xF0)|(V&0x0F); break;
case 0xC009: chr_reg[4]=(chr_reg[4]&0x0F)|((((V&4)>>1)|((V&2)<<1)|(V&0x09))<<4); break;
case 0xC00A: chr_reg[5]=(chr_reg[5]&0xF0)|(V&0x0F); break;
case 0xC00B: chr_reg[5]=(chr_reg[5]&0x0F)|((((V&4)>>1)|((V&2)<<1)|(V&0x09))<<4); break;
case 0xE000: chr_reg[6]=(chr_reg[6]&0xF0)|(V&0x0F); break;
case 0xE001: chr_reg[6]=(chr_reg[6]&0x0F)|((((V&4)>>1)|((V&2)<<1)|(V&0x09))<<4); break;
case 0xE002: chr_reg[7]=(chr_reg[7]&0xF0)|(V&0x0F); break;
case 0xE003: chr_reg[7]=(chr_reg[7]&0x0F)|((((V&4)>>1)|((V&2)<<1)|(V&0x09))<<4); break;
}
Sync();
}
static void UNLAX5705Power(void)
{
Sync();
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x8000,0xFFFF,UNLAX5705Write);
}
static void StateRestore(int version)
{
Sync();
}
void UNLAX5705_Init(CartInfo *info)
{
info->Power=UNLAX5705Power;
/* GameHBIRQHook=UNLAX5705IRQ;*/
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
-171
View File
@@ -1,171 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2007 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
*
* Bandai mappers
*
*/
#include "mapinc.h"
static uint8 reg[16], is153;
static uint8 IRQa;
static int16 IRQCount, IRQLatch;
static uint8 *WRAM=NULL;
static uint32 WRAMSIZE;
static SFORMAT StateRegs[]=
{
{reg, 16, "REGS"},
{&IRQa, 1, "IRQA"},
{&IRQCount, 2, "IRQC"},
{&IRQLatch, 2, "IRQL"}, /* need for Famicom Jump II - Saikyou no 7 Nin (J) [!]*/
{0}
};
static void BandaiIRQHook(int a)
{
if(IRQa)
{
IRQCount-=a;
if(IRQCount<0)
{
X6502_IRQBegin(FCEU_IQEXT);
IRQa=0;
IRQCount=0xFFFF;
}
}
}
static void BandaiSync(void)
{
if(is153)
{
int base=(reg[0]&1)<<4;
if(!UNIFchrrama)
{
int i;
for(i=0; i<8; i++) setchr1(i<<10,reg[i]);
}
else
setchr8(0);
setprg16(0x8000,(reg[8]&0x0F)|base);
setprg16(0xC000,0x0F|base);
}
else
{
int i;
for(i=0; i<8; i++) setchr1(i<<10,reg[i]);
setprg16(0x8000,reg[8]);
setprg16(0xC000,~0);
}
switch(reg[9]&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(BandaiWrite)
{
A&=0x0F;
if(A<0x0A)
{
reg[A&0x0F]=V;
BandaiSync();
}
else
switch(A)
{
case 0x0A: X6502_IRQEnd(FCEU_IQEXT); IRQa=V&1; IRQCount=IRQLatch; break;
case 0x0B: IRQLatch&=0xFF00; IRQLatch|=V; break;
case 0x0C: IRQLatch&=0xFF; IRQLatch|=V<<8; break;
case 0x0D: break;/* Serial EEPROM control port */
}
}
static void BandaiPower(void)
{
BandaiSync();
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x6000,0xFFFF,BandaiWrite);
}
static void M153Power(void)
{
BandaiSync();
setprg8r(0x10,0x6000,0);
SetReadHandler(0x6000,0x7FFF,CartBR);
SetWriteHandler(0x6000,0x7FFF,CartBW);
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x8000,0xFFFF,BandaiWrite);
}
static void M153Close(void)
{
if(WRAM)
free(WRAM);
WRAM=NULL;
}
static void StateRestore(int version)
{
BandaiSync();
}
void Mapper16_Init(CartInfo *info)
{
is153=0;
info->Power=BandaiPower;
MapIRQHook=BandaiIRQHook;
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
/* Famicom jump 2:*/
/* 0-7: Lower bit of data selects which 256KB PRG block is in use.*/
/* This seems to be a hack on the developers' part, so I'll make emulation*/
/* of it a hack(I think the current PRG block would depend on whatever the*/
/* lowest bit of the CHR bank switching register that corresponds to the*/
/* last CHR address read).*/
void Mapper153_Init(CartInfo *info)
{
is153=1;
info->Power=M153Power;
info->Close=M153Close;
MapIRQHook=BandaiIRQHook;
WRAMSIZE=8192;
WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1);
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
if(info->battery)
{
info->SaveGame[0]=WRAM;
info->SaveGameLen[0]=WRAMSIZE;
}
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
-103
View File
@@ -1,103 +0,0 @@
/* 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;
}
-76
View File
@@ -1,76 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2005 CaH4e3
* Copyright (C) 2009 qeed
*
* 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
* it seems now, mapper not reset-based,
* tested on real hardware and it does menus switch by pressing just Select, not Reset
* new registers behaviour proven this too
*
*/
#include "mapinc.h"
static uint8 latche[2];
static SFORMAT StateRegs[]=
{
{&latche, sizeof(latche), "LATCHE"},
{0}
};
static void Sync(void)
{
uint8 bank = (latche[0]&0x1f)|((latche[0]&0x80)>>2)|((latche[1]&1))<<6;
if(!(latche[0] & 0x20))
setprg32(0x8000,bank >> 1);
else
{
setprg16(0x8000,bank);
setprg16(0xC000,bank);
}
setmirror((latche[0]>>6)&1);
setchr8(0);
}
static DECLFW(M226Write)
{
latche[A & 1] = V;
Sync();
}
static void M226Power(void)
{
latche[0] = latche[1] = 0;
Sync();
SetWriteHandler(0x8000,0xFFFF,M226Write);
SetReadHandler(0x8000,0xFFFF,CartBR);
}
static void StateRestore(int version)
{
Sync();
}
void Mapper226_Init(CartInfo *info)
{
info->Power=M226Power;
AddExState(&StateRegs, ~0, 0, 0);
GameStateRestore=StateRestore;
}
-93
View File
@@ -1,93 +0,0 @@
/* 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;
}
-130
View File
@@ -1,130 +0,0 @@
/* 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);
}
-91
View File
@@ -1,91 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2007 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_prg[4];
static uint8 reg_chr[4];
static uint8 dip_switch;
static SFORMAT StateRegs[]=
{
{reg_prg, 4, "PREGS"},
{reg_chr, 4, "CREGS"},
{0}
};
static void Sync(void)
{
setprg8(0x8000,reg_prg[0]);
setprg8(0xa000,reg_prg[1]);
setprg8(0xc000,reg_prg[2]);
setprg8(0xe000,reg_prg[3]);
setchr2(0x0000,reg_chr[0]);
setchr2(0x0800,reg_chr[1]);
setchr2(0x1000,reg_chr[2]);
setchr2(0x1800,reg_chr[3]);
setmirror(MI_V);
}
static DECLFW(MBS5Write)
{
int bank_sel = (A&0xC00)>>10;
switch (A&0xF000)
{
case 0x8000:
reg_chr[bank_sel]=A&0x1F;
break;
case 0xA000:
if(A&(1<<(dip_switch+4)))
reg_prg[bank_sel]=A&0x0F;
break;
}
Sync();
}
static void MBS5Reset(void)
{
dip_switch++;
dip_switch&=3;
reg_prg[0]=reg_prg[1]=reg_prg[2]=reg_prg[3]=~0;
Sync();
}
static void MBS5Power(void)
{
dip_switch=0;
reg_prg[0]=reg_prg[1]=reg_prg[2]=reg_prg[3]=~0;
Sync();
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x8000,0xFFFF,MBS5Write);
}
static void StateRestore(int version)
{
Sync();
}
void BMCBS5_Init(CartInfo *info)
{
info->Power=MBS5Power;
info->Reset=MBS5Reset;
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
-378
View File
@@ -1,378 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2011 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
*/
#ifdef COPYFAMI
#include "__serial.h"
#include "mapinc.h"
#include "mmc3.h"
//#define DEBUG_SERIAL
// *** COPY FAMICOM EMULATION ***
/*
Êàðòà ïàìÿòè
$0000-$1FFF Îñíîâíîå ÎÇÓ
$2000-$200F Ðåãèñòðû PPU
$2010-$3FFB Ñèñòåìíîå ÎÇÓ
$3FFC-$3FFF Ñèñòåìíûå ðåãèñòðû
$4000-$7FFF APU ðåãèñòðû/ñâîáîäíî
$8000-$FFF9 CART/ROM
$FFFA-$FFFB CART/Âåêòîð NMI
$FFFE-$FFFF CART/Âåêòîð IRQ
Ðåãèñòðû
CTRL R/W $3FFC ---aenic ($00 at reset)
c - Ðåæèì êàðòðèäæà
0 - âûêëþ÷åí
1 - âêëþ÷åí
i - Ðåæèì IRQ âåêòîðà
0 - îðèãèíàëüíûé âåêòîð
1 - âåêòîð ïåðåõâà÷åí
n - Ðåæèì NMI âåêòîðà
0 - îðèãèíàëüíûé âåêòîð
1 - âåêòîð ïåðåõâà÷åí
e - Çàïðåò NMI
0 - çàïðåùåí
1 - ðàçðåøåí
a - Ðåæèì AROM
0 - âûêëþ÷åí
1 - âêëþ÷åí
BANK R/W $3FFD ---mbbbb
b - Íîìåð áàíêà âíóòðåííåîãî ÏÇÓ
m - Ìèððîðèíã â ðåæèìå ÀROM
USBDATA R/W $3FFE dddddddd
d - Áàéò äàííûõ ïðèåìà/ïåðåäà÷è
STATUS R $3FFF vmnicptr
r - Ñòàòóñ äàííûõ äëÿ ÷òåíèÿ èç USB
0 - Åñòü äàííûå
1 - Íåò äàííûõ
t - Ñòàòóñ áóôåðà äëÿ çàïèñè â USB
0 - Åñòü ìåñòî
1 - Íåò ìåñòà
p - Ñòàòóñ ïîäêëþ÷åíèÿ USB êàáåëÿ
0 - Ïîäêëþ÷åí
1 - Îòêëþ÷åí
c - Íàëè÷èå êàðòðèäæà â ñëîòå
0 - Ïðèñóòñòâóåò
1 - Îòñóòñòâóåò
i - Ñîñòîÿíèå ñèãíàëà IRQ êàðòðèäæà
0 - Àêòèâåí
1 - Íåàêòèâåí
n - Ñîñòîÿíèå ñèãíàëà NMI êàðòðèäæà
0 - Àêòèâåí
1 - Íåàêòèâåí
m - Ñîñòîÿíèå àäðåñíîé øèíû À10 VRAM (ìèððîðèíã)
v - Ñîñòîÿíèå VRAM
0 - Âûáðàíà
1 - Íå âûáðàíà
Ðåæèì AROM
Àêòèâèðóåòñÿ âíóòðåííÿÿ VRAM
Ðåãèñòðû áàíêîâ è ìèððîðèíãà íà 8000-FFFF
*/
#define CTRL 0x00
#define CCART 0x01
#define CVIRQ 0x02
#define CVNMI 0x04
#define CDNMI 0x08
#define CAROM 0x10
#define BANK 0x01
#define BMIRR 0x10
#define USB 0x02
#define STATUS 0x03
#define SRX 0x01
#define STX 0x02
#define SPEN 0x04
#define SCART 0x08
#define SIRQ 0x10
#define SNMI 0x20
#define SA10 0x40
#define SVRAM 0x80
#ifdef DEBUG_SERIAL
static uint8 debug_serial_data[] = {
0xDE, 0xAD, 0xBE, 0xEF, 0x00,
0xDE, 0xAD, 0xBE, 0xEF, 0x01,
0x02,
0x14, 0x50, 0xB0,
0x02,
0x14, 0x50, 0xB0,
0x02,
};
static uint32 debug_serial_data_size = sizeof(debug_serial_data);
static uint32 debug_serial_data_pos;
#endif
static uint8 *CHRRAM=NULL;
static uint32 CHRRAMSIZE;
static uint8 regs[4];
static readfunc def_read_ram, def_read_rom;
static writefunc def_write_ram;
static SFORMAT StateRegs[]=
{
{regs, 4, "CREGS"},
{0}
};
static void Sync()
{
FixMMC3PRG(MMC3_cmd);
FixMMC3CHR(MMC3_cmd);
}
static void MCopyFamiMMC3PW(uint32 A, uint8 V)
{
if(regs[CTRL] & CCART)
setprg8(A,V);
else
setprg32r(1,0x8000,(regs[BANK]&0x0F)^0x08);
}
static void MCopyFamiMMC3CW(uint32 A, uint8 V)
{
if((regs[STATUS] & SCART) && (regs[CTRL] & CAROM))
setchr8r(0x10,0);
else
setchr1r(0,A,V);
}
static void MCopyFamiMMC3MW(uint8 V)
{
if(regs[CTRL] & CAROM)
{
setmirror(MI_0+((regs[BANK]>>4)&1));
}
else
{
A000B=V;
setmirror((V&1)^1);
}
}
static uint32 direction = 0xffffffff;
static uint32 bytes_count = 0;
static DECLFW(MCopyFamiWriteReg)
{
if(((A&3) == USB))
{
if(direction != 0) {
direction = 0;
bytes_count = 0;
FCEU_printf(" >");
}
#ifndef DEBUG_SERIAL
while (!SerialSendChar(V)) {};
#endif
bytes_count++;
// FCEU_printf(" %02X",V);
}
else
{
regs[A&3]=V;
Sync();
}
}
static DECLFR(MCopyFamiReadReg)
{
#ifdef DEBUG_SERIAL
if(debug_serial_data_pos == debug_serial_data_size)
regs[STATUS] |= SRX;
else
regs[STATUS] &= ~SRX;
#endif
#ifndef DEBUG_SERIAL
if((A&3) == STATUS)
{
int data;
if((data = SerialGetChar()) == EOF)
regs[STATUS] |= SRX;
else
regs[STATUS] &= ~SRX;
regs[USB] = data & 0xff;
} else
#endif
if((A&3) == USB)
{
#ifdef DEBUG_SERIAL
regs[USB] = debug_serial_data[debug_serial_data_pos++];
#endif
if(direction != 1) {
if(direction != 0xffffffff) FCEU_printf(" bytes sent: %08x",bytes_count);
direction = 1;
bytes_count = 0;
FCEU_printf("\n<");
}
FCEU_printf(" %02X",regs[USB]);
}
return regs[A&3];
}
static DECLFW(MCopyFamiMMC3Write)
{
if(regs[CTRL] & CAROM)
{
regs[BANK] = V & 0x1F;
Sync();
}
else
{
if(A >= 0xC000)
MMC3_IRQWrite(A,V);
else
MMC3_CMDWrite(A,V);
}
}
static DECLFW(MCopyFamiMMC3WriteNMI)
{
if(regs[CTRL] & CVNMI)
def_write_ram(0x3FFC + (A & 1), V);
else
MCopyFamiMMC3Write(A, V);
}
static DECLFW(MCopyFamiMMC3WriteIRQ)
{
if(regs[CTRL] & CVIRQ)
def_write_ram(0x3FFE + (A & 1), V);
else
MCopyFamiMMC3Write(A, V);
}
static DECLFR(MCopyFamiReadNMI)
{
if(regs[CTRL] & CVNMI)
return def_read_ram(0x3FFC + (A & 1));
else
return def_read_rom(A);
}
static DECLFR(MCopyFamiReadIRQ)
{
if(regs[CTRL] & CVIRQ)
return def_read_ram(0x3FFE + (A & 1));
else
return def_read_rom(A);
}
static void MCopyFamiMMC3Power(void)
{
regs[CTRL] = regs[USB] = 0;
regs[STATUS] = SIRQ | SNMI | SVRAM;
regs[BANK] = 0x08;
#ifdef DEBUG_SERIAL
debug_serial_data_pos = 0;
#endif
GenMMC3Power();
Sync();
def_write_ram = GetWriteHandler(0x3FFC);
SetWriteHandler(0x3FFC,0x3FFF,MCopyFamiWriteReg);
def_read_ram = GetReadHandler(0x3FFC);
SetReadHandler(0x3FFC,0x3FFF,MCopyFamiReadReg);
SetWriteHandler(0x8000,0xFFF9,MCopyFamiMMC3Write);
SetWriteHandler(0xFFFA,0xFFFB,MCopyFamiMMC3WriteNMI);
SetWriteHandler(0xFFFE,0xFFFF,MCopyFamiMMC3WriteIRQ);
def_read_rom = GetReadHandler(0xFFFA);
SetReadHandler(0xFFFA,0xFFFB,MCopyFamiReadNMI);
SetReadHandler(0xFFFE,0xFFFF,MCopyFamiReadIRQ);
}
static void MCopyFamiMMC3Reset(void)
{
regs[CTRL] = regs[USB] = 0;
regs[STATUS] = SIRQ | SNMI | SVRAM;
regs[BANK] = 0x08;
#ifdef DEBUG_SERIAL
debug_serial_data_pos = 0;
#endif
MMC3RegReset();
Sync();
}
static void MCopyFamiClose(void)
{
if(CHRRAM)
free(CHRRAM);
CHRRAM=NULL;
SerialClose();
}
static void StateRestore(int version)
{
Sync();
}
void MapperCopyFamiMMC3_Init(CartInfo *info)
{
GenMMC3_Init(info, 512, 512, 8, 0);
cwrap=MCopyFamiMMC3CW;
pwrap=MCopyFamiMMC3PW;
mwrap=MCopyFamiMMC3MW;
info->Reset=MCopyFamiMMC3Reset;
info->Power=MCopyFamiMMC3Power;
info->Close=MCopyFamiClose;
GameStateRestore=StateRestore;
CHRRAMSIZE=8192;
CHRRAM=(uint8*)FCEU_gmalloc(CHRRAMSIZE);
SetupCartCHRMapping(0x10,CHRRAM,CHRRAMSIZE,1);
AddExState(CHRRAM, CHRRAMSIZE, 0, "CHRRAM");
#ifndef DEBUG_SERIAL
FCEU_printf("WAITING FOR PORT...\n");
while(!SerialOpen(20, 921600)) {}
FCEU_printf("PORT READY.\n");
#endif
AddExState(&StateRegs, ~0, 0, 0);
}
#endif
-600
View File
@@ -1,600 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2011 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
*/
/* *** COPY FAMICOM HARDWARE INTERFACE ****/
#ifdef COPYFAMI
#define NO_CACHE
#define NO_RAM
#include "__serial.h"
#include "mapinc.h"
#define FNV_32_PRIME ((uint32)0x01000193)
#define CHR_CACHE_SIZE (1024 * 4)
#define WRAM_CACHE_SIZE (1024 / 2)
#define PRG_CACHE_SIZE (1024 / 4)
#define CMD_CACHE_SIZE (1024 * 128)
#define CMD_MAX_SIZE (5)
#define CMD_MAX_RETEST (16)
#define CMD_MAX_VERIFY (16)
static uint8 *WRAM = NULL;
uint8 InitVector[] = {0xDE, 0xAD, 0xBE, 0xEF}; /* args none, return DE AD BE EF*/
uint8 ResetCmd[] = {0x00}; /* args none, return none*/
uint8 StateCmd[] = {0x01}; /* args none, return 7 bytes status*/
uint8 StatusCmd[] = {0x02}; /* args none, return 32 bytes status*/
uint8 LoadPlugCmd[] = {0x03, 0x00, 0x00}; /* args 2b size, Nb data return none*/
uint8 RunPlugCmd[] = {0x04}; /* args none, return none*/
uint8 RunGameCmd[] = {0x05}; /* args none, return none*/
uint8 NROMSave[] = {0x06}; /* args none, return 16b + 32kb + 8kb*/
uint8 PRGWBCmd[] = {0x08, 0x00, 0x00, 0x00}; /* args 2b addr, 1b data return none*/
uint8 PRGRBCmd[] = {0x09, 0x00, 0x00}; /* args 2b addr return 1b data*/
uint8 CHRWBCmd[] = {0x0A, 0x00, 0x00, 0x00}; /* args 2b addr, 1b data return none*/
uint8 CHRRBCmd[] = {0x0B, 0x00, 0x00}; /* args 2b addr, return 1b data*/
uint8 PRGSUMCmd[] = {0x10, 0x00, 0x00}; /* args 1b addr, 1b size return (256 * N)b*/
uint8 PRG32KSUMCmd[] = {0x10, 0x80, 0x80}; /* args 1b addr, 1b size return 32kb*/
uint8 PRG16KSUMCmd[] = {0x10, 0x00, 0x40}; /* args 1b addr, 1b size return 16kb*/
uint8 PRG8KSUMCmd[] = {0x10, 0x00, 0x20}; /* args 1b addr, 1b size return 8kb*/
uint8 PRG4KSUMCmd[] = {0x10, 0x00, 0x10}; /* args 1b addr, 1b size return 4kb*/
uint8 CHRSUMCmd[] = {0x11, 0x00, 0x00}; /* args 1b addr, 1b size return (256 * N)b*/
uint8 CHR8KSUMCmd[] = {0x11, 0x00, 0x20}; /* args 1b addr, 1b size return 8kb*/
uint8 CHR4KSUMCmd[] = {0x11, 0x00, 0x10}; /* args 1b addr, 1b size return 4kb*/
uint8 CHR2KSUMCmd[] = {0x11, 0x00, 0x08}; /* args 1b addr, 1b size return 2kb*/
uint8 CHR1KSUMCmd[] = {0x11, 0x00, 0x04}; /* args 1b addr, 1b size return 1kb*/
uint8 PRGGetCmd[] = {0x12, 0x00, 0x00}; /* args 1b addr, 1b size return (256 * N)b*/
uint8 PRG32KGetCmd[] = {0x12, 0x80, 0x80}; /* args 1b addr, 1b size return 32kb*/
uint8 PRG16KGetCmd[] = {0x12, 0x00, 0x40}; /* args 1b addr, 1b size return 16kb*/
uint8 PRG8KGetCmd[] = {0x12, 0x00, 0x20}; /* args 1b addr, 1b size return 8kb*/
uint8 PRG4KGetCmd[] = {0x12, 0x00, 0x10}; /* args 1b addr, 1b size return 4kb*/
uint8 CHRGetCmd[] = {0x13, 0x00, 0x00}; /* args 1b addr, 1b size return (256 * N)b*/
uint8 CHR8KGetCmd[] = {0x13, 0x00, 0x20}; /* args 1b addr, 1b size return 8kb*/
uint8 CHR4KGetCmd[] = {0x13, 0x00, 0x10}; /* args 1b addr, 1b size return 4kb*/
uint8 CHR2KGetCmd[] = {0x13, 0x00, 0x08}; /* args 1b addr, 1b size return 2kb*/
uint8 CHR1KGetCmd[] = {0x13, 0x00, 0x04}; /* args 1b addr, 1b size return 1kb*/
uint8 CPUTestCmd[] = {0x14, 0x00, 0x00}; /* args 1b addr, 1b size return (2b + 1b) * N + 3b*/
typedef struct {
int32 mirror;
int32 chrsum[8];
int32 prgsum[4];
} SYNC_STATE;
static SYNC_STATE state_cur, state_new, state_def;
typedef struct {
uint8 *buf;
int32 count;
} DATA_BANKS;
static DATA_BANKS chr_data;
static int32 chr_bank[0x10000];
static DATA_BANKS prg_data;
static int32 prg_bank[0x10000];
typedef struct {
SYNC_STATE states[CMD_CACHE_SIZE];
int32 seqs[CMD_CACHE_SIZE][CMD_MAX_SIZE];
int32 count;
} SYNC_CMDS;
typedef struct {
int32 seq[CMD_MAX_SIZE];
int32 size;
int32 found;
uint32 hash;
uint16 hashf;
} SYNC_CMD;
static SYNC_CMD cmd;
static SYNC_CMDS cmds;
typedef struct {
int32 index;
int32 size;
int32 retest;
int32 verify;
} CMD_CACHE;
static CMD_CACHE cmd_cache[0x10000];
static SFORMAT StateRegs[]=
{
{state_cur.chrsum, sizeof(state_cur.chrsum), "CHRREG"},
{state_cur.prgsum, sizeof(state_cur.prgsum), "ROMREG"},
{&state_cur.mirror, sizeof(state_cur.mirror), "MIRREG"},
{0}
};
#define MI_U 4
static char *mirror_names[5] = {"Horizontal", "Vertical", "Mirror 0", "Mirror 1", "Unknown mirror"};
static int32 mirror_modes[16] = {
MI_0, MI_U, MI_U, MI_H, MI_U, MI_V, MI_U, MI_U,
MI_U, MI_U, MI_U, MI_U, MI_U, MI_U, MI_U, MI_1 };
#define CHRDEF(slot) (chr_bank[state_def.chrsum[slot]])
#define PRGDEF(slot) (prg_bank[state_def.prgsum[slot]])
#define CHRCUR(slot) (chr_bank[state_cur.chrsum[slot]])
#define PRGCUR(slot) (prg_bank[state_cur.prgsum[slot]])
#define CHRNEW(slot) (chr_bank[state_new.chrsum[slot]])
#define PRGNEW(slot) (prg_bank[state_new.prgsum[slot]])
static void GetStatus(SYNC_STATE *state)
{
uint8 resp0;
uint16 resp1, i;
SEND(StatusCmd);
GET(resp0, 1);
state->mirror = resp0;
GET(resp0, 1);
for(i=0; i<8; i++) {
GET(resp1, 2);
state->chrsum[i] = resp1;
}
for(i=0; i<4; i++) {
GET(resp1, 2);
state->prgsum[i] = resp1;
}
}
static int32 FetchNewCHRBank(int32 slot)
{
FILE *ofile;
char name[256];
int32 bank = chr_data.count++;
CHR1KGetCmd[1] = slot << 2;
SENDGET(CHR1KGetCmd, chr_data.buf[bank * 1024], 1024);
sprintf(name,"%04x.chr",bank);
ofile=fopen(name,"wb");
fwrite((void *)&chr_data.buf[bank * 1024], 1, 1024, ofile);
fclose(ofile);
return bank;
}
static int32 FetchNewPRGBank(int32 slot)
{
FILE *ofile;
char name[256];
int32 bank = prg_data.count++;
PRG8KGetCmd[1] = 0x80 + (slot << 5);
SENDGET(PRG8KGetCmd, prg_data.buf[bank * 8192], 8192);
sprintf(name,"%04x.prg",bank);
ofile=fopen(name,"wb");
fwrite((void *)&prg_data.buf[bank * 8192], 1, 8192, ofile);
fclose(ofile);
return bank;
}
static int CheckStatus(void)
{
int32 i, ischanged = 0;
GetStatus(&state_new);
if(state_cur.mirror != state_new.mirror) {
state_cur.mirror = state_new.mirror;
#ifdef FCEU_LOG
FCEU_printf(">> mirror changed to %s (%02X)\n",mirror_names[mirror_modes[state_cur.mirror]], state_cur.mirror);
#endif
ischanged = 1;
} else {
state_new.mirror = -1;
}
for(i=0; i<8; i++) {
if(state_cur.chrsum[i] != state_new.chrsum[i]) {
state_cur.chrsum[i] = state_new.chrsum[i];
if(CHRCUR(i) == -1) {
CHRCUR(i) = FetchNewCHRBank(i);
#ifdef FCEU_LOG
FCEU_printf(">> chr[%d] bank %d loaded\n", i, CHRCUR(i));
#endif
}
#ifdef FCEU_LOG
else
FCEU_printf(">> chr[%d] bank %d switched\n", i, CHRCUR(i));
#endif
ischanged = 1;
} else {
state_new.chrsum[i] = -1;
}
}
for(i=0; i<4; i++) {
if(state_cur.prgsum[i] != state_new.prgsum[i]) {
state_cur.prgsum[i] = state_new.prgsum[i];
if(PRGCUR(i) == -1) {
PRGCUR(i) = FetchNewPRGBank(i);
#ifdef FCEU_LOG
FCEU_printf(">> prg[%d] bank %d loaded\n", i, PRGCUR(i));
#endif
}
#ifdef FCEU_LOG
else
FCEU_printf(">> prg[%d] bank %d switched\n", i, PRGCUR(i));
#endif
ischanged = 1;
} else {
state_new.prgsum[i] = -1;
}
}
return ischanged;
}
#ifndef NO_CACHE
static void ApplyStatus()
{
int32 i;
if ((cmds.states[cmd.found].mirror != -1) && (cmds.states[cmd.found].mirror != state_cur.mirror)) {
state_cur.mirror = cmds.states[cmd.found].mirror;
setmirror(mirror_modes[state_cur.mirror]);
#ifdef FCEU_LOG
FCEU_printf(">> mirror changed to %s (%02X)\n",mirror_names[mirror_modes[state_cur.mirror]], state_cur.mirror);
#endif
}
for(i=0; i<8; i++) {
int32 sum = cmds.states[cmd.found].chrsum[i];
if (sum != -1) {
if (sum != state_cur.chrsum[i]) {
state_cur.chrsum[i] = sum;
setchr1r(1, i * 1024, CHRCUR(i));
#ifdef FCEU_LOG
FCEU_printf(">> chr[%d] bank %d switched\n", i, chr_bank[sum]);
#endif
}
else
#ifdef FCEU_LOG
FCEU_printf(">> chr[%d] bank %d switched the same\n", i, chr_bank[sum]);
}
#endif
}
for(i=0; i<4; i++) {
int32 sum = cmds.states[cmd.found].prgsum[i];
if (sum != -1) {
if (sum != state_cur.prgsum[i]) {
state_cur.prgsum[i] = sum;
setprg8r(2, 0x8000 + (i * 8192), PRGCUR(i));
#ifdef FCEU_LOG
FCEU_printf(">> prg[%d] bank %d switched\n", i, prg_bank[sum]);
#endif
}
else
#ifdef FCEU_LOG
FCEU_printf(">> prg[%d] bank %d switched the same\n", i, prg_bank[sum]);
}
#endif
}
}
static void LogCmd()
{
int32 i;
FCEU_printf(">> new cmd size %d [", cmd_cache[cmd.hashf].size);
for(i=0; i<cmd_cache[cmd.hashf].size; i++)
FCEU_printf(" %06X",cmds.seqs[cmd.found][i]);
FCEU_printf(" ], switched to (");
if (cmds.states[cmd.found].mirror != -1)
FCEU_printf(" mirror=%s",mirror_names[mirror_modes[cmds.states[cmd.found].mirror]]);
for(i=0; i<8; i++)
if (cmds.states[cmd.found].chrsum[i] != -1)
FCEU_printf(" chr%d=%02X", i, chr_bank[cmds.states[cmd.found].chrsum[i]]);
for(i=0; i<4; i++)
if (cmds.states[cmd.found].prgsum[i] != -1)
FCEU_printf(" prg%d=%02X", i, prg_bank[cmds.states[cmd.found].prgsum[i]]);
FCEU_printf(" )\n");
}
#endif
static void Sync()
{
setchr1r(1, 0x0000, CHRCUR(0));
setchr1r(1, 0x0400, CHRCUR(1));
setchr1r(1, 0x0800, CHRCUR(2));
setchr1r(1, 0x0C00, CHRCUR(3));
setchr1r(1, 0x1000, CHRCUR(4));
setchr1r(1, 0x1400, CHRCUR(5));
setchr1r(1, 0x1800, CHRCUR(6));
setchr1r(1, 0x1C00, CHRCUR(7));
#ifndef NO_RAM
setprg8r(1, 0x6000, 0);
#endif
setprg8r(2, 0x8000, PRGCUR(0));
setprg8r(2, 0xA000, PRGCUR(1));
setprg8r(2, 0xC000, PRGCUR(2));
setprg8r(2, 0xE000, PRGCUR(3));
setmirror(mirror_modes[state_cur.mirror]);
}
#ifndef NO_CACHE
static void UpdateCmd(uint32 val)
{
int32 index;
if(cmd.size < CMD_MAX_SIZE) {
index = cmd.size++;
} else {
/* åñëè äîñòèãíóò ìàêñèìóì äëÿ êîìàíäû, âûáðîñèòü ïîñëåäíóþþ, äîáàâèòü íîâóþ,*/
/* ïðîäîëæàòü äî áàíêñâè÷èíãà*/
cmd.hash = 0;
for(index = 0; index < (CMD_MAX_SIZE - 1); index++) {
cmd.seq[index] = cmd.seq[index + 1];
cmd.hash *= FNV_32_PRIME;
cmd.hash ^= cmd.seq[index];
}
}
cmd.seq[index] = val;
cmd.hash *= FNV_32_PRIME;
cmd.hash ^= val;
cmd.hashf = (cmd.hash >> 16) ^ (cmd.hash & 0xffff);
cmd.found = cmd_cache[cmd.hashf].index;
}
#endif
static DECLFW(MCopyFamiWrite)
{
#ifndef NO_CACHE
int32 i;
#endif
#ifdef FCEU_LOG
FCEU_printf("> WRITE %04X:%02X\n",A,V);
#endif
PRGWBCmd[1] = A & 0xFF;
PRGWBCmd[2] = A >> 8;
PRGWBCmd[3] = V & 0xFF;
SEND(PRGWBCmd);
#ifdef NO_CACHE
CheckStatus();
Sync();
#else
UpdateCmd((A << 8) | V);
/* èùåì êîìàíäó â êåøå*/
if(cmd.found == -1) {
/* íå íàéäåíà, ïðîâåðÿåì, èçìåíèëîñü ëè ñîñòîÿíèå áàíêîâ*/
/* ëèáî íå ïðåäåëüíîé ëè îíà äëèíû äëÿ êîìàíäû*/
cmd_cache[cmd.hashf].index = cmd.found = cmds.count++;
cmd_cache[cmd.hashf].retest = 0;
cmd_cache[cmd.hashf].verify = 0;
for(i=0; i<cmd.size; i++)
cmds.seqs[cmd.found][i] = cmd.seq[i];
cmd_cache[cmd.hashf].size = cmd.size;
if(CheckStatus()) {
cmds.states[cmd.found] = state_new;
LogCmd();
cmd.size = 0;
cmd.hash = 0;
Sync();
} else {
/* åñëè äîáàâëåíà ïîëíàÿ êîìàíäà áåç áàíêñâèò÷èíãà*/
cmd_cache[cmd.hashf].index = -2;
}
} else if(cmd.found == -2) {
/* ÷àñòè÷íîå ñîâïàäåíèå, åñëè ÷èñëî ïðîâåðîê íå ïðåâûñèëî ëèìèò*/
if(cmd_cache[cmd.hashf].retest < CMD_MAX_RETEST) {
/* òî ïðîâåðèì ñîñòîÿíèå áàíêîâ*/
if(CheckStatus()) {
/* èçìåíèëîñü, çàïèøåì íîâóþ êîìàíäó*/
cmd_cache[cmd.hashf].index = cmd.found = cmds.count++;
cmd_cache[cmd.hashf].retest = 0;
cmd_cache[cmd.hashf].verify = 0;
for(i=0; i<cmd.size; i++)
cmds.seqs[cmd.found][i] = cmd.seq[i];
cmd_cache[cmd.hashf].size = cmd.size;
cmds.states[cmd.found] = state_new;
LogCmd();
cmd.size = 0;
cmd.hash = 0;
Sync();
} else {
/* íå èçìåíèëîñü, îòìåòèì óâåëè÷èì ñ÷åò÷èê ïðîâåðîê*/
cmd_cache[cmd.hashf].retest++;
}
}
} else {
/* íàéäåíà, ïîñëåäíèé ðóáåæ îáîðîíû îò ãîâíà*/
/*
if(cmd_cache[cmd.hashf].verify < CMD_MAX_VERIFY) {
if(CheckStatus()) {
int32 changed = 0;
/* åñëè åñòü èçìåíåíèÿ, ñðàâíèì íîâîå ñîñòîÿíèå ñ çàïèñàííûì*/
if(cmds.states[cmd.found].mirror != state_new.mirror)
changed = 1;
for(i=0; i<8; i++)
if(cmds.states[cmd.found].chrsum[i] != state_new.chrsum[i])
changed = 1;
for(i=0; i<4; i++)
if(cmds.states[cmd.found].prgsum[i] != state_new.prgsum[i])
changed = 1;
if(changed) {
cmd_cache[cmd.hashf].index = -1;
cmd_cache[cmd.hashf].retest = 0;
cmd_cache[cmd.hashf].verify = 0;
Sync();
}
} else
cmd_cache[cmd.hashf].verify++;
} else */ {
/* ïðèìåíÿåì áåç ìàëåéøåãî çàçðåíèÿ ñîâåñòè*/
ApplyStatus();
cmd.size = 0;
cmd.hash = 0;
}
}
#endif
}
static DECLFR(MCopyFamiRead)
{
uint8 result;
PRGRBCmd[1] = A & 0xFF;
PRGRBCmd[2] = A >> 8;
SENDGET(PRGRBCmd, result, 1);
#ifdef FCEU_LOG
FCEU_printf("> READ %04X:%02X\n",A,result);
#endif
return result;
}
static void MCopyFamiReset(void)
{
state_cur = state_def;
Sync();
}
static void MCopyFamiPower(void)
{
/* uint32 resp, presp;*/
FCEU_printf("NOW POWERING... ");
Sync();
SetWriteHandler(0x4018, 0x7fff, MCopyFamiWrite);
SetReadHandler(0x4018, 0x7fff, MCopyFamiRead);
#ifndef NO_RAM
SetWriteHandler(0x6000, 0x7fff, CartBW);
SetReadHandler(0x6000, 0x7fff, CartBR);
#endif
/*
FCEU_printf("READING MEMORY MAP...\n");
CPUTestCmd[1] = 0x50;
CPUTestCmd[2] = 0x30;
SEND(CPUTestCmd);
resp = 0;
presp = 0xffffffff;
while (presp != 0x00ff0000) {
GET(resp, 3);
if(presp != 0xffffffff) {
switch(presp & 0x00FF0000) {
case 0x00000000: /* BUS*/
FCEU_printf(" %04X-%04X OPEN BUS\n",presp & 0x7fff, (resp - 1) & 0x7fff);
break;
case 0x00010000: /* RAM*/
FCEU_printf(" %04X-%04X RAM\n",presp & 0x7fff, (resp - 1) & 0x7fff);
SetWriteHandler(presp & 0x7fff, (resp - 1) & 0x7fff, CartBW);
SetReadHandler(presp & 0x7fff, (resp - 1) & 0x7fff, CartBR);
break;
}
}
presp = resp;
}
*/
SetWriteHandler(0x8000, 0xffff, MCopyFamiWrite);
SetReadHandler(0x8000, 0xffff, CartBR);
FCEU_printf("DONE!\nNOW COLLECTING DATA...\n");
}
static void MCopyFamiClose(void)
{
if(chr_data.buf)
free(chr_data.buf);
chr_data.buf=NULL;
if(prg_data.buf)
free(prg_data.buf);
prg_data.buf=NULL;
if(WRAM)
free(WRAM);
WRAM = NULL;
SerialClose();
}
static void StateRestore(int version)
{
Sync();
}
void MapperCopyFami_Init(CartInfo *info)
{
uint32 resp = 0, i, size;
memset(chr_bank, -1, sizeof(chr_bank));
memset(prg_bank, -1, sizeof(chr_bank));
memset(cmd_cache, -1, sizeof(cmd_cache));
memset(&cmds, 0, sizeof(cmds));
memset(&cmd, 0, sizeof(cmd));
info->Reset=MCopyFamiReset;
info->Power=MCopyFamiPower;
info->Close=MCopyFamiClose;
GameStateRestore=StateRestore;
size = 1024 * CHR_CACHE_SIZE; /* ðàçìåð ñòðàíèöû 1êá*/
chr_data.buf = (uint8*)FCEU_gmalloc(size);
SetupCartCHRMapping(1, chr_data.buf, size, 1); /* ïðîâåðÿòü ïïó ðàì, èíà÷å èãðà ìîæåò ïîðòèòü äàííûå*/
AddExState(chr_data.buf, size, 0, "COPYCHR");
size = 8192; /* ðàçìåð ñòðàíèöû 8êá*/
WRAM = (uint8*)FCEU_gmalloc(size);
SetupCartPRGMapping(1, WRAM, size, 1);
AddExState(WRAM, size, 0, "COPYWRAM");
size = 8192 * PRG_CACHE_SIZE; /* ðàçìåð ñòðàíèöû 8êá*/
prg_data.buf = (uint8*)FCEU_gmalloc(size);
SetupCartPRGMapping(2, prg_data.buf, size, 0);
AddExState(prg_data.buf, size, 0, "COPYPRG");
FCEU_printf("WAITING FOR SERIAL PORT... ");
while(!SerialOpen(19, 921600)) { Sleep(500); }
FCEU_printf("READY!\n");
FCEU_printf("WAITING FOR DEVICE... ");
while(resp != *(uint32 *)&InitVector[0]) {
SEND(ResetCmd);
SENDGET(InitVector, resp, 4);
Sleep(500);
}
FCEU_printf("READY!\n");
FCEU_printf("READING STATUS...\n");
GetStatus(&state_cur);
FCEU_printf("MIRRORING IS %s (%02X)\n",mirror_names[mirror_modes[state_cur.mirror]], state_cur.mirror);
FCEU_printf("READING CHR...\n INITIAL STATE:");
for(i=0; i<8; i++) {
if(CHRCUR(i) == -1)
CHRCUR(i) = FetchNewCHRBank(i);
FCEU_printf(" CHR%d=%02X", i, CHRCUR(i));
}
FCEU_printf("\n");
FCEU_printf("READING PRG...\n INITIAL STATE:");
for(i=0; i<4; i++) {
if(PRGCUR(i) == -1)
PRGCUR(i) = FetchNewPRGBank(i);
FCEU_printf(" PRG%d=%02X", i, PRGCUR(i));
}
FCEU_printf("\nDONE!\n");
state_def = state_cur;
AddExState(&StateRegs, ~0, 0, 0);
}
#endif
-111
View File
@@ -1,111 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2007 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
*
* Dance 2000 12-in-1
*
*/
#include "mapinc.h"
static uint8 prg, mirr, prgmode;
static uint8 *WRAM=NULL;
static uint32 WRAMSIZE;
static SFORMAT StateRegs[]=
{
{&prg, 1, "REGS"},
{&mirr, 1, "MIRR"},
{&prgmode, 1, "MIRR"},
{0}
};
static void Sync(void)
{
setmirror(mirr);
setprg8r(0x10,0x6000,0);
setchr8(0);
if(prgmode)
setprg32(0x8000,prg&7);
else {
setprg16(0x8000,prg&0x0f);
setprg16(0xC000,0);
}
}
static DECLFW(UNLD2000Write)
{
/* FCEU_printf("write %04x:%04x\n",A,V);*/
switch(A) {
case 0x5000: prg = V; Sync(); break;
case 0x5200: mirr = (V & 1)^1; prgmode = V & 4; Sync(); break;
/* default: FCEU_printf("write %04x:%04x\n",A,V);*/
}
}
static DECLFR(UNLD2000Read)
{
if(prg & 0x40)
return X.DB;
else
return CartBR(A);
}
static void UNLD2000Power(void)
{
prg = prgmode = 0;
Sync();
SetReadHandler(0x6000,0x7FFF,CartBR);
SetWriteHandler(0x6000,0x7FFF,CartBW);
SetReadHandler(0x8000,0xFFFF,UNLD2000Read);
SetWriteHandler(0x4020,0x5FFF,UNLD2000Write);
}
static void UNLAX5705IRQ(void)
{
if(scanline > 174) setchr4(0x0000,1);
else setchr4(0x0000,0);
}
static void UNLD2000Close(void)
{
if(WRAM)
free(WRAM);
WRAM=NULL;
}
static void StateRestore(int version)
{
Sync();
}
void UNLD2000_Init(CartInfo *info)
{
info->Power=UNLD2000Power;
info->Close=UNLD2000Close;
GameHBIRQHook=UNLAX5705IRQ;
GameStateRestore=StateRestore;
WRAMSIZE=8192;
WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1);
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
AddExState(&StateRegs, ~0, 0, 0);
}
-429
View File
@@ -1,429 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
static uint8 latche, latcheinit, bus_conflict;
static uint16 addrreg0, addrreg1;
static uint8 *WRAM=NULL;
static uint32 WRAMSIZE;
static void(*WSync)(void);
static DECLFW(LatchWrite)
{
/* FCEU_printf("bs %04x %02x\n",A,V);*/
if(bus_conflict)
latche=V&CartBR(A);
else
latche=V;
WSync();
}
static void LatchPower(void)
{
latche=latcheinit;
WSync();
SetReadHandler(0x6000,0xFFFF,CartBR);
SetWriteHandler(0x6000,0x7FFF,CartBW);
SetWriteHandler(addrreg0,addrreg1,LatchWrite);
}
static void LatchClose(void)
{
if(WRAM)
free(WRAM);
WRAM=NULL;
}
static void StateRestore(int version)
{
WSync();
}
static void Latch_Init(CartInfo *info, void (*proc)(void), uint8 init, uint16 adr0, uint16 adr1, uint8 wram, uint8 busc)
{
bus_conflict = busc;
latcheinit=init;
addrreg0=adr0;
addrreg1=adr1;
WSync=proc;
info->Power=LatchPower;
info->Close=LatchClose;
GameStateRestore=StateRestore;
if(wram)
{
WRAMSIZE=8192;
WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1);
if(info->battery)
{
info->SaveGame[0]=WRAM;
info->SaveGameLen[0]=WRAMSIZE;
}
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
}
AddExState(&latche, 1, 0, "LATC");
}
/*------------------ CPROM ---------------------------*/
static void CPROMSync(void)
{
setchr4(0x0000,0);
setchr4(0x1000,latche&3);
setprg32(0x8000,0);
}
void CPROM_Init(CartInfo *info)
{
Latch_Init(info, CPROMSync, 0, 0x8000, 0xFFFF, 0, 0);
}
/*------------------ Map 184 ---------------------------*/
static void M184Sync(void)
{
setchr4(0x0000,latche);
setchr4(0x1000,latche>>4);
setprg32(0x8000,0);
}
void Mapper184_Init(CartInfo *info)
{
Latch_Init(info, M184Sync, 0, 0x6000, 0x7FFF, 0, 0);
}
/*------------------ CNROM ---------------------------*/
static void CNROMSync(void)
{
setchr8(latche);
setprg32(0x8000,0);
setprg8r(0x10,0x6000,0); /* Hayauchy IGO uses 2Kb or RAM*/
}
void CNROM_Init(CartInfo *info)
{
Latch_Init(info, CNROMSync, 0, 0x8000, 0xFFFF, 1, 0);
}
/*------------------ 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, 0, 0);
}
/*------------------ 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, 0, 0);
}
/*------------------ 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, 0, 0);
}
/*------------------ 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, 0, 0);
}
/*------------------ MHROM ---------------------------*/
static void MHROMSync(void)
{
setprg32(0x8000,latche>>4);
setchr8(latche&0xf);
}
void MHROM_Init(CartInfo *info)
{
Latch_Init(info, MHROMSync, 0, 0x8000, 0xFFFF, 0, 0);
}
void Mapper140_Init(CartInfo *info)
{
Latch_Init(info, MHROMSync, 0, 0x6000, 0x7FFF, 0, 0);
}
void Mapper240_Init(CartInfo *info)
{
Latch_Init(info, MHROMSync, 0, 0x4020, 0x5FFF, 0, 0);
/* need SRAM.*/
}
/*------------------ Map 87 ---------------------------*/
static void M87Sync(void)
{
setprg32(0x8000,0);
setchr8(((latche>>1)&1)|((latche<<1)&2));
}
void Mapper87_Init(CartInfo *info)
{
Latch_Init(info, M87Sync, ~0, 0x6000, 0xFFFF, 0, 0);
}
/*------------------ Map 101 ---------------------------*/
static void M101Sync(void)
{
setprg32(0x8000,0);
setchr8(latche);
}
void Mapper101_Init(CartInfo *info)
{
Latch_Init(info, M101Sync, ~0, 0x6000, 0x7FFF, 0, 0);
}
/*------------------ 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, 0, 0);
}
void Mapper144_Init(CartInfo *info)
{
Latch_Init(info, M11Sync, 0, 0x8001, 0xFFFF, 0, 0);
}
/*------------------ Map 38 ---------------------------*/
static void M38Sync(void)
{
setprg32(0x8000,latche&3);
setchr8(latche>>2);
}
void Mapper38_Init(CartInfo *info)
{
Latch_Init(info, M38Sync, 0, 0x7000, 0x7FFF, 0, 0);
}
/*------------------ Map 36 ---------------------------*/
static void M36Sync(void)
{
setprg32(0x8000,latche>>4);
setchr8((latche)&0xF);
}
void Mapper36_Init(CartInfo *info)
{
Latch_Init(info, M36Sync, 0, 0x8400, 0xfffe, 0, 0);
}
/*------------------ 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, 0, 1);
}
/*------------------ 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, 0, 0);
}
/*------------------ 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, 0, 0);
}
/*------------------ 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, 0, 0);
}
/*------------------ 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, 0, 0);
}
/*------------------ 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, 0, 0);
}
/*------------------ 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, 0, 0);
}
/*------------------ NROM ---------------------------*/
#ifdef DEBUG_MAPPER
static DECLFW(WriteHandler)
{
FCEU_printf("bs %04x %02x\n",A,V);
CartBW(A,V);
}
#endif
static void NROMPower(void)
{
setprg8r(0x10,0x6000,0); /* Famili BASIC (v3.0) need it (uses only 4KB), FP-BASIC uses 8KB*/
setprg16(0x8000,0);
setprg16(0xC000,~0);
setchr8(0);
SetReadHandler(0x6000,0x7FFF,CartBR);
SetWriteHandler(0x6000,0x7FFF,CartBW);
SetReadHandler(0x8000,0xFFFF,CartBR);
#ifdef DEBUG_MAPPER
SetWriteHandler(0x4020,0xFFFF,WriteHandler);
#endif
}
void NROM_Init(CartInfo *info)
{
info->Power=NROMPower;
info->Close=LatchClose;
WRAMSIZE=8192;
WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1);
if(info->battery)
{
info->SaveGame[0]=WRAM;
info->SaveGameLen[0]=WRAMSIZE;
}
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
}
-82
View File
@@ -1,82 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
static uint8 cmd;
static uint8 DRegs[8];
static SFORMAT 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);
}
-103
View File
@@ -1,103 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2009 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(0x6000,0x7fff,CartBR);*/
/* SetWriteHandler(0x6000,0x7fff,CartBW);*/
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x8000,0xFFFF,MNNNWrite);
}
static void MNNNReset(void)
{
}
/*
static void MNNNClose(void)
{
if(WRAM)
free(WRAM);
if(CHRRAM)
free(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);
SetupCartCHRMapping(0x10,CHRRAM,CHRRAMSIZE,1);
AddExState(CHRRAM, CHRRAMSIZE, 0, "CRAM");
*/
/*
WRAMSIZE=8192;
WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1);
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
if(info->battery)
{
info->SaveGame[0]=WRAM;
info->SaveGameLen[0]=WRAMSIZE;
}
*/
AddExState(&StateRegs, ~0, 0, 0);
}
-84
View File
@@ -1,84 +0,0 @@
/* 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 *WRAM=NULL;
static uint8 reg;
static SFORMAT StateRegs[]=
{
{&reg, 1, "REG"},
{0}
};
static void Sync(void)
{
setchr8(0);
setprg8r(0x10,0x6000,(reg&0xC0)>>6);
setprg32(0x8000,reg&0x1F);
/* setmirror(((reg&0x20)>>5));*/
}
static DECLFW(UNLEDU2000HiWrite)
{
/* FCEU_printf("%04x:%02x\n",A,V);*/
reg=V;
Sync();
}
static void UNLEDU2000Power(void)
{
setmirror(MI_0);
SetReadHandler(0x6000,0xFFFF,CartBR);
SetWriteHandler(0x6000,0xFFFF,CartBW);
SetWriteHandler(0x8000,0xFFFF,UNLEDU2000HiWrite);
reg=0;
Sync();
}
static void UNLEDU2000Close(void)
{
if(WRAM)
free(WRAM);
WRAM=NULL;
}
static void UNLEDU2000Restore(int version)
{
Sync();
}
void UNLEDU2000_Init(CartInfo *info)
{
info->Power=UNLEDU2000Power;
info->Close=UNLEDU2000Close;
GameStateRestore=UNLEDU2000Restore;
WRAM=(uint8*)FCEU_gmalloc(32768);
SetupCartPRGMapping(0x10,WRAM,32768,1);
if(info->battery)
{
info->SaveGame[0]=WRAM;
info->SaveGameLen[0]=32768;
}
AddExState(WRAM, 32768, 0, "WRAM");
AddExState(StateRegs, ~0, 0, 0);
}
-222
View File
@@ -1,222 +0,0 @@
/* 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"
#include "mmc3.h"
static uint8 unromchr;
static uint32 dipswitch = 0;
static uint8 *CHRRAM=NULL;
static uint32 CHRRAMSize;
static void BMCFK23CCW(uint32 A, uint8 V)
{
if(EXPREGS[0]&0x40)
setchr8(EXPREGS[2]|unromchr);
else if(EXPREGS[0] & 0x20)
setchr1r(0x10, A, V);
else
{
uint16 base=(EXPREGS[2]&0x7F)<<3;
if(EXPREGS[3]&2)
{
int cbase=(MMC3_cmd&0x80)<<5;
setchr1(A,V|base);
setchr1(0x0000^cbase,DRegBuf[0]|base);
setchr1(0x0400^cbase,EXPREGS[6]|base);
setchr1(0x0800^cbase,DRegBuf[1]|base);
setchr1(0x0c00^cbase,EXPREGS[7]|base);
}
else
setchr1(A,V|base);
}
}
static void BMCFK23CPW(uint32 A, uint8 V)
{
uint32 bank = (EXPREGS[1] & 0x1F);
uint32 hiblock = ((EXPREGS[0] & 8) << 4)|((EXPREGS[0] & 0x80) << 1)|(UNIFchrrama?((EXPREGS[2] & 0x40)<<3):0);
uint32 block = (EXPREGS[1] & 0x60) | hiblock;
uint32 extra = (EXPREGS[3] & 2);
switch(EXPREGS[0]&7)
{
case 0: setprg8(A, (block << 1) | (V & 0x3F));
if(extra)
{
setprg8(0xC000,EXPREGS[4]);
setprg8(0xE000,EXPREGS[5]);
}
break;
case 1: setprg8(A, ((hiblock | (EXPREGS[1] & 0x70)) << 1) | (V & 0x1F));
if(extra)
{
setprg8(0xC000,EXPREGS[4]);
setprg8(0xE000,EXPREGS[5]);
}
break;
case 2: setprg8(A, ((hiblock | (EXPREGS[1] & 0x78)) << 1) | (V & 0x0F));
if(extra)
{
setprg8(0xC000,EXPREGS[4]);
setprg8(0xE000,EXPREGS[5]);
}
break;
case 3: setprg16(0x8000,(bank | block));
setprg16(0xC000,(bank | block));
break;
case 4: setprg32(0x8000,(bank | block) >> 1);
break;
}
setprg8r(0x10,0x6000,A001B&3);
}
static DECLFW(BMCFK23CHiWrite)
{
if(EXPREGS[0]&0x40)
{
if(EXPREGS[0]&0x30)
unromchr=0;
else
{
unromchr=V&3;
FixMMC3CHR(MMC3_cmd);
}
}
else
{
if((A==0x8001)&&(EXPREGS[3]&2)&&(MMC3_cmd&8))
{
EXPREGS[4|(MMC3_cmd&3)]=V;
FixMMC3PRG(MMC3_cmd);
FixMMC3CHR(MMC3_cmd);
}
else
if(A<0xC000) {
if(UNIFchrrama) { /* hacky... strange behaviour, must be bit scramble due to pcb layot restrictions*/
/* check if it not interfer with other dumps*/
if((A==0x8000)&&(V==0x46))
V=0x47;
else if((A==0x8000)&&(V==0x47))
V=0x46;
}
MMC3_CMDWrite(A,V);
FixMMC3PRG(MMC3_cmd);
}
else
MMC3_IRQWrite(A,V);
}
}
static DECLFW(BMCFK23CWrite)
{
/* FCEU_printf("lo %04x:%02x\n",A,V);*/
if(dipswitch) /* íóëåâîé äèï áåðåò ëþáûå çàïèñè ïî äåôîëòó, äàëüøå èäåò âûáîð*/
{
if(A&(1<<(dipswitch+3))) {
EXPREGS[A&3]=V;
/* FCEU_printf(" reg %d set!\n",A&3);*/
FixMMC3PRG(MMC3_cmd);
FixMMC3CHR(MMC3_cmd);
}
}
else
{
EXPREGS[A&3]=V;
/* FCEU_printf(" reg %d set!\n",A&3);*/
FixMMC3PRG(MMC3_cmd);
FixMMC3CHR(MMC3_cmd);
}
}
static void BMCFK23CReset(void)
{
if(dipswitch<=8)
dipswitch++;
else
dipswitch=0;
EXPREGS[0]=EXPREGS[1]=EXPREGS[2]=EXPREGS[3]=0;
EXPREGS[4]=EXPREGS[5]=EXPREGS[6]=EXPREGS[7]=0xFF;
MMC3RegReset();
FixMMC3PRG(MMC3_cmd);
FixMMC3CHR(MMC3_cmd);
}
static void BMCFK23CPower(void)
{
GenMMC3Power();
EXPREGS[0]=4;
EXPREGS[1]=0xFF;
EXPREGS[2]=EXPREGS[3]=0;
dipswitch = 0;
EXPREGS[4]=EXPREGS[5]=EXPREGS[6]=EXPREGS[7]=0xFF;
SetWriteHandler(0x5000,0x5fff,BMCFK23CWrite);
SetWriteHandler(0x8000,0xFFFF,BMCFK23CHiWrite);
FixMMC3PRG(MMC3_cmd);
FixMMC3CHR(MMC3_cmd);
}
static void BMCFK23CAPower(void)
{
GenMMC3Power();
dipswitch = 0;
EXPREGS[0]=EXPREGS[1]=EXPREGS[2]=EXPREGS[3]=0;
EXPREGS[4]=EXPREGS[5]=EXPREGS[6]=EXPREGS[7]=0xFF;
SetWriteHandler(0x5000,0x5fff,BMCFK23CWrite);
SetWriteHandler(0x8000,0xFFFF,BMCFK23CHiWrite);
FixMMC3PRG(MMC3_cmd);
FixMMC3CHR(MMC3_cmd);
}
static void BMCFK23CAClose(void)
{
if(CHRRAM)
free(CHRRAM);
CHRRAM = NULL;
}
void BMCFK23C_Init(CartInfo *info)
{
GenMMC3_Init(info, 512, 256, 128, 0);
cwrap=BMCFK23CCW;
pwrap=BMCFK23CPW;
info->Power=BMCFK23CPower;
info->Reset=BMCFK23CReset;
AddExState(EXPREGS, 8, 0, "EXPR");
AddExState(&unromchr, 1, 0, "UNCHR");
AddExState(&dipswitch, 1, 0, "DIPSW");
}
void BMCFK23CA_Init(CartInfo *info)
{
GenMMC3_Init(info, 512, 256, 128, 0);
cwrap=BMCFK23CCW;
pwrap=BMCFK23CPW;
info->Power=BMCFK23CAPower;
info->Reset=BMCFK23CReset;
info->Close=BMCFK23CAClose;
CHRRAMSize=8192;
CHRRAM=(uint8*)FCEU_gmalloc(CHRRAMSize);
SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSize, 1);
AddExState(CHRRAM, CHRRAMSize, 0, "CHRRAM");
AddExState(EXPREGS, 8, 0, "EXPR");
AddExState(&unromchr, 1, 0, "UNCHR");
AddExState(&dipswitch, 1, 0, "DIPSW");
}
@@ -1,106 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2007 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
* 63in1 ghostbusters
*/
#include "mapinc.h"
static uint8 reg[2], bank;
static uint8 banks[4] = {0, 0, 1, 2};
static uint8 *CHRROM=NULL;
static uint32 CHRROMSIZE;
static SFORMAT StateRegs[]=
{
{reg, 2, "REGS"},
{&bank, 1, "BANK"},
{0}
};
static void Sync(void)
{
if(reg[0]&0x20)
{
setprg16r(banks[bank],0x8000,reg[0]&0x1F);
setprg16r(banks[bank],0xC000,reg[0]&0x1F);
}
else
setprg32r(banks[bank],0x8000,(reg[0]>>1)&0x0F);
if(reg[1]&2)
setchr8r(0x10,0);
else
setchr8(0);
setmirror((reg[0]&0x40)>>6);
}
static DECLFW(BMCGhostbusters63in1Write)
{
reg[A&1]=V;
bank=((reg[0]&0x80)>>7)|((reg[1]&1)<<1);
/* FCEU_printf("reg[0]=%02x, reg[1]=%02x, bank=%02x\n",reg[0],reg[1],bank);*/
Sync();
}
static DECLFR(BMCGhostbusters63in1Read)
{
if(bank==1)
return X.DB;
else
return CartBR(A);
}
static void BMCGhostbusters63in1Power(void)
{
reg[0]=reg[1]=0;
Sync();
SetReadHandler(0x8000,0xFFFF,BMCGhostbusters63in1Read);
SetWriteHandler(0x8000,0xFFFF,BMCGhostbusters63in1Write);
}
static void BMCGhostbusters63in1Reset(void)
{
reg[0]=reg[1]=0;
}
static void StateRestore(int version)
{
Sync();
}
static void BMCGhostbusters63in1Close(void)
{
if(CHRROM)
free(CHRROM);
CHRROM=NULL;
}
void BMCGhostbusters63in1_Init(CartInfo *info)
{
info->Reset=BMCGhostbusters63in1Reset;
info->Power=BMCGhostbusters63in1Power;
info->Close=BMCGhostbusters63in1Close;
CHRROMSIZE=8192; /* dummy CHRROM, VRAM disable*/
CHRROM=(uint8*)FCEU_gmalloc(CHRROMSIZE);
SetupCartPRGMapping(0x10,CHRROM,CHRROMSIZE,0);
AddExState(CHRROM, CHRROMSIZE, 0, "CHRROM");
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
-69
View File
@@ -1,69 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2007 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, mirr;
static SFORMAT StateRegs[]=
{
{&reg, 1, "REGS"},
{&mirr, 1, "MIRR"},
{0}
};
static void Sync(void)
{
setprg8r(0,0x6000,~0);
setprg32r((reg&8)>>3,0x8000,reg);
setchr8(0);
}
static DECLFW(BMCGS2013Write)
{
reg=V;
Sync();
}
static void BMCGS2013Power(void)
{
reg=~0;
Sync();
SetReadHandler(0x6000,0x7FFF,CartBR);
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x8000,0xFFFF,BMCGS2013Write);
}
static void BMCGS2013Reset(void)
{
reg=~0;
}
static void StateRestore(int version)
{
Sync();
}
void BMCGS2013_Init(CartInfo *info)
{
info->Reset=BMCGS2013Reset;
info->Power=BMCGS2013Power;
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
-80
View File
@@ -1,80 +0,0 @@
/* 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"
extern uint8 m114_perm[8];
static void H2288PW(uint32 A, uint8 V)
{
if(EXPREGS[0]&0x40)
{
uint8 bank=(EXPREGS[0]&5)|((EXPREGS[0]&8)>>2)|((EXPREGS[0]&0x20)>>2);
if(EXPREGS[0]&2)
setprg32(0x8000,bank>>1);
else
{
setprg16(0x8000,bank);
setprg16(0xC000,bank);
}
}
else
setprg8(A,V&0x3F);
}
static DECLFW(H2288WriteHi)
{
switch (A&0x8001)
{
case 0x8000: MMC3_CMDWrite(0x8000,(V&0xC0)|(m114_perm[V&7])); break;
case 0x8001: MMC3_CMDWrite(0x8001,V); break;
}
}
static DECLFW(H2288WriteLo)
{
if(A&0x800)
{
if(A&1)
EXPREGS[1]=V;
else
EXPREGS[0]=V;
FixMMC3PRG(MMC3_cmd);
}
}
static void H2288Power(void)
{
EXPREGS[0]=EXPREGS[1]=0;
GenMMC3Power();
/* SetReadHandler(0x5000,0x5FFF,H2288Read);*/
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x5000,0x5FFF,H2288WriteLo);
SetWriteHandler(0x8000,0x9FFF,H2288WriteHi);
}
void UNLH2288_Init(CartInfo *info)
{
GenMMC3_Init(info, 256, 256, 0, 0);
pwrap=H2288PW;
info->Power=H2288Power;
AddExState(EXPREGS, 2, 0, "EXPR");
}
-238
View File
@@ -1,238 +0,0 @@
/* 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
*
* CAI Shogakko no Sansu
*/
#include "mapinc.h"
static uint8 QTAINTRAM[2048];
static writefunc old2007wrap;
static uint16 CHRSIZE = 8192;
static uint16 WRAMSIZE = 8192 + 4096;
static uint8 *CHRRAM = NULL;
static uint8 *WRAM = NULL;
static uint8 IRQa, K4IRQ;
static uint32 IRQLatch, IRQCount;
static uint8 regs[16];
/*static uint8 test[8];*/
static SFORMAT StateRegs[]=
{
{&IRQCount, 1, "IRQC"},
{&IRQLatch, 1, "IRQL"},
{&IRQa, 1, "IRQA"},
{&K4IRQ, 1, "K4IRQ"},
{regs, 16, "REGS"},
{0}
};
static void chrSync(void)
{
setchr4r(0x10,0x0000,regs[5]&1);
setchr4r(0x10,0x1000,0);
}
static void Sync(void)
{
chrSync();
/* if(regs[0xA]&0x10)*/
/* {*/
/* setchr1r(0x10,0x0000,(((regs[5]&1))<<2)+0);
setchr1r(0x10,0x0400,(((regs[5]&1))<<2)+1);
setchr1r(0x10,0x0800,(((regs[5]&1))<<2)+2);
setchr1r(0x10,0x0c00,(((regs[5]&1))<<2)+3);
setchr1r(0x10,0x1000,0);
setchr1r(0x10,0x1400,1);
setchr1r(0x10,0x1800,2);
setchr1r(0x10,0x1c00,3);*/
/* setchr1r(0x10,0x0000,(((regs[5]&1))<<2)+0);
setchr1r(0x10,0x0400,(((regs[5]&1))<<2)+1);
setchr1r(0x10,0x0800,(((regs[5]&1))<<2)+2);
setchr1r(0x10,0x0c00,(((regs[5]&1))<<2)+3);
setchr1r(0x10,0x1000,(((regs[5]&1)^1)<<2)+4);
setchr1r(0x10,0x1400,(((regs[5]&1)^1)<<2)+5);
setchr1r(0x10,0x1800,(((regs[5]&1)^1)<<2)+6);
setchr1r(0x10,0x1c00,(((regs[5]&1)^1)<<2)+7);
*/
/* }*/
/* else*/
/* {*/
/*
setchr1r(0x10,0x0000,(((regs[5]&1)^1)<<2)+0);
setchr1r(0x10,0x0400,(((regs[5]&1)^1)<<2)+1);
setchr1r(0x10,0x0800,(((regs[5]&1)^1)<<2)+2);
setchr1r(0x10,0x0c00,(((regs[5]&1)^1)<<2)+3);
setchr1r(0x10,0x1000,(((regs[5]&1))<<2)+4);
setchr1r(0x10,0x1400,(((regs[5]&1))<<2)+5);
setchr1r(0x10,0x1800,(((regs[5]&1))<<2)+6);
setchr1r(0x10,0x1c00,(((regs[5]&1))<<2)+7);
}*/
/* setchr1r(1,0x0000,test[0]);
setchr1r(1,0x0400,test[1]);
setchr1r(1,0x0800,test[2]);
setchr1r(1,0x0c00,test[3]);
setchr1r(1,0x1000,test[4]);
setchr1r(1,0x1400,test[5]);
setchr1r(1,0x1800,test[6]);
setchr1r(1,0x1c00,test[7]);
*/
setprg4r(0x10,0x6000,regs[0]&1);
if(regs[2]>=0x40)
setprg8r(1,0x8000,(regs[2]-0x40));
else
setprg8r(0,0x8000,(regs[2]&0x3F));
if(regs[3]>=0x40)
setprg8r(1,0xA000,(regs[3]-0x40));
else
setprg8r(0,0xA000,(regs[3]&0x3F));
if(regs[4]>=0x40)
setprg8r(1,0xC000,(regs[4]-0x40));
else
setprg8r(0,0xC000,(regs[4]&0x3F));
setprg8r(1,0xE000,~0);
setmirror(MI_V);
}
/*static DECLFW(TestWrite)
{
test[A&7] = V;
Sync();
}*/
static DECLFW(M190Write)
{
/* FCEU_printf("write %04x:%04x %d, %d\n",A,V,scanline,timestamp);*/
regs[(A&0x0F00)>>8]=V;
switch(A)
{
case 0xd600:IRQLatch&=0xFF00;IRQLatch|=V;break;
case 0xd700:IRQLatch&=0x00FF;IRQLatch|=V<<8;break;
case 0xd900:IRQCount=IRQLatch;IRQa=V&2;K4IRQ=V&1;X6502_IRQEnd(FCEU_IQEXT);break;
case 0xd800:IRQa=K4IRQ;X6502_IRQEnd(FCEU_IQEXT);break;
}
Sync();
}
static DECLFR(M190Read)
{
/* FCEU_printf("read %04x:%04x %d, %d\n",A,regs[(A&0x0F00)>>8],scanline,timestamp);*/
return regs[(A&0x0F00)>>8]+regs[0x0B];
}
static void VRC5IRQ(int a)
{
if(IRQa)
{
IRQCount+=a;
if(IRQCount&0x10000)
{
X6502_IRQBegin(FCEU_IQEXT);
IRQCount=IRQLatch;
}
}
}
/*static void Mapper190_PPU(uint32 A)*/
/*{*/
/* if(A<0x2000)*/
/* setchr4r(0x10,0x1000,QTAINTRAM[A&0x1FFF]&1);*/
/* else*/
/* chrSync();*/
/*}*/
static DECLFW(M1902007Wrap)
{
if(A>=0x2000)
{
if(regs[0xA]&1)
QTAINTRAM[A&0x1FFF]=V;
else
old2007wrap(A,V);
}
}
static void M190Power(void)
{
/* test[0]=0;
test[1]=1;
test[2]=2;
test[3]=3;
test[4]=4;
test[5]=5;
test[6]=6;
test[7]=7;
*/
setprg4r(0x10,0x7000,2);
old2007wrap=GetWriteHandler(0x2007);
SetWriteHandler(0x2007,0x2007,M1902007Wrap);
SetReadHandler(0x6000,0xFFFF,CartBR);
/* SetWriteHandler(0x5000,0x5007,TestWrite);*/
SetWriteHandler(0x6000,0x7FFF,CartBW);
SetWriteHandler(0x8000,0xFFFF,M190Write);
SetReadHandler(0xDC00,0xDC00,M190Read);
SetReadHandler(0xDD00,0xDD00,M190Read);
Sync();
}
static void M190Close(void)
{
if(CHRRAM)
free(CHRRAM);
CHRRAM=NULL;
if(WRAM)
free(WRAM);
WRAM=NULL;
}
static void StateRestore(int version)
{
Sync();
}
void Mapper190_Init(CartInfo *info)
{
info->Power=M190Power;
info->Close=M190Close;
GameStateRestore=StateRestore;
MapIRQHook=VRC5IRQ;
/* PPU_hook=Mapper190_PPU;*/
CHRRAM=(uint8*)FCEU_gmalloc(CHRSIZE);
SetupCartCHRMapping(0x10,CHRRAM,CHRSIZE,1);
AddExState(CHRRAM, CHRSIZE, 0, "CHRRAM");
WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1);
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
if(info->battery)
{
info->SaveGame[0] = WRAM;
info->SaveGameLen[0] = WRAMSIZE - 4096;
}
AddExState(&StateRegs, ~0, 0, 0);
}
-445
View File
@@ -1,445 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 1998 BERO
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
static void GenMMC1Power(void);
static void GenMMC1Init(CartInfo *info, int prg, int chr, int wram, int battery);
static uint8 BufferShift,DRegs[4];
static uint8 Buffer;
static int mmc1opts;
static void (*MMC1CHRHook4)(uint32 A, uint8 V);
static void (*MMC1PRGHook16)(uint32 A, uint8 V);
static uint8 *WRAM=NULL;
static uint8 *CHRRAM=NULL;
static int is155, is171;
static DECLFW(MBWRAM)
{
if(!(DRegs[3]&0x10)||is155)
Page[A>>11][A]=V; /* WRAM is enabled.*/
}
static DECLFR(MAWRAM)
{
if((DRegs[3]&0x10)&&!is155)
return X.DB; /* WRAM is disabled*/
return(Page[A>>11][A]);
}
static void MMC1CHR(void)
{
if(mmc1opts&4)
{
if(DRegs[0]&0x10)
setprg8r(0x10,0x6000,(DRegs[1]>>4)&1);
else
setprg8r(0x10,0x6000,(DRegs[1]>>3)&1);
}
if(MMC1CHRHook4)
{
if(DRegs[0]&0x10)
{
MMC1CHRHook4(0x0000,DRegs[1]);
MMC1CHRHook4(0x1000,DRegs[2]);
}
else
{
MMC1CHRHook4(0x0000,(DRegs[1]&0xFE));
MMC1CHRHook4(0x1000,DRegs[1]|1);
}
}
else
{
if(DRegs[0]&0x10)
{
setchr4(0x0000,DRegs[1]);
setchr4(0x1000,DRegs[2]);
}
else
setchr8(DRegs[1]>>1);
}
}
static void MMC1PRG(void)
{
uint8 offs=DRegs[1]&0x10;
if(MMC1PRGHook16)
{
switch(DRegs[0]&0xC)
{
case 0xC: MMC1PRGHook16(0x8000,(DRegs[3]+offs));
MMC1PRGHook16(0xC000,0xF+offs);
break;
case 0x8: MMC1PRGHook16(0xC000,(DRegs[3]+offs));
MMC1PRGHook16(0x8000,offs);
break;
case 0x0:
case 0x4:
MMC1PRGHook16(0x8000,((DRegs[3]&~1)+offs));
MMC1PRGHook16(0xc000,((DRegs[3]&~1)+offs+1));
break;
}
}
else
{
switch(DRegs[0]&0xC)
{
case 0xC: setprg16(0x8000,(DRegs[3]+offs));
setprg16(0xC000,0xF+offs);
break;
case 0x8: setprg16(0xC000,(DRegs[3]+offs));
setprg16(0x8000,offs);
break;
case 0x0:
case 0x4:
setprg16(0x8000,((DRegs[3]&~1)+offs));
setprg16(0xc000,((DRegs[3]&~1)+offs+1));
break;
}
}
}
static void MMC1MIRROR(void)
{
if(!is171)
switch(DRegs[0]&3)
{
case 2: setmirror(MI_V); break;
case 3: setmirror(MI_H); break;
case 0: setmirror(MI_0); break;
case 1: setmirror(MI_1); break;
}
}
static uint64 lreset;
static DECLFW(MMC1_write)
{
int n=(A>>13)-4;
/*FCEU_DispMessage("%016x",timestampbase+timestamp);*/
/* FCEU_printf("$%04x:$%02x, $%04x\n",A,V,X.PC);*/
/*DumpMem("out",0xe000,0xffff);*/
/* The MMC1 is busy so ignore the write. */
/* As of version FCE Ultra 0.81, the timestamp is only
increased before each instruction is executed(in other words
precision isn't that great), but this should still work to
deal with 2 writes in a row from a single RMW instruction.
*/
if((timestampbase+timestamp)<(lreset+2))
return;
/* FCEU_printf("Write %04x:%02x\n",A,V);*/
if(V&0x80)
{
DRegs[0]|=0xC;
BufferShift=Buffer=0;
MMC1PRG();
lreset=timestampbase+timestamp;
return;
}
Buffer|=(V&1)<<(BufferShift++);
if(BufferShift==5)
{
/* FCEU_printf("REG[%d]=%02x\n",n,Buffer);*/
DRegs[n] = Buffer;
BufferShift = Buffer = 0;
switch(n)
{
case 0: MMC1MIRROR(); MMC1CHR(); MMC1PRG(); break;
case 1: MMC1CHR(); MMC1PRG(); break;
case 2: MMC1CHR(); break;
case 3: MMC1PRG(); break;
}
}
}
static void MMC1_Restore(int version)
{
MMC1MIRROR();
MMC1CHR();
MMC1PRG();
lreset=0; /* timestamp(base) is not stored in save states. */
}
static void MMC1CMReset(void)
{
int i;
for(i=0;i<4;i++)
DRegs[i]=0;
Buffer = BufferShift = 0;
DRegs[0]=0x1F;
DRegs[1]=0;
DRegs[2]=0; /* Should this be something other than 0?*/
DRegs[3]=0;
MMC1MIRROR();
MMC1CHR();
MMC1PRG();
}
static int DetectMMC1WRAMSize(uint32 crc32)
{
switch(crc32)
{
case 0xc6182024: /* Romance of the 3 Kingdoms */
case 0x2225c20f: /* Genghis Khan */
case 0x4642dda6: /* Nobunaga's Ambition */
case 0x29449ba9: /* "" "" (J) */
case 0x2b11e0b0: /* "" "" (J) */
case 0xb8747abf: /* Best Play Pro Yakyuu Special (J) */
case 0xc9556b36: /* Final Fantasy I & II (J) [!] */
FCEU_printf(" >8KB external WRAM present. Use UNIF if you hack the ROM image.\n");
return(16);
break;
default:return(8);
}
}
static uint32 NWCIRQCount;
static uint8 NWCRec;
#define NWCDIP 0xE
static void NWCIRQHook(int a)
{
if(!(NWCRec&0x10))
{
NWCIRQCount+=a;
if((NWCIRQCount|(NWCDIP<<25))>=0x3e000000)
{
NWCIRQCount=0;
X6502_IRQBegin(FCEU_IQEXT);
}
}
}
static void NWCCHRHook(uint32 A, uint8 V)
{
if((V&0x10)) /* && !(NWCRec&0x10))*/
{
NWCIRQCount=0;
X6502_IRQEnd(FCEU_IQEXT);
}
NWCRec=V;
if(V&0x08)
MMC1PRG();
else
setprg32(0x8000,(V>>1)&3);
}
static void NWCPRGHook(uint32 A, uint8 V)
{
if(NWCRec&0x8)
setprg16(A,8|(V&0x7));
else
setprg32(0x8000,(NWCRec>>1)&3);
}
static void NWCPower(void)
{
GenMMC1Power();
setchr8r(0,0);
}
void Mapper105_Init(CartInfo *info)
{
GenMMC1Init(info, 256, 256, 8, 0);
MMC1CHRHook4=NWCCHRHook;
MMC1PRGHook16=NWCPRGHook;
MapIRQHook=NWCIRQHook;
info->Power=NWCPower;
}
static void GenMMC1Power(void)
{
lreset=0;
if(mmc1opts&1)
{
FCEU_CheatAddRAM(8,0x6000,WRAM);
if(mmc1opts&4)
FCEU_dwmemset(WRAM,0,8192)
else if(!(mmc1opts&2))
FCEU_dwmemset(WRAM,0,8192);
}
SetWriteHandler(0x8000,0xFFFF,MMC1_write);
SetReadHandler(0x8000,0xFFFF,CartBR);
if(mmc1opts&1)
{
SetReadHandler(0x6000,0x7FFF,MAWRAM);
SetWriteHandler(0x6000,0x7FFF,MBWRAM);
setprg8r(0x10,0x6000,0);
}
MMC1CMReset();
}
static void GenMMC1Close(void)
{
if(CHRRAM)
free(CHRRAM);
if(WRAM)
free(WRAM);
CHRRAM=WRAM=NULL;
}
static void GenMMC1Init(CartInfo *info, int prg, int chr, int wram, int battery)
{
is155=0;
info->Close=GenMMC1Close;
MMC1PRGHook16=MMC1CHRHook4=0;
mmc1opts=0;
PRGmask16[0]&=(prg>>14)-1;
CHRmask4[0]&=(chr>>12)-1;
CHRmask8[0]&=(chr>>13)-1;
if(wram)
{
WRAM=(uint8*)FCEU_gmalloc(wram*1024);
mmc1opts|=1;
if(wram>8) mmc1opts|=4;
SetupCartPRGMapping(0x10,WRAM,wram*1024,1);
AddExState(WRAM, wram*1024, 0, "WRAM");
if(battery)
{
mmc1opts|=2;
info->SaveGame[0]=WRAM+((mmc1opts&4)?8192:0);
info->SaveGameLen[0]=8192;
}
}
if(!chr)
{
CHRRAM=(uint8*)FCEU_gmalloc(8192);
SetupCartCHRMapping(0, CHRRAM, 8192, 1);
AddExState(CHRRAM, 8192, 0, "CHRR");
}
AddExState(DRegs, 4, 0, "DREG");
info->Power=GenMMC1Power;
GameStateRestore=MMC1_Restore;
AddExState(&lreset, 8, 1, "LRST");
}
void Mapper1_Init(CartInfo *info)
{
int ws=DetectMMC1WRAMSize(info->CRC32);
GenMMC1Init(info, 512, 256, ws, info->battery);
}
/* Same as mapper 1, without respect for WRAM enable bit. */
void Mapper155_Init(CartInfo *info)
{
GenMMC1Init(info,512,256,8,info->battery);
is155=1;
}
/* Same as mapper 1, with different (or without) mirroring control. */
/* Kaiser KS7058 board, KS203 custom chip */
void Mapper171_Init(CartInfo *info)
{
GenMMC1Init(info,32,32,0,0);
is171=1;
}
void SAROM_Init(CartInfo *info)
{
GenMMC1Init(info, 128, 64, 8, info->battery);
}
void SBROM_Init(CartInfo *info)
{
GenMMC1Init(info, 128, 64, 0, 0);
}
void SCROM_Init(CartInfo *info)
{
GenMMC1Init(info, 128, 128, 0, 0);
}
void SEROM_Init(CartInfo *info)
{
GenMMC1Init(info, 32, 64, 0, 0);
}
void SGROM_Init(CartInfo *info)
{
GenMMC1Init(info, 256, 0, 0, 0);
}
void SKROM_Init(CartInfo *info)
{
GenMMC1Init(info, 256, 64, 8, info->battery);
}
void SLROM_Init(CartInfo *info)
{
GenMMC1Init(info, 256, 128, 0, 0);
}
void SL1ROM_Init(CartInfo *info)
{
GenMMC1Init(info, 128, 128, 0, 0);
}
/* Begin unknown - may be wrong - perhaps they use different MMC1s from the
similarly functioning boards?
*/
void SL2ROM_Init(CartInfo *info)
{
GenMMC1Init(info, 256, 256, 0, 0);
}
void SFROM_Init(CartInfo *info)
{
GenMMC1Init(info, 256, 256, 0, 0);
}
void SHROM_Init(CartInfo *info)
{
GenMMC1Init(info, 256, 256, 0, 0);
}
/* End unknown */
/* */
/* */
void SNROM_Init(CartInfo *info)
{
GenMMC1Init(info, 256, 0, 8, info->battery);
}
void SOROM_Init(CartInfo *info)
{
GenMMC1Init(info, 256, 0, 16, info->battery);
}
File diff suppressed because it is too large Load Diff
-831
View File
@@ -1,831 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* None of this code should use any of the iNES bank switching wrappers. */
#include "mapinc.h"
static void (*sfun)(int P);
static void (*psfun)(void);
void MMC5RunSound(int Count);
void MMC5RunSoundHQ(void);
static INLINE void MMC5SPRVROM_BANK1(uint32 A,uint32 V)
{
if(CHRptr[0])
{
V&=CHRmask1[0];
MMC5SPRVPage[(A)>>10]=&CHRptr[0][(V)<<10]-(A);
}
}
static INLINE void MMC5BGVROM_BANK1(uint32 A,uint32 V) {if(CHRptr[0]){V&=CHRmask1[0];MMC5BGVPage[(A)>>10]=&CHRptr[0][(V)<<10]-(A);}}
static INLINE void MMC5SPRVROM_BANK2(uint32 A,uint32 V) {if(CHRptr[0]){V&=CHRmask2[0];MMC5SPRVPage[(A)>>10]=MMC5SPRVPage[((A)>>10)+1]=&CHRptr[0][(V)<<11]-(A);}}
static INLINE void MMC5BGVROM_BANK2(uint32 A,uint32 V) {if(CHRptr[0]){V&=CHRmask2[0];MMC5BGVPage[(A)>>10]=MMC5BGVPage[((A)>>10)+1]=&CHRptr[0][(V)<<11]-(A);}}
static INLINE void MMC5SPRVROM_BANK4(uint32 A,uint32 V) {if(CHRptr[0]){V&=CHRmask4[0];MMC5SPRVPage[(A)>>10]=MMC5SPRVPage[((A)>>10)+1]= MMC5SPRVPage[((A)>>10)+2]=MMC5SPRVPage[((A)>>10)+3]=&CHRptr[0][(V)<<12]-(A);}}
static INLINE void MMC5BGVROM_BANK4(uint32 A,uint32 V) {if(CHRptr[0]){V&=CHRmask4[0];MMC5BGVPage[(A)>>10]=MMC5BGVPage[((A)>>10)+1]=MMC5BGVPage[((A)>>10)+2]=MMC5BGVPage[((A)>>10)+3]=&CHRptr[0][(V)<<12]-(A);}}
static INLINE void MMC5SPRVROM_BANK8(uint32 V) {if(CHRptr[0]){V&=CHRmask8[0];MMC5SPRVPage[0]=MMC5SPRVPage[1]=MMC5SPRVPage[2]=MMC5SPRVPage[3]=MMC5SPRVPage[4]=MMC5SPRVPage[5]=MMC5SPRVPage[6]=MMC5SPRVPage[7]=&CHRptr[0][(V)<<13];}}
static INLINE void MMC5BGVROM_BANK8(uint32 V) {if(CHRptr[0]){V&=CHRmask8[0];MMC5BGVPage[0]=MMC5BGVPage[1]=MMC5BGVPage[2]=MMC5BGVPage[3]=MMC5BGVPage[4]=MMC5BGVPage[5]=MMC5BGVPage[6]=MMC5BGVPage[7]=&CHRptr[0][(V)<<13];}}
static uint8 PRGBanks[4];
static uint8 WRAMPage;
static uint8 CHRBanksA[8], CHRBanksB[4];
static uint8 WRAMMaskEnable[2];
static uint8 ABMode; /* A=0, B=1 */
static uint8 IRQScanline,IRQEnable;
static uint8 CHRMode, NTAMirroring, NTFill, ATFill;
static uint8 MMC5IRQR;
static uint8 MMC5LineCounter;
static uint8 mmc5psize, mmc5vsize;
static uint8 mul[2];
static uint8 *WRAM=NULL;
static uint8 *MMC5fill=NULL;
static uint8 *ExRAM=NULL;
static uint8 MMC5WRAMsize;
static uint8 MMC5WRAMIndex[8];
static uint8 MMC5ROMWrProtect[4];
static uint8 MMC5MemIn[5];
static void MMC5CHRA(void);
static void MMC5CHRB(void);
typedef struct __cartdata {
uint32 crc32;
uint8 size;
} cartdata;
/* ETROM seems to have 16KB of WRAM, ELROM seems to have 8KB*/
/* EWROM seems to have 32KB of WRAM*/
cartdata MMC5CartList[]=
{
{0x9c18762b,2}, /* L'Empereur */
{0x26533405,2},
{0x6396b988,2},
{0xaca15643,2}, /* Uncharted Waters */
{0xfe3488d1,2}, /* Dai Koukai Jidai */
{0x15fe6d0f,2}, /* BKAC */
{0x39f2ce4b,2}, /* Suikoden */
{0x8ce478db,2}, /* Nobunaga's Ambition 2 */
{0xeee9a682,2},
{0xf9b4240f,2},
{0x1ced086f,2}, /* Ishin no Arashi */
{0xf540677b,4}, /* Nobunaga...Bushou Fuuun Roku */
{0x6f4e4312,4}, /* Aoki Ookami..Genchou */
{0xf011e490,4}, /* Romance of the 3 Kingdoms 2 */
{0x184c2124,4}, /* Sangokushi 2 */
{0xee8e6553,4},
};
#define MMC5_NOCARTS (sizeof(MMC5CartList)/sizeof(MMC5CartList[0]))
int DetectMMC5WRAMSize(uint32 crc32)
{
int x;
for(x=0;x<MMC5_NOCARTS;x++)
if(crc32==MMC5CartList[x].crc32)
{
FCEU_printf(" >8KB external WRAM present. Use UNIF if you hack the ROM image.\n");
return(MMC5CartList[x].size*8);
}
return(8);
}
static void BuildWRAMSizeTable(void)
{
int x;
for(x=0;x<8;x++)
{
switch(MMC5WRAMsize)
{
case 0: MMC5WRAMIndex[x]=255; break;
case 1: MMC5WRAMIndex[x]=(x>3)?255:0; break;
case 2: MMC5WRAMIndex[x]=(x&4)>>2; break;
case 4: MMC5WRAMIndex[x]=(x>3)?255:(x&3); break;
}
}
}
static void MMC5CHRA(void)
{
int x;
switch(mmc5vsize&3)
{
case 0: setchr8(CHRBanksA[7]);
MMC5SPRVROM_BANK8(CHRBanksA[7]);
break;
case 1: setchr4(0x0000,CHRBanksA[3]);
setchr4(0x1000,CHRBanksA[7]);
MMC5SPRVROM_BANK4(0x0000,CHRBanksA[3]);
MMC5SPRVROM_BANK4(0x1000,CHRBanksA[7]);
break;
case 2: setchr2(0x0000,CHRBanksA[1]);
setchr2(0x0800,CHRBanksA[3]);
setchr2(0x1000,CHRBanksA[5]);
setchr2(0x1800,CHRBanksA[7]);
MMC5SPRVROM_BANK2(0x0000,CHRBanksA[1]);
MMC5SPRVROM_BANK2(0x0800,CHRBanksA[3]);
MMC5SPRVROM_BANK2(0x1000,CHRBanksA[5]);
MMC5SPRVROM_BANK2(0x1800,CHRBanksA[7]);
break;
case 3: for(x=0;x<8;x++)
{
setchr1(x<<10,CHRBanksA[x]);
MMC5SPRVROM_BANK1(x<<10,CHRBanksA[x]);
}
break;
}
}
static void MMC5CHRB(void)
{
int x;
switch(mmc5vsize&3)
{
case 0: setchr8(CHRBanksB[3]);
MMC5BGVROM_BANK8(CHRBanksB[3]);
break;
case 1: setchr4(0x0000,CHRBanksB[3]);
setchr4(0x1000,CHRBanksB[3]);
MMC5BGVROM_BANK4(0x0000,CHRBanksB[3]);
MMC5BGVROM_BANK4(0x1000,CHRBanksB[3]);
break;
case 2: setchr2(0x0000,CHRBanksB[1]);
setchr2(0x0800,CHRBanksB[3]);
setchr2(0x1000,CHRBanksB[1]);
setchr2(0x1800,CHRBanksB[3]);
MMC5BGVROM_BANK2(0x0000,CHRBanksB[1]);
MMC5BGVROM_BANK2(0x0800,CHRBanksB[3]);
MMC5BGVROM_BANK2(0x1000,CHRBanksB[1]);
MMC5BGVROM_BANK2(0x1800,CHRBanksB[3]);
break;
case 3: for(x=0;x<8;x++)
{
setchr1(x<<10,CHRBanksB[x&3]);
MMC5BGVROM_BANK1(x<<10,CHRBanksB[x&3]);
}
break;
}
}
static void MMC5WRAM(uint32 A, uint32 V)
{
/*printf("%02x\n",V);*/
V=MMC5WRAMIndex[V&7];
if(V!=255)
{
setprg8r(0x10,A,V);
MMC5MemIn[(A-0x6000)>>13]=1;
}
else
MMC5MemIn[(A-0x6000)>>13]=0;
}
static void MMC5PRG(void)
{
int x;
switch(mmc5psize&3)
{
case 0: MMC5ROMWrProtect[0]=MMC5ROMWrProtect[1]=
MMC5ROMWrProtect[2]=MMC5ROMWrProtect[3]=1;
setprg32(0x8000,((PRGBanks[1]&0x7F)>>2));
for(x=0;x<4;x++)
MMC5MemIn[1+x]=1;
break;
case 1: if(PRGBanks[1]&0x80)
{
MMC5ROMWrProtect[0]=MMC5ROMWrProtect[1]=1;
setprg16(0x8000,(PRGBanks[1]>>1));
MMC5MemIn[1]=MMC5MemIn[2]=1;
}
else
{
MMC5ROMWrProtect[0]=MMC5ROMWrProtect[1]=0;
MMC5WRAM(0x8000,PRGBanks[1]&7&0xFE);
MMC5WRAM(0xA000,(PRGBanks[1]&7&0xFE)+1);
}
MMC5MemIn[3]=MMC5MemIn[4]=1;
MMC5ROMWrProtect[2]=MMC5ROMWrProtect[3]=1;
setprg16(0xC000,(PRGBanks[3]&0x7F)>>1);
break;
case 2: if(PRGBanks[1]&0x80)
{
MMC5MemIn[1]=MMC5MemIn[2]=1;
MMC5ROMWrProtect[0]=MMC5ROMWrProtect[1]=1;
setprg16(0x8000,(PRGBanks[1]&0x7F)>>1);
}
else
{
MMC5ROMWrProtect[0]=MMC5ROMWrProtect[1]=0;
MMC5WRAM(0x8000,PRGBanks[1]&7&0xFE);
MMC5WRAM(0xA000,(PRGBanks[1]&7&0xFE)+1);
}
if(PRGBanks[2]&0x80)
{
MMC5ROMWrProtect[2]=1;
MMC5MemIn[3]=1;
setprg8(0xC000,PRGBanks[2]&0x7F);
}
else
{
MMC5ROMWrProtect[2]=0;
MMC5WRAM(0xC000,PRGBanks[2]&7);
}
MMC5MemIn[4]=1;
MMC5ROMWrProtect[3]=1;
setprg8(0xE000,PRGBanks[3]&0x7F);
break;
case 3: for(x=0;x<3;x++)
if(PRGBanks[x]&0x80)
{
MMC5ROMWrProtect[x]=1;
setprg8(0x8000+(x<<13),PRGBanks[x]&0x7F);
MMC5MemIn[1+x]=1;
}
else
{
MMC5ROMWrProtect[x]=0;
MMC5WRAM(0x8000+(x<<13),PRGBanks[x]&7);
}
MMC5MemIn[4]=1;
MMC5ROMWrProtect[3]=1;
setprg8(0xE000,PRGBanks[3]&0x7F);
break;
}
}
static DECLFW(Mapper5_write)
{
if(A>=0x5120&&A<=0x5127)
{
ABMode = 0;
CHRBanksA[A&7]=V;
MMC5CHRA();
}
else switch(A)
{
case 0x5105: {
int x;
for(x=0;x<4;x++)
{
switch((V>>(x<<1))&3)
{
case 0:PPUNTARAM|=1<<x;vnapage[x]=NTARAM;break;
case 1:PPUNTARAM|=1<<x;vnapage[x]=NTARAM+0x400;break;
case 2:PPUNTARAM|=1<<x;vnapage[x]=ExRAM;break;
case 3:PPUNTARAM&=~(1<<x);vnapage[x]=MMC5fill;break;
}
}
}
NTAMirroring=V;
break;
case 0x5113: WRAMPage=V;MMC5WRAM(0x6000,V&7);break;
case 0x5100: mmc5psize=V;MMC5PRG();break;
case 0x5101: mmc5vsize=V;
if(!ABMode)
{ MMC5CHRB();MMC5CHRA();}
else
{ MMC5CHRA();MMC5CHRB();}
break;
case 0x5114:
case 0x5115:
case 0x5116:
case 0x5117: PRGBanks[A&3]=V;MMC5PRG();break;
case 0x5128:
case 0x5129:
case 0x512a:
case 0x512b: ABMode=1;
CHRBanksB[A&3]=V;
MMC5CHRB();
break;
case 0x5102: WRAMMaskEnable[0]=V;break;
case 0x5103: WRAMMaskEnable[1]=V;break;
case 0x5104: CHRMode=V;MMC5HackCHRMode=V&3;break;
case 0x5106: if(V!=NTFill)
{
uint32 t;
t=V|(V<<8)|(V<<16)|(V<<24);
FCEU_dwmemset(MMC5fill,t,0x3c0);
}
NTFill=V;
break;
case 0x5107: if(V!=ATFill)
{
unsigned char moop;
uint32 t;
moop=V|(V<<2)|(V<<4)|(V<<6);
t=moop|(moop<<8)|(moop<<16)|(moop<<24);
FCEU_dwmemset(MMC5fill+0x3c0,t,0x40);
}
ATFill=V;
break;
case 0x5200: MMC5HackSPMode=V;break;
case 0x5201: MMC5HackSPScroll=(V>>3)&0x1F;break;
case 0x5202: MMC5HackSPPage=V&0x3F;break;
case 0x5203: X6502_IRQEnd(FCEU_IQEXT);IRQScanline=V;break;
case 0x5204: X6502_IRQEnd(FCEU_IQEXT);IRQEnable=V&0x80;break;
case 0x5205: mul[0]=V;break;
case 0x5206: mul[1]=V;break;
}
}
static DECLFR(MMC5_ReadROMRAM)
{
if(MMC5MemIn[(A-0x6000)>>13])
return Page[A>>11][A];
else
return X.DB;
}
static DECLFW(MMC5_WriteROMRAM)
{
if(A>=0x8000)
if(MMC5ROMWrProtect[(A-0x8000)>>13]) return;
if(MMC5MemIn[(A-0x6000)>>13])
if(((WRAMMaskEnable[0]&3)|((WRAMMaskEnable[1]&3)<<2)) == 6) Page[A>>11][A]=V;
}
static DECLFW(MMC5_ExRAMWr)
{
if(MMC5HackCHRMode!=3)
ExRAM[A&0x3ff]=V;
}
static DECLFR(MMC5_ExRAMRd)
{
/* Not sure if this is correct, so I'll comment it out for now. */
/*if(MMC5HackCHRMode>=2)*/
return ExRAM[A&0x3ff];
/*else*/
/* return(X.DB);*/
}
static DECLFR(MMC5_read)
{
switch(A)
{
case 0x5204: X6502_IRQEnd(FCEU_IQEXT);
{
uint8 x;
x=MMC5IRQR;
MMC5IRQR&=0x40;
return x;
}
case 0x5205: return (mul[0]*mul[1]);
case 0x5206: return ((mul[0]*mul[1])>>8);
}
return(X.DB);
}
void MMC5Synco(void)
{
int x;
MMC5PRG();
for(x=0;x<4;x++)
{
switch((NTAMirroring>>(x<<1))&3)
{
case 0:PPUNTARAM|=1<<x;vnapage[x]=NTARAM;break;
case 1:PPUNTARAM|=1<<x;vnapage[x]=NTARAM+0x400;break;
case 2:PPUNTARAM|=1<<x;vnapage[x]=ExRAM;break;
case 3:PPUNTARAM&=~(1<<x);vnapage[x]=MMC5fill;break;
}
}
MMC5WRAM(0x6000,WRAMPage&7);
if(!ABMode)
{
MMC5CHRB();
MMC5CHRA();
}
else
{
MMC5CHRA();
MMC5CHRB();
}
{
uint32 t;
t=NTFill|(NTFill<<8)|(NTFill<<16)|(NTFill<<24);
FCEU_dwmemset(MMC5fill,t,0x3c0);
}
{
unsigned char moop;
uint32 t;
moop=ATFill|(ATFill<<2)|(ATFill<<4)|(ATFill<<6);
t=moop|(moop<<8)|(moop<<16)|(moop<<24);
FCEU_dwmemset(MMC5fill+0x3c0,t,0x40);
}
X6502_IRQEnd(FCEU_IQEXT);
MMC5HackCHRMode=CHRMode&3;
}
void MMC5_hb(int scanline)
{
if(scanline==240)
{
MMC5LineCounter=0;
MMC5IRQR=0x40;
return;
}
if(MMC5LineCounter<240)
{
if(MMC5LineCounter==IRQScanline)
{
MMC5IRQR|=0x80;
if(IRQEnable&0x80)
X6502_IRQBegin(FCEU_IQEXT);
}
MMC5LineCounter++;
}
if(MMC5LineCounter==240)
MMC5IRQR=0;
}
void MMC5_StateRestore(int version)
{
MMC5Synco();
}
typedef struct {
uint16 wl[2];
uint8 env[2];
uint8 enable;
uint8 running;
uint8 raw;
uint8 rawcontrol;
int32 dcount[2];
int32 BC[3];
int32 vcount[2];
} MMC5APU;
static MMC5APU MMC5Sound;
static void Do5PCM()
{
int32 V;
int32 start,end;
start=MMC5Sound.BC[2];
end=(SOUNDTS<<16)/soundtsinc;
if(end<=start) return;
MMC5Sound.BC[2]=end;
if(!(MMC5Sound.rawcontrol&0x40) && MMC5Sound.raw)
for(V=start;V<end;V++)
Wave[V>>4]+=MMC5Sound.raw<<1;
}
static void Do5PCMHQ()
{
int32 V;
if(!(MMC5Sound.rawcontrol&0x40) && MMC5Sound.raw)
for(V=MMC5Sound.BC[2];V<SOUNDTS;V++)
WaveHi[V]+=MMC5Sound.raw<<5;
MMC5Sound.BC[2]=SOUNDTS;
}
static DECLFW(Mapper5_SW)
{
A&=0x1F;
GameExpSound.Fill=MMC5RunSound;
GameExpSound.HiFill=MMC5RunSoundHQ;
switch(A)
{
case 0x10:if(psfun) psfun();MMC5Sound.rawcontrol=V;break;
case 0x11:if(psfun) psfun();MMC5Sound.raw=V;break;
case 0x0:
case 0x4:/*printf("%04x:$%02x\n",A,V&0x30);*/
if(sfun) sfun(A>>2);
MMC5Sound.env[A>>2]=V;
break;
case 0x2:
case 0x6: if(sfun) sfun(A>>2);
MMC5Sound.wl[A>>2]&=~0x00FF;
MMC5Sound.wl[A>>2]|=V&0xFF;
break;
case 0x3:
case 0x7:/*printf("%04x:$%02x\n",A,V>>3);*/
MMC5Sound.wl[A>>2]&=~0x0700;
MMC5Sound.wl[A>>2]|=(V&0x07)<<8;
MMC5Sound.running|=1<<(A>>2);
break;
case 0x15:if(sfun)
{
sfun(0);
sfun(1);
}
MMC5Sound.running&=V;
MMC5Sound.enable=V;
/*printf("%02x\n",V);*/
break;
}
}
static void Do5SQ(int P)
{
static int tal[4]={1,2,4,6};
int32 V,amp,rthresh,wl;
int32 start,end;
start=MMC5Sound.BC[P];
end=(SOUNDTS<<16)/soundtsinc;
if(end<=start) return;
MMC5Sound.BC[P]=end;
wl=MMC5Sound.wl[P]+1;
amp=(MMC5Sound.env[P]&0xF)<<4;
rthresh=tal[(MMC5Sound.env[P]&0xC0)>>6];
if(wl>=8 && (MMC5Sound.running&(P+1)))
{
int dc,vc;
wl<<=18;
dc=MMC5Sound.dcount[P];
vc=MMC5Sound.vcount[P];
for(V=start;V<end;V++)
{
if(dc<rthresh)
Wave[V>>4]+=amp;
vc-=nesincsize;
while(vc<=0)
{
vc+=wl;
dc=(dc+1)&7;
}
}
MMC5Sound.dcount[P]=dc;
MMC5Sound.vcount[P]=vc;
}
}
static void Do5SQHQ(int P)
{
static int tal[4]={1,2,4,6};
int32 V,amp,rthresh,wl;
wl=MMC5Sound.wl[P]+1;
amp=((MMC5Sound.env[P]&0xF)<<8);
rthresh=tal[(MMC5Sound.env[P]&0xC0)>>6];
if(wl>=8 && (MMC5Sound.running&(P+1)))
{
int dc,vc;
wl<<=1;
dc=MMC5Sound.dcount[P];
vc=MMC5Sound.vcount[P];
for(V=MMC5Sound.BC[P];V<SOUNDTS;V++)
{
if(dc<rthresh)
WaveHi[V]+=amp;
vc--;
if(vc<=0) /* Less than zero when first started. */
{
vc=wl;
dc=(dc+1)&7;
}
}
MMC5Sound.dcount[P]=dc;
MMC5Sound.vcount[P]=vc;
}
MMC5Sound.BC[P]=SOUNDTS;
}
void MMC5RunSoundHQ(void)
{
Do5SQHQ(0);
Do5SQHQ(1);
Do5PCMHQ();
}
void MMC5HiSync(int32 ts)
{
int x;
for(x=0;x<3;x++) MMC5Sound.BC[x]=ts;
}
void MMC5RunSound(int Count)
{
int x;
Do5SQ(0);
Do5SQ(1);
Do5PCM();
for(x=0;x<3;x++)
MMC5Sound.BC[x]=Count;
}
void Mapper5_ESI(void)
{
GameExpSound.RChange=Mapper5_ESI;
if(FSettings.SndRate)
{
#if SOUND_QUALITY == 1
sfun=Do5SQHQ;
psfun=Do5PCMHQ;
#else
sfun=Do5SQ;
psfun=Do5PCM;
#endif
}
else
{
sfun=0;
psfun=0;
}
memset(MMC5Sound.BC,0,sizeof(MMC5Sound.BC));
memset(MMC5Sound.vcount,0,sizeof(MMC5Sound.vcount));
GameExpSound.HiSync=MMC5HiSync;
}
void NSFMMC5_Init(void)
{
memset(&MMC5Sound,0,sizeof(MMC5Sound));
mul[0]=mul[1]=0;
ExRAM=(uint8*)FCEU_gmalloc(1024);
Mapper5_ESI();
SetWriteHandler(0x5c00,0x5fef,MMC5_ExRAMWr);
SetReadHandler(0x5c00,0x5fef,MMC5_ExRAMRd);
MMC5HackCHRMode=2;
SetWriteHandler(0x5000,0x5015,Mapper5_SW);
SetWriteHandler(0x5205,0x5206,Mapper5_write);
SetReadHandler(0x5205,0x5206,MMC5_read);
}
void NSFMMC5_Close(void)
{
free(ExRAM);
ExRAM=0;
}
static void GenMMC5Reset(void)
{
int x;
for(x=0;x<4;x++) PRGBanks[x]=~0;
for(x=0;x<8;x++) CHRBanksA[x]=~0;
for(x=0;x<4;x++) CHRBanksB[x]=~0;
WRAMMaskEnable[0]=WRAMMaskEnable[1]=~0;
mmc5psize=mmc5vsize=3;
CHRMode=0;
NTAMirroring=NTFill=ATFill=0xFF;
MMC5Synco();
SetWriteHandler(0x4020,0x5bff,Mapper5_write);
SetReadHandler(0x4020,0x5bff,MMC5_read);
SetWriteHandler(0x5c00,0x5fff,MMC5_ExRAMWr);
SetReadHandler(0x5c00,0x5fff,MMC5_ExRAMRd);
SetWriteHandler(0x6000,0xFFFF,MMC5_WriteROMRAM);
SetReadHandler(0x6000,0xFFFF,MMC5_ReadROMRAM);
SetWriteHandler(0x5000,0x5015,Mapper5_SW);
SetWriteHandler(0x5205,0x5206,Mapper5_write);
SetReadHandler(0x5205,0x5206,MMC5_read);
/*GameHBIRQHook=MMC5_hb;*/
FCEU_CheatAddRAM(8,0x6000,WRAM);
FCEU_CheatAddRAM(1,0x5c00,ExRAM);
}
static SFORMAT MMC5_StateRegs[]={
{ PRGBanks, 4, "PRGB"},
{ CHRBanksA, 8, "CHRA"},
{ CHRBanksB, 4, "CHRB"},
{ &WRAMPage, 1, "WRMP"},
{ WRAMMaskEnable, 2, "WRME"},
{ &ABMode, 1, "ABMD"},
{ &IRQScanline, 1, "IRQS"},
{ &IRQEnable, 1, "IRQE"},
{ &CHRMode, 1, "CHRM"},
{ &NTAMirroring, 1, "NTAM"},
{ &NTFill, 1, "NTFL"},
{ &ATFill, 1, "ATFL"},
{ &MMC5Sound.wl[0], 2|FCEUSTATE_RLSB, "SDW0"},
{ &MMC5Sound.wl[1], 2|FCEUSTATE_RLSB, "SDW1"},
{ MMC5Sound.env, 2, "SDEV"},
{ &MMC5Sound.enable, 1, "SDEN"},
{ &MMC5Sound.running, 1, "SDRU"},
{ &MMC5Sound.raw, 1, "SDRW"},
{ &MMC5Sound.rawcontrol, 1, "SDRC"},
{0}
};
static void GenMMC5_Init(CartInfo *info, int wsize, int battery)
{
if(wsize)
{
WRAM=(uint8*)FCEU_gmalloc(wsize*1024);
SetupCartPRGMapping(0x10,WRAM,wsize*1024,1);
AddExState(WRAM, wsize*1024, 0, "WRAM");
}
MMC5fill=(uint8*)FCEU_gmalloc(1024);
ExRAM=(uint8*)FCEU_gmalloc(1024);
AddExState(MMC5_StateRegs, ~0, 0, 0);
AddExState(WRAM, wsize*1024, 0, "WRAM");
AddExState(ExRAM, 1024, 0, "ERAM");
AddExState(&MMC5HackSPMode, 1, 0, "SPLM");
AddExState(&MMC5HackSPScroll, 1, 0, "SPLS");
AddExState(&MMC5HackSPPage, 1, 0, "SPLP");
MMC5WRAMsize=wsize/8;
BuildWRAMSizeTable();
GameStateRestore=MMC5_StateRestore;
info->Power=GenMMC5Reset;
if(battery)
{
info->SaveGame[0]=WRAM;
if(wsize<=16)
info->SaveGameLen[0]=8192;
else
info->SaveGameLen[0]=32768;
}
MMC5HackVROMMask=CHRmask4[0];
MMC5HackExNTARAMPtr=ExRAM;
MMC5Hack=1;
MMC5HackVROMPTR=CHRptr[0];
MMC5HackCHRMode=0;
MMC5HackSPMode=MMC5HackSPScroll=MMC5HackSPPage=0;
Mapper5_ESI();
}
void Mapper5_Init(CartInfo *info)
{
GenMMC5_Init(info, DetectMMC5WRAMSize(info->CRC32), info->battery);
}
/* ELROM seems to have 0KB of WRAM*/
/* EKROM seems to have 8KB of WRAM*/
/* ETROM seems to have 16KB of WRAM*/
/* EWROM seems to have 32KB of WRAM*/
/* ETROM and EWROM are battery-backed, EKROM isn't.*/
void ETROM_Init(CartInfo *info)
{
GenMMC5_Init(info, 16,info->battery);
}
void ELROM_Init(CartInfo *info)
{
GenMMC5_Init(info,0,0);
}
void EWROM_Init(CartInfo *info)
{
GenMMC5_Init(info,32,info->battery);
}
void EKROM_Init(CartInfo *info)
{
GenMMC5_Init(info,8,info->battery);
}
-469
View File
@@ -1,469 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
static uint16 IRQCount;
static uint8 IRQa;
static uint8 WRAM[8192];
static uint8 IRAM[128];
static DECLFR(AWRAM)
{
return(WRAM[A-0x6000]);
}
static DECLFW(BWRAM)
{
WRAM[A-0x6000]=V;
}
void Mapper19_ESI(void);
static uint8 NTAPage[4];
static uint8 dopol;
static uint8 gorfus;
static uint8 gorko;
static void NamcoSound(int Count);
static void NamcoSoundHack(void);
static void DoNamcoSound(int32 *Wave, int Count);
static void DoNamcoSoundHQ(void);
static void SyncHQ(int32 ts);
static int is210; /* Lesser mapper. */
static uint8 PRG[3];
static uint8 CHR[8];
static SFORMAT N106_StateRegs[]={
{PRG,3,"PRG"},
{CHR,8,"CHR"},
{NTAPage,4,"NTA"},
{0}
};
static void SyncPRG(void)
{
setprg8(0x8000,PRG[0]);
setprg8(0xa000,PRG[1]);
setprg8(0xc000,PRG[2]);
setprg8(0xe000,0x3F);
}
static void NamcoIRQHook(int a)
{
if(IRQa)
{
IRQCount+=a;
if(IRQCount>=0x7FFF)
{
X6502_IRQBegin(FCEU_IQEXT);
IRQa=0;
IRQCount=0x7FFF; /*7FFF;*/
}
}
}
static DECLFR(Namco_Read4800)
{
uint8 ret=IRAM[dopol&0x7f];
/* Maybe I should call NamcoSoundHack() here? */
if(dopol&0x80)
dopol=(dopol&0x80)|((dopol+1)&0x7f);
return ret;
}
static DECLFR(Namco_Read5000)
{
return(IRQCount);
}
static DECLFR(Namco_Read5800)
{
return(IRQCount>>8);
}
static void DoNTARAMROM(int w, uint8 V)
{
NTAPage[w]=V;
if(V>=0xE0)
setntamem(NTARAM+((V&1)<<10), 1, w);
else
{
V&=CHRmask1[0];
setntamem(CHRptr[0]+(V<<10), 0, w);
}
}
static void FixNTAR(void)
{
int x;
for(x=0;x<4;x++)
DoNTARAMROM(x,NTAPage[x]);
}
static void DoCHRRAMROM(int x, uint8 V)
{
CHR[x]=V;
if(!is210 && !((gorfus>>((x>>2)+6))&1) && (V>=0xE0))
{
/* printf("BLAHAHA: %d, %02x\n",x,V);*/
/*setchr1r(0x10,x<<10,V&7);*/
}
else
setchr1(x<<10,V);
}
static void FixCRR(void)
{
int x;
for(x=0;x<8;x++)
DoCHRRAMROM(x,CHR[x]);
}
static DECLFW(Mapper19C0D8_write)
{
DoNTARAMROM((A-0xC000)>>11,V);
}
static uint32 FreqCache[8];
static uint32 EnvCache[8];
static uint32 LengthCache[8];
static void FixCache(int a,int V)
{
int w=(a>>3)&0x7;
switch(a&0x07)
{
case 0x00:FreqCache[w]&=~0x000000FF;FreqCache[w]|=V;break;
case 0x02:FreqCache[w]&=~0x0000FF00;FreqCache[w]|=V<<8;break;
case 0x04:FreqCache[w]&=~0x00030000;FreqCache[w]|=(V&3)<<16;
LengthCache[w]=(8-((V>>2)&7))<<2;
break;
case 0x07:EnvCache[w]=(double)(V&0xF)*576716;break;
}
}
static DECLFW(Mapper19_write)
{
A&=0xF800;
if(A>=0x8000 && A<=0xb800)
DoCHRRAMROM((A-0x8000)>>11,V);
else switch(A)
{
case 0x4800:
if(dopol&0x40)
{
if(FSettings.SndRate)
{
NamcoSoundHack();
GameExpSound.Fill=NamcoSound;
GameExpSound.HiFill=DoNamcoSoundHQ;
GameExpSound.HiSync=SyncHQ;
}
FixCache(dopol,V);
}
IRAM[dopol&0x7f]=V;
if(dopol&0x80)
dopol=(dopol&0x80)|((dopol+1)&0x7f);
break;
case 0xf800:
dopol=V;break;
case 0x5000:
IRQCount&=0xFF00;IRQCount|=V;X6502_IRQEnd(FCEU_IQEXT);break;
case 0x5800:
IRQCount&=0x00ff;IRQCount|=(V&0x7F)<<8;
IRQa=V&0x80;
X6502_IRQEnd(FCEU_IQEXT);
break;
case 0xE000:
gorko=V&0xC0;
PRG[0]=V&0x3F;
SyncPRG();
break;
case 0xE800:
gorfus=V&0xC0;
FixCRR();
PRG[1]=V&0x3F;
SyncPRG();
break;
case 0xF000:
PRG[2]=V&0x3F;
SyncPRG();
break;
}
}
static int dwave=0;
static void NamcoSoundHack(void)
{
int32 z,a;
#if SOUND_QUALITY == 1
DoNamcoSoundHQ();
#else
z=((SOUNDTS<<16)/soundtsinc)>>4;
a=z-dwave;
if(a)
DoNamcoSound(&Wave[dwave], a);
dwave+=a;
#endif
}
static void NamcoSound(int Count)
{
int32 z,a;
z=((SOUNDTS<<16)/soundtsinc)>>4;
a=z-dwave;
if(a) DoNamcoSound(&Wave[dwave], a);
dwave=0;
}
static uint32 PlayIndex[8];
static int32 vcount[8];
static int32 CVBC;
#define TOINDEX (16+1)
/* 16:15*/
static void SyncHQ(int32 ts)
{
CVBC=ts;
}
/* Things to do:
1 Read freq low
2 Read freq mid
3 Read freq high
4 Read envelope
...?
*/
static INLINE uint32 FetchDuff(uint32 P, uint32 envelope)
{
uint32 duff;
duff=IRAM[((IRAM[0x46+(P<<3)]+(PlayIndex[P]>>TOINDEX))&0xFF)>>1];
if((IRAM[0x46+(P<<3)]+(PlayIndex[P]>>TOINDEX))&1)
duff>>=4;
duff&=0xF;
duff=(duff*envelope)>>16;
return(duff);
}
static void DoNamcoSoundHQ(void)
{
int32 P,V;
int32 cyclesuck=(((IRAM[0x7F]>>4)&7)+1)*15;
for(P=7;P>=(7-((IRAM[0x7F]>>4)&7));P--)
{
if((IRAM[0x44+(P<<3)]&0xE0) && (IRAM[0x47+(P<<3)]&0xF))
{
uint32 freq;
int32 vco;
uint32 duff2,lengo,envelope;
vco=vcount[P];
freq=FreqCache[P];
envelope=EnvCache[P];
lengo=LengthCache[P];
duff2=FetchDuff(P,envelope);
for(V=CVBC<<1;V<SOUNDTS<<1;V++)
{
WaveHi[V>>1]+=duff2;
if(!vco)
{
PlayIndex[P]+=freq;
while((PlayIndex[P]>>TOINDEX)>=lengo) PlayIndex[P]-=lengo<<TOINDEX;
duff2=FetchDuff(P,envelope);
vco=cyclesuck;
}
vco--;
}
vcount[P]=vco;
}
}
CVBC=SOUNDTS;
}
static void DoNamcoSound(int32 *Wave, int Count)
{
int P,V;
for(P=7;P>=7-((IRAM[0x7F]>>4)&7);P--)
{
if((IRAM[0x44+(P<<3)]&0xE0) && (IRAM[0x47+(P<<3)]&0xF))
{
int32 inc;
uint32 freq;
int32 vco;
uint32 duff,duff2,lengo,envelope;
vco=vcount[P];
freq=FreqCache[P];
envelope=EnvCache[P];
lengo=LengthCache[P];
if(!freq) {/*printf("Ack");*/ continue;}
{
int c=((IRAM[0x7F]>>4)&7)+1;
inc=(long double)(FSettings.SndRate<<15)/((long double)freq*21477272/((long double)0x400000*c*45));
}
duff=IRAM[(((IRAM[0x46+(P<<3)]+PlayIndex[P])&0xFF)>>1)];
if((IRAM[0x46+(P<<3)]+PlayIndex[P])&1)
duff>>=4;
duff&=0xF;
duff2=(duff*envelope)>>19;
for(V=0;V<Count*16;V++)
{
if(vco>=inc)
{
PlayIndex[P]++;
if(PlayIndex[P]>=lengo)
PlayIndex[P]=0;
vco-=inc;
duff=IRAM[(((IRAM[0x46+(P<<3)]+PlayIndex[P])&0xFF)>>1)];
if((IRAM[0x46+(P<<3)]+PlayIndex[P])&1)
duff>>=4;
duff&=0xF;
duff2=(duff*envelope)>>19;
}
Wave[V>>4]+=duff2;
vco+=0x8000;
}
vcount[P]=vco;
}
}
}
static void Mapper19_StateRestore(int version)
{
int x;
SyncPRG();
FixNTAR();
FixCRR();
for(x=0x40;x<0x80;x++)
FixCache(x,IRAM[x]);
}
static void M19SC(void)
{
if(FSettings.SndRate)
Mapper19_ESI();
}
void Mapper19_ESI(void)
{
GameExpSound.RChange=M19SC;
memset(vcount,0,sizeof(vcount));
memset(PlayIndex,0,sizeof(PlayIndex));
CVBC=0;
}
void NSFN106_Init(void)
{
SetWriteHandler(0xf800,0xffff,Mapper19_write);
SetWriteHandler(0x4800,0x4fff,Mapper19_write);
SetReadHandler(0x4800,0x4fff,Namco_Read4800);
Mapper19_ESI();
}
static int battery=0;
static void N106_Power(void)
{
int x;
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x8000,0xffff,Mapper19_write);
SetWriteHandler(0x4020,0x5fff,Mapper19_write);
if(!is210)
{
SetWriteHandler(0xc000,0xdfff,Mapper19C0D8_write);
SetReadHandler(0x4800,0x4fff,Namco_Read4800);
SetReadHandler(0x5000,0x57ff,Namco_Read5000);
SetReadHandler(0x5800,0x5fff,Namco_Read5800);
NTAPage[0]=NTAPage[1]=NTAPage[2]=NTAPage[3]=0xFF;
FixNTAR();
}
SetReadHandler(0x6000,0x7FFF,AWRAM);
SetWriteHandler(0x6000,0x7FFF,BWRAM);
FCEU_CheatAddRAM(8,0x6000,WRAM);
gorfus=0xFF;
SyncPRG();
FixCRR();
if(!battery)
{
FCEU_dwmemset(WRAM,0,8192);
FCEU_dwmemset(IRAM,0,128);
}
for(x=0x40;x<0x80;x++)
FixCache(x,IRAM[x]);
}
void Mapper19_Init(CartInfo *info)
{
is210=0;
battery=info->battery;
info->Power=N106_Power;
MapIRQHook=NamcoIRQHook;
GameStateRestore=Mapper19_StateRestore;
GameExpSound.RChange=M19SC;
if(FSettings.SndRate)
Mapper19_ESI();
AddExState(WRAM, 8192, 0, "WRAM");
AddExState(IRAM, 128, 0, "IRAM");
AddExState(N106_StateRegs, ~0, 0, 0);
if(info->battery)
{
info->SaveGame[0]=WRAM;
info->SaveGameLen[0]=8192;
info->SaveGame[1]=IRAM;
info->SaveGameLen[1]=128;
}
}
static void Mapper210_StateRestore(int version)
{
SyncPRG();
FixCRR();
}
void Mapper210_Init(CartInfo *info)
{
is210=1;
GameStateRestore=Mapper210_StateRestore;
info->Power=N106_Power;
AddExState(WRAM, 8192, 0, "WRAM");
AddExState(N106_StateRegs, ~0, 0, 0);
}
-109
View File
@@ -1,109 +0,0 @@
/* 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
* 700in1 and 400in1 carts
*/
#include "mapinc.h"
static uint16 cmd, bank;
static SFORMAT StateRegs[]=
{
{&cmd, 2, "CMD"},
{&bank, 2, "BANK"},
{0}
};
static void Sync(void)
{
setmirror((cmd&1)^1);
setchr8(0);
if(cmd&2)
{
if(cmd&0x100)
{
setprg16(0x8000,((cmd&0xfc)>>2)|bank);
setprg16(0xC000,((cmd&0xfc)>>2)|7);
}
else
{
setprg16(0x8000,((cmd&0xfc)>>2)|(bank&6));
setprg16(0xC000,((cmd&0xfc)>>2)|((bank&6)|1));
}
}
else
{
setprg16(0x8000,((cmd&0xfc)>>2)|bank);
setprg16(0xC000,((cmd&0xfc)>>2)|bank);
}
}
static uint16 ass = 0;
static DECLFW(UNLN625092WriteCommand)
{
cmd=A;
if(A==0x80F8)
{
setprg16(0x8000,ass);
setprg16(0xC000,ass);
}
else
{
Sync();
}
}
static DECLFW(UNLN625092WriteBank)
{
bank=A&7;
Sync();
}
static void UNLN625092Power(void)
{
cmd=0;
bank=0;
Sync();
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x8000,0xBFFF,UNLN625092WriteCommand);
SetWriteHandler(0xC000,0xFFFF,UNLN625092WriteBank);
}
static void UNLN625092Reset(void)
{
cmd=0;
bank=0;
ass++;
FCEU_printf("%04x\n",ass);
}
static void StateRestore(int version)
{
Sync();
}
void UNLN625092_Init(CartInfo *info)
{
info->Reset=UNLN625092Reset;
info->Power=UNLN625092Power;
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
-308
View File
@@ -1,308 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2007-2010 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
*
* OneBus system
* Street Dance (Dance pad) (Unl)
* 101-in-1 Arcade Action II
* DreamGEAR 75-in-1
*/
#include "mapinc.h"
static uint8 isDance;
static uint8 regs[16],regc[6];
static uint8 IRQCount,IRQLatch,IRQa, IRQReload, pcm_enable = 0, pcm_irq = 0;
static int16 pcm_addr, pcm_size, pcm_latch, pcm_clock = 0xF6;
static writefunc old4011write, old4012write, old4013write, old4015write;
static readfunc old4015read;
static SFORMAT StateRegs[]=
{
{regc, 6, "REGC"},
{regs, 16, "REGS"},
{&IRQReload, 1, "IRQR"},
{&IRQCount, 1, "IRQC"},
{&IRQLatch, 1, "IRQL"},
{&IRQa, 1, "IRQA"},
{&pcm_enable, 1, "PCME"},
{&pcm_irq, 1, "PCMIRQ"},
{&pcm_addr, 2, "PCMADDR"},
{&pcm_size, 2, "PCMSIZE"},
{&pcm_latch, 2, "PCMLATCH"},
{&pcm_clock, 2, "PCMCLOCK"},
{0}
};
static void Sync(void)
{
uint16 cswap = (regs[0xf] & 0x80) << 5;
uint16 pswap = (regs[0xd]&1)?((regs[0xf] & 0x40) << 8):0;
uint16 pbase = (regs[0]&0xf0)<<4;
uint16 cbase = (((regs[0]&0x0f)<<8)|(regs[0xc]<<1)|((regs[0xd]&0xf8)>>3))<<3;
uint16 pmask = 0x3f>>(regs[0xb]&0xf);
setchr1(cswap^0x0000,cbase|(regc[0]&(~1)));
setchr1(cswap^0x0400,cbase|(regc[0]|1));
setchr1(cswap^0x0800,cbase|(regc[1]&(-1)));
setchr1(cswap^0x0c00,cbase|(regc[1]|1));
setchr1(cswap^0x1000,cbase|(regc[2]));
setchr1(cswap^0x1400,cbase|(regc[3]));
setchr1(cswap^0x1800,cbase|(regc[4]));
setchr1(cswap^0x1c00,cbase|(regc[5]));
if(regs[0xd]&2)
{
setprg8(pswap^0x8000, pbase|(regs[0x7]&pmask)|(regs[0xa]&(~pmask)));
setprg8( 0xA000, pbase|(regs[0x8]&pmask)|(regs[0xa]&(~pmask)));
setprg8(pswap^0xC000, pbase|(regs[0x9]&pmask)|(regs[0xa]&(~pmask)));
setprg8( 0xE000, pbase|regs[0xa]);
}
else
{
setprg8(pswap^0x8000, pbase|(regs[0x7]&pmask)|(regs[0xa]&(~pmask)));
setprg8( 0xA000, pbase|(regs[0x8]&pmask)|(regs[0xa]&(~pmask)));
setprg8(pswap^0xC000, pbase|((~1)&pmask)|(regs[0xa]&(~pmask)));
setprg8( 0xE000, pbase|((~0)&pmask)|(regs[0xa]&(~pmask)));
}
setmirror(regs[0xe]);
}
static DECLFW(UNLOneBusWrite20XX)
{
/* FCEU_printf("PPU %04x:%04x\n",A,V);*/
if(A == 0x201A)
regs[0xd] = V;
else if(A == 0x2018)
regs[0xc] = V;
Sync();
}
static DECLFW(UNLOneBusWriteExp)
{
/* FCEU_printf("EXP %04x:%04x\n",A,V);*/
/* switch(A & 0x0F)*/
/* {*/
/* case 2: pcm_latch = pcm_clock; FCEU_printf("write %04x:%04x\n",A,V); break;*/
/* case 3: pcm_irqa = 0; X6502_IRQEnd(FCEU_IQEXT); pcm_irq = 0; FCEU_printf("write %04x:%04x\n",A,V); break;*/
/* case 4: pcm_irqa = 1; FCEU_printf("write %04x:%04x\n",A,V); break;*/
/* default:*/
regs[A & 0x0F] = V;
Sync();
/* }*/
}
static DECLFW(UNLOneBusWriteDebug)
{
/* FCEU_printf("write %04x:%04x\n",A,V);*/
}
static DECLFW(UNLOneBusWriteMMC)
{
/* FCEU_printf("MMC %04x:%04x\n",A,V);*/
switch(A&0xE001)
{
case 0x8000: regs[0xf] = V; Sync(); break;
case 0x8001:
{
uint8 mask = 0xff, mmc3cmd = regs[0xf]&7;
switch(mmc3cmd)
{
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
if(regs[0xd]&4)
mask = 0x0f;
else
mask >>= ((regs[0xb]&0xf0)>>4);
regc[mmc3cmd] = V&mask;
break;
case 6:
case 7:
mask = (mask&0x3f)>>(regs[0xb]&0xf);
regs[mmc3cmd+1] = (regs[mmc3cmd+1]&(~mask))|(V&mask);
break;
}
Sync();
break;
}
case 0xA000: regs[0xe] = (V & 1)^1; Sync(); break;
case 0xC000: IRQLatch = V&0xfe; break;
case 0xC001: IRQReload = 1; break;
case 0xE000: X6502_IRQEnd(FCEU_IQEXT); IRQa = 0; break;
case 0xE001: IRQa = 1; break;
}
}
static void UNLOneBusIRQHook(void)
{
int count = IRQCount;
if(!count || IRQReload)
{
IRQCount = IRQLatch;
IRQReload = 0;
}
else
IRQCount--;
if(count && !IRQCount)
{
if(IRQa)
X6502_IRQBegin(FCEU_IQEXT);
}
}
static DECLFW(UNLOneBusWriteAPU2)
{
/* FCEU_printf("APU2 %04x:%04x\n",A,V);*/
CartBW(A&0xffdf,V);
}
static DECLFW(UNLOneBusWrite4012)
{
/* FCEU_printf("write %04x:%04x\n",A,V);*/
pcm_addr = V << 6;
old4012write(A,V);
}
static DECLFW(UNLOneBusWrite4013)
{
/* FCEU_printf("write %04x:%04x\n",A,V);*/
pcm_size = (V << 4) + 1;
old4013write(A,V);
}
static DECLFW(UNLOneBusWrite4015)
{
/* FCEU_printf("write %04x:%04x\n",A,V);*/
pcm_enable = V&0x10;
if(pcm_irq)
{
X6502_IRQEnd(FCEU_IQEXT);
pcm_irq = 0;
}
if(pcm_enable)
pcm_latch = pcm_clock;
old4015write(A,V&0xEF);
}
static DECLFR(UNLOneBusRead4015)
{
uint8 result = (old4015read(A) & 0x7F)|pcm_irq;
/* FCEU_printf("read %04x, %02x\n",A,result);*/
return result;
}
static void UNLOneBusCpuHook(int a)
{
if(pcm_enable)
{
pcm_latch-=a;
if(pcm_latch<=0)
{
pcm_latch+=pcm_clock;
pcm_size--;
if(pcm_size<0)
{
pcm_irq = 0x80;
pcm_enable = 0;
X6502_IRQBegin(FCEU_IQEXT);
}
else
{
uint8 raw_pcm = ARead[pcm_addr](pcm_addr) >> 1;
old4011write(0x4011,raw_pcm);
pcm_addr++;
pcm_addr&=0x7FFF;
}
}
}
}
static void UNLOneBusPower(void)
{
IRQCount=IRQLatch=IRQa==0;
regs[0]=regs[1]=regs[1]=regs[2]=regs[3]=regs[4]=regs[5]=regs[6]=0;
regs[7]=regs[8]=regs[11]=regs[12]=regs[13]=regs[14]=regs[15]=0;
regs[0x09]=0x3E;
regs[0x0A]=0x3F;
SetupCartCHRMapping(0,PRGptr[0],4096 * 1024,0);
if(isDance) /* quick workaround, TODO: figure out how it works together*/
{
old4015read=GetReadHandler(0x4015);
SetReadHandler(0x4015,0x4015,UNLOneBusRead4015);
old4011write=GetWriteHandler(0x4011);
old4012write=GetWriteHandler(0x4012);
SetWriteHandler(0x4012,0x4012,UNLOneBusWrite4012);
old4013write=GetWriteHandler(0x4013);
SetWriteHandler(0x4013,0x4013,UNLOneBusWrite4013);
old4015write=GetWriteHandler(0x4015);
SetWriteHandler(0x4015,0x4015,UNLOneBusWrite4015);
}
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x2009,0x2fff,UNLOneBusWrite20XX);
/* SetWriteHandler(0x4020,0xffff,UNLOneBusWriteDebug);*/
/* SetWriteHandler(0x4020,0x4040,UNLOneBusWriteAPU2);*/
SetWriteHandler(0x4100,0x410f,UNLOneBusWriteExp);
SetWriteHandler(0x8000,0xefff,UNLOneBusWriteMMC);
Sync();
}
static void UNLOneBusReset(void)
{
IRQCount=IRQLatch=IRQa=0;
regs[0]=regs[1]=regs[1]=regs[2]=regs[3]=regs[4]=regs[5]=regs[6]=0;
regs[7]=regs[8]=regs[11]=regs[12]=regs[13]=regs[14]=regs[15]=0;
regs[0x09]=0x3E;
regs[0x0A]=0x3F;
Sync();
}
static void StateRestore(int version)
{
Sync();
}
void UNLOneBus_Init(CartInfo *info)
{
isDance = 0;
info->Power=UNLOneBusPower;
info->Reset=UNLOneBusReset;
GameHBIRQHook=UNLOneBusIRQHook;
/* MapIRQHook=UNLOneBusCpuHook;*/
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
void UNLDANCE_Init(CartInfo *info)
{
isDance = 1;
info->Power=UNLOneBusPower;
info->Reset=UNLOneBusReset;
GameHBIRQHook=UNLOneBusIRQHook;
MapIRQHook=UNLOneBusCpuHook;
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
-112
View File
@@ -1,112 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2009 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[2];
static uint8 *WRAM=NULL;
static uint32 WRAMSIZE;
static SFORMAT StateRegs[]=
{
{reg, 2, "REG"},
{0}
};
static uint8 bs_tbl[256] = {
0x03, 0x13, 0x23, 0x33, 0x03, 0x13, 0x23, 0x33, 0x03, 0x13, 0x23, 0x33, 0x03, 0x13, 0x23, 0x33,
0x45, 0x67, 0x45, 0x67, 0x45, 0x67, 0x45, 0x67, 0x45, 0x67, 0x45, 0x67, 0x45, 0x67, 0x45, 0x67,
0x03, 0x13, 0x23, 0x33, 0x03, 0x13, 0x23, 0x33, 0x03, 0x13, 0x23, 0x33, 0x03, 0x13, 0x23, 0x33,
0x47, 0x67, 0x47, 0x67, 0x47, 0x67, 0x47, 0x67, 0x47, 0x67, 0x47, 0x67, 0x47, 0x67, 0x47, 0x67,
0x02, 0x12, 0x22, 0x32, 0x02, 0x12, 0x22, 0x32, 0x02, 0x12, 0x22, 0x32, 0x02, 0x12, 0x22, 0x32,
0x45, 0x67, 0x45, 0x67, 0x45, 0x67, 0x45, 0x67, 0x45, 0x67, 0x45, 0x67, 0x45, 0x67, 0x45, 0x67,
0x02, 0x12, 0x22, 0x32, 0x02, 0x12, 0x22, 0x32, 0x02, 0x12, 0x22, 0x32, 0x00, 0x10, 0x20, 0x30,
0x47, 0x67, 0x47, 0x67, 0x47, 0x67, 0x47, 0x67, 0x47, 0x67, 0x47, 0x67, 0x47, 0x67, 0x47, 0x67,
0x03, 0x13, 0x23, 0x33, 0x03, 0x13, 0x23, 0x33, 0x03, 0x13, 0x23, 0x33, 0x03, 0x13, 0x23, 0x33,
0x45, 0x67, 0x45, 0x67, 0x45, 0x67, 0x45, 0x67, 0x45, 0x67, 0x45, 0x67, 0x45, 0x67, 0x45, 0x67,
0x03, 0x13, 0x23, 0x33, 0x03, 0x13, 0x23, 0x33, 0x03, 0x13, 0x23, 0x33, 0x03, 0x13, 0x23, 0x33,
0x47, 0x67, 0x47, 0x67, 0x47, 0x67, 0x47, 0x67, 0x47, 0x67, 0x47, 0x67, 0x47, 0x67, 0x47, 0x67,
0x02, 0x12, 0x22, 0x32, 0x02, 0x12, 0x22, 0x32, 0x02, 0x12, 0x22, 0x32, 0x02, 0x12, 0x22, 0x32,
0x45, 0x67, 0x45, 0x67, 0x45, 0x67, 0x45, 0x67, 0x45, 0x67, 0x45, 0x67, 0x45, 0x67, 0x45, 0x67,
0x02, 0x12, 0x22, 0x32, 0x02, 0x12, 0x22, 0x32, 0x02, 0x12, 0x22, 0x32, 0x00, 0x10, 0x20, 0x30,
0x47, 0x67, 0x47, 0x67, 0x47, 0x67, 0x47, 0x67, 0x47, 0x67, 0x47, 0x67, 0x47, 0x67, 0x47, 0x67,
};
static void Sync(void)
{
setchr4(0x0000,(reg[0]&0x80) >> 7);
setchr4(0x1000,(reg[0]&0x80) >> 7);
setprg8r(0x10,0x6000,0);
setprg16(0x8000,bs_tbl[reg[0]]>>4);
setprg16(0xc000,bs_tbl[reg[0]]&0xf);
setmirror(MI_V);
}
static DECLFW(UNLPEC586Write)
{
reg[A&1]=V;
FCEU_printf("bs %04x %02x\n",A,V);
Sync();
}
static void UNLPEC586Power(void)
{
reg[0]=0x0E;
Sync();
SetReadHandler(0x6000,0x7FFF,CartBR);
SetWriteHandler(0x6000,0x7FFF,CartBW);
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x5000,0x5fff,UNLPEC586Write);
}
static void UNLPEC586IRQ(void)
{
if(scanline==128)
setchr4(0x0000,1);
else
setchr4(0x0000,0);
}
static void UNLPEC586Close(void)
{
if(WRAM)
free(WRAM);
WRAM=NULL;
}
static void StateRestore(int version)
{
Sync();
}
void UNLPEC586Init(CartInfo *info)
{
info->Power=UNLPEC586Power;
info->Close=UNLPEC586Close;
/* GameHBIRQHook=UNLPEC586IRQ;*/
GameStateRestore=StateRestore;
WRAMSIZE=8192;
WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1);
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
AddExState(&StateRegs, ~0, 0, 0);
}
-470
View File
@@ -1,470 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
static uint8 cmd, dip;
static uint8 latch[8];
static void S74LS374MSync(uint8 mirr)
{
switch(mirr&3)
{
case 0:setmirror(MI_V);break;
case 1:setmirror(MI_H);break;
case 2:setmirrorw(0,1,1,1);break;
case 3:setmirror(MI_0);break;
}
}
static void S74LS374NSynco(void)
{
setprg32(0x8000,latch[0]);
setchr8(latch[1]|latch[3]|latch[4]);
S74LS374MSync(latch[2]);
}
static DECLFW(S74LS374NWrite)
{
A&=0x4101;
if(A==0x4100)
cmd=V&7;
else
{
switch(cmd)
{
case 2:latch[0]=V&1; latch[3]=(V&1)<<3;break;
case 4:latch[4]=(V&1)<<2;break;
case 5:latch[0]=V&7;break;
case 6:latch[1]=V&3;break;
case 7:latch[2]=V>>1;break;
}
S74LS374NSynco();
}
}
static DECLFR(S74LS374NRead)
{
uint8 ret;
if((A&0x4100)==0x4100)
/* ret=(X.DB&0xC0)|((~cmd)&0x3F);*/
ret=((~cmd)&0x3F)^dip;
else
ret=X.DB;
return ret;
}
static void S74LS374NPower(void)
{
dip=0;
latch[0]=latch[1]=latch[2]=latch[3]=latch[4]=0;
S74LS374NSynco();
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x4100,0x7FFF,S74LS374NWrite);
SetReadHandler(0x4100,0x5fff,S74LS374NRead);
}
static void S74LS374NReset(void)
{
dip^=1;
latch[0]=latch[1]=latch[2]=latch[3]=latch[4]=0;
S74LS374NSynco();
}
static void S74LS374NRestore(int version)
{
S74LS374NSynco();
}
void S74LS374N_Init(CartInfo *info)
{
info->Power=S74LS374NPower;
info->Reset=S74LS374NReset;
GameStateRestore=S74LS374NRestore;
AddExState(latch, 5, 0, "LATC");
AddExState(&cmd, 1, 0, "CMD");
AddExState(&dip, 1, 0, "DIP");
}
static void S74LS374NASynco(void)
{
setprg32(0x8000,latch[0]);
setchr8(latch[1]);
S74LS374MSync(latch[2]);
}
static DECLFW(S74LS374NAWrite)
{
A&=0x4101;
if(A==0x4100)
cmd=V&7;
else
{
switch(cmd)
{
case 0:latch[0]=0;latch[1]=3;break;
case 2:latch[3]=(V&1)<<3;break;
case 4:latch[1]=(latch[1]&6)|(V&3);break;
case 5:latch[0]=V&1;break;
case 6:latch[1]=(latch[1]&1)|latch[3]|((V&3)<<1);break;
case 7:latch[2]=V&1;break;
}
S74LS374NASynco();
}
}
static void S74LS374NAPower(void)
{
latch[0]=latch[2]=latch[3]=latch[4]=0;
latch[1]=3;
S74LS374NASynco();
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x4100,0x7FFF,S74LS374NAWrite);
}
void S74LS374NA_Init(CartInfo *info)
{
info->Power=S74LS374NAPower;
GameStateRestore=S74LS374NRestore;
AddExState(latch, 5, 0, "LATC");
AddExState(&cmd, 1, 0, "CMD");
}
static int type;
static void S8259Synco(void)
{
int x;
setprg32(0x8000,latch[5]&7);
if(!UNIFchrrama) /* No CHR RAM? Then BS'ing is ok.*/
{
for(x=0;x<4;x++)
{
int bank;
if(latch[7]&1)
bank=(latch[0]&0x7)|((latch[4]&7)<<3);
else
bank=(latch[x]&0x7)|((latch[4]&7)<<3);
switch (type)
{
case 00: bank=(bank<<1)|(x&1); setchr2(0x800*x,bank); break;
case 01: setchr2(0x800*x,bank); break;
case 02: bank=(bank<<2)|(x&3); setchr2(0x800*x,bank); break;
case 03: bank=latch[x]&7;
switch (x&3)
{
case 01: bank|=(latch[4]&1)<<4;break;
case 02: bank|=(latch[4]&2)<<3;break;
case 03: bank|=((latch[4]&4)<<2)|((latch[6]&1)<<3);break;
}
setchr1(0x400*x,bank);
setchr4(0x1000,~0);
break;
}
}
}
if(!(latch[7]&1))
S74LS374MSync(latch[7]>>1);
else
setmirror(MI_V);
}
static DECLFW(S8259Write)
{
A&=0x4101;
if(A==0x4100)
cmd=V;
else
{
latch[cmd&7]=V;
S8259Synco();
}
}
static void S8259Reset(void)
{
int x;
cmd=0;
for(x=0;x<8;x++) latch[x]=0;
setchr8(0);
S8259Synco();
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x4100,0x7FFF,S8259Write);
}
static void S8259Restore(int version)
{
S8259Synco();
}
void S8259A_Init(CartInfo *info) /* Kevin's Horton 141 mapper*/
{
info->Power=S8259Reset;
GameStateRestore=S8259Restore;
AddExState(latch, 8, 0, "LATC");
AddExState(&cmd, 1, 0, "CMD");
type=0;
}
void S8259B_Init(CartInfo *info) /* Kevin's Horton 138 mapper*/
{
info->Power=S8259Reset;
GameStateRestore=S8259Restore;
AddExState(latch, 8, 0, "LATC");
AddExState(&cmd, 1, 0, "CMD");
type=1;
}
void S8259C_Init(CartInfo *info) /* Kevin's Horton 139 mapper*/
{
info->Power=S8259Reset;
GameStateRestore=S8259Restore;
AddExState(latch, 8, 0, "LATC");
AddExState(&cmd, 1, 0, "CMD");
type=2;
}
void S8259D_Init(CartInfo *info) /* Kevin's Horton 137 mapper*/
{
info->Power=S8259Reset;
GameStateRestore=S8259Restore;
AddExState(latch, 8, 0, "LATC");
AddExState(&cmd, 1, 0, "CMD");
type=3;
}
static void(*WSync)(void);
static DECLFW(SAWrite)
{
if(A&0x100)
{
latch[0]=V;
WSync();
}
}
static void SAPower(void)
{
latch[0]=0;
WSync();
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x4100,0x5FFF,SAWrite);
}
static void SARestore(int version)
{
WSync();
}
static DECLFW(SADWrite)
{
latch[0]=V;
WSync();
}
static void SADPower(void)
{
latch[0]=0;
WSync();
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x8000,0xFFFF,SADWrite);
}
static void SA0161MSynco()
{
setprg32(0x8000,(latch[0]>>3)&1);
setchr8(latch[0]&7);
}
static void SA72007Synco()
{
setprg32(0x8000,0);
setchr8(latch[0]>>7);
}
static void SA009Synco()
{
setprg32(0x8000,0);
setchr8(latch[0]&1);
}
static void SA72008Synco()
{
setprg32(0x8000,(latch[0]>>2)&1);
setchr8(latch[0]&3);
}
void SA0161M_Init(CartInfo *info)
{
WSync=SA0161MSynco;
GameStateRestore=SARestore;
info->Power=SAPower;
AddExState(&latch[0], 1, 0, "LATC");
}
void SA72007_Init(CartInfo *info)
{
WSync=SA72007Synco;
GameStateRestore=SARestore;
info->Power=SAPower;
AddExState(&latch[0], 1, 0, "LATC");
}
void SA72008_Init(CartInfo *info)
{
WSync=SA72008Synco;
GameStateRestore=SARestore;
info->Power=SAPower;
AddExState(&latch[0], 1, 0, "LATC");
}
void SA009_Init(CartInfo *info)
{
WSync=SA009Synco;
GameStateRestore=SARestore;
info->Power=SAPower;
AddExState(&latch[0], 1, 0, "LATC");
}
void SA0036_Init(CartInfo *info)
{
WSync=SA72007Synco;
GameStateRestore=SARestore;
info->Power=SADPower;
AddExState(&latch[0], 1, 0, "LATC");
}
void SA0037_Init(CartInfo *info)
{
WSync=SA0161MSynco;
GameStateRestore=SARestore;
info->Power=SADPower;
AddExState(&latch[0], 1, 0, "LATC");
}
/* -----------------------------------------------*/
static void TCU01Synco()
{
setprg32(0x8000,((latch[0]&0x80)>>6)|((latch[0]>>2)&1));
setchr8((latch[0]>>3)&0xF);
}
static DECLFW(TCU01Write)
{
if((A&0x103)==0x102)
{
latch[0]=V;
TCU01Synco();
}
}
static void TCU01Power(void)
{
latch[0]=0;
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x4100,0xFFFF,TCU01Write);
TCU01Synco();
}
static void TCU01Restore(int version)
{
TCU01Synco();
}
void TCU01_Init(CartInfo *info)
{
GameStateRestore=TCU01Restore;
info->Power=TCU01Power;
AddExState(&latch[0], 1, 0, "LATC");
}
/*-----------------------------------------------*/
static void TCU02Synco()
{
setprg32(0x8000,0);
setchr8(latch[0]&3);
}
static DECLFW(TCU02Write)
{
if((A&0x103)==0x102)
{
latch[0]=V+3;
TCU02Synco();
}
}
static DECLFR(TCU02Read)
{
return (latch[0]&0x3F)|(X.DB&0xC0);
}
static void TCU02Power(void)
{
latch[0]=0;
SetReadHandler(0x8000,0xFFFF,CartBR);
SetReadHandler(0x4100,0x4100,TCU02Read);
SetWriteHandler(0x4100,0xFFFF,TCU02Write);
TCU02Synco();
}
static void TCU02Restore(int version)
{
TCU02Synco();
}
void TCU02_Init(CartInfo *info)
{
GameStateRestore=TCU02Restore;
info->Power=TCU02Power;
AddExState(&latch[0], 1, 0, "LATC");
}
/* ---------------------------------------------*/
static DECLFR(TCA01Read)
{
uint8 ret;
if((A&0x4100)==0x4100)
ret=(X.DB&0xC0)|((~A)&0x3F);
else
ret=X.DB;
return ret;
}
static void TCA01Power(void)
{
setprg16(0x8000,0);
setprg16(0xC000,1);
setchr8(0);
SetReadHandler(0x8000,0xFFFF,CartBR);
SetReadHandler(0x4100,0x5FFF,TCA01Read);
}
void TCA01_Init(CartInfo *info)
{
info->Power=TCA01Power;
}
-125
View File
@@ -1,125 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2009 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
*
* Wario Land II (Kirby hack)
*/
#include "mapinc.h"
static uint8 reg[8], chr[8];
static uint8 *WRAM=NULL;
static uint32 WRAMSIZE;
static uint16 IRQCount, IRQa;
static SFORMAT StateRegs[]=
{
{reg, 8, "REGS"},
{chr, 8, "CHRS"},
{&IRQCount, 16, "IRQc"},
{&IRQa, 16, "IRQa"},
{0}
};
static void Sync(void)
{
int i;
setprg8(0x8000,reg[0]);
setprg8(0xA000,reg[1]);
setprg8(0xC000,reg[2]);
for(i=0; i<8; i++)
setchr1(i << 10,chr[i]);
setmirror(reg[3]^1);
}
static DECLFW(UNLSC127Write)
{
switch(A)
{
case 0x8000: reg[0] = V; break;
case 0x8001: reg[1] = V; break;
case 0x8002: reg[2] = V; break;
case 0x9000: chr[0] = V; break;
case 0x9001: chr[1] = V; break;
case 0x9002: chr[2] = V; break;
case 0x9003: chr[3] = V; break;
case 0x9004: chr[4] = V; break;
case 0x9005: chr[5] = V; break;
case 0x9006: chr[6] = V; break;
case 0x9007: chr[7] = V; break;
case 0xC002: IRQa=0; X6502_IRQEnd(FCEU_IQEXT); break;
case 0xC005: IRQCount=V; break;
case 0xC003: IRQa=1; break;
case 0xD001: reg[3] = V; break;
}
Sync();
}
static void UNLSC127Power(void)
{
Sync();
setprg8r(0x10,0x6000,0);
setprg8(0xE000,~0);
SetReadHandler(0x6000,0x7fff,CartBR);
SetWriteHandler(0x6000,0x7fff,CartBW);
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x8000,0xFFFF,UNLSC127Write);
}
static void UNLSC127IRQ(void)
{
if(IRQa)
{
IRQCount--;
if(IRQCount==0)
{
X6502_IRQBegin(FCEU_IQEXT);
IRQa=0;
}
}
}
static void UNLSC127Reset(void)
{
}
static void UNLSC127Close(void)
{
if(WRAM)
free(WRAM);
WRAM=NULL;
}
static void StateRestore(int version)
{
Sync();
}
void UNLSC127_Init(CartInfo *info)
{
info->Reset=UNLSC127Reset;
info->Power=UNLSC127Power;
info->Close=UNLSC127Close;
GameHBIRQHook=UNLSC127IRQ;
GameStateRestore=StateRestore;
WRAMSIZE=8192;
WRAM=(uint8*)FCEU_gmalloc(WRAMSIZE);
SetupCartPRGMapping(0x10,WRAM,WRAMSIZE,1);
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
AddExState(&StateRegs, ~0, 0, 0);
}
-87
View File
@@ -1,87 +0,0 @@
/* 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"
#include "mmc3.h"
static uint8 *CHRRAM;
static uint8 tekker;
static void MSHCW(uint32 A, uint8 V)
{
if(EXPREGS[0]&0x40)
setchr8r(0x10,0);
else
{
if(A<0x800)
setchr1(A,V|((EXPREGS[0]&8)<<5));
else if(A<0x1000)
setchr1(A,V|((EXPREGS[0]&4)<<6));
else if(A<0x1800)
setchr1(A,V|((EXPREGS[0]&1)<<8));
else
setchr1(A,V|((EXPREGS[0]&2)<<7));
}
}
static DECLFW(MSHWrite)
{
EXPREGS[0]=V;
FixMMC3CHR(MMC3_cmd);
}
static DECLFR(MSHRead)
{
return(tekker);
}
static void MSHReset(void)
{
MMC3RegReset();
tekker^=0xFF;
}
static void MSHPower(void)
{
tekker=0x00;
GenMMC3Power();
SetWriteHandler(0x4100,0x4100,MSHWrite);
SetReadHandler(0x4100,0x4100,MSHRead);
}
static void MSHClose(void)
{
if(CHRRAM)
free(CHRRAM);
CHRRAM=NULL;
}
void UNLSHeroes_Init(CartInfo *info)
{
GenMMC3_Init(info, 256, 512, 0, 0);
cwrap=MSHCW;
info->Power=MSHPower;
info->Reset=MSHReset;
info->Close=MSHClose;
CHRRAM = (uint8*)FCEU_gmalloc(8192);
SetupCartCHRMapping(0x10, CHRRAM, 8192, 1);
AddExState(EXPREGS, 4, 0, "EXPR");
AddExState(&tekker, 1, 0, "DIPSW");
}
-126
View File
@@ -1,126 +0,0 @@
/* 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
*
* SL1632 2-in-1 protected board, similar to SL12
* Samurai Spirits Rex (Full)
*
*/
#include "mapinc.h"
#include "mmc3.h"
static uint8 chrcmd[8], prg0, prg1, bbrk, mirr, swap;
static SFORMAT StateRegs[]=
{
{chrcmd, 8, "CHRCMD"},
{&prg0, 1, "PRG0"},
{&prg1, 1, "PRG1"},
{&bbrk, 1, "BRK"},
{&mirr, 1, "MIRR"},
{&swap, 1, "SWAP"},
{0}
};
static void Sync(void)
{
int i;
setprg8(0x8000,prg0);
setprg8(0xA000,prg1);
setprg8(0xC000,~1);
setprg8(0xE000,~0);
for(i=0; i<8; i++)
setchr1(i<<10,chrcmd[i]);
setmirror(mirr^1);
}
static void UNLSL1632CW(uint32 A, uint8 V)
{
int cbase=(MMC3_cmd&0x80)<<5;
int page0=(bbrk&0x08)<<5;
int page1=(bbrk&0x20)<<3;
int page2=(bbrk&0x80)<<1;
setchr1(cbase^0x0000,page0|(DRegBuf[0]&(~1)));
setchr1(cbase^0x0400,page0|DRegBuf[0]|1);
setchr1(cbase^0x0800,page0|(DRegBuf[1]&(~1)));
setchr1(cbase^0x0C00,page0|DRegBuf[1]|1);
setchr1(cbase^0x1000,page1|DRegBuf[2]);
setchr1(cbase^0x1400,page1|DRegBuf[3]);
setchr1(cbase^0x1800,page2|DRegBuf[4]);
setchr1(cbase^0x1c00,page2|DRegBuf[5]);
}
static DECLFW(UNLSL1632CMDWrite)
{
if(A==0xA131)
{
bbrk=V;
}
if(bbrk&2)
{
FixMMC3PRG(MMC3_cmd);
FixMMC3CHR(MMC3_cmd);
if(A<0xC000)
MMC3_CMDWrite(A,V);
else
MMC3_IRQWrite(A,V);
}
else
{
if((A>=0xB000)&&(A<=0xE003))
{
int ind=((((A&2)|(A>>10))>>1)+2)&7;
int sar=((A&1)<<2);
chrcmd[ind]=(chrcmd[ind]&(0xF0>>sar))|((V&0x0F)<<sar);
}
else
switch(A&0xF003)
{
case 0x8000: prg0=V; break;
case 0xA000: prg1=V; break;
case 0x9000: mirr=V&1; break;
}
Sync();
}
}
static void StateRestore(int version)
{
if(bbrk&2)
{
FixMMC3PRG(MMC3_cmd);
FixMMC3CHR(MMC3_cmd);
}
else
Sync();
}
static void UNLSL1632Power(void)
{
GenMMC3Power();
SetWriteHandler(0x4100,0xFFFF,UNLSL1632CMDWrite);
}
void UNLSL1632_Init(CartInfo *info)
{
GenMMC3_Init(info, 256, 512, 0, 0);
cwrap=UNLSL1632CW;
info->Power=UNLSL1632Power;
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
-99
View File
@@ -1,99 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2007 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
*
* FDS Conversions
*
* Super Mario Bros 2 J alt version
* as well as "Voleyball" FDS conversion, bank layot is similar but no bankswitching and CHR ROM present
*/
#include "mapinc.h"
static uint8 prg, IRQa;
static uint16 IRQCount;
static SFORMAT StateRegs[]=
{
{&prg, 1, "PRG"},
{&IRQa, 1, "IRQA"},
{&IRQCount, 2, "IRQC"},
{0}
};
static void Sync(void)
{
setprg4r(1,0x5000,1);
setprg8r(1,0x6000,1);
setprg32(0x8000,prg);
setchr8(0);
}
static DECLFW(UNLSMB2JWrite)
{
if(A==0x4022)
{
prg=V&1;
Sync();
}
if(A==0x4122)
{
IRQa=V;
IRQCount=0;
X6502_IRQEnd(FCEU_IQEXT);
}
}
static void UNLSMB2JPower(void)
{
prg=~0;
Sync();
SetReadHandler(0x5000,0x7FFF,CartBR);
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x4020,0xffff,UNLSMB2JWrite);
}
static void UNLSMB2JReset(void)
{
prg=~0;
Sync();
}
static void UNLSMB2JIRQHook(int a)
{
if(IRQa)
{
IRQCount+=a*3;
if((IRQCount>>12)==IRQa)
X6502_IRQBegin(FCEU_IQEXT);
}
}
static void StateRestore(int version)
{
Sync();
}
void UNLSMB2J_Init(CartInfo *info)
{
info->Reset=UNLSMB2JReset;
info->Power=UNLSMB2JPower;
MapIRQHook=UNLSMB2JIRQHook;
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
-79
View File
@@ -1,79 +0,0 @@
#include "mapinc.h"
static uint8 mode;
static uint8 DRegs[4];
static SFORMAT StateRegs[]=
{
{DRegs, 4, "DREG"},
{0}
};
static void Sync(void)
{
int base, bank;
base = ((DRegs[0]^DRegs[1])&0x10)<<1;
bank = (DRegs[2]^DRegs[3])&0x1f;
if(DRegs[1]&0x08)
{
bank &= 0xfe;
if(mode==0)
{
setprg16(0x8000,base+bank+1);
setprg16(0xC000,base+bank+0);
}
else
{
setprg16(0x8000,base+bank+0);
setprg16(0xC000,base+bank+1);
}
}
else
{
if(DRegs[1]&0x04)
{
setprg16(0x8000,0x1f);
setprg16(0xC000,base+bank);
}
else
{
setprg16(0x8000,base+bank);
if(mode==0)
setprg16(0xC000,0x20);
else
setprg16(0xC000,0x07);
}
}
}
static DECLFW(Mapper167_write)
{
DRegs[(A>>13)&0x03]=V;
Sync();
}
static void StateRestore(int version)
{
Sync();
}
void Mapper166_init(void)
{
mode=1;
DRegs[0]=DRegs[1]=DRegs[2]=DRegs[3]=0;
Sync();
SetWriteHandler(0x8000,0xFFFF,Mapper167_write);
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
void Mapper167_init(void)
{
mode=0;
DRegs[0]=DRegs[1]=DRegs[2]=DRegs[3]=0;
Sync();
SetWriteHandler(0x8000,0xFFFF,Mapper167_write);
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
-99
View File
@@ -1,99 +0,0 @@
/* 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 *CHRRAM = NULL;
static int masko8[8]={63,31,15,1,3,0,0,0};
static void Super24PW(uint32 A, uint8 V)
{
uint32 NV=V&masko8[EXPREGS[0]&7];
NV|=(EXPREGS[1]<<1);
setprg8r((NV>>6)&0xF,A,NV);
}
static void Super24CW(uint32 A, uint8 V)
{
if(EXPREGS[0]&0x20)
setchr1r(0x10,A,V);
else
{
uint32 NV=V|(EXPREGS[2]<<3);
setchr1r((NV>>9)&0xF,A,NV);
}
}
static DECLFW(Super24Write)
{
switch(A)
{
case 0x5FF0: EXPREGS[0]=V;
FixMMC3PRG(MMC3_cmd);
FixMMC3CHR(MMC3_cmd);
break;
case 0x5FF1: EXPREGS[1]=V;
FixMMC3PRG(MMC3_cmd);
break;
case 0x5FF2: EXPREGS[2]=V;
FixMMC3CHR(MMC3_cmd);
break;
}
}
static void Super24Power(void)
{
EXPREGS[0]=0x24;
EXPREGS[1]=159;
EXPREGS[2]=0;
GenMMC3Power();
SetWriteHandler(0x5000,0x7FFF,Super24Write);
SetReadHandler(0x8000,0xFFFF,CartBR);
}
static void Super24Reset(void)
{
EXPREGS[0]=0x24;
EXPREGS[1]=159;
EXPREGS[2]=0;
MMC3RegReset();
}
static void Super24Close(void)
{
if(CHRRAM)
free(CHRRAM);
CHRRAM = NULL;
}
void Super24_Init(CartInfo *info)
{
GenMMC3_Init(info, 128, 256, 0, 0);
info->Power=Super24Power;
info->Reset=Super24Reset;
info->Close=Super24Close;
cwrap=Super24CW;
pwrap=Super24PW;
CHRRAM=(uint8*)FCEU_gmalloc(8192);
SetupCartCHRMapping(0x10, CHRRAM, 8192, 1);
AddExState(CHRRAM, 8192, 0, "CHRR");
AddExState(EXPREGS, 3, 0, "BIG2");
}
-74
View File
@@ -1,74 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mapinc.h"
static uint8 cmd0, cmd1;
static void DoSuper(void)
{
setprg8r((cmd0&0xC)>>2,0x6000,((cmd0&0x3)<<4)|0xF);
if(cmd0&0x10)
{
setprg16r((cmd0&0xC)>>2,0x8000,((cmd0&0x3)<<3)|(cmd1&7));
setprg16r((cmd0&0xC)>>2,0xc000,((cmd0&0x3)<<3)|7);
}
else
setprg32r(4,0x8000,0);
setmirror(((cmd0&0x20)>>5)^1);
}
static DECLFW(SuperWrite)
{
if(!(cmd0&0x10))
{
cmd0=V;
DoSuper();
}
}
static DECLFW(SuperHi)
{
cmd1=V;
DoSuper();
}
static void SuperReset(void)
{
SetWriteHandler(0x6000,0x7FFF,SuperWrite);
SetWriteHandler(0x8000,0xFFFF,SuperHi);
SetReadHandler(0x6000,0xFFFF,CartBR);
cmd0=cmd1=0;
setprg32r(4,0x8000,0);
setchr8(0);
}
static void SuperRestore(int version)
{
DoSuper();
}
void Supervision16_Init(CartInfo *info)
{
AddExState(&cmd0, 1, 0,"L1");
AddExState(&cmd1, 1, 0,"L2");
info->Power=SuperReset;
GameStateRestore=SuperRestore;
}
-118
View File
@@ -1,118 +0,0 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2008 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
*/
/* T-227-1, 820632, MMC3 based, multimenu, 60000in1 (0010) dip switches*/
#include "mapinc.h"
#include "mmc3.h"
static uint8 reset_flag = 0x07;
static void BMCT2271CW(uint32 A, uint8 V)
{
uint32 va;
va = V;
if(EXPREGS[0]&0x20)
{
va|=0x200;
va|=(EXPREGS[0]&0x10)<<4;
}
else
{
va&=0x7F;
va|=(EXPREGS[0]&0x18)<<4;
}
setchr1(A,va);
}
static void BMCT2271PW(uint32 A, uint8 V)
{
uint32 va = V & 0x3F;
if(EXPREGS[0]&0x20)
{
va&=0x1F;
va|=0x40;
va|=(EXPREGS[0]&0x10)<<1;
}
else
{
va&=0x0F;
va|=(EXPREGS[0]&0x18)<<1;
}
switch(EXPREGS[0]&3)
{
case 0x00: setprg8(A,va); break;
case 0x02:
{
va=(va&0xFD)|((EXPREGS[0]&4)>>1);
if(A<0xC000)
{
setprg16(0x8000,va >> 1);
setprg16(0xC000,va >> 1);
}
break;
}
case 0x01:
case 0x03: if(A<0xC000) setprg32(0x8000,va >> 2); break;
}
}
static DECLFW(BMCT2271LoWrite)
{
if(!(EXPREGS[0]&0x80))
EXPREGS[0] = A & 0xFF;
FixMMC3PRG(MMC3_cmd);
FixMMC3CHR(MMC3_cmd);
}
static DECLFR(BMCT2271HiRead)
{
uint32 av = A;
if(EXPREGS[0]&0x40) av = (av & 0xFFF0)|reset_flag;
return CartBR(av);
}
static void BMCT2271Reset(void)
{
EXPREGS[0] = 0x00;
reset_flag++;
reset_flag&=0x0F;
MMC3RegReset();
}
static void BMCT2271Power(void)
{
EXPREGS[0] = 0x00;
GenMMC3Power();
SetWriteHandler(0x6000,0x7FFF,BMCT2271LoWrite);
SetReadHandler(0x8000,0xFFFF,BMCT2271HiRead);
}
void BMCT2271_Init(CartInfo *info)
{
GenMMC3_Init(info, 128, 128, 8, 0);
pwrap=BMCT2271PW;
cwrap=BMCT2271CW;
info->Power=BMCT2271Power;
info->Reset=BMCT2271Reset;
AddExState(EXPREGS, 1, 0, "EXPR");
}
-84
View File
@@ -1,84 +0,0 @@
/* 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 addrreg;
static uint8 datareg;
static uint8 busy;
static SFORMAT StateRegs[]=
{
{&addrreg, 2, "ADDRREG"},
{&datareg, 1, "DATAREG"},
{&busy, 1, "BUSY"},
{0}
};
static void Sync(void)
{
uint16 base=((addrreg&0x60)>>2)|((addrreg&0x100)>>3);
setprg16(0x8000,(datareg&7)|base);
setprg16(0xC000,7|base);
setmirror(((addrreg&2)>>1)^1);
}
static DECLFW(BMCT262Write)
{
if(busy||(A==0x8000))
datareg=V;
else
{
addrreg=A;
busy=1;
}
Sync();
}
static void BMCT262Power(void)
{
setchr8(0);
SetWriteHandler(0x8000,0xFFFF,BMCT262Write);
SetReadHandler(0x8000,0xFFFF,CartBR);
busy=0;
addrreg=0;
datareg=0xff;
Sync();
}
static void BMCT262Reset(void)
{
busy=0;
addrreg=0;
datareg=0;
Sync();
}
static void BMCT262Restore(int version)
{
Sync();
}
void BMCT262_Init(CartInfo *info)
{
info->Power=BMCT262Power;
info->Reset=BMCT262Reset;
GameStateRestore=BMCT262Restore;
AddExState(&StateRegs, ~0, 0, 0);
}

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