Added FCEUmm NES core
This commit is contained in:
@@ -0,0 +1,647 @@
|
||||
<?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.
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
Copyright (c) 2009, OpenEmu Team
|
||||
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the OpenEmu Team nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY OpenEmu Team ''AS IS'' AND ANY
|
||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL OpenEmu Team BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
//
|
||||
// Prefix header for all source files of the 'VisualBoyAdvance' target in the 'VisualBoyAdvance' project.
|
||||
//
|
||||
|
||||
#ifdef __OBJC__
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#else
|
||||
#define __GNUC__ 4
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define OE_EXTERN extern "C"
|
||||
#else
|
||||
#define OE_EXTERN extern
|
||||
#endif
|
||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
Copyright (c) 2009, OpenEmu Team
|
||||
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the OpenEmu Team nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY OpenEmu Team ''AS IS'' AND ANY
|
||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL OpenEmu Team BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import <OEGameCoreController.h>
|
||||
|
||||
@interface FCEUGameController : OEGameCoreController
|
||||
@end
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
Copyright (c) 2009, OpenEmu Team
|
||||
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the OpenEmu Team nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY OpenEmu Team ''AS IS'' AND ANY
|
||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL OpenEmu Team BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#import "FCEUGameController.h"
|
||||
#import "FCEUGameEmu.h"
|
||||
|
||||
@implementation FCEUGameController
|
||||
|
||||
+ (void)initialize
|
||||
{
|
||||
if(self == [FCEUGameController class])
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
- (NSArray *)genericControlNames
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSUInteger)playerCount
|
||||
{
|
||||
return MAC_MAX_PLAYERS;
|
||||
}
|
||||
|
||||
- (Class)gameCoreClass
|
||||
{
|
||||
return [FCEUGameEmu class];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
Copyright (c) 2009, OpenEmu Team
|
||||
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the OpenEmu Team nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY OpenEmu Team ''AS IS'' AND ANY
|
||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL OpenEmu Team BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import <OEGameCore.h>
|
||||
|
||||
#define MAC_MAX_PLAYERS 2
|
||||
#define SNES_CONTROL_COUNT 8
|
||||
|
||||
extern NSString *FCEUEmulatorNames[];
|
||||
|
||||
@class OERingBuffer;
|
||||
|
||||
@interface FCEUGameEmu : OEGameCore
|
||||
{
|
||||
@public
|
||||
uint32 controlPad[MAC_MAX_PLAYERS];
|
||||
uint16_t *soundBuffer;
|
||||
uint16_t *videoBuffer;
|
||||
int videoWidth, videoHeight;
|
||||
int16_t pad[2][8];
|
||||
NSString *romName;
|
||||
}
|
||||
|
||||
@end
|
||||
+434
@@ -0,0 +1,434 @@
|
||||
/*
|
||||
Copyright (c) 2009, OpenEmu Team
|
||||
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the OpenEmu Team nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY OpenEmu Team ''AS IS'' AND ANY
|
||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL OpenEmu Team BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#import "FCEUGameEmu.h"
|
||||
#import <OERingBuffer.h>
|
||||
#import "OENESSystemResponderClient.h"
|
||||
#import <OpenGL/gl.h>
|
||||
|
||||
#include "libsnes.h"
|
||||
//#include "../src-fceumm/sound.h"
|
||||
|
||||
//#define SAMPLERATE 32040
|
||||
#define SAMPLERATE 48000
|
||||
#define SAMPLEFRAME 800
|
||||
#define SIZESOUNDBUFFER SAMPLEFRAME*4
|
||||
|
||||
@interface FCEUGameEmu () <OENESSystemResponderClient>
|
||||
@end
|
||||
|
||||
NSUInteger FCEUEmulatorValues[] = { SNES_DEVICE_ID_JOYPAD_A, SNES_DEVICE_ID_JOYPAD_B, SNES_DEVICE_ID_JOYPAD_UP, SNES_DEVICE_ID_JOYPAD_DOWN, SNES_DEVICE_ID_JOYPAD_LEFT, SNES_DEVICE_ID_JOYPAD_RIGHT, SNES_DEVICE_ID_JOYPAD_START, SNES_DEVICE_ID_JOYPAD_SELECT };
|
||||
NSString *FCEUEmulatorKeys[] = { @"Joypad@ A", @"Joypad@ B", @"Joypad@ Up", @"Joypad@ Down", @"Joypad@ Left", @"Joypad@ Right", @"Joypad@ Start", @"Joypad@ Select"};
|
||||
|
||||
FCEUGameEmu *current;
|
||||
@implementation FCEUGameEmu
|
||||
|
||||
static uint16_t conv555Rto565(uint16_t p)
|
||||
{
|
||||
unsigned r, g, b;
|
||||
|
||||
b = (p >> 10);
|
||||
g = (p >> 5) & 0x1f;
|
||||
r = p & 0x1f;
|
||||
|
||||
// 5 to 6 bit
|
||||
g = (g << 1) + (g >> 4);
|
||||
|
||||
return r | (g << 5) | (b << 11);
|
||||
}
|
||||
|
||||
static void audio_callback(uint16_t left, uint16_t right)
|
||||
{
|
||||
[[current ringBufferAtIndex:0] write:&left maxLength:2];
|
||||
[[current ringBufferAtIndex:0] write:&right maxLength:2];
|
||||
}
|
||||
|
||||
static void video_callback(const uint16_t *data, unsigned width, unsigned height)
|
||||
{
|
||||
// Normally our pitch is 2048 bytes.
|
||||
int stride = 1024;
|
||||
// If we have an interlaced mode, pitch is 1024 bytes.
|
||||
if ( height == 256 || height == 478 )
|
||||
stride = 256;
|
||||
|
||||
current->videoWidth = width;
|
||||
current->videoHeight = height;
|
||||
|
||||
dispatch_queue_t the_queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
|
||||
|
||||
// TODO opencl CPU device?
|
||||
dispatch_apply(height, the_queue, ^(size_t y){
|
||||
const uint16_t *src = data + y * stride;
|
||||
uint16_t *dst = current->videoBuffer + y * 256;
|
||||
|
||||
for (int x = 0; x < width; x++) {
|
||||
dst[x] = conv555Rto565(src[x]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static void input_poll_callback(void)
|
||||
{
|
||||
//NSLog(@"poll callback");
|
||||
}
|
||||
|
||||
static int16_t input_state_callback(bool port, unsigned device, unsigned index, unsigned devid)
|
||||
{
|
||||
//NSLog(@"polled input: port: %d device: %d id: %d", port, device, devid);
|
||||
|
||||
if (port == SNES_PORT_1 & device == SNES_DEVICE_JOYPAD) {
|
||||
return current->pad[0][devid];
|
||||
}
|
||||
else if(port == SNES_PORT_2 & device == SNES_DEVICE_JOYPAD) {
|
||||
return current->pad[1][devid];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool environment_callback(unsigned cmd, void *data)
|
||||
{
|
||||
switch (cmd)
|
||||
{
|
||||
case SNES_ENVIRONMENT_GET_FULLPATH:
|
||||
*(const char**)data = [current->romName cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
NSLog(@"Environ FULLPATH: \"%@\"\n", current->romName);
|
||||
break;
|
||||
|
||||
case SNES_ENVIRONMENT_SET_TIMING:
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
NSLog(@"Environ UNSUPPORTED (#%u)!\n", cmd);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void loadSaveFile(const char* path, int type)
|
||||
{
|
||||
FILE *file;
|
||||
|
||||
file = fopen(path, "rb");
|
||||
if ( !file )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
size_t size = snes_get_memory_size(type);
|
||||
uint8_t *data = snes_get_memory_data(type);
|
||||
|
||||
if (size == 0 || !data)
|
||||
{
|
||||
fclose(file);
|
||||
return;
|
||||
}
|
||||
|
||||
int rc = fread(data, sizeof(uint8_t), size, file);
|
||||
if ( rc != size )
|
||||
{
|
||||
NSLog(@"Couldn't load save file.");
|
||||
}
|
||||
|
||||
NSLog(@"Loaded save file: %s", path);
|
||||
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
static void writeSaveFile(const char* path, int type)
|
||||
{
|
||||
size_t size = snes_get_memory_size(type);
|
||||
uint8_t *data = snes_get_memory_data(type);
|
||||
|
||||
if ( data && size > 0 )
|
||||
{
|
||||
FILE *file = fopen(path, "wb");
|
||||
if ( file != NULL )
|
||||
{
|
||||
NSLog(@"Saving state %s. Size: %d bytes.", path, (int)size);
|
||||
if ( fwrite(data, sizeof(uint8_t), size, file) != size )
|
||||
NSLog(@"Did not save state properly.");
|
||||
fclose(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)didPushNESButton:(OENESButton)button forPlayer:(NSUInteger)player;
|
||||
{
|
||||
pad[player-1][FCEUEmulatorValues[button]] = 0xFFFF;
|
||||
//pad[player-1][FCEUEmulatorValues[button]] = 1;
|
||||
}
|
||||
|
||||
- (void)didReleaseNESButton:(OENESButton)button forPlayer:(NSUInteger)player;
|
||||
{
|
||||
pad[player-1][FCEUEmulatorValues[button]] = 0;
|
||||
}
|
||||
|
||||
- (void)didPushFDSChangeSideButton;
|
||||
{
|
||||
|
||||
}
|
||||
- (void)didReleaseFDSChangeSideButton;
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
- (id)init
|
||||
{
|
||||
self = [super init];
|
||||
if(self != nil)
|
||||
{
|
||||
if(videoBuffer)
|
||||
free(videoBuffer);
|
||||
videoBuffer = (uint16_t*)malloc(256 * 240 * 2);
|
||||
}
|
||||
|
||||
current = self;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark Exectuion
|
||||
|
||||
- (void)executeFrame
|
||||
{
|
||||
[self executeFrameSkippingFrame:NO];
|
||||
}
|
||||
|
||||
- (void)executeFrameSkippingFrame: (BOOL) skip
|
||||
{
|
||||
snes_run();
|
||||
}
|
||||
|
||||
- (BOOL)loadFileAtPath: (NSString*) path
|
||||
{
|
||||
memset(pad, 0, sizeof(int16_t) * 16);
|
||||
|
||||
uint8_t *data;
|
||||
unsigned size;
|
||||
romName = [path copy];
|
||||
|
||||
//load cart, read bytes, get length
|
||||
NSData* dataObj = [NSData dataWithContentsOfFile:[romName stringByStandardizingPath]];
|
||||
if(dataObj == nil) return false;
|
||||
size = [dataObj length];
|
||||
data = (uint8_t*)[dataObj bytes];
|
||||
|
||||
//remove copier header, if it exists
|
||||
//ssif((size & 0x7fff) == 512) memmove(data, data + 512, size -= 512);
|
||||
|
||||
//memory.copy(data, size);
|
||||
snes_set_environment(environment_callback);
|
||||
snes_init();
|
||||
|
||||
snes_set_audio_sample(audio_callback);
|
||||
snes_set_video_refresh(video_callback);
|
||||
snes_set_input_poll(input_poll_callback);
|
||||
snes_set_input_state(input_state_callback);
|
||||
|
||||
if(snes_load_cartridge_normal(NULL, data, size))
|
||||
{
|
||||
NSString *path = romName;
|
||||
NSString *extensionlessFilename = [[path lastPathComponent] stringByDeletingPathExtension];
|
||||
|
||||
NSString *batterySavesDirectory = [self batterySavesDirectoryPath];
|
||||
|
||||
// if((batterySavesDirectory != nil) && ![batterySavesDirectory isEqualToString:@""])
|
||||
if([batterySavesDirectory length] != 0)
|
||||
{
|
||||
[[NSFileManager defaultManager] createDirectoryAtPath:batterySavesDirectory withIntermediateDirectories:YES attributes:nil error:NULL];
|
||||
|
||||
NSString *filePath = [batterySavesDirectory stringByAppendingPathComponent:[extensionlessFilename stringByAppendingPathExtension:@"sav"]];
|
||||
|
||||
loadSaveFile([filePath UTF8String], SNES_MEMORY_CARTRIDGE_RAM);
|
||||
}
|
||||
|
||||
snes_set_controller_port_device(SNES_PORT_1, SNES_DEVICE_JOYPAD);
|
||||
snes_set_controller_port_device(SNES_PORT_2, SNES_DEVICE_JOYPAD);
|
||||
|
||||
snes_get_region();
|
||||
|
||||
snes_run();
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
#pragma mark Video
|
||||
- (const void *)videoBuffer
|
||||
{
|
||||
return videoBuffer;
|
||||
}
|
||||
|
||||
- (OEIntRect)screenRect
|
||||
{
|
||||
return OERectMake(0, 0, videoWidth, videoHeight);
|
||||
}
|
||||
|
||||
- (OEIntSize)bufferSize
|
||||
{
|
||||
return OESizeMake(256, 240);
|
||||
}
|
||||
|
||||
- (void)setupEmulation
|
||||
{
|
||||
if(soundBuffer)
|
||||
free(soundBuffer);
|
||||
soundBuffer = (UInt16*)malloc(SIZESOUNDBUFFER* sizeof(UInt16));
|
||||
memset(soundBuffer, 0, SIZESOUNDBUFFER*sizeof(UInt16));
|
||||
}
|
||||
|
||||
- (void)resetEmulation
|
||||
{
|
||||
snes_reset();
|
||||
}
|
||||
|
||||
- (void)stopEmulation
|
||||
{
|
||||
NSString *path = romName;
|
||||
NSString *extensionlessFilename = [[path lastPathComponent] stringByDeletingPathExtension];
|
||||
|
||||
NSString *batterySavesDirectory = [self batterySavesDirectoryPath];
|
||||
|
||||
if([batterySavesDirectory length] != 0)
|
||||
{
|
||||
|
||||
[[NSFileManager defaultManager] createDirectoryAtPath:batterySavesDirectory withIntermediateDirectories:YES attributes:nil error:NULL];
|
||||
|
||||
NSLog(@"Trying to save SRAM");
|
||||
|
||||
NSString *filePath = [batterySavesDirectory stringByAppendingPathComponent:[extensionlessFilename stringByAppendingPathExtension:@"sav"]];
|
||||
|
||||
writeSaveFile([filePath UTF8String], SNES_MEMORY_CARTRIDGE_RAM);
|
||||
}
|
||||
|
||||
NSLog(@"snes term");
|
||||
snes_unload_cartridge();
|
||||
snes_term();
|
||||
[super stopEmulation];
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
free(videoBuffer);
|
||||
free(soundBuffer);
|
||||
}
|
||||
|
||||
- (GLenum)pixelFormat
|
||||
{
|
||||
return GL_RGB;
|
||||
}
|
||||
|
||||
- (GLenum)pixelType
|
||||
{
|
||||
return GL_UNSIGNED_SHORT_5_6_5;
|
||||
}
|
||||
|
||||
- (GLenum)internalPixelFormat
|
||||
{
|
||||
return GL_RGB5;
|
||||
}
|
||||
|
||||
- (NSUInteger)soundBufferSize
|
||||
{
|
||||
return SIZESOUNDBUFFER;
|
||||
}
|
||||
|
||||
- (NSUInteger)frameSampleCount
|
||||
{
|
||||
return SAMPLEFRAME;
|
||||
}
|
||||
|
||||
- (NSUInteger)frameSampleRate
|
||||
{
|
||||
return SAMPLERATE;
|
||||
}
|
||||
|
||||
- (NSTimeInterval)frameInterval
|
||||
{
|
||||
return (snes_get_region() == SNES_REGION_NTSC) ? 60 : 50;
|
||||
}
|
||||
|
||||
- (NSUInteger)channelCount
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
- (BOOL)saveStateToFileAtPath:(NSString *)fileName
|
||||
{
|
||||
int serial_size = snes_serialize_size();
|
||||
uint8_t *serial_data = (uint8_t *) malloc(serial_size);
|
||||
|
||||
snes_serialize(serial_data, serial_size);
|
||||
|
||||
FILE *state_file = fopen([fileName UTF8String], "wb");
|
||||
long bytes_written = fwrite(serial_data, sizeof(uint8_t), serial_size, state_file);
|
||||
|
||||
free(serial_data);
|
||||
|
||||
if( bytes_written != serial_size )
|
||||
{
|
||||
NSLog(@"Couldn't write state");
|
||||
return NO;
|
||||
}
|
||||
fclose( state_file );
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)loadStateFromFileAtPath:(NSString *)fileName
|
||||
{
|
||||
FILE *state_file = fopen([fileName UTF8String], "rb");
|
||||
if( !state_file )
|
||||
{
|
||||
NSLog(@"Could not open state file");
|
||||
return NO;
|
||||
}
|
||||
|
||||
int serial_size = snes_serialize_size();
|
||||
uint8_t *serial_data = (uint8_t *) malloc(serial_size);
|
||||
|
||||
if(!fread(serial_data, sizeof(uint8_t), serial_size, state_file))
|
||||
{
|
||||
NSLog(@"Couldn't read file");
|
||||
return NO;
|
||||
}
|
||||
fclose(state_file);
|
||||
|
||||
if(!snes_unserialize(serial_data, serial_size))
|
||||
{
|
||||
NSLog(@"Couldn't unpack state");
|
||||
return NO;
|
||||
}
|
||||
|
||||
free(serial_data);
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
||||
BIN
Binary file not shown.
+36
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>FCEUX</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.openemu.${PRODUCT_NAME:identifier}</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>BNDL</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0-fceummnext</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>FCEUGameController</string>
|
||||
<key>OEProjectURL</key>
|
||||
<string>http://sourceforge.net/projects/fceumm/</string>
|
||||
<key>OESystemIdentifiers</key>
|
||||
<array>
|
||||
<string>openemu.system.nes</string>
|
||||
</array>
|
||||
<key>SUEnableAutomaticChecks</key>
|
||||
<string>1</string>
|
||||
<key>SUFeedURL</key>
|
||||
<string>http://openemu.org/update/fceu_appcast.xml</string>
|
||||
<key>SUPublicDSAKeyFile</key>
|
||||
<string>dsa_pub.pem</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,9 @@
|
||||
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
@@ -0,0 +1,20 @@
|
||||
-----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-----
|
||||
@@ -0,0 +1,109 @@
|
||||
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
|
||||
Executable
+160
@@ -0,0 +1,160 @@
|
||||
#!/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
|
||||
@@ -0,0 +1,658 @@
|
||||
#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[1], 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];
|
||||
JSReturn[1] = pad[1];
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
Executable
+162
@@ -0,0 +1,162 @@
|
||||
#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
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
#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);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
#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
|
||||
@@ -0,0 +1,103 @@
|
||||
/* 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);
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
/* 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[]=
|
||||
{
|
||||
{®0, 1, "REG0"},
|
||||
{®1, 1, "REG1"},
|
||||
{®2, 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);
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
/* 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);
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
/* 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 SFORMAT StateRegs[]=
|
||||
{
|
||||
{®, 1, "REG"},
|
||||
{0}
|
||||
};
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setprg8(0x6000,reg);
|
||||
setprg32(0x8000,~0);
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
static DECLFW(M108Write)
|
||||
{
|
||||
reg=V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M108Power(void)
|
||||
{
|
||||
Sync();
|
||||
SetReadHandler(0x6000,0x7FFF,CartBR);
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
SetWriteHandler(0x8FFF,0x8FFF,M108Write);
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper108_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=M108Power;
|
||||
GameStateRestore=StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
/* 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);
|
||||
}
|
||||
@@ -0,0 +1,349 @@
|
||||
/* 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);
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
/* 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);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
/* 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 SFORMAT StateRegs[]=
|
||||
{
|
||||
{®, 1, "REG"},
|
||||
{0}
|
||||
};
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setprg8(0x6000,reg);
|
||||
setprg32(0x8000,2);
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
static DECLFW(M120Write)
|
||||
{
|
||||
if(A==0x41FF)
|
||||
{
|
||||
reg=V&7;
|
||||
Sync();
|
||||
}
|
||||
}
|
||||
|
||||
static void M120Power(void)
|
||||
{
|
||||
reg=0;
|
||||
Sync();
|
||||
SetReadHandler(0x6000,0xFFFF,CartBR);
|
||||
SetWriteHandler(0x4100,0x5FFF,M120Write);
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper120_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=M120Power;
|
||||
GameStateRestore=StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
/* 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");
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
/* 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);
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
/* 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);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
/* 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);
|
||||
}
|
||||
@@ -0,0 +1,238 @@
|
||||
/* 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);
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
/* 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[]=
|
||||
{
|
||||
{®, 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");
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/* 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[]=
|
||||
{
|
||||
{®, 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);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
/* 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[]=
|
||||
{
|
||||
{®, 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);
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
/* 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);
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
/* 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[]=
|
||||
{
|
||||
{®, 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);
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
/* 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);
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 CaH4e3
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Gimmick Bootleg (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);
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 CaH4e3
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 *DummyCHR=NULL;
|
||||
static uint8 datareg;
|
||||
static void(*Sync)(void);
|
||||
|
||||
|
||||
static SFORMAT StateRegs[]=
|
||||
{
|
||||
{&datareg, 1, "DREG"},
|
||||
{0}
|
||||
};
|
||||
|
||||
/* on off*/
|
||||
/*1 0x0F, 0xF0 - Bird Week*/
|
||||
/*2 0x33, 0x00 - B-Wings*/
|
||||
/*3 0x11, 0x00 - Mighty Bomb Jack*/
|
||||
/*4 0x22, 0x20 - Sansuu 1 Nen, Sansuu 2 Nen*/
|
||||
/*5 0xFF, 0x00 - Sansuu 3 Nen*/
|
||||
/*6 0x21, 0x13 - Spy vs Spy*/
|
||||
/*7 0x20, 0x21 - Seicross*/
|
||||
|
||||
static void Sync185(void)
|
||||
{
|
||||
/* little dirty eh? ;_)*/
|
||||
if((datareg&3)&&(datareg!=0x13)) /* 1, 2, 3, 4, 5, 6*/
|
||||
setchr8(0);
|
||||
else
|
||||
setchr8r(0x10,0);
|
||||
}
|
||||
|
||||
static void Sync181(void)
|
||||
{
|
||||
if(!(datareg&1)) /* 7*/
|
||||
setchr8(0);
|
||||
else
|
||||
setchr8r(0x10,0);
|
||||
}
|
||||
|
||||
static DECLFW(MWrite)
|
||||
{
|
||||
datareg=V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void MPower(void)
|
||||
{
|
||||
datareg=0;
|
||||
Sync();
|
||||
setprg16(0x8000,0);
|
||||
setprg16(0xC000,~0);
|
||||
SetWriteHandler(0x8000,0xFFFF,MWrite);
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
}
|
||||
|
||||
static void MClose(void)
|
||||
{
|
||||
if(DummyCHR)
|
||||
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);
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 CaH4e3
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Family Study Box by Fukutake Shoten
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 SWRAM[2816];
|
||||
static uint8 *WRAM=NULL;
|
||||
static uint8 regs[4];
|
||||
|
||||
static SFORMAT StateRegs[]=
|
||||
{
|
||||
{regs, 4, "DREG"},
|
||||
{SWRAM, 2816, "SWRAM"},
|
||||
{0}
|
||||
};
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setprg8r(0x10,0x6000,regs[0]>>6);
|
||||
setprg16(0x8000,regs[1]);
|
||||
setprg16(0xc000,0);
|
||||
}
|
||||
|
||||
static DECLFW(M186Write)
|
||||
{
|
||||
if(A&0x4203) regs[A&3]=V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFR(M186Read)
|
||||
{
|
||||
switch(A)
|
||||
{
|
||||
case 0x4200: return 0x00; break;
|
||||
case 0x4201: return 0x00; break;
|
||||
case 0x4202: return 0x40; break;
|
||||
case 0x4203: return 0x00; break;
|
||||
}
|
||||
return 0xFF;
|
||||
}
|
||||
|
||||
static DECLFR(ASWRAM)
|
||||
{
|
||||
return(SWRAM[A-0x4400]);
|
||||
}
|
||||
static DECLFW(BSWRAM)
|
||||
{
|
||||
SWRAM[A-0x4400]=V;
|
||||
}
|
||||
|
||||
static void M186Power(void)
|
||||
{
|
||||
setchr8(0);
|
||||
SetReadHandler(0x6000,0xFFFF,CartBR);
|
||||
SetWriteHandler(0x6000,0xFFFF,CartBW);
|
||||
SetReadHandler(0x4200,0x43FF,M186Read);
|
||||
SetWriteHandler(0x4200,0x43FF,M186Write);
|
||||
SetReadHandler(0x4400,0x4EFF,ASWRAM);
|
||||
SetWriteHandler(0x4400,0x4EFF,BSWRAM);
|
||||
regs[0]=regs[1]=regs[2]=regs[3];
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M186Close(void)
|
||||
{
|
||||
if(WRAM)
|
||||
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);
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
/* 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");
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 CaH4e3
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
#include "mmc3.h"
|
||||
|
||||
static void M189PW(uint32 A, uint8 V)
|
||||
{
|
||||
setprg32(0x8000,EXPREGS[0]&7);
|
||||
}
|
||||
|
||||
static DECLFW(M189Write)
|
||||
{
|
||||
EXPREGS[0]=V|(V>>4); /*actually, there is a two versions of 189 mapper with hi or lo bits bankswitching.*/
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
}
|
||||
|
||||
static void M189Power(void)
|
||||
{
|
||||
EXPREGS[0]=EXPREGS[1]=0;
|
||||
GenMMC3Power();
|
||||
SetWriteHandler(0x4120,0x7FFF,M189Write);
|
||||
}
|
||||
|
||||
void Mapper189_Init(CartInfo *info)
|
||||
{
|
||||
GenMMC3_Init(info, 256, 256, 0, 0);
|
||||
pwrap=M189PW;
|
||||
info->Power=M189Power;
|
||||
AddExState(EXPREGS, 2, 0, "EXPR");
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
/* 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);
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
/* 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");
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 CaH4e3
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
#include "mmc3.h"
|
||||
|
||||
static uint8 lut[256]={
|
||||
0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59,0x59, 0x49, 0x19, 0x09, 0x59, 0x49, 0x19, 0x09,
|
||||
0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59,0x51, 0x41, 0x11, 0x01, 0x51, 0x41, 0x11, 0x01,
|
||||
0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59,0x59, 0x49, 0x19, 0x09, 0x59, 0x49, 0x19, 0x09,
|
||||
0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59,0x51, 0x41, 0x11, 0x01, 0x51, 0x41, 0x11, 0x01,
|
||||
0x00, 0x10, 0x40, 0x50, 0x00, 0x10, 0x40, 0x50,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x08, 0x18, 0x48, 0x58, 0x08, 0x18, 0x48, 0x58,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x10, 0x40, 0x50, 0x00, 0x10, 0x40, 0x50,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x08, 0x18, 0x48, 0x58, 0x08, 0x18, 0x48, 0x58,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59,0x58, 0x48, 0x18, 0x08, 0x58, 0x48, 0x18, 0x08,
|
||||
0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59,0x50, 0x40, 0x10, 0x00, 0x50, 0x40, 0x10, 0x00,
|
||||
0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59,0x58, 0x48, 0x18, 0x08, 0x58, 0x48, 0x18, 0x08,
|
||||
0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59,0x50, 0x40, 0x10, 0x00, 0x50, 0x40, 0x10, 0x00,
|
||||
0x01, 0x11, 0x41, 0x51, 0x01, 0x11, 0x41, 0x51,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x09, 0x19, 0x49, 0x59, 0x09, 0x19, 0x49, 0x59,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x01, 0x11, 0x41, 0x51, 0x01, 0x11, 0x41, 0x51,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x09, 0x19, 0x49, 0x59, 0x09, 0x19, 0x49, 0x59,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
static void M208PW(uint32 A, uint8 V)
|
||||
{
|
||||
setprg32(0x8000,EXPREGS[5]);
|
||||
}
|
||||
|
||||
static DECLFW(M208Write)
|
||||
{
|
||||
EXPREGS[5]=(V&0x1)|((V>>3)&0x2);
|
||||
FixMMC3PRG(MMC3_cmd);
|
||||
}
|
||||
|
||||
static DECLFW(M208ProtWrite)
|
||||
{
|
||||
if(A<=0x57FF)
|
||||
EXPREGS[4]=V;
|
||||
else
|
||||
EXPREGS[(A&0x03)]=V^lut[EXPREGS[4]];
|
||||
}
|
||||
|
||||
static DECLFR(M208ProtRead)
|
||||
{
|
||||
return(EXPREGS[(A&0x3)]);
|
||||
}
|
||||
|
||||
static void M208Power(void)
|
||||
{
|
||||
EXPREGS[5]=3;
|
||||
GenMMC3Power();
|
||||
SetWriteHandler(0x4800,0x4FFF,M208Write);
|
||||
SetWriteHandler(0x5000,0x5fff,M208ProtWrite);
|
||||
SetReadHandler(0x5800,0x5FFF,M208ProtRead);
|
||||
SetReadHandler(0x8000,0xffff,CartBR);
|
||||
}
|
||||
|
||||
void Mapper208_Init(CartInfo *info)
|
||||
{
|
||||
GenMMC3_Init(info, 128, 256, 0, 0);
|
||||
pwrap=M208PW;
|
||||
info->Power=M208Power;
|
||||
AddExState(EXPREGS, 6, 0, "EXPR");
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
/* 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);
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
/* 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);
|
||||
}
|
||||
@@ -0,0 +1,204 @@
|
||||
/* 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"},
|
||||
{®cmd, 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);
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 CaH4e3
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint16 cmdreg;
|
||||
static SFORMAT StateRegs[]=
|
||||
{
|
||||
{&cmdreg, 2, "CMDREG"},
|
||||
{0}
|
||||
};
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
if(cmdreg&0x400)
|
||||
setmirror(MI_0);
|
||||
else
|
||||
setmirror(((cmdreg>>13)&1)^1);
|
||||
if(cmdreg&0x800)
|
||||
{
|
||||
setprg16(0x8000,((cmdreg&0x300)>>3)|((cmdreg&0x1F)<<1)|((cmdreg>>12)&1));
|
||||
setprg16(0xC000,((cmdreg&0x300)>>3)|((cmdreg&0x1F)<<1)|((cmdreg>>12)&1));
|
||||
}
|
||||
else
|
||||
setprg32(0x8000,((cmdreg&0x300)>>4)|(cmdreg&0x1F));
|
||||
}
|
||||
|
||||
static DECLFW(M235Write)
|
||||
{
|
||||
cmdreg=A;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M235Power(void)
|
||||
{
|
||||
setchr8(0);
|
||||
SetWriteHandler(0x8000,0xFFFF,M235Write);
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
cmdreg=0;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M235Restore(int version)
|
||||
{
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper235_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=M235Power;
|
||||
GameStateRestore=M235Restore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
@@ -0,0 +1,166 @@
|
||||
/* 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);
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
/* 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);
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/* 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");
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
/* 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"},
|
||||
{®, 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);
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 CaH4e3
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 prg_reg;
|
||||
static uint8 chr_reg;
|
||||
static uint8 hrd_flag;
|
||||
|
||||
static SFORMAT StateRegs[]=
|
||||
{
|
||||
{&hrd_flag, 1, "DIPSW"},
|
||||
{&prg_reg, 1, "PRG"},
|
||||
{&chr_reg, 1, "CHR"},
|
||||
{0}
|
||||
};
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
if(prg_reg&0x80)
|
||||
setprg32(0x8000,prg_reg>>6);
|
||||
else
|
||||
{
|
||||
setprg16(0x8000,(prg_reg>>5)&3);
|
||||
setprg16(0xC000,(prg_reg>>5)&3);
|
||||
}
|
||||
setmirror((prg_reg&8)>>3);
|
||||
setchr8((chr_reg&3)|(prg_reg&7)|((prg_reg&0x10)>>1));
|
||||
}
|
||||
|
||||
static DECLFR(M57Read)
|
||||
{
|
||||
return hrd_flag;
|
||||
}
|
||||
|
||||
static DECLFW(M57Write)
|
||||
{
|
||||
if((A&0x8800)==0x8800)
|
||||
prg_reg=V;
|
||||
else
|
||||
chr_reg=V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M57Power(void)
|
||||
{
|
||||
prg_reg=0;
|
||||
chr_reg=0;
|
||||
hrd_flag=0;
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
SetWriteHandler(0x8000,0xFFFF,M57Write);
|
||||
SetReadHandler(0x6000,0x6000,M57Read);
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void M57Reset()
|
||||
{
|
||||
hrd_flag++;
|
||||
hrd_flag&=3;
|
||||
FCEU_printf("Select Register = %02x\n",hrd_flag);
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper57_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=M57Power;
|
||||
info->Reset=M57Reset;
|
||||
GameStateRestore=StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/* 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
|
||||
*
|
||||
* SL12 Protected 3-in-1 mapper hardware (VRC2, MMC3, MMC1)
|
||||
* the same as 603-5052 board (TODO: add reading registers, merge)
|
||||
*
|
||||
* Contra Fighter prot board
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
#include "mmc3.h"
|
||||
|
||||
static uint8 lut[4] = { 0x00, 0x02, 0x02, 0x03 };
|
||||
|
||||
static DECLFW(UNL6035052ProtWrite)
|
||||
{
|
||||
EXPREGS[0]=lut[V&3];
|
||||
}
|
||||
|
||||
static DECLFR(UNL6035052ProtRead)
|
||||
{
|
||||
return EXPREGS[0];
|
||||
}
|
||||
|
||||
static void UNL6035052Power(void)
|
||||
{
|
||||
GenMMC3Power();
|
||||
SetWriteHandler(0x4020,0x7FFF,UNL6035052ProtWrite);
|
||||
SetReadHandler(0x4020,0x7FFF,UNL6035052ProtRead);
|
||||
}
|
||||
|
||||
void UNL6035052_Init(CartInfo *info)
|
||||
{
|
||||
GenMMC3_Init(info, 128, 256, 0, 0);
|
||||
info->Power=UNL6035052Power;
|
||||
AddExState(EXPREGS, 6, 0, "EXPR");
|
||||
}
|
||||
@@ -0,0 +1,179 @@
|
||||
/* 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);
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 CaH4e3
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint16 cmdreg;
|
||||
static uint8 invalid_data;
|
||||
static SFORMAT StateRegs[]=
|
||||
{
|
||||
{&invalid_data, 1, "INVD"},
|
||||
{&cmdreg, 2, "CMDREG"},
|
||||
{0}
|
||||
};
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setprg16r((cmdreg&0x060)>>5,0x8000,(cmdreg&0x01C)>>2);
|
||||
setprg16r((cmdreg&0x060)>>5,0xC000,(cmdreg&0x200)?(~0):0);
|
||||
setmirror(((cmdreg&2)>>1)^1);
|
||||
}
|
||||
|
||||
static DECLFR(UNL8157Read)
|
||||
{
|
||||
if(invalid_data&&cmdreg&0x100)
|
||||
return 0xFF;
|
||||
else
|
||||
return CartBR(A);
|
||||
}
|
||||
|
||||
static DECLFW(UNL8157Write)
|
||||
{
|
||||
cmdreg=A;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void UNL8157Power(void)
|
||||
{
|
||||
setchr8(0);
|
||||
SetWriteHandler(0x8000,0xFFFF,UNL8157Write);
|
||||
SetReadHandler(0x8000,0xFFFF,UNL8157Read);
|
||||
cmdreg=0x200;
|
||||
invalid_data=1;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void UNL8157Reset(void)
|
||||
{
|
||||
cmdreg=0;
|
||||
invalid_data^=1;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void UNL8157Restore(int version)
|
||||
{
|
||||
Sync();
|
||||
}
|
||||
|
||||
void UNL8157_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=UNL8157Power;
|
||||
info->Reset=UNL8157Reset;
|
||||
GameStateRestore=UNL8157Restore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
@@ -0,0 +1,206 @@
|
||||
/* 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");
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
/* 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");
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 CaH4e3
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 reg[8];
|
||||
static uint8 mirror, cmd, is154;
|
||||
|
||||
static SFORMAT StateRegs[]=
|
||||
{
|
||||
{&cmd, 1, "CMD"},
|
||||
{&mirror, 1, "MIRR"},
|
||||
{reg, 8, "REGS"},
|
||||
{0}
|
||||
};
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setchr2(0x0000,reg[0]>>1);
|
||||
setchr2(0x0800,reg[1]>>1);
|
||||
setchr1(0x1000,reg[2]|0x40);
|
||||
setchr1(0x1400,reg[3]|0x40);
|
||||
setchr1(0x1800,reg[4]|0x40);
|
||||
setchr1(0x1C00,reg[5]|0x40);
|
||||
setprg8(0x8000,reg[6]);
|
||||
setprg8(0xA000,reg[7]);
|
||||
}
|
||||
|
||||
static void MSync(void)
|
||||
{
|
||||
if(is154)setmirror(MI_0+(mirror&1));
|
||||
}
|
||||
|
||||
static DECLFW(M88Write)
|
||||
{
|
||||
switch(A&0x8001)
|
||||
{
|
||||
case 0x8000: cmd=V&7; mirror=V>>6; MSync(); break;
|
||||
case 0x8001: reg[cmd]=V; Sync(); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void M88Power(void)
|
||||
{
|
||||
setprg16(0xC000,~0);
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
SetWriteHandler(0x8000,0xFFFF,M88Write);
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
Sync();
|
||||
MSync();
|
||||
}
|
||||
|
||||
void Mapper88_Init(CartInfo *info)
|
||||
{
|
||||
is154=0;
|
||||
info->Power=M88Power;
|
||||
GameStateRestore=StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
void Mapper154_Init(CartInfo *info)
|
||||
{
|
||||
is154=1;
|
||||
info->Power=M88Power;
|
||||
GameStateRestore=StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
@@ -0,0 +1,509 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
* Copyright (C) 2005 CaH4e3
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
/*#define DEBUG90*/
|
||||
|
||||
/* Mapper 090 is simpliest mapper hardware and have not extended nametable control and latched chr banks in 4k mode*/
|
||||
/* Mapper 209 much compicated hardware with decribed above features disabled by default and switchable by command*/
|
||||
/* Mapper 211 the same mapper 209 but with forced nametable control*/
|
||||
|
||||
static int is209;
|
||||
static int is211;
|
||||
|
||||
static uint8 IRQMode; /* from $c001*/
|
||||
static uint8 IRQPre; /* from $c004*/
|
||||
static uint8 IRQPreSize; /* from $c007*/
|
||||
static uint8 IRQCount; /* from $c005*/
|
||||
static uint8 IRQXOR; /* Loaded from $C006*/
|
||||
static uint8 IRQa; /* $c002, $c003, and $c000*/
|
||||
|
||||
static uint8 mul[2];
|
||||
static uint8 regie;
|
||||
|
||||
static uint8 tkcom[4];
|
||||
static uint8 prgb[4];
|
||||
static uint8 chrlow[8];
|
||||
static uint8 chrhigh[8];
|
||||
|
||||
static uint8 chr[2];
|
||||
|
||||
static uint16 names[4];
|
||||
static uint8 tekker;
|
||||
|
||||
static SFORMAT Tek_StateRegs[]={
|
||||
{&IRQMode, 1, "IRQMODE"},
|
||||
{&IRQPre, 1, "IRQPRE"},
|
||||
{&IRQPreSize, 1, "IRQPRESIZE"},
|
||||
{&IRQCount, 1, "IRQC"},
|
||||
{&IRQXOR, 1, "IRQXOR"},
|
||||
{&IRQa, 1, "IRQa"},
|
||||
{mul, 2, "MUL"},
|
||||
{®ie, 1, "REGI"},
|
||||
{tkcom, 4, "TKCO"},
|
||||
{prgb, 4, "PRGB"},
|
||||
{chr, 2, "CHRLATCH"},
|
||||
{chrlow, 4, "CHRL"},
|
||||
{chrhigh, 8, "CHRH"},
|
||||
{&names[0], 2|FCEUSTATE_RLSB, "NMS0"},
|
||||
{&names[1], 2|FCEUSTATE_RLSB, "NMS1"},
|
||||
{&names[2], 2|FCEUSTATE_RLSB, "NMS2"},
|
||||
{&names[3], 2|FCEUSTATE_RLSB, "NMS3"},
|
||||
{&tekker, 1, "TEKR"},
|
||||
{0}
|
||||
};
|
||||
|
||||
static void mira(void)
|
||||
{
|
||||
if((tkcom[0]&0x20&&is209)||is211)
|
||||
{
|
||||
int x;
|
||||
if(tkcom[0]&0x40) /* Name tables are ROM-only*/
|
||||
{
|
||||
for(x=0;x<4;x++)
|
||||
setntamem(CHRptr[0]+(((names[x])&CHRmask1[0])<<10),0,x);
|
||||
}
|
||||
else /* Name tables can be RAM or ROM.*/
|
||||
{
|
||||
for(x=0;x<4;x++)
|
||||
{
|
||||
if((tkcom[1]&0x80)==(names[x]&0x80)) /* RAM selected.*/
|
||||
setntamem(NTARAM+((names[x]&0x1)<<10),1,x);
|
||||
else
|
||||
setntamem(CHRptr[0]+(((names[x])&CHRmask1[0])<<10),0,x);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(tkcom[1]&3)
|
||||
{
|
||||
case 0: setmirror(MI_V); break;
|
||||
case 1: setmirror(MI_H); break;
|
||||
case 2: setmirror(MI_0); break;
|
||||
case 3: setmirror(MI_1); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void tekprom(void) /* TODO: verify for single, small multi and large multi*/
|
||||
{
|
||||
uint32 bankmode=((tkcom[3]&6)<<5);
|
||||
switch(tkcom[0]&7)
|
||||
{
|
||||
case 00: if(tkcom[0]&0x80)
|
||||
setprg8(0x6000,(((prgb[3]<<2)+3)&0x3F)|bankmode);
|
||||
setprg32(0x8000,(prgb[3]&7)|((tkcom[3]&7)<<3));
|
||||
break;
|
||||
case 01: if(tkcom[0]&0x80)
|
||||
setprg8(0x6000,(((prgb[3]<<1)+1)&0x3F)|bankmode);
|
||||
setprg16(0x8000,(prgb[1]&0x0F)|((tkcom[3]&7)<<4));
|
||||
setprg16(0xC000,0x0F|((tkcom[3]&7)<<4));
|
||||
break;
|
||||
case 03: /* bit reversion*/
|
||||
case 02:
|
||||
if(tkcom[0]&0x80)
|
||||
setprg8(0x6000,(prgb[3]&0x1F)|((tkcom[3]&7)<<5)); /* 45in1 multy has different bits, seems board was hacked to support big data banks*/
|
||||
setprg8(0x8000,(prgb[0]&0x1F)|((tkcom[3]&7)<<5));
|
||||
setprg8(0xa000,(prgb[1]&0x1F)|((tkcom[3]&7)<<5));
|
||||
setprg8(0xc000,(prgb[2]&0x1F)|((tkcom[3]&7)<<5));
|
||||
setprg8(0xe000,0x1F|((tkcom[3]&7)<<5));
|
||||
/* setprg8(0xe000,(prgb[3]&0x0F)|((tkcom[3]&6)<<3));*/
|
||||
/* setprg32(0x8000,((prgb[0]&0x0F)>>2)|((tkcom[3]&6)<<3));*/
|
||||
break;
|
||||
case 04: if(tkcom[0]&0x80)
|
||||
setprg8(0x6000,(((prgb[3]<<2)+3)&0x3F)|bankmode);
|
||||
setprg32(0x8000,(prgb[3]&0x0F)|((tkcom[3]&6)<<3));
|
||||
break;
|
||||
case 05: if(tkcom[0]&0x80)
|
||||
setprg8(0x6000,(((prgb[3]<<1)+1)&0x3F)|bankmode);
|
||||
setprg16(0x8000,(prgb[1]&0x1F)|((tkcom[3]&6)<<4));
|
||||
setprg16(0xC000,(prgb[3]&0x1F)|((tkcom[3]&6)<<4));
|
||||
break;
|
||||
case 07: /* bit reversion*/
|
||||
case 06: if(tkcom[0]&0x80)
|
||||
setprg8(0x6000,(prgb[3]&0x3F)|bankmode);
|
||||
setprg8(0x8000,(prgb[0]&0x3F)|bankmode);
|
||||
setprg8(0xa000,(prgb[1]&0x3F)|bankmode);
|
||||
setprg8(0xc000,(prgb[2]&0x3F)|bankmode);
|
||||
setprg8(0xe000,(prgb[3]&0x3F)|bankmode);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void tekvrom(void)
|
||||
{
|
||||
int x, bank=0, mask=0xFFFF;
|
||||
if(!(tkcom[3]&0x20))
|
||||
{
|
||||
bank=(tkcom[3]&1)|((tkcom[3]&0x18)>>2);
|
||||
switch (tkcom[0]&0x18)
|
||||
{
|
||||
case 0x00: bank<<=5; mask=0x1F; break;
|
||||
case 0x08: bank<<=6; mask=0x3F; break;
|
||||
case 0x10: bank<<=7; mask=0x7F; break;
|
||||
case 0x18: bank<<=8; mask=0xFF; break;
|
||||
}
|
||||
}
|
||||
switch(tkcom[0]&0x18)
|
||||
{
|
||||
case 0x00: /* 8KB*/
|
||||
setchr8(((chrlow[0]|(chrhigh[0]<<8))&mask)|bank);
|
||||
break;
|
||||
case 0x08: /* 4KB*/
|
||||
/* for(x=0;x<8;x+=4)*/
|
||||
/* setchr4(x<<10,((chrlow[x]|(chrhigh[x]<<8))&mask)|bank);*/
|
||||
setchr4(0x0000,((chrlow[chr[0]]|(chrhigh[chr[0]]<<8))&mask)|bank);
|
||||
setchr4(0x1000,((chrlow[chr[1]]|(chrhigh[chr[1]]<<8))&mask)|bank);
|
||||
break;
|
||||
case 0x10: /* 2KB*/
|
||||
for(x=0;x<8;x+=2)
|
||||
setchr2(x<<10,((chrlow[x]|(chrhigh[x]<<8))&mask)|bank);
|
||||
break;
|
||||
case 0x18: /* 1KB*/
|
||||
for(x=0;x<8;x++)
|
||||
setchr1(x<<10,((chrlow[x]|(chrhigh[x]<<8))&mask)|bank);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(M90TekWrite)
|
||||
{
|
||||
switch(A&0x5C03)
|
||||
{
|
||||
case 0x5800: mul[0]=V; break;
|
||||
case 0x5801: mul[1]=V; break;
|
||||
case 0x5803: regie=V; break;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFR(M90TekRead)
|
||||
{
|
||||
switch(A&0x5C03)
|
||||
{
|
||||
case 0x5800: return (mul[0]*mul[1]);
|
||||
case 0x5801: return((mul[0]*mul[1])>>8);
|
||||
case 0x5803: return (regie);
|
||||
default: return tekker;
|
||||
}
|
||||
return(0xff);
|
||||
}
|
||||
|
||||
static DECLFW(M90PRGWrite)
|
||||
{
|
||||
/* FCEU_printf("bs %04x %02x\n",A,V);*/
|
||||
prgb[A&3]=V;
|
||||
tekprom();
|
||||
}
|
||||
|
||||
static DECLFW(M90CHRlowWrite)
|
||||
{
|
||||
/* FCEU_printf("bs %04x %02x\n",A,V);*/
|
||||
chrlow[A&7]=V;
|
||||
tekvrom();
|
||||
}
|
||||
|
||||
static DECLFW(M90CHRhiWrite)
|
||||
{
|
||||
/* FCEU_printf("bs %04x %02x\n",A,V);*/
|
||||
chrhigh[A&7]=V;
|
||||
tekvrom();
|
||||
}
|
||||
|
||||
static DECLFW(M90NTWrite)
|
||||
{
|
||||
/* FCEU_printf("bs %04x %02x\n",A,V);*/
|
||||
if(A&4)
|
||||
{
|
||||
names[A&3]&=0x00FF;
|
||||
names[A&3]|=V<<8;
|
||||
}
|
||||
else
|
||||
{
|
||||
names[A&3]&=0xFF00;
|
||||
names[A&3]|=V;
|
||||
}
|
||||
mira();
|
||||
}
|
||||
|
||||
static DECLFW(M90IRQWrite)
|
||||
{
|
||||
/* FCEU_printf("bs %04x %02x\n",A,V);*/
|
||||
switch(A&7)
|
||||
{
|
||||
case 00: /*FCEU_printf("%s IRQ (C000)\n",V&1?"Enable":"Disable");*/
|
||||
IRQa=V&1;if(!(V&1)) X6502_IRQEnd(FCEU_IQEXT);break;
|
||||
case 02: /*FCEU_printf("Disable IRQ (C002) scanline=%d\n", scanline);*/
|
||||
IRQa=0;X6502_IRQEnd(FCEU_IQEXT);break;
|
||||
case 03: /*FCEU_printf("Enable IRQ (C003) scanline=%d\n", scanline);*/
|
||||
IRQa=1;break;
|
||||
case 01: IRQMode=V;
|
||||
/*FCEU_printf("IRQ Count method: ");
|
||||
switch (IRQMode&3)
|
||||
{
|
||||
case 00: FCEU_printf("M2 cycles\n");break;
|
||||
case 01: FCEU_printf("PPU A12 toggles\n");break;
|
||||
case 02: FCEU_printf("PPU reads\n");break;
|
||||
case 03: FCEU_printf("Writes to CPU space\n");break;
|
||||
}
|
||||
FCEU_printf("Counter prescaler size: %s\n",(IRQMode&4)?"3 bits":"8 bits");
|
||||
FCEU_printf("Counter prescaler size adjust: %s\n",(IRQMode&8)?"Used C007":"Normal Operation");
|
||||
if((IRQMode>>6)==2) FCEU_printf("Counter Down\n");
|
||||
else if((IRQMode>>6)==1) FCEU_printf("Counter Up\n");
|
||||
else FCEU_printf("Counter Stopped\n");*/
|
||||
break;
|
||||
case 04: /*FCEU_printf("Pre Counter Loaded and Xored wiht C006: %d\n",V^IRQXOR);*/
|
||||
IRQPre=V^IRQXOR;break;
|
||||
case 05: /*FCEU_printf("Main Counter Loaded and Xored wiht C006: %d\n",V^IRQXOR);*/
|
||||
IRQCount=V^IRQXOR;break;
|
||||
case 06: /*FCEU_printf("Xor Value: %d\n",V);*/
|
||||
IRQXOR=V;break;
|
||||
case 07: /*if(!(IRQMode&8)) FCEU_printf("C001 is clear, no effect applied\n");*/
|
||||
/* else if(V==0xFF) FCEU_printf("Prescaler is changed for 12bits\n");*/
|
||||
/* else FCEU_printf("Counter Stopped\n");*/
|
||||
IRQPreSize=V;break;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(M90ModeWrite)
|
||||
{
|
||||
/* FCEU_printf("bs %04x %02x\n",A,V);*/
|
||||
tkcom[A&3]=V;
|
||||
tekprom();
|
||||
tekvrom();
|
||||
mira();
|
||||
|
||||
#ifdef DEBUG90
|
||||
switch (A&3)
|
||||
{
|
||||
case 00: FCEU_printf("Main Control Register:\n");
|
||||
FCEU_printf(" PGR Banking mode: %d\n",V&7);
|
||||
FCEU_printf(" CHR Banking mode: %d\n",(V>>3)&3);
|
||||
FCEU_printf(" 6000-7FFF addresses mapping: %s\n",(V&0x80)?"Yes":"No");
|
||||
FCEU_printf(" Nametable control: %s\n",(V&0x20)?"Enabled":"Disabled");
|
||||
if(V&0x20)
|
||||
FCEU_printf(" Nametable can be: %s\n",(V&0x40)?"ROM Only":"RAM or ROM");
|
||||
break;
|
||||
case 01: FCEU_printf("Mirroring mode: ");
|
||||
switch (V&3)
|
||||
{
|
||||
case 0: FCEU_printf("Vertical\n");break;
|
||||
case 1: FCEU_printf("Horizontal\n");break;
|
||||
case 2: FCEU_printf("Nametable 0 only\n");break;
|
||||
case 3: FCEU_printf("Nametable 1 only\n");break;
|
||||
}
|
||||
FCEU_printf("Mirroring flag: %s\n",(V&0x80)?"On":"Off");
|
||||
break;
|
||||
case 02: if((((tkcom[0])>>5)&3)==1)
|
||||
FCEU_printf("Nametable ROM/RAM select mode: %d\n",V>>7);
|
||||
break;
|
||||
case 03:
|
||||
FCEU_printf("CHR Banking mode: %s\n",(V&0x20)?"Entire CHR ROM":"256Kb Switching mode");
|
||||
if(!(V&0x20)) FCEU_printf("256K CHR bank number: %02x\n",(V&1)|((V&0x18)>>2));
|
||||
FCEU_printf("512K PRG bank number: %d\n",(V&6)>>1);
|
||||
FCEU_printf("CHR Bank mirroring: %s\n",(V&0x80)?"Swapped":"Normal operate");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static DECLFW(M90DummyWrite)
|
||||
{
|
||||
/* FCEU_printf("bs %04x %02x\n",A,V);*/
|
||||
}
|
||||
|
||||
static void CCL(void)
|
||||
{
|
||||
if((IRQMode>>6) == 1) /* Count Up*/
|
||||
{
|
||||
IRQCount++;
|
||||
if((IRQCount == 0) && IRQa)
|
||||
{
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
}
|
||||
}
|
||||
else if((IRQMode>>6) == 2) /* Count down*/
|
||||
{
|
||||
IRQCount--;
|
||||
if((IRQCount == 0xFF) && IRQa)
|
||||
{
|
||||
X6502_IRQBegin(FCEU_IQEXT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void ClockCounter(void)
|
||||
{
|
||||
uint8 premask;
|
||||
|
||||
if(IRQMode & 0x4)
|
||||
premask = 0x7;
|
||||
else
|
||||
premask = 0xFF;
|
||||
if((IRQMode>>6) == 1) /* Count up*/
|
||||
{
|
||||
IRQPre++;
|
||||
if((IRQPre & premask) == 0) CCL();
|
||||
}
|
||||
else if((IRQMode>>6) == 2) /* Count down*/
|
||||
{
|
||||
IRQPre--;
|
||||
if((IRQPre & premask) == premask) CCL();
|
||||
}
|
||||
}
|
||||
|
||||
void CPUWrap(int a)
|
||||
{
|
||||
int x;
|
||||
if((IRQMode&3)==0) for(x=0;x<a;x++) ClockCounter();
|
||||
}
|
||||
|
||||
static void SLWrap(void)
|
||||
{
|
||||
int x;
|
||||
if((IRQMode&3)==1) for(x=0;x<8;x++) ClockCounter();
|
||||
}
|
||||
|
||||
static uint32 lastread;
|
||||
static void M90PPU(uint32 A)
|
||||
{
|
||||
if((IRQMode&3)==2)
|
||||
{
|
||||
if(lastread!=A)
|
||||
{
|
||||
ClockCounter();
|
||||
ClockCounter();
|
||||
}
|
||||
lastread=A;
|
||||
}
|
||||
|
||||
if(is209)
|
||||
{
|
||||
uint8 l,h;
|
||||
h=A>>8;
|
||||
if(h<0x20&&((h&0x0F)==0xF))
|
||||
{
|
||||
l=A&0xF0;
|
||||
if(l==0xD0)
|
||||
{
|
||||
chr[(h&0x10)>>4]=((h&0x10)>>2);
|
||||
tekvrom();
|
||||
}
|
||||
else if(l==0xE0)
|
||||
{
|
||||
chr[(h&0x10)>>4]=((h&0x10)>>2)|2;
|
||||
tekvrom();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
chr[0]=0;
|
||||
chr[1]=4;
|
||||
}
|
||||
}
|
||||
|
||||
static void togglie()
|
||||
{
|
||||
tekker+=0x40;
|
||||
tekker&=0xC0;
|
||||
FCEU_printf("tekker=%02x\n",tekker);
|
||||
memset(tkcom,0x00,sizeof(tkcom));
|
||||
memset(prgb,0xff,sizeof(prgb));
|
||||
tekprom();
|
||||
tekvrom();
|
||||
}
|
||||
|
||||
static void M90Restore(int version)
|
||||
{
|
||||
tekprom();
|
||||
tekvrom();
|
||||
mira();
|
||||
}
|
||||
|
||||
static void M90Power(void)
|
||||
{
|
||||
SetWriteHandler(0x5000,0x5fff,M90TekWrite);
|
||||
SetWriteHandler(0x8000,0x8ff0,M90PRGWrite);
|
||||
SetWriteHandler(0x9000,0x9fff,M90CHRlowWrite);
|
||||
SetWriteHandler(0xA000,0xAfff,M90CHRhiWrite);
|
||||
SetWriteHandler(0xB000,0xBfff,M90NTWrite);
|
||||
SetWriteHandler(0xC000,0xCfff,M90IRQWrite);
|
||||
SetWriteHandler(0xD000,0xD5ff,M90ModeWrite);
|
||||
SetWriteHandler(0xE000,0xFfff,M90DummyWrite);
|
||||
|
||||
SetReadHandler(0x5000,0x5fff,M90TekRead);
|
||||
SetReadHandler(0x6000,0xffff,CartBR);
|
||||
|
||||
mul[0]=mul[1]=regie=0xFF;
|
||||
|
||||
memset(tkcom,0x00,sizeof(tkcom));
|
||||
memset(prgb,0xff,sizeof(prgb));
|
||||
memset(chrlow,0xff,sizeof(chrlow));
|
||||
memset(chrhigh,0xff,sizeof(chrhigh));
|
||||
memset(names,0x00,sizeof(names));
|
||||
|
||||
if(is211)
|
||||
tekker=0xC0;
|
||||
else
|
||||
tekker=0x00;
|
||||
|
||||
tekprom();
|
||||
tekvrom();
|
||||
}
|
||||
|
||||
|
||||
void Mapper90_Init(CartInfo *info)
|
||||
{
|
||||
is211=0;
|
||||
is209=0;
|
||||
info->Reset=togglie;
|
||||
info->Power=M90Power;
|
||||
PPU_hook=M90PPU;
|
||||
MapIRQHook=CPUWrap;
|
||||
GameHBIRQHook2=SLWrap;
|
||||
GameStateRestore=M90Restore;
|
||||
AddExState(Tek_StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
void Mapper209_Init(CartInfo *info)
|
||||
{
|
||||
is211=0;
|
||||
is209=1;
|
||||
info->Reset=togglie;
|
||||
info->Power=M90Power;
|
||||
PPU_hook=M90PPU;
|
||||
MapIRQHook=CPUWrap;
|
||||
GameHBIRQHook2=SLWrap;
|
||||
GameStateRestore=M90Restore;
|
||||
AddExState(Tek_StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
void Mapper211_Init(CartInfo *info)
|
||||
{
|
||||
is211=1;
|
||||
info->Reset=togglie;
|
||||
info->Power=M90Power;
|
||||
PPU_hook=M90PPU;
|
||||
MapIRQHook=CPUWrap;
|
||||
GameHBIRQHook2=SLWrap;
|
||||
GameStateRestore=M90Restore;
|
||||
AddExState(Tek_StateRegs, ~0, 0, 0);
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
/* 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;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
/* 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[]=
|
||||
{
|
||||
{®, 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);
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
/* 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[]=
|
||||
{
|
||||
{®, 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);
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
/* 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"},
|
||||
{®, 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);
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
/* 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);
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
/* 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);
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
/* 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);
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
|
||||
#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;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
#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
|
||||
@@ -0,0 +1,80 @@
|
||||
/* 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");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
/* 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[]=
|
||||
{
|
||||
{®, 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);
|
||||
}
|
||||
@@ -0,0 +1,253 @@
|
||||
/* 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);
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
/* 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);
|
||||
}
|
||||
@@ -0,0 +1,171 @@
|
||||
/* 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);
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 CaH4e3
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* BMC 42-in-1 reset switch
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 bank_mode;
|
||||
static uint8 bank_value;
|
||||
static uint8 prgb[4];
|
||||
static SFORMAT StateRegs[]=
|
||||
{
|
||||
{0}
|
||||
};
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
FCEU_printf("%02x: %02x %02x\n", bank_mode, bank_value, prgb[0]);
|
||||
switch(bank_mode&7)
|
||||
{
|
||||
case 0:
|
||||
setprg32(0x8000,bank_value&7); break;
|
||||
case 1:
|
||||
setprg16(0x8000,((8+(bank_value&7))>>1)+prgb[1]);
|
||||
setprg16(0xC000,(bank_value&7)>>1);
|
||||
case 4:
|
||||
setprg32(0x8000,8+(bank_value&7)); break;
|
||||
case 5:
|
||||
setprg16(0x8000,((8+(bank_value&7))>>1)+prgb[1]);
|
||||
setprg16(0xC000,((8+(bank_value&7))>>1)+prgb[3]);
|
||||
case 2:
|
||||
setprg8(0x8000,prgb[0]>>2);
|
||||
setprg8(0xa000,prgb[1]);
|
||||
setprg8(0xc000,prgb[2]);
|
||||
setprg8(0xe000,~0);
|
||||
break;
|
||||
case 3:
|
||||
setprg8(0x8000,prgb[0]);
|
||||
setprg8(0xa000,prgb[1]);
|
||||
setprg8(0xc000,prgb[2]);
|
||||
setprg8(0xe000,prgb[3]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(BMC13in1JY110Write)
|
||||
{
|
||||
FCEU_printf("%04x:%04x\n",A,V);
|
||||
switch(A)
|
||||
{
|
||||
case 0x8000:
|
||||
case 0x8001:
|
||||
case 0x8002:
|
||||
case 0x8003: prgb[A&3]=V; break;
|
||||
case 0xD000: bank_mode=V; break;
|
||||
case 0xD001: setmirror(V&3);
|
||||
case 0xD002: break;
|
||||
case 0xD003: bank_value=V; break;
|
||||
}
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void BMC13in1JY110Power(void)
|
||||
{
|
||||
prgb[0]=prgb[1]=prgb[2]=prgb[3]=0;
|
||||
bank_mode=0;
|
||||
bank_value=0;
|
||||
setprg32(0x8000,0);
|
||||
setchr8(0);
|
||||
SetWriteHandler(0x8000,0xFFFF,BMC13in1JY110Write);
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
Sync();
|
||||
}
|
||||
|
||||
void BMC13in1JY110_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=BMC13in1JY110Power;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
GameStateRestore=StateRestore;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
/* 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;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 CaH4e3
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* BMC 42-in-1 reset switch
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 regs[4];
|
||||
|
||||
static SFORMAT StateRegs[]=
|
||||
{
|
||||
{regs, 4, "REGS"},
|
||||
{0}
|
||||
};
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
if(regs[0]&0x80)
|
||||
{
|
||||
if(regs[1]&0x80)
|
||||
setprg32(0x8000,regs[1]&0x1F);
|
||||
else
|
||||
{
|
||||
int bank=((regs[1]&0x1f)<<1)|((regs[1]>>6)&1);
|
||||
setprg16(0x8000,bank);
|
||||
setprg16(0xC000,bank);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int bank=((regs[1]&0x1f)<<1)|((regs[1]>>6)&1);
|
||||
setprg16(0xC000,bank);
|
||||
}
|
||||
if(regs[0]&0x20)
|
||||
setmirror(MI_H);
|
||||
else
|
||||
setmirror(MI_V);
|
||||
setchr8((regs[2]<<2)|((regs[0]>>1)&3));
|
||||
}
|
||||
|
||||
static DECLFW(BMC64in1nrWriteLo)
|
||||
{
|
||||
regs[A&3]=V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(BMC64in1nrWriteHi)
|
||||
{
|
||||
regs[3]=V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void BMC64in1nrPower(void)
|
||||
{
|
||||
regs[0]=0x80;
|
||||
regs[1]=0x43;
|
||||
regs[2]=regs[3]=0;
|
||||
Sync();
|
||||
SetWriteHandler(0x5000,0x5003,BMC64in1nrWriteLo);
|
||||
SetWriteHandler(0x8000,0xFFFF,BMC64in1nrWriteHi);
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
Sync();
|
||||
}
|
||||
|
||||
void BMC64in1nr_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=BMC64in1nrPower;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
GameStateRestore=StateRestore;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 CaH4e3
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 is_large_banks, hw_switch;
|
||||
static uint8 large_bank;
|
||||
static uint8 prg_bank;
|
||||
static uint8 chr_bank;
|
||||
static uint8 bank_mode;
|
||||
static uint8 mirroring;
|
||||
static SFORMAT StateRegs[]=
|
||||
{
|
||||
{&large_bank, 1, "LB"},
|
||||
{&hw_switch, 1, "DIPSW"},
|
||||
{&prg_bank, 1, "PRG"},
|
||||
{&chr_bank, 1, "CHR"},
|
||||
{&bank_mode, 1, "BM"},
|
||||
{&mirroring, 1, "MIRR"},
|
||||
{0}
|
||||
};
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
switch (bank_mode)
|
||||
{
|
||||
case 0x00:
|
||||
case 0x10: setprg16(0x8000,large_bank|prg_bank);
|
||||
setprg16(0xC000,large_bank|7);
|
||||
break;
|
||||
case 0x20: setprg32(0x8000,(large_bank|prg_bank)>>1);
|
||||
break;
|
||||
case 0x30: setprg16(0x8000,large_bank|prg_bank);
|
||||
setprg16(0xC000,large_bank|prg_bank);
|
||||
break;
|
||||
}
|
||||
setmirror(mirroring);
|
||||
if(!is_large_banks)
|
||||
setchr8(chr_bank);
|
||||
}
|
||||
|
||||
static DECLFR(BMC70in1Read)
|
||||
{
|
||||
if(bank_mode==0x10)
|
||||
/* if(is_large_banks)*/
|
||||
return CartBR((A&0xFFF0)|hw_switch);
|
||||
/* else*/
|
||||
/* return CartBR((A&0xFFF0)|hw_switch);*/
|
||||
else
|
||||
return CartBR(A);
|
||||
}
|
||||
|
||||
static DECLFW(BMC70in1Write)
|
||||
{
|
||||
if(A&0x4000)
|
||||
{
|
||||
bank_mode=A&0x30;
|
||||
prg_bank=A&7;
|
||||
}
|
||||
else
|
||||
{
|
||||
mirroring=((A&0x20)>>5)^1;
|
||||
if(is_large_banks)
|
||||
large_bank=(A&3)<<3;
|
||||
else
|
||||
chr_bank=A&7;
|
||||
}
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void BMC70in1Reset(void)
|
||||
{
|
||||
bank_mode=0;
|
||||
large_bank=0;
|
||||
Sync();
|
||||
hw_switch++;
|
||||
hw_switch&=0xf;
|
||||
}
|
||||
|
||||
static void BMC70in1Power(void)
|
||||
{
|
||||
setchr8(0);
|
||||
bank_mode=0;
|
||||
large_bank=0;
|
||||
Sync();
|
||||
SetReadHandler(0x8000,0xFFFF,BMC70in1Read);
|
||||
SetWriteHandler(0x8000,0xffff,BMC70in1Write);
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
Sync();
|
||||
}
|
||||
|
||||
void BMC70in1_Init(CartInfo *info)
|
||||
{
|
||||
is_large_banks=0;
|
||||
hw_switch=0xd;
|
||||
info->Power=BMC70in1Power;
|
||||
info->Reset=BMC70in1Reset;
|
||||
GameStateRestore=StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
|
||||
void BMC70in1B_Init(CartInfo *info)
|
||||
{
|
||||
is_large_banks=1;
|
||||
hw_switch=0x6;
|
||||
info->Power=BMC70in1Power;
|
||||
info->Reset=BMC70in1Reset;
|
||||
GameStateRestore=StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 CaH4e3
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
#define CARD_EXTERNAL_INSERED 0x80
|
||||
|
||||
static uint8 prg_reg;
|
||||
static uint8 chr_reg;
|
||||
static SFORMAT StateRegs[]=
|
||||
{
|
||||
{&prg_reg, 1, "PREG"},
|
||||
{&chr_reg, 1, "CREG"},
|
||||
{0}
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
cmd[0] = response on/off
|
||||
0x00 - on
|
||||
0x80 - off
|
||||
cmd[1] = cmd
|
||||
|
||||
|
||||
_GET_CHALLENGE: .BYTE 0,$B4, 0, 0,$62
|
||||
|
||||
_SELECT_FILE_1_0200: .BYTE 0,$A4, 1, 0, 2, 2, 0
|
||||
_SELECT_FILE_2_0201: .BYTE 0,$A4, 2, 0, 2, 2, 1
|
||||
_SELECT_FILE_2_0203: .BYTE 0,$A4, 2, 0, 2, 2, 3
|
||||
_SELECT_FILE_2_0204: .BYTE 0,$A4, 2, 0, 2, 2, 4
|
||||
_SELECT_FILE_2_0205: .BYTE 0,$A4, 2, 0, 2, 2, 5
|
||||
_SELECT_FILE_2_3F04: .BYTE 0,$A4, 2, 0, 2,$3F, 4
|
||||
_SELECT_FILE_2_4F00: .BYTE 0,$A4, 2, 0, 2,$4F, 0
|
||||
|
||||
_READ_BINARY_5: .BYTE 0,$B0,$85, 0, 2
|
||||
_READ_BINARY_6: .BYTE 0,$B0,$86, 0, 4
|
||||
_READ_BINARY_6_0: .BYTE 0,$B0,$86, 0,$18
|
||||
_READ_BINARY_0: .BYTE 0,$B0, 0, 2, 3
|
||||
_READ_BINARY_0_0: .BYTE 0,$B0, 0, 0, 4
|
||||
_READ_BINARY_0_1: .BYTE 0,$B0, 0, 0, $C
|
||||
_READ_BINARY_0_2: .BYTE 0,$B0, 0, 0,$10
|
||||
|
||||
_UPDATE_BINARY: .BYTE 0,$D6, 0, 0, 4
|
||||
_UPDATE_BINARY_0: .BYTE 0,$D6, 0, 0,$10
|
||||
|
||||
_GET_RESPONSE: .BYTE $80,$C0, 2,$A1, 8
|
||||
_GET_RESPONSE_0: .BYTE 0,$C0, 0, 0, 2
|
||||
_GET_RESPONSE_1: .BYTE 0,$C0, 0, 0, 6
|
||||
_GET_RESPONSE_2: .BYTE 0,$C0, 0, 0, 8
|
||||
_GET_RESPONSE_3: .BYTE 0,$C0, 0, 0, $C
|
||||
_GET_RESPONSE_4: .BYTE 0,$C0, 0, 0,$10
|
||||
|
||||
byte_8C0B: .BYTE $80,$30, 0, 2, $A, 0, 1
|
||||
byte_8C48: .BYTE $80,$32, 0, 1, 4
|
||||
byte_8C89: .BYTE $80,$34, 0, 0, 8, 0, 0
|
||||
byte_8D01: .BYTE $80,$36, 0, 0, $C
|
||||
byte_8CA7: .BYTE $80,$38, 0, 2, 4
|
||||
byte_8BEC: .BYTE $80,$3A, 0, 3, 0
|
||||
|
||||
byte_89A0: .BYTE 0,$48, 0, 0, 6
|
||||
byte_8808: .BYTE 0,$54, 0, 0,$1C
|
||||
byte_89BF: .BYTE 0,$58, 0, 0,$1C
|
||||
|
||||
_MANAGE_CHANNEL: .BYTE 0,$70, 0, 0, 8
|
||||
byte_8CE5: .BYTE 0,$74, 0, 0,$12
|
||||
byte_8C29: .BYTE 0,$76, 0, 0, 8
|
||||
byte_8CC6: .BYTE 0,$78, 0, 0,$12
|
||||
*/
|
||||
|
||||
static uint8 sim0reset[0x1F] = { 0x3B, 0xE9, 0x00, 0xFF, 0xC1, 0x10, 0x31, 0xFE,
|
||||
0x55, 0xC8, 0x10, 0x20, 0x55, 0x47, 0x4F, 0x53,
|
||||
0x56, 0x53, 0x43, 0xAD, 0x10, 0x10, 0x10, 0x10,
|
||||
0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10 };
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setprg32(0x8000, prg_reg);
|
||||
setchr8(chr_reg);
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(M216WriteHi)
|
||||
{
|
||||
prg_reg=A&1;
|
||||
chr_reg=(A&0x0E)>>1;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(M216Write5000)
|
||||
{
|
||||
/* FCEU_printf("WRITE: %04x:%04x (PC=%02x cnt=%02x)\n",A,V,X.PC,sim0bcnt);*/
|
||||
}
|
||||
|
||||
static DECLFR(M216Read5000)
|
||||
{
|
||||
/* FCEU_printf("READ: %04x PC=%04x out=%02x byte=%02x cnt=%02x bit=%02x\n",A,X.PC,sim0out,sim0byte,sim0bcnt,sim0bit);*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void Power(void)
|
||||
{
|
||||
prg_reg = 0;
|
||||
chr_reg = 0;
|
||||
Sync();
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
SetWriteHandler(0x8000,0xFFFF,M216WriteHi);
|
||||
SetWriteHandler(0x5000,0x5000,M216Write5000);
|
||||
SetReadHandler(0x5000,0x5000,M216Read5000);
|
||||
}
|
||||
|
||||
|
||||
void Mapper216_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=Power;
|
||||
GameStateRestore=StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
/* 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);
|
||||
}
|
||||
@@ -0,0 +1,378 @@
|
||||
/* 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
|
||||
@@ -0,0 +1,600 @@
|
||||
/* 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
|
||||
@@ -0,0 +1,111 @@
|
||||
/* 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);
|
||||
}
|
||||
@@ -0,0 +1,429 @@
|
||||
/* 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");
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 cmd;
|
||||
static uint8 DRegs[8];
|
||||
|
||||
static SFORMAT DEI_StateRegs[]=
|
||||
{
|
||||
{&cmd, 1, "CMD"},
|
||||
{DRegs, 8, "DREG"},
|
||||
{0}
|
||||
};
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
int x;
|
||||
setchr2(0x0000,DRegs[0]);
|
||||
setchr2(0x0800,DRegs[1]);
|
||||
for(x=0;x<4;x++)
|
||||
setchr1(0x1000+(x<<10),DRegs[2+x]);
|
||||
setprg8(0x8000,DRegs[6]);
|
||||
setprg8(0xa000,DRegs[7]);
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(DEIWrite)
|
||||
{
|
||||
switch(A&0x8001)
|
||||
{
|
||||
case 0x8000: cmd=V&0x07; break;
|
||||
case 0x8001: if(cmd<=0x05)
|
||||
V&=0x3F;
|
||||
else
|
||||
V&=0x0F;
|
||||
if(cmd<=0x01) V>>=1;
|
||||
DRegs[cmd&0x07]=V;
|
||||
Sync();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void DEIPower(void)
|
||||
{
|
||||
setprg8(0xc000,0xE);
|
||||
setprg8(0xe000,0xF);
|
||||
cmd=0;
|
||||
memset(DRegs,0,8);
|
||||
Sync();
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
SetWriteHandler(0x8000,0xFFFF,DEIWrite);
|
||||
}
|
||||
|
||||
|
||||
void DEIROM_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=DEIPower;
|
||||
GameStateRestore=StateRestore;
|
||||
AddExState(&DEI_StateRegs, ~0, 0, 0);
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/* FCE Ultra - NES/Famicom Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2005 CaH4e3
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 latche;
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setprg16(0x8000,latche);
|
||||
setprg16(0xC000,8);
|
||||
}
|
||||
|
||||
static DECLFW(DREAMWrite)
|
||||
{
|
||||
latche=V&7;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void DREAMPower(void)
|
||||
{
|
||||
latche=0;
|
||||
Sync();
|
||||
setchr8(0);
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
SetWriteHandler(0x5020,0x5020,DREAMWrite);
|
||||
}
|
||||
|
||||
static void Restore(int version)
|
||||
{
|
||||
Sync();
|
||||
}
|
||||
|
||||
void DreamTech01_Init(CartInfo *info)
|
||||
{
|
||||
GameStateRestore=Restore;
|
||||
info->Power=DREAMPower;
|
||||
AddExState(&latche, 1, 0, "LATCH");
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
/* 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);
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
/* 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[]=
|
||||
{
|
||||
{®, 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);
|
||||
}
|
||||
@@ -0,0 +1,222 @@
|
||||
/* 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");
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
/* 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);
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/* 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[]=
|
||||
{
|
||||
{®, 1, "REGS"},
|
||||
{&mirr, 1, "MIRR"},
|
||||
{0}
|
||||
};
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setprg8r(1,0x6000,0);
|
||||
setprg32(0x8000,reg);
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
static DECLFW(BMCGS2004Write)
|
||||
{
|
||||
reg=V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void BMCGS2004Power(void)
|
||||
{
|
||||
reg=~0;
|
||||
Sync();
|
||||
SetReadHandler(0x6000,0x7FFF,CartBR);
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
SetWriteHandler(0x8000,0xFFFF,BMCGS2004Write);
|
||||
}
|
||||
|
||||
static void BMCGS2004Reset(void)
|
||||
{
|
||||
reg=~0;
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
Sync();
|
||||
}
|
||||
|
||||
void BMCGS2004_Init(CartInfo *info)
|
||||
{
|
||||
info->Reset=BMCGS2004Reset;
|
||||
info->Power=BMCGS2004Power;
|
||||
GameStateRestore=StateRestore;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/* 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[]=
|
||||
{
|
||||
{®, 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);
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
/* 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");
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
/* 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"
|
||||
|
||||
extern uint32 ROM_size;
|
||||
static uint8 latche;
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
if(latche)
|
||||
{
|
||||
if(latche&0x10)
|
||||
setprg16(0x8000,(latche&7));
|
||||
else
|
||||
setprg16(0x8000,(latche&7)|8);
|
||||
}
|
||||
else
|
||||
setprg16(0x8000,7+(ROM_size>>4));
|
||||
}
|
||||
|
||||
static DECLFW(M188Write)
|
||||
{
|
||||
latche=V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFR(ExtDev)
|
||||
{
|
||||
return(3);
|
||||
}
|
||||
|
||||
static void Power(void)
|
||||
{
|
||||
latche=0;
|
||||
Sync();
|
||||
setchr8(0);
|
||||
setprg16(0xc000,0x7);
|
||||
SetReadHandler(0x6000,0x7FFF,ExtDev);
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
SetWriteHandler(0x8000,0xFFFF,M188Write);
|
||||
}
|
||||
|
||||
static void StateRestore(int version)
|
||||
{
|
||||
Sync();
|
||||
}
|
||||
|
||||
void Mapper188_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=Power;
|
||||
GameStateRestore=StateRestore;
|
||||
AddExState(&latche, 1, 0, "LATCH");
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/* 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 DECLFW(UNLKOF97CMDWrite)
|
||||
{
|
||||
V=(V&0xD8)|((V&0x20)>>4)|((V&4)<<3)|((V&2)>>1)|((V&1)<<2); /*76143502*/
|
||||
if(A==0x9000) A=0x8001;
|
||||
MMC3_CMDWrite(A,V);
|
||||
}
|
||||
|
||||
static DECLFW(UNLKOF97IRQWrite)
|
||||
{
|
||||
V=(V&0xD8)|((V&0x20)>>4)|((V&4)<<3)|((V&2)>>1)|((V&1)<<2);
|
||||
if(A==0xD000) A=0xC001;
|
||||
else if(A==0xF000) A=0xE001;
|
||||
MMC3_IRQWrite(A,V);
|
||||
}
|
||||
|
||||
static void UNLKOF97Power(void)
|
||||
{
|
||||
GenMMC3Power();
|
||||
SetWriteHandler(0x8000,0xA000,UNLKOF97CMDWrite);
|
||||
SetWriteHandler(0xC000,0xF000,UNLKOF97IRQWrite);
|
||||
}
|
||||
|
||||
void UNLKOF97_Init(CartInfo *info)
|
||||
{
|
||||
GenMMC3_Init(info, 128, 256, 0, 0);
|
||||
info->Power=UNLKOF97Power;
|
||||
}
|
||||
@@ -0,0 +1,238 @@
|
||||
/* 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);
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
/* 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 chr;
|
||||
static SFORMAT StateRegs[]=
|
||||
{
|
||||
{&chr, 1, "CHR"},
|
||||
{0}
|
||||
};
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setprg2r(0,0xE000,0);
|
||||
setprg2r(0,0xE800,0);
|
||||
setprg2r(0,0xF000,0);
|
||||
setprg2r(0,0xF800,0);
|
||||
|
||||
setprg8r(1,0x6000,3);
|
||||
setprg8r(1,0x8000,0);
|
||||
setprg8r(1,0xA000,1);
|
||||
setprg8r(1,0xC000,2);
|
||||
|
||||
setchr8(chr & 1);
|
||||
setmirror(MI_V);
|
||||
}
|
||||
|
||||
static DECLFW(LE05Write)
|
||||
{
|
||||
chr = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void LE05Power(void)
|
||||
{
|
||||
Sync();
|
||||
SetReadHandler(0x6000,0xFFFF,CartBR);
|
||||
SetWriteHandler(0x8000,0xFFFF,LE05Write);
|
||||
}
|
||||
|
||||
void LE05_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=LE05Power;
|
||||
AddExState(&StateRegs, ~0, 0, 0);
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/* 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
|
||||
*
|
||||
* FDS Conversion
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 WRAM[2048];
|
||||
|
||||
static void MALEEPower(void)
|
||||
{
|
||||
setprg2r(0x10,0x7000,0);
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
SetReadHandler(0x6000,0x67FF,CartBR);
|
||||
SetReadHandler(0x7000,0x77FF,CartBR);
|
||||
SetWriteHandler(0x7000,0x77FF,CartBW);
|
||||
setprg2r(1,0x6000,0);
|
||||
setprg32(0x8000,0);
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
void MALEE_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=MALEEPower;
|
||||
SetupCartPRGMapping(0x10, WRAM, 2048, 1);
|
||||
AddExState(WRAM, 2048, 0,"RAM");
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user