Initial commit - http://sourceforge.net/p/fceumm/code/160/
This commit is contained in:
25
Authors
Normal file
25
Authors
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
A list of people who have contributed code to FCE Ultra follows.
|
||||||
|
Please note that the "Contributions" field may not be all inclusive;
|
||||||
|
the coder may have done more than what is listed.
|
||||||
|
|
||||||
|
Name/Alias Contributions Contact Information
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
Aaron Oneal Many changes to compile http://www.morphgear.com
|
||||||
|
with MSVC and first frame
|
||||||
|
skipping code.
|
||||||
|
|
||||||
|
BERO Base FCE code. bero at geocities.co.jp
|
||||||
|
|
||||||
|
CaH4e3 Some mapper code. CaH4e3 at mail dot ru
|
||||||
|
|
||||||
|
Joe Nahmias man pages.
|
||||||
|
|
||||||
|
Mitsutaka YM2413 emulator.
|
||||||
|
Okazaki
|
||||||
|
|
||||||
|
Paul Various code for the official kuliniew at purdue.edu
|
||||||
|
Kuliniewicz SDL port.
|
||||||
|
|
||||||
|
Quietust VRC7 "translation" code. quietust at ircN dot org
|
||||||
|
|
||||||
|
Xodnizel Most of the FCE Ultra code. http://xodnizel.net/
|
||||||
341
Copying
Normal file
341
Copying
Normal file
@@ -0,0 +1,341 @@
|
|||||||
|
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 2, June 1991
|
||||||
|
|
||||||
|
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||||
|
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The licenses for most software are designed to take away your
|
||||||
|
freedom to share and change it. By contrast, the GNU General Public
|
||||||
|
License is intended to guarantee your freedom to share and change free
|
||||||
|
software--to make sure the software is free for all its users. This
|
||||||
|
General Public License applies to most of the Free Software
|
||||||
|
Foundation's software and to any other program whose authors commit to
|
||||||
|
using it. (Some other Free Software Foundation software is covered by
|
||||||
|
the GNU Library General Public License instead.) You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
this service if you wish), that you receive source code or can get it
|
||||||
|
if you want it, that you can change the software or use pieces of it
|
||||||
|
in new free programs; and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to make restrictions that forbid
|
||||||
|
anyone to deny you these rights or to ask you to surrender the rights.
|
||||||
|
These restrictions translate to certain responsibilities for you if you
|
||||||
|
distribute copies of the software, or if you modify it.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must give the recipients all the rights that
|
||||||
|
you have. You must make sure that they, too, receive or can get the
|
||||||
|
source code. And you must show them these terms so they know their
|
||||||
|
rights.
|
||||||
|
|
||||||
|
We protect your rights with two steps: (1) copyright the software, and
|
||||||
|
(2) offer you this license which gives you legal permission to copy,
|
||||||
|
distribute and/or modify the software.
|
||||||
|
|
||||||
|
Also, for each author's protection and ours, we want to make certain
|
||||||
|
that everyone understands that there is no warranty for this free
|
||||||
|
software. If the software is modified by someone else and passed on, we
|
||||||
|
want its recipients to know that what they have is not the original, so
|
||||||
|
that any problems introduced by others will not reflect on the original
|
||||||
|
authors' reputations.
|
||||||
|
|
||||||
|
Finally, any free program is threatened constantly by software
|
||||||
|
patents. We wish to avoid the danger that redistributors of a free
|
||||||
|
program will individually obtain patent licenses, in effect making the
|
||||||
|
program proprietary. To prevent this, we have made it clear that any
|
||||||
|
patent must be licensed for everyone's free use or not licensed at all.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
0. This License applies to any program or other work which contains
|
||||||
|
a notice placed by the copyright holder saying it may be distributed
|
||||||
|
under the terms of this General Public License. The "Program", below,
|
||||||
|
refers to any such program or work, and a "work based on the Program"
|
||||||
|
means either the Program or any derivative work under copyright law:
|
||||||
|
that is to say, a work containing the Program or a portion of it,
|
||||||
|
either verbatim or with modifications and/or translated into another
|
||||||
|
language. (Hereinafter, translation is included without limitation in
|
||||||
|
the term "modification".) Each licensee is addressed as "you".
|
||||||
|
|
||||||
|
Activities other than copying, distribution and modification are not
|
||||||
|
covered by this License; they are outside its scope. The act of
|
||||||
|
running the Program is not restricted, and the output from the Program
|
||||||
|
is covered only if its contents constitute a work based on the
|
||||||
|
Program (independent of having been made by running the Program).
|
||||||
|
Whether that is true depends on what the Program does.
|
||||||
|
|
||||||
|
1. You may copy and distribute verbatim copies of the Program's
|
||||||
|
source code as you receive it, in any medium, provided that you
|
||||||
|
conspicuously and appropriately publish on each copy an appropriate
|
||||||
|
copyright notice and disclaimer of warranty; keep intact all the
|
||||||
|
notices that refer to this License and to the absence of any warranty;
|
||||||
|
and give any other recipients of the Program a copy of this License
|
||||||
|
along with the Program.
|
||||||
|
|
||||||
|
You may charge a fee for the physical act of transferring a copy, and
|
||||||
|
you may at your option offer warranty protection in exchange for a fee.
|
||||||
|
|
||||||
|
2. You may modify your copy or copies of the Program or any portion
|
||||||
|
of it, thus forming a work based on the Program, and copy and
|
||||||
|
distribute such modifications or work under the terms of Section 1
|
||||||
|
above, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) You must cause the modified files to carry prominent notices
|
||||||
|
stating that you changed the files and the date of any change.
|
||||||
|
|
||||||
|
b) You must cause any work that you distribute or publish, that in
|
||||||
|
whole or in part contains or is derived from the Program or any
|
||||||
|
part thereof, to be licensed as a whole at no charge to all third
|
||||||
|
parties under the terms of this License.
|
||||||
|
|
||||||
|
c) If the modified program normally reads commands interactively
|
||||||
|
when run, you must cause it, when started running for such
|
||||||
|
interactive use in the most ordinary way, to print or display an
|
||||||
|
announcement including an appropriate copyright notice and a
|
||||||
|
notice that there is no warranty (or else, saying that you provide
|
||||||
|
a warranty) and that users may redistribute the program under
|
||||||
|
these conditions, and telling the user how to view a copy of this
|
||||||
|
License. (Exception: if the Program itself is interactive but
|
||||||
|
does not normally print such an announcement, your work based on
|
||||||
|
the Program is not required to print an announcement.)
|
||||||
|
|
||||||
|
These requirements apply to the modified work as a whole. If
|
||||||
|
identifiable sections of that work are not derived from the Program,
|
||||||
|
and can be reasonably considered independent and separate works in
|
||||||
|
themselves, then this License, and its terms, do not apply to those
|
||||||
|
sections when you distribute them as separate works. But when you
|
||||||
|
distribute the same sections as part of a whole which is a work based
|
||||||
|
on the Program, the distribution of the whole must be on the terms of
|
||||||
|
this License, whose permissions for other licensees extend to the
|
||||||
|
entire whole, and thus to each and every part regardless of who wrote it.
|
||||||
|
|
||||||
|
Thus, it is not the intent of this section to claim rights or contest
|
||||||
|
your rights to work written entirely by you; rather, the intent is to
|
||||||
|
exercise the right to control the distribution of derivative or
|
||||||
|
collective works based on the Program.
|
||||||
|
|
||||||
|
In addition, mere aggregation of another work not based on the Program
|
||||||
|
with the Program (or with a work based on the Program) on a volume of
|
||||||
|
a storage or distribution medium does not bring the other work under
|
||||||
|
the scope of this License.
|
||||||
|
|
||||||
|
3. You may copy and distribute the Program (or a work based on it,
|
||||||
|
under Section 2) in object code or executable form under the terms of
|
||||||
|
Sections 1 and 2 above provided that you also do one of the following:
|
||||||
|
|
||||||
|
a) Accompany it with the complete corresponding machine-readable
|
||||||
|
source code, which must be distributed under the terms of Sections
|
||||||
|
1 and 2 above on a medium customarily used for software interchange; or,
|
||||||
|
|
||||||
|
b) Accompany it with a written offer, valid for at least three
|
||||||
|
years, to give any third party, for a charge no more than your
|
||||||
|
cost of physically performing source distribution, a complete
|
||||||
|
machine-readable copy of the corresponding source code, to be
|
||||||
|
distributed under the terms of Sections 1 and 2 above on a medium
|
||||||
|
customarily used for software interchange; or,
|
||||||
|
|
||||||
|
c) Accompany it with the information you received as to the offer
|
||||||
|
to distribute corresponding source code. (This alternative is
|
||||||
|
allowed only for noncommercial distribution and only if you
|
||||||
|
received the program in object code or executable form with such
|
||||||
|
an offer, in accord with Subsection b above.)
|
||||||
|
|
||||||
|
The source code for a work means the preferred form of the work for
|
||||||
|
making modifications to it. For an executable work, complete source
|
||||||
|
code means all the source code for all modules it contains, plus any
|
||||||
|
associated interface definition files, plus the scripts used to
|
||||||
|
control compilation and installation of the executable. However, as a
|
||||||
|
special exception, the source code distributed need not include
|
||||||
|
anything that is normally distributed (in either source or binary
|
||||||
|
form) with the major components (compiler, kernel, and so on) of the
|
||||||
|
operating system on which the executable runs, unless that component
|
||||||
|
itself accompanies the executable.
|
||||||
|
|
||||||
|
If distribution of executable or object code is made by offering
|
||||||
|
access to copy from a designated place, then offering equivalent
|
||||||
|
access to copy the source code from the same place counts as
|
||||||
|
distribution of the source code, even though third parties are not
|
||||||
|
compelled to copy the source along with the object code.
|
||||||
|
|
||||||
|
4. You may not copy, modify, sublicense, or distribute the Program
|
||||||
|
except as expressly provided under this License. Any attempt
|
||||||
|
otherwise to copy, modify, sublicense or distribute the Program is
|
||||||
|
void, and will automatically terminate your rights under this License.
|
||||||
|
However, parties who have received copies, or rights, from you under
|
||||||
|
this License will not have their licenses terminated so long as such
|
||||||
|
parties remain in full compliance.
|
||||||
|
|
||||||
|
5. You are not required to accept this License, since you have not
|
||||||
|
signed it. However, nothing else grants you permission to modify or
|
||||||
|
distribute the Program or its derivative works. These actions are
|
||||||
|
prohibited by law if you do not accept this License. Therefore, by
|
||||||
|
modifying or distributing the Program (or any work based on the
|
||||||
|
Program), you indicate your acceptance of this License to do so, and
|
||||||
|
all its terms and conditions for copying, distributing or modifying
|
||||||
|
the Program or works based on it.
|
||||||
|
|
||||||
|
6. Each time you redistribute the Program (or any work based on the
|
||||||
|
Program), the recipient automatically receives a license from the
|
||||||
|
original licensor to copy, distribute or modify the Program subject to
|
||||||
|
these terms and conditions. You may not impose any further
|
||||||
|
restrictions on the recipients' exercise of the rights granted herein.
|
||||||
|
You are not responsible for enforcing compliance by third parties to
|
||||||
|
this License.
|
||||||
|
|
||||||
|
7. If, as a consequence of a court judgment or allegation of patent
|
||||||
|
infringement or for any other reason (not limited to patent issues),
|
||||||
|
conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot
|
||||||
|
distribute so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you
|
||||||
|
may not distribute the Program at all. For example, if a patent
|
||||||
|
license would not permit royalty-free redistribution of the Program by
|
||||||
|
all those who receive copies directly or indirectly through you, then
|
||||||
|
the only way you could satisfy both it and this License would be to
|
||||||
|
refrain entirely from distribution of the Program.
|
||||||
|
|
||||||
|
If any portion of this section is held invalid or unenforceable under
|
||||||
|
any particular circumstance, the balance of the section is intended to
|
||||||
|
apply and the section as a whole is intended to apply in other
|
||||||
|
circumstances.
|
||||||
|
|
||||||
|
It is not the purpose of this section to induce you to infringe any
|
||||||
|
patents or other property right claims or to contest validity of any
|
||||||
|
such claims; this section has the sole purpose of protecting the
|
||||||
|
integrity of the free software distribution system, which is
|
||||||
|
implemented by public license practices. Many people have made
|
||||||
|
generous contributions to the wide range of software distributed
|
||||||
|
through that system in reliance on consistent application of that
|
||||||
|
system; it is up to the author/donor to decide if he or she is willing
|
||||||
|
to distribute software through any other system and a licensee cannot
|
||||||
|
impose that choice.
|
||||||
|
|
||||||
|
This section is intended to make thoroughly clear what is believed to
|
||||||
|
be a consequence of the rest of this License.
|
||||||
|
|
||||||
|
8. If the distribution and/or use of the Program is restricted in
|
||||||
|
certain countries either by patents or by copyrighted interfaces, the
|
||||||
|
original copyright holder who places the Program under this License
|
||||||
|
may add an explicit geographical distribution limitation excluding
|
||||||
|
those countries, so that distribution is permitted only in or among
|
||||||
|
countries not thus excluded. In such case, this License incorporates
|
||||||
|
the limitation as if written in the body of this License.
|
||||||
|
|
||||||
|
9. The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Program
|
||||||
|
specifies a version number of this License which applies to it and "any
|
||||||
|
later version", you have the option of following the terms and conditions
|
||||||
|
either of that version or of any later version published by the Free
|
||||||
|
Software Foundation. If the Program does not specify a version number of
|
||||||
|
this License, you may choose any version ever published by the Free Software
|
||||||
|
Foundation.
|
||||||
|
|
||||||
|
10. If you wish to incorporate parts of the Program into other free
|
||||||
|
programs whose distribution conditions are different, write to the author
|
||||||
|
to ask for permission. For software which is copyrighted by the Free
|
||||||
|
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||||
|
make exceptions for this. Our decision will be guided by the two goals
|
||||||
|
of preserving the free status of all derivatives of our free software and
|
||||||
|
of promoting the sharing and reuse of software generally.
|
||||||
|
|
||||||
|
NO WARRANTY
|
||||||
|
|
||||||
|
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||||
|
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||||
|
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||||
|
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||||
|
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||||
|
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||||
|
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||||
|
REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||||
|
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||||
|
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||||
|
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||||
|
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||||
|
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
convey the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program is interactive, make it output a short notice like this
|
||||||
|
when it starts in an interactive mode:
|
||||||
|
|
||||||
|
Gnomovision version 69, Copyright (C) year name of author
|
||||||
|
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, the commands you use may
|
||||||
|
be called something other than `show w' and `show c'; they could even be
|
||||||
|
mouse-clicks or menu items--whatever suits your program.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or your
|
||||||
|
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||||
|
necessary. Here is a sample; alter the names:
|
||||||
|
|
||||||
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||||
|
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||||
|
|
||||||
|
<signature of Ty Coon>, 1 April 1989
|
||||||
|
Ty Coon, President of Vice
|
||||||
|
|
||||||
|
This General Public License does not permit incorporating your program into
|
||||||
|
proprietary programs. If your program is a subroutine library, you may
|
||||||
|
consider it more useful to permit linking proprietary applications with the
|
||||||
|
library. If this is what you want to do, use the GNU Library General
|
||||||
|
Public License instead of this License.
|
||||||
3169
Fceuwin.dev
Normal file
3169
Fceuwin.dev
Normal file
File diff suppressed because it is too large
Load Diff
139
Makefile.libretro
Normal file
139
Makefile.libretro
Normal file
@@ -0,0 +1,139 @@
|
|||||||
|
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
|
||||||
|
|
||||||
|
# system platform
|
||||||
|
system_platform = unix
|
||||||
|
ifeq ($(shell uname -a),)
|
||||||
|
EXE_EXT = .exe
|
||||||
|
system_platform = win
|
||||||
|
else ifneq ($(findstring Darwin,$(shell uname -a)),)
|
||||||
|
system_platform = osx
|
||||||
|
else ifneq ($(findstring MINGW,$(shell uname -a)),)
|
||||||
|
system_platform = win
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(platform), unix)
|
||||||
|
TARGET := libretro.so
|
||||||
|
fpic := -fPIC
|
||||||
|
SHARED := -shared -Wl,--version-script=src/drivers/libretro/link.T -Wl,-no-undefined
|
||||||
|
ENDIANNESS_DEFINES = -DLSB_FIRST -DLOCAL_LE=1
|
||||||
|
ZLIB_DIR := ./src/zlib
|
||||||
|
else ifeq ($(platform), osx)
|
||||||
|
TARGET := libretro.dylib
|
||||||
|
fpic := -fPIC
|
||||||
|
SHARED := -dynamiclib
|
||||||
|
ENDIANNESS_DEFINES = -DLSB_FIRST -DLOCAL_LE=1
|
||||||
|
CFLAGS += -DHAVE_ASPRINTF
|
||||||
|
else ifeq ($(platform), ps3)
|
||||||
|
TARGET := libretro_ps3.a
|
||||||
|
CC = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-gcc.exe
|
||||||
|
AR = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ar.exe
|
||||||
|
PLATFORM_DEFINES := -D__CELLOS_LV2
|
||||||
|
else ifeq ($(platform), sncps3)
|
||||||
|
TARGET := libretro_ps3.a
|
||||||
|
CC = $(CELL_SDK)/host-win32/sn/bin/ps3ppusnc.exe
|
||||||
|
AR = $(CELL_SDK)/host-win32/sn/bin/ps3snarl.exe
|
||||||
|
PLATFORM_DEFINES := -D__CELLOS_LV2
|
||||||
|
else ifeq ($(platform), psl1ght)
|
||||||
|
TARGET := libretro_psl1ght.a
|
||||||
|
CC = $(PS3DEV)/ppu/bin/ppu-gcc$(EXE_EXT)
|
||||||
|
AR = $(PS3DEV)/ppu/bin/ppu-ar$(EXE_EXT)
|
||||||
|
PLATFORM_DEFINES := -D__CELLOS_LV2 -DHAVE_ASPRINTF
|
||||||
|
else ifeq ($(platform), xenon)
|
||||||
|
TARGET := libretro_xenon360.a
|
||||||
|
CC = xenon-gcc$(EXE_EXT)
|
||||||
|
AR = xenon-ar$(EXE_EXT)
|
||||||
|
PLATFORM_DEFINES := -D__LIBXENON__
|
||||||
|
CFLAGS += -DHAVE_ASPRINTF
|
||||||
|
else ifeq ($(platform), ngc)
|
||||||
|
TARGET := libretro_ngc.a
|
||||||
|
CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
|
||||||
|
AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT)
|
||||||
|
PLATFORM_DEFINES := -DGEKKO -DHW_DOL -mrvl -mcpu=750 -meabi -mhard-float
|
||||||
|
CFLAGS += -DHAVE_ASPRINTF
|
||||||
|
else ifeq ($(platform), wii)
|
||||||
|
TARGET := libretro_wii.a
|
||||||
|
CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
|
||||||
|
AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT)
|
||||||
|
PLATFORM_DEFINES := -DGEKKO -DHW_RVL -mrvl -mcpu=750 -meabi -mhard-float
|
||||||
|
CFLAGS += -DHAVE_ASPRINTF
|
||||||
|
else
|
||||||
|
TARGET := retro.dll
|
||||||
|
CC = gcc
|
||||||
|
SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=src/drivers/libretro/link.T
|
||||||
|
ENDIANNESS_DEFINES = -DLSB_FIRST -DLOCAL_LE=1
|
||||||
|
ZLIB_DIR := ./src/zlib
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(DEBUG), 1)
|
||||||
|
CFLAGS += -O0 -g
|
||||||
|
else
|
||||||
|
CFLAGS += -O3 -DNDEBUG
|
||||||
|
endif
|
||||||
|
|
||||||
|
LIBRETRO_DIR := ./src/drivers/libretro
|
||||||
|
FCEU_DIR := ./src
|
||||||
|
|
||||||
|
FCEU_SRC_DIRS := $(LIBRETRO_DIR) $(FCEU_DIR) $(FCEU_DIR)/boards $(FCEU_DIR)/input $(FCEU_DIR)/mappers $(ZLIB_DIR)
|
||||||
|
|
||||||
|
FCEU_CSRCS := $(foreach dir,$(FCEU_SRC_DIRS),$(wildcard $(dir)/*.c))
|
||||||
|
FCEU_COBJ := $(FCEU_CSRCS:.c=.o)
|
||||||
|
|
||||||
|
OBJS := $(FCEU_COBJ)
|
||||||
|
|
||||||
|
FCEU_DEFINES := -D__LIBRETRO__ -DSOUND_QUALITY=0 -DPATH_MAX=1024 -DINLINE=inline -DPSS_STYLE=1 -DFCEU_VERSION_NUMERIC=9813 $(PLATFORM_DEFINES)
|
||||||
|
|
||||||
|
ifeq ($(platform), sncps3)
|
||||||
|
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$(LIBRETRO_DIR) -I$(FCEU_DIR) -I$(FCEU_DIR)/input -I$(FCEU_DIR)/boards -I$(FCEU_DIR)/mappers
|
||||||
|
LIBS :=
|
||||||
|
|
||||||
|
$(TARGET): $(OBJS)
|
||||||
|
ifeq ($(platform), ps3)
|
||||||
|
$(AR) rcs $@ $(OBJS)
|
||||||
|
else ifeq ($(platform), sncps3)
|
||||||
|
$(AR) rcs $@ $(OBJS)
|
||||||
|
else ifeq ($(platform), psl1ght)
|
||||||
|
$(AR) rcs $@ $(OBJS)
|
||||||
|
else ifeq ($(platform), xenon)
|
||||||
|
$(AR) rcs $@ $(OBJS)
|
||||||
|
else ifeq ($(platform), ngc)
|
||||||
|
$(AR) rcs $@ $(OBJS)
|
||||||
|
else ifeq ($(platform), wii)
|
||||||
|
$(AR) rcs $@ $(OBJS)
|
||||||
|
else
|
||||||
|
$(CC) -o $@ $(SHARED) $(OBJS) $(CFLAGS) $(LDFLAGS) $(LIBS)
|
||||||
|
endif
|
||||||
|
|
||||||
|
%.o: %.c
|
||||||
|
$(CC) -c -o $@ $< $(CFLAGS) $(INCDIRS)
|
||||||
|
|
||||||
|
clean-objs:
|
||||||
|
rm -f $(OBJS)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(OBJS)
|
||||||
|
rm -f $(TARGET)
|
||||||
|
|
||||||
|
.PHONY: clean clean-objs
|
||||||
2237
changelog.txt
Normal file
2237
changelog.txt
Normal file
File diff suppressed because it is too large
Load Diff
109
src/boards/01-222.c
Normal file
109
src/boards/01-222.c
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* TXC mappers, originally much complex banksitching
|
||||||
|
*
|
||||||
|
* 01-22111-000 (05-00002-010) (132, 22211) - MGC-001 Qi Wang
|
||||||
|
* 01-22110-000 (52S ) - MGC-002 2-in-1 Gun
|
||||||
|
* 01-22111-100 (02-00002-010) (173 ) - MGC-008 Mahjong Block
|
||||||
|
* (079 ) - MGC-012 Poke Block
|
||||||
|
* 01-22110-200 (05-00002-010) (036 ) - MGC-014 Strike Wolf
|
||||||
|
* 01-22000-400 (05-00002-010) (036 ) - MGC-015 Policeman
|
||||||
|
* 01-22017-000 (05-PT017-080) (189 ) - MGC-017 Thunder Warrior
|
||||||
|
* 01-11160-000 (04-02310-000) ( , 11160) - MGC-023 6-in-1
|
||||||
|
* 01-22270-000 (05-00002-010) (132, 22211) - MGC-xxx Creatom
|
||||||
|
* 01-22200-400 (------------) (079 ) - ET.03 F-15 City War
|
||||||
|
* (172 ) - 1991 Du Ma Racing
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#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);
|
||||||
|
}
|
||||||
|
|
||||||
97
src/boards/09-034a.c
Normal file
97
src/boards/09-034a.c
Normal file
@@ -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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* FDS Conversions
|
||||||
|
*
|
||||||
|
* Super Mario Bros 2j (Alt Full) is a BAD incomplete dump, should be mapper 43
|
||||||
|
*
|
||||||
|
* Both Voleyball and Zanac by Whirlind Manu shares the same PCB, but with
|
||||||
|
* some differences: Voleyball has 8K CHR ROM and 8K ROM at 6000K, Zanac
|
||||||
|
* have 8K CHR RAM and banked 16K ROM mapper at 6000 as two 8K banks.
|
||||||
|
*
|
||||||
|
* Super Mario Bros 2j (Alt Small) uses additionally IRQ timer to drive framerate
|
||||||
|
*
|
||||||
|
* PCB for this mapper is "09-034A"
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 prg;
|
||||||
|
static uint32 IRQCount, IRQa;
|
||||||
|
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ &IRQCount, 4, "IRQC" },
|
||||||
|
{ &IRQa, 4, "IRQA" },
|
||||||
|
{ &prg, 1, "PRG" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
setprg8r(1, 0x6000, prg);
|
||||||
|
setprg32(0x8000, 0);
|
||||||
|
setchr8(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(UNLSMB2JWrite1) {
|
||||||
|
prg = V & 1;
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(UNLSMB2JWrite2) {
|
||||||
|
IRQa = V & 1;
|
||||||
|
IRQCount = 0;
|
||||||
|
X6502_IRQEnd(FCEU_IQEXT);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFR(UNLSMB2JRead) {
|
||||||
|
return 0xFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void UNLSMB2JPower(void) {
|
||||||
|
prg = 0;
|
||||||
|
Sync();
|
||||||
|
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||||
|
SetReadHandler(0x4042, 0x4055, UNLSMB2JRead);
|
||||||
|
SetWriteHandler(0x4068, 0x4068, UNLSMB2JWrite2);
|
||||||
|
SetWriteHandler(0x4027, 0x4027, UNLSMB2JWrite1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void FP_FASTAPASS(1) UNLSMB2JIRQHook(int a) {
|
||||||
|
if (IRQa)
|
||||||
|
{
|
||||||
|
if (IRQCount < 5750) // completely by guess
|
||||||
|
IRQCount += a;
|
||||||
|
else {
|
||||||
|
IRQa = 0;
|
||||||
|
X6502_IRQBegin(FCEU_IQEXT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void UNLSMB2J_Init(CartInfo *info) {
|
||||||
|
info->Power = UNLSMB2JPower;
|
||||||
|
MapIRQHook = UNLSMB2JIRQHook;
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
|
}
|
||||||
115
src/boards/103.c
Normal file
115
src/boards/103.c
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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)
|
||||||
|
FCEU_gfree(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);
|
||||||
|
}
|
||||||
108
src/boards/106.c
Normal file
108
src/boards/106.c
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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, "IRQC" },
|
||||||
|
{ 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)
|
||||||
|
FCEU_gfree(WRAM);
|
||||||
|
WRAM = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FP_FASTAPASS(1) 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);
|
||||||
|
}
|
||||||
64
src/boards/108.c
Normal file
64
src/boards/108.c
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* FDS Conversion
|
||||||
|
*
|
||||||
|
* Meikyuu Jin Dababa
|
||||||
|
* Bubble Bobble Kaiser
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#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(0x8000, 0x8FFF, M108Write); // regular 108
|
||||||
|
SetWriteHandler(0xF000, 0xFFFF, M108Write); // simplified Kaiser BB Hack
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper108_Init(CartInfo *info) {
|
||||||
|
info->Power = M108Power;
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
|
}
|
||||||
89
src/boards/112.c
Normal file
89
src/boards/112.c
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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)
|
||||||
|
FCEU_gfree(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);
|
||||||
|
}
|
||||||
324
src/boards/116.c
Normal file
324
src/boards/116.c
Normal file
@@ -0,0 +1,324 @@
|
|||||||
|
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 (aka AV Pretty Girl Fighting) (SL-12 PCB, Hunag-1, GAL dip: unk conf. SL-11A/SL-11B maskroms)
|
||||||
|
* Samurai Spirits (Full version) (Huang-1, GAL dip: unk conf. GS-2A/GS-4A maskroms)
|
||||||
|
* Contra Fighter (603-5052 PCB, 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, "VRCC" },
|
||||||
|
{ vrc2_prg, 2, "VRCP" },
|
||||||
|
{ &vrc2_mirr, 1, "VRCM" },
|
||||||
|
{ mmc3_regs, 10, "M3RG" },
|
||||||
|
{ &mmc3_ctrl, 1, "M3CT" },
|
||||||
|
{ &mmc3_mirr, 1, "M3MR" },
|
||||||
|
{ &IRQReload, 1, "IRQR" },
|
||||||
|
{ &IRQCount, 1, "IRQC" },
|
||||||
|
{ &IRQLatch, 1, "IRQL" },
|
||||||
|
{ &IRQa, 1, "IRQA" },
|
||||||
|
{ mmc1_regs, 4, "M1RG" },
|
||||||
|
{ &mmc1_buffer, 1, "M1BF" },
|
||||||
|
{ &mmc1_shift, 1, "M1MR" },
|
||||||
|
{ 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);
|
||||||
|
}
|
||||||
91
src/boards/117.c
Normal file
91
src/boards/117.c
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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, "PREG" },
|
||||||
|
{ chrreg, 8, "CREG" },
|
||||||
|
{ &mirror, 1, "MREG" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
setprg8(0x8000, prgreg[0]);
|
||||||
|
setprg8(0xa000, prgreg[1]);
|
||||||
|
setprg8(0xc000, prgreg[2]);
|
||||||
|
setprg8(0xe000, prgreg[3]);
|
||||||
|
int i;
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
62
src/boards/120.c
Normal file
62
src/boards/120.c
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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);
|
||||||
|
}
|
||||||
129
src/boards/121.c
Normal file
129
src/boards/121.c
Normal file
@@ -0,0 +1,129 @@
|
|||||||
|
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* Panda prince pirate.
|
||||||
|
* MK4, MK6, A9711/A9713 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 0x3C:
|
||||||
|
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 (PRGsize[0] == CHRsize[0]) { // A9713 multigame extension hack!
|
||||||
|
setchr1(A, V | ((EXPREGS[3] & 0x80) << 1));
|
||||||
|
} else {
|
||||||
|
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 & 0x1F) | ((EXPREGS[3] & 0x80) >> 2));
|
||||||
|
setprg8(0xE000, (EXPREGS[0]) | ((EXPREGS[3] & 0x80) >> 2));
|
||||||
|
setprg8(0xC000, (EXPREGS[1]) | ((EXPREGS[3] & 0x80) >> 2));
|
||||||
|
setprg8(0xA000, (EXPREGS[2]) | ((EXPREGS[3] & 0x80) >> 2));
|
||||||
|
} else {
|
||||||
|
// FCEU_printf("gen banks: %04x %02x\n",A,V);
|
||||||
|
setprg8(A, (V & 0x1F) | ((EXPREGS[3] & 0x80) >> 2));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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)
|
||||||
|
if ((A & 0x5180) == 0x5180) { // A9713 multigame extension
|
||||||
|
EXPREGS[3] = V;
|
||||||
|
FixMMC3PRG(MMC3_cmd);
|
||||||
|
FixMMC3CHR(MMC3_cmd);
|
||||||
|
}
|
||||||
|
// 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[3] = 0x80;
|
||||||
|
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");
|
||||||
|
}
|
||||||
73
src/boards/12in1.c
Normal file
73
src/boards/12in1.c
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* 7-in-1 Darkwing Duck, Snake, MagicBlock (PCB marked as "12 in 1")
|
||||||
|
* 12-in-1 1991 New Star Co. Ltd.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 prgchr[2], ctrl;
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ prgchr, 2, "REGS" },
|
||||||
|
{ &ctrl, 1, "CTRL" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
uint8 bank = (ctrl & 3) << 3;
|
||||||
|
setchr4(0x0000, (prgchr[0] >> 3) | (bank << 2));
|
||||||
|
setchr4(0x1000, (prgchr[1] >> 3) | (bank << 2));
|
||||||
|
if (ctrl & 8) {
|
||||||
|
setprg16(0x8000, bank | (prgchr[0] & 6) | 0); // actually, both 0 and 1 registers used, but they will switch each PA12 transition
|
||||||
|
setprg16(0xc000, bank | (prgchr[0] & 6) | 1); // if bits are different for both registers, so they must be programmed strongly the same!
|
||||||
|
} else {
|
||||||
|
setprg16(0x8000, bank | (prgchr[0] & 7));
|
||||||
|
setprg16(0xc000, bank | 7 );
|
||||||
|
}
|
||||||
|
setmirror(((ctrl & 4) >> 2) ^ 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(BMC12IN1Write) {
|
||||||
|
switch (A & 0xE000) {
|
||||||
|
case 0xA000: prgchr[0] = V; Sync(); break;
|
||||||
|
case 0xC000: prgchr[1] = V; Sync(); break;
|
||||||
|
case 0xE000: ctrl = V & 0x0F; Sync(); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void BMC12IN1Power(void) {
|
||||||
|
prgchr[0] = prgchr[1] = ctrl = 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);
|
||||||
|
}
|
||||||
|
|
||||||
109
src/boards/15.c
Normal file
109
src/boards/15.c
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint16 latchea;
|
||||||
|
static uint8 latched;
|
||||||
|
static uint8 *WRAM = NULL;
|
||||||
|
static uint32 WRAMSIZE;
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ &latchea, 2, "AREG" },
|
||||||
|
{ &latched, 1, "DREG" },
|
||||||
|
{ 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))
|
||||||
|
b = 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)
|
||||||
|
FCEU_gfree(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);
|
||||||
|
}
|
||||||
|
|
||||||
59
src/boards/151.c
Normal file
59
src/boards/151.c
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
/* FCE Ultra - NES/Famicom Emulator
|
||||||
|
*
|
||||||
|
* Copyright notice for this file:
|
||||||
|
* Copyright (C) 2012 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 regs[8];
|
||||||
|
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ regs, 8, "REGS" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
setprg8(0x8000, regs[0]);
|
||||||
|
setprg8(0xA000, regs[2]);
|
||||||
|
setprg8(0xC000, regs[4]);
|
||||||
|
setprg8(0xE000, ~0);
|
||||||
|
setchr4(0x0000, regs[6]);
|
||||||
|
setchr4(0x1000, regs[7]);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M151Write) {
|
||||||
|
regs[(A >> 12) & 7] = V;
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M151Power(void) {
|
||||||
|
Sync();
|
||||||
|
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||||
|
SetWriteHandler(0x8000, 0xFFFF, M151Write);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper151_Init(CartInfo *info) {
|
||||||
|
info->Power = M151Power;
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
|
}
|
||||||
119
src/boards/156.c
Normal file
119
src/boards/156.c
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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, "CRGL" },
|
||||||
|
{ chrhi, 8, "CRGH" },
|
||||||
|
{ &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 M156Reset(void) {
|
||||||
|
uint32 i;
|
||||||
|
for (i = 0; i < 8; i++) {
|
||||||
|
chrlo[i] = 0;
|
||||||
|
chrhi[i] = 0;
|
||||||
|
}
|
||||||
|
prg = 0;
|
||||||
|
mirr = 0;
|
||||||
|
mirrisused = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M156Power(void) {
|
||||||
|
M156Reset();
|
||||||
|
Sync();
|
||||||
|
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||||
|
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||||
|
SetWriteHandler(0xC000, 0xCFFF, M156Write);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M156Close(void) {
|
||||||
|
if (WRAM)
|
||||||
|
FCEU_gfree(WRAM);
|
||||||
|
WRAM = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper156_Init(CartInfo *info) {
|
||||||
|
info->Reset = M156Reset;
|
||||||
|
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);
|
||||||
|
}
|
||||||
526
src/boards/164.c
Normal file
526
src/boards/164.c
Normal file
@@ -0,0 +1,526 @@
|
|||||||
|
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* It seems that 162/163/164 mappers are the same mapper with just different
|
||||||
|
* mapper modes enabled or disabled in software or hardware, need more nanjing
|
||||||
|
* carts
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 laststrobe, trigger;
|
||||||
|
static uint8 reg[8];
|
||||||
|
static uint8 *WRAM = NULL;
|
||||||
|
static uint32 WRAMSIZE;
|
||||||
|
|
||||||
|
static writefunc pcmwrite;
|
||||||
|
|
||||||
|
static void (*WSync)(void);
|
||||||
|
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ &laststrobe, 1, "STB" },
|
||||||
|
{ &trigger, 1, "TRG" },
|
||||||
|
{ reg, 8, "REGS" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static int16 step_size[49] = {
|
||||||
|
16, 17, 19, 21, 23, 25, 28, 31, 34, 37,
|
||||||
|
41, 45, 50, 55, 60, 66, 73, 80, 88, 97,
|
||||||
|
107, 118, 130, 143, 157, 173, 190, 209, 230, 253,
|
||||||
|
279, 307, 337, 371, 408, 449, 494, 544, 598, 658,
|
||||||
|
724, 796, 876, 963, 1060, 1166, 1282, 1411, 1552
|
||||||
|
}; //49 items
|
||||||
|
static int32 step_adj[16] = { -1, -1, -1, -1, 2, 5, 7, 9, -1, -1, -1, -1, 2, 5, 7, 9 };
|
||||||
|
|
||||||
|
//decode stuff
|
||||||
|
static int32 jedi_table[16 * 49];
|
||||||
|
static int32 acc = 0; //ADPCM accumulator, initial condition must be 0
|
||||||
|
static int32 decstep = 0; //ADPCM decoding step, initial condition must be 0
|
||||||
|
|
||||||
|
static void jedi_table_init() {
|
||||||
|
int step, nib;
|
||||||
|
|
||||||
|
for (step = 0; step < 49; step++) {
|
||||||
|
for (nib = 0; nib < 16; nib++) {
|
||||||
|
int value = (2 * (nib & 0x07) + 1) * step_size[step] / 8;
|
||||||
|
jedi_table[step * 16 + nib] = ((nib & 0x08) != 0) ? -value : value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint8 decode(uint8 code) {
|
||||||
|
acc += jedi_table[decstep + code];
|
||||||
|
if ((acc & ~0x7ff) != 0) // acc is > 2047
|
||||||
|
acc |= ~0xfff;
|
||||||
|
else acc &= 0xfff;
|
||||||
|
decstep += step_adj[code & 7] * 16;
|
||||||
|
if (decstep < 0) decstep = 0;
|
||||||
|
if (decstep > 48 * 16) decstep = 48 * 16;
|
||||||
|
return (acc >> 8) & 0xff;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
const EEPROM_interface eeprom_interface. =
|
||||||
|
{
|
||||||
|
9, // address bits 9
|
||||||
|
8, // data bits 8
|
||||||
|
"*110", // read 1 10 aaaaaaaaa
|
||||||
|
"*101", // write 1 01 aaaaaaaaa dddddddd
|
||||||
|
"*10000xxxxxxx", // lock 1 00 00xxxxxxx
|
||||||
|
"*10011xxxxxxx", // unlock 1 00 11xxxxxxx
|
||||||
|
1,
|
||||||
|
5
|
||||||
|
};
|
||||||
|
|
||||||
|
static const EEPROM_interface *intf;
|
||||||
|
|
||||||
|
static int serial_count = 0;
|
||||||
|
static u8 serial_buffer[SERIAL_BUFFER_LENGTH];
|
||||||
|
|
||||||
|
static int eeprom_data_bits;
|
||||||
|
static int eeprom_clock_count;
|
||||||
|
static int eeprom_read_address;
|
||||||
|
static u8 *eeprom_data;
|
||||||
|
|
||||||
|
static int latch = 0;
|
||||||
|
static int locked = 1;
|
||||||
|
static int sending = 0;
|
||||||
|
static int reset_line = ASSERT_LINE;
|
||||||
|
static int clock_line = ASSERT_LINE;
|
||||||
|
static int reset_delay;
|
||||||
|
|
||||||
|
void EEPROM_Init(u8 *data, u8 bit)
|
||||||
|
{
|
||||||
|
eeprom_data = data;
|
||||||
|
if(bit == 8)
|
||||||
|
intf = &eeprom_interface_93C46_8;
|
||||||
|
else
|
||||||
|
intf = &eeprom_interface_93C46_16;
|
||||||
|
}
|
||||||
|
|
||||||
|
u8 *EEPROM_GetData()
|
||||||
|
{
|
||||||
|
return eeprom_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int EEPROM_command_match(const char *buf, const char *cmd, int len)
|
||||||
|
{
|
||||||
|
if ( cmd == 0 ) return 0;
|
||||||
|
if ( len == 0 ) return 0;
|
||||||
|
|
||||||
|
for (;len>0;)
|
||||||
|
{
|
||||||
|
char b = *buf;
|
||||||
|
char c = *cmd;
|
||||||
|
|
||||||
|
if ((b==0) || (c==0))
|
||||||
|
return (b==c);
|
||||||
|
|
||||||
|
switch ( c )
|
||||||
|
{
|
||||||
|
case '0':
|
||||||
|
case '1':
|
||||||
|
if (b != c) return 0;
|
||||||
|
case 'X':
|
||||||
|
case 'x':
|
||||||
|
buf++;
|
||||||
|
len--;
|
||||||
|
cmd++;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '*':
|
||||||
|
c = cmd[1];
|
||||||
|
switch( c )
|
||||||
|
{
|
||||||
|
case '0':
|
||||||
|
case '1':
|
||||||
|
if (b == c) { cmd++; }
|
||||||
|
else { buf++; len--; }
|
||||||
|
break;
|
||||||
|
default: return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (*cmd==0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void EEPROM_write(int bit)
|
||||||
|
{
|
||||||
|
if (serial_count >= SERIAL_BUFFER_LENGTH-1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
serial_buffer[serial_count++] = (bit ? '1' : '0');
|
||||||
|
serial_buffer[serial_count] = 0;
|
||||||
|
|
||||||
|
if ( (serial_count > intf->address_bits) &&
|
||||||
|
EEPROM_command_match((char*)serial_buffer,intf->cmd_read,(int)strlen((char*)serial_buffer)-intf->address_bits) )
|
||||||
|
{
|
||||||
|
int i,address;
|
||||||
|
|
||||||
|
address = 0;
|
||||||
|
for (i = serial_count-intf->address_bits;i < serial_count;i++)
|
||||||
|
{
|
||||||
|
address <<= 1;
|
||||||
|
if (serial_buffer[i] == '1') address |= 1;
|
||||||
|
}
|
||||||
|
if (intf->data_bits == 16)
|
||||||
|
eeprom_data_bits = (eeprom_data[2*address+0] << 8) + eeprom_data[2*address+1];
|
||||||
|
else
|
||||||
|
eeprom_data_bits = eeprom_data[address];
|
||||||
|
eeprom_read_address = address;
|
||||||
|
eeprom_clock_count = 0;
|
||||||
|
sending = 1;
|
||||||
|
serial_count = 0;
|
||||||
|
}
|
||||||
|
else if ( (serial_count > intf->address_bits) &&
|
||||||
|
EEPROM_command_match((char*)serial_buffer,intf->cmd_erase,(int)strlen((char*)serial_buffer)-intf->address_bits) )
|
||||||
|
{
|
||||||
|
int i,address;
|
||||||
|
|
||||||
|
address = 0;
|
||||||
|
for (i = serial_count-intf->address_bits;i < serial_count;i++)
|
||||||
|
{
|
||||||
|
address <<= 1;
|
||||||
|
if (serial_buffer[i] == '1') address |= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (locked == 0)
|
||||||
|
{
|
||||||
|
if (intf->data_bits == 16)
|
||||||
|
{
|
||||||
|
eeprom_data[2*address+0] = 0x00;
|
||||||
|
eeprom_data[2*address+1] = 0x00;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
eeprom_data[address] = 0x00;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
serial_count = 0;
|
||||||
|
}
|
||||||
|
else if ( (serial_count > (intf->address_bits + intf->data_bits)) &&
|
||||||
|
EEPROM_command_match((char*)serial_buffer,intf->cmd_write,(int)strlen((char*)serial_buffer)-(intf->address_bits + intf->data_bits)) )
|
||||||
|
{
|
||||||
|
int i,address,data;
|
||||||
|
|
||||||
|
address = 0;
|
||||||
|
for (i = serial_count-intf->data_bits-intf->address_bits;i < (serial_count-intf->data_bits);i++)
|
||||||
|
{
|
||||||
|
address <<= 1;
|
||||||
|
if (serial_buffer[i] == '1') address |= 1;
|
||||||
|
}
|
||||||
|
data = 0;
|
||||||
|
for (i = serial_count-intf->data_bits;i < serial_count;i++)
|
||||||
|
{
|
||||||
|
data <<= 1;
|
||||||
|
if (serial_buffer[i] == '1') data |= 1;
|
||||||
|
}
|
||||||
|
if (locked == 0)
|
||||||
|
{
|
||||||
|
if (intf->data_bits == 16)
|
||||||
|
{
|
||||||
|
eeprom_data[2*address+0] = data >> 8;
|
||||||
|
eeprom_data[2*address+1] = data & 0xff;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
eeprom_data[address] = data;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
serial_count = 0;
|
||||||
|
}
|
||||||
|
else if ( EEPROM_command_match((char*)serial_buffer,intf->cmd_lock,(int)strlen((char*)serial_buffer)) )
|
||||||
|
{
|
||||||
|
locked = 1;
|
||||||
|
serial_count = 0;
|
||||||
|
}
|
||||||
|
else if ( EEPROM_command_match((char*)serial_buffer,intf->cmd_unlock,(int)strlen((char*)serial_buffer)) )
|
||||||
|
{
|
||||||
|
locked = 0;
|
||||||
|
serial_count = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void EEPROM_reset()
|
||||||
|
{
|
||||||
|
serial_count = 0;
|
||||||
|
sending = 0;
|
||||||
|
reset_delay = intf->reset_delay;
|
||||||
|
}
|
||||||
|
|
||||||
|
void EEPROM_set_cs_line(int state)
|
||||||
|
{
|
||||||
|
reset_line = state;
|
||||||
|
|
||||||
|
if (reset_line != CLEAR_LINE)
|
||||||
|
EEPROM_reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
void EEPROM_set_clock_line(int state)
|
||||||
|
{
|
||||||
|
if (state == PULSE_LINE || (clock_line == CLEAR_LINE && state != CLEAR_LINE))
|
||||||
|
{
|
||||||
|
if (reset_line == CLEAR_LINE)
|
||||||
|
{
|
||||||
|
if (sending)
|
||||||
|
{
|
||||||
|
if (eeprom_clock_count == intf->data_bits)
|
||||||
|
{
|
||||||
|
if(intf->enable_multi_read)
|
||||||
|
{
|
||||||
|
eeprom_read_address = (eeprom_read_address + 1) & ((1 << intf->address_bits) - 1);
|
||||||
|
if (intf->data_bits == 16)
|
||||||
|
eeprom_data_bits = (eeprom_data[2*eeprom_read_address+0] << 8) + eeprom_data[2*eeprom_read_address+1];
|
||||||
|
else
|
||||||
|
eeprom_data_bits = eeprom_data[eeprom_read_address];
|
||||||
|
eeprom_clock_count = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sending = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
eeprom_data_bits = (eeprom_data_bits << 1) | 1;
|
||||||
|
eeprom_clock_count++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
EEPROM_write(latch);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
clock_line = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void EEPROM_write_bit(int bit)
|
||||||
|
{
|
||||||
|
latch = bit;
|
||||||
|
}
|
||||||
|
|
||||||
|
int EEPROM_read_bit(void)
|
||||||
|
{
|
||||||
|
int res;
|
||||||
|
|
||||||
|
if (sending)
|
||||||
|
res = (eeprom_data_bits >> intf->data_bits) & 1;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (reset_delay > 0)
|
||||||
|
{
|
||||||
|
reset_delay--;
|
||||||
|
res = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
res = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
if(scanline>=127) // Hu Lu Jin Gang (NJ039) (Ch) [!] don't like it
|
||||||
|
{
|
||||||
|
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 0x5300: reg[2] = V; break;
|
||||||
|
case 0x5200: reg[3] = V; WSync(); 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)
|
||||||
|
FCEU_gfree(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: /*FCEU_printf("%04x %02x (5000 = %02x)\n", A, V, reg[1]); */ reg[0] = V; WSync(); break;
|
||||||
|
case 0x5000: reg[1] = V; WSync(); if (!(reg[1] & 0x80) && (scanline < 128)) setchr8(0); /* setchr8(0); */ break;
|
||||||
|
case 0x5300: /*FCEU_printf("%04x %02x (5000 = %02x)\n", A, V, reg[1]);*/ reg[2] = V; break;
|
||||||
|
case 0x5100: /*FCEU_printf("%04x %02x (5000 = %02x)\n", A, V, reg[1]);*/ reg[3] = V; /*pcmwrite(0x4011, (decode(reg[0]) & 0xf) << 3);*/ WSync(); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Power2(void) {
|
||||||
|
memset(reg, 0, 8);
|
||||||
|
laststrobe = 1;
|
||||||
|
pcmwrite = GetWriteHandler(0x4011);
|
||||||
|
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;
|
||||||
|
|
||||||
|
// jedi_table_init();
|
||||||
|
|
||||||
|
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);
|
||||||
|
switch (reg[3] & 7) {
|
||||||
|
case 0:
|
||||||
|
case 2: setprg32(0x8000, (reg[0] & 0xc) | (reg[1] & 2) | ((reg[2] & 0xf) << 4)); break;
|
||||||
|
case 1:
|
||||||
|
case 3: setprg32(0x8000, (reg[0] & 0xc) | (reg[2] & 0xf) << 4); break;
|
||||||
|
case 4:
|
||||||
|
case 6: setprg32(0x8000, (reg[0] & 0xe) | ((reg[1] >> 1) & 1) | ((reg[2] & 0xf) << 4)); break;
|
||||||
|
case 5:
|
||||||
|
case 7: setprg32(0x8000, (reg[0] & 0xf) | ((reg[2] & 0xf) << 4)); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(Write3) {
|
||||||
|
// FCEU_printf("bs %04x %02x\n",A,V);
|
||||||
|
reg[(A >> 8) & 3] = V;
|
||||||
|
WSync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Power3(void) {
|
||||||
|
reg[0] = 3;
|
||||||
|
reg[1] = 0;
|
||||||
|
reg[2] = 0;
|
||||||
|
reg[3] = 7;
|
||||||
|
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);
|
||||||
|
}
|
||||||
81
src/boards/168.c
Normal file
81
src/boards/168.c
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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)
|
||||||
|
FCEU_gfree(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");
|
||||||
|
}
|
||||||
62
src/boards/170.c
Normal file
62
src/boards/170.c
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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);
|
||||||
|
}
|
||||||
79
src/boards/175.c
Normal file
79
src/boards/175.c
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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);
|
||||||
|
}
|
||||||
80
src/boards/177.c
Normal file
80
src/boards/177.c
Normal file
@@ -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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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)
|
||||||
|
FCEU_gfree(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);
|
||||||
|
}
|
||||||
176
src/boards/178.c
Normal file
176
src/boards/178.c
Normal file
@@ -0,0 +1,176 @@
|
|||||||
|
/* FCE Ultra - NES/Famicom Emulator
|
||||||
|
*
|
||||||
|
* Copyright notice for this file:
|
||||||
|
* Copyright (C) 2013 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* DSOUNDV1/FL-TR8MA boards (32K WRAM, 8/16M), 178 mapper boards (8K WRAM, 4/8M)
|
||||||
|
* Various Education Cartridges
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 reg[4];
|
||||||
|
|
||||||
|
static uint8 *WRAM = NULL;
|
||||||
|
static uint32 WRAMSIZE;
|
||||||
|
|
||||||
|
// SND Registers
|
||||||
|
static uint8 pcm_enable = 0;
|
||||||
|
static int16 pcm_latch = 0x3F6, pcm_clock = 0x3F6;
|
||||||
|
static writefunc pcmwrite;
|
||||||
|
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ reg, 4, "REGS" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static int16 step_size[49] = {
|
||||||
|
16, 17, 19, 21, 23, 25, 28, 31, 34, 37,
|
||||||
|
41, 45, 50, 55, 60, 66, 73, 80, 88, 97,
|
||||||
|
107, 118, 130, 143, 157, 173, 190, 209, 230, 253,
|
||||||
|
279, 307, 337, 371, 408, 449, 494, 544, 598, 658,
|
||||||
|
724, 796, 876, 963, 1060, 1166, 1282, 1411, 1552
|
||||||
|
}; //49 items
|
||||||
|
static int32 step_adj[16] = { -1, -1, -1, -1, 2, 5, 7, 9, -1, -1, -1, -1, 2, 5, 7, 9 };
|
||||||
|
|
||||||
|
//decode stuff
|
||||||
|
static int32 jedi_table[16 * 49];
|
||||||
|
static int32 acc = 0; //ADPCM accumulator, initial condition must be 0
|
||||||
|
static int32 decstep = 0; //ADPCM decoding step, initial condition must be 0
|
||||||
|
|
||||||
|
static void jedi_table_init() {
|
||||||
|
int step, nib;
|
||||||
|
|
||||||
|
for (step = 0; step < 49; step++) {
|
||||||
|
for (nib = 0; nib < 16; nib++) {
|
||||||
|
int value = (2 * (nib & 0x07) + 1) * step_size[step] / 8;
|
||||||
|
jedi_table[step * 16 + nib] = ((nib & 0x08) != 0) ? -value : value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint8 decode(uint8 code) {
|
||||||
|
acc += jedi_table[decstep + code];
|
||||||
|
if ((acc & ~0x7ff) != 0) // acc is > 2047
|
||||||
|
acc |= ~0xfff;
|
||||||
|
else acc &= 0xfff;
|
||||||
|
decstep += step_adj[code & 7] * 16;
|
||||||
|
if (decstep < 0) decstep = 0;
|
||||||
|
if (decstep > 48 * 16) decstep = 48 * 16;
|
||||||
|
return (acc >> 8) & 0xff;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
uint32 sbank = reg[1] & 0x7;
|
||||||
|
uint32 bbank = reg[2];
|
||||||
|
setchr8(0);
|
||||||
|
setprg8r(0x10, 0x6000, reg[3] & 3);
|
||||||
|
if (reg[0] & 2) { // UNROM mode
|
||||||
|
setprg16(0x8000, (bbank << 3) | sbank);
|
||||||
|
if (reg[0] & 4)
|
||||||
|
setprg16(0xC000, (bbank << 3) | 6 | (reg[1] & 1));
|
||||||
|
else
|
||||||
|
setprg16(0xC000, (bbank << 3) | 7);
|
||||||
|
} else { // NROM mode
|
||||||
|
uint32 bank = (bbank << 3) | sbank;
|
||||||
|
if (reg[0] & 4) {
|
||||||
|
setprg16(0x8000, bank);
|
||||||
|
setprg16(0xC000, bank);
|
||||||
|
} else
|
||||||
|
setprg32(0x8000, bank >> 1);
|
||||||
|
}
|
||||||
|
setmirror((reg[0] & 1) ^ 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M178Write) {
|
||||||
|
reg[A & 3] = V;
|
||||||
|
// FCEU_printf("cmd %04x:%02x\n", A, V);
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M178WriteSnd) {
|
||||||
|
if (A == 0x5800) {
|
||||||
|
if (V & 0xF0) {
|
||||||
|
pcm_enable = 1;
|
||||||
|
// pcmwrite(0x4011, (V & 0xF) << 3);
|
||||||
|
pcmwrite(0x4011, decode(V & 0xf));
|
||||||
|
} else
|
||||||
|
pcm_enable = 0;
|
||||||
|
} else
|
||||||
|
FCEU_printf("misc %04x:%02x\n", A, V);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFR(M178ReadSnd) {
|
||||||
|
if (A == 0x5800)
|
||||||
|
return (X.DB & 0xBF) | ((pcm_enable ^ 1) << 6);
|
||||||
|
else
|
||||||
|
return X.DB;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M178Power(void) {
|
||||||
|
reg[0] = reg[1] = reg[2] = reg[3] = 0;
|
||||||
|
Sync();
|
||||||
|
pcmwrite = GetWriteHandler(0x4011);
|
||||||
|
SetWriteHandler(0x4800, 0x4fff, M178Write);
|
||||||
|
SetWriteHandler(0x5800, 0x5fff, M178WriteSnd);
|
||||||
|
SetReadHandler(0x5800, 0x5fff, M178ReadSnd);
|
||||||
|
SetReadHandler(0x6000, 0x7fff, CartBR);
|
||||||
|
SetWriteHandler(0x6000, 0x7fff, CartBW);
|
||||||
|
SetReadHandler(0x8000, 0xffff, CartBR);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M178SndClk(int a) {
|
||||||
|
if (pcm_enable) {
|
||||||
|
pcm_latch -= a;
|
||||||
|
if (pcm_latch <= 0) {
|
||||||
|
pcm_latch += pcm_clock;
|
||||||
|
pcm_enable = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M178Close(void) {
|
||||||
|
if (WRAM)
|
||||||
|
FCEU_gfree(WRAM);
|
||||||
|
WRAM = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper178_Init(CartInfo *info) {
|
||||||
|
info->Power = M178Power;
|
||||||
|
info->Close = M178Close;
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
MapIRQHook = M178SndClk;
|
||||||
|
|
||||||
|
jedi_table_init();
|
||||||
|
|
||||||
|
WRAMSIZE = 32768;
|
||||||
|
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);
|
||||||
|
}
|
||||||
132
src/boards/18.c
Normal file
132
src/boards/18.c
Normal file
@@ -0,0 +1,132 @@
|
|||||||
|
/* FCE Ultra - NES/Famicom Emulator
|
||||||
|
*
|
||||||
|
* Copyright notice for this file:
|
||||||
|
* Copyright (C) 2012 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 preg[4], creg[8];
|
||||||
|
static uint8 IRQa, mirr;
|
||||||
|
static int32 IRQCount, IRQLatch;
|
||||||
|
static uint8 *WRAM = NULL;
|
||||||
|
static uint32 WRAMSIZE;
|
||||||
|
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ preg, 4, "PREG" },
|
||||||
|
{ creg, 8, "CREG" },
|
||||||
|
{ &mirr, 1, "MIRR" },
|
||||||
|
{ &IRQa, 1, "IRQA" },
|
||||||
|
{ &IRQCount, 4, "IRQC" },
|
||||||
|
{ &IRQLatch, 4, "IRQL" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < 8; i++) setchr1(i << 10, creg[i]);
|
||||||
|
setprg8r(0x10, 0x6000, 0);
|
||||||
|
setprg8(0x8000, preg[0]);
|
||||||
|
setprg8(0xA000, preg[1]);
|
||||||
|
setprg8(0xC000, preg[2]);
|
||||||
|
setprg8(0xE000, ~0);
|
||||||
|
if (mirr & 2)
|
||||||
|
setmirror(MI_0);
|
||||||
|
else
|
||||||
|
setmirror(mirr & 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M18WriteIRQ) {
|
||||||
|
switch (A & 0xF003) {
|
||||||
|
case 0xE000: IRQLatch &= 0xFFF0; IRQLatch |= (V & 0x0f) << 0x0; break;
|
||||||
|
case 0xE001: IRQLatch &= 0xFF0F; IRQLatch |= (V & 0x0f) << 0x4; break;
|
||||||
|
case 0xE002: IRQLatch &= 0xF0FF; IRQLatch |= (V & 0x0f) << 0x8; break;
|
||||||
|
case 0xE003: IRQLatch &= 0x0FFF; IRQLatch |= (V & 0x0f) << 0xC; break;
|
||||||
|
case 0xF000: IRQCount = IRQLatch; break;
|
||||||
|
case 0xF001: IRQa = V & 1; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||||
|
case 0xF002: mirr = V & 3; Sync(); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M18WritePrg) {
|
||||||
|
uint32 i = ((A >> 1) & 1) | ((A - 0x8000) >> 11);
|
||||||
|
preg[i] &= (0xF0) >> ((A & 1) << 2);
|
||||||
|
preg[i] |= (V & 0xF) << ((A & 1) << 2);
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M18WriteChr) {
|
||||||
|
uint32 i = ((A >> 1) & 1) | ((A - 0xA000) >> 11);
|
||||||
|
creg[i] &= (0xF0) >> ((A & 1) << 2);
|
||||||
|
creg[i] |= (V & 0xF) << ((A & 1) << 2);
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M18Power(void) {
|
||||||
|
IRQa = 0;
|
||||||
|
preg[0] = 0;
|
||||||
|
preg[1] = 1;
|
||||||
|
preg[2] = ~1;
|
||||||
|
preg[3] = ~0;
|
||||||
|
Sync();
|
||||||
|
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||||
|
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||||
|
SetWriteHandler(0x8000, 0x9FFF, M18WritePrg);
|
||||||
|
SetWriteHandler(0xA000, 0xDFFF, M18WriteChr);
|
||||||
|
SetWriteHandler(0xE000, 0xFFFF, M18WriteIRQ);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void FP_FASTAPASS(1) M18IRQHook(int a) {
|
||||||
|
if (IRQa && IRQCount) {
|
||||||
|
IRQCount -= a;
|
||||||
|
if (IRQCount <= 0) {
|
||||||
|
X6502_IRQBegin(FCEU_IQEXT);
|
||||||
|
IRQCount = 0;
|
||||||
|
IRQa = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M18Close(void) {
|
||||||
|
if (WRAM)
|
||||||
|
FCEU_gfree(WRAM);
|
||||||
|
WRAM = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper18_Init(CartInfo *info) {
|
||||||
|
info->Power = M18Power;
|
||||||
|
info->Close = M18Close;
|
||||||
|
MapIRQHook = M18IRQHook;
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
111
src/boards/183.c
Normal file
111
src/boards/183.c
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* Gimmick Bootleg (VRC4 mapper)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 prg[4], chr[8], mirr;
|
||||||
|
static uint8 IRQCount;
|
||||||
|
static uint8 IRQPre;
|
||||||
|
static uint8 IRQa;
|
||||||
|
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ prg, 4, "PRG" },
|
||||||
|
{ chr, 8, "CHR" },
|
||||||
|
{ &mirr, 1, "MIRR" },
|
||||||
|
{ &IRQCount, 1, "IRQC" },
|
||||||
|
{ &IRQPre, 1, "IRQP" },
|
||||||
|
{ &IRQa, 1, "IRQA" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void SyncPrg(void) {
|
||||||
|
setprg8(0x6000, prg[3]);
|
||||||
|
setprg8(0x8000, prg[0]);
|
||||||
|
setprg8(0xA000, prg[1]);
|
||||||
|
setprg8(0xC000, prg[2]);
|
||||||
|
setprg8(0xE000, ~0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void SyncMirr(void) {
|
||||||
|
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 void SyncChr(void) {
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < 8; i++)
|
||||||
|
setchr1(i << 10, chr[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
|
SyncPrg();
|
||||||
|
SyncChr();
|
||||||
|
SyncMirr();
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M183Write) {
|
||||||
|
if ((A & 0xF800) == 0x6800) {
|
||||||
|
prg[3] = A & 0x3F;
|
||||||
|
SyncPrg();
|
||||||
|
} else 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: mirr = V & 3; SyncMirr(); 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(0x6000, 0xFFFF, CartBR);
|
||||||
|
SetWriteHandler(0x6000, 0xFFFF, M183Write);
|
||||||
|
SyncPrg();
|
||||||
|
SyncChr();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper183_Init(CartInfo *info) {
|
||||||
|
info->Power = M183Power;
|
||||||
|
GameHBIRQHook = M183IRQCounter;
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
|
}
|
||||||
107
src/boards/185.c
Normal file
107
src/boards/185.c
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 *DummyCHR = NULL;
|
||||||
|
static uint8 datareg;
|
||||||
|
static void (*Sync)(void);
|
||||||
|
|
||||||
|
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ &datareg, 1, "DREG" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
// on off
|
||||||
|
//1 0x0F, 0xF0 - Bird Week
|
||||||
|
//2 0x33, 0x00 - B-Wings
|
||||||
|
//3 0x11, 0x00 - Mighty Bomb Jack
|
||||||
|
//4 0x22, 0x20 - Sansuu 1 Nen, Sansuu 2 Nen
|
||||||
|
//5 0xFF, 0x00 - Sansuu 3 Nen
|
||||||
|
//6 0x21, 0x13 - Spy vs Spy
|
||||||
|
//7 0x20, 0x21 - Seicross
|
||||||
|
|
||||||
|
static void Sync185(void) {
|
||||||
|
// little dirty eh? ;_)
|
||||||
|
if ((datareg & 3) && (datareg != 0x13)) // 1, 2, 3, 4, 5, 6
|
||||||
|
setchr8(0);
|
||||||
|
else
|
||||||
|
setchr8r(0x10, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Sync181(void) {
|
||||||
|
if (!(datareg & 1)) // 7
|
||||||
|
setchr8(0);
|
||||||
|
else
|
||||||
|
setchr8r(0x10, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(MWrite) {
|
||||||
|
datareg = V;
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MPower(void) {
|
||||||
|
datareg = 0;
|
||||||
|
Sync();
|
||||||
|
setprg16(0x8000, 0);
|
||||||
|
setprg16(0xC000, ~0);
|
||||||
|
SetWriteHandler(0x8000, 0xFFFF, MWrite);
|
||||||
|
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MClose(void) {
|
||||||
|
if (DummyCHR)
|
||||||
|
FCEU_gfree(DummyCHR);
|
||||||
|
DummyCHR = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MRestore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper185_Init(CartInfo *info) {
|
||||||
|
Sync = Sync185;
|
||||||
|
info->Power = MPower;
|
||||||
|
info->Close = MClose;
|
||||||
|
GameStateRestore = MRestore;
|
||||||
|
DummyCHR = (uint8*)FCEU_gmalloc(8192);
|
||||||
|
int x;
|
||||||
|
for (x = 0; x < 8192; x++)
|
||||||
|
DummyCHR[x] = 0xff;
|
||||||
|
SetupCartCHRMapping(0x10, DummyCHR, 8192, 0);
|
||||||
|
AddExState(StateRegs, ~0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper181_Init(CartInfo *info) {
|
||||||
|
Sync = Sync181;
|
||||||
|
info->Power = MPower;
|
||||||
|
info->Close = MClose;
|
||||||
|
GameStateRestore = MRestore;
|
||||||
|
DummyCHR = (uint8*)FCEU_gmalloc(8192);
|
||||||
|
int x;
|
||||||
|
for (x = 0; x < 8192; x++)
|
||||||
|
DummyCHR[x] = 0xff;
|
||||||
|
SetupCartCHRMapping(0x10, DummyCHR, 8192, 0);
|
||||||
|
AddExState(StateRegs, ~0, 0, 0);
|
||||||
|
}
|
||||||
94
src/boards/186.c
Normal file
94
src/boards/186.c
Normal file
@@ -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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* Family Study Box by Fukutake Shoten
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 SWRAM[3072];
|
||||||
|
static uint8 *WRAM = NULL;
|
||||||
|
static uint8 regs[4];
|
||||||
|
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ regs, 4, "DREG" },
|
||||||
|
{ SWRAM, 3072, "SWRM" },
|
||||||
|
{ 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, 0x4FFF, ASWRAM);
|
||||||
|
SetWriteHandler(0x4400, 0x4FFF, BSWRAM);
|
||||||
|
regs[0] = regs[1] = regs[2] = regs[3];
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M186Close(void) {
|
||||||
|
if (WRAM)
|
||||||
|
FCEU_gfree(WRAM);
|
||||||
|
WRAM = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M186Restore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper186_Init(CartInfo *info) {
|
||||||
|
info->Power = M186Power;
|
||||||
|
info->Close = M186Close;
|
||||||
|
GameStateRestore = M186Restore;
|
||||||
|
WRAM = (uint8*)FCEU_gmalloc(32768);
|
||||||
|
SetupCartPRGMapping(0x10, WRAM, 32768, 1);
|
||||||
|
AddExState(WRAM, 32768, 0, "WRAM");
|
||||||
|
AddExState(StateRegs, ~0, 0, 0);
|
||||||
|
}
|
||||||
88
src/boards/187.c
Normal file
88
src/boards/187.c
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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");
|
||||||
|
}
|
||||||
44
src/boards/189.c
Normal file
44
src/boards/189.c
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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");
|
||||||
|
}
|
||||||
74
src/boards/193.c
Normal file
74
src/boards/193.c
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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);
|
||||||
|
}
|
||||||
97
src/boards/199.c
Normal file
97
src/boards/199.c
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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)
|
||||||
|
FCEU_gfree(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");
|
||||||
|
}
|
||||||
78
src/boards/206.c
Normal file
78
src/boards/206.c
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 cmd;
|
||||||
|
static uint8 DRegs[8];
|
||||||
|
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ &cmd, 1, "CMD" },
|
||||||
|
{ DRegs, 8, "DREG" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
setchr2(0x0000, DRegs[0]);
|
||||||
|
setchr2(0x0800, DRegs[1]);
|
||||||
|
int x;
|
||||||
|
for (x = 0; x < 4; x++)
|
||||||
|
setchr1(0x1000 + (x << 10), DRegs[2 + x]);
|
||||||
|
setprg8(0x8000, DRegs[6]);
|
||||||
|
setprg8(0xa000, DRegs[7]);
|
||||||
|
setprg8(0xc000, ~1);
|
||||||
|
setprg8(0xe000, ~0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M206Write) {
|
||||||
|
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 M206Power(void) {
|
||||||
|
cmd = 0;
|
||||||
|
DRegs[6] = 0;
|
||||||
|
DRegs[7] = 1;
|
||||||
|
Sync();
|
||||||
|
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||||
|
SetWriteHandler(0x8000, 0xFFFF, M206Write);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Mapper206_Init(CartInfo *info) {
|
||||||
|
info->Power = M206Power;
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
|
}
|
||||||
78
src/boards/208.c
Normal file
78
src/boards/208.c
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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(0x6800, 0x6fff, 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");
|
||||||
|
}
|
||||||
99
src/boards/222.c
Normal file
99
src/boards/222.c
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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) {
|
||||||
|
setprg8(0x8000, prg_reg[0]);
|
||||||
|
setprg8(0xA000, prg_reg[1]);
|
||||||
|
int i;
|
||||||
|
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);
|
||||||
|
}
|
||||||
89
src/boards/225.c
Normal file
89
src/boards/225.c
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 ^ 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
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) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
84
src/boards/228.c
Normal file
84
src/boards/228.c
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
/* FCE Ultra - NES/Famicom Emulator
|
||||||
|
*
|
||||||
|
* Copyright notice for this file:
|
||||||
|
* Copyright (C) 2012 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 mram[4], vreg;
|
||||||
|
static uint16 areg;
|
||||||
|
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ mram, 4, "MRAM" },
|
||||||
|
{ &areg, 2, "AREG" },
|
||||||
|
{ &vreg, 1, "VREG" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
uint32 prgl, prgh, page = (areg >> 7) & 0x3F;
|
||||||
|
if ((page & 0x30) == 0x30)
|
||||||
|
page -= 0x10;
|
||||||
|
prgl = prgh = (page << 1) + (((areg >> 6) & 1) & ((areg >> 5) & 1));
|
||||||
|
prgh += ((areg >> 5) & 1) ^ 1;
|
||||||
|
|
||||||
|
setmirror(((areg >> 13) & 1) ^ 1);
|
||||||
|
setprg16(0x8000, prgl);
|
||||||
|
setprg16(0xc000, prgh);
|
||||||
|
setchr8(((vreg & 0x3) | ((areg & 0xF) << 2)));
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M228RamWrite) {
|
||||||
|
mram[A & 3] = V & 0x0F;
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFR(M228RamRead) {
|
||||||
|
return mram[A & 3];
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M228Write) {
|
||||||
|
areg = A;
|
||||||
|
vreg = V;
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M228Reset(void) {
|
||||||
|
areg = 0x8000;
|
||||||
|
vreg = 0;
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M228Power(void) {
|
||||||
|
M228Reset();
|
||||||
|
SetReadHandler(0x5000, 0x5FFF, M228RamRead);
|
||||||
|
SetWriteHandler(0x5000, 0x5FFF, M228RamWrite);
|
||||||
|
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||||
|
SetWriteHandler(0x8000, 0xFFFF, M228Write);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper228_Init(CartInfo *info) {
|
||||||
|
info->Reset = M228Reset;
|
||||||
|
info->Power = M228Power;
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
|
}
|
||||||
78
src/boards/230.c
Normal file
78
src/boards/230.c
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* 22 + Contra Reset based custom mapper...
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 latche, reset;
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ &reset, 1, "RST" },
|
||||||
|
{ &latche, 1, "LATC" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
if (reset) {
|
||||||
|
setprg16(0x8000, latche & 7);
|
||||||
|
setprg16(0xC000, 7);
|
||||||
|
setmirror(MI_V);
|
||||||
|
} else {
|
||||||
|
uint32 bank = (latche & 0x1F) + 8;
|
||||||
|
if (latche & 0x20) {
|
||||||
|
setprg16(0x8000, bank);
|
||||||
|
setprg16(0xC000, bank);
|
||||||
|
} else
|
||||||
|
setprg32(0x8000, bank >> 1);
|
||||||
|
setmirror((latche >> 6) & 1);
|
||||||
|
}
|
||||||
|
setchr8(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M230Write) {
|
||||||
|
latche = V;
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M230Reset(void) {
|
||||||
|
reset ^= 1;
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M230Power(void) {
|
||||||
|
latche = reset = 0;
|
||||||
|
Sync();
|
||||||
|
SetWriteHandler(0x8000, 0xFFFF, M230Write);
|
||||||
|
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper230_Init(CartInfo *info) {
|
||||||
|
info->Power = M230Power;
|
||||||
|
info->Reset = M230Reset;
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
}
|
||||||
68
src/boards/232.c
Normal file
68
src/boards/232.c
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
/* FCE Ultra - NES/Famicom Emulator
|
||||||
|
*
|
||||||
|
* Copyright notice for this file:
|
||||||
|
* Copyright (C) 2012 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 bank, preg;
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ &bank, 1, "BANK" },
|
||||||
|
{ &preg, 1, "PREG" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
// uint32 bbank = (bank & 0x18) >> 1;
|
||||||
|
uint32 bbank = ((bank & 0x10) >> 2) | (bank & 8); // some dumps have bbanks swapped, if swap commands,
|
||||||
|
// then all roms can be played, but with some swapped
|
||||||
|
// games in menu. if not, some dumps are unplayable
|
||||||
|
// make hard dump for both cart types to check
|
||||||
|
setprg16(0x8000, bbank | (preg & 3));
|
||||||
|
setprg16(0xC000, bbank | 3);
|
||||||
|
setchr8(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M232WriteBank) {
|
||||||
|
bank = V;
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M232WritePreg) {
|
||||||
|
preg = V;
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M232Power(void) {
|
||||||
|
bank = preg = 0;
|
||||||
|
Sync();
|
||||||
|
SetWriteHandler(0x8000, 0xBFFF, M232WriteBank);
|
||||||
|
SetWriteHandler(0xC000, 0xFFFF, M232WritePreg);
|
||||||
|
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper232_Init(CartInfo *info) {
|
||||||
|
info->Power = M232Power;
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
}
|
||||||
79
src/boards/234.c
Normal file
79
src/boards/234.c
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
/* FCE Ultra - NES/Famicom Emulator
|
||||||
|
*
|
||||||
|
* Copyright notice for this file:
|
||||||
|
* Copyright (C) 2012 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 bank, preg;
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ &bank, 1, "BANK" },
|
||||||
|
{ &preg, 1, "PREG" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
if (bank & 0x40) {
|
||||||
|
setprg32(0x8000, (bank & 0xE) | (preg & 1));
|
||||||
|
setchr8(((bank & 0xE) << 2) | ((preg >> 4) & 7));
|
||||||
|
} else {
|
||||||
|
setprg32(0x8000, bank & 0xF);
|
||||||
|
setchr8(((bank & 0xF) << 2) | ((preg >> 4) & 3));
|
||||||
|
}
|
||||||
|
setmirror((bank >> 7) ^ 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
DECLFR(M234ReadBank) {
|
||||||
|
uint8 r = CartBR(A);
|
||||||
|
if (!bank) {
|
||||||
|
bank = r;
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
DECLFR(M234ReadPreg) {
|
||||||
|
uint8 r = CartBR(A);
|
||||||
|
preg = r;
|
||||||
|
Sync();
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M234Reset(void) {
|
||||||
|
bank = preg = 0;
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M234Power(void) {
|
||||||
|
M234Reset();
|
||||||
|
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||||
|
SetReadHandler(0xFF80, 0xFF9F, M234ReadBank);
|
||||||
|
SetReadHandler(0xFFE8, 0xFFF7, M234ReadPreg);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper234_Init(CartInfo *info) {
|
||||||
|
info->Power = M234Power;
|
||||||
|
info->Reset = M234Reset;
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
}
|
||||||
63
src/boards/235.c
Normal file
63
src/boards/235.c
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint16 cmdreg;
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ &cmdreg, 2, "CREG" },
|
||||||
|
{ 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);
|
||||||
|
}
|
||||||
77
src/boards/244.c
Normal file
77
src/boards/244.c
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
/* FCE Ultra - NES/Famicom Emulator
|
||||||
|
*
|
||||||
|
* Copyright notice for this file:
|
||||||
|
* Copyright (C) 2012 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 preg, creg;
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ &preg, 1, "PREG" },
|
||||||
|
{ &creg, 1, "CREG" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static uint8 prg_perm[4][4] = {
|
||||||
|
{ 0, 1, 2, 3, },
|
||||||
|
{ 3, 2, 1, 0, },
|
||||||
|
{ 0, 2, 1, 3, },
|
||||||
|
{ 3, 1, 2, 0, },
|
||||||
|
};
|
||||||
|
|
||||||
|
static uint8 chr_perm[8][8] = {
|
||||||
|
{ 0, 1, 2, 3, 4, 5, 6, 7, },
|
||||||
|
{ 0, 2, 1, 3, 4, 6, 5, 7, },
|
||||||
|
{ 0, 1, 4, 5, 2, 3, 6, 7, },
|
||||||
|
{ 0, 4, 1, 5, 2, 6, 3, 7, },
|
||||||
|
{ 0, 4, 2, 6, 1, 5, 3, 7, },
|
||||||
|
{ 0, 2, 4, 6, 1, 3, 5, 7, },
|
||||||
|
{ 7, 6, 5, 4, 3, 2, 1, 0, },
|
||||||
|
{ 7, 6, 5, 4, 3, 2, 1, 0, },
|
||||||
|
};
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
setprg32(0x8000, preg);
|
||||||
|
setchr8(creg);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M244Write) {
|
||||||
|
if (V & 8)
|
||||||
|
creg = chr_perm[(V >> 4) & 7][V & 7];
|
||||||
|
else
|
||||||
|
preg = prg_perm[(V >> 4) & 3][V & 3];
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M244Power(void) {
|
||||||
|
preg = creg = 0;
|
||||||
|
Sync();
|
||||||
|
SetWriteHandler(0x8000, 0xFFFF, M244Write);
|
||||||
|
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper244_Init(CartInfo *info) {
|
||||||
|
info->Power = M244Power;
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
}
|
||||||
85
src/boards/246.c
Normal file
85
src/boards/246.c
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
/* FCE Ultra - NES/Famicom Emulator
|
||||||
|
*
|
||||||
|
* Copyright notice for this file:
|
||||||
|
* Copyright (C) 2012 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 regs[8];
|
||||||
|
static uint8 *WRAM = NULL;
|
||||||
|
static uint32 WRAMSIZE;
|
||||||
|
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ regs, 8, "REGS" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
setprg2r(0x10, 0x6800, 0);
|
||||||
|
setprg8(0x8000, regs[0]);
|
||||||
|
setprg8(0xA000, regs[1]);
|
||||||
|
setprg8(0xC000, regs[2]);
|
||||||
|
setprg8(0xE000, regs[3]);
|
||||||
|
setchr2(0x0000, regs[4]);
|
||||||
|
setchr2(0x0800, regs[5]);
|
||||||
|
setchr2(0x1000, regs[6]);
|
||||||
|
setchr2(0x1800, regs[7]);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M246Write) {
|
||||||
|
regs[A & 7] = V;
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M246Power(void) {
|
||||||
|
regs[0] = regs[1] = regs[2] = regs[3] = ~0;
|
||||||
|
Sync();
|
||||||
|
SetWriteHandler(0x6000, 0x67FF, M246Write);
|
||||||
|
SetReadHandler(0x6800, 0x6FFF, CartBR);
|
||||||
|
SetWriteHandler(0x6800, 0x6FFF, CartBW);
|
||||||
|
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M246Close(void) {
|
||||||
|
if (WRAM)
|
||||||
|
FCEU_gfree(WRAM);
|
||||||
|
WRAM = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper246_Init(CartInfo *info) {
|
||||||
|
info->Power = M246Power;
|
||||||
|
info->Close = M246Close;
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
|
||||||
|
WRAMSIZE = 2048;
|
||||||
|
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);
|
||||||
|
}
|
||||||
134
src/boards/252.c
Normal file
134
src/boards/252.c
Normal file
@@ -0,0 +1,134 @@
|
|||||||
|
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 creg[8], preg[2];
|
||||||
|
static int32 IRQa, IRQCount, IRQClock, IRQLatch;
|
||||||
|
static uint8 *WRAM = NULL;
|
||||||
|
static uint32 WRAMSIZE;
|
||||||
|
static uint8 *CHRRAM = NULL;
|
||||||
|
static uint32 CHRRAMSIZE;
|
||||||
|
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ creg, 8, "CREG" },
|
||||||
|
{ preg, 2, "PREG" },
|
||||||
|
{ &IRQa, 4, "IRQA" },
|
||||||
|
{ &IRQCount, 4, "IRQC" },
|
||||||
|
{ &IRQLatch, 4, "IRQL" },
|
||||||
|
{ &IRQClock, 4, "IRQK" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
uint8 i;
|
||||||
|
setprg8r(0x10, 0x6000, 0);
|
||||||
|
setprg8(0x8000, preg[0]);
|
||||||
|
setprg8(0xa000, preg[1]);
|
||||||
|
setprg8(0xc000, ~1);
|
||||||
|
setprg8(0xe000, ~0);
|
||||||
|
for (i = 0; i < 8; i++)
|
||||||
|
if ((creg[i] == 6) || (creg[i] == 7))
|
||||||
|
setchr1r(0x10, i << 10, creg[i] & 1);
|
||||||
|
else
|
||||||
|
setchr1(i << 10, creg[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M252Write) {
|
||||||
|
if ((A >= 0xB000) && (A <= 0xEFFF)) {
|
||||||
|
uint8 ind = ((((A & 8) | (A >> 8)) >> 3) + 2) & 7;
|
||||||
|
uint8 sar = A & 4;
|
||||||
|
creg[ind] = (creg[ind] & (0xF0 >> sar)) | ((V & 0x0F) << sar);
|
||||||
|
Sync();
|
||||||
|
} else
|
||||||
|
switch (A & 0xF00C) {
|
||||||
|
case 0x8000:
|
||||||
|
case 0x8004:
|
||||||
|
case 0x8008:
|
||||||
|
case 0x800C: preg[0] = V; Sync(); break;
|
||||||
|
case 0xA000:
|
||||||
|
case 0xA004:
|
||||||
|
case 0xA008:
|
||||||
|
case 0xA00C: preg[1] = V; Sync(); break;
|
||||||
|
case 0xF000: X6502_IRQEnd(FCEU_IQEXT); IRQLatch &= 0xF0; IRQLatch |= V & 0xF; break;
|
||||||
|
case 0xF004: X6502_IRQEnd(FCEU_IQEXT); IRQLatch &= 0x0F; IRQLatch |= V << 4; break;
|
||||||
|
case 0xF008: X6502_IRQEnd(FCEU_IQEXT); IRQClock = 0; IRQCount = IRQLatch; IRQa = V & 2; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M252Power(void) {
|
||||||
|
Sync();
|
||||||
|
SetReadHandler(0x6000, 0x7FFF, CartBR);
|
||||||
|
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||||
|
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||||
|
SetWriteHandler(0x8000, 0xFFFF, M252Write);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M252IRQ(int a) {
|
||||||
|
#define LCYCS 341
|
||||||
|
if (IRQa) {
|
||||||
|
IRQClock += a * 3;
|
||||||
|
if (IRQClock >= LCYCS) {
|
||||||
|
while (IRQClock >= LCYCS) {
|
||||||
|
IRQClock -= LCYCS;
|
||||||
|
IRQCount++;
|
||||||
|
if (IRQCount & 0x100) {
|
||||||
|
X6502_IRQBegin(FCEU_IQEXT);
|
||||||
|
IRQCount = IRQLatch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M252Close(void) {
|
||||||
|
if (WRAM)
|
||||||
|
FCEU_gfree(WRAM);
|
||||||
|
if (CHRRAM)
|
||||||
|
FCEU_gfree(CHRRAM);
|
||||||
|
WRAM = CHRRAM = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper252_Init(CartInfo *info) {
|
||||||
|
info->Power = M252Power;
|
||||||
|
info->Close = M252Close;
|
||||||
|
MapIRQHook = M252IRQ;
|
||||||
|
|
||||||
|
CHRRAMSIZE = 2048;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
|
}
|
||||||
151
src/boards/253.c
Normal file
151
src/boards/253.c
Normal file
@@ -0,0 +1,151 @@
|
|||||||
|
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 chrlo[8], chrhi[8], prg[2], mirr, vlock;
|
||||||
|
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, "CHRL" },
|
||||||
|
{ chrhi, 8, "CHRH" },
|
||||||
|
{ prg, 2, "PRGR" },
|
||||||
|
{ &mirr, 1, "MIRR" },
|
||||||
|
{ &vlock, 1, "VLCK" },
|
||||||
|
{ &IRQa, 4, "IRQA" },
|
||||||
|
{ &IRQCount, 4, "IRQC" },
|
||||||
|
{ &IRQLatch, 4, "IRQL" },
|
||||||
|
{ &IRQClock, 4, "IRQK" },
|
||||||
|
{ 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 (((chrlo[i] == 4) || (chrlo[i] == 5)) && !vlock)
|
||||||
|
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;
|
||||||
|
uint8 clo = (chrlo[ind] & (0xF0 >> sar)) | ((V & 0x0F) << sar);
|
||||||
|
chrlo[ind] = clo;
|
||||||
|
if (ind == 0) {
|
||||||
|
if (clo == 0xc8)
|
||||||
|
vlock = 0;
|
||||||
|
else if (clo == 0x88)
|
||||||
|
vlock = 1;
|
||||||
|
}
|
||||||
|
if (sar)
|
||||||
|
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: X6502_IRQEnd(FCEU_IQEXT); IRQLatch &= 0xF0; IRQLatch |= V & 0xF; break;
|
||||||
|
case 0xF004: X6502_IRQEnd(FCEU_IQEXT); IRQLatch &= 0x0F; IRQLatch |= V << 4; break;
|
||||||
|
case 0xF008: X6502_IRQEnd(FCEU_IQEXT); IRQClock = 0; IRQCount = IRQLatch; IRQa = V & 2; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M253Power(void) {
|
||||||
|
vlock = 0;
|
||||||
|
Sync();
|
||||||
|
SetReadHandler(0x6000, 0x7FFF, CartBR);
|
||||||
|
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||||
|
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||||
|
SetWriteHandler(0x8000, 0xFFFF, M253Write);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M253Close(void) {
|
||||||
|
if (WRAM)
|
||||||
|
FCEU_gfree(WRAM);
|
||||||
|
if (CHRRAM)
|
||||||
|
FCEU_gfree(CHRRAM);
|
||||||
|
WRAM = CHRRAM = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M253IRQ(int a) {
|
||||||
|
#define LCYCS 341
|
||||||
|
if (IRQa) {
|
||||||
|
IRQClock += a * 3;
|
||||||
|
if (IRQClock >= LCYCS) {
|
||||||
|
while (IRQClock >= LCYCS) {
|
||||||
|
IRQClock -= LCYCS;
|
||||||
|
IRQCount++;
|
||||||
|
if (IRQCount & 0x100) {
|
||||||
|
X6502_IRQBegin(FCEU_IQEXT);
|
||||||
|
IRQCount = IRQLatch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper253_Init(CartInfo *info) {
|
||||||
|
info->Power = M253Power;
|
||||||
|
info->Close = M253Close;
|
||||||
|
MapIRQHook = M253IRQ;
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
|
||||||
|
CHRRAMSIZE = 2048;
|
||||||
|
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);
|
||||||
|
}
|
||||||
101
src/boards/32.c
Normal file
101
src/boards/32.c
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
/* FCE Ultra - NES/Famicom Emulator
|
||||||
|
*
|
||||||
|
* Copyright notice for this file:
|
||||||
|
* Copyright (C) 2012 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 preg[2], creg[8], mirr;
|
||||||
|
|
||||||
|
static uint8 *WRAM = NULL;
|
||||||
|
static uint32 WRAMSIZE;
|
||||||
|
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ preg, 4, "PREG" },
|
||||||
|
{ creg, 8, "CREG" },
|
||||||
|
{ &mirr, 1, "MIRR" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
uint16 swap = ((mirr & 2) << 13);
|
||||||
|
setmirror((mirr & 1) ^ 1);
|
||||||
|
setprg8r(0x10, 0x6000, 0);
|
||||||
|
setprg8(0x8000 ^ swap, preg[0]);
|
||||||
|
setprg8(0xA000, preg[1]);
|
||||||
|
setprg8(0xC000 ^ swap, ~1);
|
||||||
|
setprg8(0xE000, ~0);
|
||||||
|
uint8 i;
|
||||||
|
for (i = 0; i < 8; i++)
|
||||||
|
setchr1(i << 10, creg[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M32Write0) {
|
||||||
|
preg[0] = V;
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M32Write1) {
|
||||||
|
mirr = V;
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M32Write2) {
|
||||||
|
preg[1] = V;
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M32Write3) {
|
||||||
|
creg[A & 7] = V;
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M32Power(void) {
|
||||||
|
Sync();
|
||||||
|
SetReadHandler(0x6000, 0x7fff, CartBR);
|
||||||
|
SetWriteHandler(0x6000, 0x7fff, CartBW);
|
||||||
|
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||||
|
SetWriteHandler(0x8000, 0x8FFF, M32Write0);
|
||||||
|
SetWriteHandler(0x9000, 0x9FFF, M32Write1);
|
||||||
|
SetWriteHandler(0xA000, 0xAFFF, M32Write2);
|
||||||
|
SetWriteHandler(0xB000, 0xBFFF, M32Write3);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M32Close(void) {
|
||||||
|
if (WRAM)
|
||||||
|
FCEU_gfree(WRAM);
|
||||||
|
WRAM = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper32_Init(CartInfo *info) {
|
||||||
|
info->Power = M32Power;
|
||||||
|
info->Close = M32Close;
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
|
||||||
|
WRAMSIZE = 8192;
|
||||||
|
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||||
|
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||||
|
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||||
|
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
|
}
|
||||||
117
src/boards/33.c
Normal file
117
src/boards/33.c
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
/* FCE Ultra - NES/Famicom Emulator
|
||||||
|
*
|
||||||
|
* Copyright notice for this file:
|
||||||
|
* Copyright (C) 2012 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 is48;
|
||||||
|
static uint8 regs[8], mirr;
|
||||||
|
static uint8 IRQa;
|
||||||
|
static int16 IRQCount, IRQLatch;
|
||||||
|
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ regs, 8, "PREG" },
|
||||||
|
{ &mirr, 1, "MIRR" },
|
||||||
|
{ &IRQa, 1, "IRQA" },
|
||||||
|
{ &IRQCount, 2, "IRQC" },
|
||||||
|
{ &IRQLatch, 2, "IRQL" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
setmirror(mirr);
|
||||||
|
setprg8(0x8000, regs[0]);
|
||||||
|
setprg8(0xA000, regs[1]);
|
||||||
|
setprg8(0xC000, ~1);
|
||||||
|
setprg8(0xE000, ~0);
|
||||||
|
setchr2(0x0000, regs[2]);
|
||||||
|
setchr2(0x0800, regs[3]);
|
||||||
|
setchr1(0x1000, regs[4]);
|
||||||
|
setchr1(0x1400, regs[5]);
|
||||||
|
setchr1(0x1800, regs[6]);
|
||||||
|
setchr1(0x1C00, regs[7]);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M33Write) {
|
||||||
|
A &= 0xF003;
|
||||||
|
switch (A) {
|
||||||
|
case 0x8000: regs[0] = V & 0x3F; if (!is48) mirr = ((V >> 6) & 1) ^ 1; Sync(); break;
|
||||||
|
case 0x8001: regs[1] = V & 0x3F; Sync(); break;
|
||||||
|
case 0x8002: regs[2] = V; Sync(); break;
|
||||||
|
case 0x8003: regs[3] = V; Sync(); break;
|
||||||
|
case 0xA000: regs[4] = V; Sync(); break;
|
||||||
|
case 0xA001: regs[5] = V; Sync(); break;
|
||||||
|
case 0xA002: regs[6] = V; Sync(); break;
|
||||||
|
case 0xA003: regs[7] = V; Sync(); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M48Write) {
|
||||||
|
switch (A & 0xF003) {
|
||||||
|
case 0xC000: IRQLatch = V; break;
|
||||||
|
case 0xC001: IRQCount = IRQLatch; break;
|
||||||
|
case 0xC003: IRQa = 0; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||||
|
case 0xC002: IRQa = 1; break;
|
||||||
|
case 0xE000: mirr = ((V >> 6) & 1) ^ 1; Sync(); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M33Power(void) {
|
||||||
|
Sync();
|
||||||
|
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||||
|
SetWriteHandler(0x8000, 0xFFFF, M33Write);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M48Power(void) {
|
||||||
|
Sync();
|
||||||
|
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||||
|
SetWriteHandler(0x8000, 0xBFFF, M33Write);
|
||||||
|
SetWriteHandler(0xC000, 0xFFFF, M48Write);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M48IRQ(void) {
|
||||||
|
if (IRQa) {
|
||||||
|
IRQCount++;
|
||||||
|
if (IRQCount == 0x100) {
|
||||||
|
X6502_IRQBegin(FCEU_IQEXT);
|
||||||
|
IRQa = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper33_Init(CartInfo *info) {
|
||||||
|
is48 = 0;
|
||||||
|
info->Power = M33Power;
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper48_Init(CartInfo *info) {
|
||||||
|
is48 = 1;
|
||||||
|
info->Power = M48Power;
|
||||||
|
GameHBIRQHook = M48IRQ;
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
92
src/boards/34.c
Normal file
92
src/boards/34.c
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
/* FCE Ultra - NES/Famicom Emulator
|
||||||
|
*
|
||||||
|
* Copyright notice for this file:
|
||||||
|
* Copyright (C) 2012 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* Many-in-one hacked mapper crap.
|
||||||
|
*
|
||||||
|
* Original BNROM is actually AxROM variations without mirroring control,
|
||||||
|
* and haven't SRAM on-board, so it must be removed from here
|
||||||
|
*
|
||||||
|
* Difficult banking is what NINA board doing, most hacks for 34 mapper are
|
||||||
|
* NINA hacks, so this is actually 34 mapper
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 regs[3];
|
||||||
|
static uint8 *WRAM = NULL;
|
||||||
|
static uint32 WRAMSIZE;
|
||||||
|
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ regs, 3, "REGS" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
setprg8r(0x10, 0x6000, 0);
|
||||||
|
setprg32(0x8000, regs[0]);
|
||||||
|
setchr4(0x0000, regs[1]);
|
||||||
|
setchr4(0x1000, regs[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M34Write) {
|
||||||
|
if (A >= 0x8000)
|
||||||
|
regs[0] = V;
|
||||||
|
else
|
||||||
|
switch (A) {
|
||||||
|
case 0x7ffd: regs[0] = V; break;
|
||||||
|
case 0x7ffe: regs[1] = V; break;
|
||||||
|
case 0x7fff: regs[2] = V; break;
|
||||||
|
}
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M34Power(void) {
|
||||||
|
regs[0] = regs[1] = 0;
|
||||||
|
regs[2] = 1;
|
||||||
|
Sync();
|
||||||
|
SetReadHandler(0x6000, 0x7ffc, CartBR);
|
||||||
|
SetWriteHandler(0x6000, 0x7ffc, CartBW);
|
||||||
|
SetReadHandler(0x8000, 0xffff, CartBR);
|
||||||
|
SetWriteHandler(0x7ffd, 0xffff, M34Write);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M34Close(void) {
|
||||||
|
if (WRAM)
|
||||||
|
FCEU_gfree(WRAM);
|
||||||
|
WRAM = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper34_Init(CartInfo *info) {
|
||||||
|
info->Power = M34Power;
|
||||||
|
info->Close = M34Close;
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
|
||||||
|
WRAMSIZE = 8192;
|
||||||
|
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||||
|
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||||
|
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||||
|
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
|
}
|
||||||
63
src/boards/36.c
Normal file
63
src/boards/36.c
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
/* FCE Ultra - NES/Famicom Emulator
|
||||||
|
*
|
||||||
|
* Copyright notice for this file:
|
||||||
|
* Copyright (C) 2012 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* TXC/Micro Genius simplified mapper
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 latche;
|
||||||
|
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ &latche, 1, "LATC" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
setprg32(0x8000, latche >> 4);
|
||||||
|
setchr8(latche & 0xf);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M36Write) {
|
||||||
|
latche = V;
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFR(M36Read) {
|
||||||
|
return latche; // Need by Strike Wolf, being simplified mapper, this cart still uses some TCX mapper features andrely on it
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M36Power(void) {
|
||||||
|
latche = 0;
|
||||||
|
Sync();
|
||||||
|
SetReadHandler(0x4100, 0x4100, M36Read);
|
||||||
|
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||||
|
SetWriteHandler(0x8000, 0xFFFE, M36Write); // Actually, BUS conflict there preventing from triggering the wrong banks
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M36Restore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper36_Init(CartInfo *info) {
|
||||||
|
info->Power = M36Power;
|
||||||
|
GameStateRestore = M36Restore;
|
||||||
|
AddExState(StateRegs, ~0, 0, 0);
|
||||||
|
}
|
||||||
95
src/boards/3d-block.c
Normal file
95
src/boards/3d-block.c
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 FP_FASTAPASS(1) 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);
|
||||||
|
}
|
||||||
85
src/boards/40.c
Normal file
85
src/boards/40.c
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
/* FCE Ultra - NES/Famicom Emulator
|
||||||
|
*
|
||||||
|
* Copyright notice for this file:
|
||||||
|
* Copyright (C) 2012 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* FDS Conversion
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 reg;
|
||||||
|
static uint32 IRQCount, IRQa;
|
||||||
|
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ &IRQCount, 4, "IRQC" },
|
||||||
|
{ &IRQa, 4, "IRQA" },
|
||||||
|
{ ®, 1, "REG" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
setprg8(0x6000, ~1);
|
||||||
|
setprg8(0x8000, ~3);
|
||||||
|
setprg8(0xa000, ~2);
|
||||||
|
setprg8(0xc000, reg);
|
||||||
|
setprg8(0xe000, ~0);
|
||||||
|
setchr8(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M40Write) {
|
||||||
|
switch (A & 0xe000) {
|
||||||
|
case 0x8000: IRQa = 0; IRQCount = 0; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||||
|
case 0xa000: IRQa = 1; break;
|
||||||
|
case 0xe000: reg = V & 7; Sync(); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M40Power(void) {
|
||||||
|
reg = 0;
|
||||||
|
Sync();
|
||||||
|
SetReadHandler(0x6000, 0xffff, CartBR);
|
||||||
|
SetWriteHandler(0x8000, 0xffff, M40Write);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M40Reset(void) {
|
||||||
|
}
|
||||||
|
|
||||||
|
static void FP_FASTAPASS(1) M40IRQHook(int a) {
|
||||||
|
if (IRQa) {
|
||||||
|
if (IRQCount < 4096)
|
||||||
|
IRQCount += a;
|
||||||
|
else {
|
||||||
|
IRQa = 0;
|
||||||
|
X6502_IRQBegin(FCEU_IQEXT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper40_Init(CartInfo *info) {
|
||||||
|
info->Reset = M40Reset;
|
||||||
|
info->Power = M40Power;
|
||||||
|
MapIRQHook = M40IRQHook;
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
|
}
|
||||||
69
src/boards/41.c
Normal file
69
src/boards/41.c
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
/* FCE Ultra - NES/Famicom Emulator
|
||||||
|
*
|
||||||
|
* Copyright notice for this file:
|
||||||
|
* Copyright (C) 2012 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 mainreg, chrreg, mirror;
|
||||||
|
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ &mainreg, 1, "MREG" },
|
||||||
|
{ &chrreg, 1, "CREG" },
|
||||||
|
{ &mirror, 1, "MIRR" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
setprg32(0x8000, mainreg & 7);
|
||||||
|
setchr8(chrreg);
|
||||||
|
setmirror(mirror);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M41Write0) {
|
||||||
|
mainreg = A & 0xFF;
|
||||||
|
mirror = ((A >> 5) & 1) ^ 1;
|
||||||
|
chrreg = (chrreg & 3) | ((A >> 1) & 0xC);
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M41Write1) {
|
||||||
|
if (mainreg & 0x4) {
|
||||||
|
chrreg = (chrreg & 0xC) | (A & 3);
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M41Power(void) {
|
||||||
|
mainreg = chrreg = 0;
|
||||||
|
Sync();
|
||||||
|
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||||
|
SetWriteHandler(0x6000, 0x67FF, M41Write0);
|
||||||
|
SetWriteHandler(0x8000, 0xFFFF, M41Write1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper41_Init(CartInfo *info) {
|
||||||
|
info->Power = M41Power;
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
|
}
|
||||||
64
src/boards/411120-c.c
Normal file
64
src/boards/411120-c.c
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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");
|
||||||
|
}
|
||||||
83
src/boards/42.c
Normal file
83
src/boards/42.c
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
/* FCE Ultra - NES/Famicom Emulator
|
||||||
|
*
|
||||||
|
* Copyright notice for this file:
|
||||||
|
* Copyright (C) 2012 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* FDS Conversion
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 preg, creg, mirr;
|
||||||
|
static uint32 IRQCount, IRQa;
|
||||||
|
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ &preg, 1, "PREG" },
|
||||||
|
{ &creg, 1, "CREG" },
|
||||||
|
{ &mirr, 1, "MIRR" },
|
||||||
|
{ &IRQCount, 4, "IRQC" },
|
||||||
|
{ &IRQa, 4, "IRQA" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
setprg8(0x6000, preg);
|
||||||
|
setprg32(0x8000, ~0);
|
||||||
|
setchr8(creg);
|
||||||
|
setmirror(mirr);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M42Write) {
|
||||||
|
switch (A & 0xE003) {
|
||||||
|
case 0x8000: creg = V; Sync(); break;
|
||||||
|
case 0xE000: preg = V & 0x0F; Sync(); break;
|
||||||
|
case 0xE001: mirr = ((V >> 3) & 1) ^ 1; Sync(); break;
|
||||||
|
case 0xE002: IRQa = V & 2; if (!IRQa) IRQCount = 0; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M42Power(void) {
|
||||||
|
preg = 0;
|
||||||
|
mirr = 1; // Ai Senshi Nicol actually has fixed mirroring, but mapper forcing it's default value now
|
||||||
|
Sync();
|
||||||
|
SetReadHandler(0x6000, 0xffff, CartBR);
|
||||||
|
SetWriteHandler(0x6000, 0xffff, M42Write);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void FP_FASTAPASS(1) M42IRQHook(int a) {
|
||||||
|
if (IRQa) {
|
||||||
|
IRQCount += a;
|
||||||
|
if (IRQCount >= 32768) IRQCount -= 32768;
|
||||||
|
if (IRQCount >= 24576)
|
||||||
|
X6502_IRQBegin(FCEU_IQEXT);
|
||||||
|
else
|
||||||
|
X6502_IRQEnd(FCEU_IQEXT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper42_Init(CartInfo *info) {
|
||||||
|
info->Power = M42Power;
|
||||||
|
MapIRQHook = M42IRQHook;
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
|
}
|
||||||
91
src/boards/43.c
Normal file
91
src/boards/43.c
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
/* FCE Ultra - NES/Famicom Emulator
|
||||||
|
*
|
||||||
|
* Copyright notice for this file:
|
||||||
|
* Copyright (C) 2006 CaH4e3
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* FDS Conversion
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 reg, swap;
|
||||||
|
static uint32 IRQCount, IRQa;
|
||||||
|
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ &IRQCount, 4, "IRQC" },
|
||||||
|
{ &IRQa, 4, "IRQA" },
|
||||||
|
{ ®, 1, "REG" },
|
||||||
|
{ &swap, 1, "SWAP" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
setprg4(0x5000, 8 << 1); // Only YS-612 advanced version
|
||||||
|
setprg8(0x6000, swap?0:2);
|
||||||
|
setprg8(0x8000, 1);
|
||||||
|
setprg8(0xa000, 0);
|
||||||
|
setprg8(0xc000, reg);
|
||||||
|
setprg8(0xe000, swap?8:9); // hard dump for mr.Mary is 128K,
|
||||||
|
// bank 9 is the last 2K ok bank 8 repeated 4 times, then till the end of 128K
|
||||||
|
// instead used bank A, containing some CHR data, ines rom have unused banks removed,
|
||||||
|
// and bank A moved to the bank 9 place for compatibility with other crappy dumps
|
||||||
|
setchr8(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M43Write) {
|
||||||
|
// int transo[8]={4,3,4,4,4,7,5,6};
|
||||||
|
int transo[8] = { 4, 3, 5, 3, 6, 3, 7, 3 }; // According to hardware tests
|
||||||
|
switch (A & 0xf1ff) {
|
||||||
|
case 0x4022: reg = transo[V & 7]; Sync(); break;
|
||||||
|
case 0x4120: swap = V & 1; Sync(); break;
|
||||||
|
case 0x8122: // hacked version
|
||||||
|
case 0x4122: IRQa = V & 1; X6502_IRQEnd(FCEU_IQEXT); IRQCount = 0; break; // original version
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M43Power(void) {
|
||||||
|
reg = swap = 0;
|
||||||
|
Sync();
|
||||||
|
SetReadHandler(0x5000, 0xffff, CartBR);
|
||||||
|
SetWriteHandler(0x4020, 0xffff, M43Write);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M43Reset(void) {
|
||||||
|
}
|
||||||
|
|
||||||
|
static void FP_FASTAPASS(1) M43IRQHook(int a) {
|
||||||
|
IRQCount += a;
|
||||||
|
if (IRQa)
|
||||||
|
if (IRQCount >= 4096) {
|
||||||
|
IRQa = 0;
|
||||||
|
X6502_IRQBegin(FCEU_IQEXT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper43_Init(CartInfo *info) {
|
||||||
|
info->Reset = M43Reset;
|
||||||
|
info->Power = M43Power;
|
||||||
|
MapIRQHook = M43IRQHook;
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
|
}
|
||||||
69
src/boards/46.c
Normal file
69
src/boards/46.c
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
/* FCE Ultra - NES/Famicom Emulator
|
||||||
|
*
|
||||||
|
* Copyright notice for this file:
|
||||||
|
* Copyright (C) 2012 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 reg0, reg1;
|
||||||
|
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ ®0, 1, "REG0" },
|
||||||
|
{ ®1, 1, "REG1" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
setprg32(0x8000, (reg1 & 1) + ((reg0 & 0xF) << 1));
|
||||||
|
setchr8(((reg1 >> 4) & 7) + ((reg0 & 0xF0) >> 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M46Write0) {
|
||||||
|
reg0 = V;
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M46Write1) {
|
||||||
|
reg1 = V;
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M46Power(void) {
|
||||||
|
reg0 = reg1 = 0;
|
||||||
|
Sync();
|
||||||
|
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||||
|
SetWriteHandler(0x6000, 0x7FFF, M46Write0);
|
||||||
|
SetWriteHandler(0x8000, 0xFFFF, M46Write1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M46Reset(void) {
|
||||||
|
reg0 = reg1 = 0;
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper46_Init(CartInfo *info) {
|
||||||
|
info->Power = M46Power;
|
||||||
|
info->Reset = M46Reset;
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
|
}
|
||||||
84
src/boards/50.c
Normal file
84
src/boards/50.c
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
/* FCE Ultra - NES/Famicom Emulator
|
||||||
|
*
|
||||||
|
* Copyright notice for this file:
|
||||||
|
* Copyright (C) 2012 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* FDS Conversion
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 reg;
|
||||||
|
static uint32 IRQCount, IRQa;
|
||||||
|
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ &IRQCount, 4, "IRQC" },
|
||||||
|
{ &IRQa, 4, "IRQA" },
|
||||||
|
{ ®, 1, "REG" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
setprg8(0x6000, 0xF);
|
||||||
|
setprg8(0x8000, 0x8);
|
||||||
|
setprg8(0xa000, 0x9);
|
||||||
|
setprg8(0xc000, reg);
|
||||||
|
setprg8(0xe000, 0xB);
|
||||||
|
setchr8(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M50Write) {
|
||||||
|
switch (A & 0xD160) {
|
||||||
|
case 0x4120: IRQa = V & 1; if (!IRQa) IRQCount = 0; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||||
|
case 0x4020: reg = ((V & 1) << 2) | ((V & 2) >> 1) | ((V & 4) >> 1) | (V & 8); Sync(); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M50Power(void) {
|
||||||
|
reg = 0;
|
||||||
|
Sync();
|
||||||
|
SetReadHandler(0x6000, 0xffff, CartBR);
|
||||||
|
SetWriteHandler(0x4020, 0x5fff, M50Write);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M50Reset(void) {
|
||||||
|
}
|
||||||
|
|
||||||
|
static void FP_FASTAPASS(1) M50IRQHook(int a) {
|
||||||
|
if (IRQa) {
|
||||||
|
if (IRQCount < 4096)
|
||||||
|
IRQCount += a;
|
||||||
|
else {
|
||||||
|
IRQa = 0;
|
||||||
|
X6502_IRQBegin(FCEU_IQEXT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper50_Init(CartInfo *info) {
|
||||||
|
info->Reset = M50Reset;
|
||||||
|
info->Power = M50Power;
|
||||||
|
MapIRQHook = M50IRQHook;
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
|
}
|
||||||
84
src/boards/51.c
Normal file
84
src/boards/51.c
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
/* FCE Ultra - NES/Famicom Emulator
|
||||||
|
*
|
||||||
|
* Copyright notice for this file:
|
||||||
|
* Copyright (C) 2012 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 bank, mode;
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ &bank, 1, "BANK" },
|
||||||
|
{ &mode, 1, "MODE" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
if (mode & 2) {
|
||||||
|
setprg8(0x6000, ((bank & 7) << 2) | 0x23);
|
||||||
|
setprg16(0x8000, (bank << 1) | 0);
|
||||||
|
setprg16(0xC000, (bank << 1) | 1);
|
||||||
|
} else {
|
||||||
|
setprg8(0x6000, ((bank & 4) << 2) | 0x2F);
|
||||||
|
setprg16(0x8000, (bank << 1) | (mode >> 4));
|
||||||
|
setprg16(0xC000, ((bank & 0xC) << 1) | 7);
|
||||||
|
}
|
||||||
|
if (mode == 0x12)
|
||||||
|
setmirror(MI_H);
|
||||||
|
else
|
||||||
|
setmirror(MI_V);
|
||||||
|
setchr8(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M51WriteMode) {
|
||||||
|
mode = V & 0x12;
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M51WriteBank) {
|
||||||
|
bank = V & 0x0F;
|
||||||
|
if (A & 0x4000)
|
||||||
|
mode = (mode & 2) | (V & 0x10);
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M51Power(void) {
|
||||||
|
bank = 0;
|
||||||
|
mode = 2;
|
||||||
|
Sync();
|
||||||
|
SetWriteHandler(0x6000, 0x7FFF, M51WriteMode);
|
||||||
|
SetWriteHandler(0x8000, 0xFFFF, M51WriteBank);
|
||||||
|
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M51Reset(void) {
|
||||||
|
bank = 0;
|
||||||
|
mode = 2;
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper51_Init(CartInfo *info) {
|
||||||
|
info->Power = M51Power;
|
||||||
|
info->Reset = M51Reset;
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
}
|
||||||
84
src/boards/57.c
Normal file
84
src/boards/57.c
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 prg_reg;
|
||||||
|
static uint8 chr_reg;
|
||||||
|
static uint8 hrd_flag;
|
||||||
|
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ &hrd_flag, 1, "DPSW" },
|
||||||
|
{ &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);
|
||||||
|
}
|
||||||
49
src/boards/603-5052.c
Normal file
49
src/boards/603-5052.c
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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");
|
||||||
|
}
|
||||||
69
src/boards/62.c
Normal file
69
src/boards/62.c
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
/* FCE Ultra - NES/Famicom Emulator
|
||||||
|
*
|
||||||
|
* Copyright notice for this file:
|
||||||
|
* Copyright (C) 2012 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 bank;
|
||||||
|
static uint16 mode;
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ &bank, 1, "BANK" },
|
||||||
|
{ &mode, 2, "MODE" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
setchr8(((mode & 0x1F) << 2) | (bank & 0x03));
|
||||||
|
if (mode & 0x20) {
|
||||||
|
setprg16(0x8000, (mode & 0x40) | ((mode >> 8) & 0x3F));
|
||||||
|
setprg16(0xc000, (mode & 0x40) | ((mode >> 8) & 0x3F));
|
||||||
|
} else
|
||||||
|
setprg32(0x8000, ((mode & 0x40) | ((mode >> 8) & 0x3F)) >> 1);
|
||||||
|
setmirror(((mode >> 7) & 1) ^ 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M62Write) {
|
||||||
|
mode = A & 0x3FFF;
|
||||||
|
bank = V & 3;
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M62Power(void) {
|
||||||
|
bank = mode = 0;
|
||||||
|
Sync();
|
||||||
|
SetWriteHandler(0x8000, 0xFFFF, M62Write);
|
||||||
|
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M62Reset(void) {
|
||||||
|
bank = mode = 0;
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper62_Init(CartInfo *info) {
|
||||||
|
info->Power = M62Power;
|
||||||
|
info->Reset = M62Reset;
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
}
|
||||||
104
src/boards/65.c
Normal file
104
src/boards/65.c
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
/* FCE Ultra - NES/Famicom Emulator
|
||||||
|
*
|
||||||
|
* Copyright notice for this file:
|
||||||
|
* Copyright (C) 2012 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 preg[3], creg[8], mirr;
|
||||||
|
static uint8 IRQa;
|
||||||
|
static int16 IRQCount, IRQLatch;
|
||||||
|
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ preg, 3, "PREG" },
|
||||||
|
{ creg, 8, "CREG" },
|
||||||
|
{ &mirr, 1, "MIRR" },
|
||||||
|
{ &IRQa, 1, "IRQA" },
|
||||||
|
{ &IRQCount, 2, "IRQC" },
|
||||||
|
{ &IRQLatch, 2, "IRQL" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
setmirror(mirr);
|
||||||
|
setprg8(0x8000, preg[0]);
|
||||||
|
setprg8(0xA000, preg[1]);
|
||||||
|
setprg8(0xC000, preg[2]);
|
||||||
|
setprg8(0xE000, ~0);
|
||||||
|
setchr1(0x0000, creg[0]);
|
||||||
|
setchr1(0x0400, creg[1]);
|
||||||
|
setchr1(0x0800, creg[2]);
|
||||||
|
setchr1(0x0C00, creg[3]);
|
||||||
|
setchr1(0x1000, creg[4]);
|
||||||
|
setchr1(0x1400, creg[5]);
|
||||||
|
setchr1(0x1800, creg[6]);
|
||||||
|
setchr1(0x1C00, creg[7]);
|
||||||
|
setmirror(mirr);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M65Write) {
|
||||||
|
switch (A) {
|
||||||
|
case 0x8000: preg[0] = V; Sync(); break;
|
||||||
|
case 0xA000: preg[1] = V; Sync(); break;
|
||||||
|
case 0xC000: preg[2] = V; Sync(); break;
|
||||||
|
case 0x9001: mirr = ((V >> 7) & 1) ^ 1; Sync(); break;
|
||||||
|
case 0x9003: IRQa = V & 0x80; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||||
|
case 0x9004: IRQCount = IRQLatch; break;
|
||||||
|
case 0x9005: IRQLatch &= 0x00FF; IRQLatch |= V << 8; break;
|
||||||
|
case 0x9006: IRQLatch &= 0xFF00; IRQLatch |= V; break;
|
||||||
|
case 0xB000: creg[0] = V; Sync(); break;
|
||||||
|
case 0xB001: creg[1] = V; Sync(); break;
|
||||||
|
case 0xB002: creg[2] = V; Sync(); break;
|
||||||
|
case 0xB003: creg[3] = V; Sync(); break;
|
||||||
|
case 0xB004: creg[4] = V; Sync(); break;
|
||||||
|
case 0xB005: creg[5] = V; Sync(); break;
|
||||||
|
case 0xB006: creg[6] = V; Sync(); break;
|
||||||
|
case 0xB007: creg[7] = V; Sync(); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M65Power(void) {
|
||||||
|
preg[2] = ~1;
|
||||||
|
Sync();
|
||||||
|
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||||
|
SetWriteHandler(0x8000, 0xFFFF, M65Write);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FP_FASTAPASS(1) M65IRQ(int a) {
|
||||||
|
if (IRQa) {
|
||||||
|
IRQCount -= a;
|
||||||
|
if (IRQCount < -4) {
|
||||||
|
X6502_IRQBegin(FCEU_IQEXT);
|
||||||
|
IRQa = 0;
|
||||||
|
IRQCount = 0xFFFF;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper65_Init(CartInfo *info) {
|
||||||
|
info->Power = M65Power;
|
||||||
|
MapIRQHook = M65IRQ;
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
105
src/boards/67.c
Normal file
105
src/boards/67.c
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
/* FCE Ultra - NES/Famicom Emulator
|
||||||
|
*
|
||||||
|
* Copyright notice for this file:
|
||||||
|
* Copyright (C) 2012 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 preg, creg[4], mirr, suntoggle = 0;
|
||||||
|
static uint8 IRQa;
|
||||||
|
static int16 IRQCount, IRQLatch;
|
||||||
|
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ &preg, 1, "PREG" },
|
||||||
|
{ &suntoggle, 1, "STOG" },
|
||||||
|
{ creg, 4, "CREG" },
|
||||||
|
{ &mirr, 1, "MIRR" },
|
||||||
|
{ &IRQa, 1, "IRQA" },
|
||||||
|
{ &IRQCount, 2, "IRQC" },
|
||||||
|
{ &IRQLatch, 2, "IRQL" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
setmirror(mirr);
|
||||||
|
setprg16(0x8000, preg);
|
||||||
|
setprg16(0xC000, ~0);
|
||||||
|
setchr2(0x0000, creg[0]);
|
||||||
|
setchr2(0x0800, creg[1]);
|
||||||
|
setchr2(0x1000, creg[2]);
|
||||||
|
setchr2(0x1800, creg[3]);
|
||||||
|
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(M67Write) {
|
||||||
|
switch (A & 0xF800) {
|
||||||
|
case 0x8800: creg[0] = V; Sync(); break;
|
||||||
|
case 0x9800: creg[1] = V; Sync(); break;
|
||||||
|
case 0xA800: creg[2] = V; Sync(); break;
|
||||||
|
case 0xB800: creg[3] = V; Sync(); break;
|
||||||
|
case 0xC000:
|
||||||
|
case 0xC800:
|
||||||
|
IRQCount &= 0xFF << (suntoggle << 3);
|
||||||
|
IRQCount |= V << ((suntoggle ^ 1) << 3);
|
||||||
|
suntoggle ^= 1;
|
||||||
|
break;
|
||||||
|
case 0xD800:
|
||||||
|
suntoggle = 0;
|
||||||
|
IRQa = V & 0x10;
|
||||||
|
X6502_IRQEnd(FCEU_IQEXT);
|
||||||
|
break;
|
||||||
|
case 0xE800: mirr = V & 3; Sync(); break;
|
||||||
|
case 0xF800: preg = V; Sync(); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M67Power(void) {
|
||||||
|
suntoggle = 0;
|
||||||
|
Sync();
|
||||||
|
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||||
|
SetWriteHandler(0x8000, 0xFFFF, M67Write);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FP_FASTAPASS(1) M67IRQ(int a) {
|
||||||
|
if (IRQa) {
|
||||||
|
IRQCount -= a;
|
||||||
|
if (IRQCount <= 0) {
|
||||||
|
X6502_IRQBegin(FCEU_IQEXT);
|
||||||
|
IRQa = 0;
|
||||||
|
IRQCount = 0xFFFF;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper67_Init(CartInfo *info) {
|
||||||
|
info->Power = M67Power;
|
||||||
|
MapIRQHook = M67IRQ;
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
163
src/boards/68.c
Normal file
163
src/boards/68.c
Normal file
@@ -0,0 +1,163 @@
|
|||||||
|
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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, "KGME" },
|
||||||
|
{ &count, 4, "CNT" },
|
||||||
|
{ 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)
|
||||||
|
FCEU_gfree(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);
|
||||||
|
}
|
||||||
277
src/boards/69.c
Normal file
277
src/boards/69.c
Normal file
@@ -0,0 +1,277 @@
|
|||||||
|
/* FCE Ultra - NES/Famicom Emulator
|
||||||
|
*
|
||||||
|
* Copyright notice for this file:
|
||||||
|
* Copyright (C) 2012 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 cmdreg, preg[4], creg[8], mirr;
|
||||||
|
static uint8 IRQa;
|
||||||
|
static int32 IRQCount;
|
||||||
|
static uint8 *WRAM = NULL;
|
||||||
|
static uint32 WRAMSIZE;
|
||||||
|
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ &cmdreg, 1, "CMDR" },
|
||||||
|
{ preg, 4, "PREG" },
|
||||||
|
{ creg, 8, "CREG" },
|
||||||
|
{ &mirr, 1, "MIRR" },
|
||||||
|
{ &IRQa, 1, "IRQA" },
|
||||||
|
{ &IRQCount, 4, "IRQC" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
uint8 i;
|
||||||
|
if ((preg[3] & 0xC0) == 0xC0)
|
||||||
|
setprg8r(0x10, 0x6000, 0);
|
||||||
|
else
|
||||||
|
setprg8(0x6000, preg[3] & 0x3F);
|
||||||
|
setprg8(0x8000, preg[0]);
|
||||||
|
setprg8(0xA000, preg[1]);
|
||||||
|
setprg8(0xC000, preg[2]);
|
||||||
|
setprg8(0xE000, ~0);
|
||||||
|
for (i = 0; i < 8; i++)
|
||||||
|
setchr1(i << 10, creg[i]);
|
||||||
|
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 DECLFW(M69WRAMWrite) {
|
||||||
|
if ((preg[3] & 0xC0) == 0xC0)
|
||||||
|
CartBW(A, V);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFR(M69WRAMRead) {
|
||||||
|
if ((preg[3] & 0xC0) == 0x40)
|
||||||
|
return X.DB;
|
||||||
|
else
|
||||||
|
return CartBR(A);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M69Write0) {
|
||||||
|
cmdreg = V & 0xF;
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M69Write1) {
|
||||||
|
switch (cmdreg) {
|
||||||
|
case 0x0: creg[0] = V; Sync(); break;
|
||||||
|
case 0x1: creg[1] = V; Sync(); break;
|
||||||
|
case 0x2: creg[2] = V; Sync(); break;
|
||||||
|
case 0x3: creg[3] = V; Sync(); break;
|
||||||
|
case 0x4: creg[4] = V; Sync(); break;
|
||||||
|
case 0x5: creg[5] = V; Sync(); break;
|
||||||
|
case 0x6: creg[6] = V; Sync(); break;
|
||||||
|
case 0x7: creg[7] = V; Sync(); break;
|
||||||
|
case 0x8: preg[3] = V; Sync(); break;
|
||||||
|
case 0x9: preg[0] = V; Sync(); break;
|
||||||
|
case 0xA: preg[1] = V; Sync(); break;
|
||||||
|
case 0xB: preg[2] = V; Sync(); break;
|
||||||
|
case 0xC: mirr = V & 3; Sync();break;
|
||||||
|
case 0xD: IRQa = V; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||||
|
case 0xE: IRQCount &= 0xFF00; IRQCount |= V; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||||
|
case 0xF: IRQCount &= 0x00FF; IRQCount |= V << 8; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// SUNSOFT-5/FME-7 Sound
|
||||||
|
|
||||||
|
static void AYSound(int Count);
|
||||||
|
static void AYSoundHQ(void);
|
||||||
|
static void DoAYSQ(int x);
|
||||||
|
static void DoAYSQHQ(int x);
|
||||||
|
|
||||||
|
static uint8 sndcmd, sreg[14];
|
||||||
|
static int32 vcount[3];
|
||||||
|
static int32 dcount[3];
|
||||||
|
static int CAYBC[3];
|
||||||
|
|
||||||
|
static SFORMAT SStateRegs[] =
|
||||||
|
{
|
||||||
|
{ &sndcmd, 1, "SCMD" },
|
||||||
|
{ sreg, 14, "SREG" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static DECLFW(M69SWrite0) {
|
||||||
|
sndcmd = V % 14;
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M69SWrite1) {
|
||||||
|
int x;
|
||||||
|
GameExpSound.Fill = AYSound;
|
||||||
|
GameExpSound.HiFill = AYSoundHQ;
|
||||||
|
if (FSettings.SndRate)
|
||||||
|
switch (sndcmd) {
|
||||||
|
case 0:
|
||||||
|
case 1:
|
||||||
|
case 8: if (FSettings.soundq >= 1) DoAYSQHQ(0); else DoAYSQ(0); break;
|
||||||
|
case 2:
|
||||||
|
case 3:
|
||||||
|
case 9: if (FSettings.soundq >= 1) DoAYSQHQ(1); else DoAYSQ(1); break;
|
||||||
|
case 4:
|
||||||
|
case 5:
|
||||||
|
case 10: if (FSettings.soundq >= 1) DoAYSQHQ(2); else DoAYSQ(2); break;
|
||||||
|
case 7:
|
||||||
|
for (x = 0; x < 2; x++)
|
||||||
|
if (FSettings.soundq >= 1) DoAYSQHQ(x); else DoAYSQ(x);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
sreg[sndcmd] = V;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void DoAYSQ(int x) {
|
||||||
|
int32 freq = ((sreg[x << 1] | ((sreg[(x << 1) + 1] & 15) << 8)) + 1) << (4 + 17);
|
||||||
|
int32 amp = (sreg[0x8 + x] & 15) << 2;
|
||||||
|
int32 start, end;
|
||||||
|
int V;
|
||||||
|
|
||||||
|
amp += amp >> 1;
|
||||||
|
|
||||||
|
start = CAYBC[x];
|
||||||
|
end = (SOUNDTS << 16) / soundtsinc;
|
||||||
|
if (end <= start) return;
|
||||||
|
CAYBC[x] = end;
|
||||||
|
|
||||||
|
if (amp && !(sreg[0x7] & (1 << x)))
|
||||||
|
for (V = start; V < end; V++) {
|
||||||
|
if (dcount[x])
|
||||||
|
Wave[V >> 4] += amp;
|
||||||
|
vcount[x] -= nesincsize;
|
||||||
|
while (vcount[x] <= 0) {
|
||||||
|
dcount[x] ^= 1;
|
||||||
|
vcount[x] += freq;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void DoAYSQHQ(int x) {
|
||||||
|
int32 V;
|
||||||
|
int32 freq = ((sreg[x << 1] | ((sreg[(x << 1) + 1] & 15) << 8)) + 1) << 4;
|
||||||
|
int32 amp = (sreg[0x8 + x] & 15) << 6;
|
||||||
|
|
||||||
|
amp += amp >> 1;
|
||||||
|
|
||||||
|
if (!(sreg[0x7] & (1 << x))) {
|
||||||
|
for (V = CAYBC[x]; V < SOUNDTS; V++) {
|
||||||
|
if (dcount[x])
|
||||||
|
WaveHi[V] += amp;
|
||||||
|
vcount[x]--;
|
||||||
|
if (vcount[x] <= 0) {
|
||||||
|
dcount[x] ^= 1;
|
||||||
|
vcount[x] = freq;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CAYBC[x] = SOUNDTS;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void AYSound(int Count) {
|
||||||
|
int x;
|
||||||
|
DoAYSQ(0);
|
||||||
|
DoAYSQ(1);
|
||||||
|
DoAYSQ(2);
|
||||||
|
for (x = 0; x < 3; x++)
|
||||||
|
CAYBC[x] = Count;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void AYSoundHQ(void) {
|
||||||
|
DoAYSQHQ(0);
|
||||||
|
DoAYSQHQ(1);
|
||||||
|
DoAYSQHQ(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void AYHiSync(int32 ts) {
|
||||||
|
int x;
|
||||||
|
|
||||||
|
for (x = 0; x < 3; x++)
|
||||||
|
CAYBC[x] = ts;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper69_ESI(void) {
|
||||||
|
GameExpSound.RChange = Mapper69_ESI;
|
||||||
|
GameExpSound.HiSync = AYHiSync;
|
||||||
|
memset(dcount, 0, sizeof(dcount));
|
||||||
|
memset(vcount, 0, sizeof(vcount));
|
||||||
|
memset(CAYBC, 0, sizeof(CAYBC));
|
||||||
|
AddExState(&SStateRegs, ~0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// SUNSOFT-5/FME-7 Sound
|
||||||
|
|
||||||
|
static void M69Power(void) {
|
||||||
|
cmdreg = sndcmd = 0;
|
||||||
|
IRQCount = 0xFFFF;
|
||||||
|
IRQa = 0;
|
||||||
|
Sync();
|
||||||
|
SetReadHandler(0x6000, 0x7FFF, M69WRAMRead);
|
||||||
|
SetWriteHandler(0x6000, 0x7FFF, M69WRAMWrite);
|
||||||
|
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||||
|
SetWriteHandler(0x8000, 0x9FFF, M69Write0);
|
||||||
|
SetWriteHandler(0xA000, 0xBFFF, M69Write1);
|
||||||
|
SetWriteHandler(0xC000, 0xDFFF, M69SWrite0);
|
||||||
|
SetWriteHandler(0xE000, 0xFFFF, M69SWrite1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M69Close(void) {
|
||||||
|
if (WRAM)
|
||||||
|
FCEU_gfree(WRAM);
|
||||||
|
WRAM = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M69IRQHook(int a) {
|
||||||
|
if (IRQa) {
|
||||||
|
IRQCount -= a;
|
||||||
|
if (IRQCount <= 0) {
|
||||||
|
X6502_IRQBegin(FCEU_IQEXT); IRQa = 0; IRQCount = 0xFFFF;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper69_Init(CartInfo *info) {
|
||||||
|
info->Power = M69Power;
|
||||||
|
info->Close = M69Close;
|
||||||
|
MapIRQHook = M69IRQHook;
|
||||||
|
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;
|
||||||
|
Mapper69_ESI();
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void NSFAY_Init(void) {
|
||||||
|
sndcmd = 0;
|
||||||
|
SetWriteHandler(0xC000, 0xDFFF, M69SWrite0);
|
||||||
|
SetWriteHandler(0xE000, 0xFFFF, M69SWrite1);
|
||||||
|
Mapper69_ESI();
|
||||||
|
}
|
||||||
64
src/boards/71.c
Normal file
64
src/boards/71.c
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
/* FCE Ultra - NES/Famicom Emulator
|
||||||
|
*
|
||||||
|
* Copyright notice for this file:
|
||||||
|
* Copyright (C) 2012 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 preg, mirr;
|
||||||
|
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ &preg, 1, "PREG" },
|
||||||
|
{ &mirr, 1, "MIRR" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
setprg16(0x8000, preg);
|
||||||
|
setprg16(0xC000, ~0);
|
||||||
|
setchr8(0);
|
||||||
|
if (mirr)
|
||||||
|
setmirror(mirr);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M71Write) {
|
||||||
|
if ((A & 0xF000) == 0x9000)
|
||||||
|
mirr = MI_0 + ((V >> 4) & 1); // 2-in-1, some carts are normal hardwire V/H mirror, some uses mapper selectable 0/1 mirror
|
||||||
|
else
|
||||||
|
preg = V;
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M71Power(void) {
|
||||||
|
mirr = 0;
|
||||||
|
Sync();
|
||||||
|
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||||
|
SetWriteHandler(0x8000, 0xFFFF, M71Write);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper71_Init(CartInfo *info) {
|
||||||
|
info->Power = M71Power;
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
|
}
|
||||||
64
src/boards/72.c
Normal file
64
src/boards/72.c
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
/* FCE Ultra - NES/Famicom Emulator
|
||||||
|
*
|
||||||
|
* Copyright notice for this file:
|
||||||
|
* Copyright (C) 2012 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* Moero!! Pro Tennis have ADPCM codec on-board, PROM isn't dumped, emulation isn't
|
||||||
|
* possible just now.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 preg, creg;
|
||||||
|
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ &preg, 1, "PREG" },
|
||||||
|
{ &creg, 1, "CREG" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
setprg16(0x8000, preg);
|
||||||
|
setprg16(0xC000, ~0);
|
||||||
|
setchr8(creg);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M72Write) {
|
||||||
|
if (V & 0x80)
|
||||||
|
preg = V & 0xF;
|
||||||
|
if (V & 0x40)
|
||||||
|
creg = V & 0xF;
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M72Power(void) {
|
||||||
|
Sync();
|
||||||
|
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||||
|
SetWriteHandler(0x6000, 0xFFFF, M72Write);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper72_Init(CartInfo *info) {
|
||||||
|
info->Power = M72Power;
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
|
}
|
||||||
74
src/boards/77.c
Normal file
74
src/boards/77.c
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
/* FCE Ultra - NES/Famicom Emulator
|
||||||
|
*
|
||||||
|
* Copyright notice for this file:
|
||||||
|
* Copyright (C) 2012 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 latche;
|
||||||
|
|
||||||
|
static uint8 *CHRRAM = NULL;
|
||||||
|
static uint32 CHRRAMSIZE;
|
||||||
|
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ &latche, 1, "LATC" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
setprg32(0x8000, latche & 7);
|
||||||
|
setchr2(0x0000, latche >> 4);
|
||||||
|
setchr2r(0x10, 0x0800, 2);
|
||||||
|
setchr4r(0x10, 0x1000, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M77Write) {
|
||||||
|
latche = V;
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M77Power(void) {
|
||||||
|
latche = 0;
|
||||||
|
Sync();
|
||||||
|
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||||
|
SetWriteHandler(0x8000, 0xFFFF, M77Write);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M77Close(void) {
|
||||||
|
if (CHRRAM)
|
||||||
|
FCEU_gfree(CHRRAM);
|
||||||
|
CHRRAM = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper77_Init(CartInfo *info) {
|
||||||
|
info->Power = M77Power;
|
||||||
|
info->Close = M77Close;
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
|
||||||
|
CHRRAMSIZE = 6 * 1024;
|
||||||
|
CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSIZE);
|
||||||
|
SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1);
|
||||||
|
AddExState(CHRRAM, CHRRAMSIZE, 0, "CRAM");
|
||||||
|
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
|
}
|
||||||
60
src/boards/79.c
Normal file
60
src/boards/79.c
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
/* FCE Ultra - NES/Famicom Emulator
|
||||||
|
*
|
||||||
|
* Copyright notice for this file:
|
||||||
|
* Copyright (C) 2012 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 creg, preg;
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ &creg, 1, "CREG" },
|
||||||
|
{ &preg, 1, "PREG" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
setprg32(0x8000, preg);
|
||||||
|
setchr8(creg);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M79Write) {
|
||||||
|
if ((A < 0x8000) && ((A ^ 0x4100) == 0)) {
|
||||||
|
preg = (V >> 3) & 1;
|
||||||
|
}
|
||||||
|
creg = V & 7;
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M79Power(void) {
|
||||||
|
preg = ~0;
|
||||||
|
Sync();
|
||||||
|
SetWriteHandler(0x4100, 0x5FFF, M79Write);
|
||||||
|
SetWriteHandler(0x8000, 0xFFFF, M79Write);
|
||||||
|
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper79_Init(CartInfo *info) {
|
||||||
|
info->Power = M79Power;
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
}
|
||||||
192
src/boards/80.c
Normal file
192
src/boards/80.c
Normal file
@@ -0,0 +1,192 @@
|
|||||||
|
/* FCE Ultra - NES/Famicom Emulator
|
||||||
|
*
|
||||||
|
* Copyright notice for this file:
|
||||||
|
* Copyright (C) 2012 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 preg[3], creg[6], isExMirr;
|
||||||
|
static uint8 mirr, cmd, wram_enable, wram[256];
|
||||||
|
static uint8 mcache[8];
|
||||||
|
static uint32 lastppu;
|
||||||
|
|
||||||
|
static SFORMAT StateRegs80[] =
|
||||||
|
{
|
||||||
|
{ preg, 3, "PREG" },
|
||||||
|
{ creg, 6, "CREG" },
|
||||||
|
{ wram, 256, "WRAM" },
|
||||||
|
{ &mirr, 1, "MIRR" },
|
||||||
|
{ &wram_enable, 1, "WRME" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static SFORMAT StateRegs95[] =
|
||||||
|
{
|
||||||
|
{ &cmd, 1, "CMDR" },
|
||||||
|
{ preg, 3, "PREG" },
|
||||||
|
{ creg, 6, "CREG" },
|
||||||
|
{ mcache, 8, "MCCH" },
|
||||||
|
{ &lastppu, 4, "LPPU" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static SFORMAT StateRegs207[] =
|
||||||
|
{
|
||||||
|
{ preg, 3, "PREG" },
|
||||||
|
{ creg, 6, "CREG" },
|
||||||
|
{ mcache, 8, "MCCH" },
|
||||||
|
{ &lastppu, 4, "LPPU" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
setprg8(0x8000, preg[0]);
|
||||||
|
setprg8(0xA000, preg[1]);
|
||||||
|
setprg8(0xC000, preg[2]);
|
||||||
|
setprg8(0xE000, ~0);
|
||||||
|
setchr2(0x0000, (creg[0] >> 1) & 0x3F);
|
||||||
|
setchr2(0x0800, (creg[1] >> 1) & 0x3F);
|
||||||
|
setchr1(0x1000, creg[2]);
|
||||||
|
setchr1(0x1400, creg[3]);
|
||||||
|
setchr1(0x1800, creg[4]);
|
||||||
|
setchr1(0x1C00, creg[5]);
|
||||||
|
if (isExMirr) {
|
||||||
|
setmirror(MI_0 + mcache[lastppu]);
|
||||||
|
} else
|
||||||
|
setmirror(mirr);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M80RamWrite) {
|
||||||
|
if (wram_enable == 0xA3)
|
||||||
|
wram[A & 0xFF] = V;
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFR(M80RamRead) {
|
||||||
|
if (wram_enable == 0xA3)
|
||||||
|
return wram[A & 0xFF];
|
||||||
|
else
|
||||||
|
return 0xFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M80Write) {
|
||||||
|
switch (A) {
|
||||||
|
case 0x7EF0: creg[0] = V; mcache[0] = mcache[1] = V >> 7; Sync(); break;
|
||||||
|
case 0x7EF1: creg[1] = V; mcache[2] = mcache[3] = V >> 7; Sync(); break;
|
||||||
|
case 0x7EF2: creg[2] = V; mcache[4] = V >> 7; Sync(); break;
|
||||||
|
case 0x7EF3: creg[3] = V; mcache[5] = V >> 7; Sync(); break;
|
||||||
|
case 0x7EF4: creg[4] = V; mcache[6] = V >> 7; Sync(); break;
|
||||||
|
case 0x7EF5: creg[5] = V; mcache[7] = V >> 7; Sync(); break;
|
||||||
|
case 0x7EF6: mirr = V & 1; Sync(); break;
|
||||||
|
case 0x7EF8: wram_enable = V; break;
|
||||||
|
case 0x7EFA:
|
||||||
|
case 0x7EFB: preg[0] = V; Sync(); break;
|
||||||
|
case 0x7EFC:
|
||||||
|
case 0x7EFD: preg[1] = V; Sync(); break;
|
||||||
|
case 0x7EFE:
|
||||||
|
case 0x7EFF: preg[2] = V; Sync(); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M95Write) {
|
||||||
|
switch (A & 0xF001) {
|
||||||
|
case 0x8000: cmd = V; break;
|
||||||
|
case 0x8001:
|
||||||
|
switch (cmd & 0x07) {
|
||||||
|
case 0: creg[0] = V & 0x1F; mcache[0] = mcache[1] = (V >> 5) & 1; Sync(); break;
|
||||||
|
case 1: creg[1] = V & 0x1F; mcache[2] = mcache[3] = (V >> 5) & 1; Sync(); break;
|
||||||
|
case 2: creg[2] = V & 0x1F; mcache[4] = (V >> 5) & 1; Sync(); break;
|
||||||
|
case 3: creg[3] = V & 0x1F; mcache[5] = (V >> 5) & 1; Sync(); break;
|
||||||
|
case 4: creg[4] = V & 0x1F; mcache[6] = (V >> 5) & 1; Sync(); break;
|
||||||
|
case 5: creg[5] = V & 0x1F; mcache[7] = (V >> 5) & 1; Sync(); break;
|
||||||
|
case 6: preg[0] = V; Sync(); break;
|
||||||
|
case 7: preg[1] = V; Sync(); break;
|
||||||
|
}
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void FP_FASTAPASS(1) MExMirrPPU(uint32 A) {
|
||||||
|
static int8 lastmirr = -1, curmirr;
|
||||||
|
if (A < 0x2000) {
|
||||||
|
lastppu = A >> 10;
|
||||||
|
curmirr = mcache[lastppu];
|
||||||
|
if (curmirr != lastmirr) {
|
||||||
|
setmirror(MI_0 + curmirr);
|
||||||
|
lastmirr = curmirr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M80Power(void) {
|
||||||
|
wram_enable = 0xFF;
|
||||||
|
Sync();
|
||||||
|
SetReadHandler(0x7F00, 0x7FFF, M80RamRead);
|
||||||
|
SetWriteHandler(0x7F00, 0x7FFF, M80RamWrite);
|
||||||
|
SetWriteHandler(0x7EF0, 0x7EFF, M80Write);
|
||||||
|
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M207Power(void) {
|
||||||
|
mcache[0] = mcache[1] = mcache[2] = mcache[3] = 0;
|
||||||
|
mcache[4] = mcache[5] = mcache[6] = mcache[7] = 0;
|
||||||
|
Sync();
|
||||||
|
SetWriteHandler(0x7EF0, 0x7EFF, M80Write);
|
||||||
|
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M95Power(void) {
|
||||||
|
preg[2] = ~1;
|
||||||
|
mcache[0] = mcache[1] = mcache[2] = mcache[3] = 0;
|
||||||
|
mcache[4] = mcache[5] = mcache[6] = mcache[7] = 0;
|
||||||
|
Sync();
|
||||||
|
SetWriteHandler(0x8000, 0xFFFF, M95Write);
|
||||||
|
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper80_Init(CartInfo *info) {
|
||||||
|
isExMirr = 0;
|
||||||
|
info->Power = M80Power;
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
|
||||||
|
if (info->battery) {
|
||||||
|
info->SaveGame[0] = wram;
|
||||||
|
info->SaveGameLen[0] = 256;
|
||||||
|
}
|
||||||
|
|
||||||
|
AddExState(&StateRegs80, ~0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper95_Init(CartInfo *info) {
|
||||||
|
isExMirr = 1;
|
||||||
|
info->Power = M95Power;
|
||||||
|
PPU_hook = MExMirrPPU;
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
AddExState(&StateRegs95, ~0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper207_Init(CartInfo *info) {
|
||||||
|
isExMirr = 1;
|
||||||
|
info->Power = M207Power;
|
||||||
|
PPU_hook = MExMirrPPU;
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
AddExState(&StateRegs207, ~0, 0, 0);
|
||||||
|
}
|
||||||
85
src/boards/8157.c
Normal file
85
src/boards/8157.c
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* GG1 boards, similar to T-262, with no Data latch
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint16 cmdreg;
|
||||||
|
static uint8 reset;
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ &reset, 1, "REST" },
|
||||||
|
{ &cmdreg, 2, "CREG" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
uint32 base = ((cmdreg & 0x060) | ((cmdreg & 0x100) >> 1)) >> 2;
|
||||||
|
uint32 bank = (cmdreg & 0x01C) >> 2;
|
||||||
|
uint32 lbank = (cmdreg & 0x200) ? 7 : ((cmdreg & 0x80) ? bank : 0);
|
||||||
|
if (PRGptr[1]) {
|
||||||
|
setprg16r(base >> 3, 0x8000, bank); // for versions with split ROMs
|
||||||
|
setprg16r(base >> 3, 0xC000, lbank);
|
||||||
|
} else {
|
||||||
|
setprg16(0x8000, base | bank);
|
||||||
|
setprg16(0xC000, base | lbank);
|
||||||
|
}
|
||||||
|
setmirror(((cmdreg & 2) >> 1) ^ 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFR(UNL8157Read) {
|
||||||
|
if ((cmdreg & 0x100) && (PRGsize[0] < (1024 * 1024))) {
|
||||||
|
A = (A & 0xFFF0) + reset;
|
||||||
|
}
|
||||||
|
return CartBR(A);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(UNL8157Write) {
|
||||||
|
cmdreg = A;
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void UNL8157Power(void) {
|
||||||
|
setchr8(0);
|
||||||
|
SetWriteHandler(0x8000, 0xFFFF, UNL8157Write);
|
||||||
|
SetReadHandler(0x8000, 0xFFFF, UNL8157Read);
|
||||||
|
cmdreg = reset = 0;
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void UNL8157Reset(void) {
|
||||||
|
cmdreg = reset = 0;
|
||||||
|
reset++;
|
||||||
|
reset &= 0x1F;
|
||||||
|
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);
|
||||||
|
}
|
||||||
97
src/boards/82.c
Normal file
97
src/boards/82.c
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
/* FCE Ultra - NES/Famicom Emulator
|
||||||
|
*
|
||||||
|
* Copyright notice for this file:
|
||||||
|
* Copyright (C) 2012 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* Taito X1-017 board, battery backed
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 regs[9], ctrl;
|
||||||
|
static uint8 *WRAM = NULL;
|
||||||
|
static uint32 WRAMSIZE;
|
||||||
|
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ regs, 9, "REGS" },
|
||||||
|
{ &ctrl, 1, "CTRL" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
uint32 swap = ((ctrl & 2) << 11);
|
||||||
|
setchr2(0x0000 ^ swap, regs[0] >> 1);
|
||||||
|
setchr2(0x0800 ^ swap, regs[1] >> 1);
|
||||||
|
setchr1(0x1000 ^ swap, regs[2]);
|
||||||
|
setchr1(0x1400 ^ swap, regs[3]);
|
||||||
|
setchr1(0x1800 ^ swap, regs[4]);
|
||||||
|
setchr1(0x1c00 ^ swap, regs[5]);
|
||||||
|
setprg8r(0x10, 0x6000, 0);
|
||||||
|
setprg8(0x8000, regs[6]);
|
||||||
|
setprg8(0xA000, regs[7]);
|
||||||
|
setprg8(0xC000, regs[8]);
|
||||||
|
setprg8(0xE000, ~0);
|
||||||
|
setmirror(ctrl & 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M82Write) {
|
||||||
|
if (A <= 0x7ef5)
|
||||||
|
regs[A & 7] = V;
|
||||||
|
else
|
||||||
|
switch (A) {
|
||||||
|
case 0x7ef6: ctrl = V & 3; break;
|
||||||
|
case 0x7efa: regs[6] = V >> 2; break;
|
||||||
|
case 0x7efb: regs[7] = V >> 2; break;
|
||||||
|
case 0x7efc: regs[8] = V >> 2; break;
|
||||||
|
}
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M82Power(void) {
|
||||||
|
Sync();
|
||||||
|
SetReadHandler(0x6000, 0xffff, CartBR);
|
||||||
|
SetWriteHandler(0x6000, 0x7fff, CartBW);
|
||||||
|
SetWriteHandler(0x7ef0, 0x7efc, M82Write); // external WRAM might end at $73FF
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M82Close(void) {
|
||||||
|
if (WRAM)
|
||||||
|
FCEU_gfree(WRAM);
|
||||||
|
WRAM = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper82_Init(CartInfo *info) {
|
||||||
|
info->Power = M82Power;
|
||||||
|
info->Close = M82Close;
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
173
src/boards/8237.c
Normal file
173
src/boards/8237.c
Normal file
@@ -0,0 +1,173 @@
|
|||||||
|
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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, "CMDI");
|
||||||
|
}
|
||||||
|
|
||||||
|
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, "CMDI");
|
||||||
|
}
|
||||||
68
src/boards/830118C.c
Normal file
68
src/boards/830118C.c
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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");
|
||||||
|
}
|
||||||
83
src/boards/88.c
Normal file
83
src/boards/88.c
Normal file
@@ -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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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]);
|
||||||
|
setprg8(0xC000, ~1);
|
||||||
|
setprg8(0xE000, ~0);
|
||||||
|
}
|
||||||
|
|
||||||
|
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) {
|
||||||
|
reg[0] = reg[1] = reg[2] = reg[3] = reg[4] = reg[5] = reg[6] = reg[7] = 0;
|
||||||
|
Sync();
|
||||||
|
MSync();
|
||||||
|
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);
|
||||||
|
}
|
||||||
474
src/boards/90.c
Normal file
474
src/boards/90.c
Normal file
@@ -0,0 +1,474 @@
|
|||||||
|
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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, "IRQM" },
|
||||||
|
{ &IRQPre, 1, "IRQP" },
|
||||||
|
{ &IRQPreSize, 1, "IRQR" },
|
||||||
|
{ &IRQCount, 1, "IRQC" },
|
||||||
|
{ &IRQXOR, 1, "IRQX" },
|
||||||
|
{ &IRQa, 1, "IRQA" },
|
||||||
|
{ mul, 2, "MUL" },
|
||||||
|
{ ®ie, 1, "REGI" },
|
||||||
|
{ tkcom, 4, "TKCO" },
|
||||||
|
{ prgb, 4, "PRGB" },
|
||||||
|
{ chr, 2, "CLTC" },
|
||||||
|
{ 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 FP_FASTAPASS(1) CPUWrap(int a) {
|
||||||
|
int x;
|
||||||
|
if ((IRQMode & 3) == 0) for (x = 0; x < a; x++) ClockCounter();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void SLWrap(void) {
|
||||||
|
int x;
|
||||||
|
if ((IRQMode & 3) == 1) for (x = 0; x < 8; x++) ClockCounter();
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint32 lastread;
|
||||||
|
static void FP_FASTAPASS(1) M90PPU(uint32 A) {
|
||||||
|
if ((IRQMode & 3) == 2) {
|
||||||
|
if (lastread != A) {
|
||||||
|
ClockCounter();
|
||||||
|
ClockCounter();
|
||||||
|
}
|
||||||
|
lastread = A;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is209) {
|
||||||
|
uint8 l, h;
|
||||||
|
h = A >> 8;
|
||||||
|
if (h < 0x20 && ((h & 0x0F) == 0xF)) {
|
||||||
|
l = A & 0xF0;
|
||||||
|
if (l == 0xD0) {
|
||||||
|
chr[(h & 0x10) >> 4] = ((h & 0x10) >> 2);
|
||||||
|
tekvrom();
|
||||||
|
} else if (l == 0xE0) {
|
||||||
|
chr[(h & 0x10) >> 4] = ((h & 0x10) >> 2) | 2;
|
||||||
|
tekvrom();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
chr[0] = 0;
|
||||||
|
chr[1] = 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void togglie() {
|
||||||
|
tekker += 0x40;
|
||||||
|
tekker &= 0xC0;
|
||||||
|
FCEU_printf("tekker=%02x\n", tekker);
|
||||||
|
memset(tkcom, 0x00, sizeof(tkcom));
|
||||||
|
memset(prgb, 0xff, sizeof(prgb));
|
||||||
|
tekprom();
|
||||||
|
tekvrom();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M90Restore(int version) {
|
||||||
|
tekprom();
|
||||||
|
tekvrom();
|
||||||
|
mira();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M90Power(void) {
|
||||||
|
SetWriteHandler(0x5000, 0x5fff, M90TekWrite);
|
||||||
|
SetWriteHandler(0x8000, 0x8ff0, M90PRGWrite);
|
||||||
|
SetWriteHandler(0x9000, 0x9fff, M90CHRlowWrite);
|
||||||
|
SetWriteHandler(0xA000, 0xAfff, M90CHRhiWrite);
|
||||||
|
SetWriteHandler(0xB000, 0xBfff, M90NTWrite);
|
||||||
|
SetWriteHandler(0xC000, 0xCfff, M90IRQWrite);
|
||||||
|
SetWriteHandler(0xD000, 0xD5ff, M90ModeWrite);
|
||||||
|
SetWriteHandler(0xE000, 0xFfff, M90DummyWrite);
|
||||||
|
|
||||||
|
SetReadHandler(0x5000, 0x5fff, M90TekRead);
|
||||||
|
SetReadHandler(0x6000, 0xffff, CartBR);
|
||||||
|
|
||||||
|
mul[0] = mul[1] = regie = 0xFF;
|
||||||
|
|
||||||
|
memset(tkcom, 0x00, sizeof(tkcom));
|
||||||
|
memset(prgb, 0xff, sizeof(prgb));
|
||||||
|
memset(chrlow, 0xff, sizeof(chrlow));
|
||||||
|
memset(chrhigh, 0xff, sizeof(chrhigh));
|
||||||
|
memset(names, 0x00, sizeof(names));
|
||||||
|
|
||||||
|
if (is211)
|
||||||
|
tekker = 0xC0;
|
||||||
|
else
|
||||||
|
tekker = 0x00;
|
||||||
|
|
||||||
|
tekprom();
|
||||||
|
tekvrom();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Mapper90_Init(CartInfo *info) {
|
||||||
|
is211 = 0;
|
||||||
|
is209 = 0;
|
||||||
|
info->Reset = togglie;
|
||||||
|
info->Power = M90Power;
|
||||||
|
PPU_hook = M90PPU;
|
||||||
|
MapIRQHook = CPUWrap;
|
||||||
|
GameHBIRQHook2 = SLWrap;
|
||||||
|
GameStateRestore = M90Restore;
|
||||||
|
AddExState(Tek_StateRegs, ~0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper209_Init(CartInfo *info) {
|
||||||
|
is211 = 0;
|
||||||
|
is209 = 1;
|
||||||
|
info->Reset = togglie;
|
||||||
|
info->Power = M90Power;
|
||||||
|
PPU_hook = M90PPU;
|
||||||
|
MapIRQHook = CPUWrap;
|
||||||
|
GameHBIRQHook2 = SLWrap;
|
||||||
|
GameStateRestore = M90Restore;
|
||||||
|
AddExState(Tek_StateRegs, ~0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper211_Init(CartInfo *info) {
|
||||||
|
is211 = 1;
|
||||||
|
info->Reset = togglie;
|
||||||
|
info->Power = M90Power;
|
||||||
|
PPU_hook = M90PPU;
|
||||||
|
MapIRQHook = CPUWrap;
|
||||||
|
GameHBIRQHook2 = SLWrap;
|
||||||
|
GameStateRestore = M90Restore;
|
||||||
|
AddExState(Tek_StateRegs, ~0, 0, 0);
|
||||||
|
}
|
||||||
85
src/boards/91.c
Normal file
85
src/boards/91.c
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
/* FCE Ultra - NES/Famicom Emulator
|
||||||
|
*
|
||||||
|
* Copyright notice for this file:
|
||||||
|
* Copyright (C) 2012 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 cregs[4], pregs[2];
|
||||||
|
static uint8 IRQCount, IRQa;
|
||||||
|
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ cregs, 4, "CREG" },
|
||||||
|
{ pregs, 2, "PREG" },
|
||||||
|
{ &IRQa, 1, "IRQA" },
|
||||||
|
{ &IRQCount, 1, "IRQC" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
setprg8(0x8000, pregs[0]);
|
||||||
|
setprg8(0xa000, pregs[1]);
|
||||||
|
setprg8(0xc000, ~1);
|
||||||
|
setprg8(0xe000, ~0);
|
||||||
|
setchr2(0x0000, cregs[0]);
|
||||||
|
setchr2(0x0800, cregs[1]);
|
||||||
|
setchr2(0x1000, cregs[2]);
|
||||||
|
setchr2(0x1800, cregs[3]);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M91Write0) {
|
||||||
|
cregs[A & 3] = V;
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M91Write1) {
|
||||||
|
switch (A & 3) {
|
||||||
|
case 0:
|
||||||
|
case 1: pregs[A & 1] = V; Sync(); break;
|
||||||
|
case 2: IRQa = IRQCount = 0; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||||
|
case 3: IRQa = 1; X6502_IRQEnd(FCEU_IQEXT); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M91Power(void) {
|
||||||
|
Sync();
|
||||||
|
SetWriteHandler(0x6000, 0x6fff, M91Write0);
|
||||||
|
SetWriteHandler(0x7000, 0x7fff, M91Write1);
|
||||||
|
SetReadHandler(0x8000, 0xffff, CartBR);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M91IRQHook(void) {
|
||||||
|
if (IRQCount < 8 && IRQa) {
|
||||||
|
IRQCount++;
|
||||||
|
if (IRQCount >= 8) {
|
||||||
|
X6502_IRQBegin(FCEU_IQEXT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper91_Init(CartInfo *info) {
|
||||||
|
info->Power = M91Power;
|
||||||
|
GameHBIRQHook = M91IRQHook;
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
|
}
|
||||||
77
src/boards/96.c
Normal file
77
src/boards/96.c
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
/* FCE Ultra - NES/Famicom Emulator
|
||||||
|
*
|
||||||
|
* Copyright notice for this file:
|
||||||
|
* Copyright (C) 1998 BERO
|
||||||
|
* Copyright (C) 2002 Xodnizel
|
||||||
|
* Copyright (C) 2012 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* Oeka-kids board
|
||||||
|
*
|
||||||
|
* I might want to add some code to the mapper 96 PPU hook function
|
||||||
|
* to not change CHR banks if the attribute table is being accessed,
|
||||||
|
* if I make emulation a little more accurate in the future.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 reg, ppulatch;
|
||||||
|
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ ®, 1, "REG" },
|
||||||
|
{ &ppulatch, 1, "PPUL" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
setmirror(MI_0);
|
||||||
|
setprg32(0x8000, reg & 3);
|
||||||
|
setchr4(0x0000, (reg & 4) | ppulatch);
|
||||||
|
setchr4(0x1000, (reg & 4) | 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M96Write) {
|
||||||
|
reg = V;
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void FP_FASTAPASS(1) M96Hook(uint32 A) {
|
||||||
|
if ((A & 0x3000) == 0x2000) {
|
||||||
|
ppulatch = (A >> 8) & 3;
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M96Power(void) {
|
||||||
|
reg = ppulatch = 0;
|
||||||
|
Sync();
|
||||||
|
SetReadHandler(0x8000, 0xffff, CartBR);
|
||||||
|
SetWriteHandler(0x8000, 0xffff, M96Write);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper96_Init(CartInfo *info) {
|
||||||
|
info->Power = M96Power;
|
||||||
|
PPU_hook = M96Hook;
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
77
src/boards/99.c
Normal file
77
src/boards/99.c
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
/* FCE Ultra - NES/Famicom Emulator
|
||||||
|
*
|
||||||
|
* Copyright notice for this file:
|
||||||
|
* Copyright (C) 2012 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 latch;
|
||||||
|
static uint8 *WRAM = NULL;
|
||||||
|
static uint32 WRAMSIZE;
|
||||||
|
static writefunc old4016;
|
||||||
|
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ &latch, 1, "LATC" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
setchr8((latch >> 2) & 1);
|
||||||
|
setprg8r(0x10, 0x6000, 0);
|
||||||
|
setprg32(0x8000, 0);
|
||||||
|
setprg8(0x8000, latch & 4); /* Special for VS Gumshoe */
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(M99Write) {
|
||||||
|
latch = V;
|
||||||
|
Sync();
|
||||||
|
old4016(A, V);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M99Power(void) {
|
||||||
|
latch = 0;
|
||||||
|
Sync();
|
||||||
|
old4016 = GetWriteHandler(0x4016);
|
||||||
|
SetWriteHandler(0x4016, 0x4016, M99Write);
|
||||||
|
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||||
|
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M99Close(void) {
|
||||||
|
if (WRAM)
|
||||||
|
FCEU_gfree(WRAM);
|
||||||
|
WRAM = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper99_Init(CartInfo *info) {
|
||||||
|
info->Power = M99Power;
|
||||||
|
info->Close = M99Close;
|
||||||
|
|
||||||
|
WRAMSIZE = 8192;
|
||||||
|
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||||
|
SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1);
|
||||||
|
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||||
|
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
|
}
|
||||||
86
src/boards/KS7012.c
Normal file
86
src/boards/KS7012.c
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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)
|
||||||
|
FCEU_gfree(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);
|
||||||
|
}
|
||||||
77
src/boards/KS7013.c
Normal file
77
src/boards/KS7013.c
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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);
|
||||||
|
}
|
||||||
114
src/boards/KS7017.c
Normal file
114
src/boards/KS7017.c
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 FP_FASTAPASS(1) 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)
|
||||||
|
FCEU_gfree(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);
|
||||||
|
}
|
||||||
140
src/boards/KS7030.c
Normal file
140
src/boards/KS7030.c
Normal file
@@ -0,0 +1,140 @@
|
|||||||
|
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* FDS Conversion
|
||||||
|
*
|
||||||
|
* Logical bank layot 32 K BANK 0, 64K BANK 1, 32K ~0 hardwired, 8K is missing
|
||||||
|
* need redump from MASKROM!
|
||||||
|
* probably need refix mapper after hard dump
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 reg0, reg1;
|
||||||
|
static uint8 *WRAM = NULL;
|
||||||
|
static uint32 WRAMSIZE;
|
||||||
|
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ ®0, 1, "REG0" },
|
||||||
|
{ ®1, 1, "REG1" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
setchr8(0);
|
||||||
|
setprg32(0x8000, ~0);
|
||||||
|
setprg4(0xb800, reg0);
|
||||||
|
setprg4(0xc800, 8 + reg1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 6000 - 6BFF - RAM
|
||||||
|
// 6C00 - 6FFF - BANK 1K REG1
|
||||||
|
// 7000 - 7FFF - BANK 4K REG0
|
||||||
|
|
||||||
|
static DECLFW(UNLKS7030RamWrite0) {
|
||||||
|
if ((A >= 0x6000) && A <= 0x6BFF) {
|
||||||
|
WRAM[A - 0x6000] = V;
|
||||||
|
} else if ((A >= 0x6C00) && A <= 0x6FFF) {
|
||||||
|
CartBW(0xC800 + (A - 0x6C00), V);
|
||||||
|
} else if ((A >= 0x7000) && A <= 0x7FFF) {
|
||||||
|
CartBW(0xB800 + (A - 0x7000), V);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFR(UNLKS7030RamRead0) {
|
||||||
|
if ((A >= 0x6000) && A <= 0x6BFF) {
|
||||||
|
return WRAM[A - 0x6000];
|
||||||
|
} else if ((A >= 0x6C00) && A <= 0x6FFF) {
|
||||||
|
return CartBR(0xC800 + (A - 0x6C00));
|
||||||
|
} else if ((A >= 0x7000) && A <= 0x7FFF) {
|
||||||
|
return CartBR(0xB800 + (A - 0x7000));
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// B800 - BFFF - RAM
|
||||||
|
// C000 - CBFF - BANK 3K
|
||||||
|
// CC00 - D7FF - RAM
|
||||||
|
|
||||||
|
static DECLFW(UNLKS7030RamWrite1) {
|
||||||
|
if ((A >= 0xB800) && A <= 0xBFFF) {
|
||||||
|
WRAM[0x0C00 + (A - 0xB800)] = V;
|
||||||
|
} else if ((A >= 0xC000) && A <= 0xCBFF) {
|
||||||
|
CartBW(0xCC00 + (A - 0xC000), V);
|
||||||
|
} else if ((A >= 0xCC00) && A <= 0xD7FF) {
|
||||||
|
WRAM[0x1400 + (A - 0xCC00)] = V;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFR(UNLKS7030RamRead1) {
|
||||||
|
if ((A >= 0xB800) && A <= 0xBFFF) {
|
||||||
|
return WRAM[0x0C00 + (A - 0xB800)];
|
||||||
|
} else if ((A >= 0xC000) && A <= 0xCBFF) {
|
||||||
|
return CartBR(0xCC00 + (A - 0xC000));
|
||||||
|
} else if ((A >= 0xCC00) && A <= 0xD7FF) {
|
||||||
|
return WRAM[0x1400 + (A - 0xCC00)];
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(UNLKS7030Write0) {
|
||||||
|
reg0 = A & 7;
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(UNLKS7030Write1) {
|
||||||
|
reg1 = A & 15;
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void UNLKS7030Power(void) {
|
||||||
|
reg0 = reg1 = ~0;
|
||||||
|
Sync();
|
||||||
|
SetReadHandler(0x6000, 0x7FFF, UNLKS7030RamRead0);
|
||||||
|
SetWriteHandler(0x6000, 0x7FFF, UNLKS7030RamWrite0);
|
||||||
|
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||||
|
SetWriteHandler(0x8000, 0x8FFF, UNLKS7030Write0);
|
||||||
|
SetWriteHandler(0x9000, 0x9FFF, UNLKS7030Write1);
|
||||||
|
SetReadHandler(0xB800, 0xD7FF, UNLKS7030RamRead1);
|
||||||
|
SetWriteHandler(0xB800, 0xD7FF, UNLKS7030RamWrite1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void UNLKS7030Close(void) {
|
||||||
|
if (WRAM)
|
||||||
|
FCEU_gfree(WRAM);
|
||||||
|
WRAM = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void UNLKS7030_Init(CartInfo *info) {
|
||||||
|
info->Power = UNLKS7030Power;
|
||||||
|
info->Close = UNLKS7030Close;
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
|
||||||
|
WRAMSIZE = 8192;
|
||||||
|
WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE);
|
||||||
|
AddExState(WRAM, WRAMSIZE, 0, "WRAM");
|
||||||
|
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
|
}
|
||||||
80
src/boards/KS7031.c
Normal file
80
src/boards/KS7031.c
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
/* FCE Ultra - NES/Famicom Emulator
|
||||||
|
*
|
||||||
|
* Copyright notice for this file:
|
||||||
|
* Copyright (C) 2012 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* FDS Conversion
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 reg[4];
|
||||||
|
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ reg, 4, "REGS" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
setprg2(0x6000, reg[0]);
|
||||||
|
setprg2(0x6800, reg[1]);
|
||||||
|
setprg2(0x7000, reg[2]);
|
||||||
|
setprg2(0x7800, reg[3]);
|
||||||
|
|
||||||
|
setprg2(0x8000, 15);
|
||||||
|
setprg2(0x8800, 14);
|
||||||
|
setprg2(0x9000, 13);
|
||||||
|
setprg2(0x9800, 12);
|
||||||
|
setprg2(0xa000, 11);
|
||||||
|
setprg2(0xa800, 10);
|
||||||
|
setprg2(0xb000, 9);
|
||||||
|
setprg2(0xb800, 8);
|
||||||
|
|
||||||
|
setprg2(0xc000, 7);
|
||||||
|
setprg2(0xc800, 6);
|
||||||
|
setprg2(0xd000, 5);
|
||||||
|
setprg2(0xd800, 4);
|
||||||
|
setprg2(0xe000, 3);
|
||||||
|
setprg2(0xe800, 2);
|
||||||
|
setprg2(0xf000, 1);
|
||||||
|
setprg2(0xf800, 0);
|
||||||
|
|
||||||
|
setchr8(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(UNLKS7031Write) {
|
||||||
|
reg[(A >> 11) & 3] = V;
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void UNLKS7031Power(void) {
|
||||||
|
Sync();
|
||||||
|
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||||
|
SetWriteHandler(0x8000, 0xffff, UNLKS7031Write);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void UNLKS7031_Init(CartInfo *info) {
|
||||||
|
info->Power = UNLKS7031Power;
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
|
}
|
||||||
91
src/boards/KS7032.c
Normal file
91
src/boards/KS7032.c
Normal file
@@ -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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 FP_FASTAPASS(1) 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);
|
||||||
|
}
|
||||||
125
src/boards/KS7037.c
Normal file
125
src/boards/KS7037.c
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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)
|
||||||
|
FCEU_gfree(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);
|
||||||
|
}
|
||||||
92
src/boards/KS7057.c
Normal file
92
src/boards/KS7057.c
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* FDS Conversion
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 reg[8], mirror;
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ reg, 8, "PRG" },
|
||||||
|
{ &mirror, 1, "MIRR" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
setprg2(0x6000, reg[4]);
|
||||||
|
setprg2(0x6800, reg[5]);
|
||||||
|
setprg2(0x7000, reg[6]);
|
||||||
|
setprg2(0x7800, reg[7]);
|
||||||
|
setprg2(0x8000, reg[0]);
|
||||||
|
setprg2(0x8800, reg[1]);
|
||||||
|
setprg2(0x9000, reg[2]);
|
||||||
|
setprg2(0x9800, reg[3]);
|
||||||
|
setprg8(0xA000, 0xd);
|
||||||
|
setprg16(0xC000, 7);
|
||||||
|
setchr8(0);
|
||||||
|
setmirror(mirror);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(UNLKS7057Write) {
|
||||||
|
switch (A & 0xF003) {
|
||||||
|
case 0x8000:
|
||||||
|
case 0x8001:
|
||||||
|
case 0x8002:
|
||||||
|
case 0x8003:
|
||||||
|
case 0x9000:
|
||||||
|
case 0x9001:
|
||||||
|
case 0x9002:
|
||||||
|
case 0x9003: mirror = V & 1; 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) {
|
||||||
|
Sync();
|
||||||
|
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||||
|
SetWriteHandler(0x8000, 0xFFFF, UNLKS7057Write);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void UNLKS7057Reset(void) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void UNLKS7057_Init(CartInfo *info) {
|
||||||
|
info->Power = UNLKS7057Power;
|
||||||
|
info->Reset = UNLKS7057Reset;
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
|
}
|
||||||
61
src/boards/SA-9602B.c
Normal file
61
src/boards/SA-9602B.c
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
/* FCE Ultra - NES/Famicom Emulator
|
||||||
|
*
|
||||||
|
* Copyright notice for this file:
|
||||||
|
* Copyright (C) 2012 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
#include "mmc3.h"
|
||||||
|
|
||||||
|
static void SA9602BPW(uint32 A, uint8 V) {
|
||||||
|
setprg8r(EXPREGS[1], A, V & 0x3F);
|
||||||
|
if (MMC3_cmd & 0x40)
|
||||||
|
setprg8r(0, 0x8000, ~(1));
|
||||||
|
else
|
||||||
|
setprg8r(0, 0xc000, ~(1));
|
||||||
|
setprg8r(0, 0xe000, ~(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(SA9602BWrite) {
|
||||||
|
switch (A & 0xe001) {
|
||||||
|
case 0x8000: EXPREGS[0] = V; break;
|
||||||
|
case 0x8001:
|
||||||
|
if ((EXPREGS[0] & 7) < 6) {
|
||||||
|
EXPREGS[1] = V >> 6;
|
||||||
|
FixMMC3PRG(MMC3_cmd);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
MMC3_CMDWrite(A, V);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void SA9602BPower(void) {
|
||||||
|
EXPREGS[0] = EXPREGS[1] = 0;
|
||||||
|
GenMMC3Power();
|
||||||
|
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||||
|
SetWriteHandler(0x8000, 0xBFFF, SA9602BWrite);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SA9602B_Init(CartInfo *info) {
|
||||||
|
GenMMC3_Init(info, 512, 0, 0, 0);
|
||||||
|
pwrap = SA9602BPW;
|
||||||
|
mmc3opts |= 2;
|
||||||
|
info->SaveGame[0] = UNIFchrrama;
|
||||||
|
info->SaveGameLen[0] = 32 * 1024;
|
||||||
|
info->Power = SA9602BPower;
|
||||||
|
AddExState(EXPREGS, 2, 0, "EXPR");
|
||||||
|
}
|
||||||
99
src/boards/__dummy_mapper.c
Normal file
99
src/boards/__dummy_mapper.c
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
/* FCE Ultra - NES/Famicom Emulator
|
||||||
|
*
|
||||||
|
* Copyright notice for this file:
|
||||||
|
* Copyright (C) 2013 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 reg[8];
|
||||||
|
static uint8 IRQa;
|
||||||
|
static int16 IRQCount, IRQLatch;
|
||||||
|
/*
|
||||||
|
static uint8 *WRAM = NULL;
|
||||||
|
static uint32 WRAMSIZE;
|
||||||
|
static uint8 *CHRRAM = NULL;
|
||||||
|
static uint32 CHRRAMSIZE;
|
||||||
|
*/
|
||||||
|
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ reg, 8, "REGS" },
|
||||||
|
{ &IRQa, 1, "IRQA" },
|
||||||
|
{ &IRQCount, 2, "IRQC" },
|
||||||
|
{ &IRQLatch, 2, "IRQL" },
|
||||||
|
{ 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)
|
||||||
|
FCEU_gfree(WRAM);
|
||||||
|
if (CHRRAM)
|
||||||
|
FCEU_gfree(CHRRAM);
|
||||||
|
WRAM = CHRRAM = NULL;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
static void MNNNIRQHook() {
|
||||||
|
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);
|
||||||
|
}
|
||||||
150
src/boards/__serial.c
Normal file
150
src/boards/__serial.c
Normal file
@@ -0,0 +1,150 @@
|
|||||||
|
#include "__serial.h"
|
||||||
|
|
||||||
|
#if defined(_WIN32) && !defined(_XBOX)
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
|
||||||
|
/* code is not portable, so make stubs for now */
|
||||||
|
|
||||||
|
BOOL SerialOpen(int port, int baud) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SerialClose(void) {
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL SerialSendChar(int c) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
int SerialIsOpen(void) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
int SerialGetChar(void) {
|
||||||
|
return EOF;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SendCmd(uint8 *cmd, int size) {
|
||||||
|
}
|
||||||
|
|
||||||
|
int ReadResp(uint8 *resp, int size) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
36
src/boards/__serial.h
Normal file
36
src/boards/__serial.h
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
#ifndef __SERIAL_H
|
||||||
|
#define __SERIAL_H
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#ifdef _WIN32 && !defined(_XBOX)
|
||||||
|
#include <windows.h>
|
||||||
|
#else
|
||||||
|
#define BOOL int
|
||||||
|
|
||||||
|
#ifndef TRUE
|
||||||
|
#define TRUE 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef FALSE
|
||||||
|
#define FALSE 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "../fceu-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
|
||||||
75
src/boards/a9746.c
Normal file
75
src/boards/a9746.c
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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");
|
||||||
|
}
|
||||||
|
|
||||||
71
src/boards/ac-08.c
Normal file
71
src/boards/ac-08.c
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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) {
|
||||||
|
if (A == 0x8001) // Green Berret bank switching is only 100x xxxx xxxx xxx1 mask
|
||||||
|
reg = (V >> 1) & 0xf;
|
||||||
|
else
|
||||||
|
reg = V & 0xf; // Sad But True, 2-in-1 mapper, Green Berret need value shifted left one byte, Castlevania doesn't
|
||||||
|
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);
|
||||||
|
}
|
||||||
505
src/boards/addrlatch.c
Normal file
505
src/boards/addrlatch.c
Normal file
@@ -0,0 +1,505 @@
|
|||||||
|
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint16 latche, latcheinit;
|
||||||
|
static uint16 addrreg0, addrreg1;
|
||||||
|
static uint8 dipswitch;
|
||||||
|
static void (*WSync)(void);
|
||||||
|
static readfunc defread;
|
||||||
|
static uint8 *WRAM = NULL;
|
||||||
|
static uint32 WRAMSIZE;
|
||||||
|
|
||||||
|
static DECLFW(LatchWrite) {
|
||||||
|
latche = A;
|
||||||
|
WSync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void LatchReset(void) {
|
||||||
|
latche = latcheinit;
|
||||||
|
WSync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void LatchPower(void) {
|
||||||
|
latche = latcheinit;
|
||||||
|
WSync();
|
||||||
|
if (WRAM) {
|
||||||
|
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||||
|
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||||
|
} else
|
||||||
|
SetReadHandler(0x6000, 0xFFFF, defread);
|
||||||
|
SetWriteHandler(addrreg0, addrreg1, LatchWrite);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void LatchClose(void) {
|
||||||
|
if (WRAM)
|
||||||
|
FCEU_gfree(WRAM);
|
||||||
|
WRAM = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
|
WSync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Latch_Init(CartInfo *info, void (*proc)(void), readfunc func, uint16 linit, uint16 adr0, uint16 adr1, uint8 wram) {
|
||||||
|
latcheinit = linit;
|
||||||
|
addrreg0 = adr0;
|
||||||
|
addrreg1 = adr1;
|
||||||
|
WSync = proc;
|
||||||
|
if (func != NULL)
|
||||||
|
defread = func;
|
||||||
|
else
|
||||||
|
defread = CartBROB;
|
||||||
|
info->Power = LatchPower;
|
||||||
|
info->Reset = LatchReset;
|
||||||
|
info->Close = LatchClose;
|
||||||
|
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");
|
||||||
|
}
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
AddExState(&latche, 2, 0, "LATC");
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------ BMCD1038 ---------------------------
|
||||||
|
|
||||||
|
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, 0x0000, 0x8000, 0xFFFF, 0);
|
||||||
|
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, 0x0081, 0x8000, 0xFFFF, 0);
|
||||||
|
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, NULL, 0x0000, 0x8000, 0xFFFF, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------ Map 059 ---------------------------
|
||||||
|
// One more forgotten mapper
|
||||||
|
static void M59Sync(void) {
|
||||||
|
setprg32(0x8000, (latche >> 4) & 7);
|
||||||
|
setchr8(latche & 0x7);
|
||||||
|
setmirror((latche >> 3) & 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFR(M59Read) {
|
||||||
|
if (latche & 0x100)
|
||||||
|
return 0;
|
||||||
|
else
|
||||||
|
return CartBR(A);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper59_Init(CartInfo *info) {
|
||||||
|
Latch_Init(info, M59Sync, M59Read, 0x0000, 0x8000, 0xFFFF, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------ Map 061 ---------------------------
|
||||||
|
static void M61Sync(void) {
|
||||||
|
if (((latche & 0x10) << 1) ^ (latche & 0x20)) {
|
||||||
|
setprg16(0x8000, ((latche & 0xF) << 1) | (((latche & 0x20) >> 4)));
|
||||||
|
setprg16(0xC000, ((latche & 0xF) << 1) | (((latche & 0x20) >> 4)));
|
||||||
|
} else
|
||||||
|
setprg32(0x8000, latche & 0xF);
|
||||||
|
setchr8(0);
|
||||||
|
setmirror(((latche >> 7) & 1) ^ 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper61_Init(CartInfo *info) {
|
||||||
|
Latch_Init(info, M61Sync, NULL, 0x0000, 0x8000, 0xFFFF, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------ Map 092 ---------------------------
|
||||||
|
// Another two-in-one mapper, two Jaleco carts uses similar
|
||||||
|
// hardware, but with different wiring.
|
||||||
|
// Original code provided by LULU
|
||||||
|
// Additionally, PCB contains DSP extra sound chip, used for voice samples (unemulated)
|
||||||
|
|
||||||
|
static void M92Sync(void) {
|
||||||
|
uint8 reg = latche & 0xF0;
|
||||||
|
setprg16(0x8000, 0);
|
||||||
|
if (latche >= 0x9000) {
|
||||||
|
switch (reg) {
|
||||||
|
case 0xD0: setprg16(0xc000, latche & 15); break;
|
||||||
|
case 0xE0: setchr8(latche & 15); break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
switch (reg) {
|
||||||
|
case 0xB0: setprg16(0xc000, latche & 15); break;
|
||||||
|
case 0x70: setchr8(latche & 15); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper92_Init(CartInfo *info) {
|
||||||
|
Latch_Init(info, M92Sync, NULL, 0x80B0, 0x8000, 0xFFFF, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------ Map 200 ---------------------------
|
||||||
|
|
||||||
|
static void M200Sync(void) {
|
||||||
|
setprg16(0x8000, latche & 7);
|
||||||
|
setprg16(0xC000, latche & 7);
|
||||||
|
setchr8(latche & 7);
|
||||||
|
setmirror((latche & 8) >> 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper200_Init(CartInfo *info) {
|
||||||
|
Latch_Init(info, M200Sync, NULL, 0xFFFF, 0x8000, 0xFFFF, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------ Map 201 ---------------------------
|
||||||
|
|
||||||
|
static void M201Sync(void) {
|
||||||
|
if (latche & 8) {
|
||||||
|
setprg32(0x8000, latche & 3);
|
||||||
|
setchr8(latche & 3);
|
||||||
|
} else {
|
||||||
|
setprg32(0x8000, 0);
|
||||||
|
setchr8(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper201_Init(CartInfo *info) {
|
||||||
|
Latch_Init(info, M201Sync, NULL, 0xFFFF, 0x8000, 0xFFFF, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------ Map 202 ---------------------------
|
||||||
|
|
||||||
|
static void M202Sync(void) {
|
||||||
|
// According to more carefull hardware tests and PCB study
|
||||||
|
int32 mirror = latche & 1;
|
||||||
|
int32 bank = (latche >> 1) & 0x7;
|
||||||
|
int32 select = (mirror & (bank >> 2));
|
||||||
|
setprg16(0x8000, select ? (bank & 6) | 0 : bank);
|
||||||
|
setprg16(0xc000, select ? (bank & 6) | 1 : bank);
|
||||||
|
setmirror(mirror ^ 1);
|
||||||
|
setchr8(bank);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper202_Init(CartInfo *info) {
|
||||||
|
Latch_Init(info, M202Sync, NULL, 0x0000, 0x8000, 0xFFFF, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------ Map 204 ---------------------------
|
||||||
|
|
||||||
|
static void M204Sync(void) {
|
||||||
|
int32 tmp2 = latche & 0x6;
|
||||||
|
int32 tmp1 = tmp2 + ((tmp2 == 0x6) ? 0 : (latche & 1));
|
||||||
|
setprg16(0x8000, tmp1);
|
||||||
|
setprg16(0xc000, tmp2 + ((tmp2 == 0x6) ? 1 : (latche & 1)));
|
||||||
|
setchr8(tmp1);
|
||||||
|
setmirror(((latche >> 4) & 1) ^ 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper204_Init(CartInfo *info) {
|
||||||
|
Latch_Init(info, M204Sync, NULL, 0xFFFF, 0x8000, 0xFFFF, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------ Map 212 ---------------------------
|
||||||
|
|
||||||
|
static DECLFR(M212Read) {
|
||||||
|
uint8 ret = CartBROB(A);
|
||||||
|
if ((A & 0xE010) == 0x6000)
|
||||||
|
ret |= 0x80;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M212Sync(void) {
|
||||||
|
if (latche & 0x4000) {
|
||||||
|
setprg32(0x8000, (latche >> 1) & 3);
|
||||||
|
} else {
|
||||||
|
setprg16(0x8000, latche & 7);
|
||||||
|
setprg16(0xC000, latche & 7);
|
||||||
|
}
|
||||||
|
setchr8(latche & 7);
|
||||||
|
setmirror(((latche >> 3) & 1) ^ 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper212_Init(CartInfo *info) {
|
||||||
|
Latch_Init(info, M212Sync, M212Read, 0xFFFF, 0x8000, 0xFFFF, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------ Map 213 ---------------------------
|
||||||
|
|
||||||
|
static void M213Sync(void) {
|
||||||
|
setprg32(0x8000, (latche >> 1) & 3);
|
||||||
|
setchr8((latche >> 3) & 7);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper213_Init(CartInfo *info) {
|
||||||
|
Latch_Init(info, M213Sync, NULL, 0x0000, 0x8000, 0xFFFF, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------ Map 214 ---------------------------
|
||||||
|
|
||||||
|
static void M214Sync(void) {
|
||||||
|
setprg16(0x8000, (latche >> 2) & 3);
|
||||||
|
setprg16(0xC000, (latche >> 2) & 3);
|
||||||
|
setchr8(latche & 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper214_Init(CartInfo *info) {
|
||||||
|
Latch_Init(info, M214Sync, NULL, 0x0000, 0x8000, 0xFFFF, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------ Map 217 ---------------------------
|
||||||
|
|
||||||
|
static void M217Sync(void) {
|
||||||
|
setprg32(0x8000, (latche >> 2) & 3);
|
||||||
|
setchr8(latche & 7);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper217_Init(CartInfo *info) {
|
||||||
|
Latch_Init(info, M217Sync, NULL, 0x0000, 0x8000, 0xFFFF, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------ Map 227 ---------------------------
|
||||||
|
|
||||||
|
static void M227Sync(void) {
|
||||||
|
uint32 S = latche & 1;
|
||||||
|
uint32 p = ((latche >> 2) & 0x1F) + ((latche & 0x100) >> 3);
|
||||||
|
uint32 L = (latche >> 9) & 1;
|
||||||
|
|
||||||
|
if ((latche >> 7) & 1) {
|
||||||
|
if (S) {
|
||||||
|
setprg32(0x8000, p >> 1);
|
||||||
|
} else {
|
||||||
|
setprg16(0x8000, p);
|
||||||
|
setprg16(0xC000, p);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (S) {
|
||||||
|
if (L) {
|
||||||
|
setprg16(0x8000, p & 0x3E);
|
||||||
|
setprg16(0xC000, p | 7);
|
||||||
|
} else {
|
||||||
|
setprg16(0x8000, p & 0x3E);
|
||||||
|
setprg16(0xC000, p & 0x38);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (L) {
|
||||||
|
setprg16(0x8000, p);
|
||||||
|
setprg16(0xC000, p | 7);
|
||||||
|
} else {
|
||||||
|
setprg16(0x8000, p);
|
||||||
|
setprg16(0xC000, p & 0x38);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setmirror(((latche >> 1) & 1) ^ 1);
|
||||||
|
setchr8(0);
|
||||||
|
setprg8r(0x10, 0x6000, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper227_Init(CartInfo *info) {
|
||||||
|
Latch_Init(info, M227Sync, NULL, 0x0000, 0x8000, 0xFFFF, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------ Map 229 ---------------------------
|
||||||
|
|
||||||
|
static void M229Sync(void) {
|
||||||
|
setchr8(latche);
|
||||||
|
if (!(latche & 0x1e))
|
||||||
|
setprg32(0x8000, 0);
|
||||||
|
else {
|
||||||
|
setprg16(0x8000, latche & 0x1F);
|
||||||
|
setprg16(0xC000, latche & 0x1F);
|
||||||
|
}
|
||||||
|
setmirror(((latche >> 5) & 1) ^ 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper229_Init(CartInfo *info) {
|
||||||
|
Latch_Init(info, M229Sync, NULL, 0x0000, 0x8000, 0xFFFF, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------ Map 231 ---------------------------
|
||||||
|
|
||||||
|
static void M231Sync(void) {
|
||||||
|
setchr8(0);
|
||||||
|
if (latche & 0x20)
|
||||||
|
setprg32(0x8000, (latche >> 1) & 0x0F);
|
||||||
|
else {
|
||||||
|
setprg16(0x8000, latche & 0x1E);
|
||||||
|
setprg16(0xC000, latche & 0x1E);
|
||||||
|
}
|
||||||
|
setmirror(((latche >> 7) & 1) ^ 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper231_Init(CartInfo *info) {
|
||||||
|
Latch_Init(info, M231Sync, NULL, 0x0000, 0x8000, 0xFFFF, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------ Map 242 ---------------------------
|
||||||
|
|
||||||
|
static void M242Sync(void) {
|
||||||
|
setchr8(0);
|
||||||
|
setprg8r(0x10, 0x6000, 0);
|
||||||
|
setprg32(0x8000, (latche >> 3) & 0xf);
|
||||||
|
setmirror(((latche >> 1) & 1) ^ 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper242_Init(CartInfo *info) {
|
||||||
|
Latch_Init(info, M242Sync, NULL, 0x0000, 0x8000, 0xFFFF, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------ 190in1 ---------------------------
|
||||||
|
|
||||||
|
static void BMC190in1Sync(void) {
|
||||||
|
setprg16(0x8000, (latche >> 2) & 7);
|
||||||
|
setprg16(0xC000, (latche >> 2) & 7);
|
||||||
|
setchr8((latche >> 2) & 7);
|
||||||
|
setmirror((latche & 1) ^ 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BMC190in1_Init(CartInfo *info) {
|
||||||
|
Latch_Init(info, BMC190in1Sync, NULL, 0x0000, 0x8000, 0xFFFF, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------- 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, NULL, 0x0000, 0x8000, 0xFFFF, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------- 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, NULL, 0x0000, 0x8000, 0xFFFF, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------- BMCG-146 ------------------------
|
||||||
|
|
||||||
|
static void BMCG146Sync(void) {
|
||||||
|
setchr8(0);
|
||||||
|
if (latche & 0x800) { // UNROM mode
|
||||||
|
setprg16(0x8000, (latche & 0x1F) | (latche & ((latche & 0x40) >> 6)));
|
||||||
|
setprg16(0xC000, (latche & 0x18) | 7);
|
||||||
|
} else {
|
||||||
|
if (latche & 0x40) { // 16K mode
|
||||||
|
setprg16(0x8000, latche & 0x1F);
|
||||||
|
setprg16(0xC000, latche & 0x1F);
|
||||||
|
} else {
|
||||||
|
setprg32(0x8000, (latche >> 1) & 0x0F);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setmirror(((latche & 0x80) >> 7) ^ 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BMCG146_Init(CartInfo *info) {
|
||||||
|
Latch_Init(info, BMCG146Sync, NULL, 0x0000, 0x8000, 0xFFFF, 0);
|
||||||
|
}
|
||||||
111
src/boards/ax5705.c
Normal file
111
src/boards/ax5705.c
Normal file
@@ -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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 UNLAX5705IRQ(void) {
|
||||||
|
if(IRQa) {
|
||||||
|
IRQCount++;
|
||||||
|
if(IRQCount>=238) {
|
||||||
|
X6502_IRQBegin(FCEU_IQEXT);
|
||||||
|
// IRQa=0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
setprg8(0x8000, prg_reg[0]);
|
||||||
|
setprg8(0xA000, prg_reg[1]);
|
||||||
|
setprg8(0xC000, ~1);
|
||||||
|
setprg8(0xE000, ~0);
|
||||||
|
int i;
|
||||||
|
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;
|
||||||
|
// case 0x800A: X6502_IRQEnd(FCEU_IQEXT); IRQa=0; break;
|
||||||
|
// case 0xE00B: X6502_IRQEnd(FCEU_IQEXT); IRQa=IRQCount=V; /*if(scanline<240) IRQCount-=8; else IRQCount+=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);
|
||||||
|
}
|
||||||
463
src/boards/bandai.c
Normal file
463
src/boards/bandai.c
Normal file
@@ -0,0 +1,463 @@
|
|||||||
|
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* Bandai mappers
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 reg[16], is153, x24c02;
|
||||||
|
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 }
|
||||||
|
};
|
||||||
|
|
||||||
|
// x24C0x interface
|
||||||
|
|
||||||
|
#define X24C0X_STANDBY 0
|
||||||
|
#define X24C0X_ADDRESS 1
|
||||||
|
#define X24C0X_WORD 2
|
||||||
|
#define X24C0X_READ 3
|
||||||
|
#define X24C0X_WRITE 4
|
||||||
|
|
||||||
|
static uint8 x24c0x_data[256], x24c0x_state;
|
||||||
|
static uint8 x24c0x_addr, x24c0x_word, x24c0x_latch, x24c0x_bitcount;
|
||||||
|
static uint8 x24c0x_sda, x24c0x_scl, x24c0x_out, x24c0x_oe;
|
||||||
|
|
||||||
|
static SFORMAT x24c0xStateRegs[] =
|
||||||
|
{
|
||||||
|
{ &x24c0x_addr, 1, "ADDR" },
|
||||||
|
{ &x24c0x_word, 1, "WORD" },
|
||||||
|
{ &x24c0x_latch, 1, "LATC" },
|
||||||
|
{ &x24c0x_bitcount, 1, "BITC" },
|
||||||
|
{ &x24c0x_sda, 1, "SDA" },
|
||||||
|
{ &x24c0x_scl, 1, "SCL" },
|
||||||
|
{ &x24c0x_out, 1, "OUT" },
|
||||||
|
{ &x24c0x_oe, 1, "OE" },
|
||||||
|
{ &x24c0x_state, 1, "STAT" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void x24c0x_init() {
|
||||||
|
x24c0x_addr = x24c0x_word = x24c0x_latch = x24c0x_bitcount = x24c0x_sda = x24c0x_scl = x24c0x_oe = 0;
|
||||||
|
x24c0x_state = X24C0X_STANDBY;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void x24c0x_write(uint8 data) {
|
||||||
|
uint8 sda = (data >> 6) & 1;
|
||||||
|
uint8 scl = (data >> 5) & 1;
|
||||||
|
x24c0x_oe = (data >> 7);
|
||||||
|
|
||||||
|
if(x24c0x_scl && scl) {
|
||||||
|
if(x24c0x_sda && !sda) { // START
|
||||||
|
x24c0x_state = X24C0X_ADDRESS;
|
||||||
|
x24c0x_bitcount = 0;
|
||||||
|
x24c0x_addr = 0;
|
||||||
|
} else if(!x24c0x_sda && sda) { //STOP
|
||||||
|
x24c0x_state = X24C0X_STANDBY;
|
||||||
|
}
|
||||||
|
} else if(!x24c0x_scl && scl) { // RISING EDGE
|
||||||
|
switch(x24c0x_state) {
|
||||||
|
case X24C0X_ADDRESS:
|
||||||
|
if(x24c0x_bitcount < 7) {
|
||||||
|
x24c0x_addr <<= 1;
|
||||||
|
x24c0x_addr |= sda;
|
||||||
|
} else {
|
||||||
|
if(!x24c02) // X24C01 mode
|
||||||
|
x24c0x_word = x24c0x_addr;
|
||||||
|
if(sda) { // READ COMMAND
|
||||||
|
x24c0x_state = X24C0X_READ;
|
||||||
|
} else { // WRITE COMMAND
|
||||||
|
if(x24c02) // X24C02 mode
|
||||||
|
x24c0x_state = X24C0X_WORD;
|
||||||
|
else
|
||||||
|
x24c0x_state = X24C0X_WRITE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
x24c0x_bitcount++;
|
||||||
|
break;
|
||||||
|
case X24C0X_WORD:
|
||||||
|
if(x24c0x_bitcount == 8) { // ACK
|
||||||
|
x24c0x_word = 0;
|
||||||
|
x24c0x_out = 0;
|
||||||
|
} else { // WORD ADDRESS INPUT
|
||||||
|
x24c0x_word <<= 1;
|
||||||
|
x24c0x_word |= sda;
|
||||||
|
if(x24c0x_bitcount == 16) { // END OF ADDRESS INPUT
|
||||||
|
x24c0x_bitcount = 7;
|
||||||
|
x24c0x_state = X24C0X_WRITE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
x24c0x_bitcount++;
|
||||||
|
break;
|
||||||
|
case X24C0X_READ:
|
||||||
|
if (x24c0x_bitcount == 8) { // ACK
|
||||||
|
x24c0x_out = 0;
|
||||||
|
x24c0x_latch = x24c0x_data[x24c0x_word];
|
||||||
|
x24c0x_bitcount = 0;
|
||||||
|
} else { // REAL OUTPUT
|
||||||
|
x24c0x_out = x24c0x_latch >> 7;
|
||||||
|
x24c0x_latch <<= 1;
|
||||||
|
x24c0x_bitcount++;
|
||||||
|
if(x24c0x_bitcount == 8) {
|
||||||
|
x24c0x_word++;
|
||||||
|
x24c0x_word &= 0xff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case X24C0X_WRITE:
|
||||||
|
if (x24c0x_bitcount == 8) { // ACK
|
||||||
|
x24c0x_out = 0;
|
||||||
|
x24c0x_latch = 0;
|
||||||
|
x24c0x_bitcount = 0;
|
||||||
|
} else { // REAL INPUT
|
||||||
|
x24c0x_latch <<= 1;
|
||||||
|
x24c0x_latch |= sda;
|
||||||
|
x24c0x_bitcount++;
|
||||||
|
if(x24c0x_bitcount == 8) {
|
||||||
|
x24c0x_data[x24c0x_word] = x24c0x_latch;
|
||||||
|
x24c0x_word++;
|
||||||
|
x24c0x_word &= 0xff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
x24c0x_sda = sda;
|
||||||
|
x24c0x_scl = scl;
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint8 x24c0x_read() {
|
||||||
|
return x24c0x_out << 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
if (is153) {
|
||||||
|
int base = (reg[0] & 1) << 4;
|
||||||
|
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;
|
||||||
|
Sync();
|
||||||
|
} 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: x24c0x_write(V); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFR(BandaiRead) {
|
||||||
|
return (X.DB & 0xEF) | x24c0x_read();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void FP_FASTAPASS(1) BandaiIRQHook(int a) {
|
||||||
|
if (IRQa) {
|
||||||
|
IRQCount -= a;
|
||||||
|
if (IRQCount < 0) {
|
||||||
|
X6502_IRQBegin(FCEU_IQEXT);
|
||||||
|
IRQa = 0;
|
||||||
|
IRQCount = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void BandaiPower(void) {
|
||||||
|
IRQa = 0;
|
||||||
|
x24c0x_init();
|
||||||
|
Sync();
|
||||||
|
SetReadHandler(0x6000, 0x7FFF, BandaiRead);
|
||||||
|
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||||
|
SetWriteHandler(0x6000, 0xFFFF, BandaiWrite);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper16_Init(CartInfo *info) {
|
||||||
|
x24c02 = 1;
|
||||||
|
is153 = 0;
|
||||||
|
info->Power = BandaiPower;
|
||||||
|
MapIRQHook = BandaiIRQHook;
|
||||||
|
|
||||||
|
info->battery = 1;
|
||||||
|
info->SaveGame[0] = x24c0x_data;
|
||||||
|
info->SaveGameLen[0] = 256;
|
||||||
|
AddExState(x24c0x_data, 256, 0, "DATA");
|
||||||
|
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
AddExState(&x24c0xStateRegs, ~0, 0, 0);
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper159_Init(CartInfo *info) {
|
||||||
|
x24c02 = 0;
|
||||||
|
is153 = 0;
|
||||||
|
info->Power = BandaiPower;
|
||||||
|
MapIRQHook = BandaiIRQHook;
|
||||||
|
|
||||||
|
info->battery = 1;
|
||||||
|
info->SaveGame[0] = x24c0x_data;
|
||||||
|
info->SaveGameLen[0] = 128;
|
||||||
|
AddExState(x24c0x_data, 128, 0, "DATA");
|
||||||
|
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
AddExState(&x24c0xStateRegs, ~0, 0, 0);
|
||||||
|
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).
|
||||||
|
|
||||||
|
static void M153Power(void) {
|
||||||
|
Sync();
|
||||||
|
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)
|
||||||
|
FCEU_gfree(WRAM);
|
||||||
|
WRAM = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Datach Barcode Battler
|
||||||
|
|
||||||
|
static uint8 BarcodeData[256];
|
||||||
|
static int BarcodeReadPos;
|
||||||
|
static int BarcodeCycleCount;
|
||||||
|
static uint32 BarcodeOut;
|
||||||
|
|
||||||
|
int FCEUI_DatachSet(const uint8 *rcode) {
|
||||||
|
int prefix_parity_type[10][6] = {
|
||||||
|
{ 0, 0, 0, 0, 0, 0 }, { 0, 0, 1, 0, 1, 1 }, { 0, 0, 1, 1, 0, 1 }, { 0, 0, 1, 1, 1, 0 },
|
||||||
|
{ 0, 1, 0, 0, 1, 1 }, { 0, 1, 1, 0, 0, 1 }, { 0, 1, 1, 1, 0, 0 }, { 0, 1, 0, 1, 0, 1 },
|
||||||
|
{ 0, 1, 0, 1, 1, 0 }, { 0, 1, 1, 0, 1, 0 }
|
||||||
|
};
|
||||||
|
int data_left_odd[10][7] = {
|
||||||
|
{ 0, 0, 0, 1, 1, 0, 1 }, { 0, 0, 1, 1, 0, 0, 1 }, { 0, 0, 1, 0, 0, 1, 1 }, { 0, 1, 1, 1, 1, 0, 1 },
|
||||||
|
{ 0, 1, 0, 0, 0, 1, 1 }, { 0, 1, 1, 0, 0, 0, 1 }, { 0, 1, 0, 1, 1, 1, 1 }, { 0, 1, 1, 1, 0, 1, 1 },
|
||||||
|
{ 0, 1, 1, 0, 1, 1, 1 }, { 0, 0, 0, 1, 0, 1, 1 }
|
||||||
|
};
|
||||||
|
int data_left_even[10][7] = {
|
||||||
|
{ 0, 1, 0, 0, 1, 1, 1 }, { 0, 1, 1, 0, 0, 1, 1 }, { 0, 0, 1, 1, 0, 1, 1 }, { 0, 1, 0, 0, 0, 0, 1 },
|
||||||
|
{ 0, 0, 1, 1, 1, 0, 1 }, { 0, 1, 1, 1, 0, 0, 1 }, { 0, 0, 0, 0, 1, 0, 1 }, { 0, 0, 1, 0, 0, 0, 1 },
|
||||||
|
{ 0, 0, 0, 1, 0, 0, 1 }, { 0, 0, 1, 0, 1, 1, 1 }
|
||||||
|
};
|
||||||
|
int data_right[10][7] = {
|
||||||
|
{ 1, 1, 1, 0, 0, 1, 0 }, { 1, 1, 0, 0, 1, 1, 0 }, { 1, 1, 0, 1, 1, 0, 0 }, { 1, 0, 0, 0, 0, 1, 0 },
|
||||||
|
{ 1, 0, 1, 1, 1, 0, 0 }, { 1, 0, 0, 1, 1, 1, 0 }, { 1, 0, 1, 0, 0, 0, 0 }, { 1, 0, 0, 0, 1, 0, 0 },
|
||||||
|
{ 1, 0, 0, 1, 0, 0, 0 }, { 1, 1, 1, 0, 1, 0, 0 }
|
||||||
|
};
|
||||||
|
uint8 code[13 + 1];
|
||||||
|
uint32 tmp_p = 0;
|
||||||
|
int i, j;
|
||||||
|
int len;
|
||||||
|
|
||||||
|
for (i = len = 0; i < 13; i++) {
|
||||||
|
if (!rcode[i]) break;
|
||||||
|
if ((code[i] = rcode[i] - '0') > 9)
|
||||||
|
return(0);
|
||||||
|
len++;
|
||||||
|
}
|
||||||
|
if (len != 13 && len != 12 && len != 8 && len != 7) return(0);
|
||||||
|
|
||||||
|
#define BS(x) BarcodeData[tmp_p] = x; tmp_p++
|
||||||
|
|
||||||
|
for (j = 0; j < 32; j++) {
|
||||||
|
BS(0x00);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Left guard bars */
|
||||||
|
BS(1); BS(0); BS(1);
|
||||||
|
|
||||||
|
if (len == 13 || len == 12) {
|
||||||
|
uint32 csum;
|
||||||
|
|
||||||
|
for (i = 0; i < 6; i++)
|
||||||
|
if (prefix_parity_type[code[0]][i]) {
|
||||||
|
for (j = 0; j < 7; j++) {
|
||||||
|
BS(data_left_even[code[i + 1]][j]);
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
for (j = 0; j < 7; j++) {
|
||||||
|
BS(data_left_odd[code[i + 1]][j]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Center guard bars */
|
||||||
|
BS(0); BS(1); BS(0); BS(1); BS(0);
|
||||||
|
|
||||||
|
for (i = 7; i < 12; i++)
|
||||||
|
for (j = 0; j < 7; j++) {
|
||||||
|
BS(data_right[code[i]][j]);
|
||||||
|
}
|
||||||
|
csum = 0;
|
||||||
|
for (i = 0; i < 12; i++) csum += code[i] * ((i & 1) ? 3 : 1);
|
||||||
|
csum = (10 - (csum % 10)) % 10;
|
||||||
|
for (j = 0; j < 7; j++) {
|
||||||
|
BS(data_right[csum][j]);
|
||||||
|
}
|
||||||
|
} else if (len == 8 || len == 7) {
|
||||||
|
uint32 csum = 0;
|
||||||
|
|
||||||
|
for (i = 0; i < 7; i++) csum += (i & 1) ? code[i] : (code[i] * 3);
|
||||||
|
|
||||||
|
csum = (10 - (csum % 10)) % 10;
|
||||||
|
|
||||||
|
for (i = 0; i < 4; i++)
|
||||||
|
for (j = 0; j < 7; j++) {
|
||||||
|
BS(data_left_odd[code[i]][j]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Center guard bars */
|
||||||
|
BS(0); BS(1); BS(0); BS(1); BS(0);
|
||||||
|
|
||||||
|
for (i = 4; i < 7; i++)
|
||||||
|
for (j = 0; j < 7; j++) {
|
||||||
|
BS(data_right[code[i]][j]);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (j = 0; j < 7; j++) {
|
||||||
|
BS(data_right[csum][j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Right guard bars */
|
||||||
|
BS(1); BS(0); BS(1);
|
||||||
|
|
||||||
|
for (j = 0; j < 32; j++) {
|
||||||
|
BS(0x00);
|
||||||
|
}
|
||||||
|
|
||||||
|
BS(0xFF);
|
||||||
|
|
||||||
|
#undef BS
|
||||||
|
|
||||||
|
BarcodeReadPos = 0;
|
||||||
|
BarcodeOut = 0x8;
|
||||||
|
BarcodeCycleCount = 0;
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void FP_FASTAPASS(1) BarcodeIRQHook(int a) {
|
||||||
|
BandaiIRQHook(a);
|
||||||
|
|
||||||
|
BarcodeCycleCount += a;
|
||||||
|
|
||||||
|
if (BarcodeCycleCount >= 1000) {
|
||||||
|
BarcodeCycleCount -= 1000;
|
||||||
|
if (BarcodeData[BarcodeReadPos] == 0xFF) {
|
||||||
|
BarcodeOut = 0;
|
||||||
|
} else {
|
||||||
|
BarcodeOut = (BarcodeData[BarcodeReadPos] ^ 1) << 3;
|
||||||
|
BarcodeReadPos++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFR(BarcodeRead) {
|
||||||
|
return BarcodeOut;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M157Power(void) {
|
||||||
|
IRQa = 0;
|
||||||
|
BarcodeData[0] = 0xFF;
|
||||||
|
BarcodeReadPos = 0;
|
||||||
|
BarcodeOut = 0;
|
||||||
|
BarcodeCycleCount = 0;
|
||||||
|
|
||||||
|
Sync();
|
||||||
|
|
||||||
|
SetWriteHandler(0x6000, 0xFFFF, BandaiWrite);
|
||||||
|
SetReadHandler(0x6000, 0x7FFF, BarcodeRead);
|
||||||
|
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper157_Init(CartInfo *info) {
|
||||||
|
is153 = 1;
|
||||||
|
info->Power = M157Power;
|
||||||
|
MapIRQHook = BarcodeIRQHook;
|
||||||
|
|
||||||
|
GameInfo->cspecial = SIS_DATACH;
|
||||||
|
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
|
}
|
||||||
68
src/boards/bb.c
Normal file
68
src/boards/bb.c
Normal file
@@ -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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* FDS Conversion
|
||||||
|
*
|
||||||
|
* Bubble Bobble CHR-ROM version
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 reg, chr;
|
||||||
|
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ ®, 1, "REG" },
|
||||||
|
{ &chr, 1, "CHR" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
setprg8(0x6000, reg & 3);
|
||||||
|
setprg32(0x8000, ~0);
|
||||||
|
setchr8(chr & 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DECLFW(UNLBBWrite) {
|
||||||
|
if ((A & 0x9000) == 0x8000)
|
||||||
|
reg = chr = V;
|
||||||
|
else
|
||||||
|
chr = V & 1; // hacky hacky, ProWres simplified FDS conversion 2-in-1 mapper
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void UNLBBPower(void) {
|
||||||
|
chr = 0;
|
||||||
|
reg = ~0;
|
||||||
|
Sync();
|
||||||
|
SetReadHandler(0x6000, 0x7FFF, CartBR);
|
||||||
|
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||||
|
SetWriteHandler(0x8000, 0xFFFF, UNLBBWrite);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void UNLBB_Init(CartInfo *info) {
|
||||||
|
info->Power = UNLBBPower;
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
|
}
|
||||||
97
src/boards/bmc13in1jy110.c
Normal file
97
src/boards/bmc13in1jy110.c
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* BMC 42-in-1 "reset switch" type
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 bank_mode;
|
||||||
|
static uint8 bank_value;
|
||||||
|
static uint8 prgb[4];
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ &bank_mode, 1, "BNM" },
|
||||||
|
{ &bank_value, 1, "BMV" },
|
||||||
|
{ prgb, 4, "PRGB" },
|
||||||
|
{ 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;
|
||||||
|
}
|
||||||
86
src/boards/bmc42in1r.c
Normal file
86
src/boards/bmc42in1r.c
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* BMC 42-in-1 "reset switch" + "select switch"
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mapinc.h"
|
||||||
|
|
||||||
|
static uint8 isresetbased = 0;
|
||||||
|
static uint8 latche[2], reset;
|
||||||
|
static SFORMAT StateRegs[] =
|
||||||
|
{
|
||||||
|
{ &reset, 1, "RST" },
|
||||||
|
{ latche, 2, "LATC" },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void Sync(void) {
|
||||||
|
uint8 bank;
|
||||||
|
if (isresetbased)
|
||||||
|
bank = (latche[0] & 0x1f) | (reset << 5) | ((latche[1] & 1) << 6);
|
||||||
|
else
|
||||||
|
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] = reset = 0;
|
||||||
|
Sync();
|
||||||
|
SetWriteHandler(0x8000, 0xFFFF, M226Write);
|
||||||
|
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void StateRestore(int version) {
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper226_Init(CartInfo *info) {
|
||||||
|
isresetbased = 0;
|
||||||
|
info->Power = M226Power;
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void M233Reset(void) {
|
||||||
|
reset ^= 1;
|
||||||
|
Sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mapper233_Init(CartInfo *info) {
|
||||||
|
isresetbased = 1;
|
||||||
|
info->Power = M226Power;
|
||||||
|
info->Reset = M233Reset;
|
||||||
|
AddExState(&StateRegs, ~0, 0, 0);
|
||||||
|
GameStateRestore = StateRestore;
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user