summaryrefslogtreecommitdiff
path: root/sid/sidplay-libs-2.1.0/libsidplay/src/mos6526
diff options
context:
space:
mode:
Diffstat (limited to 'sid/sidplay-libs-2.1.0/libsidplay/src/mos6526')
-rw-r--r--sid/sidplay-libs-2.1.0/libsidplay/src/mos6526/Makefile.am7
-rw-r--r--sid/sidplay-libs-2.1.0/libsidplay/src/mos6526/Makefile.in424
-rw-r--r--sid/sidplay-libs-2.1.0/libsidplay/src/mos6526/mos6526.cpp322
-rw-r--r--sid/sidplay-libs-2.1.0/libsidplay/src/mos6526/mos6526.h156
4 files changed, 909 insertions, 0 deletions
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/mos6526/Makefile.am b/sid/sidplay-libs-2.1.0/libsidplay/src/mos6526/Makefile.am
new file mode 100644
index 00000000..e5029df5
--- /dev/null
+++ b/sid/sidplay-libs-2.1.0/libsidplay/src/mos6526/Makefile.am
@@ -0,0 +1,7 @@
+
+noinst_LTLIBRARIES = libmos6526.la
+
+libmos6526_la_SOURCES = mos6526.cpp mos6526.h
+
+# Remove bad default includes
+DEFAULT_INCLUDES=
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/mos6526/Makefile.in b/sid/sidplay-libs-2.1.0/libsidplay/src/mos6526/Makefile.in
new file mode 100644
index 00000000..8f1667ec
--- /dev/null
+++ b/sid/sidplay-libs-2.1.0/libsidplay/src/mos6526/Makefile.in
@@ -0,0 +1,424 @@
+# Makefile.in generated by automake 1.7.1 from Makefile.am.
+# @configure_input@
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+# 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@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+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 = :
+host_triplet = @host@
+ACLOCAL = @ACLOCAL@
+ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBVERSION = @LIBVERSION@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SID_HAVE_BOOL = @SID_HAVE_BOOL@
+SID_HAVE_STDBOOL_H = @SID_HAVE_STDBOOL_H@
+SID_SIZEOF_CHAR = @SID_SIZEOF_CHAR@
+SID_SIZEOF_INT = @SID_SIZEOF_INT@
+SID_SIZEOF_LONG_INT = @SID_SIZEOF_LONG_INT@
+SID_SIZEOF_SHORT_INT = @SID_SIZEOF_SHORT_INT@
+SID_WORDS_ENDIANESS = @SID_WORDS_ENDIANESS@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__quote = @am__quote@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builders = @builders@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+
+noinst_LTLIBRARIES = libmos6526.la
+
+libmos6526_la_SOURCES = mos6526.cpp mos6526.h
+
+# Remove bad default includes
+DEFAULT_INCLUDES =
+subdir = src/mos6526
+mkinstalldirs = $(SHELL) $(top_srcdir)/unix/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/unix/config.h
+CONFIG_CLEAN_FILES =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+
+libmos6526_la_LDFLAGS =
+libmos6526_la_LIBADD =
+am_libmos6526_la_OBJECTS = mos6526.lo
+libmos6526_la_OBJECTS = $(am_libmos6526_la_OBJECTS)
+depcomp = $(SHELL) $(top_srcdir)/unix/depcomp
+am__depfiles_maybe = depfiles
+@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/mos6526.Plo
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \
+ $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+DIST_SOURCES = $(libmos6526_la_SOURCES)
+DIST_COMMON = Makefile.am Makefile.in
+SOURCES = $(libmos6526_la_SOURCES)
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cpp .lo .o .obj
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu src/mos6526/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
+
+clean-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+ @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" = "$$p" && dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libmos6526.la: $(libmos6526_la_OBJECTS) $(libmos6526_la_DEPENDENCIES)
+ $(CXXLINK) $(libmos6526_la_LDFLAGS) $(libmos6526_la_OBJECTS) $(libmos6526_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT) core *.core
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mos6526.Plo@am__quote@
+
+distclean-depend:
+ -rm -rf ./$(DEPDIR)
+
+.cpp.o:
+@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
+@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
+@am__fastdepCXX_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
+@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
+@am__fastdepCXX_TRUE@ fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
+
+.cpp.obj:
+@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
+@am__fastdepCXX_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'`; \
+@am__fastdepCXX_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
+@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
+@am__fastdepCXX_TRUE@ fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'`
+
+.cpp.lo:
+@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
+@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
+@am__fastdepCXX_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \
+@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
+@am__fastdepCXX_TRUE@ fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+ETAGS = etags
+ETAGSFLAGS =
+
+CTAGS = ctags
+CTAGSFLAGS =
+
+tags: TAGS
+
+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; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ 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; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$tags$$unique" \
+ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique
+
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ 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; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ../..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkinstalldirs) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$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 $(LTLIBRARIES)
+
+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_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_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-noinstLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+
+distclean-am: clean-am distclean-compile distclean-depend \
+ distclean-generic distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+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: uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLTLIBRARIES ctags distclean \
+ distclean-compile distclean-depend distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am info \
+ info-am install install-am install-data install-data-am \
+ install-exec install-exec-am install-info install-info-am \
+ install-man 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 uninstall-info-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:
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/mos6526/mos6526.cpp b/sid/sidplay-libs-2.1.0/libsidplay/src/mos6526/mos6526.cpp
new file mode 100644
index 00000000..32b6f1f2
--- /dev/null
+++ b/sid/sidplay-libs-2.1.0/libsidplay/src/mos6526/mos6526.cpp
@@ -0,0 +1,322 @@
+/***************************************************************************
+ mos6526.cpp - CIA Timer
+ -------------------
+ begin : Wed Jun 7 2000
+ copyright : (C) 2000 by Simon White
+ email : s_a_white@email.com
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+/***************************************************************************
+ * $Log: mos6526.cpp,v $
+ * Revision 1.10 2002/12/16 22:12:24 s_a_white
+ * Simulate serial input from data port A to prevent kernel lockups.
+ *
+ * Revision 1.9 2002/11/20 22:50:27 s_a_white
+ * Reload count when timers are stopped
+ *
+ * Revision 1.8 2002/10/02 19:49:21 s_a_white
+ * Revert previous change as was incorrect.
+ *
+ * Revision 1.7 2002/09/11 22:30:47 s_a_white
+ * Counter interval writes now go to a new register call prescaler. This is
+ * copied to the timer latch/counter as appropriate.
+ *
+ * Revision 1.6 2002/09/09 22:49:06 s_a_white
+ * Proper idr clear if interrupt was only internally pending.
+ *
+ * Revision 1.5 2002/07/20 08:34:52 s_a_white
+ * Remove unnecessary and pointless conts.
+ *
+ * Revision 1.4 2002/03/03 22:04:08 s_a_white
+ * Tidy.
+ *
+ * Revision 1.3 2001/07/14 13:03:33 s_a_white
+ * Now uses new component classes and event generation.
+ *
+ * Revision 1.2 2001/03/23 23:21:38 s_a_white
+ * Removed redundant reset funtion. Timer b now gets initialised properly.
+ * Switch case now allows write/read from timer b.
+ *
+ * Revision 1.1 2001/03/21 22:41:45 s_a_white
+ * Non faked CIA emulation with NMI support. Removal of Hacked VIC support
+ * off CIA timer.
+ *
+ * Revision 1.8 2001/03/09 23:44:30 s_a_white
+ * Integrated more 6526 features. All timer modes and interrupts correctly
+ * supported.
+ *
+ * Revision 1.7 2001/02/21 22:07:10 s_a_white
+ * Prevent re-triggering of interrupt if it's already active.
+ *
+ * Revision 1.6 2001/02/13 21:00:01 s_a_white
+ * Support for real interrupts.
+ *
+ * Revision 1.4 2000/12/11 18:52:12 s_a_white
+ * Conversion to AC99
+ *
+ ***************************************************************************/
+
+#include "sidendian.h"
+#include "mos6526.h"
+
+enum
+{
+ INTERRUPT_TA = 1 << 0,
+ INTERRUPT_TB = 1 << 1,
+ INTERRUPT_ALARM = 1 << 2,
+ INTERRUPT_SP = 1 << 3,
+ INTERRUPT_FLAG = 1 << 4,
+ INTERRUPT_REQUEST = 1 << 7
+};
+
+const char *MOS6526::credit =
+{ // Optional information
+ "*MOS6526 (CIA) Emulation:\0"
+ "\tCopyright (C) 2001 Simon White <sidplay2@email.com>\0"
+};
+
+
+MOS6526::MOS6526 (EventContext *context)
+:idr(0),
+ event_context(*context),
+ event_ta(this),
+ event_tb(this)
+{
+ reset ();
+}
+
+void MOS6526::reset (void)
+{
+ ta = ta_latch = 0xffff;
+ tb = tb_latch = 0xffff;
+ cra = crb = 0;
+ // Clear off any IRQs
+ trigger (0);
+ cnt_high = true;
+ icr = idr = 0;
+ m_accessClk = 0;
+ dpa = 0xf0;
+}
+
+uint8_t MOS6526::read (uint_least8_t addr)
+{
+ event_clock_t cycles;
+ if (addr > 0x0f) return 0;
+
+ cycles = event_context.getTime (m_accessClk);
+ m_accessClk += cycles;
+
+ // Sync up timers
+ if ((cra & 0x21) == 0x01)
+ ta -= cycles;
+ if ((crb & 0x61) == 0x01)
+ tb -= cycles;
+
+ switch (addr)
+ {
+ case 0x0: // Simulate a serial port
+ dpa = ((dpa << 1) | (dpa >> 7)) & 0xff;
+ if (dpa & 0x80)
+ return 0xc0;
+ return 0;
+ case 0x4: return endian_16lo8 (ta);
+ case 0x5: return endian_16hi8 (ta);
+ case 0x6: return endian_16lo8 (tb);
+ case 0x7: return endian_16hi8 (tb);
+
+ case 0xd:
+ { // Clear IRQs, and return interrupt
+ // data register
+ uint8_t ret = idr;
+ trigger (0);
+ return ret;
+ }
+
+ case 0x0e: return cra;
+ case 0x0f: return crb;
+ default: return regs[addr];
+ }
+}
+
+void MOS6526::write (uint_least8_t addr, uint8_t data)
+{
+ event_clock_t cycles;
+ if (addr > 0x0f) return;
+
+ regs[addr] = data;
+ cycles = event_context.getTime (m_accessClk);
+ m_accessClk += cycles;
+
+ // Sync up timers
+ if ((cra & 0x21) == 0x01)
+ ta -= cycles;
+ if ((crb & 0x61) == 0x01)
+ tb -= cycles;
+
+ switch (addr)
+ {
+ case 0x4: endian_16lo8 (ta_latch, data); break;
+ case 0x5:
+ endian_16hi8 (ta_latch, data);
+ if (!(cra & 0x01)) // Reload timer if stopped
+ ta = ta_latch;
+ break;
+
+ case 0x6: endian_16lo8 (tb_latch, data); break;
+ case 0x7:
+ endian_16hi8 (tb_latch, data);
+ if (!(crb & 0x01)) // Reload timer if stopped
+ tb = tb_latch;
+ break;
+
+ case 0xd:
+ if (data & 0x80)
+ icr |= data & 0x1f;
+ else
+ icr &= ~data;
+ trigger (idr);
+ break;
+
+ case 0x0e:
+ // Check for forced load
+ cra = data;
+ if (data & 0x10)
+ {
+ cra &= (~0x10);
+ ta = ta_latch;
+ }
+
+ if ((data & 0x21) == 0x01)
+ { // Active
+ event_context.schedule (&event_ta, (event_clock_t) ta + 1);
+ } else
+ { // Inactive
+ ta = ta_latch;
+ event_context.cancel (&event_ta);
+ }
+ break;
+
+ case 0x0f:
+ // Check for forced load
+ crb = data;
+ if (data & 0x10)
+ {
+ crb &= (~0x10);
+ tb = tb_latch;
+ }
+
+ if ((data & 0x61) == 0x01)
+ { // Active
+ event_context.schedule (&event_tb, (event_clock_t) tb + 1);
+ } else
+ { // Inactive
+ tb = tb_latch;
+ event_context.cancel (&event_tb);
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+void MOS6526::trigger (int irq)
+{
+ if (!irq)
+ { // Clear any requested IRQs
+ if (idr & INTERRUPT_REQUEST)
+ interrupt (false);
+ idr = 0;
+ return;
+ }
+
+ idr |= irq;
+ if (icr & idr)
+ {
+ if (!(idr & INTERRUPT_REQUEST))
+ {
+ idr |= INTERRUPT_REQUEST;
+ interrupt (true);
+ }
+ }
+}
+
+void MOS6526::ta_event (void)
+{ // Timer Modes
+ event_clock_t cycles;
+ uint8_t mode = cra & 0x21;
+
+ if (mode == 0x21)
+ {
+ if (ta--)
+ return;
+ }
+
+ cycles = event_context.getTime (m_accessClk);
+ m_accessClk += cycles;
+
+ ta = ta_latch;
+ if (cra & 0x08)
+ { // one shot, stop timer A
+ cra &= (~0x01);
+ } else if (mode == 0x01)
+ { // Reset event
+ event_context.schedule (&event_ta, (event_clock_t) ta + 1);
+ }
+ trigger (INTERRUPT_TA);
+
+ switch (crb & 0x61)
+ {
+ case 0x01: tb -= cycles; break;
+ case 0x41:
+ case 0x61:
+ tb_event ();
+ break;
+ }
+}
+
+void MOS6526::tb_event (void)
+{ // Timer Modes
+ uint8_t mode = crb & 0x61;
+ switch (mode)
+ {
+ case 0x01:
+ break;
+
+ case 0x21:
+ case 0x41:
+ if (tb--)
+ return;
+ break;
+
+ case 0x61:
+ if (cnt_high)
+ {
+ if (tb--)
+ return;
+ }
+ break;
+
+ default:
+ return;
+ }
+
+ m_accessClk = event_context.getTime ();
+ tb = tb_latch;
+ if (crb & 0x08)
+ { // one shot, stop timer A
+ crb &= (~0x01);
+ } else if (mode == 0x01)
+ { // Reset event
+ event_context.schedule (&event_tb, (event_clock_t) tb + 1);
+ }
+ trigger (INTERRUPT_TB);
+}
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/mos6526/mos6526.h b/sid/sidplay-libs-2.1.0/libsidplay/src/mos6526/mos6526.h
new file mode 100644
index 00000000..5fa11bcf
--- /dev/null
+++ b/sid/sidplay-libs-2.1.0/libsidplay/src/mos6526/mos6526.h
@@ -0,0 +1,156 @@
+/***************************************************************************
+ mos6526.h - CIA timer to produce interrupts
+ -------------------
+ begin : Wed Jun 7 2000
+ copyright : (C) 2000 by Simon White
+ email : s_a_white@email.com
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+/***************************************************************************
+ * $Log: mos6526.h,v $
+ * Revision 1.11 2002/12/16 22:12:27 s_a_white
+ * Simulate serial input from data port A to prevent kernel lockups.
+ *
+ * Revision 1.10 2002/10/02 19:49:22 s_a_white
+ * Revert previous change as was incorrect.
+ *
+ * Revision 1.9 2002/09/11 22:30:47 s_a_white
+ * Counter interval writes now go to a new register call prescaler. This is
+ * copied to the timer latch/counter as appropriate.
+ *
+ * Revision 1.8 2002/07/20 08:34:52 s_a_white
+ * Remove unnecessary and pointless conts.
+ *
+ * Revision 1.7 2001/10/18 22:35:45 s_a_white
+ * GCC3 fixes.
+ *
+ * Revision 1.6 2001/07/14 16:46:59 s_a_white
+ * Sync with sidbuilder class project.
+ *
+ * Revision 1.5 2001/07/14 13:03:33 s_a_white
+ * Now uses new component classes and event generation.
+ *
+ * Revision 1.4 2001/03/25 19:50:16 s_a_white
+ * Timer B counts timer Aer a underflows correc
+ *
+ * Revision 1.3 2001/03/23 23:20:29 s_a_white
+ * Removed redundant reset prototype.
+ *
+ * Revision 1.2 2001/03/22 22:41:45 s_a_white
+ * Replaced tab characters
+ *
+ * Revision 1.1 2001/03/21 22:41:45 s_a_white
+ * Non faked CIA emulation with NMI support. Removal of Hacked VIC support
+ * off CIA timer.
+ *
+ * Revision 1.7 2001/03/09 23:44:30 s_a_white
+ * Integrated more 6526 features. All timer modes and interrupts correctly
+ * supported.
+ *
+ * Revision 1.6 2001/02/21 22:07:10 s_a_white
+ * Prevent re-triggering of interrupt if it's already active.
+ *
+ * Revision 1.5 2001/02/13 21:00:01 s_a_white
+ * Support for real interrupts.
+ *
+ * Revision 1.3 2000/12/11 18:52:12 s_a_white
+ * Conversion to AC99
+ *
+ ***************************************************************************/
+
+#ifndef _mos6526_h_
+#define _mos6526_h_
+
+#include "component.h"
+#include "event.h"
+
+class MOS6526: public component
+{
+private:
+ static const char *credit;
+
+protected:
+ uint8_t regs[0x10];
+ bool cnt_high;
+
+ // Timer A
+ uint8_t cra, cra_latch, dpa;
+ uint_least16_t ta, ta_latch;
+ int ta_state;
+
+ // Timer B
+ uint8_t crb;
+ uint_least16_t tb, tb_latch;
+
+ uint8_t icr, idr; // Interrupt Control Register
+ event_clock_t m_accessClk;
+ EventContext &event_context;
+
+ class EventTa: public Event
+ {
+ private:
+ MOS6526 &m_cia;
+ void event (void) {m_cia.ta_event ();}
+
+ public:
+ EventTa (MOS6526 *cia)
+ :Event("CIA Timer A"),
+ m_cia(*cia) {}
+ } event_ta;
+
+ /*
+ class EventStateMachineA: public Event
+ {
+ private:
+ MOS6526 &m_cia;
+ void event (void) {m_cia.cra_event ();}
+
+ public:
+ EventStateMachineA (MOS6526 *cia)
+ :Event("CIA Timer A (State Machine)"),
+ m_cia(*cia) {}
+ } event_stateMachineA;
+*/
+ class EventTb: public Event
+ {
+ private:
+ MOS6526 &m_cia;
+ void event (void) {m_cia.tb_event ();}
+
+ public:
+ EventTb (MOS6526 *cia)
+ :Event("CIA Timer B"),
+ m_cia(*cia) {}
+ } event_tb;
+
+ friend class EventTa;
+// friend class EventStateMachineA;
+ friend class EventTb;
+
+protected:
+ MOS6526 (EventContext *context);
+ void ta_event (void);
+ void tb_event (void);
+ void trigger (int irq);
+// void stateMachineA_event (void);
+
+ // Environment Interface
+ virtual void interrupt (bool state) = 0;
+
+public:
+ // Component Standard Calls
+ void reset (void);
+ uint8_t read (uint_least8_t addr);
+ void write (uint_least8_t addr, uint8_t data);
+ const char *credits (void) {return credit;}
+};
+
+#endif // _mos6526_h_