remove gb, snes, nes cores from libmednahawk, just for compactness sake
This commit is contained in:
parent
9ff8b450f4
commit
3b533893a8
|
@ -1,8 +0,0 @@
|
|||
AUTOMAKE_OPTIONS = subdir-objects
|
||||
DEFS = -DLOCALEDIR=\"$(datadir)/locale\" @DEFS@ @MATH_OPTIMIZER_FLAGS@
|
||||
DEFAULT_INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/intl -I$(top_builddir)/include/blip -I$(top_srcdir)/src/hw_sound
|
||||
|
||||
noinst_LIBRARIES = libgb.a
|
||||
gb_SOURCES = gb.cpp gfx.cpp gbGlobals.cpp memory.cpp sound.cpp z80.cpp
|
||||
|
||||
libgb_a_SOURCES = $(gb_SOURCES)
|
|
@ -1,604 +0,0 @@
|
|||
# Makefile.in generated by automake 1.11.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
|
||||
# Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
target_triplet = @target@
|
||||
subdir = src/gb
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cflags_gcc_option.m4 \
|
||||
$(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/fcntl-o.m4 \
|
||||
$(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/glibc2.m4 \
|
||||
$(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/iconv.m4 \
|
||||
$(top_srcdir)/m4/intdiv0.m4 $(top_srcdir)/m4/intl.m4 \
|
||||
$(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/intmax.m4 \
|
||||
$(top_srcdir)/m4/inttypes-pri.m4 \
|
||||
$(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/lcmessage.m4 \
|
||||
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
|
||||
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
|
||||
$(top_srcdir)/m4/lock.m4 $(top_srcdir)/m4/longlong.m4 \
|
||||
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
|
||||
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
|
||||
$(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
|
||||
$(top_srcdir)/m4/printf-posix.m4 $(top_srcdir)/m4/progtest.m4 \
|
||||
$(top_srcdir)/m4/size_max.m4 $(top_srcdir)/m4/stdint_h.m4 \
|
||||
$(top_srcdir)/m4/threadlib.m4 $(top_srcdir)/m4/uintmax_t.m4 \
|
||||
$(top_srcdir)/m4/visibility.m4 $(top_srcdir)/m4/wchar_t.m4 \
|
||||
$(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/xsize.m4 \
|
||||
$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = $(top_builddir)/include/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
LIBRARIES = $(noinst_LIBRARIES)
|
||||
ARFLAGS = cru
|
||||
AM_V_AR = $(am__v_AR_$(V))
|
||||
am__v_AR_ = $(am__v_AR_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_AR_0 = @echo " AR " $@;
|
||||
AM_V_at = $(am__v_at_$(V))
|
||||
am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_at_0 = @
|
||||
libgb_a_AR = $(AR) $(ARFLAGS)
|
||||
libgb_a_LIBADD =
|
||||
am__objects_1 = gb.$(OBJEXT) gfx.$(OBJEXT) gbGlobals.$(OBJEXT) \
|
||||
memory.$(OBJEXT) sound.$(OBJEXT) z80.$(OBJEXT)
|
||||
am_libgb_a_OBJECTS = $(am__objects_1)
|
||||
libgb_a_OBJECTS = $(am_libgb_a_OBJECTS)
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
am__mv = mv -f
|
||||
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
|
||||
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
|
||||
AM_V_lt = $(am__v_lt_$(V))
|
||||
am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_lt_0 = --silent
|
||||
LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \
|
||||
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
|
||||
$(AM_CXXFLAGS) $(CXXFLAGS)
|
||||
AM_V_CXX = $(am__v_CXX_$(V))
|
||||
am__v_CXX_ = $(am__v_CXX_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_CXX_0 = @echo " CXX " $@;
|
||||
CXXLD = $(CXX)
|
||||
CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
|
||||
$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
AM_V_CXXLD = $(am__v_CXXLD_$(V))
|
||||
am__v_CXXLD_ = $(am__v_CXXLD_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_CXXLD_0 = @echo " CXXLD " $@;
|
||||
AM_V_GEN = $(am__v_GEN_$(V))
|
||||
am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_GEN_0 = @echo " GEN " $@;
|
||||
SOURCES = $(libgb_a_SOURCES)
|
||||
DIST_SOURCES = $(libgb_a_SOURCES)
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALLOCA = @ALLOCA@
|
||||
ALSA_CFLAGS = @ALSA_CFLAGS@
|
||||
ALSA_LIBS = @ALSA_LIBS@
|
||||
AMTAR = @AMTAR@
|
||||
AM_CFLAGS = @AM_CFLAGS@
|
||||
AM_CXXFLAGS = @AM_CXXFLAGS@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@
|
||||
CATOBJEXT = @CATOBJEXT@
|
||||
CC = @CC@
|
||||
CCAS = @CCAS@
|
||||
CCASDEPMODE = @CCASDEPMODE@
|
||||
CCASFLAGS = @CCASFLAGS@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DATADIRNAME = @DATADIRNAME@
|
||||
DEFS = -DLOCALEDIR=\"$(datadir)/locale\" @DEFS@ @MATH_OPTIMIZER_FLAGS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
GBA_EXTRA_FLAGS = @GBA_EXTRA_FLAGS@
|
||||
GENCAT = @GENCAT@
|
||||
GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
|
||||
GLIBC2 = @GLIBC2@
|
||||
GLIBC21 = @GLIBC21@
|
||||
GMSGFMT = @GMSGFMT@
|
||||
GMSGFMT_015 = @GMSGFMT_015@
|
||||
GREP = @GREP@
|
||||
HAVE_ASPRINTF = @HAVE_ASPRINTF@
|
||||
HAVE_NEWLOCALE = @HAVE_NEWLOCALE@
|
||||
HAVE_POSIX_PRINTF = @HAVE_POSIX_PRINTF@
|
||||
HAVE_SNPRINTF = @HAVE_SNPRINTF@
|
||||
HAVE_VISIBILITY = @HAVE_VISIBILITY@
|
||||
HAVE_WPRINTF = @HAVE_WPRINTF@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
INSTOBJEXT = @INSTOBJEXT@
|
||||
INTLBISON = @INTLBISON@
|
||||
INTLLIBS = @INTLLIBS@
|
||||
INTLOBJS = @INTLOBJS@
|
||||
INTL_DEFAULT_VERBOSITY = @INTL_DEFAULT_VERBOSITY@
|
||||
INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@
|
||||
INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
|
||||
JACK_CFLAGS = @JACK_CFLAGS@
|
||||
JACK_LIBS = @JACK_LIBS@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBCDIO_CFLAGS = @LIBCDIO_CFLAGS@
|
||||
LIBCDIO_LIBS = @LIBCDIO_LIBS@
|
||||
LIBICONV = @LIBICONV@
|
||||
LIBINTL = @LIBINTL@
|
||||
LIBMULTITHREAD = @LIBMULTITHREAD@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBPTH = @LIBPTH@
|
||||
LIBPTH_PREFIX = @LIBPTH_PREFIX@
|
||||
LIBS = @LIBS@
|
||||
LIBTHREAD = @LIBTHREAD@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBC = @LTLIBC@
|
||||
LTLIBICONV = @LTLIBICONV@
|
||||
LTLIBINTL = @LTLIBINTL@
|
||||
LTLIBMULTITHREAD = @LTLIBMULTITHREAD@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
LTLIBPTH = @LTLIBPTH@
|
||||
LTLIBTHREAD = @LTLIBTHREAD@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MATH_OPTIMIZER_FLAGS = @MATH_OPTIMIZER_FLAGS@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
MMX_CFLAGS = @MMX_CFLAGS@
|
||||
MSGFMT = @MSGFMT@
|
||||
MSGFMT_015 = @MSGFMT_015@
|
||||
MSGMERGE = @MSGMERGE@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PKG_CONFIG = @PKG_CONFIG@
|
||||
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
|
||||
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
|
||||
POSUB = @POSUB@
|
||||
PRI_MACROS_BROKEN = @PRI_MACROS_BROKEN@
|
||||
RANLIB = @RANLIB@
|
||||
SDL_CFLAGS = @SDL_CFLAGS@
|
||||
SDL_CONFIG = @SDL_CONFIG@
|
||||
SDL_LIBS = @SDL_LIBS@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
|
||||
SNDFILE_LIBS = @SNDFILE_LIBS@
|
||||
SNES_EXTRA_CXXFLAGS = @SNES_EXTRA_CXXFLAGS@
|
||||
SNES_EXTRA_FLAGS = @SNES_EXTRA_FLAGS@
|
||||
SSE2_CFLAGS = @SSE2_CFLAGS@
|
||||
SSE3_CFLAGS = @SSE3_CFLAGS@
|
||||
SSE_CFLAGS = @SSE_CFLAGS@
|
||||
STRIP = @STRIP@
|
||||
TRIO_CFLAGS = @TRIO_CFLAGS@
|
||||
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
|
||||
USE_NLS = @USE_NLS@
|
||||
VERSION = @VERSION@
|
||||
WARNING_FLAGS = @WARNING_FLAGS@
|
||||
WINDRES = @WINDRES@
|
||||
WOE32 = @WOE32@
|
||||
WOE32DLL = @WOE32DLL@
|
||||
XGETTEXT = @XGETTEXT@
|
||||
XGETTEXT_015 = @XGETTEXT_015@
|
||||
XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
|
||||
XMKMF = @XMKMF@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
lt_ECHO = @lt_ECHO@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target = @target@
|
||||
target_alias = @target_alias@
|
||||
target_cpu = @target_cpu@
|
||||
target_os = @target_os@
|
||||
target_vendor = @target_vendor@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
AUTOMAKE_OPTIONS = subdir-objects
|
||||
DEFAULT_INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/intl -I$(top_builddir)/include/blip -I$(top_srcdir)/src/hw_sound
|
||||
noinst_LIBRARIES = libgb.a
|
||||
gb_SOURCES = gb.cpp gfx.cpp gbGlobals.cpp memory.cpp sound.cpp z80.cpp
|
||||
libgb_a_SOURCES = $(gb_SOURCES)
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .cpp .lo .o .obj
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/gb/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu src/gb/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
clean-noinstLIBRARIES:
|
||||
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
|
||||
libgb.a: $(libgb_a_OBJECTS) $(libgb_a_DEPENDENCIES)
|
||||
$(AM_V_at)-rm -f libgb.a
|
||||
$(AM_V_AR)$(libgb_a_AR) libgb.a $(libgb_a_OBJECTS) $(libgb_a_LIBADD)
|
||||
$(AM_V_at)$(RANLIB) libgb.a
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gb.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gbGlobals.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfx.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memory.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sound.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/z80.Po@am__quote@
|
||||
|
||||
.cpp.o:
|
||||
@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
|
||||
@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
|
||||
@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
|
||||
@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
|
||||
|
||||
.cpp.obj:
|
||||
@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
|
||||
@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
|
||||
@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
|
||||
@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
|
||||
.cpp.lo:
|
||||
@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
|
||||
@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
|
||||
@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo
|
||||
@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(LIBRARIES)
|
||||
installdirs:
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
|
||||
mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am:
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
|
||||
clean-libtool clean-noinstLIBRARIES ctags distclean \
|
||||
distclean-compile distclean-generic distclean-libtool \
|
||||
distclean-tags distdir dvi dvi-am html html-am info info-am \
|
||||
install install-am install-data install-data-am install-dvi \
|
||||
install-dvi-am install-exec install-exec-am install-html \
|
||||
install-html-am install-info install-info-am install-man \
|
||||
install-pdf install-pdf-am install-ps install-ps-am \
|
||||
install-strip installcheck installcheck-am installdirs \
|
||||
maintainer-clean maintainer-clean-generic mostlyclean \
|
||||
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
|
||||
pdf pdf-am ps ps-am tags uninstall uninstall-am
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
File diff suppressed because it is too large
Load Diff
|
@ -1,70 +0,0 @@
|
|||
// -*- C++ -*-
|
||||
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
||||
// Copyright (C) 1999-2003 Forgotten
|
||||
// Copyright (C) 2004 Forgotten and the VBA development team
|
||||
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or(at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#ifndef VBA_GB_GB_H
|
||||
#define VBA_GB_GB_H
|
||||
|
||||
namespace MDFN_IEN_GB
|
||||
{
|
||||
|
||||
#define C_FLAG 0x10
|
||||
#define H_FLAG 0x20
|
||||
#define N_FLAG 0x40
|
||||
#define Z_FLAG 0x80
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
#ifndef LSB_FIRST
|
||||
uint8 B1, B0;
|
||||
#else
|
||||
uint8 B0,B1;
|
||||
#endif
|
||||
} B;
|
||||
uint16 W;
|
||||
} gbRegister;
|
||||
|
||||
extern uint8 gbOAM[0xA0];
|
||||
extern uint8 register_IF, register_IE, register_KEY1;
|
||||
|
||||
extern void gbEmulate(int);
|
||||
extern void gbSoundReset();
|
||||
extern void gbReset();
|
||||
extern void gbCleanUp();
|
||||
extern bool gbWriteBatteryFile(const char *);
|
||||
extern bool gbWriteBatteryFile(const char *, bool);
|
||||
extern bool gbReadBatteryFile(const char *);
|
||||
extern bool gbWriteSaveState(const char *);
|
||||
extern bool gbWriteMemSaveState(char *, int);
|
||||
extern bool gbReadSaveState(const char *);
|
||||
extern bool gbReadMemSaveState(char *, int);
|
||||
extern void gbSgbRenderBorder();
|
||||
extern bool gbWritePNGFile(const char *);
|
||||
extern bool gbWriteBMPFile(const char *);
|
||||
extern bool gbReadGSASnapshot(const char *);
|
||||
|
||||
extern struct EmulatedSystem GBSystem;
|
||||
|
||||
|
||||
void gbWriteMemory(uint16 address, uint8 value);
|
||||
uint8 gbReadMemory(uint16 address);
|
||||
void gbSpeedSwitch();
|
||||
|
||||
}
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,51 +0,0 @@
|
|||
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
||||
// Copyright (C) 1999-2003 Forgotten
|
||||
// Copyright (C) 2004 Forgotten and the VBA development team
|
||||
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or(at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "../mednafen.h"
|
||||
|
||||
namespace MDFN_IEN_GB
|
||||
{
|
||||
|
||||
uint8 *gbMemoryMap[16];
|
||||
|
||||
int gbRomSizeMask = 0;
|
||||
int gbRomSize = 0;
|
||||
int gbRamSizeMask = 0;
|
||||
int gbRamSize = 0;
|
||||
|
||||
uint8 *gbVram = NULL;
|
||||
uint8 *gbRom = NULL;
|
||||
uint8 *gbRam = NULL;
|
||||
uint8 *gbWram = NULL;
|
||||
uint16 *gbLineBuffer = NULL;
|
||||
|
||||
uint16 gbPalette[128];
|
||||
uint8 gbBgp[4] = { 0, 1, 2, 3};
|
||||
uint8 gbObp0[4] = { 0, 1, 2, 3};
|
||||
uint8 gbObp1[4] = { 0, 1, 2, 3};
|
||||
int gbWindowLine = -1;
|
||||
|
||||
int gbCgbMode = 0;
|
||||
|
||||
int gbPaletteOption = 0;
|
||||
int gbEmulatorType = 0;
|
||||
int gbDmaTicks = 0;
|
||||
|
||||
uint8 (*gbSerialFunction)(uint8) = NULL;
|
||||
|
||||
}
|
|
@ -1,66 +0,0 @@
|
|||
// -*- C++ -*-
|
||||
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
||||
// Copyright (C) 1999-2003 Forgotten
|
||||
// Copyright (C) 2004 Forgotten and the VBA development team
|
||||
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or(at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
namespace MDFN_IEN_GB
|
||||
{
|
||||
|
||||
extern int gbRomSizeMask;
|
||||
extern int gbRomSize;
|
||||
extern int gbRamSize;
|
||||
extern int gbRamSizeMask;
|
||||
|
||||
extern uint8 *gbRom;
|
||||
extern uint8 *gbRam;
|
||||
extern uint8 *gbVram;
|
||||
extern uint8 *gbWram;
|
||||
extern uint16 *gbLineBuffer;
|
||||
|
||||
extern uint8 *gbMemoryMap[16];
|
||||
|
||||
extern int gbFrameSkip;
|
||||
extern int gbPaletteOption;
|
||||
extern int gbEmulatorType;
|
||||
extern int gbCgbMode;
|
||||
extern int gbSgbMode;
|
||||
extern int gbWindowLine;
|
||||
extern int gbSpeed;
|
||||
extern uint8 gbBgp[4];
|
||||
extern uint8 gbObp0[4];
|
||||
extern uint8 gbObp1[4];
|
||||
extern uint16 gbPalette[128];
|
||||
|
||||
extern uint8 register_LCDC;
|
||||
extern uint8 register_LY;
|
||||
extern uint8 register_SCY;
|
||||
extern uint8 register_SCX;
|
||||
extern uint8 register_WY;
|
||||
extern uint8 register_WX;
|
||||
extern uint8 register_VBK;
|
||||
|
||||
extern int emulating;
|
||||
|
||||
extern int gbDmaTicks;
|
||||
|
||||
extern void gbRenderLine();
|
||||
extern void gbDrawSprites();
|
||||
|
||||
extern uint32 gblayerSettings;
|
||||
extern uint8 (*gbSerialFunction)(uint8);
|
||||
|
||||
}
|
|
@ -1,479 +0,0 @@
|
|||
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
||||
// Copyright (C) 1999-2003 Forgotten
|
||||
// Copyright (C) 2004 Forgotten and the VBA development team
|
||||
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or(at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "../mednafen.h"
|
||||
#include <memory.h>
|
||||
|
||||
#include "gbGlobals.h"
|
||||
#include "gb.h"
|
||||
|
||||
namespace MDFN_IEN_GB
|
||||
{
|
||||
|
||||
static const uint8 gbInvertTab[256] =
|
||||
{
|
||||
0x00,0x80,0x40,0xc0,0x20,0xa0,0x60,0xe0,
|
||||
0x10,0x90,0x50,0xd0,0x30,0xb0,0x70,0xf0,
|
||||
0x08,0x88,0x48,0xc8,0x28,0xa8,0x68,0xe8,
|
||||
0x18,0x98,0x58,0xd8,0x38,0xb8,0x78,0xf8,
|
||||
0x04,0x84,0x44,0xc4,0x24,0xa4,0x64,0xe4,
|
||||
0x14,0x94,0x54,0xd4,0x34,0xb4,0x74,0xf4,
|
||||
0x0c,0x8c,0x4c,0xcc,0x2c,0xac,0x6c,0xec,
|
||||
0x1c,0x9c,0x5c,0xdc,0x3c,0xbc,0x7c,0xfc,
|
||||
0x02,0x82,0x42,0xc2,0x22,0xa2,0x62,0xe2,
|
||||
0x12,0x92,0x52,0xd2,0x32,0xb2,0x72,0xf2,
|
||||
0x0a,0x8a,0x4a,0xca,0x2a,0xaa,0x6a,0xea,
|
||||
0x1a,0x9a,0x5a,0xda,0x3a,0xba,0x7a,0xfa,
|
||||
0x06,0x86,0x46,0xc6,0x26,0xa6,0x66,0xe6,
|
||||
0x16,0x96,0x56,0xd6,0x36,0xb6,0x76,0xf6,
|
||||
0x0e,0x8e,0x4e,0xce,0x2e,0xae,0x6e,0xee,
|
||||
0x1e,0x9e,0x5e,0xde,0x3e,0xbe,0x7e,0xfe,
|
||||
0x01,0x81,0x41,0xc1,0x21,0xa1,0x61,0xe1,
|
||||
0x11,0x91,0x51,0xd1,0x31,0xb1,0x71,0xf1,
|
||||
0x09,0x89,0x49,0xc9,0x29,0xa9,0x69,0xe9,
|
||||
0x19,0x99,0x59,0xd9,0x39,0xb9,0x79,0xf9,
|
||||
0x05,0x85,0x45,0xc5,0x25,0xa5,0x65,0xe5,
|
||||
0x15,0x95,0x55,0xd5,0x35,0xb5,0x75,0xf5,
|
||||
0x0d,0x8d,0x4d,0xcd,0x2d,0xad,0x6d,0xed,
|
||||
0x1d,0x9d,0x5d,0xdd,0x3d,0xbd,0x7d,0xfd,
|
||||
0x03,0x83,0x43,0xc3,0x23,0xa3,0x63,0xe3,
|
||||
0x13,0x93,0x53,0xd3,0x33,0xb3,0x73,0xf3,
|
||||
0x0b,0x8b,0x4b,0xcb,0x2b,0xab,0x6b,0xeb,
|
||||
0x1b,0x9b,0x5b,0xdb,0x3b,0xbb,0x7b,0xfb,
|
||||
0x07,0x87,0x47,0xc7,0x27,0xa7,0x67,0xe7,
|
||||
0x17,0x97,0x57,0xd7,0x37,0xb7,0x77,0xf7,
|
||||
0x0f,0x8f,0x4f,0xcf,0x2f,0xaf,0x6f,0xef,
|
||||
0x1f,0x9f,0x5f,0xdf,0x3f,0xbf,0x7f,0xff
|
||||
};
|
||||
|
||||
uint16 gbLineMix[160];
|
||||
|
||||
void gbRenderLine()
|
||||
{
|
||||
uint8 * bank0;
|
||||
uint8 * bank1;
|
||||
|
||||
if(gbCgbMode) {
|
||||
bank0 = &gbVram[0x0000];
|
||||
bank1 = &gbVram[0x2000];
|
||||
} else {
|
||||
bank0 = &gbVram[0x0000];
|
||||
bank1 = NULL;
|
||||
}
|
||||
|
||||
int tile_map = 0x1800;
|
||||
if((register_LCDC & 8) != 0)
|
||||
tile_map = 0x1c00;
|
||||
|
||||
int tile_pattern = 0x0800;
|
||||
|
||||
if((register_LCDC & 16) != 0)
|
||||
tile_pattern = 0x0000;
|
||||
|
||||
int x = 0;
|
||||
int y = register_LY;
|
||||
|
||||
if(y >= 144)
|
||||
return;
|
||||
|
||||
int sx = register_SCX;
|
||||
int sy = register_SCY;
|
||||
|
||||
sy+=y;
|
||||
|
||||
sy &= 255;
|
||||
|
||||
int tx = sx >> 3;
|
||||
int ty = sy >> 3;
|
||||
|
||||
int bx = 1 << (7 - (sx & 7));
|
||||
int by = sy & 7;
|
||||
|
||||
int tile_map_line_y = tile_map + ty * 32;
|
||||
|
||||
int tile_map_address = tile_map_line_y + tx;
|
||||
|
||||
uint8 attrs = 0;
|
||||
if(bank1 != NULL)
|
||||
attrs = bank1[tile_map_address];
|
||||
|
||||
uint8 tile = bank0[tile_map_address];
|
||||
|
||||
tile_map_address++;
|
||||
|
||||
if((register_LCDC & 16) == 0) {
|
||||
if(tile < 128) tile += 128;
|
||||
else tile -= 128;
|
||||
}
|
||||
|
||||
int tile_pattern_address = tile_pattern + tile * 16 + by*2;
|
||||
|
||||
if(register_LCDC & 0x80)
|
||||
{
|
||||
if((register_LCDC & 0x01 || gbCgbMode) && (gblayerSettings & 0x01))
|
||||
{
|
||||
while(x < 160) {
|
||||
uint8 tile_a = 0;
|
||||
uint8 tile_b = 0;
|
||||
|
||||
if(attrs & 0x40) {
|
||||
tile_pattern_address = tile_pattern + tile * 16 + (7-by)*2;
|
||||
}
|
||||
|
||||
if(attrs & 0x08) {
|
||||
tile_a = bank1[tile_pattern_address++];
|
||||
tile_b = bank1[tile_pattern_address];
|
||||
} else {
|
||||
tile_a = bank0[tile_pattern_address++];
|
||||
tile_b = bank0[tile_pattern_address];
|
||||
}
|
||||
|
||||
if(attrs & 0x20) {
|
||||
tile_a = gbInvertTab[tile_a];
|
||||
tile_b = gbInvertTab[tile_b];
|
||||
}
|
||||
|
||||
while(bx > 0) {
|
||||
uint8 c = (tile_a & bx) ? 1 : 0;
|
||||
c += ((tile_b & bx) ? 2 : 0);
|
||||
|
||||
gbLineBuffer[x] = c; // mark the gbLineBuffer color
|
||||
|
||||
if(attrs & 0x80)
|
||||
gbLineBuffer[x] |= 0x300;
|
||||
|
||||
if(gbCgbMode)
|
||||
{
|
||||
c = c + (attrs & 7)*4;
|
||||
gbLineMix[x] = gbPalette[c];
|
||||
}
|
||||
else
|
||||
{
|
||||
gbLineMix[x] = gbBgp[c];
|
||||
}
|
||||
|
||||
x++;
|
||||
if(x >= 160)
|
||||
break;
|
||||
bx >>= 1;
|
||||
}
|
||||
tx++;
|
||||
if(tx == 32)
|
||||
tx = 0;
|
||||
bx = 128;
|
||||
|
||||
if(bank1)
|
||||
attrs = bank1[tile_map_line_y + tx];
|
||||
|
||||
tile = bank0[tile_map_line_y + tx];
|
||||
|
||||
if((register_LCDC & 16) == 0) {
|
||||
if(tile < 128) tile += 128;
|
||||
else tile -= 128;
|
||||
}
|
||||
tile_pattern_address = tile_pattern + tile * 16 + by * 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int fill_color = gbCgbMode ? gbPalette[0] : 0;
|
||||
|
||||
for(int i = 0; i < 160; i++)
|
||||
{
|
||||
gbLineMix[i] = fill_color;
|
||||
gbLineBuffer[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// do the window display
|
||||
if((register_LCDC & 0x20) && (gblayerSettings & 0x02)) {
|
||||
int wy = register_WY;
|
||||
|
||||
if(y >= wy) {
|
||||
int wx = register_WX;
|
||||
wx -= 7;
|
||||
|
||||
if( wx <= 159 && gbWindowLine <= 143) {
|
||||
|
||||
tile_map = 0x1800;
|
||||
|
||||
if((register_LCDC & 0x40) != 0)
|
||||
tile_map = 0x1c00;
|
||||
|
||||
if(gbWindowLine == -1) {
|
||||
gbWindowLine = 0;
|
||||
}
|
||||
|
||||
tx = 0;
|
||||
ty = gbWindowLine >> 3;
|
||||
|
||||
bx = 128;
|
||||
by = gbWindowLine & 7;
|
||||
|
||||
if(wx < 0) {
|
||||
bx >>= (-wx);
|
||||
wx = 0;
|
||||
}
|
||||
|
||||
tile_map_line_y = tile_map + ty * 32;
|
||||
|
||||
tile_map_address = tile_map_line_y + tx;
|
||||
|
||||
x = wx;
|
||||
|
||||
tile = bank0[tile_map_address];
|
||||
|
||||
attrs = 0;
|
||||
|
||||
if(bank1)
|
||||
attrs = bank1[tile_map_address];
|
||||
tile_map_address++;
|
||||
|
||||
if((register_LCDC & 16) == 0) {
|
||||
if(tile < 128) tile += 128;
|
||||
else tile -= 128;
|
||||
}
|
||||
|
||||
tile_pattern_address = tile_pattern + tile * 16 + by*2;
|
||||
|
||||
while(x < 160) {
|
||||
uint8 tile_a = 0;
|
||||
uint8 tile_b = 0;
|
||||
|
||||
if(attrs & 0x40) {
|
||||
tile_pattern_address = tile_pattern + tile * 16 + (7-by)*2;
|
||||
}
|
||||
|
||||
if(attrs & 0x08) {
|
||||
tile_a = bank1[tile_pattern_address++];
|
||||
tile_b = bank1[tile_pattern_address];
|
||||
} else {
|
||||
tile_a = bank0[tile_pattern_address++];
|
||||
tile_b = bank0[tile_pattern_address];
|
||||
}
|
||||
|
||||
if(attrs & 0x20) {
|
||||
tile_a = gbInvertTab[tile_a];
|
||||
tile_b = gbInvertTab[tile_b];
|
||||
}
|
||||
|
||||
while(bx > 0) {
|
||||
uint8 c = (tile_a & bx) != 0 ? 1 : 0;
|
||||
c += ((tile_b & bx) != 0 ? 2 : 0);
|
||||
|
||||
if(attrs & 0x80)
|
||||
gbLineBuffer[x] = 0x300 + c;
|
||||
else
|
||||
gbLineBuffer[x] = 0x100 + c;
|
||||
|
||||
if(gbCgbMode)
|
||||
{
|
||||
c = c + (attrs & 7) * 4;
|
||||
gbLineMix[x] = gbPalette[c];
|
||||
}
|
||||
else
|
||||
{
|
||||
gbLineMix[x] = gbBgp[c];
|
||||
}
|
||||
|
||||
x++;
|
||||
if(x >= 160)
|
||||
break;
|
||||
bx >>= 1;
|
||||
}
|
||||
tx++;
|
||||
if(tx == 32)
|
||||
tx = 0;
|
||||
bx = 128;
|
||||
tile = bank0[tile_map_line_y + tx];
|
||||
if(bank1)
|
||||
attrs = bank1[tile_map_line_y + tx];
|
||||
|
||||
if((register_LCDC & 16) == 0) {
|
||||
if(tile < 128) tile += 128;
|
||||
else tile -= 128;
|
||||
}
|
||||
tile_pattern_address = tile_pattern + tile * 16 + by * 2;
|
||||
}
|
||||
gbWindowLine++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int fill_color = gbCgbMode ? gbPalette[0] : 8;
|
||||
|
||||
for(int i = 0; i < 160; i++)
|
||||
{
|
||||
gbLineMix[i] = fill_color;
|
||||
gbLineBuffer[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void gbDrawSpriteTile(int tile, int x,int y,int t, int flags,
|
||||
int size,int spriteNumber)
|
||||
{
|
||||
uint8 * bank0;
|
||||
uint8 * bank1;
|
||||
if(gbCgbMode) {
|
||||
if(register_VBK & 1) {
|
||||
bank0 = &gbVram[0x0000];
|
||||
bank1 = &gbVram[0x2000];
|
||||
} else {
|
||||
bank0 = &gbVram[0x0000];
|
||||
bank1 = &gbVram[0x2000];
|
||||
}
|
||||
} else {
|
||||
bank0 = &gbVram[0x0000];
|
||||
bank1 = NULL;
|
||||
}
|
||||
|
||||
int init = 0x0000;
|
||||
|
||||
uint8 *pal = gbObp0;
|
||||
|
||||
int flipx = (flags & 0x20);
|
||||
int flipy = (flags & 0x40);
|
||||
|
||||
if((flags & 0x10))
|
||||
pal = gbObp1;
|
||||
|
||||
if(flipy) {
|
||||
t = (size ? 15 : 7) - t;
|
||||
}
|
||||
|
||||
int prio = flags & 0x80;
|
||||
|
||||
int address = init + tile * 16 + 2*t;
|
||||
int a = 0;
|
||||
int b = 0;
|
||||
|
||||
if(gbCgbMode && flags & 0x08) {
|
||||
a = bank1[address++];
|
||||
b = bank1[address++];
|
||||
} else {
|
||||
a = bank0[address++];
|
||||
b = bank0[address++];
|
||||
}
|
||||
|
||||
for(int xx = 0; xx < 8; xx++) {
|
||||
uint8 mask = 1 << (7-xx);
|
||||
uint8 c = 0;
|
||||
if( (a & mask))
|
||||
c++;
|
||||
if( (b & mask))
|
||||
c+=2;
|
||||
|
||||
if(c==0) continue;
|
||||
|
||||
int xxx = xx+x;
|
||||
if(flipx)
|
||||
xxx = (7-xx+x);
|
||||
|
||||
if(xxx < 0 || xxx > 159)
|
||||
continue;
|
||||
|
||||
uint16 color = gbLineBuffer[xxx];
|
||||
|
||||
if(prio) {
|
||||
if(color < 0x200 && ((color & 0xFF) != 0))
|
||||
continue;
|
||||
}
|
||||
if(color >= 0x300 && color != 0x300)
|
||||
continue;
|
||||
else if(color >= 0x200 && color < 0x300) {
|
||||
int sprite = color & 0xff;
|
||||
|
||||
int spriteX = gbOAM[4 * sprite + 1] - 8;
|
||||
|
||||
if(spriteX == x) {
|
||||
if(sprite < spriteNumber)
|
||||
continue;
|
||||
} else {
|
||||
if(gbCgbMode) {
|
||||
if(sprite < spriteNumber)
|
||||
continue;
|
||||
} else {
|
||||
if(spriteX < x+8)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
gbLineBuffer[xxx] = 0x200 + spriteNumber;
|
||||
|
||||
// make sure that sprites will work even in CGB mode
|
||||
if(gbCgbMode)
|
||||
{
|
||||
c = c + (flags & 0x07)*4 + 32;
|
||||
gbLineMix[xxx] = gbPalette[c];
|
||||
}
|
||||
else
|
||||
{
|
||||
c = pal[c];
|
||||
c += 4;
|
||||
gbLineMix[xxx] = c;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void gbDrawSprites()
|
||||
{
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
int count = 0;
|
||||
|
||||
int size = (register_LCDC & 4);
|
||||
|
||||
if(!(register_LCDC & 0x80))
|
||||
return;
|
||||
|
||||
if((register_LCDC & 2) && (gblayerSettings & 0x04)) {
|
||||
int yc = register_LY;
|
||||
|
||||
int address = 0;
|
||||
for(int i = 0; i < 40; i++) {
|
||||
y = gbOAM[address++];
|
||||
x = gbOAM[address++];
|
||||
int tile = gbOAM[address++];
|
||||
if(size)
|
||||
tile &= 254;
|
||||
int flags = gbOAM[address++];
|
||||
|
||||
if(x > 0 && y > 0 && x < 168 && y < 160) {
|
||||
// check if sprite intersects current line
|
||||
int t = yc -y + 16;
|
||||
if(size && t >=0 && t < 16) {
|
||||
gbDrawSpriteTile(tile,x-8,yc,t,flags,size,i);
|
||||
count++;
|
||||
} else if(!size && t >= 0 && t < 8) {
|
||||
gbDrawSpriteTile(tile, x-8, yc, t, flags,size,i);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
// sprite limit reached!
|
||||
if(count >= 10)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,952 +0,0 @@
|
|||
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
||||
// Copyright (C) 1999-2003 Forgotten
|
||||
// Copyright (C) 2004 Forgotten and the VBA development team
|
||||
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or(at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "../mednafen.h"
|
||||
#include "../mempatcher.h"
|
||||
#include "gbGlobals.h"
|
||||
#include "memory.h"
|
||||
|
||||
namespace MDFN_IEN_GB
|
||||
{
|
||||
|
||||
mapperMBC1 gbDataMBC1 = {
|
||||
0, // RAM enable
|
||||
1, // ROM bank
|
||||
0, // RAM bank or high address
|
||||
0, // memory model
|
||||
};
|
||||
|
||||
void memoryUpdateMapMBC1()
|
||||
{
|
||||
int tmpAddress = gbDataMBC1.mapperROMBank << 14;
|
||||
|
||||
// check current model
|
||||
if(gbDataMBC1.mapperMemoryModel == 0) {
|
||||
// model is 16/8, so we have a high address in use
|
||||
tmpAddress |= gbDataMBC1.mapperRAMBank << 19;
|
||||
}
|
||||
|
||||
gbMemoryMap[0x0a] = &gbRam[0];
|
||||
gbMemoryMap[0x0b] = &gbRam[0x1000];
|
||||
|
||||
tmpAddress &= gbRomSizeMask;
|
||||
gbMemoryMap[0x04] = &gbRom[tmpAddress];
|
||||
gbMemoryMap[0x05] = &gbRom[tmpAddress + 0x1000];
|
||||
gbMemoryMap[0x06] = &gbRom[tmpAddress + 0x2000];
|
||||
gbMemoryMap[0x07] = &gbRom[tmpAddress + 0x3000];
|
||||
|
||||
if((gbRamSize) && (gbDataMBC1.mapperMemoryModel == 1))
|
||||
{
|
||||
tmpAddress = gbDataMBC1.mapperRAMBank << 13;
|
||||
tmpAddress &= gbRamSizeMask;
|
||||
|
||||
MDFNMP_AddRAM(8192, 0xA000, &gbRam[tmpAddress]);
|
||||
gbMemoryMap[0x0a] = &gbRam[tmpAddress];
|
||||
gbMemoryMap[0x0b] = &gbRam[tmpAddress + 0x1000];
|
||||
}
|
||||
else
|
||||
MDFNMP_AddRAM(8192, 0xA000, gbRam);
|
||||
|
||||
}
|
||||
|
||||
// MBC1 ROM write registers
|
||||
void mapperMBC1ROM(uint16 address, uint8 value)
|
||||
{
|
||||
switch(address & 0x6000)
|
||||
{
|
||||
case 0x0000: // RAM enable register
|
||||
gbDataMBC1.mapperRAMEnable = ( ( value & 0x0a) == 0x0a ? 1 : 0);
|
||||
break;
|
||||
|
||||
case 0x2000: // ROM bank select
|
||||
// value = value & 0x1f;
|
||||
if((value & 0x1f) == 0)
|
||||
value++;
|
||||
|
||||
gbDataMBC1.mapperROMBank = value;
|
||||
memoryUpdateMapMBC1();
|
||||
break;
|
||||
|
||||
case 0x4000: // RAM bank select
|
||||
gbDataMBC1.mapperRAMBank = value & 0x03;
|
||||
memoryUpdateMapMBC1();
|
||||
break;
|
||||
|
||||
case 0x6000: // memory model select
|
||||
gbDataMBC1.mapperMemoryModel = value & 1;
|
||||
memoryUpdateMapMBC1();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// MBC1 RAM write
|
||||
void mapperMBC1RAM(uint16 address, uint8 value)
|
||||
{
|
||||
if(gbDataMBC1.mapperRAMEnable) {
|
||||
if(gbRamSize) {
|
||||
gbMemoryMap[address >> 12][address & 0x0fff & gbRamSizeMask] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mapperMBC2 gbDataMBC2 = {
|
||||
0, // RAM enable
|
||||
1 // ROM bank
|
||||
};
|
||||
|
||||
// MBC2 ROM write registers
|
||||
void mapperMBC2ROM(uint16 address, uint8 value)
|
||||
{
|
||||
switch(address & 0x6000) {
|
||||
case 0x0000: // RAM enable
|
||||
if(!(address & 0x0100)) {
|
||||
gbDataMBC2.mapperRAMEnable = (value & 0x0f) == 0x0a;
|
||||
}
|
||||
break;
|
||||
case 0x2000: // ROM bank select
|
||||
if(address & 0x0100) {
|
||||
value &= 0x0f;
|
||||
|
||||
if(value == 0)
|
||||
value = 1;
|
||||
if(gbDataMBC2.mapperROMBank != value) {
|
||||
gbDataMBC2.mapperROMBank = value;
|
||||
|
||||
int tmpAddress = value << 14;
|
||||
|
||||
tmpAddress &= gbRomSizeMask;
|
||||
|
||||
gbMemoryMap[0x04] = &gbRom[tmpAddress];
|
||||
gbMemoryMap[0x05] = &gbRom[tmpAddress + 0x1000];
|
||||
gbMemoryMap[0x06] = &gbRom[tmpAddress + 0x2000];
|
||||
gbMemoryMap[0x07] = &gbRom[tmpAddress + 0x3000];
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// MBC2 RAM write
|
||||
void mapperMBC2RAM(uint16 address, uint8 value)
|
||||
{
|
||||
if(gbDataMBC2.mapperRAMEnable) {
|
||||
if(gbRamSize && address < 0xa200) {
|
||||
gbMemoryMap[address >> 12][address & 0x0fff & gbRamSizeMask] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void memoryUpdateMapMBC2()
|
||||
{
|
||||
int tmpAddress = gbDataMBC2.mapperROMBank << 14;
|
||||
|
||||
tmpAddress &= gbRomSizeMask;
|
||||
|
||||
gbMemoryMap[0x04] = &gbRom[tmpAddress];
|
||||
gbMemoryMap[0x05] = &gbRom[tmpAddress + 0x1000];
|
||||
gbMemoryMap[0x06] = &gbRom[tmpAddress + 0x2000];
|
||||
gbMemoryMap[0x07] = &gbRom[tmpAddress + 0x3000];
|
||||
}
|
||||
|
||||
mapperMBC3 gbDataMBC3 = {
|
||||
0, // RAM enable
|
||||
1, // ROM bank
|
||||
0, // RAM bank
|
||||
0, // RAM address
|
||||
0, // timer clock latch
|
||||
0, // timer clock register
|
||||
0, // timer seconds
|
||||
0, // timer minutes
|
||||
0, // timer hours
|
||||
0, // timer days
|
||||
0, // timer control
|
||||
0, // timer latched seconds
|
||||
0, // timer latched minutes
|
||||
0, // timer latched hours
|
||||
0, // timer latched days
|
||||
0, // timer latched control
|
||||
~0ULL // last time
|
||||
};
|
||||
|
||||
void memoryUpdateMBC3Clock()
|
||||
{
|
||||
time_t now = time(NULL);
|
||||
time_t diff = now - gbDataMBC3.mapperLastTime;
|
||||
if(diff > 0) {
|
||||
// update the clock according to the last update time
|
||||
gbDataMBC3.mapperSeconds += diff % 60;
|
||||
if(gbDataMBC3.mapperSeconds > 59) {
|
||||
gbDataMBC3.mapperSeconds -= 60;
|
||||
gbDataMBC3.mapperMinutes++;
|
||||
}
|
||||
|
||||
diff /= 60;
|
||||
|
||||
gbDataMBC3.mapperMinutes += diff % 60;
|
||||
if(gbDataMBC3.mapperMinutes > 60) {
|
||||
gbDataMBC3.mapperMinutes -= 60;
|
||||
gbDataMBC3.mapperHours++;
|
||||
}
|
||||
|
||||
diff /= 60;
|
||||
|
||||
gbDataMBC3.mapperHours += diff % 24;
|
||||
if(gbDataMBC3.mapperHours > 24) {
|
||||
gbDataMBC3.mapperHours -= 24;
|
||||
gbDataMBC3.mapperDays++;
|
||||
}
|
||||
diff /= 24;
|
||||
|
||||
gbDataMBC3.mapperDays += diff;
|
||||
if(gbDataMBC3.mapperDays > 255) {
|
||||
if(gbDataMBC3.mapperDays > 511) {
|
||||
gbDataMBC3.mapperDays %= 512;
|
||||
gbDataMBC3.mapperControl |= 0x80;
|
||||
}
|
||||
gbDataMBC3.mapperControl = (gbDataMBC3.mapperControl & 0xfe) |
|
||||
(gbDataMBC3.mapperDays>255 ? 1 : 0);
|
||||
}
|
||||
}
|
||||
gbDataMBC3.mapperLastTime = now;
|
||||
}
|
||||
|
||||
// MBC3 ROM write registers
|
||||
void mapperMBC3ROM(uint16 address, uint8 value)
|
||||
{
|
||||
int tmpAddress = 0;
|
||||
|
||||
switch(address & 0x6000) {
|
||||
case 0x0000: // RAM enable register
|
||||
gbDataMBC3.mapperRAMEnable = ( ( value & 0x0a) == 0x0a ? 1 : 0);
|
||||
break;
|
||||
case 0x2000: // ROM bank select
|
||||
value = value & 0x7f;
|
||||
if(value == 0)
|
||||
value = 1;
|
||||
if(value == gbDataMBC3.mapperROMBank)
|
||||
break;
|
||||
|
||||
tmpAddress = value << 14;
|
||||
|
||||
tmpAddress &= gbRomSizeMask;
|
||||
gbDataMBC3.mapperROMBank = value;
|
||||
gbMemoryMap[0x04] = &gbRom[tmpAddress];
|
||||
gbMemoryMap[0x05] = &gbRom[tmpAddress + 0x1000];
|
||||
gbMemoryMap[0x06] = &gbRom[tmpAddress + 0x2000];
|
||||
gbMemoryMap[0x07] = &gbRom[tmpAddress + 0x3000];
|
||||
|
||||
break;
|
||||
case 0x4000: // RAM bank select
|
||||
if(value < 8) {
|
||||
if(value == gbDataMBC3.mapperRAMBank)
|
||||
break;
|
||||
tmpAddress = value << 13;
|
||||
tmpAddress &= gbRamSizeMask;
|
||||
MDFNMP_AddRAM(8192, 0xA000, &gbRam[tmpAddress]);
|
||||
gbMemoryMap[0x0a] = &gbRam[tmpAddress];
|
||||
gbMemoryMap[0x0b] = &gbRam[tmpAddress + 0x1000];
|
||||
gbDataMBC3.mapperRAMBank = value;
|
||||
gbDataMBC3.mapperRAMAddress = tmpAddress;
|
||||
} else {
|
||||
if(gbDataMBC3.mapperRAMEnable) {
|
||||
gbDataMBC3.mapperRAMBank = -1;
|
||||
|
||||
gbDataMBC3.mapperClockRegister = value;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0x6000: // clock latch
|
||||
if(gbDataMBC3.mapperClockLatch == 0 && value == 1) {
|
||||
memoryUpdateMBC3Clock();
|
||||
gbDataMBC3.mapperLSeconds = gbDataMBC3.mapperSeconds;
|
||||
gbDataMBC3.mapperLMinutes = gbDataMBC3.mapperMinutes;
|
||||
gbDataMBC3.mapperLHours = gbDataMBC3.mapperHours;
|
||||
gbDataMBC3.mapperLDays = gbDataMBC3.mapperDays;
|
||||
gbDataMBC3.mapperLControl = gbDataMBC3.mapperControl;
|
||||
}
|
||||
if(value == 0x00 || value == 0x01)
|
||||
gbDataMBC3.mapperClockLatch = value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// MBC3 RAM write
|
||||
void mapperMBC3RAM(uint16 address, uint8 value)
|
||||
{
|
||||
if(gbDataMBC3.mapperRAMEnable) {
|
||||
if(gbDataMBC3.mapperRAMBank != -1) {
|
||||
if(gbRamSize) {
|
||||
gbMemoryMap[address>>12][address & 0x0fff & gbRamSizeMask] = value;
|
||||
}
|
||||
} else {
|
||||
time_t tmp;
|
||||
time(&tmp);
|
||||
|
||||
gbDataMBC3.mapperLastTime = tmp;
|
||||
switch(gbDataMBC3.mapperClockRegister) {
|
||||
case 0x08:
|
||||
gbDataMBC3.mapperSeconds = value;
|
||||
break;
|
||||
case 0x09:
|
||||
gbDataMBC3.mapperMinutes = value;
|
||||
break;
|
||||
case 0x0a:
|
||||
gbDataMBC3.mapperHours = value;
|
||||
break;
|
||||
case 0x0b:
|
||||
gbDataMBC3.mapperDays = value;
|
||||
break;
|
||||
case 0x0c:
|
||||
if(gbDataMBC3.mapperControl & 0x80)
|
||||
gbDataMBC3.mapperControl = 0x80 | value;
|
||||
else
|
||||
gbDataMBC3.mapperControl = value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MBC3 read RAM
|
||||
uint8 mapperMBC3ReadRAM(uint16 address)
|
||||
{
|
||||
if(gbDataMBC3.mapperRAMEnable) {
|
||||
if(gbDataMBC3.mapperRAMBank != -1) {
|
||||
return gbMemoryMap[address>>12][address & 0x0fff];
|
||||
}
|
||||
|
||||
switch(gbDataMBC3.mapperClockRegister) {
|
||||
case 0x08:
|
||||
return gbDataMBC3.mapperLSeconds;
|
||||
break;
|
||||
case 0x09:
|
||||
return gbDataMBC3.mapperLMinutes;
|
||||
break;
|
||||
case 0x0a:
|
||||
return gbDataMBC3.mapperLHours;
|
||||
break;
|
||||
case 0x0b:
|
||||
return gbDataMBC3.mapperLDays;
|
||||
break;
|
||||
case 0x0c:
|
||||
return gbDataMBC3.mapperLControl;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void memoryUpdateMapMBC3()
|
||||
{
|
||||
int tmpAddress = gbDataMBC3.mapperROMBank << 14;
|
||||
|
||||
tmpAddress &= gbRomSizeMask;
|
||||
|
||||
gbMemoryMap[0x04] = &gbRom[tmpAddress];
|
||||
gbMemoryMap[0x05] = &gbRom[tmpAddress + 0x1000];
|
||||
gbMemoryMap[0x06] = &gbRom[tmpAddress + 0x2000];
|
||||
gbMemoryMap[0x07] = &gbRom[tmpAddress + 0x3000];
|
||||
|
||||
if(gbDataMBC3.mapperRAMBank >= 0 && gbRamSize) {
|
||||
tmpAddress = gbDataMBC3.mapperRAMBank << 13;
|
||||
tmpAddress &= gbRamSizeMask;
|
||||
MDFNMP_AddRAM(8192, 0xA000, &gbRam[tmpAddress]);
|
||||
gbMemoryMap[0x0a] = &gbRam[tmpAddress];
|
||||
gbMemoryMap[0x0b] = &gbRam[tmpAddress + 0x1000];
|
||||
}
|
||||
}
|
||||
|
||||
mapperMBC5 gbDataMBC5 = {
|
||||
0, // RAM enable
|
||||
1, // ROM bank
|
||||
0, // RAM bank
|
||||
0, // ROM high address
|
||||
0, // RAM address
|
||||
0 // is rumble cartridge?
|
||||
};
|
||||
|
||||
// MBC5 ROM write registers
|
||||
void mapperMBC5ROM(uint16 address, uint8 value)
|
||||
{
|
||||
int tmpAddress = 0;
|
||||
|
||||
switch(address & 0x6000) {
|
||||
case 0x0000: // RAM enable register
|
||||
gbDataMBC5.mapperRAMEnable = ( ( value & 0x0a) == 0x0a ? 1 : 0);
|
||||
break;
|
||||
case 0x2000: // ROM bank select
|
||||
if(address < 0x3000) {
|
||||
value = value & 0xff;
|
||||
if(value == gbDataMBC5.mapperROMBank)
|
||||
break;
|
||||
|
||||
tmpAddress = (value << 14) | (gbDataMBC5.mapperROMHighAddress << 22) ;
|
||||
|
||||
tmpAddress &= gbRomSizeMask;
|
||||
gbDataMBC5.mapperROMBank = value;
|
||||
gbMemoryMap[0x04] = &gbRom[tmpAddress];
|
||||
gbMemoryMap[0x05] = &gbRom[tmpAddress + 0x1000];
|
||||
gbMemoryMap[0x06] = &gbRom[tmpAddress + 0x2000];
|
||||
gbMemoryMap[0x07] = &gbRom[tmpAddress + 0x3000];
|
||||
|
||||
} else {
|
||||
value = value & 1;
|
||||
if(value == gbDataMBC5.mapperROMHighAddress)
|
||||
break;
|
||||
|
||||
tmpAddress = (gbDataMBC5.mapperROMBank << 14) | (value << 22);
|
||||
|
||||
tmpAddress &= gbRomSizeMask;
|
||||
gbDataMBC5.mapperROMHighAddress = value;
|
||||
gbMemoryMap[0x04] = &gbRom[tmpAddress];
|
||||
gbMemoryMap[0x05] = &gbRom[tmpAddress + 0x1000];
|
||||
gbMemoryMap[0x06] = &gbRom[tmpAddress + 0x2000];
|
||||
gbMemoryMap[0x07] = &gbRom[tmpAddress + 0x3000];
|
||||
}
|
||||
break;
|
||||
case 0x4000: // RAM bank select
|
||||
if(gbDataMBC5.isRumbleCartridge)
|
||||
value &= 0x07;
|
||||
else
|
||||
value &= 0x0f;
|
||||
if(value == gbDataMBC5.mapperRAMBank)
|
||||
break;
|
||||
tmpAddress = value << 13;
|
||||
tmpAddress &= gbRamSizeMask;
|
||||
if(gbRamSize) {
|
||||
MDFNMP_AddRAM(8192, 0xA000, &gbRam[tmpAddress]);
|
||||
gbMemoryMap[0x0a] = &gbRam[tmpAddress];
|
||||
gbMemoryMap[0x0b] = &gbRam[tmpAddress + 0x1000];
|
||||
|
||||
gbDataMBC5.mapperRAMBank = value;
|
||||
gbDataMBC5.mapperRAMAddress = tmpAddress;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// MBC5 RAM write
|
||||
void mapperMBC5RAM(uint16 address, uint8 value)
|
||||
{
|
||||
if(gbDataMBC5.mapperRAMEnable) {
|
||||
if(gbRamSize) {
|
||||
gbMemoryMap[address >> 12][address & 0x0fff & gbRamSizeMask] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void memoryUpdateMapMBC5()
|
||||
{
|
||||
int tmpAddress = (gbDataMBC5.mapperROMBank << 14) |
|
||||
(gbDataMBC5.mapperROMHighAddress << 22) ;
|
||||
|
||||
tmpAddress &= gbRomSizeMask;
|
||||
gbMemoryMap[0x04] = &gbRom[tmpAddress];
|
||||
gbMemoryMap[0x05] = &gbRom[tmpAddress + 0x1000];
|
||||
gbMemoryMap[0x06] = &gbRom[tmpAddress + 0x2000];
|
||||
gbMemoryMap[0x07] = &gbRom[tmpAddress + 0x3000];
|
||||
|
||||
if(gbRamSize) {
|
||||
tmpAddress = gbDataMBC5.mapperRAMBank << 13;
|
||||
tmpAddress &= gbRamSizeMask;
|
||||
MDFNMP_AddRAM(8192, 0xA000, &gbRam[tmpAddress]);
|
||||
gbMemoryMap[0x0a] = &gbRam[tmpAddress];
|
||||
gbMemoryMap[0x0b] = &gbRam[tmpAddress + 0x1000];
|
||||
}
|
||||
}
|
||||
|
||||
mapperMBC7 gbDataMBC7 = {
|
||||
0, // RAM enable
|
||||
1, // ROM bank
|
||||
0, // RAM bank
|
||||
0, // RAM address
|
||||
0, // chip select
|
||||
0, // ??
|
||||
0, // mapper state
|
||||
0, // buffer for receiving serial data
|
||||
0, // idle state
|
||||
0, // count of bits received
|
||||
0, // command received
|
||||
0, // address received
|
||||
0, // write enable
|
||||
0, // value to return on ram
|
||||
};
|
||||
|
||||
// MBC7 ROM write registers
|
||||
void mapperMBC7ROM(uint16 address, uint8 value)
|
||||
{
|
||||
int tmpAddress = 0;
|
||||
|
||||
switch(address & 0x6000) {
|
||||
case 0x0000:
|
||||
break;
|
||||
case 0x2000: // ROM bank select
|
||||
value = value & 0x7f;
|
||||
if(value == 0)
|
||||
value = 1;
|
||||
|
||||
if(value == gbDataMBC7.mapperROMBank)
|
||||
break;
|
||||
|
||||
tmpAddress = (value << 14);
|
||||
|
||||
tmpAddress &= gbRomSizeMask;
|
||||
gbDataMBC7.mapperROMBank = value;
|
||||
gbMemoryMap[0x04] = &gbRom[tmpAddress];
|
||||
gbMemoryMap[0x05] = &gbRom[tmpAddress + 0x1000];
|
||||
gbMemoryMap[0x06] = &gbRom[tmpAddress + 0x2000];
|
||||
gbMemoryMap[0x07] = &gbRom[tmpAddress + 0x3000];
|
||||
break;
|
||||
case 0x4000: // RAM bank select/enable
|
||||
if(value < 8) {
|
||||
tmpAddress = (value&3) << 13;
|
||||
tmpAddress &= gbRamSizeMask;
|
||||
gbMemoryMap[0x0a] = &gbRam[0x0000];
|
||||
gbMemoryMap[0x0b] = &gbRam[0x1000];
|
||||
|
||||
gbDataMBC7.mapperRAMBank = value;
|
||||
gbDataMBC7.mapperRAMAddress = tmpAddress;
|
||||
gbDataMBC7.mapperRAMEnable = 0;
|
||||
} else {
|
||||
gbDataMBC7.mapperRAMEnable = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// MBC7 read RAM
|
||||
uint8 mapperMBC7ReadRAM(uint16 address)
|
||||
{
|
||||
switch(address & 0xa0f0) {
|
||||
case 0xa000:
|
||||
case 0xa010:
|
||||
case 0xa060:
|
||||
case 0xa070:
|
||||
return 0;
|
||||
case 0xa020:
|
||||
// sensor X low byte
|
||||
//return systemGetSensorX() & 255;
|
||||
case 0xa030:
|
||||
// sensor X high byte
|
||||
//return systemGetSensorX() >> 8;
|
||||
case 0xa040:
|
||||
// sensor Y low byte
|
||||
//return systemGetSensorY() & 255;
|
||||
case 0xa050:
|
||||
// sensor Y high byte
|
||||
//return systemGetSensorY() >> 8;
|
||||
case 0xa080:
|
||||
return gbDataMBC7.value;
|
||||
}
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
// MBC7 RAM write
|
||||
void mapperMBC7RAM(uint16 address, uint8 value)
|
||||
{
|
||||
if(address == 0xa080) {
|
||||
// special processing needed
|
||||
int oldCs = gbDataMBC7.cs,oldSk=gbDataMBC7.sk;
|
||||
|
||||
gbDataMBC7.cs=value>>7;
|
||||
gbDataMBC7.sk=(value>>6)&1;
|
||||
|
||||
if(!oldCs && gbDataMBC7.cs) {
|
||||
if(gbDataMBC7.state==5) {
|
||||
if(gbDataMBC7.writeEnable) {
|
||||
gbRam[gbDataMBC7.address*2]=gbDataMBC7.buffer>>8;
|
||||
gbRam[gbDataMBC7.address*2+1]=gbDataMBC7.buffer&0xff;
|
||||
}
|
||||
gbDataMBC7.state=0;
|
||||
gbDataMBC7.value=1;
|
||||
} else {
|
||||
gbDataMBC7.idle=true;
|
||||
gbDataMBC7.state=0;
|
||||
}
|
||||
}
|
||||
|
||||
if(!oldSk && gbDataMBC7.sk) {
|
||||
if(gbDataMBC7.idle) {
|
||||
if(value & 0x02) {
|
||||
gbDataMBC7.idle=false;
|
||||
gbDataMBC7.count=0;
|
||||
gbDataMBC7.state=1;
|
||||
}
|
||||
} else {
|
||||
switch(gbDataMBC7.state) {
|
||||
case 1:
|
||||
// receiving command
|
||||
gbDataMBC7.buffer <<= 1;
|
||||
gbDataMBC7.buffer |= (value & 0x02)?1:0;
|
||||
gbDataMBC7.count++;
|
||||
if(gbDataMBC7.count==2) {
|
||||
// finished receiving command
|
||||
gbDataMBC7.state=2;
|
||||
gbDataMBC7.count=0;
|
||||
gbDataMBC7.code=gbDataMBC7.buffer & 3;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
// receive address
|
||||
gbDataMBC7.buffer <<= 1;
|
||||
gbDataMBC7.buffer |= (value&0x02)?1:0;
|
||||
gbDataMBC7.count++;
|
||||
if(gbDataMBC7.count==8) {
|
||||
// finish receiving
|
||||
gbDataMBC7.state=3;
|
||||
gbDataMBC7.count=0;
|
||||
gbDataMBC7.address=gbDataMBC7.buffer&0xff;
|
||||
if(gbDataMBC7.code==0) {
|
||||
if((gbDataMBC7.address>>6)==0) {
|
||||
gbDataMBC7.writeEnable=0;
|
||||
gbDataMBC7.state=0;
|
||||
} else if((gbDataMBC7.address>>6) == 3) {
|
||||
gbDataMBC7.writeEnable=1;
|
||||
gbDataMBC7.state=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
gbDataMBC7.buffer <<= 1;
|
||||
gbDataMBC7.buffer |= (value&0x02)?1:0;
|
||||
gbDataMBC7.count++;
|
||||
|
||||
switch(gbDataMBC7.code) {
|
||||
case 0:
|
||||
if(gbDataMBC7.count==16) {
|
||||
if((gbDataMBC7.address>>6)==0) {
|
||||
gbDataMBC7.writeEnable = 0;
|
||||
gbDataMBC7.state=0;
|
||||
} else if((gbDataMBC7.address>>6)==1) {
|
||||
if (gbDataMBC7.writeEnable) {
|
||||
for(int i=0;i<256;i++) {
|
||||
gbRam[i*2] = gbDataMBC7.buffer >> 8;
|
||||
gbRam[i*2+1] = gbDataMBC7.buffer & 0xff;
|
||||
}
|
||||
}
|
||||
gbDataMBC7.state=5;
|
||||
} else if((gbDataMBC7.address>>6) == 2) {
|
||||
if (gbDataMBC7.writeEnable) {
|
||||
for(int i=0;i<256;i++)
|
||||
*((uint16 *)&gbRam[i*2]) = 0xffff;
|
||||
}
|
||||
gbDataMBC7.state=5;
|
||||
} else if((gbDataMBC7.address>>6)==3) {
|
||||
gbDataMBC7.writeEnable = 1;
|
||||
gbDataMBC7.state=0;
|
||||
}
|
||||
gbDataMBC7.count=0;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if(gbDataMBC7.count==16) {
|
||||
gbDataMBC7.count=0;
|
||||
gbDataMBC7.state=5;
|
||||
gbDataMBC7.value=0;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if(gbDataMBC7.count==1) {
|
||||
gbDataMBC7.state=4;
|
||||
gbDataMBC7.count=0;
|
||||
gbDataMBC7.buffer = (gbRam[gbDataMBC7.address*2]<<8)|
|
||||
(gbRam[gbDataMBC7.address*2+1]);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if(gbDataMBC7.count==16) {
|
||||
gbDataMBC7.count=0;
|
||||
gbDataMBC7.state=5;
|
||||
gbDataMBC7.value=0;
|
||||
gbDataMBC7.buffer=0xffff;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (oldSk && !gbDataMBC7.sk) {
|
||||
if (gbDataMBC7.state==4) {
|
||||
gbDataMBC7.value = (gbDataMBC7.buffer & 0x8000)?1:0;
|
||||
gbDataMBC7.buffer <<= 1;
|
||||
gbDataMBC7.count++;
|
||||
if (gbDataMBC7.count==16) {
|
||||
gbDataMBC7.count=0;
|
||||
gbDataMBC7.state=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void memoryUpdateMapMBC7()
|
||||
{
|
||||
int tmpAddress = (gbDataMBC5.mapperROMBank << 14);
|
||||
|
||||
tmpAddress &= gbRomSizeMask;
|
||||
gbMemoryMap[0x04] = &gbRom[tmpAddress];
|
||||
gbMemoryMap[0x05] = &gbRom[tmpAddress + 0x1000];
|
||||
gbMemoryMap[0x06] = &gbRom[tmpAddress + 0x2000];
|
||||
gbMemoryMap[0x07] = &gbRom[tmpAddress + 0x3000];
|
||||
}
|
||||
|
||||
mapperHuC1 gbDataHuC1 = {
|
||||
0, // RAM enable
|
||||
1, // ROM bank
|
||||
0, // RAM bank
|
||||
0, // memory model
|
||||
0, // ROM high address
|
||||
0 // RAM address
|
||||
};
|
||||
|
||||
// HuC1 ROM write registers
|
||||
void mapperHuC1ROM(uint16 address, uint8 value)
|
||||
{
|
||||
int tmpAddress = 0;
|
||||
|
||||
switch(address & 0x6000) {
|
||||
case 0x0000: // RAM enable register
|
||||
gbDataHuC1.mapperRAMEnable = ( ( value & 0x0a) == 0x0a ? 1 : 0);
|
||||
break;
|
||||
case 0x2000: // ROM bank select
|
||||
value = value & 0x3f;
|
||||
if(value == 0)
|
||||
value = 1;
|
||||
if(value == gbDataHuC1.mapperROMBank)
|
||||
break;
|
||||
|
||||
tmpAddress = value << 14;
|
||||
|
||||
tmpAddress &= gbRomSizeMask;
|
||||
gbDataHuC1.mapperROMBank = value;
|
||||
gbMemoryMap[0x04] = &gbRom[tmpAddress];
|
||||
gbMemoryMap[0x05] = &gbRom[tmpAddress + 0x1000];
|
||||
gbMemoryMap[0x06] = &gbRom[tmpAddress + 0x2000];
|
||||
gbMemoryMap[0x07] = &gbRom[tmpAddress + 0x3000];
|
||||
break;
|
||||
case 0x4000: // RAM bank select
|
||||
if(gbDataHuC1.mapperMemoryModel == 1) {
|
||||
// 4/32 model, RAM bank switching provided
|
||||
value = value & 0x03;
|
||||
if(value == gbDataHuC1.mapperRAMBank)
|
||||
break;
|
||||
tmpAddress = value << 13;
|
||||
tmpAddress &= gbRamSizeMask;
|
||||
MDFNMP_AddRAM(8192, 0xA000, &gbRam[tmpAddress]);
|
||||
gbMemoryMap[0x0a] = &gbRam[tmpAddress];
|
||||
gbMemoryMap[0x0b] = &gbRam[tmpAddress + 0x1000];
|
||||
gbDataHuC1.mapperRAMBank = value;
|
||||
gbDataHuC1.mapperRAMAddress = tmpAddress;
|
||||
} else {
|
||||
// 16/8, set the high address
|
||||
gbDataHuC1.mapperROMHighAddress = value & 0x03;
|
||||
tmpAddress = gbDataHuC1.mapperROMBank << 14;
|
||||
tmpAddress |= (gbDataHuC1.mapperROMHighAddress) << 19;
|
||||
tmpAddress &= gbRomSizeMask;
|
||||
gbMemoryMap[0x04] = &gbRom[tmpAddress];
|
||||
gbMemoryMap[0x05] = &gbRom[tmpAddress + 0x1000];
|
||||
gbMemoryMap[0x06] = &gbRom[tmpAddress + 0x2000];
|
||||
gbMemoryMap[0x07] = &gbRom[tmpAddress + 0x3000];
|
||||
}
|
||||
break;
|
||||
case 0x6000: // memory model select
|
||||
gbDataHuC1.mapperMemoryModel = value & 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// HuC1 RAM write
|
||||
void mapperHuC1RAM(uint16 address, uint8 value)
|
||||
{
|
||||
if(gbDataHuC1.mapperRAMEnable) {
|
||||
if(gbRamSize) {
|
||||
gbMemoryMap[address >> 12][address & 0x0fff] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void memoryUpdateMapHuC1()
|
||||
{
|
||||
int tmpAddress = gbDataHuC1.mapperROMBank << 14;
|
||||
|
||||
tmpAddress &= gbRomSizeMask;
|
||||
|
||||
gbMemoryMap[0x04] = &gbRom[tmpAddress];
|
||||
gbMemoryMap[0x05] = &gbRom[tmpAddress + 0x1000];
|
||||
gbMemoryMap[0x06] = &gbRom[tmpAddress + 0x2000];
|
||||
gbMemoryMap[0x07] = &gbRom[tmpAddress + 0x3000];
|
||||
|
||||
if(gbRamSize) {
|
||||
tmpAddress = gbDataHuC1.mapperRAMBank << 13;
|
||||
tmpAddress &= gbRamSizeMask;
|
||||
MDFNMP_AddRAM(8192, 0xA000, &gbRam[tmpAddress]);
|
||||
gbMemoryMap[0x0a] = &gbRam[tmpAddress];
|
||||
gbMemoryMap[0x0b] = &gbRam[tmpAddress + 0x1000];
|
||||
}
|
||||
}
|
||||
|
||||
mapperHuC3 gbDataHuC3 = {
|
||||
0, // RAM enable
|
||||
1, // ROM bank
|
||||
0, // RAM bank
|
||||
0, // RAM address
|
||||
0, // RAM flag
|
||||
0 // RAM read value
|
||||
};
|
||||
|
||||
|
||||
// HuC3 ROM write registers
|
||||
void mapperHuC3ROM(uint16 address, uint8 value)
|
||||
{
|
||||
int tmpAddress = 0;
|
||||
|
||||
switch(address & 0x6000) {
|
||||
case 0x0000: // RAM enable register
|
||||
gbDataHuC3.mapperRAMEnable = ( value == 0x0a ? 1 : 0);
|
||||
gbDataHuC3.mapperRAMFlag = value;
|
||||
if(gbDataHuC3.mapperRAMFlag != 0x0a)
|
||||
gbDataHuC3.mapperRAMBank = -1;
|
||||
break;
|
||||
case 0x2000: // ROM bank select
|
||||
value = value & 0x7f;
|
||||
if(value == 0)
|
||||
value = 1;
|
||||
if(value == gbDataHuC3.mapperROMBank)
|
||||
break;
|
||||
|
||||
tmpAddress = value << 14;
|
||||
|
||||
tmpAddress &= gbRomSizeMask;
|
||||
gbDataHuC3.mapperROMBank = value;
|
||||
gbMemoryMap[0x04] = &gbRom[tmpAddress];
|
||||
gbMemoryMap[0x05] = &gbRom[tmpAddress + 0x1000];
|
||||
gbMemoryMap[0x06] = &gbRom[tmpAddress + 0x2000];
|
||||
gbMemoryMap[0x07] = &gbRom[tmpAddress + 0x3000];
|
||||
break;
|
||||
case 0x4000: // RAM bank select
|
||||
value = value & 0x03;
|
||||
if(value == gbDataHuC3.mapperRAMBank)
|
||||
break;
|
||||
tmpAddress = value << 13;
|
||||
tmpAddress &= gbRamSizeMask;
|
||||
MDFNMP_AddRAM(8192, 0xA000, &gbRam[tmpAddress]);
|
||||
gbMemoryMap[0x0a] = &gbRam[tmpAddress];
|
||||
gbMemoryMap[0x0b] = &gbRam[tmpAddress + 0x1000];
|
||||
gbDataHuC3.mapperRAMBank = value;
|
||||
gbDataHuC3.mapperRAMAddress = tmpAddress;
|
||||
break;
|
||||
case 0x6000: // nothing to do!
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// HuC3 read RAM
|
||||
uint8 mapperHuC3ReadRAM(uint16 address)
|
||||
{
|
||||
if(gbDataHuC3.mapperRAMFlag > 0x0b &&
|
||||
gbDataHuC3.mapperRAMFlag < 0x0e) {
|
||||
if(gbDataHuC3.mapperRAMFlag != 0x0c)
|
||||
return 1;
|
||||
return gbDataHuC3.mapperRAMValue;
|
||||
} else
|
||||
return gbMemoryMap[address >> 12][address & 0x0fff];
|
||||
}
|
||||
|
||||
// HuC3 RAM write
|
||||
void mapperHuC3RAM(uint16 address, uint8 value)
|
||||
{
|
||||
int *p;
|
||||
|
||||
if(gbDataHuC3.mapperRAMFlag < 0x0b ||
|
||||
gbDataHuC3.mapperRAMFlag > 0x0e) {
|
||||
if(gbDataHuC3.mapperRAMEnable) {
|
||||
if(gbRamSize) {
|
||||
gbMemoryMap[address >> 12][address & 0x0fff] = value;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(gbDataHuC3.mapperRAMFlag == 0x0b) {
|
||||
if(value == 0x62) {
|
||||
gbDataHuC3.mapperRAMValue = 1;
|
||||
} else {
|
||||
switch(value & 0xf0) {
|
||||
case 0x10:
|
||||
p = &gbDataHuC3.mapperRegister2;
|
||||
gbDataHuC3.mapperRAMValue = *(p+gbDataHuC3.mapperRegister1++);
|
||||
if(gbDataHuC3.mapperRegister1 > 6)
|
||||
gbDataHuC3.mapperRegister1 = 0;
|
||||
break;
|
||||
case 0x30:
|
||||
p = &gbDataHuC3.mapperRegister2;
|
||||
*(p+gbDataHuC3.mapperRegister1++) = value & 0x0f;
|
||||
if(gbDataHuC3.mapperRegister1 > 6)
|
||||
gbDataHuC3.mapperRegister1 = 0;
|
||||
gbDataHuC3.mapperAddress =
|
||||
(gbDataHuC3.mapperRegister6 << 24) |
|
||||
(gbDataHuC3.mapperRegister5 << 16) |
|
||||
(gbDataHuC3.mapperRegister4 << 8) |
|
||||
(gbDataHuC3.mapperRegister3 << 4) |
|
||||
(gbDataHuC3.mapperRegister2);
|
||||
break;
|
||||
case 0x40:
|
||||
gbDataHuC3.mapperRegister1 = (gbDataHuC3.mapperRegister1 & 0xf0) |
|
||||
(value & 0x0f);
|
||||
gbDataHuC3.mapperRegister2 = (gbDataHuC3.mapperAddress & 0x0f);
|
||||
gbDataHuC3.mapperRegister3 = ((gbDataHuC3.mapperAddress>>4)&0x0f);
|
||||
gbDataHuC3.mapperRegister4 = ((gbDataHuC3.mapperAddress>>8)&0x0f);
|
||||
gbDataHuC3.mapperRegister5 = ((gbDataHuC3.mapperAddress>>16)&0x0f);
|
||||
gbDataHuC3.mapperRegister6 = ((gbDataHuC3.mapperAddress>>24)&0x0f);
|
||||
gbDataHuC3.mapperRegister7 = 0;
|
||||
gbDataHuC3.mapperRegister8 = 0;
|
||||
gbDataHuC3.mapperRAMValue = 0;
|
||||
break;
|
||||
case 0x50:
|
||||
gbDataHuC3.mapperRegister1 = (gbDataHuC3.mapperRegister1 & 0x0f) |
|
||||
((value << 4)&0x0f);
|
||||
break;
|
||||
default:
|
||||
gbDataHuC3.mapperRAMValue = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void memoryUpdateMapHuC3()
|
||||
{
|
||||
int tmpAddress = gbDataHuC3.mapperROMBank << 14;
|
||||
|
||||
tmpAddress &= gbRomSizeMask;
|
||||
gbMemoryMap[0x04] = &gbRom[tmpAddress];
|
||||
gbMemoryMap[0x05] = &gbRom[tmpAddress + 0x1000];
|
||||
gbMemoryMap[0x06] = &gbRom[tmpAddress + 0x2000];
|
||||
gbMemoryMap[0x07] = &gbRom[tmpAddress + 0x3000];
|
||||
|
||||
if(gbRamSize) {
|
||||
tmpAddress = gbDataHuC3.mapperRAMBank << 13;
|
||||
tmpAddress &= gbRamSizeMask;
|
||||
MDFNMP_AddRAM(8192, 0xA000, &gbRam[tmpAddress]);
|
||||
gbMemoryMap[0x0a] = &gbRam[tmpAddress];
|
||||
gbMemoryMap[0x0b] = &gbRam[tmpAddress + 0x1000];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,149 +0,0 @@
|
|||
// -*- C++ -*-
|
||||
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
||||
// Copyright (C) 1999-2003 Forgotten
|
||||
// Copyright (C) 2004 Forgotten and the VBA development team
|
||||
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or(at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include <time.h>
|
||||
|
||||
namespace MDFN_IEN_GB
|
||||
{
|
||||
|
||||
struct mapperMBC1 {
|
||||
int mapperRAMEnable;
|
||||
int mapperROMBank;
|
||||
int mapperRAMBank;
|
||||
int mapperMemoryModel;
|
||||
};
|
||||
|
||||
struct mapperMBC2 {
|
||||
int mapperRAMEnable;
|
||||
int mapperROMBank;
|
||||
};
|
||||
|
||||
struct mapperMBC3 {
|
||||
int mapperRAMEnable;
|
||||
int mapperROMBank;
|
||||
int mapperRAMBank;
|
||||
int mapperRAMAddress;
|
||||
int mapperClockLatch;
|
||||
int mapperClockRegister;
|
||||
int mapperSeconds;
|
||||
int mapperMinutes;
|
||||
int mapperHours;
|
||||
int mapperDays;
|
||||
int mapperControl;
|
||||
int mapperLSeconds;
|
||||
int mapperLMinutes;
|
||||
int mapperLHours;
|
||||
int mapperLDays;
|
||||
int mapperLControl;
|
||||
uint64 mapperLastTime;
|
||||
};
|
||||
|
||||
struct mapperMBC5 {
|
||||
int mapperRAMEnable;
|
||||
int mapperROMBank;
|
||||
int mapperRAMBank;
|
||||
int mapperROMHighAddress;
|
||||
int mapperRAMAddress;
|
||||
int isRumbleCartridge;
|
||||
};
|
||||
|
||||
struct mapperMBC7 {
|
||||
int mapperRAMEnable;
|
||||
int mapperROMBank;
|
||||
int mapperRAMBank;
|
||||
int mapperRAMAddress;
|
||||
int cs;
|
||||
int sk;
|
||||
int state;
|
||||
int buffer;
|
||||
int idle;
|
||||
int count;
|
||||
int code;
|
||||
int address;
|
||||
int writeEnable;
|
||||
int value;
|
||||
};
|
||||
|
||||
struct mapperHuC1 {
|
||||
int mapperRAMEnable;
|
||||
int mapperROMBank;
|
||||
int mapperRAMBank;
|
||||
int mapperMemoryModel;
|
||||
int mapperROMHighAddress;
|
||||
int mapperRAMAddress;
|
||||
};
|
||||
|
||||
struct mapperHuC3 {
|
||||
int mapperRAMEnable;
|
||||
int mapperROMBank;
|
||||
int mapperRAMBank;
|
||||
int mapperRAMAddress;
|
||||
int mapperAddress;
|
||||
int mapperRAMFlag;
|
||||
int mapperRAMValue;
|
||||
int mapperRegister1;
|
||||
int mapperRegister2;
|
||||
int mapperRegister3;
|
||||
int mapperRegister4;
|
||||
int mapperRegister5;
|
||||
int mapperRegister6;
|
||||
int mapperRegister7;
|
||||
int mapperRegister8;
|
||||
};
|
||||
|
||||
extern mapperMBC1 gbDataMBC1;
|
||||
extern mapperMBC2 gbDataMBC2;
|
||||
extern mapperMBC3 gbDataMBC3;
|
||||
extern mapperMBC5 gbDataMBC5;
|
||||
extern mapperMBC7 gbDataMBC7;
|
||||
|
||||
extern mapperHuC1 gbDataHuC1;
|
||||
extern mapperHuC3 gbDataHuC3;
|
||||
|
||||
void mapperMBC1ROM(uint16,uint8);
|
||||
void mapperMBC1RAM(uint16,uint8);
|
||||
void mapperMBC2ROM(uint16,uint8);
|
||||
void mapperMBC2RAM(uint16,uint8);
|
||||
void mapperMBC3ROM(uint16,uint8);
|
||||
void mapperMBC3RAM(uint16,uint8);
|
||||
uint8 mapperMBC3ReadRAM(uint16);
|
||||
void mapperMBC5ROM(uint16,uint8);
|
||||
void mapperMBC5RAM(uint16,uint8);
|
||||
void mapperMBC7ROM(uint16,uint8);
|
||||
void mapperMBC7RAM(uint16,uint8);
|
||||
uint8 mapperMBC7ReadRAM(uint16);
|
||||
void mapperHuC1ROM(uint16,uint8);
|
||||
void mapperHuC1RAM(uint16,uint8);
|
||||
void mapperHuC3ROM(uint16,uint8);
|
||||
void mapperHuC3RAM(uint16,uint8);
|
||||
uint8 mapperHuC3ReadRAM(uint16);
|
||||
|
||||
//extern void (*mapper)(uint16,uint8);
|
||||
//extern void (*mapperRAM)(uint16,uint8);
|
||||
//extern uint8 (*mapperReadRAM)(uint16);
|
||||
|
||||
extern void memoryUpdateMapMBC1();
|
||||
extern void memoryUpdateMapMBC2();
|
||||
extern void memoryUpdateMapMBC3();
|
||||
extern void memoryUpdateMapMBC5();
|
||||
extern void memoryUpdateMapMBC7();
|
||||
extern void memoryUpdateMapHuC1();
|
||||
extern void memoryUpdateMapHuC3();
|
||||
|
||||
}
|
|
@ -1,152 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "../mednafen.h"
|
||||
#include "../state.h"
|
||||
#include "gb.h"
|
||||
#include "gbGlobals.h"
|
||||
#include "sound.h"
|
||||
#include "gb_apu/Gb_Apu.h"
|
||||
#include <blip/Stereo_Buffer.h>
|
||||
|
||||
namespace MDFN_IEN_GB
|
||||
{
|
||||
|
||||
static Gb_Apu gb_apu;
|
||||
static Stereo_Buffer *gb_buf = NULL;
|
||||
|
||||
void MDFNGBSOUND_Reset(void)
|
||||
{
|
||||
Gb_Apu::mode_t gbmode = Gb_Apu::mode_cgb;
|
||||
|
||||
if(gbEmulatorType == 4)
|
||||
gbmode = Gb_Apu::mode_agb;
|
||||
else if(gbEmulatorType == 3)
|
||||
gbmode = Gb_Apu::mode_dmg;
|
||||
else if(gbEmulatorType == 1)
|
||||
gbmode = Gb_Apu::mode_cgb;
|
||||
else if(gbEmulatorType == 0)
|
||||
{
|
||||
if(gbCgbMode)
|
||||
gbmode = Gb_Apu::mode_cgb;
|
||||
else
|
||||
gbmode = Gb_Apu::mode_dmg;
|
||||
}
|
||||
|
||||
//printf("%d -- %d\n", (int)gbmode, (int)Gb_Apu::mode_cgb);
|
||||
gb_apu.reset(gbmode);
|
||||
}
|
||||
|
||||
uint32 MDFNGBSOUND_Read(int ts, uint32 addr)
|
||||
{
|
||||
uint32 ret;
|
||||
|
||||
ret = gb_apu.read_register(ts*GB_APU_OVERCLOCK, addr);
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
void MDFNGBSOUND_Write(int ts, uint32 addr, uint8 val)
|
||||
{
|
||||
//if(addr == 0xFF26)
|
||||
// printf("%04x %02x\n", addr, val);
|
||||
gb_apu.write_register(ts * GB_APU_OVERCLOCK, addr, val);
|
||||
}
|
||||
|
||||
static bool RedoBuffer(uint32 rate)
|
||||
{
|
||||
if(gb_buf)
|
||||
{
|
||||
delete gb_buf;
|
||||
gb_buf = NULL;
|
||||
}
|
||||
|
||||
gb_apu.set_output(NULL, NULL, NULL);
|
||||
|
||||
if(rate)
|
||||
{
|
||||
gb_buf = new Stereo_Buffer();
|
||||
|
||||
gb_buf->set_sample_rate(rate, 40);
|
||||
gb_buf->clock_rate((long)(4194304 * GB_APU_OVERCLOCK * 1));
|
||||
|
||||
gb_apu.set_output(gb_buf->center(), gb_buf->left(), gb_buf->right());
|
||||
}
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
bool MDFNGB_SetSoundRate(uint32 rate)
|
||||
{
|
||||
RedoBuffer(rate);
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
int MDFNGBSOUND_StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
gb_apu_state_t gb_state;
|
||||
int ret = 1;
|
||||
|
||||
//if(!load) // always save state, in case there is none to load
|
||||
{
|
||||
gb_apu.save_state(&gb_state);
|
||||
}
|
||||
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFVARN(gb_state, "apu_state"),
|
||||
SFEND
|
||||
};
|
||||
|
||||
if(!MDFNSS_StateAction(sm, load, data_only, StateRegs, "APU"))
|
||||
ret = 0;
|
||||
else if(load)
|
||||
{
|
||||
// TODO: set hardware mode to mode_dmg, mode_cgb, or mode_agb
|
||||
// (latter if you're running classic GB game on Game Boy Advance)
|
||||
gb_apu.reset();
|
||||
gb_apu.load_state(gb_state);
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
void MDFNGBSOUND_Init(void)
|
||||
{
|
||||
gb_apu.volume(0.5);
|
||||
|
||||
RedoBuffer(0);
|
||||
}
|
||||
|
||||
int32 MDFNGBSOUND_Flush(int ts, int16 *SoundBuf, const int32 MaxSoundFrames)
|
||||
{
|
||||
int32 SoundFrames = 0;
|
||||
|
||||
gb_apu.end_frame(ts * GB_APU_OVERCLOCK);
|
||||
|
||||
if(SoundBuf && gb_buf)
|
||||
{
|
||||
gb_buf->end_frame(ts * GB_APU_OVERCLOCK);
|
||||
SoundFrames = gb_buf->read_samples(SoundBuf, MaxSoundFrames * 2) / 2;
|
||||
}
|
||||
else if(gb_buf)
|
||||
exit(1);
|
||||
|
||||
return(SoundFrames);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
#ifndef __MDFN_GB_SOUND_H
|
||||
#define __MDFN_GB_SOUND_H
|
||||
|
||||
namespace MDFN_IEN_GB
|
||||
{
|
||||
|
||||
uint32 MDFNGBSOUND_Read(int ts, uint32_t addr);
|
||||
void MDFNGBSOUND_Write(int ts, uint32 addr, uint8 val);
|
||||
|
||||
int32 MDFNGBSOUND_Flush(int ts, int16 *SoundBuf, const int32 MaxSoundFrames);
|
||||
void MDFNGBSOUND_Init(void);
|
||||
void MDFNGBSOUND_Reset(void);
|
||||
int MDFNGBSOUND_StateAction(StateMem *sm, int load, int data_only);
|
||||
|
||||
void MDFNGB_SetSoundVolume(uint32 volume);
|
||||
bool MDFNGB_SetSoundRate(uint32 rate);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -1,481 +0,0 @@
|
|||
#include "../mednafen.h"
|
||||
#include "../state.h"
|
||||
#include "gb.h"
|
||||
#include "z80.h"
|
||||
#include "gbGlobals.h"
|
||||
#include "memory.h"
|
||||
|
||||
namespace MDFN_IEN_GB
|
||||
{
|
||||
|
||||
// GameBoy Z80-clone emulation
|
||||
|
||||
static const uint16 DAATable[] = {
|
||||
0x0080,0x0100,0x0200,0x0300,0x0400,0x0500,0x0600,0x0700,
|
||||
0x0800,0x0900,0x1000,0x1100,0x1200,0x1300,0x1400,0x1500,
|
||||
0x1000,0x1100,0x1200,0x1300,0x1400,0x1500,0x1600,0x1700,
|
||||
0x1800,0x1900,0x2000,0x2100,0x2200,0x2300,0x2400,0x2500,
|
||||
0x2000,0x2100,0x2200,0x2300,0x2400,0x2500,0x2600,0x2700,
|
||||
0x2800,0x2900,0x3000,0x3100,0x3200,0x3300,0x3400,0x3500,
|
||||
0x3000,0x3100,0x3200,0x3300,0x3400,0x3500,0x3600,0x3700,
|
||||
0x3800,0x3900,0x4000,0x4100,0x4200,0x4300,0x4400,0x4500,
|
||||
0x4000,0x4100,0x4200,0x4300,0x4400,0x4500,0x4600,0x4700,
|
||||
0x4800,0x4900,0x5000,0x5100,0x5200,0x5300,0x5400,0x5500,
|
||||
0x5000,0x5100,0x5200,0x5300,0x5400,0x5500,0x5600,0x5700,
|
||||
0x5800,0x5900,0x6000,0x6100,0x6200,0x6300,0x6400,0x6500,
|
||||
0x6000,0x6100,0x6200,0x6300,0x6400,0x6500,0x6600,0x6700,
|
||||
0x6800,0x6900,0x7000,0x7100,0x7200,0x7300,0x7400,0x7500,
|
||||
0x7000,0x7100,0x7200,0x7300,0x7400,0x7500,0x7600,0x7700,
|
||||
0x7800,0x7900,0x8000,0x8100,0x8200,0x8300,0x8400,0x8500,
|
||||
0x8000,0x8100,0x8200,0x8300,0x8400,0x8500,0x8600,0x8700,
|
||||
0x8800,0x8900,0x9000,0x9100,0x9200,0x9300,0x9400,0x9500,
|
||||
0x9000,0x9100,0x9200,0x9300,0x9400,0x9500,0x9600,0x9700,
|
||||
0x9800,0x9900,0x0090,0x0110,0x0210,0x0310,0x0410,0x0510,
|
||||
0x0090,0x0110,0x0210,0x0310,0x0410,0x0510,0x0610,0x0710,
|
||||
0x0810,0x0910,0x1010,0x1110,0x1210,0x1310,0x1410,0x1510,
|
||||
0x1010,0x1110,0x1210,0x1310,0x1410,0x1510,0x1610,0x1710,
|
||||
0x1810,0x1910,0x2010,0x2110,0x2210,0x2310,0x2410,0x2510,
|
||||
0x2010,0x2110,0x2210,0x2310,0x2410,0x2510,0x2610,0x2710,
|
||||
0x2810,0x2910,0x3010,0x3110,0x3210,0x3310,0x3410,0x3510,
|
||||
0x3010,0x3110,0x3210,0x3310,0x3410,0x3510,0x3610,0x3710,
|
||||
0x3810,0x3910,0x4010,0x4110,0x4210,0x4310,0x4410,0x4510,
|
||||
0x4010,0x4110,0x4210,0x4310,0x4410,0x4510,0x4610,0x4710,
|
||||
0x4810,0x4910,0x5010,0x5110,0x5210,0x5310,0x5410,0x5510,
|
||||
0x5010,0x5110,0x5210,0x5310,0x5410,0x5510,0x5610,0x5710,
|
||||
0x5810,0x5910,0x6010,0x6110,0x6210,0x6310,0x6410,0x6510,
|
||||
0x6010,0x6110,0x6210,0x6310,0x6410,0x6510,0x6610,0x6710,
|
||||
0x6810,0x6910,0x7010,0x7110,0x7210,0x7310,0x7410,0x7510,
|
||||
0x7010,0x7110,0x7210,0x7310,0x7410,0x7510,0x7610,0x7710,
|
||||
0x7810,0x7910,0x8010,0x8110,0x8210,0x8310,0x8410,0x8510,
|
||||
0x8010,0x8110,0x8210,0x8310,0x8410,0x8510,0x8610,0x8710,
|
||||
0x8810,0x8910,0x9010,0x9110,0x9210,0x9310,0x9410,0x9510,
|
||||
0x9010,0x9110,0x9210,0x9310,0x9410,0x9510,0x9610,0x9710,
|
||||
0x9810,0x9910,0xA010,0xA110,0xA210,0xA310,0xA410,0xA510,
|
||||
0xA010,0xA110,0xA210,0xA310,0xA410,0xA510,0xA610,0xA710,
|
||||
0xA810,0xA910,0xB010,0xB110,0xB210,0xB310,0xB410,0xB510,
|
||||
0xB010,0xB110,0xB210,0xB310,0xB410,0xB510,0xB610,0xB710,
|
||||
0xB810,0xB910,0xC010,0xC110,0xC210,0xC310,0xC410,0xC510,
|
||||
0xC010,0xC110,0xC210,0xC310,0xC410,0xC510,0xC610,0xC710,
|
||||
0xC810,0xC910,0xD010,0xD110,0xD210,0xD310,0xD410,0xD510,
|
||||
0xD010,0xD110,0xD210,0xD310,0xD410,0xD510,0xD610,0xD710,
|
||||
0xD810,0xD910,0xE010,0xE110,0xE210,0xE310,0xE410,0xE510,
|
||||
0xE010,0xE110,0xE210,0xE310,0xE410,0xE510,0xE610,0xE710,
|
||||
0xE810,0xE910,0xF010,0xF110,0xF210,0xF310,0xF410,0xF510,
|
||||
0xF010,0xF110,0xF210,0xF310,0xF410,0xF510,0xF610,0xF710,
|
||||
0xF810,0xF910,0x0090,0x0110,0x0210,0x0310,0x0410,0x0510,
|
||||
0x0090,0x0110,0x0210,0x0310,0x0410,0x0510,0x0610,0x0710,
|
||||
0x0810,0x0910,0x1010,0x1110,0x1210,0x1310,0x1410,0x1510,
|
||||
0x1010,0x1110,0x1210,0x1310,0x1410,0x1510,0x1610,0x1710,
|
||||
0x1810,0x1910,0x2010,0x2110,0x2210,0x2310,0x2410,0x2510,
|
||||
0x2010,0x2110,0x2210,0x2310,0x2410,0x2510,0x2610,0x2710,
|
||||
0x2810,0x2910,0x3010,0x3110,0x3210,0x3310,0x3410,0x3510,
|
||||
0x3010,0x3110,0x3210,0x3310,0x3410,0x3510,0x3610,0x3710,
|
||||
0x3810,0x3910,0x4010,0x4110,0x4210,0x4310,0x4410,0x4510,
|
||||
0x4010,0x4110,0x4210,0x4310,0x4410,0x4510,0x4610,0x4710,
|
||||
0x4810,0x4910,0x5010,0x5110,0x5210,0x5310,0x5410,0x5510,
|
||||
0x5010,0x5110,0x5210,0x5310,0x5410,0x5510,0x5610,0x5710,
|
||||
0x5810,0x5910,0x6010,0x6110,0x6210,0x6310,0x6410,0x6510,
|
||||
0x0600,0x0700,0x0800,0x0900,0x0A00,0x0B00,0x0C00,0x0D00,
|
||||
0x0E00,0x0F00,0x1000,0x1100,0x1200,0x1300,0x1400,0x1500,
|
||||
0x1600,0x1700,0x1800,0x1900,0x1A00,0x1B00,0x1C00,0x1D00,
|
||||
0x1E00,0x1F00,0x2000,0x2100,0x2200,0x2300,0x2400,0x2500,
|
||||
0x2600,0x2700,0x2800,0x2900,0x2A00,0x2B00,0x2C00,0x2D00,
|
||||
0x2E00,0x2F00,0x3000,0x3100,0x3200,0x3300,0x3400,0x3500,
|
||||
0x3600,0x3700,0x3800,0x3900,0x3A00,0x3B00,0x3C00,0x3D00,
|
||||
0x3E00,0x3F00,0x4000,0x4100,0x4200,0x4300,0x4400,0x4500,
|
||||
0x4600,0x4700,0x4800,0x4900,0x4A00,0x4B00,0x4C00,0x4D00,
|
||||
0x4E00,0x4F00,0x5000,0x5100,0x5200,0x5300,0x5400,0x5500,
|
||||
0x5600,0x5700,0x5800,0x5900,0x5A00,0x5B00,0x5C00,0x5D00,
|
||||
0x5E00,0x5F00,0x6000,0x6100,0x6200,0x6300,0x6400,0x6500,
|
||||
0x6600,0x6700,0x6800,0x6900,0x6A00,0x6B00,0x6C00,0x6D00,
|
||||
0x6E00,0x6F00,0x7000,0x7100,0x7200,0x7300,0x7400,0x7500,
|
||||
0x7600,0x7700,0x7800,0x7900,0x7A00,0x7B00,0x7C00,0x7D00,
|
||||
0x7E00,0x7F00,0x8000,0x8100,0x8200,0x8300,0x8400,0x8500,
|
||||
0x8600,0x8700,0x8800,0x8900,0x8A00,0x8B00,0x8C00,0x8D00,
|
||||
0x8E00,0x8F00,0x9000,0x9100,0x9200,0x9300,0x9400,0x9500,
|
||||
0x9600,0x9700,0x9800,0x9900,0x9A00,0x9B00,0x9C00,0x9D00,
|
||||
0x9E00,0x9F00,0x0090,0x0110,0x0210,0x0310,0x0410,0x0510,
|
||||
0x0610,0x0710,0x0810,0x0910,0x0A10,0x0B10,0x0C10,0x0D10,
|
||||
0x0E10,0x0F10,0x1010,0x1110,0x1210,0x1310,0x1410,0x1510,
|
||||
0x1610,0x1710,0x1810,0x1910,0x1A10,0x1B10,0x1C10,0x1D10,
|
||||
0x1E10,0x1F10,0x2010,0x2110,0x2210,0x2310,0x2410,0x2510,
|
||||
0x2610,0x2710,0x2810,0x2910,0x2A10,0x2B10,0x2C10,0x2D10,
|
||||
0x2E10,0x2F10,0x3010,0x3110,0x3210,0x3310,0x3410,0x3510,
|
||||
0x3610,0x3710,0x3810,0x3910,0x3A10,0x3B10,0x3C10,0x3D10,
|
||||
0x3E10,0x3F10,0x4010,0x4110,0x4210,0x4310,0x4410,0x4510,
|
||||
0x4610,0x4710,0x4810,0x4910,0x4A10,0x4B10,0x4C10,0x4D10,
|
||||
0x4E10,0x4F10,0x5010,0x5110,0x5210,0x5310,0x5410,0x5510,
|
||||
0x5610,0x5710,0x5810,0x5910,0x5A10,0x5B10,0x5C10,0x5D10,
|
||||
0x5E10,0x5F10,0x6010,0x6110,0x6210,0x6310,0x6410,0x6510,
|
||||
0x6610,0x6710,0x6810,0x6910,0x6A10,0x6B10,0x6C10,0x6D10,
|
||||
0x6E10,0x6F10,0x7010,0x7110,0x7210,0x7310,0x7410,0x7510,
|
||||
0x7610,0x7710,0x7810,0x7910,0x7A10,0x7B10,0x7C10,0x7D10,
|
||||
0x7E10,0x7F10,0x8010,0x8110,0x8210,0x8310,0x8410,0x8510,
|
||||
0x8610,0x8710,0x8810,0x8910,0x8A10,0x8B10,0x8C10,0x8D10,
|
||||
0x8E10,0x8F10,0x9010,0x9110,0x9210,0x9310,0x9410,0x9510,
|
||||
0x9610,0x9710,0x9810,0x9910,0x9A10,0x9B10,0x9C10,0x9D10,
|
||||
0x9E10,0x9F10,0xA010,0xA110,0xA210,0xA310,0xA410,0xA510,
|
||||
0xA610,0xA710,0xA810,0xA910,0xAA10,0xAB10,0xAC10,0xAD10,
|
||||
0xAE10,0xAF10,0xB010,0xB110,0xB210,0xB310,0xB410,0xB510,
|
||||
0xB610,0xB710,0xB810,0xB910,0xBA10,0xBB10,0xBC10,0xBD10,
|
||||
0xBE10,0xBF10,0xC010,0xC110,0xC210,0xC310,0xC410,0xC510,
|
||||
0xC610,0xC710,0xC810,0xC910,0xCA10,0xCB10,0xCC10,0xCD10,
|
||||
0xCE10,0xCF10,0xD010,0xD110,0xD210,0xD310,0xD410,0xD510,
|
||||
0xD610,0xD710,0xD810,0xD910,0xDA10,0xDB10,0xDC10,0xDD10,
|
||||
0xDE10,0xDF10,0xE010,0xE110,0xE210,0xE310,0xE410,0xE510,
|
||||
0xE610,0xE710,0xE810,0xE910,0xEA10,0xEB10,0xEC10,0xED10,
|
||||
0xEE10,0xEF10,0xF010,0xF110,0xF210,0xF310,0xF410,0xF510,
|
||||
0xF610,0xF710,0xF810,0xF910,0xFA10,0xFB10,0xFC10,0xFD10,
|
||||
0xFE10,0xFF10,0x0090,0x0110,0x0210,0x0310,0x0410,0x0510,
|
||||
0x0610,0x0710,0x0810,0x0910,0x0A10,0x0B10,0x0C10,0x0D10,
|
||||
0x0E10,0x0F10,0x1010,0x1110,0x1210,0x1310,0x1410,0x1510,
|
||||
0x1610,0x1710,0x1810,0x1910,0x1A10,0x1B10,0x1C10,0x1D10,
|
||||
0x1E10,0x1F10,0x2010,0x2110,0x2210,0x2310,0x2410,0x2510,
|
||||
0x2610,0x2710,0x2810,0x2910,0x2A10,0x2B10,0x2C10,0x2D10,
|
||||
0x2E10,0x2F10,0x3010,0x3110,0x3210,0x3310,0x3410,0x3510,
|
||||
0x3610,0x3710,0x3810,0x3910,0x3A10,0x3B10,0x3C10,0x3D10,
|
||||
0x3E10,0x3F10,0x4010,0x4110,0x4210,0x4310,0x4410,0x4510,
|
||||
0x4610,0x4710,0x4810,0x4910,0x4A10,0x4B10,0x4C10,0x4D10,
|
||||
0x4E10,0x4F10,0x5010,0x5110,0x5210,0x5310,0x5410,0x5510,
|
||||
0x5610,0x5710,0x5810,0x5910,0x5A10,0x5B10,0x5C10,0x5D10,
|
||||
0x5E10,0x5F10,0x6010,0x6110,0x6210,0x6310,0x6410,0x6510,
|
||||
0x00C0,0x0140,0x0240,0x0340,0x0440,0x0540,0x0640,0x0740,
|
||||
0x0840,0x0940,0x0A40,0x0B40,0x0C40,0x0D40,0x0E40,0x0F40,
|
||||
0x1040,0x1140,0x1240,0x1340,0x1440,0x1540,0x1640,0x1740,
|
||||
0x1840,0x1940,0x1A40,0x1B40,0x1C40,0x1D40,0x1E40,0x1F40,
|
||||
0x2040,0x2140,0x2240,0x2340,0x2440,0x2540,0x2640,0x2740,
|
||||
0x2840,0x2940,0x2A40,0x2B40,0x2C40,0x2D40,0x2E40,0x2F40,
|
||||
0x3040,0x3140,0x3240,0x3340,0x3440,0x3540,0x3640,0x3740,
|
||||
0x3840,0x3940,0x3A40,0x3B40,0x3C40,0x3D40,0x3E40,0x3F40,
|
||||
0x4040,0x4140,0x4240,0x4340,0x4440,0x4540,0x4640,0x4740,
|
||||
0x4840,0x4940,0x4A40,0x4B40,0x4C40,0x4D40,0x4E40,0x4F40,
|
||||
0x5040,0x5140,0x5240,0x5340,0x5440,0x5540,0x5640,0x5740,
|
||||
0x5840,0x5940,0x5A40,0x5B40,0x5C40,0x5D40,0x5E40,0x5F40,
|
||||
0x6040,0x6140,0x6240,0x6340,0x6440,0x6540,0x6640,0x6740,
|
||||
0x6840,0x6940,0x6A40,0x6B40,0x6C40,0x6D40,0x6E40,0x6F40,
|
||||
0x7040,0x7140,0x7240,0x7340,0x7440,0x7540,0x7640,0x7740,
|
||||
0x7840,0x7940,0x7A40,0x7B40,0x7C40,0x7D40,0x7E40,0x7F40,
|
||||
0x8040,0x8140,0x8240,0x8340,0x8440,0x8540,0x8640,0x8740,
|
||||
0x8840,0x8940,0x8A40,0x8B40,0x8C40,0x8D40,0x8E40,0x8F40,
|
||||
0x9040,0x9140,0x9240,0x9340,0x9440,0x9540,0x9640,0x9740,
|
||||
0x9840,0x9940,0x9A40,0x9B40,0x9C40,0x9D40,0x9E40,0x9F40,
|
||||
0xA040,0xA140,0xA240,0xA340,0xA440,0xA540,0xA640,0xA740,
|
||||
0xA840,0xA940,0xAA40,0xAB40,0xAC40,0xAD40,0xAE40,0xAF40,
|
||||
0xB040,0xB140,0xB240,0xB340,0xB440,0xB540,0xB640,0xB740,
|
||||
0xB840,0xB940,0xBA40,0xBB40,0xBC40,0xBD40,0xBE40,0xBF40,
|
||||
0xC040,0xC140,0xC240,0xC340,0xC440,0xC540,0xC640,0xC740,
|
||||
0xC840,0xC940,0xCA40,0xCB40,0xCC40,0xCD40,0xCE40,0xCF40,
|
||||
0xD040,0xD140,0xD240,0xD340,0xD440,0xD540,0xD640,0xD740,
|
||||
0xD840,0xD940,0xDA40,0xDB40,0xDC40,0xDD40,0xDE40,0xDF40,
|
||||
0xE040,0xE140,0xE240,0xE340,0xE440,0xE540,0xE640,0xE740,
|
||||
0xE840,0xE940,0xEA40,0xEB40,0xEC40,0xED40,0xEE40,0xEF40,
|
||||
0xF040,0xF140,0xF240,0xF340,0xF440,0xF540,0xF640,0xF740,
|
||||
0xF840,0xF940,0xFA40,0xFB40,0xFC40,0xFD40,0xFE40,0xFF40,
|
||||
0xA050,0xA150,0xA250,0xA350,0xA450,0xA550,0xA650,0xA750,
|
||||
0xA850,0xA950,0xAA50,0xAB50,0xAC50,0xAD50,0xAE50,0xAF50,
|
||||
0xB050,0xB150,0xB250,0xB350,0xB450,0xB550,0xB650,0xB750,
|
||||
0xB850,0xB950,0xBA50,0xBB50,0xBC50,0xBD50,0xBE50,0xBF50,
|
||||
0xC050,0xC150,0xC250,0xC350,0xC450,0xC550,0xC650,0xC750,
|
||||
0xC850,0xC950,0xCA50,0xCB50,0xCC50,0xCD50,0xCE50,0xCF50,
|
||||
0xD050,0xD150,0xD250,0xD350,0xD450,0xD550,0xD650,0xD750,
|
||||
0xD850,0xD950,0xDA50,0xDB50,0xDC50,0xDD50,0xDE50,0xDF50,
|
||||
0xE050,0xE150,0xE250,0xE350,0xE450,0xE550,0xE650,0xE750,
|
||||
0xE850,0xE950,0xEA50,0xEB50,0xEC50,0xED50,0xEE50,0xEF50,
|
||||
0xF050,0xF150,0xF250,0xF350,0xF450,0xF550,0xF650,0xF750,
|
||||
0xF850,0xF950,0xFA50,0xFB50,0xFC50,0xFD50,0xFE50,0xFF50,
|
||||
0x00D0,0x0150,0x0250,0x0350,0x0450,0x0550,0x0650,0x0750,
|
||||
0x0850,0x0950,0x0A50,0x0B50,0x0C50,0x0D50,0x0E50,0x0F50,
|
||||
0x1050,0x1150,0x1250,0x1350,0x1450,0x1550,0x1650,0x1750,
|
||||
0x1850,0x1950,0x1A50,0x1B50,0x1C50,0x1D50,0x1E50,0x1F50,
|
||||
0x2050,0x2150,0x2250,0x2350,0x2450,0x2550,0x2650,0x2750,
|
||||
0x2850,0x2950,0x2A50,0x2B50,0x2C50,0x2D50,0x2E50,0x2F50,
|
||||
0x3050,0x3150,0x3250,0x3350,0x3450,0x3550,0x3650,0x3750,
|
||||
0x3850,0x3950,0x3A50,0x3B50,0x3C50,0x3D50,0x3E50,0x3F50,
|
||||
0x4050,0x4150,0x4250,0x4350,0x4450,0x4550,0x4650,0x4750,
|
||||
0x4850,0x4950,0x4A50,0x4B50,0x4C50,0x4D50,0x4E50,0x4F50,
|
||||
0x5050,0x5150,0x5250,0x5350,0x5450,0x5550,0x5650,0x5750,
|
||||
0x5850,0x5950,0x5A50,0x5B50,0x5C50,0x5D50,0x5E50,0x5F50,
|
||||
0x6050,0x6150,0x6250,0x6350,0x6450,0x6550,0x6650,0x6750,
|
||||
0x6850,0x6950,0x6A50,0x6B50,0x6C50,0x6D50,0x6E50,0x6F50,
|
||||
0x7050,0x7150,0x7250,0x7350,0x7450,0x7550,0x7650,0x7750,
|
||||
0x7850,0x7950,0x7A50,0x7B50,0x7C50,0x7D50,0x7E50,0x7F50,
|
||||
0x8050,0x8150,0x8250,0x8350,0x8450,0x8550,0x8650,0x8750,
|
||||
0x8850,0x8950,0x8A50,0x8B50,0x8C50,0x8D50,0x8E50,0x8F50,
|
||||
0x9050,0x9150,0x9250,0x9350,0x9450,0x9550,0x9650,0x9750,
|
||||
0x9850,0x9950,0x9A50,0x9B50,0x9C50,0x9D50,0x9E50,0x9F50,
|
||||
0xFA40,0xFB40,0xFC40,0xFD40,0xFE40,0xFF40,0x00C0,0x0140,
|
||||
0x0240,0x0340,0x0440,0x0540,0x0640,0x0740,0x0840,0x0940,
|
||||
0x0A40,0x0B40,0x0C40,0x0D40,0x0E40,0x0F40,0x1040,0x1140,
|
||||
0x1240,0x1340,0x1440,0x1540,0x1640,0x1740,0x1840,0x1940,
|
||||
0x1A40,0x1B40,0x1C40,0x1D40,0x1E40,0x1F40,0x2040,0x2140,
|
||||
0x2240,0x2340,0x2440,0x2540,0x2640,0x2740,0x2840,0x2940,
|
||||
0x2A40,0x2B40,0x2C40,0x2D40,0x2E40,0x2F40,0x3040,0x3140,
|
||||
0x3240,0x3340,0x3440,0x3540,0x3640,0x3740,0x3840,0x3940,
|
||||
0x3A40,0x3B40,0x3C40,0x3D40,0x3E40,0x3F40,0x4040,0x4140,
|
||||
0x4240,0x4340,0x4440,0x4540,0x4640,0x4740,0x4840,0x4940,
|
||||
0x4A40,0x4B40,0x4C40,0x4D40,0x4E40,0x4F40,0x5040,0x5140,
|
||||
0x5240,0x5340,0x5440,0x5540,0x5640,0x5740,0x5840,0x5940,
|
||||
0x5A40,0x5B40,0x5C40,0x5D40,0x5E40,0x5F40,0x6040,0x6140,
|
||||
0x6240,0x6340,0x6440,0x6540,0x6640,0x6740,0x6840,0x6940,
|
||||
0x6A40,0x6B40,0x6C40,0x6D40,0x6E40,0x6F40,0x7040,0x7140,
|
||||
0x7240,0x7340,0x7440,0x7540,0x7640,0x7740,0x7840,0x7940,
|
||||
0x7A40,0x7B40,0x7C40,0x7D40,0x7E40,0x7F40,0x8040,0x8140,
|
||||
0x8240,0x8340,0x8440,0x8540,0x8640,0x8740,0x8840,0x8940,
|
||||
0x8A40,0x8B40,0x8C40,0x8D40,0x8E40,0x8F40,0x9040,0x9140,
|
||||
0x9240,0x9340,0x9440,0x9540,0x9640,0x9740,0x9840,0x9940,
|
||||
0x9A40,0x9B40,0x9C40,0x9D40,0x9E40,0x9F40,0xA040,0xA140,
|
||||
0xA240,0xA340,0xA440,0xA540,0xA640,0xA740,0xA840,0xA940,
|
||||
0xAA40,0xAB40,0xAC40,0xAD40,0xAE40,0xAF40,0xB040,0xB140,
|
||||
0xB240,0xB340,0xB440,0xB540,0xB640,0xB740,0xB840,0xB940,
|
||||
0xBA40,0xBB40,0xBC40,0xBD40,0xBE40,0xBF40,0xC040,0xC140,
|
||||
0xC240,0xC340,0xC440,0xC540,0xC640,0xC740,0xC840,0xC940,
|
||||
0xCA40,0xCB40,0xCC40,0xCD40,0xCE40,0xCF40,0xD040,0xD140,
|
||||
0xD240,0xD340,0xD440,0xD540,0xD640,0xD740,0xD840,0xD940,
|
||||
0xDA40,0xDB40,0xDC40,0xDD40,0xDE40,0xDF40,0xE040,0xE140,
|
||||
0xE240,0xE340,0xE440,0xE540,0xE640,0xE740,0xE840,0xE940,
|
||||
0xEA40,0xEB40,0xEC40,0xED40,0xEE40,0xEF40,0xF040,0xF140,
|
||||
0xF240,0xF340,0xF440,0xF540,0xF640,0xF740,0xF840,0xF940,
|
||||
0x9A50,0x9B50,0x9C50,0x9D50,0x9E50,0x9F50,0xA050,0xA150,
|
||||
0xA250,0xA350,0xA450,0xA550,0xA650,0xA750,0xA850,0xA950,
|
||||
0xAA50,0xAB50,0xAC50,0xAD50,0xAE50,0xAF50,0xB050,0xB150,
|
||||
0xB250,0xB350,0xB450,0xB550,0xB650,0xB750,0xB850,0xB950,
|
||||
0xBA50,0xBB50,0xBC50,0xBD50,0xBE50,0xBF50,0xC050,0xC150,
|
||||
0xC250,0xC350,0xC450,0xC550,0xC650,0xC750,0xC850,0xC950,
|
||||
0xCA50,0xCB50,0xCC50,0xCD50,0xCE50,0xCF50,0xD050,0xD150,
|
||||
0xD250,0xD350,0xD450,0xD550,0xD650,0xD750,0xD850,0xD950,
|
||||
0xDA50,0xDB50,0xDC50,0xDD50,0xDE50,0xDF50,0xE050,0xE150,
|
||||
0xE250,0xE350,0xE450,0xE550,0xE650,0xE750,0xE850,0xE950,
|
||||
0xEA50,0xEB50,0xEC50,0xED50,0xEE50,0xEF50,0xF050,0xF150,
|
||||
0xF250,0xF350,0xF450,0xF550,0xF650,0xF750,0xF850,0xF950,
|
||||
0xFA50,0xFB50,0xFC50,0xFD50,0xFE50,0xFF50,0x00D0,0x0150,
|
||||
0x0250,0x0350,0x0450,0x0550,0x0650,0x0750,0x0850,0x0950,
|
||||
0x0A50,0x0B50,0x0C50,0x0D50,0x0E50,0x0F50,0x1050,0x1150,
|
||||
0x1250,0x1350,0x1450,0x1550,0x1650,0x1750,0x1850,0x1950,
|
||||
0x1A50,0x1B50,0x1C50,0x1D50,0x1E50,0x1F50,0x2050,0x2150,
|
||||
0x2250,0x2350,0x2450,0x2550,0x2650,0x2750,0x2850,0x2950,
|
||||
0x2A50,0x2B50,0x2C50,0x2D50,0x2E50,0x2F50,0x3050,0x3150,
|
||||
0x3250,0x3350,0x3450,0x3550,0x3650,0x3750,0x3850,0x3950,
|
||||
0x3A50,0x3B50,0x3C50,0x3D50,0x3E50,0x3F50,0x4050,0x4150,
|
||||
0x4250,0x4350,0x4450,0x4550,0x4650,0x4750,0x4850,0x4950,
|
||||
0x4A50,0x4B50,0x4C50,0x4D50,0x4E50,0x4F50,0x5050,0x5150,
|
||||
0x5250,0x5350,0x5450,0x5550,0x5650,0x5750,0x5850,0x5950,
|
||||
0x5A50,0x5B50,0x5C50,0x5D50,0x5E50,0x5F50,0x6050,0x6150,
|
||||
0x6250,0x6350,0x6450,0x6550,0x6650,0x6750,0x6850,0x6950,
|
||||
0x6A50,0x6B50,0x6C50,0x6D50,0x6E50,0x6F50,0x7050,0x7150,
|
||||
0x7250,0x7350,0x7450,0x7550,0x7650,0x7750,0x7850,0x7950,
|
||||
0x7A50,0x7B50,0x7C50,0x7D50,0x7E50,0x7F50,0x8050,0x8150,
|
||||
0x8250,0x8350,0x8450,0x8550,0x8650,0x8750,0x8850,0x8950,
|
||||
0x8A50,0x8B50,0x8C50,0x8D50,0x8E50,0x8F50,0x9050,0x9150,
|
||||
0x9250,0x9350,0x9450,0x9550,0x9650,0x9750,0x9850,0x9950,
|
||||
};
|
||||
|
||||
static const int gbCycles[] = {
|
||||
// 0 1 2 3 4 5 6 7 8 9 a b c d e f
|
||||
1, 3, 2, 2, 1, 1, 2, 1, 5, 2, 2, 2, 1, 1, 2, 1, // 0
|
||||
1, 3, 2, 2, 1, 1, 2, 1, 3, 2, 2, 2, 1, 1, 2, 1, // 1
|
||||
2, 3, 2, 2, 1, 1, 2, 1, 2, 2, 2, 2, 1, 1, 2, 1, // 2
|
||||
2, 3, 2, 2, 3, 3, 3, 1, 2, 2, 2, 2, 1, 1, 2, 1, // 3
|
||||
1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, // 4
|
||||
1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, // 5
|
||||
1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, // 6
|
||||
2, 2, 2, 2, 2, 2, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, // 7
|
||||
1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, // 8
|
||||
1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, // 9
|
||||
1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, // a
|
||||
1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, // b
|
||||
2, 3, 3, 4, 3, 4, 2, 4, 2, 4, 3, 2, 3, 6, 2, 4, // c
|
||||
2, 3, 3, 0, 3, 4, 2, 4, 2, 4, 3, 0, 3, 0, 2, 4, // d
|
||||
3, 3, 2, 0, 0, 4, 2, 4, 4, 1, 4, 0, 0, 0, 2, 4, // e
|
||||
3, 3, 2, 1, 0, 4, 2, 4, 3, 2, 4, 1, 0, 0, 2, 4 // f
|
||||
};
|
||||
|
||||
static const int gbCyclesCB[] = {
|
||||
// 0 1 2 3 4 5 6 7 8 9 a b c d e f
|
||||
2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 4, 2, // 0
|
||||
2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 4, 2, // 1
|
||||
2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 4, 2, // 2
|
||||
2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 4, 2, // 3
|
||||
2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 3, 2, // 4
|
||||
2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 3, 2, // 5
|
||||
2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 3, 2, // 6
|
||||
2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 3, 2, // 7
|
||||
2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 4, 2, // 8
|
||||
2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 4, 2, // 9
|
||||
2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 4, 2, // a
|
||||
2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 4, 2, // b
|
||||
2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 4, 2, // c
|
||||
2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 4, 2, // d
|
||||
2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 4, 2, // e
|
||||
2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 4, 2 // f
|
||||
};
|
||||
|
||||
static const uint8 ZeroTable[256] = {
|
||||
0x80,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0
|
||||
};
|
||||
|
||||
|
||||
|
||||
// registers
|
||||
static gbRegister PC;
|
||||
static gbRegister SP;
|
||||
static gbRegister AF;
|
||||
static gbRegister BC;
|
||||
static gbRegister DE;
|
||||
static gbRegister HL;
|
||||
static uint8 IFF;
|
||||
static bool InHALT;
|
||||
static bool RepeatNextByte;
|
||||
static bool EI_Delayed;
|
||||
|
||||
void GBZ80_Interrupt(int which)
|
||||
{
|
||||
IFF = FALSE;
|
||||
EI_Delayed = FALSE;
|
||||
|
||||
register_IF &= ~(1 << which);
|
||||
|
||||
gbWriteMemory(--SP.W, PC.B.B1);
|
||||
gbWriteMemory(--SP.W, PC.B.B0);
|
||||
PC.W = 0x40 + (which << 3);
|
||||
}
|
||||
|
||||
void GBZ80_Reset(void)
|
||||
{
|
||||
SP.W = 0xfffe;
|
||||
AF.W = 0x01b0;
|
||||
BC.W = 0x0013;
|
||||
DE.W = 0x00d8;
|
||||
HL.W = 0x014d;
|
||||
PC.W = 0x0100;
|
||||
IFF = FALSE;
|
||||
|
||||
EI_Delayed = FALSE;
|
||||
RepeatNextByte = FALSE;
|
||||
InHALT = FALSE;
|
||||
|
||||
if(gbCgbMode)
|
||||
{
|
||||
AF.W = 0x11b0;
|
||||
BC.W = 0x0000;
|
||||
DE.W = 0xff56;
|
||||
HL.W = 0x000d;
|
||||
if(gbEmulatorType == 4)
|
||||
BC.B.B1 |= 0x01;
|
||||
}
|
||||
}
|
||||
|
||||
// Returns the number of cycles this instruction took
|
||||
int GBZ80_RunOp(void)
|
||||
{
|
||||
int clockTicks;
|
||||
uint8 opcode;
|
||||
gbRegister tempRegister;
|
||||
uint8 tempValue;
|
||||
int8 offset;
|
||||
|
||||
|
||||
// HALT will be exited even when interrupts are disabled by IFF
|
||||
if(register_IF & register_IE)
|
||||
InHALT = FALSE;
|
||||
|
||||
if(IFF)
|
||||
{
|
||||
if(register_IF & register_IE & 0x01)
|
||||
GBZ80_Interrupt(0);
|
||||
else if(register_IF & register_IE & 0x02)
|
||||
GBZ80_Interrupt(1);
|
||||
else if(register_IF & register_IE & 0x04)
|
||||
GBZ80_Interrupt(2);
|
||||
else if(register_IF & register_IE & 0x08)
|
||||
GBZ80_Interrupt(3);
|
||||
else if(register_IF & register_IE & 0x10)
|
||||
GBZ80_Interrupt(4);
|
||||
}
|
||||
|
||||
if(EI_Delayed)
|
||||
{
|
||||
IFF = TRUE;
|
||||
EI_Delayed = FALSE;
|
||||
}
|
||||
|
||||
if(InHALT)
|
||||
return(4);
|
||||
|
||||
opcode = gbReadMemory(PC.W++);
|
||||
|
||||
if(RepeatNextByte)
|
||||
{
|
||||
RepeatNextByte = FALSE;
|
||||
PC.W--;
|
||||
}
|
||||
|
||||
clockTicks = gbCycles[opcode];
|
||||
|
||||
switch(opcode)
|
||||
{
|
||||
case 0xCB:
|
||||
// extended opcode
|
||||
opcode = gbReadMemory(PC.W++);
|
||||
clockTicks = gbCyclesCB[opcode];
|
||||
switch(opcode)
|
||||
{
|
||||
#include "gbCodesCB.h"
|
||||
}
|
||||
break;
|
||||
|
||||
#include "gbCodes.h"
|
||||
}
|
||||
|
||||
return(clockTicks);
|
||||
}
|
||||
|
||||
int GBZ80_StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFVAR(PC.W),
|
||||
SFVAR(SP.W),
|
||||
SFVAR(AF.W),
|
||||
SFVAR(BC.W),
|
||||
SFVAR(DE.W),
|
||||
SFVAR(HL.W),
|
||||
SFVAR(IFF),
|
||||
SFVAR(InHALT),
|
||||
SFVAR(RepeatNextByte),
|
||||
SFVAR(EI_Delayed),
|
||||
SFEND
|
||||
};
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "CPU");
|
||||
|
||||
if(load)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
#ifndef __GB_Z80_H
|
||||
#define __GB_Z80_H
|
||||
|
||||
namespace MDFN_IEN_GB
|
||||
{
|
||||
|
||||
int GBZ80_RunOp(void);
|
||||
void GBZ80_Reset(void);
|
||||
void GBZ80_Interrupt(int which);
|
||||
int GBZ80_StateAction(StateMem *sm, int load, int data_only);
|
||||
|
||||
}
|
||||
#endif
|
|
@ -1,17 +0,0 @@
|
|||
AUTOMAKE_OPTIONS = subdir-objects
|
||||
DEFS = -DLOCALEDIR=\"$(datadir)/locale\" @DEFS@ @MATH_OPTIMIZER_FLAGS@
|
||||
DEFAULT_INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/intl
|
||||
|
||||
noinst_LIBRARIES = libnes.a
|
||||
mednafen_SOURCES = nes.cpp x6502.cpp cart.cpp fds.cpp ines.cpp input.cpp nsf.cpp nsfe.cpp unif.cpp vsuni.cpp sound.cpp filter.cpp fds-sound.cpp
|
||||
|
||||
if WANT_DEBUGGER
|
||||
mednafen_SOURCES += debug.cpp
|
||||
endif
|
||||
|
||||
include ppu/Makefile.am.inc
|
||||
include boards/Makefile.am.inc
|
||||
include input/Makefile.am.inc
|
||||
#include mappers/Makefile.am.inc
|
||||
|
||||
libnes_a_SOURCES = $(mednafen_SOURCES) ntsc/nes_ntsc.cpp
|
File diff suppressed because it is too large
Load Diff
|
@ -1,45 +0,0 @@
|
|||
#include "mapinc.h"
|
||||
|
||||
static uint8 latch;
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setprg32(0x8000, latch >> 1);
|
||||
setchr8(latch & 0x07);
|
||||
}
|
||||
|
||||
static DECLFW(m107w)
|
||||
{
|
||||
latch = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
latch = 0;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFVAR(latch),
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
Sync();
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int Mapper107_Init(CartInfo *info)
|
||||
{
|
||||
info->Power = Power;
|
||||
info->StateAction = StateAction;
|
||||
SetWriteHandler(0x8000,0xffff,m107w);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
|
||||
return(1);
|
||||
}
|
|
@ -1,120 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static char Mirroring;
|
||||
static uint8 RegSelect;
|
||||
static uint8 Regs[8];
|
||||
|
||||
static uint8 *WRAM = NULL;
|
||||
|
||||
static void SyncPRGCHR(void)
|
||||
{
|
||||
setprg8(0x8000, Regs[0]);
|
||||
setprg8(0xa000, Regs[1]);
|
||||
setchr2(0x0000, Regs[2] >> 1);
|
||||
setchr2(0x0800, Regs[3] >> 1);
|
||||
setchr1(0x1000, Regs[4]);
|
||||
setchr1(0x1400, Regs[5]);
|
||||
setchr1(0x1800, Regs[6]);
|
||||
setchr1(0x1C00, Regs[7]);
|
||||
}
|
||||
|
||||
static DECLFW(Mapper112_write)
|
||||
{
|
||||
switch(A)
|
||||
{
|
||||
case 0xe000:Mirroring = V & 1; setmirror((V&1) ^ 1); break;
|
||||
case 0x8000:RegSelect = V & 0x7; break;
|
||||
case 0xa000:Regs[RegSelect & 7] = V;
|
||||
SyncPRGCHR();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
int x;
|
||||
for(x = 0; x < 8; x++)
|
||||
Regs[x] = ~0;
|
||||
Mirroring = 1;
|
||||
setmirror(Mirroring ^ 1);
|
||||
SyncPRGCHR();
|
||||
setprg16(0xc000, 0x7F);
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
|
||||
if(!info->battery)
|
||||
memset(WRAM, 0xFF, 8192);
|
||||
}
|
||||
|
||||
static void Close(void)
|
||||
{
|
||||
if(WRAM)
|
||||
{
|
||||
free(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFVAR(RegSelect),
|
||||
SFVAR(Mirroring),
|
||||
SFARRAY(Regs, 8),
|
||||
SFARRAY(WRAM, 8192),
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "M112");
|
||||
if(load)
|
||||
{
|
||||
Mirroring &= 1;
|
||||
SyncPRGCHR();
|
||||
setmirror(Mirroring ^ 1);
|
||||
}
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int Mapper112_Init(CartInfo *info)
|
||||
{
|
||||
SetWriteHandler(0x8000,0xffff,Mapper112_write);
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||
info->Power = Power;
|
||||
info->Close = Close;
|
||||
info->StateAction = StateAction;
|
||||
|
||||
if(!(WRAM = (uint8 *)malloc(8192)))
|
||||
return(0);
|
||||
|
||||
SetupCartPRGMapping(0x10, WRAM, 8192, 1);
|
||||
|
||||
if(info->battery)
|
||||
{
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = 8192;
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
|
|
@ -1,77 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
/* I'm getting the feeling this is another "jam two different bank
|
||||
switching hardwares into one mapper".
|
||||
*/
|
||||
|
||||
static uint8 latch;
|
||||
|
||||
/* HES 4-in-1 */
|
||||
static DECLFW(Mapper113_write)
|
||||
{
|
||||
latch = V;
|
||||
|
||||
setprg32(0x8000, (V >> 3) & 0x7);
|
||||
setchr8(V & 0x7);
|
||||
}
|
||||
|
||||
|
||||
/* Deathbots */
|
||||
static DECLFW(Mapper113_writeh)
|
||||
{
|
||||
latch = ((V & 0x7) << 3);
|
||||
setprg32(0x8000, V & 0x7);
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
latch = 0;
|
||||
setprg32(0x8000, 0);
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFVAR(latch),
|
||||
SFEND
|
||||
};
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "M113");
|
||||
if(load)
|
||||
{
|
||||
setprg32(0x8000, (latch >> 3) & 0x7);
|
||||
setchr8(latch & 0x7);
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
int Mapper113_Init(CartInfo *info)
|
||||
{
|
||||
info->Power = Power;
|
||||
info->StateAction = StateAction;
|
||||
SetWriteHandler(0x4020,0x7fff,Mapper113_write);
|
||||
SetWriteHandler(0x8000,0xffff,Mapper113_writeh);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
|
||||
return(1);
|
||||
}
|
|
@ -1,138 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 master, incmd, IRQCount, cmd, regs[8], Mirroring;
|
||||
|
||||
static void dochr(void)
|
||||
{
|
||||
setchr2(0x0000,(regs[0]>>1));
|
||||
setchr2(0x0800,(regs[2]>>1));
|
||||
setchr1(0x1000, regs[6]);
|
||||
setchr1(0x1400, regs[1]);
|
||||
setchr1(0x1800, regs[7]);
|
||||
setchr1(0x1c00, regs[3]);
|
||||
}
|
||||
|
||||
static void doprg()
|
||||
{
|
||||
if(master&0x80)
|
||||
{
|
||||
setprg16(0x8000,master&0x1F);
|
||||
}
|
||||
else
|
||||
{
|
||||
setprg8(0x8000,regs[4]);
|
||||
setprg8(0xa000,regs[5]);
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(Mapper114_write)
|
||||
{
|
||||
if(A<=0x7FFF)
|
||||
{
|
||||
master=V;
|
||||
doprg();
|
||||
}
|
||||
else if(A==0xe003) IRQCount=V;
|
||||
else if(A==0xe002) X6502_IRQEnd(MDFN_IQEXT);
|
||||
else switch(A&0xE000)
|
||||
{
|
||||
case 0x8000:Mirroring = V & 1; setmirror((V & 1) ^ 1);break;
|
||||
case 0xa000:cmd=V;incmd=1;break;
|
||||
case 0xc000:
|
||||
if(!incmd) break;
|
||||
regs[cmd & 0x7]=V;
|
||||
switch(cmd & 0x7)
|
||||
{
|
||||
case 0x0: case 1: case 2: case 3: case 6: case 7:
|
||||
dochr();break;
|
||||
case 0x4:
|
||||
case 0x5:doprg();break;
|
||||
}
|
||||
incmd=0;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void Mapper114_hb(void)
|
||||
{
|
||||
if(IRQCount)
|
||||
{
|
||||
IRQCount--;
|
||||
if(!IRQCount)
|
||||
{
|
||||
X6502_IRQBegin(MDFN_IQEXT);
|
||||
//printf("IRQ: %d\n",scanline);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFVAR(master), SFVAR(incmd), SFVAR(IRQCount), SFVAR(Mirroring), SFVAR(cmd),
|
||||
SFARRAY(regs, 8),
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "M114");
|
||||
if(load)
|
||||
{
|
||||
Mirroring &= 1;
|
||||
dochr();
|
||||
doprg();
|
||||
setmirror(Mirroring ^ 1);
|
||||
}
|
||||
|
||||
return(ret);
|
||||
}
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
int x;
|
||||
|
||||
IRQCount = 0;
|
||||
master = incmd = cmd = ~0;
|
||||
|
||||
for(x = 0; x < 8; x++)
|
||||
regs[x] = ~0;
|
||||
|
||||
dochr();
|
||||
doprg();
|
||||
setprg16(0xc000, ~0);
|
||||
|
||||
Mirroring = 1;
|
||||
setmirror(Mirroring ^ 1);
|
||||
}
|
||||
|
||||
int Mapper114_Init(CartInfo *info)
|
||||
{
|
||||
GameHBIRQHook=Mapper114_hb;
|
||||
SetWriteHandler(0x6000,0xffff,Mapper114_write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
info->Power = Power;
|
||||
info->StateAction = StateAction;
|
||||
return(1);
|
||||
}
|
||||
|
|
@ -1,110 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 IRQLatch, IRQCount, CHRBanks[8], PRGBanks[4], IRQa;
|
||||
|
||||
static void DoPRG(void)
|
||||
{
|
||||
int x;
|
||||
for(x = 0; x < 4; x++)
|
||||
setprg8(0x8000 + 8192 * x, PRGBanks[x]);
|
||||
}
|
||||
|
||||
static void DoCHR(void)
|
||||
{
|
||||
int x;
|
||||
for(x = 0; x < 8; x++)
|
||||
setchr1(0x0000 + 1024 * x, CHRBanks[x]);
|
||||
}
|
||||
|
||||
static DECLFW(Mapper117_write)
|
||||
{
|
||||
A &= 0xF00F;
|
||||
|
||||
if(A >= 0xa000 && A <= 0xa007)
|
||||
{
|
||||
CHRBanks[A & 7] = V;
|
||||
DoCHR();
|
||||
}
|
||||
else
|
||||
{
|
||||
//A &= 0xF003;
|
||||
if(A >= 0x8000 && A <= 0x8003)
|
||||
{
|
||||
PRGBanks[A & 3] = V;
|
||||
DoPRG();
|
||||
}
|
||||
else
|
||||
switch(A)
|
||||
{
|
||||
case 0xc001:IRQLatch=V;break;
|
||||
case 0xc003:IRQCount=IRQLatch;IRQa|=2;break;
|
||||
case 0xe000:IRQa&=~1;IRQa|=V&1;X6502_IRQEnd(MDFN_IQEXT);break;
|
||||
case 0xc002:X6502_IRQEnd(MDFN_IQEXT);break;
|
||||
//default: printf("Oops: %04x $%02x\n", A, V); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void Mapper117_hb(void)
|
||||
{
|
||||
if(IRQa==3 && IRQCount)
|
||||
{
|
||||
IRQCount--;
|
||||
if(!IRQCount)
|
||||
{
|
||||
IRQa&=1;
|
||||
X6502_IRQBegin(MDFN_IQEXT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
int x;
|
||||
|
||||
IRQCount = IRQLatch = ~0;
|
||||
IRQa = 3;
|
||||
|
||||
for(x = 0; x < 8; x++)
|
||||
CHRBanks[x] = ~0;
|
||||
|
||||
for(x = 0; x < 4; x++)
|
||||
PRGBanks[x] = ~0;
|
||||
|
||||
DoCHR();
|
||||
DoPRG();
|
||||
|
||||
//IRQa = 0;
|
||||
//setprg16(0x8000, 0);
|
||||
//setprg16(0xc000, ~0);
|
||||
}
|
||||
|
||||
int Mapper117_Init(CartInfo *info)
|
||||
{
|
||||
info->Power = Power;
|
||||
GameHBIRQHook=Mapper117_hb;
|
||||
SetWriteHandler(0x8000,0xffff,Mapper117_write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
return(1);
|
||||
}
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
#include "mapinc.h"
|
||||
|
||||
static uint8 latch;
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setchr8(latch & 0xF);
|
||||
setprg32(0x8000, (latch >> 4));
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFVAR(latch),
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
Sync();
|
||||
return(ret);
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
latch = 0;
|
||||
Sync();
|
||||
}
|
||||
|
||||
|
||||
static DECLFW(Write)
|
||||
{
|
||||
latch = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
int Mapper140_Init(CartInfo *info)
|
||||
{
|
||||
SetWriteHandler(0x6000, 0x7FFF, Write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
info->StateAction = StateAction;
|
||||
info->Power = Power;
|
||||
return(1);
|
||||
}
|
|
@ -1,91 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2003 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 latch[2];
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
int x;
|
||||
|
||||
setmirror(((latch[0]>>6)&1)^1);
|
||||
switch(latch[1]&0x3)
|
||||
{
|
||||
case 0x0:
|
||||
for(x=0;x<4;x++)
|
||||
setprg8(0x8000+x*8192,(((latch[0]&0x7F)<<1)+x)^(latch[0]>>7));
|
||||
break;
|
||||
case 0x2:
|
||||
for(x=0;x<4;x++)
|
||||
setprg8(0x8000+x*8192,((latch[0]&0x7F)<<1)+(latch[0]>>7));
|
||||
break;
|
||||
case 0x1:
|
||||
case 0x3:
|
||||
for(x=0;x<4;x++)
|
||||
{
|
||||
unsigned int b;
|
||||
|
||||
b=latch[0]&0x7F;
|
||||
if(x>=2 && !(latch[1]&0x2))
|
||||
b=0x7F;
|
||||
setprg8(0x8000+x*8192,(x&1)+((b<<1)^(latch[0]>>7)));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static DECLFW(Mapper15_write)
|
||||
{
|
||||
latch[0]=V;
|
||||
latch[1]=A&3;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
latch[0] = latch[1] = 0;
|
||||
Sync();
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFARRAY(latch, 2),
|
||||
SFEND
|
||||
};
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
Sync();
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int Mapper15_Init(CartInfo *info)
|
||||
{
|
||||
info->Power = Power;
|
||||
info->StateAction = StateAction;
|
||||
SetWriteHandler(0x8000,0xFFFF,Mapper15_write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
return(1);
|
||||
}
|
||||
|
|
@ -1,81 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 PRGBanks[3], CHRBanks[2];
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
for(int x = 0; x < 3; x++)
|
||||
setprg8(0x8000 + x * 8192, PRGBanks[x]);
|
||||
setchr4(0x0000, CHRBanks[0]);
|
||||
setchr4(0x1000, CHRBanks[1]);
|
||||
}
|
||||
|
||||
static DECLFW(Mapper151_write)
|
||||
{
|
||||
switch(A&0xF000)
|
||||
{
|
||||
case 0x8000:PRGBanks[0] = V; break;
|
||||
case 0xA000:PRGBanks[1] = V; break;
|
||||
case 0xC000:PRGBanks[2] = V; break;
|
||||
case 0xe000:CHRBanks[0] = V; break;
|
||||
case 0xf000:CHRBanks[1] = V; break;
|
||||
}
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
int x;
|
||||
for(x = 0; x < 3; x++)
|
||||
PRGBanks[x] = ~0;
|
||||
|
||||
for(x = 0; x < 2; x++)
|
||||
CHRBanks[x] = x;
|
||||
|
||||
Sync();
|
||||
setprg8(0xe000, ~0);
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFARRAY(PRGBanks, 3), SFARRAY(CHRBanks, 2), SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
Sync();
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int Mapper151_Init(CartInfo *info)
|
||||
{
|
||||
info->Power = Power;
|
||||
info->StateAction = StateAction;
|
||||
SetWriteHandler(0x8000,0xffff,Mapper151_write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
#include "mapinc.h"
|
||||
|
||||
static uint8 latch;
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setprg16(0x8000, (latch >> 4) & 0x07);
|
||||
setchr8(latch & 0x0F);
|
||||
setmirror((latch >> 7) ? MI_1 : MI_0);
|
||||
}
|
||||
|
||||
static DECLFW(Mapper152_write)
|
||||
{
|
||||
latch = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
latch = 0;
|
||||
setprg16(0xc000, 0x07);
|
||||
Sync();
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFVAR(latch),
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
Sync();
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int Mapper152_Init(CartInfo *info)
|
||||
{
|
||||
info->Power = Power;
|
||||
info->StateAction = StateAction;
|
||||
SetWriteHandler(0x6000,0xffff,Mapper152_write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
#include "mapinc.h"
|
||||
|
||||
static uint8 CHRBanks[8], PRGBank16;
|
||||
static uint8 WRAM[8192];
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setprg16(0x8000, PRGBank16);
|
||||
for(int x = 0; x < 8; x++)
|
||||
setchr1(x * 1024, CHRBanks[x]);
|
||||
}
|
||||
|
||||
static DECLFW(M156Write)
|
||||
{
|
||||
if(A>=0xc000 && A<=0xC003)
|
||||
CHRBanks[A & 3] = V;
|
||||
else if(A>=0xc008 && A<=0xc00b)
|
||||
CHRBanks[4 + (A & 3)] = V;
|
||||
if(A==0xc010)
|
||||
PRGBank16 = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
for(int x = 0; x < 8; x++)
|
||||
CHRBanks[x] = x;
|
||||
PRGBank16 = 0;
|
||||
Sync();
|
||||
setprg16(0xc000, 0xFF);
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
if(!info->battery)
|
||||
memset(WRAM, 0xFF, 8192);
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFARRAY(CHRBanks, 8),
|
||||
SFVAR(PRGBank16),
|
||||
SFARRAY(WRAM, 8192),
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
Sync();
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int Mapper156_Init(CartInfo *info)
|
||||
{
|
||||
setmirror(MI_0);
|
||||
SetWriteHandler(0xc000,0xc010,M156Write);
|
||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
info->Power = Power;
|
||||
info->StateAction = StateAction;
|
||||
SetupCartPRGMapping(0x10, WRAM, 8192, 1);
|
||||
if(info->battery)
|
||||
{
|
||||
memset(WRAM, 0xFF, 8192);
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = 8192;
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
|
|
@ -1,446 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 1998 BERO
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 IRQa, CHRBanks[8], PRGBank16, Mirroring;
|
||||
static uint16 IRQCount, IRQLatch;
|
||||
|
||||
static void BandaiIRQHook(int a)
|
||||
{
|
||||
if(IRQa)
|
||||
{
|
||||
uint16 last_irq = IRQCount;
|
||||
IRQCount-=a;
|
||||
if(IRQCount > last_irq)
|
||||
{
|
||||
X6502_IRQBegin(MDFN_IQEXT);
|
||||
IRQa=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void DoCHR(void)
|
||||
{
|
||||
for(int x = 0; x < 8; x++)
|
||||
setchr1(x << 10, CHRBanks[x]);
|
||||
}
|
||||
|
||||
static void DoPRG(void)
|
||||
{
|
||||
setprg16(0x8000, PRGBank16 & 0xF);
|
||||
}
|
||||
|
||||
static void DoMirroring(void)
|
||||
{
|
||||
static const int mir_tab[4] = { MI_V, MI_H, MI_0, MI_1 };
|
||||
setmirror(mir_tab[Mirroring & 3]);
|
||||
}
|
||||
|
||||
static DECLFW(Mapper16_write)
|
||||
{
|
||||
A&=0xF;
|
||||
|
||||
if(A<=0x7)
|
||||
{
|
||||
CHRBanks[A & 0x7] = V;
|
||||
DoCHR();
|
||||
}
|
||||
else if(A==0x8)
|
||||
{
|
||||
PRGBank16 = V & 0xF;
|
||||
DoPRG();
|
||||
}
|
||||
else switch(A)
|
||||
{
|
||||
case 0x9: Mirroring = V & 3;
|
||||
DoMirroring();
|
||||
break;
|
||||
case 0xA: X6502_IRQEnd(MDFN_IQEXT);
|
||||
IRQa=V&1;
|
||||
IRQCount=IRQLatch;
|
||||
break;
|
||||
case 0xB: IRQLatch&=0xFF00;
|
||||
IRQLatch|=V;
|
||||
break;
|
||||
case 0xC: IRQLatch&=0xFF;
|
||||
IRQLatch|=V<<8;
|
||||
break;
|
||||
case 0xD: break;/* Serial EEPROM control port */
|
||||
}
|
||||
}
|
||||
|
||||
// Famicom jump 2:
|
||||
// 0-7: Lower bit of data selects which 256KB PRG block is in use.
|
||||
// This seems to be a hack on the developers' part, so I'll make emulation
|
||||
// of it a hack(I think the current PRG block would depend on whatever the
|
||||
// lowest bit of the CHR bank switching register that corresponds to the
|
||||
// last CHR address read).
|
||||
|
||||
static uint8 WRAM[8192];
|
||||
|
||||
static void DoPRG_153(void)
|
||||
{
|
||||
uint32 base=(CHRBanks[0]&1)<<4;
|
||||
setprg16(0x8000,(PRGBank16&0xF)|base);
|
||||
setprg16(0xC000,base|0xF);
|
||||
}
|
||||
|
||||
static DECLFW(Mapper153_write)
|
||||
{
|
||||
A&=0xF;
|
||||
if(A<=0x7)
|
||||
{
|
||||
CHRBanks[A & 0x7] = V;
|
||||
DoPRG_153();
|
||||
}
|
||||
else if(A==0x8)
|
||||
{
|
||||
PRGBank16 = V;
|
||||
DoPRG_153();
|
||||
}
|
||||
else switch(A) {
|
||||
case 0x9: Mirroring = V;
|
||||
DoMirroring();
|
||||
break;
|
||||
case 0xA:X6502_IRQEnd(MDFN_IQEXT);
|
||||
IRQa=V&1;
|
||||
IRQCount=IRQLatch;
|
||||
break;
|
||||
case 0xB:IRQLatch&=0xFF00;
|
||||
IRQLatch|=V;
|
||||
break;
|
||||
case 0xC:IRQLatch&=0xFF;
|
||||
IRQLatch|=V<<8;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
IRQCount = IRQLatch = IRQa = 0;
|
||||
PRGBank16 = 0;
|
||||
for(int x = 0; x < 8; x++)
|
||||
CHRBanks[x] = x;
|
||||
DoPRG();
|
||||
DoCHR();
|
||||
DoMirroring();
|
||||
|
||||
setprg16(0xc000, 0xF);
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFARRAY(CHRBanks, 8),
|
||||
SFVAR(PRGBank16),
|
||||
SFVAR(IRQa), SFVAR(IRQCount), SFVAR(IRQLatch),
|
||||
SFVAR(Mirroring),
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
{
|
||||
DoPRG();
|
||||
DoCHR();
|
||||
DoMirroring();
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int Mapper16_Init(CartInfo *info)
|
||||
{
|
||||
info->Power = Power;
|
||||
info->StateAction = StateAction;
|
||||
MapIRQHook = BandaiIRQHook;
|
||||
SetWriteHandler(0x6000,0xFFFF,Mapper16_write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
||||
static int StateAction_153(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFARRAY(CHRBanks, 8),
|
||||
SFVAR(PRGBank16),
|
||||
SFVAR(IRQa), SFVAR(IRQCount), SFVAR(IRQLatch),
|
||||
SFVAR(Mirroring),
|
||||
SFARRAY(WRAM, 8192),
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
{
|
||||
DoPRG_153();
|
||||
//DoCHR();
|
||||
DoMirroring();
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
static void Power_153(CartInfo *info)
|
||||
{
|
||||
IRQCount = IRQLatch = IRQa = 0;
|
||||
PRGBank16 = 0;
|
||||
for(int x = 0; x < 8; x++)
|
||||
CHRBanks[x] = x;
|
||||
DoPRG_153();
|
||||
DoCHR();
|
||||
DoMirroring();
|
||||
|
||||
setprg16r(0x10, 0x6000, 0);
|
||||
|
||||
if(!info->battery)
|
||||
memset(WRAM, 0xFF, 8192);
|
||||
}
|
||||
|
||||
int Mapper153_Init(CartInfo *info)
|
||||
{
|
||||
MapIRQHook=BandaiIRQHook;
|
||||
SetWriteHandler(0x8000,0xFFFF,Mapper153_write);
|
||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
|
||||
info->Power = Power_153;
|
||||
info->StateAction = StateAction_153;
|
||||
SetupCartPRGMapping(0x10, WRAM, 8192, 1);
|
||||
if(info->battery)
|
||||
{
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = 8192;
|
||||
}
|
||||
/* This mapper/board seems to have WRAM at $6000-$7FFF. */
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
static uint8 BarcodeData[256];
|
||||
static uint8 BarcodeReadPos;
|
||||
static uint32 BarcodeCycleCount;
|
||||
static uint8 BarcodeOut;
|
||||
|
||||
int MDFNI_DatachSet(const uint8 *rcode)
|
||||
{
|
||||
int prefix_parity_type[10][6] = {
|
||||
{0,0,0,0,0,0}, {0,0,1,0,1,1}, {0,0,1,1,0,1}, {0,0,1,1,1,0},
|
||||
{0,1,0,0,1,1}, {0,1,1,0,0,1}, {0,1,1,1,0,0}, {0,1,0,1,0,1},
|
||||
{0,1,0,1,1,0}, {0,1,1,0,1,0}
|
||||
};
|
||||
int data_left_odd[10][7] = {
|
||||
{0,0,0,1,1,0,1}, {0,0,1,1,0,0,1}, {0,0,1,0,0,1,1}, {0,1,1,1,1,0,1},
|
||||
{0,1,0,0,0,1,1}, {0,1,1,0,0,0,1}, {0,1,0,1,1,1,1}, {0,1,1,1,0,1,1},
|
||||
{0,1,1,0,1,1,1}, {0,0,0,1,0,1,1}
|
||||
};
|
||||
int data_left_even[10][7] = {
|
||||
{0,1,0,0,1,1,1}, {0,1,1,0,0,1,1}, {0,0,1,1,0,1,1}, {0,1,0,0,0,0,1},
|
||||
{0,0,1,1,1,0,1}, {0,1,1,1,0,0,1}, {0,0,0,0,1,0,1}, {0,0,1,0,0,0,1},
|
||||
{0,0,0,1,0,0,1}, {0,0,1,0,1,1,1}
|
||||
};
|
||||
int data_right[10][7] = {
|
||||
{1,1,1,0,0,1,0}, {1,1,0,0,1,1,0}, {1,1,0,1,1,0,0}, {1,0,0,0,0,1,0},
|
||||
{1,0,1,1,1,0,0}, {1,0,0,1,1,1,0}, {1,0,1,0,0,0,0}, {1,0,0,0,1,0,0},
|
||||
{1,0,0,1,0,0,0}, {1,1,1,0,1,0,0}
|
||||
};
|
||||
uint8 code[13+1];
|
||||
uint32 tmp_p=0;
|
||||
int i, j;
|
||||
int len;
|
||||
|
||||
for(i=len=0;i<13;i++)
|
||||
{
|
||||
if(!rcode[i]) break;
|
||||
|
||||
if((code[i]=rcode[i]-'0') > 9)
|
||||
return(0);
|
||||
len++;
|
||||
}
|
||||
if(len!=13 && len!=12 && len!=8 && len!=7) return(0);
|
||||
|
||||
#define BS(x) BarcodeData[tmp_p]=x;tmp_p++
|
||||
|
||||
for(j=0;j<32;j++)
|
||||
{
|
||||
BS(0x00);
|
||||
}
|
||||
|
||||
/* Left guard bars */
|
||||
BS(1); BS(0); BS(1);
|
||||
|
||||
if(len==13 || len==12)
|
||||
{
|
||||
uint32 csum;
|
||||
|
||||
for(i=0;i<6;i++)
|
||||
if(prefix_parity_type[code[0]][i])
|
||||
{
|
||||
for(j=0;j<7;j++)
|
||||
{
|
||||
BS(data_left_even[code[i+1]][j]);
|
||||
}
|
||||
}
|
||||
else
|
||||
for(j=0;j<7;j++)
|
||||
{
|
||||
BS(data_left_odd[code[i+1]][j]);
|
||||
}
|
||||
|
||||
/* Center guard bars */
|
||||
BS(0); BS(1); BS(0); BS(1); BS(0);
|
||||
|
||||
for(i=7;i<12;i++)
|
||||
for(j=0;j<7;j++)
|
||||
{
|
||||
BS(data_right[code[i]][j]);
|
||||
}
|
||||
csum=0;
|
||||
for(i=0;i<12;i++) csum+=code[i]*((i&1)?3:1);
|
||||
csum=(10-(csum%10))%10;
|
||||
//printf("%d\n",csum);
|
||||
for(j=0;j<7;j++)
|
||||
{
|
||||
BS(data_right[csum][j]);
|
||||
}
|
||||
|
||||
}
|
||||
else if(len==8 || len==7)
|
||||
{
|
||||
uint32 csum=0;
|
||||
|
||||
for(i=0;i<7;i++) csum+=(i&1)?code[i]:(code[i]*3);
|
||||
|
||||
csum=(10-(csum%10))%10;
|
||||
|
||||
for(i=0;i<4;i++)
|
||||
for(j=0;j<7;j++)
|
||||
{
|
||||
BS(data_left_odd[code[i]][j]);
|
||||
}
|
||||
|
||||
|
||||
/* Center guard bars */
|
||||
BS(0); BS(1); BS(0); BS(1); BS(0);
|
||||
|
||||
for(i=4;i<7;i++)
|
||||
for(j=0;j<7;j++)
|
||||
{
|
||||
BS(data_right[code[i]][j]);
|
||||
}
|
||||
|
||||
for(j=0;j<7;j++)
|
||||
{ BS(data_right[csum][j]);}
|
||||
|
||||
}
|
||||
|
||||
/* Right guard bars */
|
||||
BS(1); BS(0); BS(1);
|
||||
|
||||
for(j=0;j<32;j++)
|
||||
{
|
||||
BS(0x00);
|
||||
}
|
||||
|
||||
BS(0xFF);
|
||||
#undef BS
|
||||
BarcodeReadPos=0;
|
||||
BarcodeOut=0x8;
|
||||
BarcodeCycleCount=0;
|
||||
return(1);
|
||||
}
|
||||
|
||||
static void BarcodeIRQHook(int a)
|
||||
{
|
||||
BandaiIRQHook(a);
|
||||
|
||||
BarcodeCycleCount+=a;
|
||||
|
||||
if(BarcodeCycleCount >= 1000)
|
||||
{
|
||||
BarcodeCycleCount -= 1000;
|
||||
if(BarcodeData[BarcodeReadPos]==0xFF)
|
||||
{
|
||||
BarcodeOut=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
BarcodeOut=(BarcodeData[BarcodeReadPos]^1)<<3;
|
||||
BarcodeReadPos++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFR(Mapper157_read)
|
||||
{
|
||||
uint8 ret;
|
||||
|
||||
ret=BarcodeOut;
|
||||
return(ret);
|
||||
}
|
||||
|
||||
static void Mapper157_Power(CartInfo *info)
|
||||
{
|
||||
BarcodeData[0]=0xFF;
|
||||
BarcodeReadPos=0;
|
||||
BarcodeOut=0;
|
||||
BarcodeCycleCount=0;
|
||||
|
||||
Power(info);
|
||||
}
|
||||
|
||||
static int StateAction_157(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFARRAY(BarcodeData, 256),
|
||||
SFVAR(BarcodeReadPos), SFVAR(BarcodeCycleCount), SFVAR(BarcodeOut),
|
||||
SFARRAY(CHRBanks, 8),
|
||||
SFVAR(PRGBank16),
|
||||
SFVAR(IRQa), SFVAR(IRQCount), SFVAR(IRQLatch),
|
||||
SFVAR(Mirroring),
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
{
|
||||
DoPRG();
|
||||
DoCHR();
|
||||
DoMirroring();
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int Mapper157_Init(CartInfo *info)
|
||||
{
|
||||
info->Power = Mapper157_Power;
|
||||
info->StateAction = StateAction_157;
|
||||
MDFNGameInfo->cspecial = "datach";
|
||||
MapIRQHook=BarcodeIRQHook;
|
||||
SetWriteHandler(0x6000, 0xFFFF, Mapper16_write);
|
||||
SetReadHandler(0x6000, 0x7FFF, Mapper157_read);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
return(1);
|
||||
}
|
|
@ -1,199 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* Mapper 163(Nanjing) emulation Based on code from VirtuaNES */
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint8 security, trigger, strobe;
|
||||
static uint8 regs[2];
|
||||
static uint8 chrbank[2];
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setprg32(0x8000, (regs[0] & 0xF) | ((regs[1] & 0xF) << 4));
|
||||
setchr4(0x0000, chrbank[0]);
|
||||
setchr4(0x1000, chrbank[1]);
|
||||
}
|
||||
|
||||
static DECLFW(Write)
|
||||
{
|
||||
//printf("Write: %04x %02x\n", A, V);
|
||||
switch(A & 0xF300)
|
||||
{
|
||||
case 0x5000: regs[0] = V;
|
||||
if(!(regs[0] & 0x80) && scanline < 128)
|
||||
{
|
||||
chrbank[0] = 0;
|
||||
chrbank[1] = 1;
|
||||
}
|
||||
Sync();
|
||||
break;
|
||||
|
||||
case 0x5100: if(A & 1)
|
||||
{
|
||||
if(strobe && !V)
|
||||
trigger ^= 1;
|
||||
strobe = V;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Needed by NJ023...
|
||||
if(V == 6)
|
||||
{
|
||||
regs[0] &= ~0x0F;
|
||||
regs[0] |= 0x03;
|
||||
regs[1] &= ~0x0F; // Is this correct?
|
||||
Sync();
|
||||
}
|
||||
|
||||
//printf("Oops: %04x %02x\n", A, V);
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x5200: regs[1] = V;
|
||||
Sync();
|
||||
break;
|
||||
|
||||
case 0x5300: security = V;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFR(ReadLow)
|
||||
{
|
||||
//printf("Readlow: %04x\n", A);
|
||||
switch(A & 0xF700)
|
||||
{
|
||||
case 0x5100: return(security);
|
||||
case 0x5500: return(trigger ? security : 0);
|
||||
default: return(4);
|
||||
}
|
||||
return(0x00);
|
||||
}
|
||||
|
||||
static void Mapper163_HB(void)
|
||||
{
|
||||
if(regs[0] & 0x80)
|
||||
{
|
||||
switch(scanline)
|
||||
{
|
||||
case 127: chrbank[0] = 1;
|
||||
chrbank[1] = 1;
|
||||
break;
|
||||
|
||||
case 239: chrbank[0] = 0;
|
||||
chrbank[1] = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(BWRAM)
|
||||
{
|
||||
//printf("WriteRA: %04x %02x\n", A, V);
|
||||
WRAM[A-0x6000]=V;
|
||||
}
|
||||
|
||||
static DECLFR(AWRAM)
|
||||
{
|
||||
//printf("ReadRA: %04x\n", A);
|
||||
return(WRAM[A-0x6000]);
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
|
||||
regs[0] = 0x8F;
|
||||
regs[1] = 0x00;
|
||||
strobe = 1;
|
||||
security = 0x00;
|
||||
trigger = 0;
|
||||
|
||||
chrbank[0] = 0;
|
||||
chrbank[1] = 1;
|
||||
Sync();
|
||||
|
||||
if(!info->battery)
|
||||
memset(WRAM, 0xFF, 8192); // 0xFF or 0x00?
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFARRAY(WRAM, 8192),
|
||||
SFARRAY(regs, 2),
|
||||
SFARRAY(chrbank, 2),
|
||||
SFVAR(strobe),
|
||||
SFVAR(security),
|
||||
SFVAR(trigger),
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
|
||||
if(load)
|
||||
{
|
||||
Sync();
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
static void Close(void)
|
||||
{
|
||||
if(WRAM)
|
||||
{
|
||||
free(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
int Mapper163_Init(CartInfo *info)
|
||||
{
|
||||
info->Power = Power;
|
||||
info->StateAction = StateAction;
|
||||
info->Close = Close;
|
||||
|
||||
GameHBIRQHook2 = Mapper163_HB;
|
||||
|
||||
|
||||
if(!(WRAM = (uint8 *)malloc(8192)))
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
memset(WRAM, 0x00, 8192); // 0x00 needed over 0xFF for NJ079. Probably programmed that way in the factory?
|
||||
MDFNMP_AddRAM(8192, 0x6000, WRAM);
|
||||
if(info->battery)
|
||||
{
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = 8192;
|
||||
}
|
||||
|
||||
SetReadHandler(0x5000, 0x5FFF, ReadLow);
|
||||
SetWriteHandler(0x5000, 0x5FFF, Write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
|
||||
SetReadHandler(0x6000, 0x7FFF, AWRAM);
|
||||
SetWriteHandler(0x6000, 0x7FFF, BWRAM);
|
||||
|
||||
return(1);
|
||||
}
|
|
@ -1,164 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint16 IRQCount, IRQLatch, Mirroring;
|
||||
static uint8 IRQa, PRGBanks[4], CHRBanks[8];
|
||||
static uint8 WRAM[8192];
|
||||
|
||||
static void JalecoIRQHook(int a)
|
||||
{
|
||||
if(IRQa && IRQCount)
|
||||
{
|
||||
uint16 prev = IRQCount;
|
||||
IRQCount-=a;
|
||||
|
||||
if(IRQCount == 0 || IRQCount > prev)
|
||||
{
|
||||
X6502_IRQBegin(MDFN_IQEXT);
|
||||
IRQCount=0;
|
||||
IRQa=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void DoCHR(void)
|
||||
{
|
||||
for(int x = 0; x < 8; x++)
|
||||
setchr1(x * 1024, CHRBanks[x]);
|
||||
}
|
||||
|
||||
static void DoPRG(void)
|
||||
{
|
||||
for(int x = 0; x < 4; x++)
|
||||
setprg8(0x8000 + x * 8192, PRGBanks[x]);
|
||||
}
|
||||
|
||||
static void DoMirroring(void)
|
||||
{
|
||||
if(Mirroring & 2)
|
||||
setmirror(MI_0);
|
||||
else
|
||||
setmirror(Mirroring & 1);
|
||||
}
|
||||
|
||||
static DECLFW(Mapper18_write)
|
||||
{
|
||||
A&=0xF003;
|
||||
if(A>=0x8000 && A<=0x9001)
|
||||
{
|
||||
int x=((A>>1)&1)|((A-0x8000)>>11);
|
||||
|
||||
PRGBanks[x]&=(0xF0)>>((A&1)<<2);
|
||||
PRGBanks[x]|=(V&0xF)<<((A&1)<<2);
|
||||
DoPRG();
|
||||
}
|
||||
else if(A>=0xa000 && A<=0xd003)
|
||||
{
|
||||
int x=((A>>1)&1)|((A-0xA000)>>11);
|
||||
|
||||
CHRBanks[x]&=(0xF0)>>((A&1)<<2);
|
||||
CHRBanks[x]|=(V&0xF)<<((A&1)<<2);
|
||||
DoCHR();
|
||||
}
|
||||
else switch(A)
|
||||
{
|
||||
case 0xe000:IRQLatch&=0xFFF0;IRQLatch|=(V&0x0f);break;
|
||||
case 0xe001:IRQLatch&=0xFF0F;IRQLatch|=(V&0x0f)<<4;break;
|
||||
case 0xe002:IRQLatch&=0xF0FF;IRQLatch|=(V&0x0f)<<8;break;
|
||||
case 0xe003:IRQLatch&=0x0FFF;IRQLatch|=(V&0x0f)<<12;break;
|
||||
case 0xf000:IRQCount=IRQLatch;break;
|
||||
case 0xf001:IRQa=V&1;
|
||||
X6502_IRQEnd(MDFN_IQEXT);
|
||||
break;
|
||||
case 0xf002:Mirroring = V & 3;
|
||||
DoMirroring();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
int x;
|
||||
|
||||
Mirroring = IRQCount = IRQLatch = IRQa = 0;
|
||||
for(x = 0; x < 8; x++)
|
||||
CHRBanks[x] = x;
|
||||
|
||||
PRGBanks[0] = 0;
|
||||
PRGBanks[1] = 1;
|
||||
PRGBanks[2] = ~1;
|
||||
PRGBanks[3] = ~0;
|
||||
|
||||
DoPRG();
|
||||
DoCHR();
|
||||
DoMirroring();
|
||||
|
||||
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
|
||||
if(!info->battery)
|
||||
memset(WRAM, 0xFF, 8192);
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFARRAY(WRAM, 8192),
|
||||
SFVAR(IRQCount), SFVAR(IRQLatch), SFVAR(Mirroring),
|
||||
SFVAR(IRQa), SFARRAY(PRGBanks, 4), SFARRAY(CHRBanks, 8),
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
{
|
||||
DoPRG();
|
||||
DoCHR();
|
||||
DoMirroring();
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int Mapper18_Init(CartInfo *info)
|
||||
{
|
||||
SetupCartPRGMapping(0x10, WRAM, 8192, 1);
|
||||
SetReadHandler(0x6000, 0x7FFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||
|
||||
|
||||
info->StateAction = StateAction;
|
||||
info->Power = Power;
|
||||
SetWriteHandler(0x8000,0xffff,Mapper18_write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
MapIRQHook=JalecoIRQHook;
|
||||
|
||||
|
||||
if(info->battery)
|
||||
{
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = 8192;
|
||||
}
|
||||
|
||||
|
||||
return(1);
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
#include "mapinc.h"
|
||||
|
||||
static uint8 latch;
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setprg16(0xc000, latch & 0xF);
|
||||
}
|
||||
|
||||
static DECLFW(Mapper180_write)
|
||||
{
|
||||
latch = V & 0xF;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
setchr8(0);
|
||||
setprg16(0x8000, 0);
|
||||
latch = 0xF;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{ SFVAR(latch), SFEND };
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
Sync();
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int Mapper180_Init(CartInfo *info)
|
||||
{
|
||||
SetWriteHandler(0x8000,0xffff,Mapper180_write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
info->Power = Power;
|
||||
info->StateAction = StateAction;
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
|
@ -1,79 +0,0 @@
|
|||
#include "mapinc.h"
|
||||
|
||||
static uint8 IRQCount, IRQa, Mirroring, cmd, regs[8];
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setmirror((Mirroring & 1) ^ 1);
|
||||
setchr2(0x0000, regs[0] >> 1);
|
||||
setchr1(0x1400, regs[1]);
|
||||
setchr2(0x0800, regs[2] >> 1);
|
||||
setchr1(0x1c00, regs[3]);
|
||||
setprg8(0x8000, regs[4]);
|
||||
setprg8(0xa000, regs[5]);
|
||||
setchr1(0x1000, regs[6]);
|
||||
setchr1(0x1800, regs[7]);
|
||||
}
|
||||
|
||||
static DECLFW(Mapper182_write)
|
||||
{
|
||||
switch(A&0xf003)
|
||||
{
|
||||
case 0xe003:IRQCount=V;IRQa=1;X6502_IRQEnd(MDFN_IQEXT);break;
|
||||
case 0x8001:Mirroring = V&1; Sync();break;
|
||||
case 0xA000:cmd = V; break;
|
||||
case 0xC000: regs[cmd & 7] = V; Sync(); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void blop(void)
|
||||
{
|
||||
if(IRQa)
|
||||
{
|
||||
if(IRQCount)
|
||||
{
|
||||
IRQCount--;
|
||||
if(!IRQCount)
|
||||
{
|
||||
IRQa=0;
|
||||
X6502_IRQBegin(MDFN_IQEXT);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
IRQCount = IRQa = Mirroring = cmd = 0;
|
||||
for(int x = 0; x < 8; x++)
|
||||
regs[x] = 0xFF;
|
||||
|
||||
Sync();
|
||||
setprg16(0xc000, ~0);
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFVAR(IRQCount), SFVAR(IRQa), SFVAR(Mirroring), SFVAR(cmd),
|
||||
SFARRAY(regs, 8),
|
||||
SFEND
|
||||
};
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
Sync();
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int Mapper182_Init(CartInfo *info)
|
||||
{
|
||||
SetWriteHandler(0x8000,0xFFFF,Mapper182_write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
info->Power = Power;
|
||||
info->StateAction = StateAction;
|
||||
GameHBIRQHook=blop;
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
#include "mapinc.h"
|
||||
|
||||
static uint8 latch;
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setchr4(0x0000, latch & 0xf);
|
||||
setchr4(0x1000, latch >> 4);
|
||||
}
|
||||
|
||||
static DECLFW(Mapper184_write)
|
||||
{
|
||||
latch = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
latch = 0;
|
||||
Sync();
|
||||
setprg32(0x8000, 0);
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFVAR(latch),
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
Sync();
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int Mapper184_Init(CartInfo *info)
|
||||
{
|
||||
SetWriteHandler(0x6000,0xffff,Mapper184_write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
info->Power = Power;
|
||||
info->StateAction = StateAction;
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
#include "mapinc.h"
|
||||
|
||||
static uint8 latch;
|
||||
static uint8 CHRBogus[8192];
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
//printf("%02x\n",mapbyte1[0]);
|
||||
//if((mapbyte1[0]&3)==3)
|
||||
if(CHRmask8[0] == 0)
|
||||
{
|
||||
if((latch&3) == 1)
|
||||
setchr8(0);
|
||||
else
|
||||
setchr8r(0x10,0);
|
||||
}
|
||||
else if(CHRmask8[0] == 1)
|
||||
{
|
||||
if((latch&2)) setchr8(latch&1);
|
||||
else setchr8r(0x10,0);
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(Mapper185_write)
|
||||
{
|
||||
latch=V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFVAR(latch),
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
Sync();
|
||||
return(ret);
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
setprg32(0x8000, 0);
|
||||
latch = 0x0;
|
||||
Sync();
|
||||
}
|
||||
|
||||
int Mapper185_Init(CartInfo *info)
|
||||
{
|
||||
memset(CHRBogus, 0xFF, 8192);
|
||||
info->Power = Power;
|
||||
info->StateAction = StateAction;
|
||||
|
||||
SetupCartCHRMapping(0x10,CHRBogus,8192,0);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000,0xFFFF,Mapper185_write);
|
||||
|
||||
return(1);
|
||||
}
|
|
@ -1,186 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2003 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
// TODO: Remove this mapper or add a StateAction for it!
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 LastWr;
|
||||
static uint8 ExtMode;
|
||||
static uint8 cmd;
|
||||
static uint8 DRegs[8];
|
||||
static uint32 count;
|
||||
static uint32 last;
|
||||
static int safe;
|
||||
static uint8 poofish;
|
||||
|
||||
static int32 IRQCount;
|
||||
static uint8 IRQa;
|
||||
static uint8 IRQLatch;
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
int x;
|
||||
uint32 base=0;
|
||||
|
||||
if(cmd&0x80) base=0x1000;
|
||||
setchr2(0x0000^base,(0x100|DRegs[0])>>1);
|
||||
setchr2(0x0800^base,(0x100|DRegs[1])>>1);
|
||||
for(x=0;x<4;x++)
|
||||
setchr1((0x1000^base)+x*0x400,DRegs[2+x]);
|
||||
|
||||
if(ExtMode&0x80)
|
||||
{
|
||||
if(ExtMode&0x20)
|
||||
setprg32(0x8000,(ExtMode&0x1F)>>1);
|
||||
else
|
||||
{
|
||||
setprg16(0x8000,(ExtMode&0x1F));
|
||||
setprg16(0xc000,(ExtMode&0x1F));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setprg8(0x8000,DRegs[6]);
|
||||
setprg8(0xc000,~1);
|
||||
setprg8(0xa000,DRegs[7]);
|
||||
setprg8(0xe000,~0);
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(M187Write)
|
||||
{
|
||||
LastWr=V;
|
||||
if(A==0x5000)
|
||||
ExtMode=V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(M187HWrite)
|
||||
{
|
||||
//if(A==0x8003 && X.PC<0x800) MDFNI_DumpMem("dmp",0x0000,0xFFFF);
|
||||
//printf("$%04x:$%02x, %04x\n",A,V,X.PC);
|
||||
LastWr=V;
|
||||
|
||||
if(A==0x8003)
|
||||
{
|
||||
if(V==0x28 || V==0x2A)
|
||||
poofish=V;
|
||||
}
|
||||
else if(A==0x8000) poofish=0;
|
||||
|
||||
switch(A)
|
||||
{
|
||||
case 0xc000:IRQLatch=IRQCount=V;break;
|
||||
case 0xc001:IRQCount=IRQLatch;last=count=0;break;
|
||||
case 0xe000:IRQa=0;X6502_IRQEnd(MDFN_IQEXT);break;
|
||||
case 0xe001:IRQa=1;break;
|
||||
case 0xa000:setmirror((V&1) ^ 1);break;
|
||||
|
||||
case 0x8000:cmd=V;safe=1;break;
|
||||
case 0x8001:
|
||||
if(safe)
|
||||
{
|
||||
//printf("Cmd: %d, %02x, %04x\n",cmd&0x7,V,X.PC);
|
||||
DRegs[cmd&7]=V;
|
||||
Sync();
|
||||
safe=0;
|
||||
}
|
||||
if(poofish==0x28) setprg8(0xc000,0x17);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFR(ProtRead)
|
||||
{
|
||||
switch(LastWr&0x3)
|
||||
{
|
||||
case 0x1:
|
||||
case 0x0: return(0x80);
|
||||
case 0x2: return(0x42);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
static void M187Power(CartInfo *info)
|
||||
{
|
||||
LastWr = 0;
|
||||
ExtMode = 0;
|
||||
cmd = 0;
|
||||
|
||||
memset(DRegs, 0, sizeof(DRegs));
|
||||
|
||||
count = 0;
|
||||
last = 0;
|
||||
safe = 0;
|
||||
poofish = 0;
|
||||
|
||||
IRQCount = 0;
|
||||
IRQa = 0;
|
||||
IRQLatch = 0;
|
||||
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void sl(void)
|
||||
{
|
||||
if(IRQa)
|
||||
{
|
||||
if(IRQCount>=0)
|
||||
{
|
||||
IRQCount--;
|
||||
if(IRQCount<0)
|
||||
{
|
||||
X6502_IRQBegin(MDFN_IQEXT);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void foo(uint32 A)
|
||||
{
|
||||
if((A&0x2000) && !(last&0x2000))
|
||||
{
|
||||
count++;
|
||||
if(count==42)
|
||||
{
|
||||
sl();
|
||||
count=0;
|
||||
}
|
||||
}
|
||||
last=A;
|
||||
}
|
||||
|
||||
int Mapper187_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=M187Power;
|
||||
//GameHBIRQHook=sl;
|
||||
PPU_hook=foo;
|
||||
|
||||
SetWriteHandler(0x5000,0x5fff,M187Write);
|
||||
SetWriteHandler(0x8000,0xFFFF,M187HWrite);
|
||||
SetReadHandler(0x5000,0x5FFF,ProtRead);
|
||||
SetWriteHandler(0x6000,0x7FFF,M187Write);
|
||||
SetReadHandler(0x8000,0xffff,CartBR);
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
|
@ -1,103 +0,0 @@
|
|||
/* Is this an MMC3 workalike piece of hardware, with the addition of
|
||||
a register at $4120 or does it have only partial MMC3 functionality?
|
||||
A good test would be to see if commands 6 and 7 can change PRG banks
|
||||
and of course test the regs >=$c000, on the real cart.
|
||||
*/
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 IRQCount, IRQLatch, IRQa, cmd, regs[8];
|
||||
static uint8 PRGBank32, Mirroring;
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setprg32(0x8000, PRGBank32);
|
||||
setchr2(0x0000, regs[0] >> 1);
|
||||
setchr2(0x0800, regs[1] >> 1);
|
||||
setchr1(0x1000, regs[2]);
|
||||
setchr1(0x1400, regs[3]);
|
||||
setchr1(0x1800, regs[4]);
|
||||
setchr1(0x1c00, regs[5]);
|
||||
setmirror((Mirroring & 1) ? MI_H : MI_V);
|
||||
}
|
||||
|
||||
static DECLFW(Mapper189_write)
|
||||
{
|
||||
//if(A>=0xc000) printf("$%04x:$%02x\n",A,V);
|
||||
if((A&0xF100)==0x4100)
|
||||
{
|
||||
PRGBank32 = V >> 4;
|
||||
Sync();
|
||||
}
|
||||
else if((A&0xF100)==0x6100)
|
||||
{
|
||||
PRGBank32 = V & 0x3;
|
||||
Sync();
|
||||
}
|
||||
else switch(A&0xE001)
|
||||
{
|
||||
case 0xa000:Mirroring = V & 1; Sync();break;
|
||||
case 0x8000:cmd=V;break;
|
||||
case 0x8001:regs[cmd & 0x7] = V; Sync(); break;
|
||||
case 0xc000:IRQLatch=V;break;
|
||||
case 0xc001:IRQCount=IRQLatch;break;
|
||||
case 0xe000:IRQa=0;X6502_IRQEnd(MDFN_IQEXT);break;
|
||||
case 0xe001:IRQa=1;break;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
void m189irq(void)
|
||||
{
|
||||
if(IRQa)
|
||||
{
|
||||
if(IRQCount)
|
||||
{
|
||||
IRQCount--;
|
||||
if(!IRQCount) X6502_IRQBegin(MDFN_IQEXT);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
IRQCount = IRQLatch = IRQa = 0;
|
||||
cmd = 0;
|
||||
regs[0] = 0;
|
||||
regs[1] = 2;
|
||||
regs[2] = 4;
|
||||
regs[3] = 5;
|
||||
regs[4] = 6;
|
||||
regs[5] = 7;
|
||||
PRGBank32 = 0;
|
||||
Mirroring = 0;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFARRAY(regs, 8),
|
||||
SFVAR(PRGBank32),
|
||||
SFVAR(IRQCount), SFVAR(IRQLatch), SFVAR(IRQa),
|
||||
SFVAR(Mirroring), SFVAR(cmd),
|
||||
SFEND
|
||||
};
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
Sync();
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int Mapper189_Init(CartInfo *info)
|
||||
{
|
||||
GameHBIRQHook=m189irq;
|
||||
SetWriteHandler(0x4120,0xFFFF,Mapper189_write);
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
info->Power = Power;
|
||||
info->StateAction = StateAction;
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
#include "mapinc.h"
|
||||
|
||||
static uint8 CHRBanks[3], PRGBank8;
|
||||
static void Sync(void)
|
||||
{
|
||||
setchr4(0x0000, CHRBanks[0]);
|
||||
setchr2(0x1000, CHRBanks[1]);
|
||||
setchr2(0x1800, CHRBanks[2]);
|
||||
setprg8(0x8000, PRGBank8);
|
||||
}
|
||||
|
||||
static DECLFW(m193w)
|
||||
{
|
||||
switch(A&3)
|
||||
{
|
||||
case 0:CHRBanks[0] = V >> 2;break;
|
||||
case 1:CHRBanks[1] = (V >> 1) & 0x3F; break;
|
||||
case 2:CHRBanks[2] = (V >> 1) & 0x3F; break;
|
||||
case 3:PRGBank8 = V;break;
|
||||
}
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
CHRBanks[0] = 0;
|
||||
CHRBanks[1] = 2;
|
||||
CHRBanks[2] = 3;
|
||||
PRGBank8 = 0xFC;
|
||||
Sync();
|
||||
setprg8(0xa000, 0xFD);
|
||||
setprg8(0xc000, 0xFE);
|
||||
setprg8(0xe000, 0xFF);
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFARRAY(CHRBanks, 3),
|
||||
SFVAR(PRGBank8),
|
||||
SFEND
|
||||
};
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
Sync();
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
||||
int Mapper193_Init(CartInfo *info)
|
||||
{
|
||||
info->Power = Power;
|
||||
info->StateAction = StateAction;
|
||||
SetWriteHandler(0x4018,0x7fff,m193w);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
return(1);
|
||||
}
|
|
@ -1,157 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2003 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
// TODO: Remove this mapper or add a StateAction()
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 PRGSel;
|
||||
static uint8 PBuf[4],PSel;
|
||||
static uint8 cmd;
|
||||
static uint8 DRegs[8];
|
||||
static uint32 count;
|
||||
static uint32 last;
|
||||
static int32 IRQCount;
|
||||
static uint8 IRQLatch;
|
||||
static uint8 IRQa;
|
||||
|
||||
static DECLFW(M208Write1)
|
||||
{
|
||||
PRGSel=(V&0x1)|((V>>3)&0x2);
|
||||
setprg32(0x8000,PRGSel);
|
||||
}
|
||||
|
||||
static DECLFW(M208Write2)
|
||||
{
|
||||
static const uint8 lut[256]={
|
||||
0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59,0x59, 0x49, 0x19, 0x09, 0x59, 0x49, 0x19, 0x09,
|
||||
0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59,0x51, 0x41, 0x11, 0x01, 0x51, 0x41, 0x11, 0x01,
|
||||
0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59,0x59, 0x49, 0x19, 0x09, 0x59, 0x49, 0x19, 0x09,
|
||||
0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59,0x51, 0x41, 0x11, 0x01, 0x51, 0x41, 0x11, 0x01,
|
||||
0x00, 0x10, 0x40, 0x50, 0x00, 0x10, 0x40, 0x50,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x08, 0x18, 0x48, 0x58, 0x08, 0x18, 0x48, 0x58,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x10, 0x40, 0x50, 0x00, 0x10, 0x40, 0x50,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x08, 0x18, 0x48, 0x58, 0x08, 0x18, 0x48, 0x58,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59,0x58, 0x48, 0x18, 0x08, 0x58, 0x48, 0x18, 0x08,
|
||||
0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59,0x50, 0x40, 0x10, 0x00, 0x50, 0x40, 0x10, 0x00,
|
||||
0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59,0x58, 0x48, 0x18, 0x08, 0x58, 0x48, 0x18, 0x08,
|
||||
0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59,0x50, 0x40, 0x10, 0x00, 0x50, 0x40, 0x10, 0x00,
|
||||
0x01, 0x11, 0x41, 0x51, 0x01, 0x11, 0x41, 0x51,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x09, 0x19, 0x49, 0x59, 0x09, 0x19, 0x49, 0x59,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x01, 0x11, 0x41, 0x51, 0x01, 0x11, 0x41, 0x51,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x09, 0x19, 0x49, 0x59, 0x09, 0x19, 0x49, 0x59,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
|
||||
};
|
||||
if(A<=0x57FF) PSel=V;
|
||||
else
|
||||
PBuf[(A&0x03)]=V^lut[PSel];
|
||||
}
|
||||
|
||||
static DECLFR(M208Read)
|
||||
{
|
||||
return(PBuf[(A&0x3)]);
|
||||
}
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
int x;
|
||||
|
||||
setchr2(0x0000,DRegs[0]>>1);
|
||||
setchr2(0x0800,DRegs[1]>>1);
|
||||
for(x=0;x<4;x++)
|
||||
setchr1(0x1000+x*0x400,DRegs[2+x]);
|
||||
}
|
||||
|
||||
static DECLFW(M208HWrite)
|
||||
{
|
||||
switch(A&0xe001)
|
||||
{
|
||||
case 0xc000:IRQLatch=IRQCount=V;break;
|
||||
case 0xc001:IRQCount=IRQLatch;last=count=0;break;
|
||||
case 0xe000:IRQa=0;X6502_IRQEnd(MDFN_IQEXT);break;
|
||||
case 0xe001:IRQa=1;break;
|
||||
case 0x8000:cmd=V;break;
|
||||
case 0x8001:DRegs[cmd&7]=V;
|
||||
Sync();
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
static void M208Power(CartInfo *info)
|
||||
{
|
||||
memset(PBuf, 0, sizeof(PBuf));
|
||||
PSel = 0;
|
||||
cmd = 0;
|
||||
memset(DRegs, 0, sizeof(DRegs));
|
||||
count = 0;
|
||||
last = 0;
|
||||
IRQCount = 0;
|
||||
IRQLatch = 0;
|
||||
IRQa = 0;
|
||||
PRGSel = 3;
|
||||
|
||||
setprg32(0x8000,3);
|
||||
}
|
||||
|
||||
static void sl(void)
|
||||
{
|
||||
if(IRQa)
|
||||
{
|
||||
if(IRQCount>=0)
|
||||
{
|
||||
IRQCount--;
|
||||
if(IRQCount<0)
|
||||
{
|
||||
X6502_IRQBegin(MDFN_IQEXT);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void foo(uint32 A)
|
||||
{
|
||||
if((A&0x2000) && !(last&0x2000))
|
||||
{
|
||||
count++;
|
||||
if(count==42)
|
||||
{
|
||||
sl();
|
||||
count=0;
|
||||
}
|
||||
}
|
||||
last=A;
|
||||
}
|
||||
|
||||
int Mapper208_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=M208Power;
|
||||
//GameHBIRQHook=sl;
|
||||
PPU_hook=foo;
|
||||
|
||||
SetWriteHandler(0x4800,0x4FFF,M208Write1);
|
||||
SetWriteHandler(0x5000,0x5fff,M208Write2);
|
||||
SetWriteHandler(0x8000,0xFFFF,M208HWrite);
|
||||
SetReadHandler(0x5800,0x5FFF,M208Read);
|
||||
SetReadHandler(0x8000,0xffff,CartBR);
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
|
@ -1,178 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 CHRBanks[8], PRGBanks[2], K4IRQ, K4sel, IRQCount, IRQLatch, Mirroring, IRQa, WRAM[8192];
|
||||
static int32 acount;
|
||||
|
||||
static void DoPRG(void)
|
||||
{
|
||||
setprg8(0xa000, PRGBanks[1]);
|
||||
|
||||
if(K4sel & 2)
|
||||
{
|
||||
setprg8(0xc000, PRGBanks[0]);
|
||||
setprg8(0x8000, ~1);
|
||||
}
|
||||
else
|
||||
{
|
||||
setprg8(0x8000, PRGBanks[0]);
|
||||
setprg8(0xC000, ~1);
|
||||
}
|
||||
}
|
||||
|
||||
static void DoCHR(void)
|
||||
{
|
||||
int x;
|
||||
for(x = 0; x < 8; x++)
|
||||
setchr1(x * 1024, CHRBanks[x]);
|
||||
}
|
||||
|
||||
static void DoMirroring(void)
|
||||
{
|
||||
switch(Mirroring & 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(Mapper21_write)
|
||||
{
|
||||
A|=((A>>5)&0xF);
|
||||
|
||||
if((A&0xF000)==0xA000)
|
||||
{
|
||||
PRGBanks[1] = V;
|
||||
DoPRG();
|
||||
}
|
||||
else if((A&0xF000)==0x8000)
|
||||
{
|
||||
PRGBanks[0] = V;
|
||||
DoPRG();
|
||||
}
|
||||
else if(A>=0xb000 && A<=0xefff)
|
||||
{
|
||||
A&=0xF006;
|
||||
{
|
||||
int x=((A>>2)&1)|((A-0xB000)>>11);
|
||||
|
||||
CHRBanks[x]&=(0xF0)>>((A&2)<<1);
|
||||
CHRBanks[x]|=(V&0xF)<<((A&2)<<1);
|
||||
DoCHR();
|
||||
}
|
||||
}
|
||||
else switch(A&0xF006)
|
||||
{
|
||||
case 0x9000: Mirroring = V; DoMirroring();break;
|
||||
case 0x9006:
|
||||
case 0x9004:
|
||||
case 0x9002:K4sel=V;
|
||||
DoPRG();
|
||||
break;
|
||||
case 0xf000:IRQLatch&=0xF0;IRQLatch|=V&0xF;break;
|
||||
case 0xf002:IRQLatch&=0x0F;IRQLatch|=V<<4;break;
|
||||
case 0xf004:IRQCount=IRQLatch;acount=0;
|
||||
IRQa=V&2;K4IRQ=V&1;
|
||||
X6502_IRQEnd(MDFN_IQEXT);
|
||||
break;
|
||||
case 0xf006:IRQa=K4IRQ;X6502_IRQEnd(MDFN_IQEXT);break;
|
||||
}
|
||||
}
|
||||
static void KonamiIRQHook(int a)
|
||||
{
|
||||
#define LCYCS ((227*2)+1)
|
||||
//#define LCYCS 341
|
||||
if(IRQa)
|
||||
{
|
||||
// acount+=a*3;
|
||||
acount+=a*4;
|
||||
if(acount>=LCYCS)
|
||||
{
|
||||
doagainbub:acount-=LCYCS;IRQCount++;
|
||||
if(!IRQCount) {X6502_IRQBegin(MDFN_IQEXT);IRQCount=IRQLatch;}
|
||||
if(acount>=LCYCS) goto doagainbub;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFARRAY(CHRBanks, 8), SFARRAY(PRGBanks, 2), SFARRAY(WRAM, 8192),
|
||||
SFVAR(K4IRQ), SFVAR(K4sel), SFVAR(IRQCount), SFVAR(IRQLatch), SFVAR(Mirroring), SFVAR(IRQa),
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
{
|
||||
DoPRG();
|
||||
DoCHR();
|
||||
DoMirroring();
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
int x;
|
||||
|
||||
acount = 0;
|
||||
|
||||
for(x = 0; x < 8; x++)
|
||||
CHRBanks[x] = x;
|
||||
DoCHR();
|
||||
K4sel = 0;
|
||||
PRGBanks[0] = 0;
|
||||
PRGBanks[1] = 1;
|
||||
DoPRG();
|
||||
Mirroring = 0;
|
||||
DoMirroring();
|
||||
|
||||
IRQCount = IRQLatch = 0;
|
||||
setprg8(0xe000, ~0);
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
|
||||
if(!info->battery)
|
||||
memset(WRAM, 0xFF, 8192);
|
||||
}
|
||||
|
||||
int Mapper21_Init(CartInfo *info)
|
||||
{
|
||||
SetupCartPRGMapping(0x10, WRAM, 8192, 1);
|
||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||
SetWriteHandler(0x8000,0xffff,Mapper21_write);
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
info->Power = Power;
|
||||
info->StateAction = StateAction;
|
||||
MapIRQHook=KonamiIRQHook;
|
||||
|
||||
if(info->battery)
|
||||
{
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = 8192;
|
||||
}
|
||||
return(1);
|
||||
}
|
|
@ -1,95 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 PRGBanks[2], CHRBanks[8], Mirroring;
|
||||
|
||||
static void DoPRG(void)
|
||||
{
|
||||
setprg8(0x8000, PRGBanks[0]);
|
||||
setprg8(0xa000, PRGBanks[1]);
|
||||
}
|
||||
|
||||
static void DoCHR(void)
|
||||
{
|
||||
int x;
|
||||
for(x = 0; x < 8; x++)
|
||||
setchr1(x * 1024, CHRBanks[x] >> 1);
|
||||
}
|
||||
|
||||
static void DoMirroring(void)
|
||||
{
|
||||
switch(Mirroring & 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(Mapper22_write)
|
||||
{
|
||||
if(A<=0xAFFF)
|
||||
{
|
||||
switch(A&0xF000)
|
||||
{
|
||||
case 0x8000:PRGBanks[0] = V; DoPRG(); break;
|
||||
case 0xa000:PRGBanks[1] = V; DoPRG(); break;
|
||||
case 0x9000:Mirroring = V & 3; DoMirroring(); break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
A&=0xF003;
|
||||
if(A>=0xb000 && A<=0xe003)
|
||||
{
|
||||
int x=(A&1)|((A-0xB000)>>11);
|
||||
|
||||
CHRBanks[x]&=(0xF0)>>((A&2)<<1);
|
||||
CHRBanks[x]|=(V&0xF)<<((A&2)<<1);
|
||||
DoCHR();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
int x;
|
||||
|
||||
Mirroring = 3;
|
||||
|
||||
for(x = 0; x < 8; x++)
|
||||
CHRBanks[x] = ~0;
|
||||
DoCHR();
|
||||
PRGBanks[0] = PRGBanks[1] = ~0;
|
||||
DoPRG();
|
||||
|
||||
setprg16(0xc000, 0x7F);
|
||||
}
|
||||
|
||||
int Mapper22_Init(CartInfo *info)
|
||||
{
|
||||
info->Power = Power;
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000,0xffff,Mapper22_write);
|
||||
return(1);
|
||||
}
|
|
@ -1,96 +0,0 @@
|
|||
#include "mapinc.h"
|
||||
|
||||
static uint8 PRGBanks[2], CHRBanks[8], IRQCount, IRQLatch, IRQa;
|
||||
int32 acount;
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
int x;
|
||||
|
||||
setprg8(0x8000, PRGBanks[0]);
|
||||
setprg8(0xa000, PRGBanks[1]);
|
||||
for(x = 0; x < 8; x++)
|
||||
setchr1(x * 1024, CHRBanks[x]);
|
||||
}
|
||||
|
||||
|
||||
static DECLFW(Write)
|
||||
{
|
||||
A &= 0xF003;
|
||||
if((A & 0xF000) == 0x8000)
|
||||
PRGBanks[0] = V;
|
||||
else if((A & 0xF000) == 0xA000)
|
||||
PRGBanks[1] = V;
|
||||
else switch(A)
|
||||
{
|
||||
case 0xb000: CHRBanks[0] = V; break;
|
||||
case 0xb002: CHRBanks[1] = V; break;
|
||||
case 0xc000: CHRBanks[2] = V; break;
|
||||
case 0xc002: CHRBanks[3] = V; break;
|
||||
case 0xd000: CHRBanks[4] = V; break;
|
||||
case 0xd002: CHRBanks[5] = V; break;
|
||||
case 0xe000: CHRBanks[6] = V; break;
|
||||
case 0xe002: CHRBanks[7] = V; break;
|
||||
case 0xf000: IRQLatch = V; break;
|
||||
case 0xf001: X6502_IRQEnd(MDFN_IQEXT); IRQa = 0; IRQCount = IRQLatch; break;
|
||||
case 0xf002: IRQa = 1; break;
|
||||
default: printf("%04x: %02x\n", A, V);break;
|
||||
}
|
||||
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
IRQCount = IRQa = 0;
|
||||
PRGBanks[0] = 0;
|
||||
PRGBanks[1] = 1;
|
||||
setprg16(0xc000, 0x7F);
|
||||
for(unsigned int x = 0; x < 8; x++)
|
||||
CHRBanks[x] = x;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFARRAY(PRGBanks, 2),
|
||||
SFARRAY(CHRBanks, 8),
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
Sync();
|
||||
return(ret);
|
||||
}
|
||||
|
||||
static void IRQHook(int a)
|
||||
{
|
||||
if(IRQa)
|
||||
{
|
||||
acount += a * 3;
|
||||
while(acount >= 341)
|
||||
{
|
||||
acount -= 341;
|
||||
IRQCount++;
|
||||
if(IRQCount == 0)
|
||||
{
|
||||
X6502_IRQBegin(MDFN_IQEXT);
|
||||
IRQa=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int Mapper222_Init(CartInfo *info)
|
||||
{
|
||||
info->Power = Power;
|
||||
info->StateAction = StateAction;
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0xFFFF, Write);
|
||||
MapIRQHook = IRQHook;
|
||||
return(1);
|
||||
}
|
|
@ -1,79 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint16 latch;
|
||||
static uint8 v_latch;
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
uint32 page,pagel,pageh;
|
||||
|
||||
setmirror(((latch>>13)&1) ? MI_H : MI_V);
|
||||
|
||||
page=(latch>>7)&0x3F;
|
||||
//printf("%04x\n",A);
|
||||
if((page&0x30)==0x30)
|
||||
page-=0x10;
|
||||
|
||||
pagel=pageh=(page<<1) + (((latch>>6)&1)&((latch>>5)&1));
|
||||
pageh+=((latch>>5)&1)^1;
|
||||
|
||||
setprg16(0x8000,pagel);
|
||||
setprg16(0xC000,pageh);
|
||||
setchr8( (v_latch&0x3) | ((latch&0xF)<<2) );
|
||||
}
|
||||
|
||||
static DECLFW(Mapper228_write)
|
||||
{
|
||||
latch = A;
|
||||
v_latch = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void Reset(CartInfo *info)
|
||||
{
|
||||
latch = v_latch = 0;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFVAR(latch), SFVAR(v_latch),
|
||||
SFEND
|
||||
};
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
Sync();
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int Mapper228_Init(CartInfo *info)
|
||||
{
|
||||
info->Power = info->Reset = Reset;
|
||||
info->StateAction = StateAction;
|
||||
SetWriteHandler(0x8000, 0xffff, Mapper228_write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
return(1);
|
||||
}
|
||||
|
|
@ -1,187 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 CHRBanks[8], PRGBanks[2], IRQCount, IRQLatch, Mirroring, K4IRQ, IRQa, K4sel;
|
||||
static int32 acount;
|
||||
static uint8 *WRAM = NULL;
|
||||
|
||||
static void DoMirroring(void)
|
||||
{
|
||||
switch(Mirroring & 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 DoCHR(void)
|
||||
{
|
||||
int x;
|
||||
for(x = 0; x < 8; x++)
|
||||
setchr1(x * 1024, CHRBanks[x]);
|
||||
}
|
||||
|
||||
static void DoPRG(void)
|
||||
{
|
||||
if(K4sel & 2)
|
||||
{
|
||||
setprg8(0x8000, 0xFE);
|
||||
setprg8(0xc000, PRGBanks[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
setprg8(0xc000, 0xFE);
|
||||
setprg8(0x8000, PRGBanks[0]);
|
||||
}
|
||||
setprg8(0xa000, PRGBanks[1]);
|
||||
}
|
||||
|
||||
static DECLFW(Mapper23_write)
|
||||
{
|
||||
if((A&0xF000)==0x8000)
|
||||
{
|
||||
PRGBanks[0] = V;
|
||||
DoPRG();
|
||||
}
|
||||
else if((A&0xF000)==0xA000)
|
||||
{
|
||||
PRGBanks[1] = V;
|
||||
DoPRG();
|
||||
}
|
||||
else
|
||||
{
|
||||
A|=((A>>2)&0x3)|((A>>4)&0x3)|((A>>6)&0x3);
|
||||
A&=0xF003;
|
||||
if(A>=0xb000 && A<=0xe003)
|
||||
{
|
||||
int x=((A>>1)&1)|((A-0xB000)>>11);
|
||||
|
||||
CHRBanks[x]&=(0xF0)>>((A&1)<<2);
|
||||
CHRBanks[x]|=(V&0xF)<<((A&1)<<2);
|
||||
DoCHR();
|
||||
}
|
||||
else
|
||||
switch(A)
|
||||
{
|
||||
case 0xf000:X6502_IRQEnd(MDFN_IQEXT);IRQLatch&=0xF0;IRQLatch|=V&0xF;break;
|
||||
case 0xf001:X6502_IRQEnd(MDFN_IQEXT);IRQLatch&=0x0F;IRQLatch|=V<<4;break;
|
||||
case 0xf002:X6502_IRQEnd(MDFN_IQEXT);acount=0;IRQCount=IRQLatch;IRQa=V&2;K4IRQ=V&1;break;
|
||||
case 0xf003:X6502_IRQEnd(MDFN_IQEXT);IRQa=K4IRQ;break;
|
||||
case 0x9001:
|
||||
case 0x9002:
|
||||
case 0x9003:K4sel=V;
|
||||
DoPRG();
|
||||
break;
|
||||
case 0x9000: Mirroring = V & 0x3; DoMirroring(); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void KonamiIRQHook2(int a)
|
||||
{
|
||||
#define LCYCS 341
|
||||
if(IRQa)
|
||||
{
|
||||
acount+=a*3;
|
||||
if(acount>=LCYCS)
|
||||
{
|
||||
doagainbub:acount-=LCYCS;IRQCount++;
|
||||
if(!IRQCount) {X6502_IRQBegin(MDFN_IQEXT);IRQCount=IRQLatch;}
|
||||
if(acount>=LCYCS) goto doagainbub;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFARRAY(CHRBanks, 8), SFARRAY(PRGBanks, 2), SFARRAY(WRAM, 8192),
|
||||
SFVAR(K4IRQ), SFVAR(K4sel), SFVAR(IRQCount), SFVAR(IRQLatch), SFVAR(Mirroring), SFVAR(IRQa),
|
||||
SFVAR(acount),
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
{
|
||||
DoPRG();
|
||||
DoCHR();
|
||||
DoMirroring();
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
for(int x = 0; x < 8; x++)
|
||||
CHRBanks[x] = ~0;
|
||||
PRGBanks[0] = PRGBanks[1] = ~0;
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
setprg16(0xc000, 0x7F);
|
||||
IRQCount = IRQLatch = IRQa = K4sel = K4IRQ = 0;
|
||||
Mirroring = 3;
|
||||
DoPRG();
|
||||
DoCHR();
|
||||
DoMirroring();
|
||||
|
||||
if(!info->battery)
|
||||
memset(WRAM, 0xFF, 8192);
|
||||
|
||||
acount = 0;
|
||||
}
|
||||
|
||||
static void Close(void)
|
||||
{
|
||||
if(WRAM)
|
||||
{
|
||||
free(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
int Mapper23_Init(CartInfo *info)
|
||||
{
|
||||
info->StateAction = StateAction;
|
||||
SetWriteHandler(0x8000,0xffff,Mapper23_write);
|
||||
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||
|
||||
MapIRQHook=KonamiIRQHook2;
|
||||
info->Power = Power;
|
||||
info->Close = Close;
|
||||
|
||||
if(!(WRAM = (uint8 *)malloc(8192)))
|
||||
return(0);
|
||||
|
||||
SetupCartPRGMapping(0x10, WRAM, 8192, 1);
|
||||
if(info->battery)
|
||||
{
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = 8192;
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
|
|
@ -1,74 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 latches[2];
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setprg16(0x8000,(latches[1]&3) | ((latches[0]&0x18)>>1));
|
||||
setprg16(0xc000,3|(((latches[0])&0x18)>>1));
|
||||
}
|
||||
|
||||
static DECLFW(Mapper232_write)
|
||||
{
|
||||
if(A<=0x9FFF)
|
||||
latches[0]=V;
|
||||
else
|
||||
latches[1]=V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void Reset(CartInfo *info)
|
||||
{
|
||||
latches[0]=0x18;
|
||||
Sync();
|
||||
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFARRAY(latches, 2),
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
{
|
||||
Sync();
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int BIC48_Init(CartInfo *info)
|
||||
{
|
||||
SetWriteHandler(0x8000,0xffff,Mapper232_write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
|
||||
info->Power = info->Reset = Reset;
|
||||
info->StateAction = StateAction;
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
|
@ -1,115 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 r1, r2;
|
||||
|
||||
static void DoBS(void)
|
||||
{
|
||||
if(r1&0x40)
|
||||
{
|
||||
setprg32(0x8000, (r1&0xE)|(r2&1));
|
||||
setchr8( ((r1&0xE)<<2) | ((r2>>4)&7) );
|
||||
}
|
||||
else
|
||||
{
|
||||
setprg32(0x8000, r1&0xF);
|
||||
setchr8( ((r1&0xF)<<2) | ((r2>>4)&3) );
|
||||
}
|
||||
}
|
||||
|
||||
static void R1Set(uint8 V)
|
||||
{
|
||||
if(r1) return;
|
||||
r1=V;
|
||||
setmirror(((V >> 7) & 1) ^ 1);
|
||||
DoBS();
|
||||
}
|
||||
|
||||
static void R2Set(uint8 V)
|
||||
{
|
||||
r2=V;
|
||||
DoBS();
|
||||
}
|
||||
|
||||
static DECLFW(R1W)
|
||||
{
|
||||
R1Set(V);
|
||||
}
|
||||
|
||||
static DECLFR(R1R)
|
||||
{
|
||||
uint8 r=CartBR(A);
|
||||
R1Set(r);
|
||||
return r;
|
||||
}
|
||||
|
||||
static DECLFW(R2W)
|
||||
{
|
||||
R2Set(V);
|
||||
}
|
||||
|
||||
static DECLFR(R2R)
|
||||
{
|
||||
uint8 r=CartBR(A);
|
||||
R2Set(r);
|
||||
return r;
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{ SFVAR(r1), SFVAR(r2), SFEND };
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
|
||||
if(load)
|
||||
{
|
||||
DoBS();
|
||||
setmirror(((r1 >> 7) & 1) ^ 1);
|
||||
}
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
r1=r2=0;
|
||||
DoBS();
|
||||
setmirror(MI_V);
|
||||
}
|
||||
|
||||
int Mapper234_Init(CartInfo *info)
|
||||
{
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
|
||||
SetWriteHandler(0xff80,0xff9f,R1W);
|
||||
SetReadHandler(0xff80,0xff9f,R1R);
|
||||
|
||||
SetWriteHandler(0xffe8,0xfff7,R2W);
|
||||
SetReadHandler(0xffe8,0xfff7,R2R);
|
||||
|
||||
info->Power = Power;
|
||||
info->StateAction = StateAction;
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
|
@ -1,108 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint8 latch;
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setprg32(0x8000, latch >> 4);
|
||||
setchr8(latch & 0xF);
|
||||
}
|
||||
|
||||
static DECLFW(Write)
|
||||
{
|
||||
latch = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(BWRAM)
|
||||
{
|
||||
WRAM[A-0x6000]=V;
|
||||
}
|
||||
|
||||
static DECLFR(AWRAM)
|
||||
{
|
||||
return(WRAM[A-0x6000]);
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
latch = 0xFF;
|
||||
Sync();
|
||||
|
||||
if(!info->battery)
|
||||
memset(WRAM, 0xFF, 8192);
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFVAR(latch),
|
||||
SFARRAY(WRAM, 8192),
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
|
||||
if(load)
|
||||
{
|
||||
Sync();
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
static void Close(void)
|
||||
{
|
||||
if(WRAM)
|
||||
{
|
||||
free(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
int Mapper240_Init(CartInfo *info)
|
||||
{
|
||||
info->Power = Power;
|
||||
info->StateAction = StateAction;
|
||||
info->Close = Close;
|
||||
|
||||
if(!(WRAM = (uint8 *)malloc(8192)))
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
memset(WRAM, 0xFF, 8192);
|
||||
|
||||
MDFNMP_AddRAM(8192, 0x6000, WRAM);
|
||||
if(info->battery)
|
||||
{
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = 8192;
|
||||
}
|
||||
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x4020, 0x5FFF, Write);
|
||||
|
||||
SetReadHandler(0x6000, 0x7FFF, AWRAM);
|
||||
SetWriteHandler(0x6000, 0x7FFF, BWRAM);
|
||||
|
||||
return(1);
|
||||
}
|
|
@ -1,123 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 *WRAM = NULL;
|
||||
static uint8 latch;
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setprg32(0x8000, latch);
|
||||
}
|
||||
|
||||
static DECLFW(Write)
|
||||
{
|
||||
if(A & 0x8000)
|
||||
{
|
||||
latch = V;
|
||||
Sync();
|
||||
}
|
||||
//else
|
||||
// printf("%04x %02x\n", A, V);
|
||||
}
|
||||
|
||||
static DECLFR(ReadLow)
|
||||
{
|
||||
//printf("ReadLow: %04x\n", A);
|
||||
return(0x00);
|
||||
}
|
||||
|
||||
static DECLFW(BWRAM)
|
||||
{
|
||||
//printf("Write: %04x %02x\n", A, V);
|
||||
WRAM[A-0x6000]=V;
|
||||
}
|
||||
|
||||
static DECLFR(AWRAM)
|
||||
{
|
||||
//printf("Read: %04x\n", A);
|
||||
return(WRAM[A-0x6000]);
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
latch = 0;
|
||||
Sync();
|
||||
setchr8(0);
|
||||
|
||||
if(!info->battery)
|
||||
memset(WRAM, 0xFF, 8192);
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFARRAY(WRAM, 8192),
|
||||
SFVAR(latch),
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
|
||||
if(load)
|
||||
{
|
||||
Sync();
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
static void Close(void)
|
||||
{
|
||||
if(WRAM)
|
||||
{
|
||||
free(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
int Mapper241_Init(CartInfo *info)
|
||||
{
|
||||
info->Power = Power;
|
||||
info->StateAction = StateAction;
|
||||
info->Close = Close;
|
||||
|
||||
if(!(WRAM = (uint8 *)malloc(8192)))
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
memset(WRAM, 0xFF, 8192);
|
||||
|
||||
MDFNMP_AddRAM(8192, 0x6000, WRAM);
|
||||
if(info->battery)
|
||||
{
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = 8192;
|
||||
}
|
||||
|
||||
SetReadHandler(0x5000, 0x5FFF, ReadLow);
|
||||
SetWriteHandler(0x5000, 0x5FFF, Write);
|
||||
SetWriteHandler(0x8000, 0xFFFF, Write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
|
||||
SetReadHandler(0x6000, 0x7FFF, AWRAM);
|
||||
SetWriteHandler(0x6000, 0x7FFF, BWRAM);
|
||||
|
||||
return(1);
|
||||
}
|
|
@ -1,81 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 Mirroring, PRGBank32, WRAM[8192];
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
const int mirtab[4] = { MI_V, MI_H, MI_0, MI_1 };
|
||||
|
||||
setprg32(0x8000, PRGBank32);
|
||||
setmirror(mirtab[Mirroring & 3]);
|
||||
}
|
||||
|
||||
static DECLFW(Mapper242_write)
|
||||
{
|
||||
PRGBank32 = (A >> 3) & 0xF;
|
||||
Mirroring = V & 3;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
Mirroring = PRGBank32 = 0;
|
||||
Sync();
|
||||
setchr8(0);
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
if(!info->battery)
|
||||
memset(WRAM, 0xFF, 8192);
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFVAR(Mirroring),
|
||||
SFVAR(PRGBank32),
|
||||
SFARRAY(WRAM, 8192),
|
||||
SFEND
|
||||
};
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
Sync();
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int Mapper242_Init(CartInfo *info)
|
||||
{
|
||||
SetWriteHandler(0x8000,0xffff,Mapper242_write);
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||
info->Power = Power;
|
||||
info->StateAction = StateAction;
|
||||
if(info->battery)
|
||||
{
|
||||
memset(WRAM, 0xFF, 8192);
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = 8192;
|
||||
}
|
||||
SetupCartPRGMapping(0x10, WRAM, 8192, 1);
|
||||
return(1);
|
||||
}
|
||||
|
|
@ -1,70 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2003 CaH4e3
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 PRGBank32, CHRBank8;
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setprg32(0x8000, PRGBank32);
|
||||
setchr8(CHRBank8);
|
||||
}
|
||||
static DECLFW(Mapper244_write_1)
|
||||
{
|
||||
PRGBank32 = (A - 0x8065) & 0x3;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(Mapper244_write_2)
|
||||
{
|
||||
CHRBank8 = (A - 0x80A5) & 0x7;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
CHRBank8 = PRGBank32 = 0;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFVAR(PRGBank32),
|
||||
SFVAR(CHRBank8),
|
||||
SFEND
|
||||
};
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
Sync();
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int Mapper244_Init(CartInfo *info)
|
||||
{
|
||||
SetWriteHandler(0x8065,0x80a4,Mapper244_write_1);
|
||||
SetWriteHandler(0x80a5,0x80e4,Mapper244_write_2);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
info->Power = Power;
|
||||
info->StateAction = StateAction;
|
||||
return(1);
|
||||
}
|
|
@ -1,102 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
static uint8 PRGBanks[4], CHRBanks[4];
|
||||
static uint8 WRAM[0x800];
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
int x;
|
||||
for(x = 0; x < 4; x++)
|
||||
{
|
||||
setprg8(0x8000 + x * 8192, PRGBanks[x]);
|
||||
setchr2(0x0000 + x * 2048, CHRBanks[x]);
|
||||
}
|
||||
}
|
||||
static DECLFW(Mapper246_write)
|
||||
{
|
||||
switch(A&0xF007)
|
||||
{
|
||||
case 0x6000:PRGBanks[0] = V;break;
|
||||
case 0x6001:PRGBanks[1] = V;break;
|
||||
case 0x6002:PRGBanks[2] = V;break;
|
||||
case 0x6003:PRGBanks[3] = V;break;
|
||||
case 0x6004:CHRBanks[0] = V;break;
|
||||
case 0x6005:CHRBanks[1] = V;break;
|
||||
case 0x6006:CHRBanks[2] = V;break;
|
||||
case 0x6007:CHRBanks[3] = V;break;
|
||||
}
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void Reset(CartInfo *info)
|
||||
{
|
||||
int x;
|
||||
for(x = 0; x < 4; x++)
|
||||
CHRBanks[x] = x;
|
||||
PRGBanks[0] = 0;
|
||||
PRGBanks[1] = 1;
|
||||
PRGBanks[2] = 0xFE;
|
||||
PRGBanks[3] = 0xFF;
|
||||
setprg2r(0x10, 0x6800, 0);
|
||||
Sync();
|
||||
if(!info->battery)
|
||||
memset(WRAM, 0xFF, 0x800);
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFARRAY(PRGBanks, 4),
|
||||
SFARRAY(CHRBanks, 4),
|
||||
SFARRAY(WRAM, 0x800),
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
|
||||
if(load)
|
||||
{
|
||||
Sync();
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int Mapper246_Init(CartInfo *info)
|
||||
{
|
||||
SetupCartPRGMapping(0x10, WRAM, 0x800, 1);
|
||||
SetWriteHandler(0x4020,0x67ff,Mapper246_write);
|
||||
SetWriteHandler(0x8000,0xffff,Mapper246_write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetReadHandler(0x6800, 0x6FFF, CartBR);
|
||||
SetWriteHandler(0x6800, 0x6FFF, CartBW);
|
||||
info->Reset = info->Power = Reset;
|
||||
info->StateAction = StateAction;
|
||||
if(info->battery)
|
||||
{
|
||||
memset(WRAM, 0xFF, 0x800);
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = 2048;
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
|
|
@ -1,144 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 cmd, lpa, prgl[2], Mirroring, IRQLatch, IRQCount, IRQa, CHRBanks[6];
|
||||
|
||||
static void PRGSynco(void)
|
||||
{
|
||||
if(lpa&0x80)
|
||||
{
|
||||
setprg16(0x8000,lpa&0xF);
|
||||
}
|
||||
else
|
||||
{
|
||||
setprg8(0x8000,prgl[0]&0x1F);
|
||||
setprg8(0xa000,prgl[1]&0x1F);
|
||||
}
|
||||
}
|
||||
static void DoCHR(void)
|
||||
{
|
||||
setchr2(0x0000, CHRBanks[0]);
|
||||
setchr2(0x0800, CHRBanks[1]);
|
||||
for(int x = 0; x < 4; x++)
|
||||
setchr1(0x1000 + x * 1024, CHRBanks[2 + x]);
|
||||
}
|
||||
static DECLFW(Mapper248_writelow)
|
||||
{
|
||||
lpa=V;
|
||||
PRGSynco();
|
||||
}
|
||||
|
||||
static DECLFW(Mapper248_write)
|
||||
{
|
||||
switch(A&0xF001)
|
||||
{
|
||||
case 0xa000:Mirroring = V & 1; setmirror(Mirroring ? MI_H : MI_V);break; // Not sure if this is right. Mirroring may be hard wired...
|
||||
case 0xc000:IRQLatch=V;break;
|
||||
case 0xc001:IRQCount=IRQLatch;break;
|
||||
case 0xe000:IRQa=0;X6502_IRQEnd(MDFN_IQEXT);break;
|
||||
case 0xe001:IRQa=1;break;
|
||||
case 0x8000:cmd=V;break;
|
||||
case 0x8001:switch(cmd&7)
|
||||
{
|
||||
case 0:CHRBanks[0] = V >> 1;DoCHR();break;
|
||||
case 1:CHRBanks[1] = V >> 1;DoCHR();break;
|
||||
case 2:CHRBanks[2] = V;DoCHR();break;
|
||||
case 3:CHRBanks[3] = V;DoCHR();break;
|
||||
case 4:CHRBanks[4] = V;DoCHR();break;
|
||||
case 5:CHRBanks[5] = V;DoCHR();break;
|
||||
case 6:prgl[0]=V;PRGSynco();break;
|
||||
case 7:prgl[1]=V;PRGSynco();break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void Mapper248_hb(void)
|
||||
{
|
||||
if(IRQa)
|
||||
{
|
||||
IRQCount--;
|
||||
if(IRQCount == 0xFF)
|
||||
{
|
||||
X6502_IRQBegin(MDFN_IQEXT);
|
||||
IRQCount = IRQLatch;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
CHRBanks[0] = 0;
|
||||
CHRBanks[1] = 1;
|
||||
CHRBanks[2] = 4;
|
||||
CHRBanks[3] = 5;
|
||||
CHRBanks[4] = 6;
|
||||
CHRBanks[5] = 7;
|
||||
IRQCount = IRQLatch = IRQa = 0;
|
||||
|
||||
Mirroring = (info->mirror & 1) ^ 1;
|
||||
setmirror(Mirroring ^ 1);
|
||||
cmd = 0;
|
||||
lpa = 0;
|
||||
prgl[0] = 0;
|
||||
prgl[1] = 1;
|
||||
setprg16(0xc000, 0x7F);
|
||||
PRGSynco();
|
||||
DoCHR();
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFARRAY(CHRBanks, 6),
|
||||
SFARRAY(prgl, 2),
|
||||
SFVAR(lpa),
|
||||
SFVAR(cmd),
|
||||
SFVAR(Mirroring),
|
||||
SFVAR(IRQCount),
|
||||
SFVAR(IRQLatch),
|
||||
SFVAR(IRQa),
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
{
|
||||
Mirroring &= 1;
|
||||
setmirror(Mirroring ^ 1);
|
||||
DoCHR();
|
||||
PRGSynco();
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int Mapper248_Init(CartInfo *info)
|
||||
{
|
||||
info->Power = Power;
|
||||
info->StateAction = StateAction;
|
||||
SetWriteHandler(0x6000,0x6fff,Mapper248_writelow);
|
||||
SetWriteHandler(0x8000,0xffff,Mapper248_write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
|
||||
GameHBIRQHook=Mapper248_hb;
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
|
@ -1,174 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 CHRBanks[8], PRGBanks[2], K4IRQ, K4sel, IRQCount, IRQLatch, Mirroring, IRQa, WRAM[8192];
|
||||
static int32 acount;
|
||||
|
||||
static void DoPRG(void)
|
||||
{
|
||||
setprg8(0xa000, PRGBanks[1]);
|
||||
|
||||
if(K4sel & 2)
|
||||
{
|
||||
setprg8(0xc000, PRGBanks[0]);
|
||||
setprg8(0x8000, ~1);
|
||||
}
|
||||
else
|
||||
{
|
||||
setprg8(0x8000, PRGBanks[0]);
|
||||
setprg8(0xC000, ~1);
|
||||
}
|
||||
}
|
||||
|
||||
static void DoCHR(void)
|
||||
{
|
||||
int x;
|
||||
for(x = 0; x < 8; x++)
|
||||
setchr1(x * 1024, CHRBanks[x]);
|
||||
}
|
||||
|
||||
static void DoMirroring(void)
|
||||
{
|
||||
switch(Mirroring & 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 int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFARRAY(CHRBanks, 8), SFARRAY(PRGBanks, 2), SFARRAY(WRAM, 8192),
|
||||
SFVAR(K4IRQ), SFVAR(K4sel), SFVAR(IRQCount), SFVAR(IRQLatch), SFVAR(Mirroring), SFVAR(IRQa),
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
{
|
||||
DoPRG();
|
||||
DoCHR();
|
||||
DoMirroring();
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
static DECLFW(Mapper25_write)
|
||||
{
|
||||
A=(A&0xF003)|((A&0xC)>>2);
|
||||
|
||||
if((A&0xF000)==0xA000)
|
||||
{
|
||||
PRGBanks[1] = V;
|
||||
DoPRG();
|
||||
}
|
||||
else if(A>=0xB000 && A<=0xEFFF)
|
||||
{
|
||||
int x=(A&1)|((A-0xB000)>>11);
|
||||
|
||||
CHRBanks[x]&=(0xF0)>>((A&2)<<1);
|
||||
CHRBanks[x]|=(V&0xF)<<((A&2)<<1);
|
||||
DoCHR();
|
||||
}
|
||||
else if((A&0xF000)==0x8000)
|
||||
{
|
||||
PRGBanks[0] = V;
|
||||
DoPRG();
|
||||
}
|
||||
else switch(A)
|
||||
{
|
||||
case 0x9000:Mirroring = V; DoMirroring(); break;
|
||||
case 0x9001:K4sel=V; DoPRG(); break;
|
||||
break;
|
||||
case 0xf000:IRQLatch&=0xF0;IRQLatch|=V&0xF;break;
|
||||
case 0xf002:IRQLatch&=0x0F;IRQLatch|=V<<4;break;
|
||||
case 0xf001:IRQCount=IRQLatch;IRQa=V&2;K4IRQ=V&1;acount=0;X6502_IRQEnd(MDFN_IQEXT);break;
|
||||
case 0xf003:IRQa=K4IRQ;X6502_IRQEnd(MDFN_IQEXT);break;
|
||||
}
|
||||
}
|
||||
|
||||
static void KonamiIRQHook(int a)
|
||||
{
|
||||
// #define LCYCS ((227*2))
|
||||
#define LCYCS 341
|
||||
if(IRQa)
|
||||
{
|
||||
acount+=a*3;
|
||||
// acount+=a*4;
|
||||
if(acount>=LCYCS)
|
||||
{
|
||||
doagainbub:acount-=LCYCS;IRQCount++;
|
||||
if(IRQCount == 0)
|
||||
{//acount=0;
|
||||
X6502_IRQBegin(MDFN_IQEXT);IRQCount=IRQLatch;
|
||||
}
|
||||
if(acount>=LCYCS) goto doagainbub;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
int x;
|
||||
|
||||
acount = 0;
|
||||
|
||||
for(x = 0; x < 8; x++)
|
||||
CHRBanks[x] = x;
|
||||
DoCHR();
|
||||
K4sel = 0;
|
||||
PRGBanks[0] = 0;
|
||||
PRGBanks[1] = 1;
|
||||
DoPRG();
|
||||
Mirroring = 0;
|
||||
DoMirroring();
|
||||
|
||||
IRQCount = IRQLatch = 0;
|
||||
setprg8(0xe000, ~0);
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
|
||||
if(!info->battery)
|
||||
memset(WRAM, 0xFF, 8192);
|
||||
}
|
||||
|
||||
int Mapper25_Init(CartInfo *info)
|
||||
{
|
||||
SetupCartPRGMapping(0x10, WRAM, 8192, 1);
|
||||
SetWriteHandler(0x8000,0xffff,Mapper25_write);
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||
MapIRQHook=KonamiIRQHook;
|
||||
info->Power = Power;
|
||||
info->StateAction = StateAction;
|
||||
|
||||
if(info->battery)
|
||||
{
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = 8192;
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
|
|
@ -1,127 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 PRGBanks[2], IREMCon, CHRBanks[8], WRAM[8192];
|
||||
|
||||
static void DoCHR(void)
|
||||
{
|
||||
for(int x = 0; x < 8; x++)
|
||||
setchr1(x * 1024, CHRBanks[x]);
|
||||
}
|
||||
static void DoPRG(void)
|
||||
{
|
||||
if(IREMCon & 2)
|
||||
{
|
||||
setprg8(0xC000, PRGBanks[0]);
|
||||
setprg8(0x8000, 0xFE);
|
||||
}
|
||||
else
|
||||
{
|
||||
setprg8(0x8000, PRGBanks[0]);
|
||||
setprg8(0xC000, 0xFE);
|
||||
}
|
||||
setprg8(0xa000, PRGBanks[1]);
|
||||
}
|
||||
|
||||
static void DoMirroring(void)
|
||||
{
|
||||
setmirror((IREMCon & 1) ? MI_H : MI_V);
|
||||
}
|
||||
|
||||
static DECLFW(Mapper32_write)
|
||||
{
|
||||
switch(A>>12)
|
||||
{
|
||||
case 0x8:
|
||||
PRGBanks[0] = V;
|
||||
DoPRG();
|
||||
break;
|
||||
case 0x9:IREMCon = V;
|
||||
DoPRG();
|
||||
DoMirroring();
|
||||
break;
|
||||
case 0xa:PRGBanks[1] = V;DoPRG();
|
||||
break;
|
||||
}
|
||||
|
||||
if((A&0xF000)==0xb000)
|
||||
{
|
||||
CHRBanks[A & 7] = V;
|
||||
DoCHR();
|
||||
}
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
PRGBanks[0] = 0;
|
||||
PRGBanks[1] = 1;
|
||||
for(int x = 0; x < 8; x++)
|
||||
CHRBanks[x] = x;
|
||||
IREMCon = 0;
|
||||
setprg16(0xc000, 0x7F);
|
||||
DoPRG();
|
||||
DoCHR();
|
||||
DoMirroring();
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
if(!info->battery)
|
||||
memset(WRAM, 0xFF, 8192);
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFARRAY(PRGBanks, 2),
|
||||
SFARRAY(CHRBanks, 8),
|
||||
SFVAR(IREMCon),
|
||||
SFARRAY(WRAM, 8192),
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
|
||||
if(load)
|
||||
{
|
||||
DoPRG();
|
||||
DoCHR();
|
||||
DoMirroring();
|
||||
}
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int Mapper32_Init(CartInfo *info)
|
||||
{
|
||||
info->Power = Power;
|
||||
info->StateAction = StateAction;
|
||||
SetupCartPRGMapping(0x10, WRAM, 8192, 1);
|
||||
SetWriteHandler(0x8000,0xffff,Mapper32_write);
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||
if(info->battery)
|
||||
{
|
||||
memset(WRAM, 0xFF, 8192);
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = 8192;
|
||||
}
|
||||
return(1);
|
||||
}
|
|
@ -1,166 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static bool is48;
|
||||
static uint8 IRQCount, IRQa, IRQLatch, PRGBanks[2], Mirroring, CHRBanks[6];
|
||||
|
||||
static void DoPRG(void)
|
||||
{
|
||||
if(is48)
|
||||
{
|
||||
setprg8(0x8000, PRGBanks[0]);
|
||||
setprg8(0xa000, PRGBanks[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
setprg8(0x8000, PRGBanks[0] & 0x3F);
|
||||
setprg8(0xa000, PRGBanks[1] & 0x3F);
|
||||
}
|
||||
}
|
||||
|
||||
static void DoCHR(void)
|
||||
{
|
||||
for(int x = 0; x < 4; x++)
|
||||
setchr1(0x1000 + x * 1024, CHRBanks[x]);
|
||||
setchr2(0x0000, CHRBanks[4]);
|
||||
setchr2(0x0800, CHRBanks[5]);
|
||||
}
|
||||
|
||||
static void DoMirroring(void)
|
||||
{
|
||||
if(is48)
|
||||
setmirror(((Mirroring >> 6) & 1) ? MI_H : MI_V);
|
||||
else
|
||||
setmirror(((PRGBanks[0] >> 6) & 1) ? MI_H : MI_V);
|
||||
}
|
||||
|
||||
static DECLFW(Mapper33_write)
|
||||
{
|
||||
A&=0xF003;
|
||||
if(A>=0xA000 && A<=0xA003)
|
||||
{
|
||||
CHRBanks[A & 3] = V;
|
||||
DoCHR();
|
||||
}
|
||||
else switch(A)
|
||||
{
|
||||
case 0x8000:PRGBanks[0] = V; DoPRG(); DoMirroring(); break;
|
||||
case 0x8001:PRGBanks[1] = V; DoPRG(); break;
|
||||
case 0x8002:CHRBanks[4] = V; DoCHR(); break;
|
||||
case 0x8003:CHRBanks[5] = V; DoCHR(); break;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(Mapper48_HiWrite)
|
||||
{
|
||||
switch(A&0xF003)
|
||||
{
|
||||
case 0xc000:IRQLatch=V;break;
|
||||
case 0xc001:IRQCount=IRQLatch;break;
|
||||
case 0xc003:IRQa=0;X6502_IRQEnd(MDFN_IQEXT);break;
|
||||
case 0xc002:IRQa=1;break;
|
||||
case 0xe000:Mirroring = V; DoMirroring(); ;break;
|
||||
}
|
||||
}
|
||||
|
||||
static void heho(void)
|
||||
{
|
||||
if(IRQa)
|
||||
{
|
||||
IRQCount++;
|
||||
if(!IRQCount)
|
||||
{
|
||||
X6502_IRQBegin(MDFN_IQEXT);
|
||||
IRQa=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
PRGBanks[0] = 0;
|
||||
PRGBanks[1] = 1;
|
||||
Mirroring = 0;
|
||||
IRQLatch = IRQCount = IRQa = 0;
|
||||
for(int x = 0; x < 6; x++)
|
||||
CHRBanks[x] = 0;
|
||||
DoPRG();
|
||||
DoCHR();
|
||||
DoMirroring();
|
||||
|
||||
if(is48)
|
||||
setprg16(0xc000, 0x7F);
|
||||
else
|
||||
setprg16(0xc000, 0x1F);
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFARRAY(PRGBanks, 2),
|
||||
SFARRAY(CHRBanks, 6),
|
||||
SFEND
|
||||
};
|
||||
|
||||
SFORMAT StateRegs48[] =
|
||||
{
|
||||
SFARRAY(PRGBanks, 2),
|
||||
SFARRAY(CHRBanks, 6),
|
||||
SFVAR(Mirroring),
|
||||
SFVAR(IRQCount), SFVAR(IRQa), SFVAR(IRQLatch),
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, is48 ? StateRegs48 : StateRegs, "MAPR");
|
||||
if(load)
|
||||
{
|
||||
DoPRG();
|
||||
DoCHR();
|
||||
DoMirroring();
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int Mapper33_Init(CartInfo *info)
|
||||
{
|
||||
SetWriteHandler(0x8000,0xffff,Mapper33_write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
info->Power = Power;
|
||||
info->StateAction = StateAction;
|
||||
is48=0;
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
||||
int Mapper48_Init(CartInfo *info)
|
||||
{
|
||||
SetWriteHandler(0x8000,0xffff,Mapper33_write);
|
||||
SetWriteHandler(0xc000,0xffff,Mapper48_HiWrite);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
info->Power = Power;
|
||||
info->StateAction = StateAction;
|
||||
GameHBIRQHook=heho;
|
||||
is48=1;
|
||||
|
||||
return(1);
|
||||
}
|
|
@ -1,68 +0,0 @@
|
|||
#include "mapinc.h"
|
||||
|
||||
static uint8 PRGBank32, CHRBanks[2], WRAM[8192];
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setprg32(0x8000, PRGBank32);
|
||||
setchr4(0x0000, CHRBanks[0]);
|
||||
setchr4(0x1000, CHRBanks[1]);
|
||||
}
|
||||
|
||||
static DECLFW(Mapper34_write)
|
||||
{
|
||||
switch(A)
|
||||
{
|
||||
case 0x7FFD:PRGBank32 = V;break;
|
||||
case 0x7FFE:CHRBanks[0] = V;break;
|
||||
case 0x7fff:CHRBanks[1] = V;break;
|
||||
}
|
||||
if(A>=0x8000)
|
||||
PRGBank32 = V;
|
||||
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
if(!info->battery)
|
||||
memset(WRAM, 0xFF, 8192);
|
||||
PRGBank32 = 0;
|
||||
CHRBanks[0] = 0;
|
||||
CHRBanks[1] = 1;
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
Sync();
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFVAR(PRGBank32),
|
||||
SFARRAY(CHRBanks, 2),
|
||||
SFARRAY(WRAM, 8192),
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
Sync();
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int Mapper34_Init(CartInfo *info)
|
||||
{
|
||||
info->Power = Power;
|
||||
info->StateAction = StateAction;
|
||||
SetupCartPRGMapping(0x10, WRAM, 8192, 1);
|
||||
if(info->battery)
|
||||
{
|
||||
memset(WRAM, 0xFF, 8192);
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = 8192;
|
||||
}
|
||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||
SetWriteHandler(0x7ffd,0xffff,Mapper34_write);
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
return(1);
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 latch;
|
||||
static void Sync(void)
|
||||
{
|
||||
setprg32(0x8000, latch & 0x3);
|
||||
setchr8((latch >> 2) & 0x3);
|
||||
}
|
||||
|
||||
static DECLFW(Mapper38_write)
|
||||
{
|
||||
latch = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
latch = 0;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFVAR(latch), SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
Sync();
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int Mapper38_Init(CartInfo *info)
|
||||
{
|
||||
info->Power = Power;
|
||||
info->StateAction = StateAction;
|
||||
SetWriteHandler(0x7000, 0x7fff, Mapper38_write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
|
@ -1,79 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 calreg, calchr;
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setprg32(0x8000, calreg & 0x7);
|
||||
setmirror((calreg & 0x20) ? MI_H : MI_V);
|
||||
setchr8(calchr);
|
||||
}
|
||||
|
||||
static DECLFW(Mapper41_write)
|
||||
{
|
||||
if(A<0x8000)
|
||||
{
|
||||
calreg=A;
|
||||
calchr&=0x3;
|
||||
calchr|=(A>>1)&0xC;
|
||||
}
|
||||
else if(calreg&0x4)
|
||||
{
|
||||
calchr&=0xC;
|
||||
calchr|=A&3;
|
||||
}
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void Reset(CartInfo *info)
|
||||
{
|
||||
calreg=calchr=0;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFVAR(calreg),
|
||||
SFVAR(calchr),
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
Sync();
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
||||
int Mapper41_Init(CartInfo *info)
|
||||
{
|
||||
info->Power = info->Reset = Reset;
|
||||
info->StateAction = StateAction;
|
||||
SetWriteHandler(0x8000,0xffff,Mapper41_write);
|
||||
SetWriteHandler(0x6000,0x67ff,Mapper41_write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
|
||||
return(1);
|
||||
}
|
|
@ -1,111 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 regs[4], CHRBank8;
|
||||
static uint16 IRQCount;
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setchr8(CHRBank8);
|
||||
setprg8(0x6000, regs[0] & 0xF);
|
||||
setmirror((regs[1] & 0x08) ? MI_H : MI_V);
|
||||
}
|
||||
|
||||
static DECLFW(NicolWrite)
|
||||
{
|
||||
CHRBank8 = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(Write)
|
||||
{
|
||||
regs[A & 3] = V;
|
||||
if((A & 3) == 2)
|
||||
if(!(V & 2))
|
||||
{
|
||||
X6502_IRQEnd(MDFN_IQEXT);
|
||||
IRQCount = 0;
|
||||
}
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void IRQHook(int a)
|
||||
{
|
||||
if(regs[2] & 2)
|
||||
{
|
||||
IRQCount += a;
|
||||
if(IRQCount >= 24576)
|
||||
{
|
||||
X6502_IRQBegin(MDFN_IQEXT);
|
||||
IRQCount = 24576;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
int x;
|
||||
|
||||
CHRBank8 = 0;
|
||||
|
||||
IRQCount = 0;
|
||||
|
||||
for(x = 0; x < 4; x++)
|
||||
regs[x] = 0;
|
||||
|
||||
setprg8(0x8000, 0xC);
|
||||
setprg8(0xa000, 0xD);
|
||||
setprg8(0xc000, 0xE);
|
||||
setprg8(0xe000, 0xF);
|
||||
|
||||
Sync();
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFARRAY(regs, 4),
|
||||
SFVAR(IRQCount),
|
||||
SFVAR(CHRBank8),
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
|
||||
if(load)
|
||||
{
|
||||
Sync();
|
||||
}
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int BioMiracleA_Init(CartInfo *info)
|
||||
{
|
||||
MapIRQHook = IRQHook;
|
||||
info->Power = Power;
|
||||
info->StateAction = StateAction;
|
||||
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000, 0x9FFF, NicolWrite);
|
||||
SetWriteHandler(0xe000, 0xFFFF, Write);
|
||||
|
||||
return(1);
|
||||
}
|
|
@ -1,72 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 A64reg, A64wr;
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setprg32(0x8000, (A64wr&1)+((A64reg&0xF)<<1));
|
||||
setchr8(((A64wr>>4)&7)+((A64reg&0xF0)>>1));
|
||||
}
|
||||
|
||||
static DECLFW(Mapper46_writel)
|
||||
{
|
||||
A64reg=V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(Mapper46_write)
|
||||
{
|
||||
A64wr=V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void Reset(CartInfo *info)
|
||||
{
|
||||
A64reg = A64wr = 0;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFVAR(A64reg),
|
||||
SFVAR(A64wr),
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
Sync();
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int Mapper46_Init(CartInfo *info)
|
||||
{
|
||||
info->Power = Reset;
|
||||
info->StateAction = StateAction;
|
||||
SetWriteHandler(0x8000,0xffff,Mapper46_write);
|
||||
SetWriteHandler(0x6000,0x7fff,Mapper46_writel);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
return(1);
|
||||
}
|
|
@ -1,87 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 mode, page;
|
||||
|
||||
static uint32 Get8K(uint32 A)
|
||||
{
|
||||
uint32 bank;
|
||||
|
||||
bank=(page<<2)|((A>>13)&1);
|
||||
|
||||
if(A&0x4000 && !(mode&1)) bank|=0xC;
|
||||
if(!(A&0x8000)) bank|=0x20;
|
||||
if(mode==2) bank|=2;
|
||||
else bank|=(A>>13)&2;
|
||||
return(bank);
|
||||
}
|
||||
|
||||
static void Synco(void)
|
||||
{
|
||||
uint32 x;
|
||||
if(mode<=2)
|
||||
setmirror(MI_V);
|
||||
else
|
||||
setmirror(MI_H);
|
||||
for(x=0x6000;x<0x10000;x+=8192)
|
||||
setprg8(x,Get8K(x));
|
||||
}
|
||||
|
||||
static DECLFW(Write)
|
||||
{
|
||||
if(A&0x8000) page=V&0xF;
|
||||
else mode=(mode&2)|((V>>1)&1);
|
||||
|
||||
if(A&0x4000) mode=(mode&1)|((V>>3)&2);
|
||||
Synco();
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
setchr8(0);
|
||||
mode = 1;
|
||||
page = 0;
|
||||
Synco();
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFVAR(page),
|
||||
SFVAR(mode),
|
||||
SFEND
|
||||
};
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
Synco();
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int Mapper51_Init(CartInfo *info)
|
||||
{
|
||||
SetWriteHandler(0x6000,0xFFFF,Write);
|
||||
SetReadHandler(0x6000,0xFFFF,CartBR);
|
||||
info->Power = Power;
|
||||
info->StateAction = StateAction;
|
||||
return(1);
|
||||
}
|
|
@ -1,130 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 IRQa, CHRBanks[8], PRGBanks[3], Mirroring;
|
||||
static uint16 IRQCount, IRQLatch;
|
||||
|
||||
static void DoCHR(void)
|
||||
{
|
||||
for(int x = 0; x < 8; x++)
|
||||
setchr1(x * 1024, CHRBanks[x]);
|
||||
}
|
||||
|
||||
static void DoPRG(void)
|
||||
{
|
||||
for(int x = 0; x < 3; x++)
|
||||
setprg8(0x8000 + x * 8192, PRGBanks[x]);
|
||||
}
|
||||
|
||||
static void DoMirroring(void)
|
||||
{
|
||||
setmirror((Mirroring & 1) ^ 1);
|
||||
}
|
||||
|
||||
static void IREMIRQHook(int a)
|
||||
{
|
||||
if(IRQa)
|
||||
{
|
||||
uint16 last = IRQCount;
|
||||
IRQCount-=a;
|
||||
if(IRQCount > last)
|
||||
{
|
||||
X6502_IRQBegin(MDFN_IQEXT);
|
||||
IRQa=0;
|
||||
IRQCount=0xFFFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(Mapper65_write)
|
||||
{
|
||||
A&= 0xF007;
|
||||
|
||||
if(A >= 0xb000 && A <= 0xB007)
|
||||
{
|
||||
CHRBanks[A & 7] = V;
|
||||
DoCHR();
|
||||
}
|
||||
else switch(A)
|
||||
{
|
||||
case 0x8000:PRGBanks[0] = V; DoPRG(); break;
|
||||
case 0x9001:Mirroring = V >> 7; DoMirroring();break;
|
||||
case 0x9003:IRQa=V&0x80;X6502_IRQEnd(MDFN_IQEXT);break;
|
||||
case 0x9004:IRQCount=IRQLatch;break;
|
||||
case 0x9005: IRQLatch&=0x00FF;
|
||||
IRQLatch|=V<<8;
|
||||
break;
|
||||
case 0x9006: IRQLatch&=0xFF00;IRQLatch|=V;
|
||||
break;
|
||||
case 0xa000:PRGBanks[1] = V; DoPRG();break;
|
||||
case 0xC000:PRGBanks[2] = V; DoPRG();break;
|
||||
}
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
int x;
|
||||
|
||||
for(x = 0; x < 8; x++)
|
||||
CHRBanks[x] = x;
|
||||
|
||||
Mirroring = ((info->mirror & 1) ^ 1);
|
||||
PRGBanks[0] = 0;
|
||||
PRGBanks[1] = 1;
|
||||
PRGBanks[2] = 0xFE;
|
||||
DoPRG();
|
||||
DoCHR();
|
||||
DoMirroring();
|
||||
setprg8(0xe000, 0xFF);
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFARRAY(CHRBanks, 8), SFARRAY(PRGBanks, 3),
|
||||
SFVAR(Mirroring),
|
||||
SFVAR(IRQCount), SFVAR(IRQLatch), SFVAR(IRQa),
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
{
|
||||
DoCHR();
|
||||
DoPRG();
|
||||
DoMirroring();
|
||||
}
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int Mapper65_Init(CartInfo *info)
|
||||
{
|
||||
info->Power = Power;
|
||||
info->StateAction = StateAction;
|
||||
MapIRQHook=IREMIRQHook;
|
||||
SetWriteHandler(0x8000,0xffff,Mapper65_write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
|
||||
return(1);
|
||||
}
|
|
@ -1,136 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 CHRBanks[4], PRGBank16, Mirroring, suntoggle, IRQa;
|
||||
static uint16 IRQCount;
|
||||
|
||||
static void DoCHR(void)
|
||||
{
|
||||
int x;
|
||||
for(x = 0; x < 4; x++)
|
||||
setchr2(x * 2048, CHRBanks[x]);
|
||||
}
|
||||
|
||||
static void DoMirroring(void)
|
||||
{
|
||||
switch(Mirroring & 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 DoPRG(void)
|
||||
{
|
||||
setprg16(0x8000, PRGBank16);
|
||||
}
|
||||
|
||||
static DECLFW(Mapper67_write)
|
||||
{
|
||||
A&=0xF800;
|
||||
if((A&0x800) && A<=0xb800)
|
||||
{
|
||||
CHRBanks[(A - 0x8800) >> 12] = V;
|
||||
DoCHR();
|
||||
}
|
||||
else switch(A)
|
||||
{
|
||||
case 0xc800:
|
||||
case 0xc000:if(!suntoggle)
|
||||
{
|
||||
IRQCount&=0xFF;
|
||||
IRQCount|=V<<8;
|
||||
}
|
||||
else
|
||||
{
|
||||
IRQCount&=0xFF00;
|
||||
IRQCount|=V;
|
||||
}
|
||||
suntoggle^=1;
|
||||
break;
|
||||
case 0xd800:suntoggle=0;IRQa=V&0x10;X6502_IRQEnd(MDFN_IQEXT);break;
|
||||
|
||||
case 0xe800:Mirroring = V & 3; DoMirroring(); break;
|
||||
case 0xf800:PRGBank16 = V; DoPRG(); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void SunIRQHook(int a)
|
||||
{
|
||||
if(IRQa)
|
||||
{
|
||||
uint16 last = IRQCount;
|
||||
IRQCount-=a;
|
||||
if(last < IRQCount)
|
||||
{
|
||||
X6502_IRQBegin(MDFN_IQEXT);
|
||||
IRQa=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
Mirroring = 0;
|
||||
IRQCount = IRQa = 0;
|
||||
for(int x = 0; x < 4; x++)
|
||||
CHRBanks[x] = x;
|
||||
PRGBank16 = 0;
|
||||
DoMirroring();
|
||||
DoPRG();
|
||||
DoCHR();
|
||||
|
||||
setprg16(0xc000, ~0);
|
||||
}
|
||||
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFARRAY(CHRBanks, 4),
|
||||
SFVAR(PRGBank16), SFVAR(Mirroring), SFVAR(suntoggle), SFVAR(IRQa), SFVAR(IRQCount),
|
||||
SFEND
|
||||
};
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
{
|
||||
Mirroring &= 3;
|
||||
DoPRG();
|
||||
DoCHR();
|
||||
DoMirroring();
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int Mapper67_Init(CartInfo *info)
|
||||
{
|
||||
SetWriteHandler(0x8000, 0xffff, Mapper67_write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
MapIRQHook=SunIRQHook;
|
||||
info->Power = Power;
|
||||
info->StateAction = StateAction;
|
||||
|
||||
return(1);
|
||||
}
|
|
@ -1,140 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 CHRBanks[4], Mirroring, NTBanks[2], PRGBank16;
|
||||
static uint8 WRAM[8192];
|
||||
|
||||
static void DoCHR(void)
|
||||
{
|
||||
if(!(Mirroring & 0x10))
|
||||
{
|
||||
const int mir_tab[4] = {MI_V, MI_H, MI_0, MI_1};
|
||||
setmirror(mir_tab[Mirroring & 3]);
|
||||
}
|
||||
else
|
||||
{
|
||||
uint8 *b[2];
|
||||
b[0] = CHRptr[0] + (((NTBanks[0] | 0x80)&CHRmask1[0])<<10);
|
||||
b[1] = CHRptr[0] + (((NTBanks[1] | 0x80) & CHRmask1[0]) << 10);
|
||||
|
||||
const int zoom_tab[4][4] =
|
||||
{
|
||||
{ 0, 1, 0, 1 },
|
||||
{ 0, 0, 1, 1 },
|
||||
{ 0, 0, 0, 0 },
|
||||
{ 1, 1, 1, 1 },
|
||||
};
|
||||
for(int x = 0; x < 4; x++)
|
||||
setntamem(b[zoom_tab[Mirroring & 3][x]], 0, x);
|
||||
}
|
||||
for(int x = 0; x < 4; x++)
|
||||
setchr2(x << 11, CHRBanks[x]);
|
||||
}
|
||||
|
||||
static void DoPRG(void)
|
||||
{
|
||||
setprg16(0x8000, PRGBank16);
|
||||
}
|
||||
|
||||
static DECLFW(Mapper68_write)
|
||||
{
|
||||
A&=0xF000;
|
||||
|
||||
if(A>=0x8000 && A<=0xB000)
|
||||
{
|
||||
CHRBanks[(A - 0x8000) >> 12] = V;
|
||||
DoCHR();
|
||||
}
|
||||
else switch(A)
|
||||
{
|
||||
case 0xc000:NTBanks[0] = V;
|
||||
DoCHR();
|
||||
break;
|
||||
|
||||
case 0xd000:NTBanks[1] = V;
|
||||
DoCHR();
|
||||
break;
|
||||
|
||||
case 0xe000: Mirroring = V;
|
||||
DoCHR();
|
||||
break;
|
||||
case 0xf000: PRGBank16 = V; DoPRG();break;
|
||||
}
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFVAR(Mirroring), SFARRAY(CHRBanks, 4), SFVAR(PRGBank16), SFARRAY(NTBanks, 2),
|
||||
SFARRAY(WRAM, 8192),
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
{
|
||||
DoPRG();
|
||||
DoCHR();
|
||||
}
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
int x;
|
||||
for(x = 0; x < 4; x++)
|
||||
CHRBanks[x] = x;
|
||||
PRGBank16 = 0;
|
||||
Mirroring = 0;
|
||||
for(x = 0; x < 2; x++)
|
||||
NTBanks[x] = 0;
|
||||
DoPRG();
|
||||
DoCHR();
|
||||
setprg16(0xc000, ~0);
|
||||
|
||||
if(!info->battery)
|
||||
memset(WRAM, 0, 8192);
|
||||
|
||||
setprg16r(0x10, 0x6000, 0);
|
||||
}
|
||||
|
||||
int Mapper68_Init(CartInfo *info)
|
||||
{
|
||||
info->Power = Power;
|
||||
info->StateAction = StateAction;
|
||||
SetWriteHandler(0x8000,0xffff,Mapper68_write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
|
||||
// external WRAM is apparently used by Nantettatte Baseball
|
||||
SetReadHandler(0x6000, 0x7FFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||
SetupCartPRGMapping(0x10, WRAM, 8192, 1);
|
||||
|
||||
if(info->battery)
|
||||
{
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = 8192;
|
||||
}
|
||||
return(1);
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
#include "mapinc.h"
|
||||
|
||||
static uint8 latch;
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setprg16(0x8000, (latch >> 4) & 0x0f);
|
||||
setchr8(latch & 0x0F);
|
||||
}
|
||||
|
||||
static DECLFW(Mapper70_write)
|
||||
{
|
||||
latch = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
latch = 0;
|
||||
setprg16(0xc000, 0x0F);
|
||||
Sync();
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFVAR(latch),
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
Sync();
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int Mapper70_Init(CartInfo *info)
|
||||
{
|
||||
info->Power = Power;
|
||||
info->StateAction = StateAction;
|
||||
SetWriteHandler(0x6000,0xffff,Mapper70_write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
|
@ -1,78 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 latch;
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setprg16(0x8000, latch & 0xF);
|
||||
setchr8(latch >> 4);
|
||||
}
|
||||
static DECLFW(Mapper72_write)
|
||||
{
|
||||
if(V&0x80)
|
||||
{
|
||||
latch &= 0xF0;
|
||||
latch |= V & 0xF;
|
||||
}
|
||||
|
||||
if(V&0x40)
|
||||
{
|
||||
latch &= 0x0F;
|
||||
latch |= (V&0xF) << 4;
|
||||
}
|
||||
|
||||
if(V&0xC0)
|
||||
Sync();
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFVAR(latch),
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
Sync();
|
||||
return(ret);
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
latch = 0;
|
||||
setprg16(0xc000, 0xF);
|
||||
Sync();
|
||||
}
|
||||
|
||||
int Mapper72_Init(CartInfo *info)
|
||||
{
|
||||
info->Power = Power;
|
||||
info->StateAction = StateAction;
|
||||
SetWriteHandler(0x6000,0xffff,Mapper72_write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
|
@ -1,107 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint16 IRQCount;
|
||||
static uint8 IRQa, PRGBank16, WRAM[8192];
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setprg16(0x8000, PRGBank16);
|
||||
}
|
||||
|
||||
static DECLFW(Mapper73_write)
|
||||
{
|
||||
//if(A>=0xd000 && A<=0xdfff)
|
||||
X6502_IRQEnd(MDFN_IQEXT); /* How are IRQs acknowledged on this chip? */
|
||||
switch(A&0xF000)
|
||||
{
|
||||
//default: printf("$%04x:$%02x\n",A,V);break;
|
||||
case 0x8000:IRQCount&=0xFFF0;IRQCount|=(V&0xF);break;
|
||||
case 0x9000:IRQCount&=0xFF0F;IRQCount|=(V&0xF)<<4;break;
|
||||
case 0xa000:IRQCount&=0xF0FF;IRQCount|=(V&0xF)<<8;break;
|
||||
case 0xb000:IRQCount&=0x0FFF;IRQCount|=(V&0xF)<<12;break;
|
||||
case 0xc000:IRQa=V&2;break;
|
||||
case 0xf000:PRGBank16 = V; Sync(); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void Mapper73IRQHook(int a)
|
||||
{
|
||||
if(IRQa)
|
||||
{
|
||||
uint32 tmp = IRQCount;
|
||||
tmp += a;
|
||||
if(tmp >= 0xFFFF)
|
||||
{
|
||||
IRQCount&=0xFFFF;
|
||||
IRQa=0;
|
||||
X6502_IRQBegin(MDFN_IQEXT);
|
||||
}
|
||||
else
|
||||
IRQCount = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
IRQCount = IRQa = 0;
|
||||
PRGBank16 = 0;
|
||||
setprg16(0xc000, 0xFF);
|
||||
setchr8(0);
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
Sync();
|
||||
|
||||
if(!info->battery)
|
||||
memset(WRAM, 0xFF, 8192);
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFVAR(IRQCount), SFVAR(IRQa), SFVAR(PRGBank16),
|
||||
SFARRAY(WRAM, 8192),
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
Sync();
|
||||
return(ret);
|
||||
}
|
||||
int Mapper73_Init(CartInfo *info)
|
||||
{
|
||||
info->StateAction = StateAction;
|
||||
|
||||
SetupCartPRGMapping(0x10, WRAM, 8192, 1);
|
||||
SetWriteHandler(0x8000,0xffff,Mapper73_write);
|
||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
info->Power = Power;
|
||||
MapIRQHook=Mapper73IRQHook;
|
||||
|
||||
if(info->battery)
|
||||
{
|
||||
memset(WRAM, 0xFF, 8192);
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = 8192;
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
|
|
@ -1,100 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
|
||||
static uint8 PRGBanks[3], map75ar[2], map75sel;
|
||||
|
||||
static void DoPRG(void)
|
||||
{
|
||||
setprg8(0x8000, PRGBanks[0]);
|
||||
setprg8(0xa000, PRGBanks[1]);
|
||||
setprg8(0xc000, PRGBanks[2]);
|
||||
}
|
||||
|
||||
static void DoCHR(void)
|
||||
{
|
||||
setchr4(0x0000, ((map75sel & 2) << 3) | map75ar[0]);
|
||||
setchr4(0x1000, ((map75sel & 4) << 2) | map75ar[1]);
|
||||
}
|
||||
|
||||
static void DoMirroring(void)
|
||||
{
|
||||
setmirror((map75sel & 1) ? MI_H : MI_V);
|
||||
}
|
||||
|
||||
static DECLFW(Mapper75_write)
|
||||
{
|
||||
switch(A&0xF000)
|
||||
{
|
||||
case 0x8000:PRGBanks[0] = V; DoPRG(); break;
|
||||
case 0x9000:map75sel = V; DoCHR(); DoMirroring(); map75sel=V; break;
|
||||
case 0xa000:PRGBanks[1] = V; DoPRG();break;
|
||||
case 0xc000:PRGBanks[2] = V; DoPRG();break;
|
||||
case 0xe000:V&=0xF;map75ar[0]=V;DoCHR();break;
|
||||
case 0xf000:V&=0xF;map75ar[1]=V;DoCHR();break;
|
||||
}
|
||||
}
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFARRAY(PRGBanks, 3),
|
||||
SFARRAY(map75ar, 2),
|
||||
SFVAR(map75sel),
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
{
|
||||
DoPRG();
|
||||
DoCHR();
|
||||
DoMirroring();
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
PRGBanks[0] = 0;
|
||||
PRGBanks[1] = 1;
|
||||
PRGBanks[2] = 0xFE;
|
||||
map75ar[0] = 0;
|
||||
map75ar[1] = 1;
|
||||
map75sel = 0;
|
||||
DoPRG();
|
||||
DoCHR();
|
||||
DoMirroring();
|
||||
|
||||
setprg8(0xe000, 0xFF);
|
||||
}
|
||||
|
||||
int Mapper75_Init(CartInfo *info)
|
||||
{
|
||||
SetWriteHandler(0x8000,0xffff,Mapper75_write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
info->Power = Power;
|
||||
info->StateAction = StateAction;
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
|
@ -1,118 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 cmd, CHRBanks[4], PRGBanks[2], Mirroring;
|
||||
|
||||
static void DoCHR(void)
|
||||
{
|
||||
for(int x = 0; x < 4; x++)
|
||||
setchr2(x * 2048, CHRBanks[x]);
|
||||
}
|
||||
|
||||
static void DoPRG(void)
|
||||
{
|
||||
if(cmd & 0x40)
|
||||
{
|
||||
setprg8(0xc000, PRGBanks[0]);
|
||||
setprg8(0x8000, 0xFE);
|
||||
}
|
||||
else
|
||||
{
|
||||
setprg8(0x8000, PRGBanks[0]);
|
||||
setprg8(0xc000, 0xFE);
|
||||
}
|
||||
setprg8(0xa000, PRGBanks[1]);
|
||||
}
|
||||
|
||||
static void DoMirroring(void)
|
||||
{
|
||||
setmirror((Mirroring & 1) ? MI_H : MI_V);
|
||||
}
|
||||
|
||||
static DECLFW(Mapper76_write)
|
||||
{
|
||||
switch(A&0xE001)
|
||||
{
|
||||
case 0x8000: cmd = V; DoPRG(); break;
|
||||
case 0x8001:
|
||||
switch(cmd&0x07)
|
||||
{
|
||||
case 2: CHRBanks[0] = V; DoCHR(); break;
|
||||
case 3: CHRBanks[1] = V; DoCHR(); break;
|
||||
case 4: CHRBanks[2] = V; DoCHR(); break;
|
||||
case 5: CHRBanks[3] = V; DoCHR(); break;
|
||||
case 6: PRGBanks[0] = V; DoPRG(); break;
|
||||
case 7: PRGBanks[1] = V; DoPRG(); break;
|
||||
}
|
||||
break;
|
||||
case 0xA000: Mirroring = V & 1; DoMirroring(); break;
|
||||
}
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFVAR(cmd),
|
||||
SFVAR(Mirroring),
|
||||
SFARRAY(CHRBanks, 4),
|
||||
SFARRAY(PRGBanks, 2),
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
{
|
||||
DoPRG();
|
||||
DoCHR();
|
||||
DoMirroring();
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
int x;
|
||||
|
||||
for(x = 0; x < 4; x++)
|
||||
CHRBanks[x] = x;
|
||||
|
||||
PRGBanks[0] = 0;
|
||||
PRGBanks[1] = 1;
|
||||
Mirroring = 0;
|
||||
cmd = 0;
|
||||
DoPRG();
|
||||
DoCHR();
|
||||
DoMirroring();
|
||||
setprg16(0xc000, 0x7F);
|
||||
}
|
||||
|
||||
|
||||
int Mapper76_Init(CartInfo *info)
|
||||
{
|
||||
SetWriteHandler(0x8000,0xffff,Mapper76_write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
info->Power = Power;
|
||||
info->StateAction = StateAction;
|
||||
return(1);
|
||||
}
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 latch;
|
||||
static uint8 CHRRAM[8192];
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setprg32(0x8000, latch & 0x7);
|
||||
setchr2(0x0000, (latch & 0xF0) >> 4);
|
||||
}
|
||||
|
||||
static DECLFW(Mapper77_write)
|
||||
{
|
||||
latch = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFVAR(latch),
|
||||
SFARRAY(CHRRAM, 8192),
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
Sync();
|
||||
return(ret);
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
latch = 0;
|
||||
Sync();
|
||||
for(int x = 2; x < 8; x++)
|
||||
setchr1r(0x10, x * 0x400, x);
|
||||
memset(CHRRAM, 0xFF, 8192);
|
||||
}
|
||||
|
||||
int Mapper77_Init(CartInfo *info)
|
||||
{
|
||||
info->Power = Power;
|
||||
info->StateAction = StateAction;
|
||||
|
||||
SetupCartCHRMapping(0x10, CHRRAM, 8192, 1);
|
||||
SetWriteHandler(0x6000,0xffff,Mapper77_write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
return(1);
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
#include "mapinc.h"
|
||||
|
||||
static uint8 latch;
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setprg16(0x8000, latch & 0x7);
|
||||
setmirror(((latch >> 3) & 1) ? MI_1 : MI_0);
|
||||
setchr8(latch >> 4);
|
||||
}
|
||||
|
||||
static DECLFW(Mapper78_write)
|
||||
{
|
||||
latch = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
latch = 0;
|
||||
setprg16(0xc000, 0x0F);
|
||||
Sync();
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFVAR(latch),
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
Sync();
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int Mapper78_Init(CartInfo *info)
|
||||
{
|
||||
info->Power = Power;
|
||||
info->StateAction = StateAction;
|
||||
SetWriteHandler(0x8000,0xffff,Mapper78_write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
|
||||
return(1);
|
||||
}
|
|
@ -1,79 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 WRAM[8192], latch;
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setprg16(0x8000, latch >> 3);
|
||||
setchr8(latch & 0x7);
|
||||
}
|
||||
|
||||
static DECLFW(Mapper8_write)
|
||||
{
|
||||
latch = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void Reset(CartInfo *info)
|
||||
{
|
||||
if(!info->battery)
|
||||
memset(WRAM, 0x00, 8192);
|
||||
latch = 0;
|
||||
Sync();
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
setprg16(0xc000, 0x1F);
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFARRAY(WRAM, 8192),
|
||||
SFVAR(latch),
|
||||
SFEND
|
||||
};
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
Sync();
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int Mapper8_Init(CartInfo *info)
|
||||
{
|
||||
latch = 0;
|
||||
info->Power = info->Reset = Reset;
|
||||
info->StateAction = StateAction;
|
||||
if(info->battery) // Do FFE units initialize 6000-7fff RAM?
|
||||
{
|
||||
memset(WRAM, 0x00, 8192);
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = 8192;
|
||||
}
|
||||
SetupCartPRGMapping(0x10, WRAM, 8192, 1);
|
||||
Sync();
|
||||
SetWriteHandler(0x8000,0xFFFF,Mapper8_write);
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||
return(1);
|
||||
}
|
||||
|
|
@ -1,170 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 Mirroring, PRGBanks[3], CHRBanks[6], WRAM[8192];
|
||||
static uint32 lastA;
|
||||
static bool isfu;
|
||||
static uint8 CCache[8];
|
||||
static int32 lastmc;
|
||||
|
||||
static void Fudou_PPU(uint32 A)
|
||||
{
|
||||
static uint8 z;
|
||||
|
||||
if(A>=0x2000) return;
|
||||
|
||||
A>>=10;
|
||||
lastA=A;
|
||||
|
||||
z=CCache[A];
|
||||
if(z != lastmc)
|
||||
{
|
||||
setmirror(z?MI_1:MI_0);
|
||||
lastmc = z;
|
||||
}
|
||||
}
|
||||
|
||||
static void mira()
|
||||
{
|
||||
if(isfu)
|
||||
{
|
||||
int x;
|
||||
CCache[0]=CCache[1]=CHRBanks[0]>>7;
|
||||
CCache[2]=CCache[3]=CHRBanks[1]>>7;
|
||||
|
||||
for(x=0;x<4;x++)
|
||||
CCache[4+x]=CHRBanks[2+x]>>7;
|
||||
|
||||
setmirror(CCache[lastA] ? MI_1 : MI_0);
|
||||
}
|
||||
else
|
||||
setmirror(Mirroring & 1);
|
||||
}
|
||||
static void DoPRG(void)
|
||||
{
|
||||
int x;
|
||||
for(x = 0; x < 3; x++)
|
||||
setprg8(0x8000 + x * 8192, PRGBanks[x]);
|
||||
}
|
||||
static void DoCHR(void)
|
||||
{
|
||||
setchr2(0x0000, (CHRBanks[0] >> 1) & 0x3F);
|
||||
setchr2(0x0800, (CHRBanks[1] >> 1) & 0x3F);
|
||||
|
||||
for(int x = 0; x < 4; x++)
|
||||
setchr1(0x1000 + x * 1024, CHRBanks[2 + x]);
|
||||
}
|
||||
static DECLFW(Mapper80_write)
|
||||
{
|
||||
switch(A)
|
||||
{
|
||||
case 0x7ef0: CHRBanks[0]=V;DoCHR();mira();break;
|
||||
case 0x7ef1: CHRBanks[1]=V;DoCHR();mira();break;
|
||||
|
||||
case 0x7ef2: CHRBanks[2]=V;DoCHR();mira();break;
|
||||
case 0x7ef3: CHRBanks[3]=V;DoCHR();mira();break;
|
||||
case 0x7ef4: CHRBanks[4]=V;DoCHR();mira();break;
|
||||
case 0x7ef5: CHRBanks[5]=V;DoCHR();mira();break;
|
||||
case 0x7ef6: Mirroring = V & 1;mira();break;
|
||||
case 0x7efa:
|
||||
case 0x7efb: PRGBanks[0] = V; DoPRG();break;
|
||||
case 0x7efd:
|
||||
case 0x7efc: PRGBanks[1] = V; DoPRG();break;
|
||||
case 0x7efe:
|
||||
case 0x7eff: PRGBanks[2] = V; DoPRG();break;
|
||||
}
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFVAR(Mirroring),
|
||||
SFARRAY(PRGBanks, 3),
|
||||
SFVAR(lastA),
|
||||
SFVAR(lastmc),
|
||||
SFARRAY(CHRBanks, 6),
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
|
||||
if(load)
|
||||
{
|
||||
DoPRG();
|
||||
DoCHR();
|
||||
mira();
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
int x;
|
||||
|
||||
for(x = 0; x < 6; x++)
|
||||
CHRBanks[x] = 0;
|
||||
|
||||
for(x = 0; x < 3; x++)
|
||||
PRGBanks[x] = x;
|
||||
|
||||
Mirroring = 0;
|
||||
lastA = 0;
|
||||
lastmc = -1;
|
||||
|
||||
setprg8(0xe000, ~0);
|
||||
DoPRG();
|
||||
DoCHR();
|
||||
mira();
|
||||
|
||||
memset(WRAM, 0xFF, 8192);
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
}
|
||||
|
||||
int Mapper80_Init(CartInfo *info)
|
||||
{
|
||||
info->Power = Power;
|
||||
info->StateAction = StateAction;
|
||||
|
||||
SetWriteHandler(0x7ef0,0x7eff,Mapper80_write);
|
||||
SetWriteHandler(0x6000, 0x7eef, CartBW);
|
||||
SetWriteHandler(0x7f00, 0x7fff, CartBW);
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
isfu = false;
|
||||
SetupCartPRGMapping(0x10, WRAM, 8192, 1); // For Minelvation Saga, at least. Total amount of RAM on the actual board is unknown, though...
|
||||
|
||||
if(info->battery)
|
||||
{
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = 8192;
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
|
||||
int Mapper207_Init(CartInfo *info)
|
||||
{
|
||||
Mapper80_Init(info);
|
||||
isfu = true;
|
||||
PPU_hook=Fudou_PPU;
|
||||
|
||||
return(1);
|
||||
}
|
|
@ -1,115 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 ctrl, CHRBanks[6], PRGBanks[3], WRAM[8192];
|
||||
|
||||
static void DoPRG(void)
|
||||
{
|
||||
int x;
|
||||
for(x = 0; x < 3; x++)
|
||||
setprg8(0x8000 + 8192 * x, PRGBanks[x]);
|
||||
}
|
||||
|
||||
static void DoCHR(void)
|
||||
{
|
||||
int x;
|
||||
|
||||
setmirror(ctrl & 1);
|
||||
|
||||
for(x=0;x<2;x++)
|
||||
setchr2((x<<11)|((ctrl&2)<<11),CHRBanks[x]>>1);
|
||||
for(x=0;x<4;x++)
|
||||
setchr1((x<<10) | (((ctrl&2)^2)<<11),CHRBanks[2+x]);
|
||||
}
|
||||
|
||||
static DECLFW(Mapper82_write)
|
||||
{
|
||||
if(A>=0x7EF0 && A<=0x7EF5)
|
||||
{
|
||||
CHRBanks[A - 0x7EF0]=V;
|
||||
DoCHR();
|
||||
}
|
||||
else
|
||||
switch(A)
|
||||
{
|
||||
case 0x7ef6:ctrl=V&3;
|
||||
DoCHR();
|
||||
break;
|
||||
case 0x7efa:V>>=2;PRGBanks[0]=V;DoPRG();break;
|
||||
case 0x7efb:V>>=2;PRGBanks[1]=V;DoPRG();break;
|
||||
case 0x7efc:V>>=2;PRGBanks[2]=V;DoPRG();break;
|
||||
}
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
int x;
|
||||
|
||||
for(x = 0; x < 3; x++)
|
||||
PRGBanks[x] = x;
|
||||
ctrl = 0;
|
||||
for(x = 0; x < 6; x++)
|
||||
CHRBanks[x] = 0;
|
||||
|
||||
setprg8(0xe000, 0xFF >> 2);
|
||||
DoPRG();
|
||||
DoCHR();
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFVAR(ctrl),
|
||||
SFARRAY(CHRBanks, 6),
|
||||
SFARRAY(PRGBanks, 3),
|
||||
SFARRAY(WRAM, 8192),
|
||||
SFEND
|
||||
};
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
|
||||
if(load)
|
||||
{
|
||||
DoPRG();
|
||||
DoCHR();
|
||||
}
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int Mapper82_Init(CartInfo *info)
|
||||
{
|
||||
info->Power = Power;
|
||||
info->StateAction = StateAction;
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||
/* external WRAM might end at $73FF */
|
||||
SetWriteHandler(0x7ef0,0x7efc,Mapper82_write);
|
||||
|
||||
if(info->battery)
|
||||
{
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = 8192;
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
|
|
@ -1,165 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 cmdin;
|
||||
static uint8 cmd;
|
||||
static uint8 regs[8];
|
||||
static uint8 master,chrm;
|
||||
|
||||
static int32 IRQCount,IRQa;
|
||||
|
||||
static void DoPRG(void)
|
||||
{
|
||||
if(master&0x80)
|
||||
{
|
||||
if(master&0x20)
|
||||
{
|
||||
setprg32(0x8000,(master&0xF)>>1);
|
||||
}
|
||||
else
|
||||
{
|
||||
setprg16(0x8000,master&0xF);
|
||||
setprg16(0xC000,master&0xF);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setprg8(0xA000,regs[4]);
|
||||
setprg8(0xE000,~0);
|
||||
if(cmd&0x40)
|
||||
{
|
||||
setprg8(0xC000,regs[2]);
|
||||
setprg8(0x8000,~1);
|
||||
}
|
||||
else
|
||||
{
|
||||
setprg8(0x8000,regs[2]);
|
||||
setprg8(0xC000,~1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void DoCHR(void)
|
||||
{
|
||||
uint32 base=(cmd&0x80)<<5;
|
||||
int orie=(chrm&0x4)<<6;
|
||||
|
||||
setchr2(0x0000^base,(orie|regs[0])>>1); //K
|
||||
setchr2(0x0800^base,(orie|regs[3])>>1); //43
|
||||
|
||||
setchr1(0x1000,orie|regs[1]);
|
||||
setchr1(0x1400,orie|regs[5]);
|
||||
setchr1(0x1800,orie|regs[6]);
|
||||
setchr1(0x1c00,orie|regs[7]);
|
||||
}
|
||||
|
||||
static DECLFW(UNL8237Write)
|
||||
{
|
||||
switch(A&0xF000)
|
||||
{
|
||||
case 0xf000:IRQCount=V;break;
|
||||
case 0xE000:X6502_IRQEnd(MDFN_IQEXT);break;
|
||||
}
|
||||
// if(A<0x8000)
|
||||
// printf("$%04x:$%02x, %d\n",A&0xFFFF,V,scanline);
|
||||
if(A==0x5000)
|
||||
{
|
||||
master=V;
|
||||
DoPRG();
|
||||
DoCHR();
|
||||
}
|
||||
else if(A==0x5001)
|
||||
{
|
||||
chrm=V;
|
||||
DoCHR();
|
||||
}
|
||||
else
|
||||
switch(A&0xE000)
|
||||
{
|
||||
case 0x8000:setmirror(((V|(V>>7))&1)^1);break;
|
||||
case 0xa000:cmd=V;cmdin=1;DoPRG();DoCHR();break;
|
||||
case 0xC000:if(!cmdin) break;
|
||||
regs[cmd&7]=V;
|
||||
DoPRG();
|
||||
DoCHR();
|
||||
cmdin=0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void UNL8237Reset(CartInfo *info)
|
||||
{
|
||||
int x;
|
||||
|
||||
for(x=0;x<8;x++) regs[x]=0;
|
||||
master=chrm=cmd=cmdin=IRQCount=IRQa=0;
|
||||
DoPRG();
|
||||
DoCHR();
|
||||
}
|
||||
|
||||
static void hooko(void)
|
||||
{
|
||||
if(IRQCount)
|
||||
{
|
||||
IRQCount--;
|
||||
if(!IRQCount)
|
||||
{
|
||||
X6502_IRQBegin(MDFN_IQEXT);
|
||||
//printf("IRQ: %d\n",scanline);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFARRAYN(regs, 8, "REGS"),
|
||||
SFVARN(IRQCount, "IRQC"),
|
||||
SFVARN(IRQa, "IRQA"),
|
||||
SFVARN(master, "MAST"),
|
||||
SFVARN(chrm, "CHRM"),
|
||||
SFVARN(cmd, "CMD"),
|
||||
SFVARN(cmdin, "CMDI"),
|
||||
SFEND
|
||||
};
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
|
||||
if(load)
|
||||
{
|
||||
DoPRG();
|
||||
DoCHR();
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int UNL8237_Init(CartInfo *info)
|
||||
{
|
||||
GameHBIRQHook=hooko;
|
||||
info->Power=UNL8237Reset;
|
||||
info->StateAction = StateAction;
|
||||
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
SetWriteHandler(0x5000,0xFFFF,UNL8237Write);
|
||||
|
||||
return(1);
|
||||
}
|
|
@ -1,65 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 latch;
|
||||
static void Sync(void)
|
||||
{
|
||||
setchr8((latch&3)|((latch>>4)&4));
|
||||
setprg32(0x8000, (latch >> 4) & 3);
|
||||
}
|
||||
|
||||
static DECLFW(Mapper86_write)
|
||||
{
|
||||
if(A>=0x6000 && A<=0x6fFF)
|
||||
{
|
||||
latch = V;
|
||||
Sync();
|
||||
}
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
latch = 0;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFVAR(latch), SFEND
|
||||
};
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
Sync();
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int Mapper86_Init(CartInfo *info)
|
||||
{
|
||||
info->StateAction = StateAction;
|
||||
info->Power = Power;
|
||||
SetWriteHandler(0x6000,0x6fff,Mapper86_write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
|
||||
return(1);
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
#include "mapinc.h"
|
||||
|
||||
static uint8 latch;
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setchr8(latch);
|
||||
}
|
||||
|
||||
static DECLFW(Mapper87_write)
|
||||
{
|
||||
latch = V >> 1;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
latch = 0;
|
||||
setprg32(0x8000, 0);
|
||||
Sync();
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFVAR(latch),
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
Sync();
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int Mapper87_Init(CartInfo *info)
|
||||
{
|
||||
info->Power = Power;
|
||||
info->StateAction = StateAction;
|
||||
SetWriteHandler(0x6000,0x7fff,Mapper87_write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
|
||||
return(1);
|
||||
}
|
|
@ -1,98 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static int mn;
|
||||
static uint8 cmd, regs[8];
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
if(mn)
|
||||
{
|
||||
setmirror(((cmd >> 6) & 1) ? MI_1 : MI_0);
|
||||
}
|
||||
setchr2(0x0000, (regs[0] & 0x3E) >> 1);
|
||||
setchr2(0x0800, (regs[1] & 0x3E) >> 1);
|
||||
setchr1(0x1000, (regs[2] & 0x3F) | 0x40);
|
||||
setchr1(0x1400, (regs[3] & 0x3F) | 0x40);
|
||||
setchr1(0x1800, (regs[4] & 0x3F) | 0x40);
|
||||
setchr1(0x1c00, (regs[5] & 0x3F) | 0x40);
|
||||
setprg8(0x8000, regs[6]);
|
||||
setprg8(0xa000, regs[7]);
|
||||
}
|
||||
|
||||
static DECLFW(Mapper88_write)
|
||||
{
|
||||
switch(A&0x8001)
|
||||
{
|
||||
case 0x8000:cmd = V;
|
||||
Sync();
|
||||
break;
|
||||
case 0x8001:regs[cmd & 0x7] = V;Sync();break;
|
||||
}
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
cmd = 0;
|
||||
int x;
|
||||
for(x = 0; x < 8; x++)
|
||||
regs[x] = ~0;
|
||||
|
||||
setprg16(0xc000, ~0);
|
||||
Sync();
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFVAR(cmd),
|
||||
SFARRAY(regs, 8),
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
Sync();
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int Mapper88_Init(CartInfo *info)
|
||||
{
|
||||
mn=0;
|
||||
SetWriteHandler(0x8000,0xffff,Mapper88_write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
info->Power = Power;
|
||||
info->StateAction = StateAction;
|
||||
return(1);
|
||||
}
|
||||
|
||||
int Mapper154_Init(CartInfo *info)
|
||||
{
|
||||
mn=1;
|
||||
SetWriteHandler(0x8000,0xffff,Mapper88_write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
info->Power = Power;
|
||||
info->StateAction = StateAction;
|
||||
|
||||
return(1);
|
||||
}
|
|
@ -1,66 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 latch;
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setchr8((latch&7)|((latch>>4)&8));
|
||||
setprg16(0x8000,(latch>>4)&7);
|
||||
setmirror(((latch >> 3) & 1) ? MI_1 : MI_0);
|
||||
}
|
||||
|
||||
static DECLFW(Mapper89_write)
|
||||
{
|
||||
latch = V;
|
||||
Sync();
|
||||
}
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
latch = 0;
|
||||
setprg16(0xc000, 0x7);
|
||||
Sync();
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFVAR(latch),
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret= MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
Sync();
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int Mapper89_Init(CartInfo *info)
|
||||
{
|
||||
info->Power = Power;
|
||||
info->StateAction = StateAction;
|
||||
SetWriteHandler(0x8000,0xffff,Mapper89_write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
|
||||
return(1);
|
||||
}
|
|
@ -1,358 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static int is209;
|
||||
|
||||
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 uint16 names[4];
|
||||
static uint8 tekker;
|
||||
|
||||
static DECLFR(tekread)
|
||||
{
|
||||
//MDFN_printf("READ READ READ: $%04x, $%04x\n",A,X.PC);
|
||||
switch(A)
|
||||
{
|
||||
case 0x5000:return(tekker);
|
||||
case 0x5800:return(mul[0]*mul[1]);
|
||||
case 0x5801:return((mul[0]*mul[1])>>8);
|
||||
case 0x5803:return(regie);
|
||||
default:break;
|
||||
}
|
||||
return(X.DB);
|
||||
}
|
||||
|
||||
static void mira(void)
|
||||
{
|
||||
if(tkcom[0]&0x20 && is209)
|
||||
{
|
||||
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[2]&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)
|
||||
{
|
||||
switch(tkcom[0]&3)
|
||||
{
|
||||
case 1: // 16 KB
|
||||
setprg16(0x8000,prgb[0]);
|
||||
setprg16(0xC000,prgb[2]);
|
||||
break;
|
||||
case 2: //2 = 8 KB ??
|
||||
if(tkcom[0]&0x4)
|
||||
{
|
||||
setprg8(0x8000,prgb[0]);
|
||||
setprg8(0xa000,prgb[1]);
|
||||
setprg8(0xc000,prgb[2]);
|
||||
setprg8(0xe000,prgb[3]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(tkcom[0]&0x80)
|
||||
setprg8(0x6000,prgb[3]);
|
||||
setprg8(0x8000,prgb[0]);
|
||||
setprg8(0xa000,prgb[1]);
|
||||
setprg8(0xc000,prgb[2]);
|
||||
setprg8(0xe000,~0);
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
case 3:
|
||||
setprg8(0x8000,prgb[0]);
|
||||
setprg8(0xa000,prgb[1]);
|
||||
setprg8(0xc000,prgb[2]);
|
||||
setprg8(0xe000,prgb[3]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void tekvrom(void)
|
||||
{
|
||||
int x;
|
||||
|
||||
switch(tkcom[0]&0x18)
|
||||
{
|
||||
case 0x00: // 8KB
|
||||
setchr8(chrlow[0]|(chrhigh[0]<<8));
|
||||
break;
|
||||
case 0x08: // 4KB
|
||||
for(x=0;x<8;x+=4)
|
||||
setchr4(x<<10,chrlow[x]|(chrhigh[x]<<8));
|
||||
break;
|
||||
case 0x10: // 2KB
|
||||
for(x=0;x<8;x+=2)
|
||||
setchr2(x<<10,chrlow[x]|(chrhigh[x]<<8));
|
||||
break;
|
||||
case 0x18: // 1KB
|
||||
for(x=0;x<8;x++)
|
||||
setchr1(x<<10,(chrlow[x]|(chrhigh[x]<<8)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(Mapper90_write)
|
||||
{
|
||||
//printf("$%04x:$%02x\n",A,V);
|
||||
|
||||
if(A==0x5800) mul[0]=V;
|
||||
else if(A==0x5801) mul[1]=V;
|
||||
else if(A==0x5803) regie=V;
|
||||
|
||||
|
||||
//if(A>=0xc000 && A<=0xc007)
|
||||
// MDFN_printf("$%04x:$%02x $%04x, %d, %d\n",A,V,X.PC,scanline,timestamp);
|
||||
|
||||
A&=0xF007;
|
||||
if(A>=0x8000 && A<=0x8003)
|
||||
{
|
||||
prgb[A&3]=V;
|
||||
tekprom();
|
||||
}
|
||||
else if(A>=0x9000 && A<=0x9007)
|
||||
{
|
||||
chrlow[A&7]=V;
|
||||
tekvrom();
|
||||
}
|
||||
else if(A>=0xa000 && A<=0xa007)
|
||||
{
|
||||
chrhigh[A&7]=V;
|
||||
tekvrom();
|
||||
}
|
||||
else if(A>=0xb000 && A<=0xb007)
|
||||
{
|
||||
//printf("$%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();
|
||||
}
|
||||
else if(A>=0xd000 && A<=0xdfff)
|
||||
{
|
||||
tkcom[A&3]=V;
|
||||
tekprom();
|
||||
tekvrom();
|
||||
mira();
|
||||
}
|
||||
else switch(A)
|
||||
{
|
||||
case 0xc000: IRQa=V&1;if(!(V&1)) X6502_IRQEnd(MDFN_IQEXT);break;
|
||||
case 0xc002: IRQa=0;X6502_IRQEnd(MDFN_IQEXT);break;
|
||||
case 0xc003: IRQa=1;break;
|
||||
|
||||
case 0xc001: IRQMode=V;break;
|
||||
case 0xc004: IRQPre=V^IRQXOR;break;
|
||||
case 0xc005: IRQCount=V^IRQXOR;break;
|
||||
case 0xc006: IRQXOR=V;break;
|
||||
case 0xc007: IRQPreSize=V;break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void CCL(void)
|
||||
{
|
||||
if((IRQMode>>6) == 1) // Count Up
|
||||
{
|
||||
IRQCount++;
|
||||
if((IRQCount == 0) && IRQa)
|
||||
X6502_IRQBegin(MDFN_IQEXT);
|
||||
}
|
||||
else if((IRQMode>>6) == 2) // Count down
|
||||
{
|
||||
IRQCount--;
|
||||
if((IRQCount == 0xFF) && IRQa)
|
||||
X6502_IRQBegin(MDFN_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--;
|
||||
//printf("%d\n",IRQPre);
|
||||
if((IRQPre & premask) == premask)
|
||||
CCL();
|
||||
}
|
||||
}
|
||||
|
||||
static void SLWrap(void)
|
||||
{
|
||||
int x;
|
||||
for(x=0;x<8;x++) ClockCounter(); // 8 PPU A10 0->1 transitions per scanline(usually)
|
||||
}
|
||||
/*
|
||||
static uint32 lasta;
|
||||
static void YARGH(uint32 A)
|
||||
{
|
||||
if((A&0x1000) && !(lasta & 0x1000))
|
||||
ClockCounter();
|
||||
|
||||
lasta = A;
|
||||
}
|
||||
*/
|
||||
|
||||
static void togglie(CartInfo *info)
|
||||
{
|
||||
tekker^=0xFF;
|
||||
}
|
||||
|
||||
static void M90Power(CartInfo *info)
|
||||
{
|
||||
mul[0]=mul[1]=regie=0xFF;
|
||||
|
||||
tkcom[0]=tkcom[1]=tkcom[2]=tkcom[3]=0xFF;
|
||||
|
||||
memset(prgb,0xff,sizeof(prgb));
|
||||
memset(chrlow,0xff,sizeof(chrlow));
|
||||
memset(chrhigh,0xff,sizeof(chrhigh));
|
||||
memset(names,0x00,sizeof(names));
|
||||
|
||||
tekker=0;
|
||||
|
||||
prgb[0]=0xFF;
|
||||
prgb[1]=0xFF;
|
||||
prgb[2]=0xFF;
|
||||
prgb[3]=0xFF;
|
||||
tekprom();
|
||||
tekvrom();
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[]={
|
||||
SFVARN(IRQCount, "IRQC"),
|
||||
SFVARN(IRQa, "IRQa"),
|
||||
SFARRAYN(mul, 2, "MUL"),
|
||||
SFVARN(regie, "REGI"),
|
||||
SFARRAYN(tkcom, 4, "TKCO"),
|
||||
SFARRAYN(prgb, 4, "PRGB"),
|
||||
SFARRAYN(chrlow, 4, "CHRL"),
|
||||
SFARRAYN(chrhigh, 8, "CHRH"),
|
||||
SFVARN(names[0], "NMS0"),
|
||||
SFVARN(names[1], "NMS1"),
|
||||
SFVARN(names[2], "NMS2"),
|
||||
SFVARN(names[3], "NMS3"),
|
||||
SFVARN(tekker, "TEKR"),
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
{
|
||||
tekprom();
|
||||
tekvrom();
|
||||
mira();
|
||||
}
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int Mapper90_Init(CartInfo *info)
|
||||
{
|
||||
is209=0;
|
||||
info->Reset=togglie;
|
||||
info->Power=M90Power;
|
||||
//PPU_hook = YARGH;
|
||||
info->StateAction = StateAction;
|
||||
GameHBIRQHook2 = SLWrap;
|
||||
|
||||
SetWriteHandler(0x5000,0xffff,Mapper90_write);
|
||||
SetReadHandler(0x5000,0x5fff,tekread);
|
||||
|
||||
SetReadHandler(0x6000,0xffff,CartBR);
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
||||
int Mapper209_Init(CartInfo *info)
|
||||
{
|
||||
is209=1;
|
||||
info->Reset=togglie;
|
||||
info->Power=M90Power;
|
||||
//PPU_hook = YARGH;
|
||||
GameHBIRQHook2 = SLWrap;
|
||||
info->StateAction = StateAction;
|
||||
|
||||
SetWriteHandler(0x5000,0xffff,Mapper90_write);
|
||||
SetReadHandler(0x5000,0x5fff,tekread);
|
||||
|
||||
SetReadHandler(0x6000,0xffff,CartBR);
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
|
@ -1,80 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
/* Original code provided by LULU */
|
||||
static uint8 PRGBank16, CHRBank8;
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setprg16(0xc000, PRGBank16);
|
||||
setchr8(CHRBank8);
|
||||
}
|
||||
|
||||
static DECLFW(Mapper92_write)
|
||||
{
|
||||
uint8 reg=(A&0xF0)>>4;
|
||||
uint8 bank=A&0xF;
|
||||
|
||||
if(A>=0x9000)
|
||||
{
|
||||
if(reg==0xD) PRGBank16 = bank;
|
||||
else if(reg==0xE) CHRBank8 = bank;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(reg==0xB) PRGBank16 = bank;
|
||||
else if(reg==0x7) CHRBank8 = bank;
|
||||
}
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
PRGBank16 = 0xFF;
|
||||
CHRBank8 = 0;
|
||||
Sync();
|
||||
setprg16(0x8000, 0);
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFVAR(PRGBank16), SFVAR(CHRBank8),
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
Sync();
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int Mapper92_Init(CartInfo *info)
|
||||
{
|
||||
info->Power = Power;
|
||||
info->StateAction = StateAction;
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x8000,0xFFFF,Mapper92_write);
|
||||
return(1);
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
#include "mapinc.h"
|
||||
|
||||
static uint8 latch;
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setmirror((latch & 1) ? MI_H : MI_V);
|
||||
setchr8(latch & 0xF);
|
||||
setprg16(0x8000, (latch >> 4));
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFVAR(latch),
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
Sync();
|
||||
return(ret);
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
latch = 0;
|
||||
setchr8(0);
|
||||
setprg16(0xc000, 0xF);
|
||||
Sync();
|
||||
}
|
||||
|
||||
|
||||
static DECLFW(Write)
|
||||
{
|
||||
latch = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
int Mapper93_Init(CartInfo *info)
|
||||
{
|
||||
SetWriteHandler(0x8000, 0xFFFF, Write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
info->StateAction = StateAction;
|
||||
info->Power = Power;
|
||||
return(1);
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
#include "mapinc.h"
|
||||
|
||||
static uint8 latch;
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setprg16(0x8000, latch >> 2);
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFVAR(latch),
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
Sync();
|
||||
return(ret);
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
latch = 0;
|
||||
setchr8(0);
|
||||
setprg16(0xc000, 0x3F);
|
||||
Sync();
|
||||
}
|
||||
|
||||
|
||||
static DECLFW(Write)
|
||||
{
|
||||
latch = V & CartBR(A);
|
||||
Sync();
|
||||
}
|
||||
|
||||
int Mapper94_Init(CartInfo *info)
|
||||
{
|
||||
SetWriteHandler(0x8000, 0xFFFF, Write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
info->StateAction = StateAction;
|
||||
info->Power = Power;
|
||||
return(1);
|
||||
}
|
|
@ -1,146 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 lastA;
|
||||
static uint8 DRegs[8];
|
||||
static uint8 cmd;
|
||||
static uint8 MirCache[8];
|
||||
static int32 lastmc;
|
||||
|
||||
static void dragonbust_ppu(uint32 A)
|
||||
{
|
||||
static uint8 z;
|
||||
|
||||
if(A>=0x2000) return;
|
||||
|
||||
A>>=10;
|
||||
|
||||
lastA=A;
|
||||
|
||||
z=MirCache[A];
|
||||
if(z!=lastmc)
|
||||
{
|
||||
setmirror(z?MI_1:MI_0);
|
||||
lastmc = z;
|
||||
}
|
||||
}
|
||||
|
||||
static void toot(void)
|
||||
{
|
||||
int x;
|
||||
|
||||
MirCache[0]=MirCache[1]=(DRegs[0]>>4)&1;
|
||||
MirCache[2]=MirCache[3]=(DRegs[1]>>4)&1;
|
||||
|
||||
for(x=0;x<4;x++)
|
||||
MirCache[4+x]=(DRegs[2+x]>>5)&1;
|
||||
setmirror(MirCache[lastA]?MI_1:MI_0);
|
||||
}
|
||||
|
||||
static DECLFW(Mapper95_write)
|
||||
{
|
||||
switch(A&0xF001)
|
||||
{
|
||||
|
||||
case 0x8000:
|
||||
cmd = V;
|
||||
break;
|
||||
|
||||
case 0x8001:
|
||||
switch(cmd&0x07)
|
||||
{
|
||||
case 0: DRegs[0]=(V&0x3F)>>1;toot();V>>=1;setchr2(0x0000,V&0x1F);break;
|
||||
case 1: DRegs[1]=(V&0x3F)>>1;toot();V>>=1;setchr2(0x0800,V&0x1F);break;
|
||||
case 2: DRegs[2]=V&0x3F;toot();setchr1(0x1000,V&0x1F); break;
|
||||
case 3: DRegs[3]=V&0x3F;toot();setchr1(0x1400,V&0x1F); break;
|
||||
case 4: DRegs[4]=V&0x3F;toot();setchr1(0x1800,V&0x1F); break;
|
||||
case 5: DRegs[5]=V&0x3F;toot();setchr1(0x1C00,V&0x1F); break;
|
||||
case 6: DRegs[6]=V&0x3F;
|
||||
setprg8(0x8000,V);
|
||||
break;
|
||||
case 7: DRegs[7]=V&0x3F;
|
||||
setprg8(0xA000,V);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void DBSync()
|
||||
{
|
||||
int x;
|
||||
|
||||
setchr2(0x0000,DRegs[0]);
|
||||
setchr2(0x0800,DRegs[1]);
|
||||
|
||||
for(x=0;x<4;x++)
|
||||
setchr1(0x1000+x*0x400,DRegs[2+x]);
|
||||
|
||||
setprg8(0x8000,DRegs[6]);
|
||||
setprg8(0xa000,DRegs[7]);
|
||||
toot();
|
||||
}
|
||||
|
||||
static void DBPower(CartInfo *info)
|
||||
{
|
||||
lastmc = -1;
|
||||
|
||||
memset(DRegs,0x3F,8);
|
||||
DRegs[0]=DRegs[1]=0x1F;
|
||||
|
||||
DBSync();
|
||||
|
||||
setprg8(0xc000,0x3E);
|
||||
setprg8(0xe000,0x3F);
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[]={
|
||||
SFARRAYN(DRegs, 8, "DREG"),
|
||||
SFVARN(cmd, "CMD"),
|
||||
SFVARN(lastA, "LAST"),
|
||||
SFVAR(lastmc),
|
||||
SFEND
|
||||
};
|
||||
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
|
||||
if(load)
|
||||
DBSync();
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int Mapper95_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=DBPower;
|
||||
info->StateAction = StateAction;
|
||||
PPU_hook = dragonbust_ppu;
|
||||
|
||||
SetReadHandler(0x8000,0xffff,CartBR);
|
||||
SetWriteHandler(0x8000,0xffff,Mapper95_write);
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
|
@ -1,81 +0,0 @@
|
|||
#include "mapinc.h"
|
||||
|
||||
/* I might want to add some code to the mapper 96 PPU hook function
|
||||
to not change CHR banks if the attribute table is being accessed,
|
||||
if I make emulation a little more accurate in the future.
|
||||
*/
|
||||
static uint8 latche;
|
||||
static uint8 M96LA;
|
||||
static uint8 *M96_CHR = NULL;
|
||||
|
||||
static DECLFW(Mapper96_write)
|
||||
{
|
||||
latche=V;
|
||||
setprg32(0x8000,V&3);
|
||||
setchr4r(0x10,0x0000,(latche&4)|M96LA);
|
||||
setchr4r(0x10,0x1000,(latche&4)|3);
|
||||
}
|
||||
|
||||
static void M96Hook(uint32 A)
|
||||
{
|
||||
if((A&0x3000)!=0x2000) return;
|
||||
//if((A&0x3ff)>=0x3c0) return;
|
||||
M96LA=(A>>8)&3;
|
||||
setchr4r(0x10,0x0000,(latche&4)|M96LA);
|
||||
}
|
||||
|
||||
static void M96Sync(void)
|
||||
{
|
||||
setprg32(0x8000,latche&3);
|
||||
setchr4r(0x10,0x0000,(latche&4)|M96LA);
|
||||
setchr4r(0x10,0x1000,(latche&4)|3);
|
||||
}
|
||||
|
||||
static int M96_StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[]=
|
||||
{
|
||||
SFVARN(latche, "LATC"),
|
||||
SFVARN(M96LA, "LAVA"),
|
||||
SFEND
|
||||
};
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
|
||||
if(load)
|
||||
M96Sync();
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
static void Mapper96_Close(void)
|
||||
{
|
||||
if(M96_CHR)
|
||||
free(M96_CHR);
|
||||
M96_CHR = NULL;
|
||||
}
|
||||
|
||||
static void Mapper96_Reset(CartInfo *info)
|
||||
{
|
||||
latche = 0;
|
||||
M96LA = 0;
|
||||
M96Sync();
|
||||
}
|
||||
|
||||
int Mapper96_Init(CartInfo *info)
|
||||
{
|
||||
if(!(M96_CHR = (uint8 *)malloc(32768)))
|
||||
return(0);
|
||||
|
||||
SetWriteHandler(0x8000, 0xffff, Mapper96_write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
PPU_hook = M96Hook;
|
||||
info->StateAction = M96_StateAction;
|
||||
info->Close = Mapper96_Close;
|
||||
info->Power = Mapper96_Reset;
|
||||
SetupCartCHRMapping(0x10, M96_CHR, 32768, 1);
|
||||
latche=M96LA=0;
|
||||
setmirror(MI_0);
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
|
@ -1,80 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 latch;
|
||||
static void Sync(void)
|
||||
{
|
||||
setprg16(0xC000, latch & 0xF);
|
||||
|
||||
/*
|
||||
switch(V>>6)
|
||||
{
|
||||
case 0:break;
|
||||
case 1:MIRROR_SET2(0);break;
|
||||
case 2:MIRROR_SET2(1);break;
|
||||
case 3:break;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
static DECLFW(Mapper97_write)
|
||||
{
|
||||
latch = V;
|
||||
switch(V>>6)
|
||||
{
|
||||
case 0:break;
|
||||
case 1:setmirror(MI_H);break;
|
||||
case 2:setmirror(MI_V);break;
|
||||
case 3:break;
|
||||
}
|
||||
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
setprg16(0x8000, 0xF);
|
||||
setchr8(0);
|
||||
latch = 0xFF;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{ SFVAR(latch), SFEND };
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
Sync();
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int Mapper97_Init(CartInfo *info)
|
||||
{
|
||||
info->Power = Power;
|
||||
info->StateAction = StateAction;
|
||||
SetWriteHandler(0x8000,0xffff,Mapper97_write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
return(1);
|
||||
}
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 latch;
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setchr8((latch >> 2) & 1);
|
||||
setprg8(0x8000, latch & 0x4);
|
||||
}
|
||||
|
||||
static DECLFW(Write)
|
||||
{
|
||||
latch = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
setprg32(0x8000, 0);
|
||||
|
||||
latch = 0;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFVAR(latch),
|
||||
SFEND
|
||||
};
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
Sync();
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int Mapper99_Init(CartInfo *info)
|
||||
{
|
||||
info->Power = Power;
|
||||
info->StateAction = StateAction;
|
||||
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x4016, 0x4016, Write); // Warning: relies on kludge in input.cpp
|
||||
|
||||
return(1);
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
mednafen_SOURCES += boards/8237.cpp boards/h2288.cpp boards/simple.cpp boards/super24.cpp boards/mmc2and4.cpp boards/vrc6.cpp boards/emu2413.cpp boards/vrc7.cpp boards/96.cpp boards/208.cpp boards/187.cpp boards/95.cpp boards/fme7.cpp boards/mmc5.cpp boards/mmc3.cpp boards/mmc1.cpp boards/tengen.cpp boards/90.cpp boards/deirom.cpp boards/n106.cpp boards/maxicart.cpp
|
||||
mednafen_SOURCES += boards/112.cpp boards/113.cpp boards/114.cpp boards/117.cpp boards/22.cpp boards/23.cpp boards/25.cpp boards/67.cpp boards/68.cpp boards/16.cpp boards/97.cpp boards/99.cpp boards/151.cpp boards/180.cpp boards/182.cpp boards/184.cpp
|
||||
mednafen_SOURCES += boards/88.cpp boards/89.cpp boards/92.cpp boards/86.cpp boards/82.cpp boards/80.cpp boards/18.cpp boards/21.cpp boards/228.cpp boards/234.cpp boards/232.cpp
|
||||
mednafen_SOURCES += boards/42.cpp boards/ffe.cpp boards/65.cpp boards/nina06.cpp boards/73.cpp boards/32.cpp boards/33.cpp boards/41.cpp boards/46.cpp boards/72.cpp boards/75.cpp boards/76.cpp boards/77.cpp boards/colordreams.cpp
|
||||
mednafen_SOURCES += boards/140.cpp boards/93.cpp boards/94.cpp boards/malee.cpp boards/156.cpp boards/supervision.cpp boards/novel.cpp boards/242.cpp boards/246.cpp boards/248.cpp boards/15.cpp boards/8.cpp boards/193.cpp boards/189.cpp
|
||||
mednafen_SOURCES += boards/244.cpp boards/sachen.cpp boards/107.cpp boards/51.cpp boards/152.cpp boards/70.cpp boards/185.cpp boards/78.cpp boards/87.cpp boards/34.cpp boards/222.cpp boards/codemasters.cpp boards/38.cpp
|
||||
|
||||
mednafen_SOURCES += boards/240.cpp boards/241.cpp boards/163.cpp
|
|
@ -1,94 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 PRGBank16, Mirroring;
|
||||
static int isbf9097;
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setprg16(0x8000, PRGBank16 & 0xF);
|
||||
if(isbf9097)
|
||||
setmirror(Mirroring?MI_1:MI_0);
|
||||
}
|
||||
|
||||
static DECLFW(WriteHi)
|
||||
{
|
||||
PRGBank16 = V;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(WriteLo)
|
||||
{
|
||||
Mirroring = (V >> 4) & 1;
|
||||
Sync();
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
Mirroring = 0;
|
||||
PRGBank16 = 0;
|
||||
Sync();
|
||||
setchr8(0);
|
||||
setprg16(0xc000, 0xF);
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFVAR(PRGBank16),
|
||||
SFVAR(Mirroring), // Only for firehawk, though
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
|
||||
if(load)
|
||||
Sync();
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int Mapper71_Init(CartInfo *info)
|
||||
{
|
||||
info->Power = Power;
|
||||
info->StateAction = StateAction;
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||
SetWriteHandler(0xC000, 0xFFFF, WriteHi);
|
||||
|
||||
isbf9097 = 0;
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
||||
int BIC62_Init(CartInfo *info)
|
||||
{
|
||||
Mapper71_Init(info);
|
||||
|
||||
SetWriteHandler(0x8000, 0xBFFF, WriteLo);
|
||||
isbf9097 = 1;
|
||||
PRGmask16[0] &= 0x7;
|
||||
return(1);
|
||||
}
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
#include "mapinc.h"
|
||||
|
||||
static uint8 latch;
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
setprg32(0x8000, latch & 3);
|
||||
setchr8((latch >> 4) & 0xF);
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFVAR(latch),
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
Sync();
|
||||
return(ret);
|
||||
}
|
||||
|
||||
static void Power(CartInfo *info)
|
||||
{
|
||||
latch = 0;
|
||||
Sync();
|
||||
}
|
||||
|
||||
|
||||
static DECLFW(Write)
|
||||
{
|
||||
latch = V & CartBR(A);
|
||||
Sync();
|
||||
}
|
||||
|
||||
static DECLFW(Write50282)
|
||||
{
|
||||
latch = (V & 0xFE & CartBR(A)) | (CartBR(A) & 1);
|
||||
Sync();
|
||||
}
|
||||
|
||||
int Mapper11_Init(CartInfo *info)
|
||||
{
|
||||
SetWriteHandler(0x8000, 0xFFFF, Write);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
info->StateAction = StateAction;
|
||||
info->Power = Power;
|
||||
return(1);
|
||||
}
|
||||
|
||||
int AGCI50282_Init(CartInfo *info)
|
||||
{
|
||||
SetWriteHandler(0x8000, 0xFFFF, Write50282);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
info->StateAction = StateAction;
|
||||
info->Power = Power;
|
||||
return(1);
|
||||
}
|
|
@ -1,89 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 cmd;
|
||||
static uint8 DRegs[8];
|
||||
|
||||
static void Sync(void)
|
||||
{
|
||||
int x;
|
||||
|
||||
setchr2(0x0000,DRegs[0]);
|
||||
setchr2(0x0800,DRegs[1]);
|
||||
for(x=0;x<4;x++)
|
||||
setchr1(0x1000+(x<<10),DRegs[2+x]);
|
||||
setprg8(0x8000,DRegs[6]);
|
||||
setprg8(0xa000,DRegs[7]);
|
||||
}
|
||||
|
||||
static DECLFW(DEIWrite)
|
||||
{
|
||||
switch(A&0x8001)
|
||||
{
|
||||
case 0x8000:cmd=V&0x07;break;
|
||||
case 0x8001:if(cmd<=0x05) V&=0x3F;
|
||||
else V&=0x0F;
|
||||
if(cmd<=0x01) V>>=1;
|
||||
DRegs[cmd&0x07]=V;
|
||||
Sync();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void DEIPower(CartInfo *info)
|
||||
{
|
||||
setprg8(0xc000,0xE);
|
||||
setprg8(0xe000,0xF);
|
||||
cmd=0;
|
||||
memset(DRegs,0,8);
|
||||
Sync();
|
||||
}
|
||||
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[]=
|
||||
{
|
||||
SFVAR(cmd),
|
||||
SFARRAY(DRegs, 8),
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
Sync();
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int DEIROM_Init(CartInfo *info)
|
||||
{
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
SetWriteHandler(0x8000,0xFFFF,DEIWrite);
|
||||
info->Power=DEIPower;
|
||||
info->StateAction = StateAction;
|
||||
return(1);
|
||||
}
|
||||
|
||||
int Mapper206_Init(CartInfo *info)
|
||||
{
|
||||
return(DEIROM_Init(info));
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,207 +0,0 @@
|
|||
#ifndef _EMU2413_H_
|
||||
#define _EMU2413_H_
|
||||
|
||||
#include "emutypes.h"
|
||||
|
||||
/* Size of Sintable ( 8 -- 18 can be used. 9 recommended.)*/
|
||||
#define PG_BITS 9
|
||||
#define PG_WIDTH (1<<PG_BITS)
|
||||
|
||||
/* Phase increment counter */
|
||||
#define DP_BITS 18
|
||||
#define DP_WIDTH (1<<DP_BITS)
|
||||
#define DP_BASE_BITS (DP_BITS - PG_BITS)
|
||||
|
||||
/* Dynamic range (Accuracy of sin table) */
|
||||
#define DB_BITS 8
|
||||
#define DB_STEP (48.0/(1<<DB_BITS))
|
||||
#define DB_MUTE (1<<DB_BITS)
|
||||
|
||||
/* Dynamic range of envelope */
|
||||
#define EG_STEP 0.375
|
||||
#define EG_BITS 7
|
||||
#define EG_MUTE (1<<EG_BITS)
|
||||
|
||||
/* Dynamic range of total level */
|
||||
#define TL_STEP 0.75
|
||||
#define TL_BITS 6
|
||||
#define TL_MUTE (1<<TL_BITS)
|
||||
|
||||
/* Dynamic range of sustine level */
|
||||
#define SL_STEP 3.0
|
||||
#define SL_BITS 4
|
||||
#define SL_MUTE (1<<SL_BITS)
|
||||
|
||||
|
||||
/* Bits for Pitch and Amp modulator */
|
||||
#define PM_PG_BITS 8
|
||||
#define PM_PG_WIDTH (1<<PM_PG_BITS)
|
||||
#define PM_DP_BITS 16
|
||||
#define PM_DP_WIDTH (1<<PM_DP_BITS)
|
||||
#define AM_PG_BITS 8
|
||||
#define AM_PG_WIDTH (1<<AM_PG_BITS)
|
||||
#define AM_DP_BITS 16
|
||||
#define AM_DP_WIDTH (1<<AM_DP_BITS)
|
||||
|
||||
|
||||
#ifdef EMU2413_DLL_EXPORTS
|
||||
#define EMU2413_API __declspec(dllexport)
|
||||
#elif defined(EMU2413_DLL_IMPORTS)
|
||||
#define EMU2413_API __declspec(dllimport)
|
||||
#else
|
||||
#define EMU2413_API
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define PI 3.14159265358979323846
|
||||
|
||||
enum {OPLL_VRC7_TONE=0} ;
|
||||
|
||||
/* voice data */
|
||||
typedef struct {
|
||||
e_uint32 TL,FB,EG,ML,AR,DR,SL,RR,KR,KL,AM,PM,WF ;
|
||||
} OPLL_PATCH ;
|
||||
|
||||
/* slot */
|
||||
typedef struct {
|
||||
|
||||
OPLL_PATCH patch;
|
||||
|
||||
e_int32 type ; /* 0 : modulator 1 : carrier */
|
||||
|
||||
/* OUTPUT */
|
||||
e_int32 feedback ;
|
||||
e_int32 output[2] ; /* Output value of slot */
|
||||
|
||||
/* for Phase Generator (PG) */
|
||||
e_uint16 *sintbl ; /* Wavetable */
|
||||
e_uint32 phase ; /* Phase */
|
||||
e_uint32 dphase ; /* Phase increment amount */
|
||||
e_uint32 pgout ; /* output */
|
||||
|
||||
/* for Envelope Generator (EG) */
|
||||
e_int32 fnum ; /* F-Number */
|
||||
e_int32 block ; /* Block */
|
||||
e_int32 volume ; /* Current volume */
|
||||
e_int32 sustine ; /* Sustine 1 = ON, 0 = OFF */
|
||||
e_uint32 tll ; /* Total Level + Key scale level*/
|
||||
e_uint32 rks ; /* Key scale offset (Rks) */
|
||||
e_int32 eg_mode ; /* Current state */
|
||||
e_uint32 eg_phase ; /* Phase */
|
||||
e_uint32 eg_dphase ; /* Phase increment amount */
|
||||
e_uint32 egout ; /* output */
|
||||
|
||||
} OPLL_SLOT ;
|
||||
|
||||
/* Mask */
|
||||
#define OPLL_MASK_CH(x) (1<<(x))
|
||||
|
||||
/* opll */
|
||||
typedef struct {
|
||||
|
||||
e_uint32 adr ;
|
||||
e_int32 out ;
|
||||
|
||||
#ifndef EMU2413_COMPACTION
|
||||
e_uint32 realstep ;
|
||||
e_uint32 oplltime ;
|
||||
e_uint32 opllstep ;
|
||||
e_int32 prev, next ;
|
||||
#endif
|
||||
|
||||
/* Register */
|
||||
e_uint8 LowFreq[6];
|
||||
e_uint8 HiFreq[6];
|
||||
e_uint8 InstVol[6];
|
||||
|
||||
e_uint8 CustInst[8];
|
||||
|
||||
e_int32 slot_on_flag[6 * 2] ;
|
||||
|
||||
/* Pitch Modulator */
|
||||
e_uint32 pm_phase ;
|
||||
e_int32 lfo_pm ;
|
||||
|
||||
/* Amp Modulator */
|
||||
e_int32 am_phase ;
|
||||
e_int32 lfo_am ;
|
||||
|
||||
e_uint32 quality;
|
||||
|
||||
/* Channel Data */
|
||||
e_int32 patch_number[6];
|
||||
e_int32 key_status[6] ;
|
||||
|
||||
/* Slot */
|
||||
OPLL_SLOT slot[6 * 2] ;
|
||||
|
||||
e_uint32 mask ;
|
||||
|
||||
/* Input clock */
|
||||
e_uint32 clk;
|
||||
|
||||
/* WaveTable for each envelope amp */
|
||||
e_uint16 fullsintable[PG_WIDTH];
|
||||
e_uint16 halfsintable[PG_WIDTH];
|
||||
|
||||
e_uint16 *waveform[2];
|
||||
|
||||
/* LFO Table */
|
||||
e_int32 pmtable[PM_PG_WIDTH];
|
||||
e_int32 amtable[AM_PG_WIDTH];
|
||||
|
||||
/* Phase delta for LFO */
|
||||
e_uint32 pm_dphase;
|
||||
e_uint32 am_dphase;
|
||||
|
||||
/* dB to Liner table */
|
||||
e_int16 DB2LIN_TABLE[(DB_MUTE + DB_MUTE) * 2];
|
||||
|
||||
/* Liner to Log curve conversion table (for Attack rate). */
|
||||
e_uint16 AR_ADJUST_TABLE[1 << EG_BITS];
|
||||
|
||||
/* Phase incr table for Attack */
|
||||
e_uint32 dphaseARTable[16][16];
|
||||
|
||||
/* Phase incr table for Decay and Release */
|
||||
e_uint32 dphaseDRTable[16][16];
|
||||
|
||||
/* KSL + TL Table */
|
||||
e_uint32 tllTable[16][8][1 << TL_BITS][4];
|
||||
e_int32 rksTable[2][8][2];
|
||||
|
||||
/* Phase incr table for PG */
|
||||
e_uint32 dphaseTable[512][8][16];
|
||||
} OPLL ;
|
||||
|
||||
/* Create Object */
|
||||
EMU2413_API OPLL *OPLL_new(e_uint32 clk) ;
|
||||
EMU2413_API void OPLL_delete(OPLL *) ;
|
||||
|
||||
/* Setup */
|
||||
EMU2413_API void OPLL_reset(OPLL *) ;
|
||||
EMU2413_API void OPLL_set_rate(OPLL *opll, e_uint32 r) ;
|
||||
EMU2413_API void OPLL_set_quality(OPLL *opll, e_uint32 q) ;
|
||||
|
||||
/* Port/Register access */
|
||||
EMU2413_API void OPLL_writeIO(OPLL *, e_uint32 reg, e_uint32 val) ;
|
||||
EMU2413_API void OPLL_writeReg(OPLL *, e_uint32 reg, e_uint32 val) ;
|
||||
|
||||
/* Synthsize */
|
||||
EMU2413_API e_int16 OPLL_calc(OPLL *) ;
|
||||
|
||||
/* Misc */
|
||||
EMU2413_API void OPLL_forceRefresh(OPLL *) ;
|
||||
|
||||
/* Channel Mask */
|
||||
EMU2413_API e_uint32 OPLL_setMask(OPLL *, e_uint32 mask) ;
|
||||
EMU2413_API e_uint32 OPLL_toggleMask(OPLL *, e_uint32 mask) ;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,44 +0,0 @@
|
|||
#ifndef _EMUTYPES_H_
|
||||
#define _EMUTYPES_H_
|
||||
|
||||
#ifndef INLINE
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define INLINE __forceinline
|
||||
#elif defined(__GNUC__)
|
||||
#define INLINE __inline__ __attribute__((always_inline))
|
||||
#elif defined(_MWERKS_)
|
||||
#define INLINE inline
|
||||
#else
|
||||
#define INLINE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(EMU_DLL_IMPORTS)
|
||||
#define EMU2149_DLL_IMPORTS
|
||||
#define EMU2212_DLL_IMPORTS
|
||||
#define EMU2413_DLL_IMPORTS
|
||||
#define EMU8950_DLL_IMPORTS
|
||||
#define EMU76489_DLL_IMPORTS
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef unsigned int e_uint;
|
||||
typedef signed int e_int;
|
||||
|
||||
typedef unsigned char e_uint8 ;
|
||||
typedef signed char e_int8 ;
|
||||
|
||||
typedef unsigned short e_uint16 ;
|
||||
typedef signed short e_int16 ;
|
||||
|
||||
typedef unsigned int e_uint32 ;
|
||||
typedef signed int e_int32 ;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
|
@ -1,187 +0,0 @@
|
|||
#include "mapinc.h"
|
||||
|
||||
static uint8 IRQa, MirRegs[2], latch, CHRBanks[8], PRGBanks[4], MirSelect, ModeSelect;
|
||||
static uint16 IRQCount;
|
||||
static uint8 WRAM[8192];
|
||||
|
||||
static void FFEIRQHook(int a)
|
||||
{
|
||||
if(IRQa)
|
||||
{
|
||||
if(0)
|
||||
{
|
||||
uint16 last = IRQCount;
|
||||
IRQCount -= a;
|
||||
if(IRQCount > last)
|
||||
{
|
||||
X6502_IRQBegin(MDFN_IQEXT);
|
||||
IRQa=0;
|
||||
IRQCount=0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
uint16 last = IRQCount;
|
||||
IRQCount+=a;
|
||||
if(IRQCount < last)
|
||||
{
|
||||
X6502_IRQBegin(MDFN_IQEXT);
|
||||
IRQa=0;
|
||||
IRQCount=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void DoMirroring(void)
|
||||
{
|
||||
if(!MirSelect)
|
||||
setmirror(((MirRegs[0] >> 4) & 1) ? MI_1 : MI_0);
|
||||
else
|
||||
setmirror(((MirRegs[1] >> 4) & 1) ? MI_H : MI_V);
|
||||
}
|
||||
|
||||
static void DoPRG(void)
|
||||
{
|
||||
if(!ModeSelect)
|
||||
{
|
||||
for(int x = 0; x < 4; x++)
|
||||
setprg8(0x8000 + x * 8192, PRGBanks[x]);
|
||||
}
|
||||
else
|
||||
{
|
||||
setprg16(0x8000, (latch >> 2) & 0x3F);
|
||||
setprg16(0xc000, 0x7);
|
||||
}
|
||||
}
|
||||
|
||||
static void DoCHR(void)
|
||||
{
|
||||
if(!ModeSelect)
|
||||
{
|
||||
for(int x = 0; x < 8; x++)
|
||||
setchr1(x * 1024, CHRBanks[x]);
|
||||
}
|
||||
else
|
||||
{
|
||||
setchr8(latch & 3);
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFW(Mapper6_write)
|
||||
{
|
||||
if(A >= 0x4500 && A <= 0x4503)
|
||||
printf("%04x: %02x\n", A, V);
|
||||
if(A < 0x8000)
|
||||
{
|
||||
switch(A)
|
||||
{
|
||||
default: printf("Oops: %04x : %02x\n", A, V);break;
|
||||
case 0x42FE: MirSelect = 0; MirRegs[0] = V; DoMirroring(); break;
|
||||
case 0x42FF: MirSelect = 1; MirRegs[1] = V; DoMirroring(); break;
|
||||
case 0x4501: IRQa = V & 1; X6502_IRQEnd(MDFN_IQEXT); break;
|
||||
case 0x4502: IRQCount &= 0xFF00; IRQCount |= V; X6502_IRQEnd(MDFN_IQEXT); break;
|
||||
case 0x4503: IRQCount &= 0x00FF; IRQCount |= V << 8; IRQa = 1; X6502_IRQEnd(MDFN_IQEXT); break;
|
||||
case 0x4504: PRGBanks[0] = V; DoPRG(); break;
|
||||
case 0x4505: PRGBanks[1] = V; DoPRG(); break;
|
||||
case 0x4506: PRGBanks[2] = V; DoPRG(); break;
|
||||
case 0x4507: PRGBanks[3] = V; DoPRG(); break;
|
||||
case 0x4510: CHRBanks[0] = V; DoCHR(); break;
|
||||
case 0x4511: CHRBanks[1] = V; DoCHR(); break;
|
||||
case 0x4512: CHRBanks[2] = V; DoCHR(); break;
|
||||
case 0x4513: CHRBanks[3] = V; DoCHR(); break;
|
||||
case 0x4514: CHRBanks[4] = V; DoCHR(); break;
|
||||
case 0x4515: CHRBanks[5] = V; DoCHR(); break;
|
||||
case 0x4516: CHRBanks[6] = V; DoCHR(); break;
|
||||
case 0x4517: CHRBanks[7] = V; DoCHR(); break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
latch = V;
|
||||
DoPRG();
|
||||
DoCHR();
|
||||
}
|
||||
}
|
||||
|
||||
static void Reset(CartInfo *info)
|
||||
{
|
||||
int x;
|
||||
|
||||
if(!info->battery)
|
||||
memset(WRAM, 0x00, 8192);
|
||||
|
||||
latch = 0;
|
||||
MirRegs[0] = 0x00;
|
||||
MirRegs[1] = 0x00 | (((info->mirror & 1) << 4) ^ 0x10);
|
||||
MirSelect = 1;
|
||||
DoMirroring();
|
||||
|
||||
for(x = 0; x < 8; x++)
|
||||
CHRBanks[x] = x;
|
||||
PRGBanks[0] = 0;
|
||||
PRGBanks[1] = 1;
|
||||
PRGBanks[2] = 0xFE;
|
||||
PRGBanks[3] = 0xFF;
|
||||
DoPRG();
|
||||
DoCHR();
|
||||
|
||||
setprg8r(0x10, 0x6000, 0);
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFARRAY(WRAM, 8192),
|
||||
SFARRAY(CHRBanks, 8),
|
||||
SFARRAY(PRGBanks, 4),
|
||||
SFARRAY(MirRegs, 2),
|
||||
SFVAR(MirSelect),
|
||||
SFVAR(latch),
|
||||
SFVAR(IRQCount),
|
||||
SFVAR(IRQa),
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
|
||||
if(load)
|
||||
{
|
||||
DoCHR();
|
||||
DoPRG();
|
||||
DoMirroring();
|
||||
}
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int Mapper6_Init(CartInfo *info)
|
||||
{
|
||||
ModeSelect = 1;
|
||||
MapIRQHook = FFEIRQHook;
|
||||
info->Power = info->Reset = Reset;
|
||||
|
||||
SetWriteHandler(0x4020,0x5fff,Mapper6_write);
|
||||
SetWriteHandler(0x8000,0xffff,Mapper6_write);
|
||||
SetReadHandler(0x6000, 0xFFFF, CartBR);
|
||||
SetWriteHandler(0x6000, 0x7FFF, CartBW);
|
||||
SetupCartPRGMapping(0x10, WRAM, 8192, 1);
|
||||
|
||||
if(info->battery)
|
||||
{
|
||||
memset(WRAM, 0x00, 8192);
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = 8192;
|
||||
}
|
||||
|
||||
info->StateAction = StateAction;
|
||||
return(1);
|
||||
}
|
||||
|
||||
int Mapper17_Init(CartInfo *info)
|
||||
{
|
||||
Mapper6_Init(info);
|
||||
ModeSelect = 0;
|
||||
return(1);
|
||||
}
|
|
@ -1,289 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
#include "../nsf.h"
|
||||
#include <math.h>
|
||||
|
||||
static uint8 WRAM[8192];
|
||||
static void AYSoundHQ(void);
|
||||
static void DoAYSQHQ(int x);
|
||||
|
||||
static uint16 IRQCount;
|
||||
static uint8 IRQa;
|
||||
static uint8 PRGRegs[3];
|
||||
static uint8 Mirroring;
|
||||
|
||||
static uint8 reg_select;
|
||||
static uint8 wram_control;
|
||||
static int32 amp_lut[0x10];
|
||||
static uint8 sr[0x10];
|
||||
static uint8 sr_index;
|
||||
|
||||
static int32 vcount[3];
|
||||
static uint32 dcount[3];
|
||||
static uint32 CAYBC[3];
|
||||
|
||||
|
||||
static DECLFW(SUN5BWRAM)
|
||||
{
|
||||
if((wram_control&0xC0)==0xC0)
|
||||
(WRAM-0x6000)[A]=V;
|
||||
}
|
||||
|
||||
static DECLFR(SUN5AWRAM)
|
||||
{
|
||||
if((wram_control&0xC0)==0x40)
|
||||
return X.DB;
|
||||
return CartBR(A);
|
||||
}
|
||||
|
||||
static void SyncPRG(void)
|
||||
{
|
||||
if(wram_control&0x40)
|
||||
{
|
||||
if(wram_control&0x80) // Select WRAM
|
||||
setprg8r(0x10,0x6000,0);
|
||||
}
|
||||
else
|
||||
setprg8(0x6000,wram_control);
|
||||
|
||||
setprg8(0x8000, PRGRegs[0]);
|
||||
setprg8(0xa000, PRGRegs[1]);
|
||||
setprg8(0xc000, PRGRegs[2]);
|
||||
}
|
||||
|
||||
static void SyncMirroring(void)
|
||||
{
|
||||
switch(Mirroring&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(Mapper69_SWL)
|
||||
{
|
||||
sr_index= V & 0xF;
|
||||
}
|
||||
|
||||
static DECLFW(Mapper69_SWH)
|
||||
{
|
||||
int x;
|
||||
|
||||
switch(sr_index)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
case 8:DoAYSQHQ(0);break;
|
||||
case 2:
|
||||
case 3:
|
||||
case 9:DoAYSQHQ(1);;break;
|
||||
case 4:
|
||||
case 5:
|
||||
case 10:DoAYSQHQ(2);break;
|
||||
case 7:
|
||||
for(x=0;x<2;x++)
|
||||
DoAYSQHQ(x);
|
||||
break;
|
||||
}
|
||||
sr[sr_index]=V;
|
||||
}
|
||||
|
||||
static DECLFW(Mapper69_write)
|
||||
{
|
||||
switch(A&0xE000)
|
||||
{
|
||||
case 0x8000:reg_select=V;break;
|
||||
case 0xa000:
|
||||
reg_select&=0xF;
|
||||
if(reg_select < 8)
|
||||
setchr1(reg_select<<10,V);
|
||||
else
|
||||
switch(reg_select&0x0f)
|
||||
{
|
||||
case 0x8: wram_control = V; SyncPRG(); break;
|
||||
case 0x9: PRGRegs[0] = V & 0x3F; SyncPRG(); break;
|
||||
case 0xa: PRGRegs[1] = V & 0x3F; SyncPRG(); break;
|
||||
case 0xb: PRGRegs[2] = V & 0x3F; SyncPRG(); break;
|
||||
case 0xc: Mirroring = V & 0x3; SyncMirroring(); break;
|
||||
|
||||
case 0xd:IRQa=V; if(!(V&0x80)) X6502_IRQEnd(MDFN_IQEXT); break;
|
||||
case 0xe:IRQCount&=0xFF00;IRQCount|=V;break;
|
||||
case 0xf:IRQCount&=0x00FF;IRQCount|=V<<8;break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void DoAYSQHQ(int x)
|
||||
{
|
||||
const int32 period = sr[x * 2] | ((sr[(x * 2) + 1] & 0xF) << 8);
|
||||
const int32 amp = amp_lut[(sr[0x8 + x] & 0xF)];
|
||||
uint32 V;
|
||||
|
||||
if(!(sr[0x7]&(1<<x)))
|
||||
{
|
||||
for(V=CAYBC[x];V<SOUNDTS;V++)
|
||||
{
|
||||
if(dcount[x] & 0x10)
|
||||
WaveHiEx[V] += amp;
|
||||
|
||||
vcount[x]++;
|
||||
if(vcount[x] >= period)
|
||||
{
|
||||
dcount[x] = (dcount[x] + 1) & 0x1F;
|
||||
vcount[x] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
CAYBC[x]=SOUNDTS;
|
||||
}
|
||||
|
||||
static void AYSoundHQ(void)
|
||||
{
|
||||
DoAYSQHQ(0);
|
||||
DoAYSQHQ(1);
|
||||
DoAYSQHQ(2);
|
||||
}
|
||||
|
||||
static void AYHiSync(int32 ts)
|
||||
{
|
||||
int x;
|
||||
|
||||
for(x=0;x<3;x++)
|
||||
CAYBC[x]=ts;
|
||||
}
|
||||
|
||||
static void SunIRQHook(int a)
|
||||
{
|
||||
if(IRQa & 1)
|
||||
{
|
||||
uint16 prev = IRQCount;
|
||||
|
||||
IRQCount-=a;
|
||||
|
||||
if(IRQCount > prev && (IRQa & 0x80))
|
||||
{
|
||||
X6502_IRQBegin(MDFN_IQEXT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] = {
|
||||
SFVARN(reg_select, "FM7S"),
|
||||
SFVARN(wram_control, "FM7W"),
|
||||
SFARRAYN(sr, 0x10, "FM7SR"),
|
||||
SFVARN(sr_index, "FM7I"),
|
||||
SFARRAY(PRGRegs, 3),
|
||||
SFVAR(Mirroring),
|
||||
SFARRAY32(vcount, 3),
|
||||
SFARRAY32(dcount, 3),
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
|
||||
if(load)
|
||||
{
|
||||
SyncPRG();
|
||||
SyncMirroring();
|
||||
}
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
void Mapper69_ESI(EXPSOUND *ep)
|
||||
{
|
||||
for(int i = 0; i < 0x10; i++)
|
||||
{
|
||||
double vl = 1.0 / pow(2, 1.0 / 2 * (15 - i));
|
||||
|
||||
//amp_lut[i] = i * 96;
|
||||
amp_lut[i] = 7000 * vl; //7500 * vl; //6500 * vl; //8192 * vl; //(int32)(48 * 128 * vl);
|
||||
|
||||
if(!i)
|
||||
amp_lut[i] = 0;
|
||||
|
||||
//printf("%d %f, %d\n", i, vl, amp_lut[i]);
|
||||
}
|
||||
|
||||
ep->HiFill=AYSoundHQ;
|
||||
ep->HiSync=AYHiSync;
|
||||
memset(dcount,0,sizeof(dcount));
|
||||
memset(vcount,0,sizeof(vcount));
|
||||
memset(CAYBC,0,sizeof(CAYBC));
|
||||
}
|
||||
|
||||
int NSFAY_Init(EXPSOUND *ep, bool MultiChip)
|
||||
{
|
||||
sr_index=0;
|
||||
if(MultiChip)
|
||||
{
|
||||
NSFECSetWriteHandler(0xc000,0xc000,Mapper69_SWL);
|
||||
NSFECSetWriteHandler(0xe000,0xe000,Mapper69_SWH);
|
||||
}
|
||||
else
|
||||
{
|
||||
NSFECSetWriteHandler(0xc000,0xdfff,Mapper69_SWL);
|
||||
NSFECSetWriteHandler(0xe000,0xffff,Mapper69_SWH);
|
||||
}
|
||||
Mapper69_ESI(ep);
|
||||
return(1);
|
||||
}
|
||||
|
||||
static void Reset(CartInfo *info)
|
||||
{
|
||||
sr_index = 0;
|
||||
wram_control = 0;
|
||||
memset(sr, 0xFF, sizeof(sr)); // Setting all bits will cause sound output to be disabled on reset.
|
||||
|
||||
PRGRegs[0] = PRGRegs[1] = PRGRegs[2] = 0x3F;
|
||||
|
||||
Mirroring = info->mirror ? 0 : 1; // Do any mapper 69 boards use hardware-fixed mirroring?
|
||||
|
||||
SyncPRG();
|
||||
SyncMirroring();
|
||||
|
||||
setprg8(0xe000, 0x3F);
|
||||
}
|
||||
|
||||
int BTR_Init(CartInfo *info)
|
||||
{
|
||||
SetupCartPRGMapping(0x10,WRAM,8192,1);
|
||||
|
||||
SetWriteHandler(0x8000,0xbfff,Mapper69_write);
|
||||
SetWriteHandler(0xc000,0xdfff,Mapper69_SWL);
|
||||
SetWriteHandler(0xe000,0xffff,Mapper69_SWH);
|
||||
SetWriteHandler(0x6000,0x7fff,SUN5BWRAM);
|
||||
SetReadHandler(0x6000,0x7fff,SUN5AWRAM);
|
||||
SetReadHandler(0x8000, 0xFFFF, CartBR);
|
||||
|
||||
info->Power = info->Reset = Reset;
|
||||
info->StateAction = StateAction;
|
||||
|
||||
Mapper69_ESI(&info->CartExpSound);
|
||||
|
||||
MapIRQHook = SunIRQHook;
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
|
@ -1,116 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2003 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* Not finished. Darn evil game... *Mumble*... */
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 cmd;
|
||||
static uint8 regs[8];
|
||||
|
||||
static void DoPRG(void)
|
||||
{
|
||||
if(cmd&0x40)
|
||||
{
|
||||
setprg8(0xC000,regs[4]);
|
||||
setprg8(0xA000,regs[5]);
|
||||
setprg8(0x8000,~1);
|
||||
setprg8(0xE000,~0);
|
||||
}
|
||||
else
|
||||
{
|
||||
setprg8(0x8000,regs[4]);
|
||||
setprg8(0xA000,regs[5]);
|
||||
setprg8(0xC000,~1);
|
||||
setprg8(0xE000,~0);
|
||||
}
|
||||
}
|
||||
|
||||
static void DoCHR(void)
|
||||
{
|
||||
uint32 base=(cmd&0x80)<<5;
|
||||
|
||||
setchr2(0x0000^base,regs[0]);
|
||||
setchr2(0x0800^base,regs[2]);
|
||||
|
||||
setchr1(0x1000^base,regs[6]);
|
||||
setchr1(0x1400^base,regs[1]);
|
||||
setchr1(0x1800^base,regs[7]);
|
||||
setchr1(0x1c00^base,regs[3]);
|
||||
}
|
||||
|
||||
static DECLFW(PWrite)
|
||||
{
|
||||
//printf("$%04x:$%02x\n",A,V);
|
||||
}
|
||||
|
||||
static DECLFW(H2288Write)
|
||||
{
|
||||
//printf("$%04x:$%02x, $%04x\n",A,V,X.PC);
|
||||
//MDFNI_DumpMem("dmp",0xc000,0xffff);
|
||||
|
||||
switch(A&0xE001)
|
||||
{
|
||||
case 0xa000:setmirror((V&1)^1);break;
|
||||
case 0x8000:
|
||||
cmd=V;DoPRG();DoCHR();break;
|
||||
case 0x8001:regs[cmd&7]=V;
|
||||
if((cmd&7)==4 || (cmd&7)==5)
|
||||
DoPRG();
|
||||
else
|
||||
DoCHR();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static DECLFR(H2288Read)
|
||||
{
|
||||
int bit;
|
||||
//printf("Read: $%04x, $%04x\n",A,X.PC);
|
||||
//DumpMem("out",0x8000,0xFFFF);
|
||||
bit=(A&1)^1;
|
||||
bit&=((A>>8)&1);
|
||||
bit^=1;
|
||||
return((X.DB&0xFE)|bit);
|
||||
}
|
||||
|
||||
static void H2288Reset(CartInfo *info)
|
||||
{
|
||||
int x;
|
||||
|
||||
for(x=0;x<8;x++) regs[x]=0;
|
||||
regs[4]=0;
|
||||
regs[5]=1;
|
||||
cmd=0;
|
||||
DoPRG();
|
||||
DoCHR();
|
||||
}
|
||||
|
||||
int H2288_Init(CartInfo *info)
|
||||
{
|
||||
info->Power=H2288Reset;
|
||||
|
||||
SetReadHandler(0x5000,0x5FFF,H2288Read);
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
SetWriteHandler(0x5000,0x5FFF,PWrite);
|
||||
SetWriteHandler(0x8000,0xFFFF,H2288Write);
|
||||
|
||||
return(1);
|
||||
}
|
|
@ -1,63 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static uint8 WRAM[2048];
|
||||
|
||||
static DECLFW(MWrite)
|
||||
{
|
||||
(WRAM-0x7000)[A]=V;
|
||||
}
|
||||
|
||||
static void MALEEReset(CartInfo *info)
|
||||
{
|
||||
memset(WRAM, 0x00, 2048);
|
||||
setprg2r(0x10,0x7000,0);
|
||||
setprg2r(1,0x6000,0);
|
||||
setprg32(0x8000,0);
|
||||
setchr8(0);
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFARRAY(WRAM, 2048),
|
||||
SFEND
|
||||
};
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int MALEE_Init(CartInfo *info)
|
||||
{
|
||||
SetupCartPRGMapping(0x10, WRAM, 2048, 1);
|
||||
info->Power=MALEEReset;
|
||||
info->StateAction = StateAction;
|
||||
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
SetReadHandler(0x6000,0x67ff,CartBR);
|
||||
SetReadHandler(0x7000,0x77FF,CartBR);
|
||||
SetWriteHandler(0x7000,0x77FF,MWrite);
|
||||
|
||||
return(1);
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
#include "../nes.h"
|
||||
#include "../x6502.h"
|
||||
#include "../ppu/ppu.h"
|
||||
#include "../sound.h"
|
||||
#include "../cart.h"
|
||||
#include "../unif.h"
|
||||
#include "../../mempatcher.h"
|
|
@ -1,120 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 1998 BERO
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8 PRGSelect;
|
||||
uint8 RAMSelect;
|
||||
} M125Data;
|
||||
|
||||
static M125Data Mapper125;
|
||||
static uint8 *WRAM = NULL;
|
||||
|
||||
static DECLFW(M125w)
|
||||
{
|
||||
if(A==0x5000)
|
||||
{
|
||||
Mapper125.PRGSelect=V&0xF;
|
||||
setprg32(0x8000,V&0xF);
|
||||
}
|
||||
else if(A==0x5001)
|
||||
{
|
||||
Mapper125.RAMSelect=V&0x33;
|
||||
setchr8(V&3);
|
||||
setprg8r(0x10,0x6000,(V>>4)&3);
|
||||
}
|
||||
}
|
||||
|
||||
static void M125_Reset(CartInfo *info)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static void M125_Power(CartInfo *info)
|
||||
{
|
||||
Mapper125.PRGSelect = ~0;
|
||||
Mapper125.RAMSelect = 0;
|
||||
|
||||
setprg32(0x8000,Mapper125.PRGSelect&0xF);
|
||||
setchr8(Mapper125.RAMSelect&3);
|
||||
setprg8r(0x10,0x6000,(Mapper125.RAMSelect>>4)&3);
|
||||
|
||||
if(!info->battery)
|
||||
{
|
||||
memset(WRAM, 0xFF, 32768);
|
||||
}
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFVAR(Mapper125.RAMSelect), SFVAR(Mapper125.PRGSelect),
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
|
||||
if(load)
|
||||
{
|
||||
setprg32(0x8000,Mapper125.PRGSelect&0xF);
|
||||
setchr8(Mapper125.RAMSelect&3);
|
||||
setprg8r(0x10,0x6000,(Mapper125.RAMSelect>>4)&3);
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
static void Close(void)
|
||||
{
|
||||
if(WRAM)
|
||||
{
|
||||
free(WRAM);
|
||||
WRAM = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
int Mapper125_Init(CartInfo *info)
|
||||
{
|
||||
if(!(WRAM = (uint8*) MDFN_malloc(32768, _("expansion RAM"))))
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
SetupCartPRGMapping(0x10, WRAM, 32768, 1);
|
||||
info->Reset=M125_Reset;
|
||||
info->Power=M125_Power;
|
||||
info->StateAction = StateAction;
|
||||
info->Close = Close;
|
||||
|
||||
if(info->battery)
|
||||
{
|
||||
info->SaveGame[0] = WRAM;
|
||||
info->SaveGameLen[0] = 32768;
|
||||
}
|
||||
|
||||
SetReadHandler(0x6000,0xFFFF,CartBR);
|
||||
SetWriteHandler(0x5000,0x5001,M125w);
|
||||
SetWriteHandler(0x6000,0x7FFF,CartBW);
|
||||
|
||||
return(1);
|
||||
}
|
|
@ -1,637 +0,0 @@
|
|||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* Copyright notice for this file:
|
||||
* Copyright (C) 1998 BERO
|
||||
* Copyright (C) 2002 Xodnizel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mapinc.h"
|
||||
|
||||
static void GenMMC1Power(CartInfo *info);
|
||||
static int GenMMC1Init(CartInfo *info, int prg, int chr, int wram, int battery);
|
||||
|
||||
static uint8 DRegs[4];
|
||||
static uint8 Buffer,BufferShift;
|
||||
|
||||
static int mmc1opts;
|
||||
|
||||
static void (*MMC1CHRHook4)(uint32 A, uint8 V);
|
||||
static void (*MMC1PRGHook16)(uint32 A, uint8 V);
|
||||
|
||||
static int WRAM_Size;
|
||||
static uint8 *WRAM=NULL;
|
||||
static uint8 *CHRRAM=NULL;
|
||||
static int is155;
|
||||
|
||||
static DECLFW(MBWRAM)
|
||||
{
|
||||
if(!(DRegs[3]&0x10) || is155)
|
||||
Page[A>>11][A]=V; // WRAM is enabled.
|
||||
}
|
||||
|
||||
static DECLFR(MAWRAM)
|
||||
{
|
||||
if((DRegs[3]&0x10) && !is155)
|
||||
return X.DB; // WRAM is disabled
|
||||
return(Page[A>>11][A]);
|
||||
}
|
||||
|
||||
static void MMC1CHR(void)
|
||||
{
|
||||
if(mmc1opts&4)
|
||||
{
|
||||
if(DRegs[0]&0x10)
|
||||
setprg8r(0x10,0x6000,(DRegs[1]>>4)&1);
|
||||
else
|
||||
setprg8r(0x10,0x6000,(DRegs[1]>>3)&1);
|
||||
}
|
||||
|
||||
if(MMC1CHRHook4)
|
||||
{
|
||||
if(DRegs[0]&0x10)
|
||||
{
|
||||
MMC1CHRHook4(0x0000,DRegs[1]);
|
||||
MMC1CHRHook4(0x1000,DRegs[2]);
|
||||
}
|
||||
else
|
||||
{
|
||||
MMC1CHRHook4(0x0000,(DRegs[1]&0xFE));
|
||||
MMC1CHRHook4(0x1000,DRegs[1]|1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(DRegs[0]&0x10)
|
||||
{
|
||||
setchr4(0x0000,DRegs[1]);
|
||||
setchr4(0x1000,DRegs[2]);
|
||||
}
|
||||
else
|
||||
setchr8(DRegs[1]>>1);
|
||||
}
|
||||
}
|
||||
|
||||
static void MMC1PRG(void)
|
||||
{
|
||||
uint8 offs;
|
||||
|
||||
offs=DRegs[1]&0x10;
|
||||
if(MMC1PRGHook16)
|
||||
{
|
||||
switch(DRegs[0]&0xC)
|
||||
{
|
||||
case 0xC: MMC1PRGHook16(0x8000,(DRegs[3]+offs));
|
||||
MMC1PRGHook16(0xC000,0xF+offs);
|
||||
break;
|
||||
case 0x8: MMC1PRGHook16(0xC000,(DRegs[3]+offs));
|
||||
MMC1PRGHook16(0x8000,offs);
|
||||
break;
|
||||
case 0x0:
|
||||
case 0x4:
|
||||
MMC1PRGHook16(0x8000,((DRegs[3]&~1)+offs));
|
||||
MMC1PRGHook16(0xc000,((DRegs[3]&~1)+offs+1));
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
switch(DRegs[0]&0xC)
|
||||
{
|
||||
case 0xC: setprg16(0x8000,(DRegs[3]+offs));
|
||||
setprg16(0xC000,0xF+offs);
|
||||
break;
|
||||
case 0x8: setprg16(0xC000,(DRegs[3]+offs));
|
||||
setprg16(0x8000,offs);
|
||||
break;
|
||||
case 0x0:
|
||||
case 0x4:
|
||||
setprg16(0x8000,((DRegs[3]&~1)+offs));
|
||||
setprg16(0xc000,((DRegs[3]&~1)+offs+1));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void MMC1MIRROR(void)
|
||||
{
|
||||
switch(DRegs[0]&3)
|
||||
{
|
||||
case 2: setmirror(MI_V);break;
|
||||
case 3: setmirror(MI_H);break;
|
||||
case 0: setmirror(MI_0);break;
|
||||
case 1: setmirror(MI_1);break;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef WANT_DEBUGGER
|
||||
enum
|
||||
{
|
||||
MMC1_GSREG_CONTROL = 0,
|
||||
MMC1_GSREG_CHRBANK0,
|
||||
MMC1_GSREG_CHRBANK1,
|
||||
MMC1_GSREG_PRGBANK,
|
||||
MMC1_GSREG_BUFFER,
|
||||
MMC1_GSREG_BUFFERSHIFT
|
||||
};
|
||||
|
||||
static RegType DBGMMC1Regs[] =
|
||||
{
|
||||
{ MMC1_GSREG_CONTROL, "Control", "Control(MMC1 register 0)", 1 },
|
||||
{ MMC1_GSREG_CHRBANK0, "CHRBank0", "CHR Bank Register 0(MMC1 register 1)", 1 },
|
||||
{ MMC1_GSREG_CHRBANK1, "CHRBank1", "CHR Bank Register 1(MMC1 register 2)", 1 },
|
||||
{ MMC1_GSREG_PRGBANK, "PRGBank", "PRG Bank Bank Register(MMC1 register 3)", 1 },
|
||||
{ MMC1_GSREG_BUFFER, "Buffer", "Shifty buffer that takes your moneys!", 1 },
|
||||
{ MMC1_GSREG_BUFFERSHIFT, "BufferShift", "Place to stick bit in shifty bit buffer", 1 },
|
||||
{ 0, "", "", 0 },
|
||||
};
|
||||
|
||||
static uint32 MMC1DBG_GetRegister(const unsigned int id, char *special, const uint32 special_len)
|
||||
{
|
||||
uint32 value = 0xDEADBEEF;
|
||||
|
||||
switch(id)
|
||||
{
|
||||
case MMC1_GSREG_CONTROL:
|
||||
value = DRegs[0];
|
||||
|
||||
if(special)
|
||||
{
|
||||
static const char *PMNames[4] = { "One-screen(0)", "One-screen(1)", "Vertical", "Horizontal" };
|
||||
char tmpstr[256];
|
||||
tmpstr[0] = 0;
|
||||
|
||||
sprintf(tmpstr + strlen(tmpstr), "PRG Bank Size: %dKiB", (DRegs[0] & 0x8) ? 16 : 32);
|
||||
if(DRegs[0] & 0x8)
|
||||
{
|
||||
sprintf(tmpstr + strlen(tmpstr), " @ 0x%04x, ", (DRegs[0] & 0x4) ? 0x8000 : 0xC000);
|
||||
}
|
||||
else
|
||||
strcat(tmpstr, ", ");
|
||||
|
||||
sprintf(tmpstr + strlen(tmpstr), "CHR Bank Size: %dKiB, ", (DRegs[0]&0x10) ? 4 : 8);
|
||||
|
||||
if(!CartHasHardMirroring())
|
||||
sprintf(tmpstr + strlen(tmpstr), "Mirroring: %s", PMNames[DRegs[0] & 0x3]);
|
||||
|
||||
strncpy(special, tmpstr, special_len);
|
||||
}
|
||||
break;
|
||||
|
||||
case MMC1_GSREG_CHRBANK0:
|
||||
value = DRegs[1];
|
||||
break;
|
||||
|
||||
case MMC1_GSREG_CHRBANK1:
|
||||
value = DRegs[2];
|
||||
break;
|
||||
|
||||
case MMC1_GSREG_PRGBANK:
|
||||
value = DRegs[3];
|
||||
break;
|
||||
|
||||
case MMC1_GSREG_BUFFER:
|
||||
value = Buffer;
|
||||
break;
|
||||
|
||||
case MMC1_GSREG_BUFFERSHIFT:
|
||||
value = BufferShift;
|
||||
break;
|
||||
}
|
||||
|
||||
return(value);
|
||||
}
|
||||
|
||||
static void MMC1DBG_SetRegister(const unsigned int id, uint32 value)
|
||||
{
|
||||
switch(id)
|
||||
{
|
||||
case MMC1_GSREG_CONTROL:
|
||||
DRegs[0] = value;
|
||||
break;
|
||||
|
||||
case MMC1_GSREG_CHRBANK0:
|
||||
DRegs[1] = value;
|
||||
break;
|
||||
|
||||
case MMC1_GSREG_CHRBANK1:
|
||||
DRegs[2] = value;
|
||||
break;
|
||||
|
||||
case MMC1_GSREG_PRGBANK:
|
||||
DRegs[3] = value;
|
||||
break;
|
||||
|
||||
case MMC1_GSREG_BUFFER:
|
||||
Buffer = value;
|
||||
break;
|
||||
|
||||
case MMC1_GSREG_BUFFERSHIFT:
|
||||
BufferShift = value % 5;
|
||||
break;
|
||||
}
|
||||
|
||||
MMC1MIRROR();
|
||||
MMC1CHR();
|
||||
MMC1PRG();
|
||||
}
|
||||
|
||||
static RegGroupType DBGMMC1RegsGroup =
|
||||
{
|
||||
"MMC1",
|
||||
DBGMMC1Regs,
|
||||
MMC1DBG_GetRegister,
|
||||
MMC1DBG_SetRegister,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
static uint64 lreset;
|
||||
static DECLFW(MMC1_write)
|
||||
{
|
||||
int n=(A>>13)-4;
|
||||
//MDFN_DispMessage("%016x",timestampbase+timestamp);
|
||||
//printf("$%04x:$%02x, $%04x\n",A,V,X.PC);
|
||||
//DumpMem("out",0xe000,0xffff);
|
||||
|
||||
/* The MMC1 is busy so ignore the write. */
|
||||
/* As of version Mednafen 0.81, the timestamp is only
|
||||
increased before each instruction is executed(in other words
|
||||
precision isn't that great), but this should still work to
|
||||
deal with 2 writes in a row from a single RMW instruction.
|
||||
*/
|
||||
if( (timestampbase+timestamp)<(lreset+2))
|
||||
return;
|
||||
if (V&0x80)
|
||||
{
|
||||
DRegs[0]|=0xC;
|
||||
BufferShift=Buffer=0;
|
||||
MMC1PRG();
|
||||
lreset=timestampbase+timestamp;
|
||||
return;
|
||||
}
|
||||
|
||||
Buffer|=(V&1)<<(BufferShift++);
|
||||
|
||||
if (BufferShift==5) {
|
||||
DRegs[n] = Buffer;
|
||||
BufferShift = Buffer = 0;
|
||||
|
||||
switch(n){
|
||||
case 0:
|
||||
MMC1MIRROR();
|
||||
MMC1CHR();
|
||||
MMC1PRG();
|
||||
break;
|
||||
case 1:
|
||||
MMC1CHR();
|
||||
MMC1PRG();
|
||||
break;
|
||||
case 2:
|
||||
MMC1CHR();
|
||||
break;
|
||||
case 3:
|
||||
MMC1PRG();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void MMC1CMReset(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i=0;i<4;i++)
|
||||
DRegs[i]=0;
|
||||
Buffer = BufferShift = 0;
|
||||
DRegs[0]=0x1F;
|
||||
|
||||
DRegs[1]=0;
|
||||
DRegs[2]=0; // Should this be something other than 0?
|
||||
DRegs[3]=0;
|
||||
|
||||
MMC1MIRROR();
|
||||
MMC1CHR();
|
||||
MMC1PRG();
|
||||
}
|
||||
|
||||
static int DetectMMC1WRAMSize(uint32 crc32)
|
||||
{
|
||||
switch(crc32)
|
||||
{
|
||||
default:return(8);
|
||||
case 0xc6182024: /* Romance of the 3 Kingdoms */
|
||||
case 0x2225c20f: /* Genghis Khan */
|
||||
case 0x4642dda6: /* Nobunaga's Ambition */
|
||||
case 0x29449ba9: /* "" "" (J) */
|
||||
case 0x2b11e0b0: /* "" "" (J) */
|
||||
MDFN_printf(_(">8KB external WRAM present. Use UNIF if you hack the ROM image.\n"));
|
||||
return(16);
|
||||
}
|
||||
}
|
||||
|
||||
static uint32 NWCIRQCount;
|
||||
static uint8 NWCRec;
|
||||
#define NWCDIP 0xE
|
||||
|
||||
static void NWCIRQHook(int a)
|
||||
{
|
||||
if(!(NWCRec&0x10))
|
||||
{
|
||||
NWCIRQCount+=a;
|
||||
if((NWCIRQCount|(NWCDIP<<25))>=0x3e000000)
|
||||
{
|
||||
NWCIRQCount=0;
|
||||
X6502_IRQBegin(MDFN_IQEXT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void NWCCHRHook(uint32 A, uint8 V)
|
||||
{
|
||||
if((V&0x10)) // && !(NWCRec&0x10))
|
||||
{
|
||||
NWCIRQCount=0;
|
||||
X6502_IRQEnd(MDFN_IQEXT);
|
||||
}
|
||||
|
||||
NWCRec=V;
|
||||
if(V&0x08)
|
||||
MMC1PRG();
|
||||
else
|
||||
setprg32(0x8000,(V>>1)&3);
|
||||
}
|
||||
|
||||
static void NWCPRGHook(uint32 A, uint8 V)
|
||||
{
|
||||
if(NWCRec&0x8)
|
||||
setprg16(A,8|(V&0x7));
|
||||
else
|
||||
setprg32(0x8000,(NWCRec>>1)&3);
|
||||
}
|
||||
|
||||
static void NWCPower(CartInfo *info)
|
||||
{
|
||||
GenMMC1Power(info);
|
||||
setchr8r(0,0);
|
||||
}
|
||||
|
||||
static int NWC_StateAction(StateMem *sm, int load, int data_only);
|
||||
int Mapper105_Init(CartInfo *info)
|
||||
{
|
||||
if(!(GenMMC1Init(info, 256, 256, 8, 0)))
|
||||
return(0);
|
||||
|
||||
MMC1CHRHook4=NWCCHRHook;
|
||||
MMC1PRGHook16=NWCPRGHook;
|
||||
MapIRQHook=NWCIRQHook;
|
||||
info->Power=NWCPower;
|
||||
info->StateAction = NWC_StateAction;
|
||||
return(1);
|
||||
}
|
||||
|
||||
static void GenMMC1Power(CartInfo *info)
|
||||
{
|
||||
lreset=0;
|
||||
if(mmc1opts&1)
|
||||
{
|
||||
if(mmc1opts&4)
|
||||
memset(WRAM,0,8192);
|
||||
else if(!(mmc1opts&2))
|
||||
memset(WRAM,0,8192);
|
||||
}
|
||||
|
||||
if(mmc1opts&1)
|
||||
{
|
||||
setprg8r(0x10,0x6000,0);
|
||||
}
|
||||
|
||||
MMC1CMReset();
|
||||
}
|
||||
|
||||
static void GenMMC1Close(void)
|
||||
{
|
||||
if(CHRRAM)
|
||||
MDFN_free(CHRRAM);
|
||||
if(WRAM)
|
||||
MDFN_free(WRAM);
|
||||
CHRRAM=WRAM=NULL;
|
||||
}
|
||||
|
||||
static int NWC_StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFARRAY(WRAM, WRAM_Size),
|
||||
SFARRAY(CHRRAM, 8192),
|
||||
SFARRAY(DRegs, 4),
|
||||
SFVAR(lreset),
|
||||
SFVAR(Buffer),
|
||||
SFVAR(BufferShift),
|
||||
SFVAR(NWCIRQCount),
|
||||
SFVAR(NWCRec),
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
{
|
||||
MMC1MIRROR();
|
||||
MMC1CHR();
|
||||
MMC1PRG();
|
||||
lreset=0; /* timestamp(base) is not stored in save states. */
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
static int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
//uint32 NWCIRQCount;
|
||||
//uint8 NWCRec;
|
||||
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
SFARRAY(WRAM, WRAM_Size),
|
||||
SFARRAY(CHRRAM, 8192),
|
||||
SFARRAY(DRegs, 4),
|
||||
SFVAR(lreset),
|
||||
SFVAR(Buffer),
|
||||
SFVAR(BufferShift),
|
||||
SFEND
|
||||
};
|
||||
|
||||
int ret = MDFNSS_StateAction(sm, load, data_only, StateRegs, "MAPR");
|
||||
if(load)
|
||||
{
|
||||
MMC1MIRROR();
|
||||
MMC1CHR();
|
||||
MMC1PRG();
|
||||
lreset=0; /* timestamp(base) is not stored in save states. */
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
static int GenMMC1Init(CartInfo *info, int prg, int chr, int wram, int battery)
|
||||
{
|
||||
is155=0;
|
||||
|
||||
info->StateAction = StateAction;
|
||||
info->Close=GenMMC1Close;
|
||||
MMC1PRGHook16=MMC1CHRHook4=0;
|
||||
mmc1opts=0;
|
||||
PRGmask16[0]&=(prg>>14)-1;
|
||||
CHRmask4[0]&=(chr>>12)-1;
|
||||
CHRmask8[0]&=(chr>>13)-1;
|
||||
|
||||
WRAM_Size = wram * 1024;
|
||||
if(wram)
|
||||
{
|
||||
if(!(WRAM=(uint8*)malloc(wram*1024)))
|
||||
{
|
||||
GenMMC1Close();
|
||||
return(0);
|
||||
}
|
||||
mmc1opts|=1;
|
||||
if(wram>8) mmc1opts|=4;
|
||||
SetupCartPRGMapping(0x10,WRAM,wram*1024,1);
|
||||
|
||||
if(battery)
|
||||
{
|
||||
mmc1opts|=2;
|
||||
|
||||
info->SaveGame[0]=WRAM+((mmc1opts&4)?8192:0);
|
||||
info->SaveGameLen[0]=8192;
|
||||
}
|
||||
}
|
||||
if(!chr)
|
||||
{
|
||||
if(!(CHRRAM=(uint8*)malloc(8192)))
|
||||
{
|
||||
GenMMC1Close();
|
||||
return(0);
|
||||
}
|
||||
SetupCartCHRMapping(0, CHRRAM, 8192, 1);
|
||||
}
|
||||
info->Power=GenMMC1Power;
|
||||
|
||||
|
||||
#ifdef WANT_DEBUGGER
|
||||
MDFNDBG_AddRegGroup(&DBGMMC1RegsGroup);
|
||||
#endif
|
||||
|
||||
SetWriteHandler(0x8000,0xFFFF,MMC1_write);
|
||||
SetReadHandler(0x8000,0xFFFF,CartBR);
|
||||
|
||||
if(mmc1opts&1)
|
||||
{
|
||||
MDFNMP_AddRAM(8192,0x6000,WRAM);
|
||||
SetReadHandler(0x6000,0x7FFF,MAWRAM);
|
||||
SetWriteHandler(0x6000,0x7FFF,MBWRAM);
|
||||
}
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
||||
int Mapper1_Init(CartInfo *info)
|
||||
{
|
||||
int ws=DetectMMC1WRAMSize(info->CRC32);
|
||||
return(GenMMC1Init(info, 512, 256, ws, info->battery));
|
||||
}
|
||||
|
||||
/* Same as mapper 1, without respect for WRAM enable bit. */
|
||||
int Mapper155_Init(CartInfo *info)
|
||||
{
|
||||
int ret = GenMMC1Init(info,512,256,8,info->battery);
|
||||
|
||||
is155=1;
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
//static void GenMMC1Init(int prg, int chr, int wram, int battery)
|
||||
int SAROM_Init(CartInfo *info)
|
||||
{
|
||||
return(GenMMC1Init(info, 128, 64, 8, info->battery));
|
||||
}
|
||||
|
||||
int SBROM_Init(CartInfo *info)
|
||||
{
|
||||
return(GenMMC1Init(info, 128, 64, 0, 0));
|
||||
}
|
||||
|
||||
int SCROM_Init(CartInfo *info)
|
||||
{
|
||||
return(GenMMC1Init(info, 128, 128, 0, 0));
|
||||
}
|
||||
|
||||
int SEROM_Init(CartInfo *info)
|
||||
{
|
||||
return(GenMMC1Init(info, 32, 64, 0, 0));
|
||||
}
|
||||
|
||||
int SGROM_Init(CartInfo *info)
|
||||
{
|
||||
return(GenMMC1Init(info, 256, 0, 0, 0));
|
||||
}
|
||||
|
||||
int SKROM_Init(CartInfo *info)
|
||||
{
|
||||
return(GenMMC1Init(info, 256, 64, 8, info->battery));
|
||||
}
|
||||
|
||||
int SLROM_Init(CartInfo *info)
|
||||
{
|
||||
return(GenMMC1Init(info, 256, 128, 0, 0));
|
||||
}
|
||||
|
||||
int SL1ROM_Init(CartInfo *info)
|
||||
{
|
||||
return(GenMMC1Init(info, 128, 128, 0, 0));
|
||||
}
|
||||
|
||||
/* Begin unknown - may be wrong - perhaps they use different MMC1s from the
|
||||
similarly functioning boards?
|
||||
*/
|
||||
|
||||
int SL2ROM_Init(CartInfo *info)
|
||||
{
|
||||
return(GenMMC1Init(info, 256, 256, 0, 0));
|
||||
}
|
||||
|
||||
int SFROM_Init(CartInfo *info)
|
||||
{
|
||||
return(GenMMC1Init(info, 256, 256, 0, 0));
|
||||
}
|
||||
|
||||
int SHROM_Init(CartInfo *info)
|
||||
{
|
||||
return(GenMMC1Init(info, 256, 256, 0, 0));
|
||||
}
|
||||
|
||||
/* End unknown */
|
||||
/* */
|
||||
/* */
|
||||
|
||||
int SNROM_Init(CartInfo *info)
|
||||
{
|
||||
return(GenMMC1Init(info, 256, 0, 8, info->battery));
|
||||
}
|
||||
|
||||
int SOROM_Init(CartInfo *info)
|
||||
{
|
||||
return(GenMMC1Init(info, 256, 0, 16, info->battery));
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue