diff -Nru emu8051-1.1.1/aclocal.m4 emu8051-2.0.1/aclocal.m4 --- emu8051-1.1.1/aclocal.m4 2011-12-12 04:55:39.000000000 +0000 +++ emu8051-2.0.1/aclocal.m4 2014-03-22 18:26:14.000000000 +0000 @@ -1,7 +1,7 @@ -# generated automatically by aclocal 1.11.1 -*- Autoconf -*- +# generated automatically by aclocal 1.14 -*- Autoconf -*- + +# Copyright (C) 1996-2013 Free Software Foundation, Inc. -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. # This file 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. @@ -11,15 +11,17 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. +m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],, -[m4_warning([this file was generated for autoconf 2.68. +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, +[m4_warning([this file was generated for autoconf 2.69. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. -To do so, use the procedure documented by the package, typically `autoreconf'.])]) +To do so, use the procedure documented by the package, typically 'autoreconf'.])]) # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# serial 1 (pkg-config-0.24) # # Copyright © 2004 Scott James Remnant . # @@ -46,8 +48,12 @@ # ---------------------------------- AC_DEFUN([PKG_PROG_PKG_CONFIG], [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) -m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) -AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl +m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) +m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) +AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) +AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) + if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) fi @@ -60,7 +66,6 @@ AC_MSG_RESULT([no]) PKG_CONFIG="" fi - fi[]dnl ])# PKG_PROG_PKG_CONFIG @@ -69,21 +74,20 @@ # Check to see whether a particular set of modules exists. Similar # to PKG_CHECK_MODULES(), but does not set variables or print errors. # -# -# Similar to PKG_CHECK_MODULES, make sure that the first instance of -# this or PKG_CHECK_MODULES is called, or make sure to call -# PKG_CHECK_EXISTS manually +# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +# only at the first occurence in configure.ac, so if the first place +# it's called might be skipped (such as if it is within an "if", you +# have to call PKG_CHECK_EXISTS manually # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_EXISTS], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl if test -n "$PKG_CONFIG" && \ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then - m4_ifval([$2], [$2], [:]) + m4_default([$2], [:]) m4_ifvaln([$3], [else $3])dnl fi]) - # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) # --------------------------------------------- m4_define([_PKG_CONFIG], @@ -91,7 +95,8 @@ pkg_cv_[]$1="$$1" elif test -n "$PKG_CONFIG"; then PKG_CHECK_EXISTS([$3], - [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes ], [pkg_failed=yes]) else pkg_failed=untried @@ -136,16 +141,17 @@ See the pkg-config man page for more details.]) if test $pkg_failed = yes; then + AC_MSG_RESULT([no]) _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then - $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1` + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` else - $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1` + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD - ifelse([$4], , [AC_MSG_ERROR(dnl + m4_default([$4], [AC_MSG_ERROR( [Package requirements ($2) were not met: $$1_PKG_ERRORS @@ -153,29 +159,28 @@ Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. -_PKG_TEXT -])], - [AC_MSG_RESULT([no]) - $4]) +_PKG_TEXT])[]dnl + ]) elif test $pkg_failed = untried; then - ifelse([$4], , [AC_MSG_FAILURE(dnl + AC_MSG_RESULT([no]) + m4_default([$4], [AC_MSG_FAILURE( [The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. _PKG_TEXT -To get pkg-config, see .])], - [$4]) +To get pkg-config, see .])[]dnl + ]) else $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS $1[]_LIBS=$pkg_cv_[]$1[]_LIBS AC_MSG_RESULT([yes]) - ifelse([$3], , :, [$3]) + $3 fi[]dnl ])# PKG_CHECK_MODULES -# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# Copyright (C) 2002-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -187,10 +192,10 @@ # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], -[am__api_version='1.11' +[am__api_version='1.14' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.11.1], [], +m4_if([$1], [1.14], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -206,22 +211,82 @@ # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.11.1])dnl +[AM_AUTOMAKE_VERSION([1.14])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) +# Copyright (C) 2011-2013 Free Software Foundation, Inc. +# +# This file 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. + +# AM_PROG_AR([ACT-IF-FAIL]) +# ------------------------- +# Try to determine the archiver interface, and trigger the ar-lib wrapper +# if it is needed. If the detection of archiver interface fails, run +# ACT-IF-FAIL (default is to abort configure with a proper error message). +AC_DEFUN([AM_PROG_AR], +[AC_BEFORE([$0], [LT_INIT])dnl +AC_BEFORE([$0], [AC_PROG_LIBTOOL])dnl +AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([ar-lib])dnl +AC_CHECK_TOOLS([AR], [ar lib "link -lib"], [false]) +: ${AR=ar} + +AC_CACHE_CHECK([the archiver ($AR) interface], [am_cv_ar_interface], + [AC_LANG_PUSH([C]) + am_cv_ar_interface=ar + AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int some_variable = 0;]])], + [am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&AS_MESSAGE_LOG_FD' + AC_TRY_EVAL([am_ar_try]) + if test "$ac_status" -eq 0; then + am_cv_ar_interface=ar + else + am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext >&AS_MESSAGE_LOG_FD' + AC_TRY_EVAL([am_ar_try]) + if test "$ac_status" -eq 0; then + am_cv_ar_interface=lib + else + am_cv_ar_interface=unknown + fi + fi + rm -f conftest.lib libconftest.a + ]) + AC_LANG_POP([C])]) + +case $am_cv_ar_interface in +ar) + ;; +lib) + # Microsoft lib, so override with the ar-lib wrapper script. + # FIXME: It is wrong to rewrite AR. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__AR in this case, + # and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or something + # similar. + AR="$am_aux_dir/ar-lib $AR" + ;; +unknown) + m4_default([$1], + [AC_MSG_ERROR([could not determine $AR interface])]) + ;; +esac +AC_SUBST([AR])dnl +]) + # AM_AUX_DIR_EXPAND -*- Autoconf -*- -# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file 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. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets -# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to -# `$srcdir', `$srcdir/..', or `$srcdir/../..'. +# $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to +# '$srcdir', '$srcdir/..', or '$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and @@ -240,7 +305,7 @@ # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually -# harmless because $srcdir is `.', but things will broke when you +# harmless because $srcdir is '.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, @@ -266,22 +331,19 @@ # AM_CONDITIONAL -*- Autoconf -*- -# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 -# Free Software Foundation, Inc. +# Copyright (C) 1997-2013 Free Software Foundation, Inc. # # This file 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. -# serial 9 - # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], -[AC_PREREQ(2.52)dnl - ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], - [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +[AC_PREREQ([2.52])dnl + m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl @@ -300,16 +362,14 @@ Usually this means the macro was only invoked conditionally.]]) fi])]) -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 -# Free Software Foundation, Inc. +# Copyright (C) 1999-2013 Free Software Foundation, Inc. # # This file 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. -# serial 10 -# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be +# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing @@ -319,7 +379,7 @@ # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. -# NAME is "CC", "CXX", "GCJ", or "OBJC". +# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was @@ -332,12 +392,13 @@ AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl -ifelse([$1], CC, [depcc="$CC" am_compiler_list=], - [$1], CXX, [depcc="$CXX" am_compiler_list=], - [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], - [$1], UPC, [depcc="$UPC" am_compiler_list=], - [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], - [depcc="$$1" am_compiler_list=]) +m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], + [$1], [CXX], [depcc="$CXX" am_compiler_list=], + [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], + [$1], [UPC], [depcc="$UPC" am_compiler_list=], + [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], @@ -345,8 +406,9 @@ # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. @@ -385,16 +447,16 @@ : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch sub/conftst$i.h + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - # We check with `-c' and `-o' for the sake of the "dashmstdout" + # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in @@ -403,16 +465,16 @@ test "$am__universal" = false || continue ;; nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; - msvisualcpp | msvcmsys) - # This compiler won't grok `-c -o', but also, the minuso test has + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} @@ -460,7 +522,7 @@ # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. -# This macro is AC_REQUIREd in _AM_DEPENDENCIES +# This macro is AC_REQUIREd in _AM_DEPENDENCIES. AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl @@ -470,34 +532,39 @@ # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], -[AC_ARG_ENABLE(dependency-tracking, -[ --disable-dependency-tracking speeds up one-time build - --enable-dependency-tracking do not reject slow dependency extractors]) +[AC_ARG_ENABLE([dependency-tracking], [dnl +AS_HELP_STRING( + [--enable-dependency-tracking], + [do not reject slow dependency extractors]) +AS_HELP_STRING( + [--disable-dependency-tracking], + [speeds up one-time build])]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' + am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl +AC_SUBST([am__nodep])dnl +_AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 -# Free Software Foundation, Inc. +# Copyright (C) 1999-2013 Free Software Foundation, Inc. # # This file 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. -#serial 5 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ - # Autoconf 2.62 quotes --file arguments for eval, but not when files + # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in @@ -510,7 +577,7 @@ # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named `Makefile.in', but + # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. @@ -522,21 +589,19 @@ continue fi # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running `make'. + # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "am__include" && continue + test -z "$am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` @@ -554,7 +619,7 @@ # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking -# is enabled. FIXME. This creates each `.P' file that we will +# is enabled. FIXME. This creates each '.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], @@ -562,32 +627,23 @@ [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) -# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 -# Free Software Foundation, Inc. -# -# This file 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. - -# serial 8 - -# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. -AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) - # Do all the work for Automake. -*- Autoconf -*- -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006, 2008, 2009 Free Software Foundation, Inc. +# Copyright (C) 1996-2013 Free Software Foundation, Inc. # # This file 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. -# serial 16 - # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. +dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. +m4_define([AC_PROG_CC], +m4_defn([AC_PROG_CC]) +[_AM_PROG_CC_C_O +]) + # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- @@ -600,7 +656,7 @@ # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], -[AC_PREREQ([2.62])dnl +[AC_PREREQ([2.65])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl @@ -629,31 +685,40 @@ # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], -[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl +[AC_DIAGNOSE([obsolete], + [$0: two- and three-arguments forms are deprecated.]) +m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. -m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, +m4_if( + m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), + [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, -[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) - AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl +[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) + AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl -AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) -AM_MISSING_PROG(AUTOCONF, autoconf) -AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) -AM_MISSING_PROG(AUTOHEADER, autoheader) -AM_MISSING_PROG(MAKEINFO, makeinfo) +AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) +AM_MISSING_PROG([AUTOCONF], [autoconf]) +AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) +AM_MISSING_PROG([AUTOHEADER], [autoheader]) +AM_MISSING_PROG([MAKEINFO], [makeinfo]) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl -AC_REQUIRE([AM_PROG_MKDIR_P])dnl +AC_REQUIRE([AC_PROG_MKDIR_P])dnl +# For better backward compatibility. To be removed once Automake 1.9.x +# dies out for good. For more background, see: +# +# +AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl @@ -664,34 +729,78 @@ [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], - [_AM_DEPENDENCIES(CC)], - [define([AC_PROG_CC], - defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl + [_AM_DEPENDENCIES([CC])], + [m4_define([AC_PROG_CC], + m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], - [_AM_DEPENDENCIES(CXX)], - [define([AC_PROG_CXX], - defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl + [_AM_DEPENDENCIES([CXX])], + [m4_define([AC_PROG_CXX], + m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], - [_AM_DEPENDENCIES(OBJC)], - [define([AC_PROG_OBJC], - defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl + [_AM_DEPENDENCIES([OBJC])], + [m4_define([AC_PROG_OBJC], + m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], + [_AM_DEPENDENCIES([OBJCXX])], + [m4_define([AC_PROG_OBJCXX], + m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) -_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl -dnl The `parallel-tests' driver may need to know about EXEEXT, so add the -dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro -dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. +AC_REQUIRE([AM_SILENT_RULES])dnl +dnl The testsuite driver may need to know about EXEEXT, so add the +dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This +dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl -]) -dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not +# POSIX will say in a future version that running "rm -f" with no argument +# is OK; and we want to be able to make that assumption in our Makefile +# recipes. So use an aggressive probe to check that the usage we want is +# actually supported "in the wild" to an acceptable degree. +# See automake bug#10828. +# To make any issue more visible, cause the running configure to be aborted +# by default if the 'rm' program in use doesn't match our expectations; the +# user can still override this though. +if rm -f && rm -fr && rm -rf; then : OK; else + cat >&2 <<'END' +Oops! + +Your 'rm' program seems unable to run without file operands specified +on the command line, even when the '-f' option is present. This is contrary +to the behaviour of most rm programs out there, and not conforming with +the upcoming POSIX standard: + +Please tell bug-automake@gnu.org about your system, including the value +of your $PATH and any error possibly output before this message. This +can help us improve future automake versions. + +END + if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then + echo 'Configuration will proceed anyway, since you have set the' >&2 + echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 + echo >&2 + else + cat >&2 <<'END' +Aborting the configuration process, to ensure you take notice of the issue. + +You can download and install GNU coreutils to get an 'rm' implementation +that behaves properly: . + +If you want to complete the configuration process using your problematic +'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM +to "yes", and re-run configure. + +END + AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) + fi +fi]) + +dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) - # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. @@ -713,7 +822,7 @@ done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) -# Copyright (C) 2001, 2003, 2005, 2008 Free Software Foundation, Inc. +# Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -732,16 +841,14 @@ install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi -AC_SUBST(install_sh)]) +AC_SUBST([install_sh])]) -# Copyright (C) 2003, 2005 Free Software Foundation, Inc. +# Copyright (C) 2003-2013 Free Software Foundation, Inc. # # This file 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. -# serial 2 - # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], @@ -757,14 +864,12 @@ # Check to see how 'make' treats includes. -*- Autoconf -*- -# Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc. +# Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file 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. -# serial 4 - # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. @@ -782,7 +887,7 @@ _am_result=none # First try GNU make style include. echo "include confinc" > confmf -# Ignore all kinds of additional output from `make'. +# Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include @@ -807,52 +912,14 @@ rm -f confinc confmf ]) -# Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2008 -# Free Software Foundation, Inc. -# -# This file 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. - -# serial 6 - -# AM_PROG_CC_C_O -# -------------- -# Like AC_PROG_CC_C_O, but changed for automake. -AC_DEFUN([AM_PROG_CC_C_O], -[AC_REQUIRE([AC_PROG_CC_C_O])dnl -AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -AC_REQUIRE_AUX_FILE([compile])dnl -# FIXME: we rely on the cache variable name because -# there is no other way. -set dummy $CC -am_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']` -eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o -if test "$am_t" != yes; then - # Losing compiler, so override with the script. - # FIXME: It is wrong to rewrite CC. - # But if we don't then we get into trouble of one sort or another. - # A longer-term fix would be to have automake use am__CC in this case, - # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" - CC="$am_aux_dir/compile $CC" -fi -dnl Make sure AC_PROG_CC is never called again, or it will override our -dnl setting of CC. -m4_define([AC_PROG_CC], - [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])]) -]) - # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- -# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 -# Free Software Foundation, Inc. +# Copyright (C) 1997-2013 Free Software Foundation, Inc. # # This file 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. -# serial 6 - # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], @@ -860,11 +927,10 @@ $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) - # AM_MISSING_HAS_RUN # ------------------ -# Define MISSING if not defined so far and test if it supports --run. -# If it does, set am_missing_run to use it, otherwise, to nothing. +# Define MISSING if not defined so far and test if it is modern enough. +# If it is, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl @@ -877,63 +943,64 @@ esac fi # Use eval to expand $SHELL -if eval "$MISSING --run true"; then - am_missing_run="$MISSING --run " +if eval "$MISSING --is-lightweight"; then + am_missing_run="$MISSING " else am_missing_run= - AC_MSG_WARN([`missing' script is too old or missing]) + AC_MSG_WARN(['missing' script is too old or missing]) fi ]) -# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# -*- Autoconf -*- +# Obsolete and "removed" macros, that must however still report explicit +# error messages when used, to smooth transition. +# +# Copyright (C) 1996-2013 Free Software Foundation, Inc. # # This file 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. -# AM_PROG_MKDIR_P -# --------------- -# Check for `mkdir -p'. -AC_DEFUN([AM_PROG_MKDIR_P], -[AC_PREREQ([2.60])dnl -AC_REQUIRE([AC_PROG_MKDIR_P])dnl -dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, -dnl while keeping a definition of mkdir_p for backward compatibility. -dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. -dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of -dnl Makefile.ins that do not define MKDIR_P, so we do our own -dnl adjustment using top_builddir (which is defined more often than -dnl MKDIR_P). -AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl -case $mkdir_p in - [[\\/$]]* | ?:[[\\/]]*) ;; - */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; -esac -]) +AC_DEFUN([AM_CONFIG_HEADER], +[AC_DIAGNOSE([obsolete], +['$0': this macro is obsolete. +You should use the 'AC][_CONFIG_HEADERS' macro instead.])dnl +AC_CONFIG_HEADERS($@)]) + +AC_DEFUN([AM_PROG_CC_STDC], +[AC_PROG_CC +am_cv_prog_cc_stdc=$ac_cv_prog_cc_stdc +AC_DIAGNOSE([obsolete], +['$0': this macro is obsolete. +You should simply use the 'AC][_PROG_CC' macro instead. +Also, your code should no longer depend upon 'am_cv_prog_cc_stdc', +but upon 'ac_cv_prog_cc_stdc'.])]) + +AC_DEFUN([AM_C_PROTOTYPES], + [AC_FATAL([automatic de-ANSI-fication support has been removed])]) +AU_DEFUN([fp_C_PROTOTYPES], [AM_C_PROTOTYPES]) # Helper functions for option handling. -*- Autoconf -*- -# Copyright (C) 2001, 2002, 2003, 2005, 2008 Free Software Foundation, Inc. +# Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file 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. -# serial 4 - # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) -# ------------------------------ +# -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], -[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) +[m4_define(_AM_MANGLE_OPTION([$1]), [1])]) # _AM_SET_OPTIONS(OPTIONS) -# ---------------------------------- +# ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) @@ -944,24 +1011,82 @@ AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) -# Check to make sure that the build environment is sane. -*- Autoconf -*- +# Copyright (C) 1999-2013 Free Software Foundation, Inc. +# +# This file 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. -# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 -# Free Software Foundation, Inc. +# _AM_PROG_CC_C_O +# --------------- +# Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC +# to automatically call this. +AC_DEFUN([_AM_PROG_CC_C_O], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([compile])dnl +AC_LANG_PUSH([C])dnl +AC_CACHE_CHECK( + [whether $CC understands -c and -o together], + [am_cv_prog_cc_c_o], + [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) + # Make sure it works both with $CC and with simple cc. + # Following AC_PROG_CC_C_O, we do the test twice because some + # compilers refuse to overwrite an existing .o file with -o, + # though they will create one. + am_cv_prog_cc_c_o=yes + for am_i in 1 2; do + if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ + && test -f conftest2.$ac_objext; then + : OK + else + am_cv_prog_cc_c_o=no + break + fi + done + rm -f core conftest* + unset am_i]) +if test "$am_cv_prog_cc_c_o" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi +AC_LANG_POP([C])]) + +# For backward compatibility. +AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) + +# Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file 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. -# serial 5 +# AM_RUN_LOG(COMMAND) +# ------------------- +# Run COMMAND, save the exit status in ac_status, and log it. +# (This has been adapted from Autoconf's _AC_RUN_LOG macro.) +AC_DEFUN([AM_RUN_LOG], +[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD + ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + (exit $ac_status); }]) + +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996-2013 Free Software Foundation, Inc. +# +# This file 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. # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) -# Just in case -sleep 1 -echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' @@ -972,32 +1097,40 @@ esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) - AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; + AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; esac -# Do `set' in a subshell so we don't clobber the current shell's +# Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( - set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` - if test "$[*]" = "X"; then - # -L didn't work. - set X `ls -t "$srcdir/configure" conftest.file` - fi - rm -f conftest.file - if test "$[*]" != "X $srcdir/configure conftest.file" \ - && test "$[*]" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken -alias in your environment]) - fi - + am_has_slept=no + for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken + alias in your environment]) + fi + if test "$[2]" = conftest.file || test $am_try -eq 2; then + break + fi + # Just in case. + sleep 1 + am_has_slept=yes + done test "$[2]" = conftest.file ) then @@ -1007,36 +1140,85 @@ AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi -AC_MSG_RESULT(yes)]) +AC_MSG_RESULT([yes]) +# If we didn't sleep, we still need to ensure time stamps of config.status and +# generated files are strictly newer. +am_sleep_pid= +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & + am_sleep_pid=$! +fi +AC_CONFIG_COMMANDS_PRE( + [AC_MSG_CHECKING([that generated files are newer than configure]) + if test -n "$am_sleep_pid"; then + # Hide warnings about reused PIDs. + wait $am_sleep_pid 2>/dev/null + fi + AC_MSG_RESULT([done])]) +rm -f conftest.file +]) -# Copyright (C) 2009 Free Software Foundation, Inc. +# Copyright (C) 2009-2013 Free Software Foundation, Inc. # # This file 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. -# serial 1 - # AM_SILENT_RULES([DEFAULT]) # -------------------------- # Enable less verbose build rules; with the default set to DEFAULT -# (`yes' being less verbose, `no' or empty being verbose). +# ("yes" being less verbose, "no" or empty being verbose). AC_DEFUN([AM_SILENT_RULES], -[AC_ARG_ENABLE([silent-rules], -[ --enable-silent-rules less verbose build output (undo: `make V=1') - --disable-silent-rules verbose build output (undo: `make V=0')]) -case $enable_silent_rules in -yes) AM_DEFAULT_VERBOSITY=0;; -no) AM_DEFAULT_VERBOSITY=1;; -*) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; +[AC_ARG_ENABLE([silent-rules], [dnl +AS_HELP_STRING( + [--enable-silent-rules], + [less verbose build output (undo: "make V=1")]) +AS_HELP_STRING( + [--disable-silent-rules], + [verbose build output (undo: "make V=0")])dnl +]) +case $enable_silent_rules in @%:@ ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac +dnl +dnl A few 'make' implementations (e.g., NonStop OS and NextStep) +dnl do not support nested variable expansions. +dnl See automake bug#9928 and bug#10237. +am_make=${MAKE-make} +AC_CACHE_CHECK([whether $am_make supports nested variables], + [am_cv_make_support_nested_variables], + [if AS_ECHO([['TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi]) +if test $am_cv_make_support_nested_variables = yes; then + dnl Using '$V' instead of '$(V)' breaks IRIX make. + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AC_SUBST([AM_V])dnl +AM_SUBST_NOTMAKE([AM_V])dnl +AC_SUBST([AM_DEFAULT_V])dnl +AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) -# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1044,34 +1226,32 @@ # AM_PROG_INSTALL_STRIP # --------------------- -# One issue with vendor `install' (even GNU) is that you can't +# One issue with vendor 'install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we -# always use install-sh in `make install-strip', and initialize +# always use install-sh in "make install-strip", and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl -# Installed binaries are usually stripped using `strip' when the user -# run `make install-strip'. However `strip' might not be the right +# Installed binaries are usually stripped using 'strip' when the user +# run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake -# will honor the `STRIP' environment variable to overrule this program. -dnl Don't test for $cross_compiling = yes, because it might be `maybe'. +# will honor the 'STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) -# Copyright (C) 2006, 2008 Free Software Foundation, Inc. +# Copyright (C) 2006-2013 Free Software Foundation, Inc. # # This file 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. -# serial 2 - # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. @@ -1079,24 +1259,22 @@ AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) -# --------------------------- +# -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- -# Copyright (C) 2004, 2005 Free Software Foundation, Inc. +# Copyright (C) 2004-2013 Free Software Foundation, Inc. # # This file 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. -# serial 2 - # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. -# FORMAT should be one of `v7', `ustar', or `pax'. +# FORMAT should be one of 'v7', 'ustar', or 'pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory @@ -1106,77 +1284,115 @@ # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar +# AC_DEFUN([_AM_PROG_TAR], -[# Always define AMTAR for backward compatibility. -AM_MISSING_PROG([AMTAR], [tar]) -m4_if([$1], [v7], - [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], - [m4_case([$1], [ustar],, [pax],, - [m4_fatal([Unknown tar format])]) -AC_MSG_CHECKING([how to create a $1 tar archive]) -# Loop over all known methods to create a tar archive until one works. +[# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AC_SUBST([AMTAR], ['$${TAR-tar}']) + +# We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' -_am_tools=${am_cv_prog_tar_$1-$_am_tools} -# Do not fold the above two line into one, because Tru64 sh and -# Solaris sh will not grok spaces in the rhs of `-'. -for _am_tool in $_am_tools -do - case $_am_tool in - gnutar) - for _am_tar in tar gnutar gtar; - do - AM_RUN_LOG([$_am_tar --version]) && break - done - am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' - am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' - am__untar="$_am_tar -xf -" - ;; - plaintar) - # Must skip GNU tar: if it does not support --format= it doesn't create - # ustar tarball either. - (tar --version) >/dev/null 2>&1 && continue - am__tar='tar chf - "$$tardir"' - am__tar_='tar chf - "$tardir"' - am__untar='tar xf -' - ;; - pax) - am__tar='pax -L -x $1 -w "$$tardir"' - am__tar_='pax -L -x $1 -w "$tardir"' - am__untar='pax -r' - ;; - cpio) - am__tar='find "$$tardir" -print | cpio -o -H $1 -L' - am__tar_='find "$tardir" -print | cpio -o -H $1 -L' - am__untar='cpio -i -H $1 -d' - ;; - none) - am__tar=false - am__tar_=false - am__untar=false - ;; - esac - # If the value was cached, stop now. We just wanted to have am__tar - # and am__untar set. - test -n "${am_cv_prog_tar_$1}" && break +m4_if([$1], [v7], + [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], - # tar/untar a dummy directory, and stop if the command works - rm -rf conftest.dir - mkdir conftest.dir - echo GrepMe > conftest.dir/file - AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + [m4_case([$1], + [ustar], + [# The POSIX 1988 'ustar' format is defined with fixed-size fields. + # There is notably a 21 bits limit for the UID and the GID. In fact, + # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 + # and bug#13588). + am_max_uid=2097151 # 2^21 - 1 + am_max_gid=$am_max_uid + # The $UID and $GID variables are not portable, so we need to resort + # to the POSIX-mandated id(1) utility. Errors in the 'id' calls + # below are definitely unexpected, so allow the users to see them + # (that is, avoid stderr redirection). + am_uid=`id -u || echo unknown` + am_gid=`id -g || echo unknown` + AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) + if test $am_uid -le $am_max_uid; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + _am_tools=none + fi + AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) + if test $am_gid -le $am_max_gid; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + _am_tools=none + fi], + + [pax], + [], + + [m4_fatal([Unknown tar format])]) + + AC_MSG_CHECKING([how to create a $1 tar archive]) + + # Go ahead even if we have the value already cached. We do so because we + # need to set the values for the 'am__tar' and 'am__untar' variables. + _am_tools=${am_cv_prog_tar_$1-$_am_tools} + + for _am_tool in $_am_tools; do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works. + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar /dev/null 2>&1 && break + fi + done rm -rf conftest.dir - if test -s conftest.tar; then - AM_RUN_LOG([$am__untar /dev/null 2>&1 && break - fi -done -rm -rf conftest.dir -AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) -AC_MSG_RESULT([$am_cv_prog_tar_$1])]) + AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) + AC_MSG_RESULT([$am_cv_prog_tar_$1])]) + AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR -m4_include([config/debug.m4]) diff -Nru emu8051-1.1.1/AUTHORS emu8051-2.0.1/AUTHORS --- emu8051-1.1.1/AUTHORS 2011-10-29 21:06:32.000000000 +0000 +++ emu8051-2.0.1/AUTHORS 2014-03-22 18:25:51.000000000 +0000 @@ -1,8 +1,23 @@ +Original authors of emu8051: -Hugo Villeneuve + Hugo Villeneuve + Jonathan St-André + Pascal Fecteau + Jimmy Ringuette -Jonathan St-André -Pascal Fecteau +Actual maintainer: -Jimmy Ringuette + Hugo Villeneuve + + +Debian package maintainer: + + Bhavani Shankar + + +Additional contributors / bugs fixing: + + Anthony Liu + Pierre Ferrari + Tobias Diedrich diff -Nru emu8051-1.1.1/autogen.sh emu8051-2.0.1/autogen.sh --- emu8051-1.1.1/autogen.sh 2011-10-29 21:06:32.000000000 +0000 +++ emu8051-2.0.1/autogen.sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,68 +0,0 @@ -#!/bin/sh -# autogen.sh -- Use this script to create generated files from the SVN distribution -# Taken from glib CVS - -PROJECT=Emu8051 -TEST_TYPE=-f -TEST_FILE=src/cpu8051.c - -ACLOCAL_FLAGS="${ACLOCAL_FLAGS} -I config" - -srcdir=`dirname $0` -test -z "$srcdir" && srcdir=. - -ORIGDIR=`pwd` -cd ${srcdir} - -DIE=0 - -(autoconf --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "You must have autoconf installed to compile $PROJECT." - echo "Download the appropriate package for your distribution," - echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/" - DIE=1 -} - -(automake --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "You must have automake installed to compile $PROJECT." - echo "Get ftp://sourceware.cygnus.com/pub/automake/automake-1.4.tar.gz" - echo "(or a newer version if it is available)" - DIE=1 -} - -(libtoolize --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "You must have libtool installed to compile $PROJECT." - echo "Visit http://www.gnu.org/software/libtool/ for more information." - DIE=1 -} - -if test "${DIE}" -eq 1; then - exit 1 -fi - -test ${TEST_TYPE} ${TEST_FILE} || { - echo "You must run this script in the top-level $PROJECT directory" - exit 1 -} - -case ${CC} in - *xlc | *xlc\ * | *lcc | *lcc\ *) am_opt=--include-deps;; -esac - -aclocal ${ACLOCAL_FLAGS} - -#libtoolize --force --copy - -# Optionally feature autoheader -(autoheader --version) < /dev/null > /dev/null 2>&1 && autoheader - -automake --add-missing --copy ${am_opt} - -autoconf - -cd ${ORIGDIR} - -rm -rf autom4te.cache diff -Nru emu8051-1.1.1/build-aux/ar-lib emu8051-2.0.1/build-aux/ar-lib --- emu8051-1.1.1/build-aux/ar-lib 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/build-aux/ar-lib 2014-03-22 18:26:16.000000000 +0000 @@ -0,0 +1,270 @@ +#! /bin/sh +# Wrapper for Microsoft lib.exe + +me=ar-lib +scriptversion=2012-03-01.08; # UTC + +# Copyright (C) 2010-2013 Free Software Foundation, Inc. +# Written by Peter Rosin . +# +# This program is free software; you can redistribute 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, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + + +# func_error message +func_error () +{ + echo "$me: $1" 1>&2 + exit 1 +} + +file_conv= + +# func_file_conv build_file +# Convert a $build file to $host form and store it in $file +# Currently only supports Windows hosts. +func_file_conv () +{ + file=$1 + case $file in + / | /[!/]*) # absolute file, and not a UNC file + if test -z "$file_conv"; then + # lazily determine how to convert abs files + case `uname -s` in + MINGW*) + file_conv=mingw + ;; + CYGWIN*) + file_conv=cygwin + ;; + *) + file_conv=wine + ;; + esac + fi + case $file_conv in + mingw) + file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` + ;; + cygwin) + file=`cygpath -m "$file" || echo "$file"` + ;; + wine) + file=`winepath -w "$file" || echo "$file"` + ;; + esac + ;; + esac +} + +# func_at_file at_file operation archive +# Iterate over all members in AT_FILE performing OPERATION on ARCHIVE +# for each of them. +# When interpreting the content of the @FILE, do NOT use func_file_conv, +# since the user would need to supply preconverted file names to +# binutils ar, at least for MinGW. +func_at_file () +{ + operation=$2 + archive=$3 + at_file_contents=`cat "$1"` + eval set x "$at_file_contents" + shift + + for member + do + $AR -NOLOGO $operation:"$member" "$archive" || exit $? + done +} + +case $1 in + '') + func_error "no command. Try '$0 --help' for more information." + ;; + -h | --h*) + cat <. +# +# This program is free software; you can redistribute 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, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +nl=' +' + +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent tools from complaining about whitespace usage. +IFS=" "" $nl" + +file_conv= + +# func_file_conv build_file lazy +# Convert a $build file to $host form and store it in $file +# Currently only supports Windows hosts. If the determined conversion +# type is listed in (the comma separated) LAZY, no conversion will +# take place. +func_file_conv () +{ + file=$1 + case $file in + / | /[!/]*) # absolute file, and not a UNC file + if test -z "$file_conv"; then + # lazily determine how to convert abs files + case `uname -s` in + MINGW*) + file_conv=mingw + ;; + CYGWIN*) + file_conv=cygwin + ;; + *) + file_conv=wine + ;; + esac + fi + case $file_conv/,$2, in + *,$file_conv,*) + ;; + mingw/*) + file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` + ;; + cygwin/*) + file=`cygpath -m "$file" || echo "$file"` + ;; + wine/*) + file=`winepath -w "$file" || echo "$file"` + ;; + esac + ;; + esac +} + +# func_cl_dashL linkdir +# Make cl look for libraries in LINKDIR +func_cl_dashL () +{ + func_file_conv "$1" + if test -z "$lib_path"; then + lib_path=$file + else + lib_path="$lib_path;$file" + fi + linker_opts="$linker_opts -LIBPATH:$file" +} + +# func_cl_dashl library +# Do a library search-path lookup for cl +func_cl_dashl () +{ + lib=$1 + found=no + save_IFS=$IFS + IFS=';' + for dir in $lib_path $LIB + do + IFS=$save_IFS + if $shared && test -f "$dir/$lib.dll.lib"; then + found=yes + lib=$dir/$lib.dll.lib + break + fi + if test -f "$dir/$lib.lib"; then + found=yes + lib=$dir/$lib.lib + break + fi + if test -f "$dir/lib$lib.a"; then + found=yes + lib=$dir/lib$lib.a + break + fi + done + IFS=$save_IFS + + if test "$found" != yes; then + lib=$lib.lib + fi +} + +# func_cl_wrapper cl arg... +# Adjust compile command to suit cl +func_cl_wrapper () +{ + # Assume a capable shell + lib_path= + shared=: + linker_opts= + for arg + do + if test -n "$eat"; then + eat= + else + case $1 in + -o) + # configure might choose to run compile as 'compile cc -o foo foo.c'. + eat=1 + case $2 in + *.o | *.[oO][bB][jJ]) + func_file_conv "$2" + set x "$@" -Fo"$file" + shift + ;; + *) + func_file_conv "$2" + set x "$@" -Fe"$file" + shift + ;; + esac + ;; + -I) + eat=1 + func_file_conv "$2" mingw + set x "$@" -I"$file" + shift + ;; + -I*) + func_file_conv "${1#-I}" mingw + set x "$@" -I"$file" + shift + ;; + -l) + eat=1 + func_cl_dashl "$2" + set x "$@" "$lib" + shift + ;; + -l*) + func_cl_dashl "${1#-l}" + set x "$@" "$lib" + shift + ;; + -L) + eat=1 + func_cl_dashL "$2" + ;; + -L*) + func_cl_dashL "${1#-L}" + ;; + -static) + shared=false + ;; + -Wl,*) + arg=${1#-Wl,} + save_ifs="$IFS"; IFS=',' + for flag in $arg; do + IFS="$save_ifs" + linker_opts="$linker_opts $flag" + done + IFS="$save_ifs" + ;; + -Xlinker) + eat=1 + linker_opts="$linker_opts $2" + ;; + -*) + set x "$@" "$1" + shift + ;; + *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) + func_file_conv "$1" + set x "$@" -Tp"$file" + shift + ;; + *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) + func_file_conv "$1" mingw + set x "$@" "$file" + shift + ;; + *) + set x "$@" "$1" + shift + ;; + esac + fi + shift + done + if test -n "$linker_opts"; then + linker_opts="-link$linker_opts" + fi + exec "$@" $linker_opts + exit 1 +} + +eat= + +case $1 in + '') + echo "$0: No command. Try '$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: compile [--help] [--version] PROGRAM [ARGS] + +Wrapper for compilers which do not understand '-c -o'. +Remove '-o dest.o' from ARGS, run PROGRAM with the remaining +arguments, and rename the output as expected. + +If you are trying to build a whole package this is not the +right script to run: please start by reading the file 'INSTALL'. + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "compile $scriptversion" + exit $? + ;; + cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) + func_cl_wrapper "$@" # Doesn't return... + ;; +esac + +ofile= +cfile= + +for arg +do + if test -n "$eat"; then + eat= + else + case $1 in + -o) + # configure might choose to run compile as 'compile cc -o foo foo.c'. + # So we strip '-o arg' only if arg is an object. + eat=1 + case $2 in + *.o | *.obj) + ofile=$2 + ;; + *) + set x "$@" -o "$2" + shift + ;; + esac + ;; + *.c) + cfile=$1 + set x "$@" "$1" + shift + ;; + *) + set x "$@" "$1" + shift + ;; + esac + fi + shift +done + +if test -z "$ofile" || test -z "$cfile"; then + # If no '-o' option was seen then we might have been invoked from a + # pattern rule where we don't need one. That is ok -- this is a + # normal compilation that the losing compiler can handle. If no + # '.c' file was seen then we are probably linking. That is also + # ok. + exec "$@" +fi + +# Name of file we expect compiler to create. +cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` + +# Create the lock directory. +# Note: use '[/\\:.-]' here to ensure that we don't use the same name +# that we are using for the .o file. Also, base the name on the expected +# object file name, since that is what matters with a parallel build. +lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d +while true; do + if mkdir "$lockdir" >/dev/null 2>&1; then + break + fi + sleep 1 +done +# FIXME: race condition here if user kills between mkdir and trap. +trap "rmdir '$lockdir'; exit 1" 1 2 15 + +# Run the compile. +"$@" +ret=$? + +if test -f "$cofile"; then + test "$cofile" = "$ofile" || mv "$cofile" "$ofile" +elif test -f "${cofile}bj"; then + test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" +fi + +rmdir "$lockdir" +exit $ret + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff -Nru emu8051-1.1.1/build-aux/depcomp emu8051-2.0.1/build-aux/depcomp --- emu8051-1.1.1/build-aux/depcomp 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/build-aux/depcomp 2014-03-22 18:26:16.000000000 +0000 @@ -0,0 +1,791 @@ +#! /bin/sh +# depcomp - compile a program generating dependencies as side-effects + +scriptversion=2013-05-30.07; # UTC + +# Copyright (C) 1999-2013 Free Software Foundation, Inc. + +# This program is free software; you can redistribute 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, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Alexandre Oliva . + +case $1 in + '') + echo "$0: No command. Try '$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: depcomp [--help] [--version] PROGRAM [ARGS] + +Run PROGRAMS ARGS to compile a file, generating dependencies +as side-effects. + +Environment variables: + depmode Dependency tracking mode. + source Source file read by 'PROGRAMS ARGS'. + object Object file output by 'PROGRAMS ARGS'. + DEPDIR directory where to store dependencies. + depfile Dependency file to output. + tmpdepfile Temporary file to use when outputting dependencies. + libtool Whether libtool is used (yes/no). + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "depcomp $scriptversion" + exit $? + ;; +esac + +# Get the directory component of the given path, and save it in the +# global variables '$dir'. Note that this directory component will +# be either empty or ending with a '/' character. This is deliberate. +set_dir_from () +{ + case $1 in + */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; + *) dir=;; + esac +} + +# Get the suffix-stripped basename of the given path, and save it the +# global variable '$base'. +set_base_from () +{ + base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` +} + +# If no dependency file was actually created by the compiler invocation, +# we still have to create a dummy depfile, to avoid errors with the +# Makefile "include basename.Plo" scheme. +make_dummy_depfile () +{ + echo "#dummy" > "$depfile" +} + +# Factor out some common post-processing of the generated depfile. +# Requires the auxiliary global variable '$tmpdepfile' to be set. +aix_post_process_depfile () +{ + # If the compiler actually managed to produce a dependency file, + # post-process it. + if test -f "$tmpdepfile"; then + # Each line is of the form 'foo.o: dependency.h'. + # Do two passes, one to just change these to + # $object: dependency.h + # and one to simply output + # dependency.h: + # which is needed to avoid the deleted-header problem. + { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" + sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" + } > "$depfile" + rm -f "$tmpdepfile" + else + make_dummy_depfile + fi +} + +# A tabulation character. +tab=' ' +# A newline character. +nl=' +' +# Character ranges might be problematic outside the C locale. +# These definitions help. +upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ +lower=abcdefghijklmnopqrstuvwxyz +digits=0123456789 +alpha=${upper}${lower} + +if test -z "$depmode" || test -z "$source" || test -z "$object"; then + echo "depcomp: Variables source, object and depmode must be set" 1>&2 + exit 1 +fi + +# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. +depfile=${depfile-`echo "$object" | + sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} + +rm -f "$tmpdepfile" + +# Avoid interferences from the environment. +gccflag= dashmflag= + +# Some modes work just like other modes, but use different flags. We +# parameterize here, but still list the modes in the big case below, +# to make depend.m4 easier to write. Note that we *cannot* use a case +# here, because this file can only contain one case statement. +if test "$depmode" = hp; then + # HP compiler uses -M and no extra arg. + gccflag=-M + depmode=gcc +fi + +if test "$depmode" = dashXmstdout; then + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout +fi + +cygpath_u="cygpath -u -f -" +if test "$depmode" = msvcmsys; then + # This is just like msvisualcpp but w/o cygpath translation. + # Just convert the backslash-escaped backslashes to single forward + # slashes to satisfy depend.m4 + cygpath_u='sed s,\\\\,/,g' + depmode=msvisualcpp +fi + +if test "$depmode" = msvc7msys; then + # This is just like msvc7 but w/o cygpath translation. + # Just convert the backslash-escaped backslashes to single forward + # slashes to satisfy depend.m4 + cygpath_u='sed s,\\\\,/,g' + depmode=msvc7 +fi + +if test "$depmode" = xlc; then + # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. + gccflag=-qmakedep=gcc,-MF + depmode=gcc +fi + +case "$depmode" in +gcc3) +## gcc 3 implements dependency tracking that does exactly what +## we want. Yay! Note: for some reason libtool 1.4 doesn't like +## it if -MD -MP comes after the -MF stuff. Hmm. +## Unfortunately, FreeBSD c89 acceptance of flags depends upon +## the command line argument order; so add the flags where they +## appear in depend2.am. Note that the slowdown incurred here +## affects only configure: in makefiles, %FASTDEP% shortcuts this. + for arg + do + case $arg in + -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; + *) set fnord "$@" "$arg" ;; + esac + shift # fnord + shift # $arg + done + "$@" + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. +## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. +## (see the conditional assignment to $gccflag above). +## There are various ways to get dependency output from gcc. Here's +## why we pick this rather obscure method: +## - Don't want to use -MD because we'd like the dependencies to end +## up in a subdir. Having to rename by hand is ugly. +## (We might end up doing this anyway to support other compilers.) +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like +## -MM, not -M (despite what the docs say). Also, it might not be +## supported by the other compilers which use the 'gcc' depmode. +## - Using -M directly means running the compiler twice (even worse +## than renaming). + if test -z "$gccflag"; then + gccflag=-MD, + fi + "$@" -Wp,"$gccflag$tmpdepfile" + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + # The second -e expression handles DOS-style file names with drive + # letters. + sed -e 's/^[^:]*: / /' \ + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" +## This next piece of magic avoids the "deleted header file" problem. +## The problem is that when a header file which appears in a .P file +## is deleted, the dependency causes make to die (because there is +## typically no way to rebuild the header). We avoid this by adding +## dummy dependencies for each header file. Too bad gcc doesn't do +## this for us directly. +## Some versions of gcc put a space before the ':'. On the theory +## that the space means something, we add a space to the output as +## well. hp depmode also adds that space, but also prefixes the VPATH +## to the object. Take care to not repeat it in the output. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + tr ' ' "$nl" < "$tmpdepfile" \ + | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ + | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +sgi) + if test "$libtool" = yes; then + "$@" "-Wp,-MDupdate,$tmpdepfile" + else + "$@" -MDupdate "$tmpdepfile" + fi + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files + echo "$object : \\" > "$depfile" + # Clip off the initial element (the dependent). Don't try to be + # clever and replace this with sed code, as IRIX sed won't handle + # lines with more than a fixed number of characters (4096 in + # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; + # the IRIX cc adds comments like '#:fec' to the end of the + # dependency line. + tr ' ' "$nl" < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ + | tr "$nl" ' ' >> "$depfile" + echo >> "$depfile" + # The second pass generates a dummy entry for each header file. + tr ' ' "$nl" < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> "$depfile" + else + make_dummy_depfile + fi + rm -f "$tmpdepfile" + ;; + +xlc) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +aix) + # The C for AIX Compiler uses -M and outputs the dependencies + # in a .u file. In older versions, this file always lives in the + # current directory. Also, the AIX compiler puts '$object:' at the + # start of each line; $object doesn't have directory information. + # Version 6 uses the directory in both cases. + set_dir_from "$object" + set_base_from "$object" + if test "$libtool" = yes; then + tmpdepfile1=$dir$base.u + tmpdepfile2=$base.u + tmpdepfile3=$dir.libs/$base.u + "$@" -Wc,-M + else + tmpdepfile1=$dir$base.u + tmpdepfile2=$dir$base.u + tmpdepfile3=$dir$base.u + "$@" -M + fi + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + do + test -f "$tmpdepfile" && break + done + aix_post_process_depfile + ;; + +tcc) + # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 + # FIXME: That version still under development at the moment of writing. + # Make that this statement remains true also for stable, released + # versions. + # It will wrap lines (doesn't matter whether long or short) with a + # trailing '\', as in: + # + # foo.o : \ + # foo.c \ + # foo.h \ + # + # It will put a trailing '\' even on the last line, and will use leading + # spaces rather than leading tabs (at least since its commit 0394caf7 + # "Emit spaces for -MD"). + "$@" -MD -MF "$tmpdepfile" + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. + # We have to change lines of the first kind to '$object: \'. + sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" + # And for each line of the second kind, we have to emit a 'dep.h:' + # dummy dependency, to avoid the deleted-header problem. + sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" + rm -f "$tmpdepfile" + ;; + +## The order of this option in the case statement is important, since the +## shell code in configure will try each of these formats in the order +## listed in this file. A plain '-MD' option would be understood by many +## compilers, so we must ensure this comes after the gcc and icc options. +pgcc) + # Portland's C compiler understands '-MD'. + # Will always output deps to 'file.d' where file is the root name of the + # source file under compilation, even if file resides in a subdirectory. + # The object file name does not affect the name of the '.d' file. + # pgcc 10.2 will output + # foo.o: sub/foo.c sub/foo.h + # and will wrap long lines using '\' : + # foo.o: sub/foo.c ... \ + # sub/foo.h ... \ + # ... + set_dir_from "$object" + # Use the source, not the object, to determine the base name, since + # that's sadly what pgcc will do too. + set_base_from "$source" + tmpdepfile=$base.d + + # For projects that build the same source file twice into different object + # files, the pgcc approach of using the *source* file root name can cause + # problems in parallel builds. Use a locking strategy to avoid stomping on + # the same $tmpdepfile. + lockdir=$base.d-lock + trap " + echo '$0: caught signal, cleaning up...' >&2 + rmdir '$lockdir' + exit 1 + " 1 2 13 15 + numtries=100 + i=$numtries + while test $i -gt 0; do + # mkdir is a portable test-and-set. + if mkdir "$lockdir" 2>/dev/null; then + # This process acquired the lock. + "$@" -MD + stat=$? + # Release the lock. + rmdir "$lockdir" + break + else + # If the lock is being held by a different process, wait + # until the winning process is done or we timeout. + while test -d "$lockdir" && test $i -gt 0; do + sleep 1 + i=`expr $i - 1` + done + fi + i=`expr $i - 1` + done + trap - 1 2 13 15 + if test $i -le 0; then + echo "$0: failed to acquire lock after $numtries attempts" >&2 + echo "$0: check lockdir '$lockdir'" >&2 + exit 1 + fi + + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each line is of the form `foo.o: dependent.h', + # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process this invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ + | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp2) + # The "hp" stanza above does not work with aCC (C++) and HP's ia64 + # compilers, which have integrated preprocessors. The correct option + # to use with these is +Maked; it writes dependencies to a file named + # 'foo.d', which lands next to the object file, wherever that + # happens to be. + # Much of this is similar to the tru64 case; see comments there. + set_dir_from "$object" + set_base_from "$object" + if test "$libtool" = yes; then + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir.libs/$base.d + "$@" -Wc,+Maked + else + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir$base.d + "$@" +Maked + fi + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile1" "$tmpdepfile2" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" + # Add 'dependent.h:' lines. + sed -ne '2,${ + s/^ *// + s/ \\*$// + s/$/:/ + p + }' "$tmpdepfile" >> "$depfile" + else + make_dummy_depfile + fi + rm -f "$tmpdepfile" "$tmpdepfile2" + ;; + +tru64) + # The Tru64 compiler uses -MD to generate dependencies as a side + # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # dependencies in 'foo.d' instead, so we check for that too. + # Subdirectories are respected. + set_dir_from "$object" + set_base_from "$object" + + if test "$libtool" = yes; then + # Libtool generates 2 separate objects for the 2 libraries. These + # two compilations output dependencies in $dir.libs/$base.o.d and + # in $dir$base.o.d. We have to check for both files, because + # one of the two compilations can be disabled. We should prefer + # $dir$base.o.d over $dir.libs/$base.o.d because the latter is + # automatically cleaned when .libs/ is deleted, while ignoring + # the former would cause a distcleancheck panic. + tmpdepfile1=$dir$base.o.d # libtool 1.5 + tmpdepfile2=$dir.libs/$base.o.d # Likewise. + tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 + "$@" -Wc,-MD + else + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir$base.d + tmpdepfile3=$dir$base.d + "$@" -MD + fi + + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + do + test -f "$tmpdepfile" && break + done + # Same post-processing that is required for AIX mode. + aix_post_process_depfile + ;; + +msvc7) + if test "$libtool" = yes; then + showIncludes=-Wc,-showIncludes + else + showIncludes=-showIncludes + fi + "$@" $showIncludes > "$tmpdepfile" + stat=$? + grep -v '^Note: including file: ' "$tmpdepfile" + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + # The first sed program below extracts the file names and escapes + # backslashes for cygpath. The second sed program outputs the file + # name when reading, but also accumulates all include files in the + # hold buffer in order to output them again at the end. This only + # works with sed implementations that can handle large buffers. + sed < "$tmpdepfile" -n ' +/^Note: including file: *\(.*\)/ { + s//\1/ + s/\\/\\\\/g + p +}' | $cygpath_u | sort -u | sed -n ' +s/ /\\ /g +s/\(.*\)/'"$tab"'\1 \\/p +s/.\(.*\) \\/\1:/ +H +$ { + s/.*/'"$tab"'/ + G + p +}' >> "$depfile" + echo >> "$depfile" # make sure the fragment doesn't end with a backslash + rm -f "$tmpdepfile" + ;; + +msvc7msys) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +#nosideeffect) + # This comment above is used by automake to tell side-effect + # dependency tracking mechanisms from slower ones. + +dashmstdout) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + # Remove '-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + test -z "$dashmflag" && dashmflag=-M + # Require at least two characters before searching for ':' + # in the target name. This is to cope with DOS-style filenames: + # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. + "$@" $dashmflag | + sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process this sed invocation + # correctly. Breaking it into two sed invocations is a workaround. + tr ' ' "$nl" < "$tmpdepfile" \ + | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ + | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +dashXmstdout) + # This case only exists to satisfy depend.m4. It is never actually + # run, as this mode is specially recognized in the preamble. + exit 1 + ;; + +makedepend) + "$@" || exit $? + # Remove any Libtool call + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + # X makedepend + shift + cleared=no eat=no + for arg + do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + if test $eat = yes; then + eat=no + continue + fi + case "$arg" in + -D*|-I*) + set fnord "$@" "$arg"; shift ;; + # Strip any option that makedepend may not understand. Remove + # the object too, otherwise makedepend will parse it as a source file. + -arch) + eat=yes ;; + -*|$object) + ;; + *) + set fnord "$@" "$arg"; shift ;; + esac + done + obj_suffix=`echo "$object" | sed 's/^.*\././'` + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" + rm -f "$depfile" + # makedepend may prepend the VPATH from the source file name to the object. + # No need to regex-escape $object, excess matching of '.' is harmless. + sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process the last invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed '1,2d' "$tmpdepfile" \ + | tr ' ' "$nl" \ + | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ + | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" "$tmpdepfile".bak + ;; + +cpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + # Remove '-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + "$@" -E \ + | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ + -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ + | sed '$ s: \\$::' > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + cat < "$tmpdepfile" >> "$depfile" + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvisualcpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + IFS=" " + for arg + do + case "$arg" in + -o) + shift + ;; + $object) + shift + ;; + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") + set fnord "$@" + shift + shift + ;; + *) + set fnord "$@" "$arg" + shift + shift + ;; + esac + done + "$@" -E 2>/dev/null | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" + echo "$tab" >> "$depfile" + sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvcmsys) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +none) + exec "$@" + ;; + +*) + echo "Unknown depmode $depmode" 1>&2 + exit 1 + ;; +esac + +exit 0 + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff -Nru emu8051-1.1.1/build-aux/install-sh emu8051-2.0.1/build-aux/install-sh --- emu8051-1.1.1/build-aux/install-sh 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/build-aux/install-sh 2014-03-22 18:26:16.000000000 +0000 @@ -0,0 +1,527 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2011-11-20.07; # UTC + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# 'make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. + +nl=' +' +IFS=" "" $nl" + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit=${DOITPROG-} +if test -z "$doit"; then + doit_exec=exec +else + doit_exec=$doit +fi + +# Put in absolute file names if you don't have them in your path; +# or use environment vars. + +chgrpprog=${CHGRPPROG-chgrp} +chmodprog=${CHMODPROG-chmod} +chownprog=${CHOWNPROG-chown} +cmpprog=${CMPPROG-cmp} +cpprog=${CPPROG-cp} +mkdirprog=${MKDIRPROG-mkdir} +mvprog=${MVPROG-mv} +rmprog=${RMPROG-rm} +stripprog=${STRIPPROG-strip} + +posix_glob='?' +initialize_posix_glob=' + test "$posix_glob" != "?" || { + if (set -f) 2>/dev/null; then + posix_glob= + else + posix_glob=: + fi + } +' + +posix_mkdir= + +# Desired mode of installed file. +mode=0755 + +chgrpcmd= +chmodcmd=$chmodprog +chowncmd= +mvcmd=$mvprog +rmcmd="$rmprog -f" +stripcmd= + +src= +dst= +dir_arg= +dst_arg= + +copy_on_change=false +no_target_directory= + +usage="\ +Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: + --help display this help and exit. + --version display version info and exit. + + -c (ignored) + -C install only if different (preserve the last data modification time) + -d create directories instead of installing files. + -g GROUP $chgrpprog installed files to GROUP. + -m MODE $chmodprog installed files to MODE. + -o USER $chownprog installed files to USER. + -s $stripprog installed files. + -t DIRECTORY install into DIRECTORY. + -T report an error if DSTFILE is a directory. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG + RMPROG STRIPPROG +" + +while test $# -ne 0; do + case $1 in + -c) ;; + + -C) copy_on_change=true;; + + -d) dir_arg=true;; + + -g) chgrpcmd="$chgrpprog $2" + shift;; + + --help) echo "$usage"; exit $?;; + + -m) mode=$2 + case $mode in + *' '* | *' '* | *' +'* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + shift;; + + -o) chowncmd="$chownprog $2" + shift;; + + -s) stripcmd=$stripprog;; + + -t) dst_arg=$2 + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + shift;; + + -T) no_target_directory=true;; + + --version) echo "$0 $scriptversion"; exit $?;; + + --) shift + break;; + + -*) echo "$0: invalid option: $1" >&2 + exit 1;; + + *) break;; + esac + shift +done + +if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then + # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dst_arg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dst_arg" + shift # fnord + fi + shift # arg + dst_arg=$arg + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + done +fi + +if test $# -eq 0; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call 'install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +if test -z "$dir_arg"; then + do_exit='(exit $ret); exit $ret' + trap "ret=129; $do_exit" 1 + trap "ret=130; $do_exit" 2 + trap "ret=141; $do_exit" 13 + trap "ret=143; $do_exit" 15 + + # Set umask so as not to create temps with too-generous modes. + # However, 'strip' requires both read and write access to temps. + case $mode in + # Optimize common cases. + *644) cp_umask=133;; + *755) cp_umask=22;; + + *[0-7]) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw='% 200' + fi + cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; + *) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw=,u+rw + fi + cp_umask=$mode$u_plus_rw;; + esac +fi + +for src +do + # Protect names problematic for 'test' and other utilities. + case $src in + -* | [=\(\)!]) src=./$src;; + esac + + if test -n "$dir_arg"; then + dst=$src + dstdir=$dst + test -d "$dstdir" + dstdir_status=$? + else + + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dst_arg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + dst=$dst_arg + + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + if test -n "$no_target_directory"; then + echo "$0: $dst_arg: Is a directory" >&2 + exit 1 + fi + dstdir=$dst + dst=$dstdir/`basename "$src"` + dstdir_status=0 + else + # Prefer dirname, but fall back on a substitute if dirname fails. + dstdir=` + (dirname "$dst") 2>/dev/null || + expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$dst" : 'X\(//\)[^/]' \| \ + X"$dst" : 'X\(//\)$' \| \ + X"$dst" : 'X\(/\)' \| . 2>/dev/null || + echo X"$dst" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q' + ` + + test -d "$dstdir" + dstdir_status=$? + fi + fi + + obsolete_mkdir_used=false + + if test $dstdir_status != 0; then + case $posix_mkdir in + '') + # Create intermediate dirs using mode 755 as modified by the umask. + # This is like FreeBSD 'install' as of 1997-10-28. + umask=`umask` + case $stripcmd.$umask in + # Optimize common cases. + *[2367][2367]) mkdir_umask=$umask;; + .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; + + *[0-7]) + mkdir_umask=`expr $umask + 22 \ + - $umask % 100 % 40 + $umask % 20 \ + - $umask % 10 % 4 + $umask % 2 + `;; + *) mkdir_umask=$umask,go-w;; + esac + + # With -d, create the new directory with the user-specified mode. + # Otherwise, rely on $mkdir_umask. + if test -n "$dir_arg"; then + mkdir_mode=-m$mode + else + mkdir_mode= + fi + + posix_mkdir=false + case $umask in + *[123567][0-7][0-7]) + # POSIX mkdir -p sets u+wx bits regardless of umask, which + # is incompatible with FreeBSD 'install' when (umask & 300) != 0. + ;; + *) + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 + + if (umask $mkdir_umask && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + ls_ld_tmpdir=`ls -ld "$tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/d" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null + fi + trap '' 0;; + esac;; + esac + + if + $posix_mkdir && ( + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + ) + then : + else + + # The umask is ridiculous, or mkdir does not conform to POSIX, + # or it failed possibly due to a race condition. Create the + # directory the slow way, step by step, checking for races as we go. + + case $dstdir in + /*) prefix='/';; + [-=\(\)!]*) prefix='./';; + *) prefix='';; + esac + + eval "$initialize_posix_glob" + + oIFS=$IFS + IFS=/ + $posix_glob set -f + set fnord $dstdir + shift + $posix_glob set +f + IFS=$oIFS + + prefixes= + + for d + do + test X"$d" = X && continue + + prefix=$prefix$d + if test -d "$prefix"; then + prefixes= + else + if $posix_mkdir; then + (umask=$mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break + # Don't fail if two instances are running concurrently. + test -d "$prefix" || exit 1 + else + case $prefix in + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *) qprefix=$prefix;; + esac + prefixes="$prefixes '$qprefix'" + fi + fi + prefix=$prefix/ + done + + if test -n "$prefixes"; then + # Don't fail if two instances are running concurrently. + (umask $mkdir_umask && + eval "\$doit_exec \$mkdirprog $prefixes") || + test -d "$dstdir" || exit 1 + obsolete_mkdir_used=true + fi + fi + fi + + if test -n "$dir_arg"; then + { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && + { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || + test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 + else + + # Make a couple of temp file names in the proper directory. + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + + # Copy the file name to the temp name. + (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && + { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && + { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && + + # If -C, don't bother to copy if it wouldn't change the file. + if $copy_on_change && + old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && + new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && + + eval "$initialize_posix_glob" && + $posix_glob set -f && + set X $old && old=:$2:$4:$5:$6 && + set X $new && new=:$2:$4:$5:$6 && + $posix_glob set +f && + + test "$old" = "$new" && + $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 + then + rm -f "$dsttmp" + else + # Rename the file to the real destination. + $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || + + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + { + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + test ! -f "$dst" || + $doit $rmcmd -f "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } + } || + { echo "$0: cannot unlink or rename $dst" >&2 + (exit 1); exit 1 + } + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dst" + } + fi || exit 1 + + trap '' 0 + fi +done + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff -Nru emu8051-1.1.1/build-aux/missing emu8051-2.0.1/build-aux/missing --- emu8051-1.1.1/build-aux/missing 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/build-aux/missing 2014-03-22 18:26:16.000000000 +0000 @@ -0,0 +1,215 @@ +#! /bin/sh +# Common wrapper for a few potentially missing GNU programs. + +scriptversion=2012-06-26.16; # UTC + +# Copyright (C) 1996-2013 Free Software Foundation, Inc. +# Originally written by Fran,cois Pinard , 1996. + +# This program is free software; you can redistribute 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, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +if test $# -eq 0; then + echo 1>&2 "Try '$0 --help' for more information" + exit 1 +fi + +case $1 in + + --is-lightweight) + # Used by our autoconf macros to check whether the available missing + # script is modern enough. + exit 0 + ;; + + --run) + # Back-compat with the calling convention used by older automake. + shift + ;; + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due +to PROGRAM being missing or too old. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + +Supported PROGRAM values: + aclocal autoconf autoheader autom4te automake makeinfo + bison yacc flex lex help2man + +Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and +'g' are ignored when checking the name. + +Send bug reports to ." + exit $? + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing $scriptversion (GNU Automake)" + exit $? + ;; + + -*) + echo 1>&2 "$0: unknown '$1' option" + echo 1>&2 "Try '$0 --help' for more information" + exit 1 + ;; + +esac + +# Run the given program, remember its exit status. +"$@"; st=$? + +# If it succeeded, we are done. +test $st -eq 0 && exit 0 + +# Also exit now if we it failed (or wasn't found), and '--version' was +# passed; such an option is passed most likely to detect whether the +# program is present and works. +case $2 in --version|--help) exit $st;; esac + +# Exit code 63 means version mismatch. This often happens when the user +# tries to use an ancient version of a tool on a file that requires a +# minimum version. +if test $st -eq 63; then + msg="probably too old" +elif test $st -eq 127; then + # Program was missing. + msg="missing on your system" +else + # Program was found and executed, but failed. Give up. + exit $st +fi + +perl_URL=http://www.perl.org/ +flex_URL=http://flex.sourceforge.net/ +gnu_software_URL=http://www.gnu.org/software + +program_details () +{ + case $1 in + aclocal|automake) + echo "The '$1' program is part of the GNU Automake package:" + echo "<$gnu_software_URL/automake>" + echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" + echo "<$gnu_software_URL/autoconf>" + echo "<$gnu_software_URL/m4/>" + echo "<$perl_URL>" + ;; + autoconf|autom4te|autoheader) + echo "The '$1' program is part of the GNU Autoconf package:" + echo "<$gnu_software_URL/autoconf/>" + echo "It also requires GNU m4 and Perl in order to run:" + echo "<$gnu_software_URL/m4/>" + echo "<$perl_URL>" + ;; + esac +} + +give_advice () +{ + # Normalize program name to check for. + normalized_program=`echo "$1" | sed ' + s/^gnu-//; t + s/^gnu//; t + s/^g//; t'` + + printf '%s\n' "'$1' is $msg." + + configure_deps="'configure.ac' or m4 files included by 'configure.ac'" + case $normalized_program in + autoconf*) + echo "You should only need it if you modified 'configure.ac'," + echo "or m4 files included by it." + program_details 'autoconf' + ;; + autoheader*) + echo "You should only need it if you modified 'acconfig.h' or" + echo "$configure_deps." + program_details 'autoheader' + ;; + automake*) + echo "You should only need it if you modified 'Makefile.am' or" + echo "$configure_deps." + program_details 'automake' + ;; + aclocal*) + echo "You should only need it if you modified 'acinclude.m4' or" + echo "$configure_deps." + program_details 'aclocal' + ;; + autom4te*) + echo "You might have modified some maintainer files that require" + echo "the 'automa4te' program to be rebuilt." + program_details 'autom4te' + ;; + bison*|yacc*) + echo "You should only need it if you modified a '.y' file." + echo "You may want to install the GNU Bison package:" + echo "<$gnu_software_URL/bison/>" + ;; + lex*|flex*) + echo "You should only need it if you modified a '.l' file." + echo "You may want to install the Fast Lexical Analyzer package:" + echo "<$flex_URL>" + ;; + help2man*) + echo "You should only need it if you modified a dependency" \ + "of a man page." + echo "You may want to install the GNU Help2man package:" + echo "<$gnu_software_URL/help2man/>" + ;; + makeinfo*) + echo "You should only need it if you modified a '.texi' file, or" + echo "any other file indirectly affecting the aspect of the manual." + echo "You might want to install the Texinfo package:" + echo "<$gnu_software_URL/texinfo/>" + echo "The spurious makeinfo call might also be the consequence of" + echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" + echo "want to install GNU make:" + echo "<$gnu_software_URL/make/>" + ;; + *) + echo "You might have modified some files without having the proper" + echo "tools for further handling them. Check the 'README' file, it" + echo "often tells you about the needed prerequisites for installing" + echo "this package. You may also peek at any GNU archive site, in" + echo "case some other package contains this missing '$1' program." + ;; + esac +} + +give_advice "$1" | sed -e '1s/^/WARNING: /' \ + -e '2,$s/^/ /' >&2 + +# Propagate the correct exit status (expected to be 127 for a program +# not found, 63 for a program that failed due to version mismatch). +exit $st + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff -Nru emu8051-1.1.1/build-aux/test-driver emu8051-2.0.1/build-aux/test-driver --- emu8051-1.1.1/build-aux/test-driver 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/build-aux/test-driver 2014-03-22 18:26:16.000000000 +0000 @@ -0,0 +1,127 @@ +#! /bin/sh +# test-driver - basic testsuite driver script. + +scriptversion=2012-06-27.10; # UTC + +# Copyright (C) 2011-2013 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute 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, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +# Make unconditional expansion of undefined variables an error. This +# helps a lot in preventing typo-related bugs. +set -u + +usage_error () +{ + echo "$0: $*" >&2 + print_usage >&2 + exit 2 +} + +print_usage () +{ + cat <$log_file 2>&1 +estatus=$? +if test $enable_hard_errors = no && test $estatus -eq 99; then + estatus=1 +fi + +case $estatus:$expect_failure in + 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;; + 0:*) col=$grn res=PASS recheck=no gcopy=no;; + 77:*) col=$blu res=SKIP recheck=no gcopy=yes;; + 99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;; + *:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;; + *:*) col=$red res=FAIL recheck=yes gcopy=yes;; +esac + +# Report outcome to console. +echo "${col}${res}${std}: $test_name" + +# Register the test result, and other relevant metadata. +echo ":test-result: $res" > $trs_file +echo ":global-test-result: $res" >> $trs_file +echo ":recheck: $recheck" >> $trs_file +echo ":copy-in-global-log: $gcopy" >> $trs_file + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff -Nru emu8051-1.1.1/build-aux/ylwrap emu8051-2.0.1/build-aux/ylwrap --- emu8051-1.1.1/build-aux/ylwrap 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/build-aux/ylwrap 2014-03-22 18:26:16.000000000 +0000 @@ -0,0 +1,247 @@ +#! /bin/sh +# ylwrap - wrapper for lex/yacc invocations. + +scriptversion=2013-01-12.17; # UTC + +# Copyright (C) 1996-2013 Free Software Foundation, Inc. +# +# Written by Tom Tromey . +# +# This program is free software; you can redistribute 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, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +get_dirname () +{ + case $1 in + */*|*\\*) printf '%s\n' "$1" | sed -e 's|\([\\/]\)[^\\/]*$|\1|';; + # Otherwise, we want the empty string (not "."). + esac +} + +# guard FILE +# ---------- +# The CPP macro used to guard inclusion of FILE. +guard () +{ + printf '%s\n' "$1" \ + | sed \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \ + -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g' \ + -e 's/__*/_/g' +} + +# quote_for_sed [STRING] +# ---------------------- +# Return STRING (or stdin) quoted to be used as a sed pattern. +quote_for_sed () +{ + case $# in + 0) cat;; + 1) printf '%s\n' "$1";; + esac \ + | sed -e 's|[][\\.*]|\\&|g' +} + +case "$1" in + '') + echo "$0: No files given. Try '$0 --help' for more information." 1>&2 + exit 1 + ;; + --basedir) + basedir=$2 + shift 2 + ;; + -h|--h*) + cat <<\EOF +Usage: ylwrap [--help|--version] INPUT [OUTPUT DESIRED]... -- PROGRAM [ARGS]... + +Wrapper for lex/yacc invocations, renaming files as desired. + + INPUT is the input file + OUTPUT is one file PROG generates + DESIRED is the file we actually want instead of OUTPUT + PROGRAM is program to run + ARGS are passed to PROG + +Any number of OUTPUT,DESIRED pairs may be used. + +Report bugs to . +EOF + exit $? + ;; + -v|--v*) + echo "ylwrap $scriptversion" + exit $? + ;; +esac + + +# The input. +input=$1 +shift +# We'll later need for a correct munging of "#line" directives. +input_sub_rx=`get_dirname "$input" | quote_for_sed` +case $input in + [\\/]* | ?:[\\/]*) + # Absolute path; do nothing. + ;; + *) + # Relative path. Make it absolute. + input=`pwd`/$input + ;; +esac +input_rx=`get_dirname "$input" | quote_for_sed` + +# Since DOS filename conventions don't allow two dots, +# the DOS version of Bison writes out y_tab.c instead of y.tab.c +# and y_tab.h instead of y.tab.h. Test to see if this is the case. +y_tab_nodot=false +if test -f y_tab.c || test -f y_tab.h; then + y_tab_nodot=true +fi + +# The parser itself, the first file, is the destination of the .y.c +# rule in the Makefile. +parser=$1 + +# A sed program to s/FROM/TO/g for all the FROM/TO so that, for +# instance, we rename #include "y.tab.h" into #include "parse.h" +# during the conversion from y.tab.c to parse.c. +sed_fix_filenames= + +# Also rename header guards, as Bison 2.7 for instance uses its header +# guard in its implementation file. +sed_fix_header_guards= + +while test $# -ne 0; do + if test x"$1" = x"--"; then + shift + break + fi + from=$1 + # Handle y_tab.c and y_tab.h output by DOS + if $y_tab_nodot; then + case $from in + "y.tab.c") from=y_tab.c;; + "y.tab.h") from=y_tab.h;; + esac + fi + shift + to=$1 + shift + sed_fix_filenames="${sed_fix_filenames}s|"`quote_for_sed "$from"`"|$to|g;" + sed_fix_header_guards="${sed_fix_header_guards}s|"`guard "$from"`"|"`guard "$to"`"|g;" +done + +# The program to run. +prog=$1 +shift +# Make any relative path in $prog absolute. +case $prog in + [\\/]* | ?:[\\/]*) ;; + *[\\/]*) prog=`pwd`/$prog ;; +esac + +dirname=ylwrap$$ +do_exit="cd '`pwd`' && rm -rf $dirname > /dev/null 2>&1;"' (exit $ret); exit $ret' +trap "ret=129; $do_exit" 1 +trap "ret=130; $do_exit" 2 +trap "ret=141; $do_exit" 13 +trap "ret=143; $do_exit" 15 +mkdir $dirname || exit 1 + +cd $dirname + +case $# in + 0) "$prog" "$input" ;; + *) "$prog" "$@" "$input" ;; +esac +ret=$? + +if test $ret -eq 0; then + for from in * + do + to=`printf '%s\n' "$from" | sed "$sed_fix_filenames"` + if test -f "$from"; then + # If $2 is an absolute path name, then just use that, + # otherwise prepend '../'. + case $to in + [\\/]* | ?:[\\/]*) target=$to;; + *) target=../$to;; + esac + + # Do not overwrite unchanged header files to avoid useless + # recompilations. Always update the parser itself: it is the + # destination of the .y.c rule in the Makefile. Divert the + # output of all other files to a temporary file so we can + # compare them to existing versions. + if test $from != $parser; then + realtarget=$target + target=tmp-`printf '%s\n' "$target" | sed 's|.*[\\/]||g'` + fi + + # Munge "#line" or "#" directives. Don't let the resulting + # debug information point at an absolute srcdir. Use the real + # output file name, not yy.lex.c for instance. Adjust the + # include guards too. + sed -e "/^#/!b" \ + -e "s|$input_rx|$input_sub_rx|" \ + -e "$sed_fix_filenames" \ + -e "$sed_fix_header_guards" \ + "$from" >"$target" || ret=$? + + # Check whether files must be updated. + if test "$from" != "$parser"; then + if test -f "$realtarget" && cmp -s "$realtarget" "$target"; then + echo "$to is unchanged" + rm -f "$target" + else + echo "updating $to" + mv -f "$target" "$realtarget" + fi + fi + else + # A missing file is only an error for the parser. This is a + # blatant hack to let us support using "yacc -d". If -d is not + # specified, don't fail when the header file is "missing". + if test "$from" = "$parser"; then + ret=1 + fi + fi + done +fi + +# Remove the directory. +cd .. +rm -rf $dirname + +exit $ret + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff -Nru emu8051-1.1.1/ChangeLog emu8051-2.0.1/ChangeLog --- emu8051-1.1.1/ChangeLog 2011-12-12 04:55:03.000000000 +0000 +++ emu8051-2.0.1/ChangeLog 2014-03-22 18:26:21.000000000 +0000 @@ -1,482 +1,1186 @@ -2011-12-11 Hugo Villeneuve - Added optional size parameter when dumping memory. - Created two separate executables, emu8051-cli (default) - and optional emu8051-gtk if Gtk+ is detected. - -2011-10-29 Hugo Villeneuve - Fixed SJMP error and improved columns and rows sizing - -2010-03-19 Hugo Villeneuve - Reintroduced the console mode if no GTK+ librairies are - detected. The default is to build the GUI if GTK+ is detected, - but the console mode can always be forced by using - "--enable-gui=no" as a configure option. - -2009-02-09 Hugo Villeneuve - * Updated Free Software Foundation address. - -2008-11-05 Hugo Villeneuve - * Added licencing informations for each source file. - * Removed some debugging messages. - -2008-04-28 Hugo Villeneuve - * Removed gtk+-1.0 support, now requires gtk+-2 - -2004-05-07 Hugo Villeneuve - * Corrected a bug with the CJNE instruction. - * Modified the directory layout and autoconf files. - * Added support for GTK2. - * Added project to subversion. - -2002-11-12 Hugo Villeneuve - * Removed some warnings for GCC 3.2: replaced by - and by . - * Added "using namespace std;" in EmuGtk.hpp (for GCC 3.2) - * Removed all unused variables - * Corrected error in CPU8051.cpp, in function: - 'void CPU8051::IntMemBitInfo( unsigned int BitAddress, char *Text )' - Modified this: - 'sprintf( &Text[ TextLength ], ".%X", BitAddress );' - instead of: - 'sprintf( &Text[ TextLength ], ".%X" );' - * In Opcode2cpp.pl (line 767), modified for GCC 3.2: - 'print INST_IMP " funcptr[$i]=&CPU8051::$ifunc;\n";' - instead of: - 'print INST_IMP " funcptr[$i]=&$ifunc;\n";' - * EmuGtk.cpp, added '#include ' - * Modified the return type of some functions to void to remove warnings. - * In function 'void RegWin::Show( CPU8051 *CPU )' (RegWin.cpp), removed all - the '\n' in 'gtk_clist_set_text' calls (to fix a display problem) - -1999-04-27 Hugo Villeneuve - * Ajoute les fonctions DumpInt dans EmuConsole.hpp ainsi que ReadInt - dans CPU8051.hpp. Corrige des bugs dans WriteInt et WriteExt. - - * Corrige l'implementation des timers. Les 4 modes ont ete testes et - semblent bien fonctionner maintenant. LEs flags sont mis correctement - et les timers augmentent maintenant (au lieu d'etre decrementes). - * Ajoute un fichier timer.hex pour tester les timers. - -1999-04-22 Hugo Villeneuve - * Ajoute les fonctions ME, MI et MP (voir definitions dans - EmuConsole.cpp). Ajoute les fonctions membres WriteExt et WriteInt - dans la classe CPU8051 afin de suivre la logique de l'espace - memoire du 8051. WriteExt permet de modifier la memoire externe - qui va de $00 a $FFFF (et non de $100 a $FFFF comme c'etait le cas - avant). De meme, WriteInt permet de modifier la memoire interne qui - va de $00 a $FF (incluant les SFR). Meme si la memoire externe - contient les adresses $00 a $FF, il n'y a pas de conflit avec la - memoire interne de $00 a $FF car la memoire externe est accedee avec - l'instruction MOVX alors que la memoire interne l'est avec les - instructions MOV (direct ou indirect). - - * Renomme l'option DD du menu pour DE (dump External data memory). - Change la description de l'option DI du menu pour Dump External - Data Memory. - - * Ajoute la fonction ReadExt dans la classe CPU8051, toujours pour - la logique de la memoire du 8051. Ajoute la fonction DumpExt dans la - classe EmuConsole pour dumper la memoire externe. - * Ces nouvelles fonctions ont ete testees et semblent bien fonctionner. - -1999-04-09 Jonathan St-Andre - * Refait marche le RunningState avec les classes. - * Reconnecte les signaux aux boutons Trace, Run, Reset et Quit. - * Ajoute bouton Step qui ajoute un breakpoint a la ligne suivante - et passe en RunningState. Pratique lorsqu'arrive un CALL et qu'on ne - veut pas y entrer contrairement a Trace. - -1999-04-06 Jonathan St-Andre - * Creation de EmuConsole.hpp et EmuConsole.cpp - * Cette nouvelle archive est presque rendue au meme niveau que - l'ancienne. Vous allez pouvoir commencer a laisser faire l'ancienne - et vous concentrer sur celle-ci. - -(Les modifs annoncee se rapportent a l'ancienne archive mais elles ont ete -ramenee dans celle-ci par Jonathan St-Andre) -1999-04-05 Jonathan St-Andre - * Corrige qq malfonctions dans exec de mainconsole.cpp (nb d'inst. - peut etre l'infini, caractere est attendu au clavier seulement - si l'execution est arretee par une touche. - * Corrige probleme d'instructions sans operandes mal desassemblees - (il ne faut pas ecrire le caractere ' ' dans la chaine, il faut - utiliser sprintf avec " " a la place car sprintf termine la chaine - avec un 0 a la fin. La chaine n'etait pas terminee par un 0 et elle - affichait du garbage de la memoire) - * Corrige probleme dans disasm.cpp en rapport avec addr11 qui ne - prenait pas opcode mais memoire[opcode] (je devais etre chaud quand - j'ai ecrit ca). - * Bouton Run se change en Stop dans l'interface Gtk+ lorsque l'on - clique dessus et le cpu se met en mode execution. Les fonctions de - l'interface restent disponibles. N'importe quelle action dans - l'interface(excepte le fait de cliquer dans les fenetre memoire - et programme) cause l'arret de l'execution et la mise a jour - de l'affichage. - * Il est possible de placer des breakpoints pendant qu'il est - dans le "RunningState". - * Enleve les pixmaps sur les boutons dans l'interface Gtk+ - * Ajoute verification de breakpoint deja existant dans - setbreakpoint. - - Hugo Villeneuve - - * Modifie l'affichage de disasm pour que les operandes soient alignees. - * Modifie la fonction DP pour qu'elle prenne l'adresse du PC par - defaut si aucune adresse n'est specifiee. - - * Erreur avec l'instruction ACALL qui ne calculait pas l'adresse - correctement et qui ne poussait pas l'adresse de retour sur la pile. - Il est important que le PC soit incremente de 2 avant de calculer - addr11 et de pousser le PC sur la pile... - Il faut aussi modifier le dessassemblage de cette instruction qui - n'affiche que la deuxieme operande (adresse de 8 bits), alors que - l'adresse est sur 11 bits... - * Erreur avec l'instruction RET( fichier siae1.asm adresse 03A4) , - affiche RET @%K - * Ajoute la possibilite d'arreter l'execution du programme en pesant - sur n'importe quelle touche grace a la fonction kbhit(). - * Ajoute les fonctions SB, RB et DB pour les breakpoints dans le - mode console. L'execution se fait jusqu'au breakpoint. Une fois - arrive au breakpoint, si on fait de nouveau EM, on peut continuer - l'execution du programme passe ce breakpoint. Autrement dit, EM - ne verifie pas si la premiere instruction qu'il execute est un - break point, ce qui est pratique pour continuer l'execution du prog - apres un breakpoint. - -1999-03-31 Jonathan St-Andre - * Reecriture de TOUT les sources en imbriquant au maximum - dans des classes pour que ce soit plus lisible et reutilisable. - * Les classes sont CPU8051, Memory, EmuGtk, MemWin, RegWin, PgmWin - et les exceptions. - * Tout est en anglais pour rendre le programme disponible sur - internet. - * Je n'ai pas encore refais l'interface Console en classes donc - elle n'est pas incluse dans cette archive. Il faudrait vraiment - la refaire en tant que classe. - * Ajout fichiers TODO, CREDITS et COPYING (license GPL) - -1999-03-30 Jonathan St-Andre - * Corrige bug lors du desassemblage dans l'interpretation des - adresses directes dans 0-7F. disasm.cpp - * Corrige bug dans l'opcode 0x85, ajoute conditions particulieres - pour cette instruction dans script Perl et dans desassemblage. - Les operandes de cette instruction sont inversees dans la memoire - programme. Ex.: MOV 50H,51H est ecrit 85 51 50 dans la memoire - programme. - - Hugo Villeneuve - - * Bug dans les instructions ayant un mode d'adressage direct qui - utilisent des adresses dans 0-7F. Le desassembleur interprete les - adresses comme etant des adresses de bit. - * Bug dans l'opcode 0x85 MOV direct,direct. La source et la - destination sont inverses dans le desassemblage et dans l'execution. - -1999-03-29 Jonathan St-Andre - * Remplace string::erase pour string::replace partout, g++ a - l'universite ne connait pas encore string::erase, c'est trop recent. - * Ajoute "-w" pour disabler les warnings et "-fhandle-exceptions" - pour activer les exceptions a l'universite. - - Pascal Fecteau - - * Ajoute .h comme extension aux fichiers inclus, sinon ca ne - fonctionne pas a l'universite. - - Pascal Fecteau - Hugo Villeneuve - - * Corrige une erreur dans les instructions AJMP addr11 - -1999-03-28 Hugo Villeneuve - * Modification de la presentation de "Dump Register" sur la console. - Beaucoup plus facile a lire maintenant. - * Correction d'un bug dans l'instruction DA (opcode 0xD4). - -1999-03-27 Hugo Villeneuve - * Correction d'un probleme avec l'instruction CJNE. - * Correction de bugs dans LoadHexFile (voir 1999-03-22) - - Jonathan St-Andre - - * Augmente la hauteur de la fenetre Internal RAM. - * Correction de probleme avec tous les XCH et XCHD, l'operande source - n'etait pas modifiee (Trouve par Hugo et suggestion de correction par - Hugo). - * Ajout de P0, P1, P2 et P3 dans la fenetre des registres. - (Suggestion d'Hugo). - * View -> Data Memory Dump et View -> Program Memory Dump sont - fonctionnels. On ne peut visionner que les 16384 premiers octets. - Il ne veut pas prendre 65536 lignes dans une scrolled window. - Probablement parce que 18colonnes x 65536lignes = 1179648 cellules - est beaucoup trop. - * J'ai remarque qu'avec Gtk, on peut facilement changer les raccoucis - dans les menus. Pour associer "View -> Program Memory Dump" au - raccourci "Alt-2" par exemple, il suffit d'aller dans le menu "View", - se placer au dessus de "Program Memory Dump" et appuyer "Alt-2". - Le menu se modifiera automatiquement pour afficher "Alt-2" au bout - de la ligne et desormais, lorsque vous appuierez "Alt-2", l'action - sera executee. Ca dure seulement durant la session presente. - * Reduit la taille de la fenetre principale en largeur de 120 pixels - et en hauteur de 20 pixels. - -1999-03-25 Jonathan St-Andre - * Fenetre dump connais la position ou on clique dedans. - * Generalise dans une classe la fenetre memorydump, il sera plus - facile d'ajouter plusieurs fenetres memory dump a partir du menu - plus tard. - * Implemente Run jusqu'a un breakpoint (si aucun breakpoint, - loop sans fin -> il faut killer). - * Suffit de cliquer sur une ligne de programme dans Gtk pour placer - ou retirer un breakpoint. Les breakpoints apparaissent comme une - asterisque (*) a droite de l'adresse dans la fenetre program. - * Ajoute bouton Run dans interface Gtk - * Implemente quelques fonctions necessaires au breakpoints. - * Change un peu le layout - * Enleve image de fond (cause leger delai au chargement) - * Fait un peu de menage dans fichiers relatifs au Gtk - -1999-03-23 Jonathan St-Andre - * Changement des champs GTK_TEXT des fenetres Registre, Program et - Internal RAM pour des champs GTK_CLIST. Plus beau, moins de - flickering quand on trace et plus pratique pour ce qui s'en vient. - * Integration des fichiers xpm dans l'executable. Mais c'est encore - trop long a charger lors de l'execution, va probablement falloir les - compresser ou laisser faire l'image de fond. - * Ajout de pixmaps sur les boutons Trace, Reset et Quit (Gtk) - * Ajout de pixmap comme fond (Gtk) - -1999-03-22 Hugo Villeneuve - * Corrige un bug dans la fonction LoadHexFile : Le checksum n'etait - pas calcule correctement, ce qui entrainait des erreurs a l'ouverture - de certains fichiers HEX. L'erreur venait du fait que le checksum se - calculait avec la valeur absolue du LoadOffset, au lieu d'utiliser - les caracteres composant le LoadOffset. Exemple : si LoadOffset = - 0103, il faut additionner 01h+03h=4h au Checksum et non pas 0103h = - 259 en decimal. - * Deplace la fonction enleve_espaces de main_console vers mainemu - car elle est commune aux deux interfaces graphiques. - * Modifie la fonction majuscules pour qu'elle puisse convertir les - lettres de minuscule a majuscule meme si la chaine contient des - chiffres ou autres signes de ponctuation. - * Modifie la declaration des fonctions dans tous les fichiers .hpp: - enleve le nom des parametres car c'etait inutile. - * Stocke le nom des registres dans un fichier registres8051.hpp. - Ainsi, si on veut emuler un autre type de processeur, il suffira - de se creer un autre fichier registres8052xxx.hpp par exemple. - * Implemente l'affichage en francais ou en anglais dependant de - l'option passee sur la ligne de commande. L'interface est beaucoup - plus lisible de cette facon. Par defaut, l'affichage est en anglais. - -1999-03-21 Hugo Villeneuve - * Ajoute deux parametres qu'on peut passer par la ligne de commande: - /? affiche les options disponibles sur la ligne de commande. - -f force l'affichage en francais (pas encore implemente!!!) - * Ajoute le controle d'erreur pour le chargement d'un fichier HEX. - Les differentes erreurs sont controlees ( checksum, rectype, - fin de fichier, etc.). - * Modifie la fonction unasm pour qu'elle accepte 0,1 ou 2 parametres. - U (adresse) (nombre d'instructions) - Si adresse et nombre d'instructions non-specifies: - Adresse = PC et Nombre d'Instructions = 16 - Si adresse specifie et nombre d'instructions non-specifie: - Adresse = adresse specifiee et Nombre d'Instructions = 16 - Si adresse specifie et nombre d'instructions specifie: - Adresse = adresse specifiee et Nombre d'Instructions = nb specifie - A noter: on peut specifier une adresse comme etant un nombre - hexadecimal, ou tout simplement en entrant "PC" ou "pc". - - Jonathan St-Andre - - * Ajout des interruptions du port serie. - * Ajout du timer 2 (8052). - -1999-03-20 Hugo Villeneuve - * Separe le fichier main.cpp en deux: main.cpp et fonctions.cpp. - fonctions.cpp contient les fonctions necessaires a main.cpp. - * Ajoute un fichier exceptions.hpp qui permet de gerer les erreurs. - * Modifie le Makefile en consequence. - * On peut maintenant entrer les adresses < a quatre caracteres : - ex: adresse 0000h = 0 ou 00 ou 000 ou 0000. - * Enleve le include - * Remplace toutes les commandes printf du main par cout. - * Modifie l'apparence du menu. - * Le programme est maintenant plus robuste en ce qui concerne les - erreurs de syntaxe, les adresses invalides, etc (a tester...). - * Modifier l'operation et la syntaxe de certaines commandes - S (set register) devient MR (modify register) car set veut - plutot dire "mettre a 1", et on pourra aussi implementer - MM (modify Memory). - R devient DR (display Register), pour suivre la logique de - DP, DM et DI. - * Ajoute une commande Execute Memory: EM addr n - * La gestion des chaines de caracteres se fait maintenant - uniquement avec des variables de type STRING, selon le C++. - * Enleve variables i,j,k et inputcars dans le main. - * Modifie la fonction RESET pour quelle n'affiche pas les - registres au demarrage... ca faisait pas beau! Ajoute - cependant un message pour dire que le up est resette. - * Pour changer un registre, on doit entrer PC (et non p) ainsi - que SP (et non seulement s). - * Ajoute une fonction qui convertit une chaine de caracteres - en majuscules. - -1999-03-19 Jonathan St-Andre - * Fonction reset51() ajoutee dans cpu8051.cpp, reset() ajoutee - dans main.cpp. - * Commande "Z" fait un reset du processeur sur la console et le - bouton Reset fonctionne dans le GUI. - - Jimmy Ringuette - - * Les interruptions sont maintenant implementees. check_hardware() a - ete supprimee et Do_timers() est appelee directement de exec8051(). - -1999-03-18 Hugo Villeneuve - * Modifie l'entree des commandes pour gerer un peu plus les erreurs - de syntaxe (je n'ai pas fini, il y a encore de la job a faire pour - mettre ca error proof). - * Simplifie l'entree des parametres pour chacune des fonctions. - * Re-modifie l'instruction trace pour avoir seulement deux modes: - trace a adresse et trace 1 instruction. Cela simplifie l'entree de - la commande (on n'a pas a faire TA, qui n'est pas une commande - standard dans les emulateurs). Si on veut faire tracer pour plusieurs - instructions, alors il suffira d'implementer la commande - EXECUTE Nombre_instructions, ce qui est beaucoup plus logique et - c'est ce qu'on retrouve dans la plupart des emulateurs. - * Ajoute la description des commandes en francais (loi 101). - -1999-03-18 Jonathan St-Andre - * Le bouton Trace dans la version Gtk+ fonctionne. On peut tracer - et les 3 fenetres(registres, memoire, programme) se mettent a jour. - * Ajout de 2 nouvelles fonctions trace : "tracenb()" et "traceat()" - Qui, respectivement, prenent un nombre d'instruction a executer ou - une adresse ou commencer l'execution. La fonction trace() a ete - resimplifiee. - * Dans les instructions RET, RETI, LCALL, PUSH et POP la pile prend - la iram seulement pour les adresses sous 0x80, la data RAM est - utilisee autrement. Avant, les SFR se faisaient ecraser! - * Modes d'addressage addr16, reladdr, #data16 modifies! - En tenant compte de ce que Hugo avait fait remarquer ce matin : - ex.: si PC++ apparait 2 fois sur une ligne, les 2 fois il repartira - de la meme valeur de PC et suite a cette ligne, on se trouve avec - un PC incremente 1 fois au lieu de 2. - * Menu accepte maj/minuscules - * Corrige bug dans "setreg", les registres peuvent vraiment - etre donnes en maj/minuscules maintenant. - -1999-03-17 Hugo Villeneuve - * Correction de bugs relatifs a la compilation sur VC5. - Dont ajout de #include . - -1999-03-13 Jimmy Ringuette - * Ajout des timers dans cpu8051.cpp. Il faudrait tester a fond. - -1999-03-12 Jonathan St-Andre - * Je crois qu'il sera plus interessant si on garde le memory - dump normal dans une fenetre exterieur et dont on pourra en ouvrir - plusieurs pour monitorer differents endroits de la memoire, c'est - pourquoi je n'ai place que "Internal RAM" comme memory dump dans - la fenetre principale. - * Au demarrage, effectue un premier memory dump dans la fenetre - "Internal RAM", un unasm dans "Program" et un show register dans - "Registers". - * Bouton Quit, menus "File -> Quit" et "Help -> About" reagissent. - * Comporte maintenant 2 Makefile : Makefile.console(fonctionne sur - toutes les plateformes) et Makefile.gtk(teste seulement sous Linux). - * DEBUT d'interface graphique Gtk+ (ne fait qu'afficher une fenetre - avec un layout tres simple), presentement je cours apres des sources - de documentations.(le manuel n'est pas encore complet) - -1999-03-09 Jimmy Ringuette - * Regle le bug avec mul (probleme avec les bits 15-8 du resultat - ne se ramenaient pas dans les bits 7-0 du registre B) - * La conversion chaine->hexadecimal accepte les minuscules - * Il n'est plus obligatoire d'ecrire les 4 caracteres lorsqu'il faut - entrer une valeur hexadecimale. - -1999-03-05 Jonathan St-Andre - * Corrige un warning de compilation sous Solaris. - -1999-03-04 Jonathan St-Andre - * Ca execute! (presque) - * Phase de corrections des bugs dans les instructions, une premiere - implementation est faite pour toutes les instructions. - * Ajout fonction "trace" et "dump internal memory" - * Les modes d'adressage sont pratiquement termines dans - les instructions. - * Certaines instructions ont un debut d'implementation. - * Desassembleur, bit addressable segment 00-7F -> 20.0-2F.7 - -1999-03-03 Jonathan St-Andre - * Ajout automatique de certaines lignes de codes concernant - l'adressage dans les fonctions d'instructions tres brouillon - * Ajout de stub pour write_mem et read_mem, modifs dans exec8051 - * Ajout de la fonction showregister() et de la commande 'r'. - * Correction d'une erreur iram_mem doit etre unsigned char et non int - * Note : Il y a des references a certaines parties du 8052 mais - elles ne seront pas implementees. Ce n'est qu'a titre d'informations. - * Ajout de #define pour faire correspondre les registres SFR avec - leur adresse dans la iram. - * Renomme instructions.cpp a instructions.hpp et ajout du tableau - de pointeurs sur les fonctions - * Ajout de la ram interne 00-FF et valeurs initiale au reset - dans cpu8051.cpp avec le registre : unsigned int PC. - * Ajout de cpu8051.cpp contenant exec8051() - -1999-03-02 Jonathan St-Andre - * Ajout de remarques dans le source - * Il faudrait maintenant tester avec plusieurs programmes pour - reperer les bugs. - * Le desassembleur reconnait maintenant les registres du SFR - (ex.: 88H est remplace par TCON, F0 par B, etc...) - * Changement au desassembleur (instructions peuvent avoir jusqu'a 3 - arguments ex.: CJNE R0,#data,reladdr) - * La vrai instruction CJNE comporte 3 arguments il faut changer - radicalement le desassembleur - -1999-03-01 Jonathan St-Andre - * Probleme dans opcodes.lst au niveau de l'instruction CJNE (mauvaise - definition) - * Tous les types d'adressages semblent fonctionner - * Le desassembleur peut lire les arguments et les afficher - (ex.: MOV A,#data peut devenir plus concret MOV A,#20) - * Desassembleur (instructions ont 2 arguments : instleftarg et - instrightarg) - -1999-02-28 Jonathan St-Andre - * Charge un fichier .hex donne en parametre (format Intel Hexadecimal - produit par ASM51) - * Effectue le dump program memory et dump data memory - * On peut quitter (YEAH!) - * Affiche le menu - * Creation de opcodes.lst et script Perl pour l'interpreter - * Debut +2014-03-22 Hugo Villeneuve + + emu8051 2.0.1 + +2014-03-16 Hugo Villeneuve + + Convert manpage to UTF-8 + +2014-02-17 Hugo Villeneuve + + Add tests for CLI version commands + +2014-02-17 Hugo Villeneuve + + Do not display registers at CLI version startup + + This is to help testing the "dr" command, to be able to match + default register values. + +2014-02-16 Hugo Villeneuve + + Add proper error checking in asciihex2int functions + +2014-02-15 Hugo Villeneuve + + Dont exit in case of hexfile reading failure + +2014-02-15 Hugo Villeneuve + + Replace disam.h with opcodes{h,c} + + Also rename opcode2c.pl -> opcodes2c.pl + +2014-02-15 Hugo Villeneuve + + Fix comment after cleanup + +2014-02-15 Hugo Villeneuve + + Fix splint warnings + +2014-02-15 Hugo Villeneuve + + Fix C99 standard types uintN_t + +2014-02-13 Hugo Villeneuve + + Remove unused header file includes + +2014-02-13 Hugo Villeneuve + + Fix test script to work in external build directory + +2014-02-13 Hugo Villeneuve + + Shorten memory_ functions prefix to mem_ in memory.c + +2014-02-13 Hugo Villeneuve + + Fix checkpatch warnings + +2014-02-13 Hugo Villeneuve + + Move memory read functions to memory.c + + Fix warnings given by checkpatch.pl + +2014-02-13 Hugo Villeneuve + + Fix auto-generated C source files indentation + +2014-02-13 Hugo Villeneuve + + Remove unnecessary column in opcodes.lst + + Begin to cleanup Perl code + +2014-02-13 Hugo Villeneuve + + Remove duplicate code for disassembly + +2014-02-13 Hugo Villeneuve + + Fix checkpatch warnings + +2014-02-13 Hugo Villeneuve + + Shorten GPLv2 licence text in header of each source file + +2014-02-13 Hugo Villeneuve + + Add up to 4 emulator timers + +2014-02-13 Hugo Villeneuve + + Rename DumpMem function -> memory_dump + +2014-02-13 Hugo Villeneuve + + Add more error checking for CLI version arguments + +2014-02-13 Hugo Villeneuve + + Cleanup help menu + +2014-02-13 Hugo Villeneuve + + Add support for GNU readline + + readline input is fed into Lex. + + This adds commands history. + + There is also a configure option to disable readline support. + +2014-02-13 Hugo Villeneuve + + Rename CLI and GUI versions main source files + +2014-02-13 Hugo Villeneuve + + Allow hex numbers to begin with 0x or $ prefix in scanner + +2014-02-13 Hugo Villeneuve + + Allow to set all SFR registers in CLI version + +2014-02-13 Hugo Villeneuve + + Add new value range check when writing register in CLI version + + The GUI version also had this check, so the functionality has been merged. + +2014-02-13 Hugo Villeneuve + + Convert CLI version input parsing to Lex/Yacc + + Some error checking is still missing, but all commands seem to be + working correctly. + + Update CLI help menu. + +2014-02-06 Hugo Villeneuve + + Remove address parameter from RUN and TRACE CLI commands + + Also automatically display register contents after each RUN operation. + +2014-01-26 Hugo Villeneuve + + Add general-purpose timer to CLI + + Also add command to reset it. + +2014-01-26 Hugo Villeneuve + + Add better error checking when loading invalid hex files + + Also replaced custom error message box with standard one. + +2014-01-26 Hugo Villeneuve + + Refactor hex loading code + + Merged two identical code portions that validated the checksum. + + Also added better debug messages. + +2014-01-26 Hugo Villeneuve + + Allow EM command to be specified without arguments + + In this case, program will run from the current PC address until a breakpoint + is reached. + +2014-01-26 Hugo Villeneuve + + Move macro definition to top of file + +2014-01-26 Hugo Villeneuve + + Use log functions to display errors + +2014-01-26 Hugo Villeneuve + + Fix error when specifying start address in CLI version + + Start address was specified as "0x0000", but need to be "0000". + +2014-01-26 Hugo Villeneuve + + Add square root regression test + +2014-01-25 Hugo Villeneuve + + Return error for test files without any validation condition + +2014-01-25 Hugo Villeneuve + + Do not display eror message when simply pressing return in CLI version + + Before was displaying message "Syntax error". + +2014-01-25 Hugo Villeneuve + + Add general-purpose timer to GUI + + This timer is not part of the 8051 hardware. It is a free running + timer/counter added as a mean to quickly measure delays in instruction + cyles. + + For now, it is implemented only in GUI version. + +2014-01-23 Hugo Villeneuve + + Add documentation about regression testing + +2014-01-23 Hugo Villeneuve + + Remove display of command line options in GUI mode + + The information message was manually edited, which creates synchronization + problems now that we are using argp to manage our options. + +2014-01-23 Hugo Villeneuve + + Simplify options parsing code + +2014-01-23 Hugo Villeneuve + + emu8051 2.0.0 + +2014-01-23 Hugo Villeneuve + + Remove dynamic update of GUI layout + + The application must restarted for the changes to take effect. + + Added a message for telling this to the user. + +2014-01-23 Hugo Villeneuve + + Improve view/hide of memory windows + + Do not restart whole GUI, just update vpaned containing + the two memory scroll windows. + +2014-01-22 Hugo Villeneuve + + Remove deprecated view->sfr-window option + +2014-01-22 Hugo Villeneuve + + Fix error when toggling memory display viewing on/off + + Only the first two rows were displayed. The crc_init variable + was not handled correctly. + +2014-01-14 Hugo Villeneuve + + Remove autogen.sh from distribution tarball + +2014-01-14 Hugo Villeneuve + + ChangeLog is now automatically generated from git log output + +2014-01-14 Hugo Villeneuve + + Fix compilation warning + +2014-01-14 Hugo Villeneuve + + Refactor memwin.c for internal and external memories + +2014-01-13 Hugo Villeneuve + + Change confusing variable name bits_per_row to bytes_per_row + +2014-01-13 Hugo Villeneuve + + Improve performance of GUI step operations + + Use CRC to detect which memory rows have changed. + + This is only to improve GUI performance when using stepping mode, as we then + only update rows which have been modified. + +2014-01-13 Hugo Villeneuve + + Set external memory size default to 256 + +2014-01-11 Hugo Villeneuve + + Set program memory size default to 65536 + + Before was set to 8192. + + To make sure to not cause problems with bigger programs, or with small + programs that are split accross large memory regions. + +2014-01-11 Hugo Villeneuve + + Create common function for running instructions + +2014-01-03 Hugo Villeneuve + + Fix warning for ignored return value for getline() + +2014-01-03 Hugo Villeneuve + + Fix [-Wsign-compare] warnings + + Original warning message: + emuconsole.c:45:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] + +2014-01-03 Hugo Villeneuve + + Merge ADD and ADDC operations into common function + +2014-01-03 Hugo Villeneuve + + Fix code indentation + +2014-01-03 Hugo Villeneuve + + Fix error with ADDC instruction + + The carry flag was not added to the result. + +2014-01-03 Hugo Villeneuve + + Add tests for ADD and ADDC instructions + +2014-01-03 Hugo Villeneuve + + Fix [-Wformat-security] warning + + Original warning message: + emuconsole.c:316:3: warning: format not a string literal and no format arguments [-Wformat-security] + +2014-01-03 Hugo Villeneuve + + Fix warnings about unused function parameters + +2014-01-03 Hugo Villeneuve + + Fix [-Wmissing-field-initializers] warnings + +2014-01-03 Hugo Villeneuve + + Fix regression with ADDC instruction + + Introduced when refactoring code with psw_set_ov() function. + +2014-01-03 Hugo Villeneuve + + Add additional compile warning flags + + Also changed way that warning flags are defined in autoconf files. + +2013-12-10 Hugo Villeneuve + + Move git ignore file list to build-aux + +2013-12-10 Hugo Villeneuve + + Remove configure cache directory after running autoreconf + +2013-12-07 Hugo Villeneuve + + Separate cli and gtk sources into separate directories + + Also added a common directory to hold common files to both interfaces, + and compiled into a static library. + +2013-12-07 Hugo Villeneuve + + Remove obsolescent macro AM_PROG_CC_C_O + +2013-12-06 Anthony Liu + + Improve interrupt trigger code readability + +2013-12-05 Anthony Liu + + Fix bug when processing interrupts + + Push current PC onto stack and take vector address from parameter. + +2013-12-02 Hugo Villeneuve + + Add support for as504 assembler, with output file option + + Patch is available here: + http://www.hugovil.com/repository/hvlinux/patches/as504-add-output-file-option.patch + + This patch is usefull because it fixes a bug when testing the distribution + in a separate build directory like when using: + make distcheck + + configure.ac automatically detects if as504 supports the option. + +2013-12-02 Hugo Villeneuve + + Add support for as504 assembler + +2013-12-01 Hugo Villeneuve + + Fix bug when using separate build directory to create symbolic link + +2013-12-01 Hugo Villeneuve + + Replace CALL by LCALL for compatibility with AS31 and AS504 assemblers + +2013-12-01 Hugo Villeneuve + + Remove CSEG directive for compatibility with AS31 and AS504 assemblers + +2013-12-01 Hugo Villeneuve + + Remove currently unsupported option to set iram size + +2013-12-01 Hugo Villeneuve + + Fix CPPFLAGS for each target (CLI and GTK) + +2013-12-01 Hugo Villeneuve + + Change way tests are enabled/disabled by asem presence + +2013-12-01 Hugo Villeneuve + + Run each test separately from single shell script + + Each new test is simply a link to opcodes.sh, generatated automatically. + +2013-12-01 Hugo Villeneuve + + Move timer functions to timers.c + +2013-12-01 Hugo Villeneuve + + Add tests for timers mode 2 + +2013-12-01 Hugo Villeneuve + + Change test output expected string layout + + Also check stack pointer value for all tests + +2013-12-01 Hugo Villeneuve + + Add tests for timers mode 0 + +2013-12-01 Hugo Villeneuve + + Fix bug with timers mode 0 (8 bits with 5-bit prescaler) + +2013-12-01 Hugo Villeneuve + + Add tests for timers mode 1 + +2013-12-01 Hugo Villeneuve + + Fix error with timer1 being written to timer0 + +2013-12-01 Hugo Villeneuve + + Add PC check for all tests + +2013-12-01 Hugo Villeneuve + + Add tests for MOV instruction + +2013-12-01 Hugo Villeneuve + + Add tests for DIV instruction + +2013-12-01 Hugo Villeneuve + + Add tests for ANL instruction + +2013-12-01 Hugo Villeneuve + + Add tests for ORL instruction + +2013-12-01 Hugo Villeneuve + + Add framework for regression testing + +2013-12-01 Hugo Villeneuve + + Automatic generation of test hex files + +2013-12-01 Hugo Villeneuve + + Add tests for MUL instructions + +2013-12-01 Hugo Villeneuve + + Remove hex files + +2013-12-01 Hugo Villeneuve + + Rename test-files directory -> tests + +2013-12-01 Hugo Villeneuve + + Add automake options -Wall and gnu std-options + + Remove configure verbose output + +2013-12-01 Hugo Villeneuve + + Remove superfluous bytes in program disassembly + + Sometimes, B1 and B2 were showing old values from previous disassembly. + Now explicitly remove them for each disassembly line. + +2013-12-01 Hugo Villeneuve + + Fix code indentation + +2013-12-01 Hugo Villeneuve + + Prevent dissassembling instructions past last address + +2013-12-01 Hugo Villeneuve + + Add ignore files to gitignore + +2013-12-01 Hugo Villeneuve + + Fix syntax error in comments + +2013-12-01 Hugo Villeneuve + + Fix error with EM command in CLI mode + + Address parameter was not handled correctly. + +2013-12-01 Hugo Villeneuve + + CLI version: Add to display help menu + +2013-12-01 Hugo Villeneuve + + Reintroduce PSW in list of displayed registers (for regression tests) + +2013-12-01 Hugo Villeneuve + + Display SFR registers one per line in automatic run mode + +2013-12-01 Hugo Villeneuve + + Move SFR read/write functions to new file sfr.c + +2013-12-01 Hugo Villeneuve + + Add option to automatically run and stop CLI emulator + +2013-12-01 Hugo Villeneuve + + Replace printf statements with log functions + +2013-12-01 Hugo Villeneuve + + Move variable declaration before statements + +2013-12-01 Hugo Villeneuve + + Display filename in case of HEX file load error + +2013-11-22 Hugo Villeneuve + + Zero all memories when initializing program + + This is especially usefull to have NOP in program memory. + +2013-11-22 Hugo Villeneuve + + Add grid lines to PSW window + +2013-11-21 Hugo Villeneuve + + Add PSW sub window + +2013-11-21 Hugo Villeneuve + + Use macro to set name of sub window + +2013-11-21 Hugo Villeneuve + + Change scope of local variable to static + +2013-11-21 Hugo Villeneuve + + Add option to display bool hex character + +2013-11-21 Hugo Villeneuve + + Add PSW generic bit write/read functions + +2013-11-17 Hugo Villeneuve + + Add parity bit update each instruction cycle + +2013-11-17 Hugo Villeneuve + + Add function to read 16-bit address/offset/value from pgm memory + +2013-11-17 Hugo Villeneuve + + Fix bug with MOV DPTR,#data16 instruction + + Source variable was 8 bits instead of 16 bits. + +2013-11-17 Hugo Villeneuve + + Remove unused destination adressing mode #data16 + + Even if it is required, the destination variable is only 8-bits, + so this would have been a potential bug. + +2013-11-17 Hugo Villeneuve + + Make MUL and DIV use generic source/destination variables + + To remove confusing commented code and compilation warning + +2013-11-17 Hugo Villeneuve + + Refactor perl code to write C source code line + +2013-11-17 Hugo Villeneuve + + Refactor perl code to write file header + +2013-11-17 Hugo Villeneuve + + Add overflow and auxiliary carry flags manipulation functions + +2013-11-17 Hugo Villeneuve + + Simplify carry bit set/clr functions + +2013-11-17 Hugo Villeneuve + + Add carry bit definitions + +2013-11-17 Hugo Villeneuve + + Move PSW bit manipulation functions to psw.c + +2013-11-17 Hugo Villeneuve + + Add carry flag manipulation functions + +2013-11-17 Hugo Villeneuve + + Add stack push/pop functions + +2013-11-17 Hugo Villeneuve + + Add DPTR read/write functions + +2013-11-17 Hugo Villeneuve + + Add comment about reset value of stack pointer + +2013-11-17 Hugo Villeneuve + + Fix error with ADD instruction and AC bit + + The overflow bit was written instead of the auxiliary carry bit. + +2013-11-17 Hugo Villeneuve + + Fix bug with ANL instruction + +2013-11-17 Hugo Villeneuve + + Fix bug with ORL instruction + +2013-11-05 Hugo Villeneuve + + Fix error with JMP @A,DPTR instruction + + The resulting jump address is simply the sum of the values in the accumulator + and the DPTR registers, not the indirect read of that sum. + + Error reported and fixed by Anthony (antliu at gmail.com). + +2013-11-05 Hugo Villeneuve + + Fix error with RETI instruction + + The stack pointer was not updated correctly. + + Error reported and fixed by Anthony (antliu at gmail.com). + +2013-11-05 Hugo Villeneuve + + Add view menu option to view/hide SFR memory dump window + +2013-11-05 Hugo Villeneuve + + Add support to view/hide SFR memory dump window in config file + +2013-11-05 Hugo Villeneuve + + Update TODO + +2013-11-05 Hugo Villeneuve + + Refactor code to create memory windows + +2013-11-05 Hugo Villeneuve + + Refactor log functions + +2013-11-05 Hugo Villeneuve + + Add option to specify maximum pgm memory size + +2013-11-05 Hugo Villeneuve + + Refactor code to read/write different memory types + + Dynamic memory buffers allocation depending on sizes specified with command-line + options. + + Add future support for separate IRAM and SFR buffers. + +2013-11-05 Hugo Villeneuve + + Rename macros for maximum memory sizes + +2013-11-05 Hugo Villeneuve + + Limit default external memory size to 1024 bytes + + Emulator is running very slow if external memory is at its maximum of 64K. + +2013-11-05 Hugo Villeneuve + + Fix syntax error in comment + +2013-11-05 Hugo Villeneuve + + Do not reset emulator on file load (no ram clear) + + Reset only when loading first file at application startup. + +2013-11-05 Hugo Villeneuve + + Add Timers 0 and 1 to SFR window + +2013-11-05 Hugo Villeneuve + + Add option to specify maximum memory sizes + +2013-11-05 Hugo Villeneuve + + Add view menu option to enable/disable IRAM/XRAM windows + +2013-11-05 Hugo Villeneuve + + Add view menu option for selecting bits per row (8/16) + +2013-11-05 Hugo Villeneuve + + Add support for bits per row in config file + + Also add support for viewing internal and external memory windows + in config file. + + These 3 new variables are not yet connected (TODO). + +2013-11-05 Hugo Villeneuve + + Add live option to change windows layout + + Restart UI when changing layout. This is working, altough the main window + temporarily disapear in doing so. + +2013-11-05 Hugo Villeneuve + + Use fixed font for ASCII column + +2013-11-05 Hugo Villeneuve + + Align memory data columns text on left side + +2013-11-05 Hugo Villeneuve + + Adjust memory index column header according to number of data columns + +2013-11-05 Hugo Villeneuve + + Harmonize windows refresh function names + +2013-11-05 Hugo Villeneuve + + Save vpane position for memory windows + +2013-11-05 Hugo Villeneuve + + Add external memory window vpaned_mem + +2013-11-05 Hugo Villeneuve + + Convert memwin to display internal or external memory + +2013-11-05 Hugo Villeneuve + + Use single function to refresh all windows + + Use emugtk_UpdateDisplay() to replace individual calls to these functions: + regwin_Show(); + memwin_DumpD(); + pgmwin_Disasm(); + +2013-11-05 Hugo Villeneuve + + Code cleanup (tree view store init) + +2013-11-05 Hugo Villeneuve + + Increase dissassembled instructions lines from 24 to 100 + +2013-11-05 Hugo Villeneuve + + Add red color for current instruction in pgmwin + +2013-11-05 Hugo Villeneuve + + Refresh pgmwin after modifying regwin (PC) + +2013-11-05 Hugo Villeneuve + + Add offset address to memwin dump header + +2013-11-05 Hugo Villeneuve + + Remove address parameter when dumping memwin + +2013-11-05 Hugo Villeneuve + + Refactor code for memwin and pgmwin modify + + Add common functions int2asciihex and asciihex2int + +2013-11-05 Hugo Villeneuve + + Registers window can now be edited + +2013-11-05 Hugo Villeneuve + + Refresh register window after any memory modification + + Banked registers R0 to R7 depend on internal memory content. + +2013-11-05 Hugo Villeneuve + + Memory window can now be edited + +2013-11-05 Hugo Villeneuve + + Replace macro EMU8051_DEBUG with logging functions + +2013-11-05 Hugo Villeneuve + + Replace custom command-line options processing with argp + +2013-11-05 Hugo Villeneuve + + Add debug log functions + +2013-11-05 Hugo Villeneuve + + Replace custom help->about dialog with gtk_show_about_dialog + +2013-11-05 Hugo Villeneuve + + Add web site url and bug report email to AC_INIT + +2013-10-09 Hugo Villeneuve + + Act as if reset was pressed if no hex file is specified at startup + +2013-10-09 Hugo Villeneuve + + Replace GTK deprecated functions + + gtk_signal_connect_object -> g_signal_connect + gtk_menu_bar_append -> gtk_menu_shell_append + + Also simplified ShowMessage function. + +2013-10-09 Hugo Villeneuve + + Replace deprecated gtk_clist (pgmwin) + +2013-10-09 Hugo Villeneuve + + Replace deprecated gtk_clist (regwin) + +2013-10-09 Hugo Villeneuve + + Add title to memory window + +2013-10-09 Hugo Villeneuve + + Refactor memory window ASCII display code section + +2013-10-09 Hugo Villeneuve + + Refactor memory window code section + +2013-10-09 Hugo Villeneuve + + Replace deprecated gtk_clist (memwin) + +2013-10-09 Hugo Villeneuve + + Replace autogen custom commands with autoreconf + +2013-10-09 Hugo Villeneuve + + Rename config to build-aux + +2013-10-09 Hugo Villeneuve + + Remove unused configure option --enable-debug + +2013-10-09 Hugo Villeneuve + + Remove unused/commented code + +2013-10-09 Hugo Villeneuve + + Remove superfluous function call gtk_widget_show_all() when creating menu + +2013-10-09 Hugo Villeneuve + + Remove superfluous function WindowDestroyEvent + +2013-10-09 Hugo Villeneuve + + Fix bug with children not resizing with main window + +2013-10-09 Hugo Villeneuve + + Add Gtk windows diagram + + Rename main_vbox -> vbox. + +2013-10-09 Hugo Villeneuve + + Add example configuration file + +2013-10-09 Hugo Villeneuve + + Save paned positions and main window size to config file + +2013-10-09 Hugo Villeneuve + + Add support for saving UI settings to config file + +2013-10-01 Hugo Villeneuve + + Rename fixed_frame variable to scrollwin + +2013-10-01 Hugo Villeneuve + + Add vpaned to separate memory dump window + +2013-10-01 Hugo Villeneuve + + Add hpaned to separate pgm and disassembly windows + +2013-10-01 Hugo Villeneuve + + Remove obsolete gtksizes.h + +2013-09-30 Hugo Villeneuve + + Eliminate all fixed size windows + +2013-09-30 Hugo Villeneuve + + Allow frames to expand and fill inside vbox and hbox + +2013-09-30 Hugo Villeneuve + + Remove fixed frame containing the 3 major windows + +2013-09-30 Hugo Villeneuve + + Replace fixed frames with scrollable windows + + Done for program, register and memory dump windows. + +2013-09-30 Hugo Villeneuve + + Replace deprecated gtk_widget_set_usize() + +2013-09-30 Hugo Villeneuve + + Replace deprecated gtk_menu_append() + +2013-09-30 Hugo Villeneuve + + Replace deprecated gtk_signal_connect() + +2013-09-30 Hugo Villeneuve + + Increase spacing between buttons + +2013-09-30 Hugo Villeneuve + + Replace deprecated functions for displaying pixmap buttons + +2013-09-08 Hugo Villeneuve + + Replace gtk_idle functions with g_idle equivalents + +2013-09-08 Hugo Villeneuve + + Activate gtk deprecated compilation flags + +2013-09-08 Hugo Villeneuve + + Remember previous opened directory in file selection dialog + +2013-09-08 Hugo Villeneuve + + Use current working directory for initial file selection dialog + +2013-09-08 Hugo Villeneuve + + Replace gtk_file_selection dialog with gtk_file_chooser + + Increase minimum gtk version to 2.4.0. + +2013-09-08 Hugo Villeneuve + + Release v1.1.2 + +2013-09-08 Hugo Villeneuve + + Fix compiler warning (and potential bug) in auto-generated 8051 instructions + + Original warning: + warning: operation on ‘cpu8051.pc’ may be undefined [-Wsequence-point] + +2013-09-08 Hugo Villeneuve + + Fix compiler warning about unused variable set by getline() + +2013-09-08 Hugo Villeneuve + + Fix compiler warning about unused variable set by getch() + +2013-09-08 Hugo Villeneuve + + Fix error with CJNE instruction + + When the comparison was true, the PC was advanced by 2 instead of 3 bytes. + + Error reported and fixed by Tobias Diedrich (ranma at tdiedrich.de). + +2013-09-08 Hugo Villeneuve + + Add test file for CJNE bug + +2013-09-08 Hugo Villeneuve + + Remove obsolete comment about older c++ code + +2013-09-08 Hugo Villeneuve + + Fix trailing whitespace + +2013-09-08 Hugo Villeneuve + + Create two separate executables, emu8051-cli (default) and emu8051-gtk + + emu8051-gtk is optional and compiled only if Gtk+ is detected. + + Add optional size parameter when dumping memory. + +2013-09-08 Hugo Villeneuve + + Add display of address in case of error + +2013-09-08 Hugo Villeneuve + + Fix error with SJMP instruction + + Error reported and fixed by Pierre Ferrari (piferr4ri at gmail.com). + +2013-09-08 Hugo Villeneuve + + Improve window sizing + + Based on suggestions from Pierre Ferrari (piferr4ri at gmail.com). + +2013-09-08 Hugo Villeneuve + + Remove unnecessary autoconf checks + + Disable debug message when not compiled in debug mode. + +2013-09-08 Hugo Villeneuve + + Fix syntax errors in ascii to int conversion + +2013-09-08 Hugo Villeneuve + + Conversion from iso8859-1 to utf-8 + +2013-09-08 Hugo Villeneuve + + Run checkpatch.pl on every source file + +2013-09-08 Hugo Villeneuve + + Update NEWS and ChangeLog + +2013-09-08 Hugo Villeneuve + + Reintroduce command line mode + +2013-09-08 Hugo Villeneuve + + Update Free Software Foundation address + +2013-09-08 Hugo Villeneuve + + Add licencing information to each source file + + Remove some debug messages. + +2013-09-08 Hugo Villeneuve + + Upgrade to gtk+-2 + + Remove gtk+-1.0 support. + +2013-09-08 Hugo Villeneuve + + Add automatic regeneration of files from opcode2c.pl to src/Makefile.am + +2013-09-08 Hugo Villeneuve + + Code simplification and cleanup + +2013-09-08 Hugo Villeneuve + + Modify generated files for 8051 instructions + + Seems to be working good. + +2013-09-08 Hugo Villeneuve + + Add options -h and -version + + Merge common function LoadHexFile() to file.c. + +2013-09-08 Hugo Villeneuve + + Change autogen.sh script and rename test_files directory + +2013-09-08 Hugo Villeneuve + + Increase version number + +2013-09-08 Hugo Villeneuve + + Add documentation + +2013-09-08 Hugo Villeneuve + + Initial import diff -Nru emu8051-1.1.1/config/compile emu8051-2.0.1/config/compile --- emu8051-1.1.1/config/compile 2011-11-20 21:31:12.000000000 +0000 +++ emu8051-2.0.1/config/compile 1970-01-01 00:00:00.000000000 +0000 @@ -1,143 +0,0 @@ -#! /bin/sh -# Wrapper for compilers which do not understand `-c -o'. - -scriptversion=2009-10-06.20; # UTC - -# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009 Free Software -# Foundation, Inc. -# Written by Tom Tromey . -# -# This program is free software; you can redistribute 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, see . - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# This file is maintained in Automake, please report -# bugs to or send patches to -# . - -case $1 in - '') - echo "$0: No command. Try \`$0 --help' for more information." 1>&2 - exit 1; - ;; - -h | --h*) - cat <<\EOF -Usage: compile [--help] [--version] PROGRAM [ARGS] - -Wrapper for compilers which do not understand `-c -o'. -Remove `-o dest.o' from ARGS, run PROGRAM with the remaining -arguments, and rename the output as expected. - -If you are trying to build a whole package this is not the -right script to run: please start by reading the file `INSTALL'. - -Report bugs to . -EOF - exit $? - ;; - -v | --v*) - echo "compile $scriptversion" - exit $? - ;; -esac - -ofile= -cfile= -eat= - -for arg -do - if test -n "$eat"; then - eat= - else - case $1 in - -o) - # configure might choose to run compile as `compile cc -o foo foo.c'. - # So we strip `-o arg' only if arg is an object. - eat=1 - case $2 in - *.o | *.obj) - ofile=$2 - ;; - *) - set x "$@" -o "$2" - shift - ;; - esac - ;; - *.c) - cfile=$1 - set x "$@" "$1" - shift - ;; - *) - set x "$@" "$1" - shift - ;; - esac - fi - shift -done - -if test -z "$ofile" || test -z "$cfile"; then - # If no `-o' option was seen then we might have been invoked from a - # pattern rule where we don't need one. That is ok -- this is a - # normal compilation that the losing compiler can handle. If no - # `.c' file was seen then we are probably linking. That is also - # ok. - exec "$@" -fi - -# Name of file we expect compiler to create. -cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` - -# Create the lock directory. -# Note: use `[/\\:.-]' here to ensure that we don't use the same name -# that we are using for the .o file. Also, base the name on the expected -# object file name, since that is what matters with a parallel build. -lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d -while true; do - if mkdir "$lockdir" >/dev/null 2>&1; then - break - fi - sleep 1 -done -# FIXME: race condition here if user kills between mkdir and trap. -trap "rmdir '$lockdir'; exit 1" 1 2 15 - -# Run the compile. -"$@" -ret=$? - -if test -f "$cofile"; then - test "$cofile" = "$ofile" || mv "$cofile" "$ofile" -elif test -f "${cofile}bj"; then - test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" -fi - -rmdir "$lockdir" -exit $ret - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" -# time-stamp-end: "; # UTC" -# End: diff -Nru emu8051-1.1.1/config/debug.m4 emu8051-2.0.1/config/debug.m4 --- emu8051-1.1.1/config/debug.m4 2011-10-29 21:06:32.000000000 +0000 +++ emu8051-2.0.1/config/debug.m4 1970-01-01 00:00:00.000000000 +0000 @@ -1,18 +0,0 @@ -dnl -dnl Macro for adding an option to 'configure' for enabling debugging messages -dnl -AC_DEFUN([HV_CHECK_FOR_DEBUG],[ -AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], - [enable debugging messages on console - (default is NO)]),[ - if test x"${enableval}" = xyes; then - debug_messages=1 - AC_DEFINE([DEBUG],1,[Set to 1 to enable debugging messages.]) - elif test x"${enableval}" = xno; then - debug_messages=0 - else - AC_MSG_ERROR(bad value for --enable-debug option) - fi -], debug_messages=0 ) -]) - diff -Nru emu8051-1.1.1/config/depcomp emu8051-2.0.1/config/depcomp --- emu8051-1.1.1/config/depcomp 2011-11-20 21:31:12.000000000 +0000 +++ emu8051-2.0.1/config/depcomp 1970-01-01 00:00:00.000000000 +0000 @@ -1,630 +0,0 @@ -#! /bin/sh -# depcomp - compile a program generating dependencies as side-effects - -scriptversion=2009-04-28.21; # UTC - -# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free -# Software Foundation, Inc. - -# This program is free software; you can redistribute 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, see . - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Originally written by Alexandre Oliva . - -case $1 in - '') - echo "$0: No command. Try \`$0 --help' for more information." 1>&2 - exit 1; - ;; - -h | --h*) - cat <<\EOF -Usage: depcomp [--help] [--version] PROGRAM [ARGS] - -Run PROGRAMS ARGS to compile a file, generating dependencies -as side-effects. - -Environment variables: - depmode Dependency tracking mode. - source Source file read by `PROGRAMS ARGS'. - object Object file output by `PROGRAMS ARGS'. - DEPDIR directory where to store dependencies. - depfile Dependency file to output. - tmpdepfile Temporary file to use when outputing dependencies. - libtool Whether libtool is used (yes/no). - -Report bugs to . -EOF - exit $? - ;; - -v | --v*) - echo "depcomp $scriptversion" - exit $? - ;; -esac - -if test -z "$depmode" || test -z "$source" || test -z "$object"; then - echo "depcomp: Variables source, object and depmode must be set" 1>&2 - exit 1 -fi - -# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. -depfile=${depfile-`echo "$object" | - sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} -tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} - -rm -f "$tmpdepfile" - -# Some modes work just like other modes, but use different flags. We -# parameterize here, but still list the modes in the big case below, -# to make depend.m4 easier to write. Note that we *cannot* use a case -# here, because this file can only contain one case statement. -if test "$depmode" = hp; then - # HP compiler uses -M and no extra arg. - gccflag=-M - depmode=gcc -fi - -if test "$depmode" = dashXmstdout; then - # This is just like dashmstdout with a different argument. - dashmflag=-xM - depmode=dashmstdout -fi - -cygpath_u="cygpath -u -f -" -if test "$depmode" = msvcmsys; then - # This is just like msvisualcpp but w/o cygpath translation. - # Just convert the backslash-escaped backslashes to single forward - # slashes to satisfy depend.m4 - cygpath_u="sed s,\\\\\\\\,/,g" - depmode=msvisualcpp -fi - -case "$depmode" in -gcc3) -## gcc 3 implements dependency tracking that does exactly what -## we want. Yay! Note: for some reason libtool 1.4 doesn't like -## it if -MD -MP comes after the -MF stuff. Hmm. -## Unfortunately, FreeBSD c89 acceptance of flags depends upon -## the command line argument order; so add the flags where they -## appear in depend2.am. Note that the slowdown incurred here -## affects only configure: in makefiles, %FASTDEP% shortcuts this. - for arg - do - case $arg in - -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; - *) set fnord "$@" "$arg" ;; - esac - shift # fnord - shift # $arg - done - "$@" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - mv "$tmpdepfile" "$depfile" - ;; - -gcc) -## There are various ways to get dependency output from gcc. Here's -## why we pick this rather obscure method: -## - Don't want to use -MD because we'd like the dependencies to end -## up in a subdir. Having to rename by hand is ugly. -## (We might end up doing this anyway to support other compilers.) -## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like -## -MM, not -M (despite what the docs say). -## - Using -M directly means running the compiler twice (even worse -## than renaming). - if test -z "$gccflag"; then - gccflag=-MD, - fi - "$@" -Wp,"$gccflag$tmpdepfile" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - echo "$object : \\" > "$depfile" - alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz -## The second -e expression handles DOS-style file names with drive letters. - sed -e 's/^[^:]*: / /' \ - -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" -## This next piece of magic avoids the `deleted header file' problem. -## The problem is that when a header file which appears in a .P file -## is deleted, the dependency causes make to die (because there is -## typically no way to rebuild the header). We avoid this by adding -## dummy dependencies for each header file. Too bad gcc doesn't do -## this for us directly. - tr ' ' ' -' < "$tmpdepfile" | -## Some versions of gcc put a space before the `:'. On the theory -## that the space means something, we add a space to the output as -## well. -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -hp) - # This case exists only to let depend.m4 do its work. It works by - # looking at the text of this script. This case will never be run, - # since it is checked for above. - exit 1 - ;; - -sgi) - if test "$libtool" = yes; then - "$@" "-Wp,-MDupdate,$tmpdepfile" - else - "$@" -MDupdate "$tmpdepfile" - fi - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - - if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files - echo "$object : \\" > "$depfile" - - # Clip off the initial element (the dependent). Don't try to be - # clever and replace this with sed code, as IRIX sed won't handle - # lines with more than a fixed number of characters (4096 in - # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; - # the IRIX cc adds comments like `#:fec' to the end of the - # dependency line. - tr ' ' ' -' < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ - tr ' -' ' ' >> "$depfile" - echo >> "$depfile" - - # The second pass generates a dummy entry for each header file. - tr ' ' ' -' < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ - >> "$depfile" - else - # The sourcefile does not contain any dependencies, so just - # store a dummy comment line, to avoid errors with the Makefile - # "include basename.Plo" scheme. - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -aix) - # The C for AIX Compiler uses -M and outputs the dependencies - # in a .u file. In older versions, this file always lives in the - # current directory. Also, the AIX compiler puts `$object:' at the - # start of each line; $object doesn't have directory information. - # Version 6 uses the directory in both cases. - dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` - test "x$dir" = "x$object" && dir= - base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` - if test "$libtool" = yes; then - tmpdepfile1=$dir$base.u - tmpdepfile2=$base.u - tmpdepfile3=$dir.libs/$base.u - "$@" -Wc,-M - else - tmpdepfile1=$dir$base.u - tmpdepfile2=$dir$base.u - tmpdepfile3=$dir$base.u - "$@" -M - fi - stat=$? - - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" - exit $stat - fi - - for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" - do - test -f "$tmpdepfile" && break - done - if test -f "$tmpdepfile"; then - # Each line is of the form `foo.o: dependent.h'. - # Do two passes, one to just change these to - # `$object: dependent.h' and one to simply `dependent.h:'. - sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" - # That's a tab and a space in the []. - sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" - else - # The sourcefile does not contain any dependencies, so just - # store a dummy comment line, to avoid errors with the Makefile - # "include basename.Plo" scheme. - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -icc) - # Intel's C compiler understands `-MD -MF file'. However on - # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c - # ICC 7.0 will fill foo.d with something like - # foo.o: sub/foo.c - # foo.o: sub/foo.h - # which is wrong. We want: - # sub/foo.o: sub/foo.c - # sub/foo.o: sub/foo.h - # sub/foo.c: - # sub/foo.h: - # ICC 7.1 will output - # foo.o: sub/foo.c sub/foo.h - # and will wrap long lines using \ : - # foo.o: sub/foo.c ... \ - # sub/foo.h ... \ - # ... - - "$@" -MD -MF "$tmpdepfile" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - # Each line is of the form `foo.o: dependent.h', - # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. - # Do two passes, one to just change these to - # `$object: dependent.h' and one to simply `dependent.h:'. - sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" - # Some versions of the HPUX 10.20 sed can't process this invocation - # correctly. Breaking it into two sed invocations is a workaround. - sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | - sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -hp2) - # The "hp" stanza above does not work with aCC (C++) and HP's ia64 - # compilers, which have integrated preprocessors. The correct option - # to use with these is +Maked; it writes dependencies to a file named - # 'foo.d', which lands next to the object file, wherever that - # happens to be. - # Much of this is similar to the tru64 case; see comments there. - dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` - test "x$dir" = "x$object" && dir= - base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` - if test "$libtool" = yes; then - tmpdepfile1=$dir$base.d - tmpdepfile2=$dir.libs/$base.d - "$@" -Wc,+Maked - else - tmpdepfile1=$dir$base.d - tmpdepfile2=$dir$base.d - "$@" +Maked - fi - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile1" "$tmpdepfile2" - exit $stat - fi - - for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" - do - test -f "$tmpdepfile" && break - done - if test -f "$tmpdepfile"; then - sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" - # Add `dependent.h:' lines. - sed -ne '2,${ - s/^ *// - s/ \\*$// - s/$/:/ - p - }' "$tmpdepfile" >> "$depfile" - else - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" "$tmpdepfile2" - ;; - -tru64) - # The Tru64 compiler uses -MD to generate dependencies as a side - # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. - # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put - # dependencies in `foo.d' instead, so we check for that too. - # Subdirectories are respected. - dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` - test "x$dir" = "x$object" && dir= - base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` - - if test "$libtool" = yes; then - # With Tru64 cc, shared objects can also be used to make a - # static library. This mechanism is used in libtool 1.4 series to - # handle both shared and static libraries in a single compilation. - # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. - # - # With libtool 1.5 this exception was removed, and libtool now - # generates 2 separate objects for the 2 libraries. These two - # compilations output dependencies in $dir.libs/$base.o.d and - # in $dir$base.o.d. We have to check for both files, because - # one of the two compilations can be disabled. We should prefer - # $dir$base.o.d over $dir.libs/$base.o.d because the latter is - # automatically cleaned when .libs/ is deleted, while ignoring - # the former would cause a distcleancheck panic. - tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 - tmpdepfile2=$dir$base.o.d # libtool 1.5 - tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 - tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 - "$@" -Wc,-MD - else - tmpdepfile1=$dir$base.o.d - tmpdepfile2=$dir$base.d - tmpdepfile3=$dir$base.d - tmpdepfile4=$dir$base.d - "$@" -MD - fi - - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" - exit $stat - fi - - for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" - do - test -f "$tmpdepfile" && break - done - if test -f "$tmpdepfile"; then - sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" - # That's a tab and a space in the []. - sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" - else - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -#nosideeffect) - # This comment above is used by automake to tell side-effect - # dependency tracking mechanisms from slower ones. - -dashmstdout) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout, regardless of -o. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test "X$1" != 'X--mode=compile'; do - shift - done - shift - fi - - # Remove `-o $object'. - IFS=" " - for arg - do - case $arg in - -o) - shift - ;; - $object) - shift - ;; - *) - set fnord "$@" "$arg" - shift # fnord - shift # $arg - ;; - esac - done - - test -z "$dashmflag" && dashmflag=-M - # Require at least two characters before searching for `:' - # in the target name. This is to cope with DOS-style filenames: - # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. - "$@" $dashmflag | - sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" - rm -f "$depfile" - cat < "$tmpdepfile" > "$depfile" - tr ' ' ' -' < "$tmpdepfile" | \ -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -dashXmstdout) - # This case only exists to satisfy depend.m4. It is never actually - # run, as this mode is specially recognized in the preamble. - exit 1 - ;; - -makedepend) - "$@" || exit $? - # Remove any Libtool call - if test "$libtool" = yes; then - while test "X$1" != 'X--mode=compile'; do - shift - done - shift - fi - # X makedepend - shift - cleared=no eat=no - for arg - do - case $cleared in - no) - set ""; shift - cleared=yes ;; - esac - if test $eat = yes; then - eat=no - continue - fi - case "$arg" in - -D*|-I*) - set fnord "$@" "$arg"; shift ;; - # Strip any option that makedepend may not understand. Remove - # the object too, otherwise makedepend will parse it as a source file. - -arch) - eat=yes ;; - -*|$object) - ;; - *) - set fnord "$@" "$arg"; shift ;; - esac - done - obj_suffix=`echo "$object" | sed 's/^.*\././'` - touch "$tmpdepfile" - ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" - rm -f "$depfile" - cat < "$tmpdepfile" > "$depfile" - sed '1,2d' "$tmpdepfile" | tr ' ' ' -' | \ -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" "$tmpdepfile".bak - ;; - -cpp) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test "X$1" != 'X--mode=compile'; do - shift - done - shift - fi - - # Remove `-o $object'. - IFS=" " - for arg - do - case $arg in - -o) - shift - ;; - $object) - shift - ;; - *) - set fnord "$@" "$arg" - shift # fnord - shift # $arg - ;; - esac - done - - "$@" -E | - sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ - -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | - sed '$ s: \\$::' > "$tmpdepfile" - rm -f "$depfile" - echo "$object : \\" > "$depfile" - cat < "$tmpdepfile" >> "$depfile" - sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -msvisualcpp) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test "X$1" != 'X--mode=compile'; do - shift - done - shift - fi - - IFS=" " - for arg - do - case "$arg" in - -o) - shift - ;; - $object) - shift - ;; - "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") - set fnord "$@" - shift - shift - ;; - *) - set fnord "$@" "$arg" - shift - shift - ;; - esac - done - "$@" -E 2>/dev/null | - sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" - rm -f "$depfile" - echo "$object : \\" > "$depfile" - sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" - echo " " >> "$depfile" - sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -msvcmsys) - # This case exists only to let depend.m4 do its work. It works by - # looking at the text of this script. This case will never be run, - # since it is checked for above. - exit 1 - ;; - -none) - exec "$@" - ;; - -*) - echo "Unknown depmode $depmode" 1>&2 - exit 1 - ;; -esac - -exit 0 - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" -# time-stamp-end: "; # UTC" -# End: diff -Nru emu8051-1.1.1/config/install-sh emu8051-2.0.1/config/install-sh --- emu8051-1.1.1/config/install-sh 2011-11-20 21:31:12.000000000 +0000 +++ emu8051-2.0.1/config/install-sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,520 +0,0 @@ -#!/bin/sh -# install - install a program, script, or datafile - -scriptversion=2009-04-28.21; # UTC - -# This originates from X11R5 (mit/util/scripts/install.sh), which was -# later released in X11R6 (xc/config/util/install.sh) with the -# following copyright and license. -# -# Copyright (C) 1994 X Consortium -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- -# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -# Except as contained in this notice, the name of the X Consortium shall not -# be used in advertising or otherwise to promote the sale, use or other deal- -# ings in this Software without prior written authorization from the X Consor- -# tium. -# -# -# FSF changes to this file are in the public domain. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. - -nl=' -' -IFS=" "" $nl" - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit=${DOITPROG-} -if test -z "$doit"; then - doit_exec=exec -else - doit_exec=$doit -fi - -# Put in absolute file names if you don't have them in your path; -# or use environment vars. - -chgrpprog=${CHGRPPROG-chgrp} -chmodprog=${CHMODPROG-chmod} -chownprog=${CHOWNPROG-chown} -cmpprog=${CMPPROG-cmp} -cpprog=${CPPROG-cp} -mkdirprog=${MKDIRPROG-mkdir} -mvprog=${MVPROG-mv} -rmprog=${RMPROG-rm} -stripprog=${STRIPPROG-strip} - -posix_glob='?' -initialize_posix_glob=' - test "$posix_glob" != "?" || { - if (set -f) 2>/dev/null; then - posix_glob= - else - posix_glob=: - fi - } -' - -posix_mkdir= - -# Desired mode of installed file. -mode=0755 - -chgrpcmd= -chmodcmd=$chmodprog -chowncmd= -mvcmd=$mvprog -rmcmd="$rmprog -f" -stripcmd= - -src= -dst= -dir_arg= -dst_arg= - -copy_on_change=false -no_target_directory= - -usage="\ -Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE - or: $0 [OPTION]... SRCFILES... DIRECTORY - or: $0 [OPTION]... -t DIRECTORY SRCFILES... - or: $0 [OPTION]... -d DIRECTORIES... - -In the 1st form, copy SRCFILE to DSTFILE. -In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. -In the 4th, create DIRECTORIES. - -Options: - --help display this help and exit. - --version display version info and exit. - - -c (ignored) - -C install only if different (preserve the last data modification time) - -d create directories instead of installing files. - -g GROUP $chgrpprog installed files to GROUP. - -m MODE $chmodprog installed files to MODE. - -o USER $chownprog installed files to USER. - -s $stripprog installed files. - -t DIRECTORY install into DIRECTORY. - -T report an error if DSTFILE is a directory. - -Environment variables override the default commands: - CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG - RMPROG STRIPPROG -" - -while test $# -ne 0; do - case $1 in - -c) ;; - - -C) copy_on_change=true;; - - -d) dir_arg=true;; - - -g) chgrpcmd="$chgrpprog $2" - shift;; - - --help) echo "$usage"; exit $?;; - - -m) mode=$2 - case $mode in - *' '* | *' '* | *' -'* | *'*'* | *'?'* | *'['*) - echo "$0: invalid mode: $mode" >&2 - exit 1;; - esac - shift;; - - -o) chowncmd="$chownprog $2" - shift;; - - -s) stripcmd=$stripprog;; - - -t) dst_arg=$2 - shift;; - - -T) no_target_directory=true;; - - --version) echo "$0 $scriptversion"; exit $?;; - - --) shift - break;; - - -*) echo "$0: invalid option: $1" >&2 - exit 1;; - - *) break;; - esac - shift -done - -if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then - # When -d is used, all remaining arguments are directories to create. - # When -t is used, the destination is already specified. - # Otherwise, the last argument is the destination. Remove it from $@. - for arg - do - if test -n "$dst_arg"; then - # $@ is not empty: it contains at least $arg. - set fnord "$@" "$dst_arg" - shift # fnord - fi - shift # arg - dst_arg=$arg - done -fi - -if test $# -eq 0; then - if test -z "$dir_arg"; then - echo "$0: no input file specified." >&2 - exit 1 - fi - # It's OK to call `install-sh -d' without argument. - # This can happen when creating conditional directories. - exit 0 -fi - -if test -z "$dir_arg"; then - trap '(exit $?); exit' 1 2 13 15 - - # Set umask so as not to create temps with too-generous modes. - # However, 'strip' requires both read and write access to temps. - case $mode in - # Optimize common cases. - *644) cp_umask=133;; - *755) cp_umask=22;; - - *[0-7]) - if test -z "$stripcmd"; then - u_plus_rw= - else - u_plus_rw='% 200' - fi - cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; - *) - if test -z "$stripcmd"; then - u_plus_rw= - else - u_plus_rw=,u+rw - fi - cp_umask=$mode$u_plus_rw;; - esac -fi - -for src -do - # Protect names starting with `-'. - case $src in - -*) src=./$src;; - esac - - if test -n "$dir_arg"; then - dst=$src - dstdir=$dst - test -d "$dstdir" - dstdir_status=$? - else - - # Waiting for this to be detected by the "$cpprog $src $dsttmp" command - # might cause directories to be created, which would be especially bad - # if $src (and thus $dsttmp) contains '*'. - if test ! -f "$src" && test ! -d "$src"; then - echo "$0: $src does not exist." >&2 - exit 1 - fi - - if test -z "$dst_arg"; then - echo "$0: no destination specified." >&2 - exit 1 - fi - - dst=$dst_arg - # Protect names starting with `-'. - case $dst in - -*) dst=./$dst;; - esac - - # If destination is a directory, append the input filename; won't work - # if double slashes aren't ignored. - if test -d "$dst"; then - if test -n "$no_target_directory"; then - echo "$0: $dst_arg: Is a directory" >&2 - exit 1 - fi - dstdir=$dst - dst=$dstdir/`basename "$src"` - dstdir_status=0 - else - # Prefer dirname, but fall back on a substitute if dirname fails. - dstdir=` - (dirname "$dst") 2>/dev/null || - expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$dst" : 'X\(//\)[^/]' \| \ - X"$dst" : 'X\(//\)$' \| \ - X"$dst" : 'X\(/\)' \| . 2>/dev/null || - echo X"$dst" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q' - ` - - test -d "$dstdir" - dstdir_status=$? - fi - fi - - obsolete_mkdir_used=false - - if test $dstdir_status != 0; then - case $posix_mkdir in - '') - # Create intermediate dirs using mode 755 as modified by the umask. - # This is like FreeBSD 'install' as of 1997-10-28. - umask=`umask` - case $stripcmd.$umask in - # Optimize common cases. - *[2367][2367]) mkdir_umask=$umask;; - .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; - - *[0-7]) - mkdir_umask=`expr $umask + 22 \ - - $umask % 100 % 40 + $umask % 20 \ - - $umask % 10 % 4 + $umask % 2 - `;; - *) mkdir_umask=$umask,go-w;; - esac - - # With -d, create the new directory with the user-specified mode. - # Otherwise, rely on $mkdir_umask. - if test -n "$dir_arg"; then - mkdir_mode=-m$mode - else - mkdir_mode= - fi - - posix_mkdir=false - case $umask in - *[123567][0-7][0-7]) - # POSIX mkdir -p sets u+wx bits regardless of umask, which - # is incompatible with FreeBSD 'install' when (umask & 300) != 0. - ;; - *) - tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ - trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 - - if (umask $mkdir_umask && - exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 - then - if test -z "$dir_arg" || { - # Check for POSIX incompatibilities with -m. - # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or - # other-writeable bit of parent directory when it shouldn't. - # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. - ls_ld_tmpdir=`ls -ld "$tmpdir"` - case $ls_ld_tmpdir in - d????-?r-*) different_mode=700;; - d????-?--*) different_mode=755;; - *) false;; - esac && - $mkdirprog -m$different_mode -p -- "$tmpdir" && { - ls_ld_tmpdir_1=`ls -ld "$tmpdir"` - test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" - } - } - then posix_mkdir=: - fi - rmdir "$tmpdir/d" "$tmpdir" - else - # Remove any dirs left behind by ancient mkdir implementations. - rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null - fi - trap '' 0;; - esac;; - esac - - if - $posix_mkdir && ( - umask $mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" - ) - then : - else - - # The umask is ridiculous, or mkdir does not conform to POSIX, - # or it failed possibly due to a race condition. Create the - # directory the slow way, step by step, checking for races as we go. - - case $dstdir in - /*) prefix='/';; - -*) prefix='./';; - *) prefix='';; - esac - - eval "$initialize_posix_glob" - - oIFS=$IFS - IFS=/ - $posix_glob set -f - set fnord $dstdir - shift - $posix_glob set +f - IFS=$oIFS - - prefixes= - - for d - do - test -z "$d" && continue - - prefix=$prefix$d - if test -d "$prefix"; then - prefixes= - else - if $posix_mkdir; then - (umask=$mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break - # Don't fail if two instances are running concurrently. - test -d "$prefix" || exit 1 - else - case $prefix in - *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; - *) qprefix=$prefix;; - esac - prefixes="$prefixes '$qprefix'" - fi - fi - prefix=$prefix/ - done - - if test -n "$prefixes"; then - # Don't fail if two instances are running concurrently. - (umask $mkdir_umask && - eval "\$doit_exec \$mkdirprog $prefixes") || - test -d "$dstdir" || exit 1 - obsolete_mkdir_used=true - fi - fi - fi - - if test -n "$dir_arg"; then - { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && - { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && - { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || - test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 - else - - # Make a couple of temp file names in the proper directory. - dsttmp=$dstdir/_inst.$$_ - rmtmp=$dstdir/_rm.$$_ - - # Trap to clean up those temp files at exit. - trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 - - # Copy the file name to the temp name. - (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && - - # and set any options; do chmod last to preserve setuid bits. - # - # If any of these fail, we abort the whole thing. If we want to - # ignore errors from any of these, just make sure not to ignore - # errors from the above "$doit $cpprog $src $dsttmp" command. - # - { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && - { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && - { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && - { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && - - # If -C, don't bother to copy if it wouldn't change the file. - if $copy_on_change && - old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && - new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && - - eval "$initialize_posix_glob" && - $posix_glob set -f && - set X $old && old=:$2:$4:$5:$6 && - set X $new && new=:$2:$4:$5:$6 && - $posix_glob set +f && - - test "$old" = "$new" && - $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 - then - rm -f "$dsttmp" - else - # Rename the file to the real destination. - $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || - - # The rename failed, perhaps because mv can't rename something else - # to itself, or perhaps because mv is so ancient that it does not - # support -f. - { - # Now remove or move aside any old file at destination location. - # We try this two ways since rm can't unlink itself on some - # systems and the destination file might be busy for other - # reasons. In this case, the final cleanup might fail but the new - # file should still install successfully. - { - test ! -f "$dst" || - $doit $rmcmd -f "$dst" 2>/dev/null || - { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && - { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } - } || - { echo "$0: cannot unlink or rename $dst" >&2 - (exit 1); exit 1 - } - } && - - # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dst" - } - fi || exit 1 - - trap '' 0 - fi -done - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" -# time-stamp-end: "; # UTC" -# End: diff -Nru emu8051-1.1.1/config/missing emu8051-2.0.1/config/missing --- emu8051-1.1.1/config/missing 2011-11-20 21:31:12.000000000 +0000 +++ emu8051-2.0.1/config/missing 1970-01-01 00:00:00.000000000 +0000 @@ -1,376 +0,0 @@ -#! /bin/sh -# Common stub for a few missing GNU programs while installing. - -scriptversion=2009-04-28.21; # UTC - -# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, -# 2008, 2009 Free Software Foundation, Inc. -# Originally by Fran,cois Pinard , 1996. - -# This program is free software; you can redistribute 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, see . - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -if test $# -eq 0; then - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 -fi - -run=: -sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' -sed_minuso='s/.* -o \([^ ]*\).*/\1/p' - -# In the cases where this matters, `missing' is being run in the -# srcdir already. -if test -f configure.ac; then - configure_ac=configure.ac -else - configure_ac=configure.in -fi - -msg="missing on your system" - -case $1 in ---run) - # Try to run requested program, and just exit if it succeeds. - run= - shift - "$@" && exit 0 - # Exit code 63 means version mismatch. This often happens - # when the user try to use an ancient version of a tool on - # a file that requires a minimum version. In this case we - # we should proceed has if the program had been absent, or - # if --run hadn't been passed. - if test $? = 63; then - run=: - msg="probably too old" - fi - ;; - - -h|--h|--he|--hel|--help) - echo "\ -$0 [OPTION]... PROGRAM [ARGUMENT]... - -Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an -error status if there is no known handling for PROGRAM. - -Options: - -h, --help display this help and exit - -v, --version output version information and exit - --run try to run the given command, and emulate it if it fails - -Supported PROGRAM values: - aclocal touch file \`aclocal.m4' - autoconf touch file \`configure' - autoheader touch file \`config.h.in' - autom4te touch the output file, or create a stub one - automake touch all \`Makefile.in' files - bison create \`y.tab.[ch]', if possible, from existing .[ch] - flex create \`lex.yy.c', if possible, from existing .c - help2man touch the output file - lex create \`lex.yy.c', if possible, from existing .c - makeinfo touch the output file - tar try tar, gnutar, gtar, then tar without non-portable flags - yacc create \`y.tab.[ch]', if possible, from existing .[ch] - -Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and -\`g' are ignored when checking the name. - -Send bug reports to ." - exit $? - ;; - - -v|--v|--ve|--ver|--vers|--versi|--versio|--version) - echo "missing $scriptversion (GNU Automake)" - exit $? - ;; - - -*) - echo 1>&2 "$0: Unknown \`$1' option" - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 - ;; - -esac - -# normalize program name to check for. -program=`echo "$1" | sed ' - s/^gnu-//; t - s/^gnu//; t - s/^g//; t'` - -# Now exit if we have it, but it failed. Also exit now if we -# don't have it and --version was passed (most likely to detect -# the program). This is about non-GNU programs, so use $1 not -# $program. -case $1 in - lex*|yacc*) - # Not GNU programs, they don't have --version. - ;; - - tar*) - if test -n "$run"; then - echo 1>&2 "ERROR: \`tar' requires --run" - exit 1 - elif test "x$2" = "x--version" || test "x$2" = "x--help"; then - exit 1 - fi - ;; - - *) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - elif test "x$2" = "x--version" || test "x$2" = "x--help"; then - # Could not run --version or --help. This is probably someone - # running `$TOOL --version' or `$TOOL --help' to check whether - # $TOOL exists and not knowing $TOOL uses missing. - exit 1 - fi - ;; -esac - -# If it does not exist, or fails to run (possibly an outdated version), -# try to emulate it. -case $program in - aclocal*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`acinclude.m4' or \`${configure_ac}'. You might want - to install the \`Automake' and \`Perl' packages. Grab them from - any GNU archive site." - touch aclocal.m4 - ;; - - autoconf*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`${configure_ac}'. You might want to install the - \`Autoconf' and \`GNU m4' packages. Grab them from any GNU - archive site." - touch configure - ;; - - autoheader*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`acconfig.h' or \`${configure_ac}'. You might want - to install the \`Autoconf' and \`GNU m4' packages. Grab them - from any GNU archive site." - files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` - test -z "$files" && files="config.h" - touch_files= - for f in $files; do - case $f in - *:*) touch_files="$touch_files "`echo "$f" | - sed -e 's/^[^:]*://' -e 's/:.*//'`;; - *) touch_files="$touch_files $f.in";; - esac - done - touch $touch_files - ;; - - automake*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. - You might want to install the \`Automake' and \`Perl' packages. - Grab them from any GNU archive site." - find . -type f -name Makefile.am -print | - sed 's/\.am$/.in/' | - while read f; do touch "$f"; done - ;; - - autom4te*) - echo 1>&2 "\ -WARNING: \`$1' is needed, but is $msg. - You might have modified some files without having the - proper tools for further handling them. - You can get \`$1' as part of \`Autoconf' from any GNU - archive site." - - file=`echo "$*" | sed -n "$sed_output"` - test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` - if test -f "$file"; then - touch $file - else - test -z "$file" || exec >$file - echo "#! /bin/sh" - echo "# Created by GNU Automake missing as a replacement of" - echo "# $ $@" - echo "exit 0" - chmod +x $file - exit 1 - fi - ;; - - bison*|yacc*) - echo 1>&2 "\ -WARNING: \`$1' $msg. You should only need it if - you modified a \`.y' file. You may need the \`Bison' package - in order for those modifications to take effect. You can get - \`Bison' from any GNU archive site." - rm -f y.tab.c y.tab.h - if test $# -ne 1; then - eval LASTARG="\${$#}" - case $LASTARG in - *.y) - SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` - if test -f "$SRCFILE"; then - cp "$SRCFILE" y.tab.c - fi - SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` - if test -f "$SRCFILE"; then - cp "$SRCFILE" y.tab.h - fi - ;; - esac - fi - if test ! -f y.tab.h; then - echo >y.tab.h - fi - if test ! -f y.tab.c; then - echo 'main() { return 0; }' >y.tab.c - fi - ;; - - lex*|flex*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a \`.l' file. You may need the \`Flex' package - in order for those modifications to take effect. You can get - \`Flex' from any GNU archive site." - rm -f lex.yy.c - if test $# -ne 1; then - eval LASTARG="\${$#}" - case $LASTARG in - *.l) - SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` - if test -f "$SRCFILE"; then - cp "$SRCFILE" lex.yy.c - fi - ;; - esac - fi - if test ! -f lex.yy.c; then - echo 'main() { return 0; }' >lex.yy.c - fi - ;; - - help2man*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a dependency of a manual page. You may need the - \`Help2man' package in order for those modifications to take - effect. You can get \`Help2man' from any GNU archive site." - - file=`echo "$*" | sed -n "$sed_output"` - test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` - if test -f "$file"; then - touch $file - else - test -z "$file" || exec >$file - echo ".ab help2man is required to generate this page" - exit $? - fi - ;; - - makeinfo*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a \`.texi' or \`.texinfo' file, or any other file - indirectly affecting the aspect of the manual. The spurious - call might also be the consequence of using a buggy \`make' (AIX, - DU, IRIX). You might want to install the \`Texinfo' package or - the \`GNU make' package. Grab either from any GNU archive site." - # The file to touch is that specified with -o ... - file=`echo "$*" | sed -n "$sed_output"` - test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` - if test -z "$file"; then - # ... or it is the one specified with @setfilename ... - infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` - file=`sed -n ' - /^@setfilename/{ - s/.* \([^ ]*\) *$/\1/ - p - q - }' $infile` - # ... or it is derived from the source name (dir/f.texi becomes f.info) - test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info - fi - # If the file does not exist, the user really needs makeinfo; - # let's fail without touching anything. - test -f $file || exit 1 - touch $file - ;; - - tar*) - shift - - # We have already tried tar in the generic part. - # Look for gnutar/gtar before invocation to avoid ugly error - # messages. - if (gnutar --version > /dev/null 2>&1); then - gnutar "$@" && exit 0 - fi - if (gtar --version > /dev/null 2>&1); then - gtar "$@" && exit 0 - fi - firstarg="$1" - if shift; then - case $firstarg in - *o*) - firstarg=`echo "$firstarg" | sed s/o//` - tar "$firstarg" "$@" && exit 0 - ;; - esac - case $firstarg in - *h*) - firstarg=`echo "$firstarg" | sed s/h//` - tar "$firstarg" "$@" && exit 0 - ;; - esac - fi - - echo 1>&2 "\ -WARNING: I can't seem to be able to run \`tar' with the given arguments. - You may want to install GNU tar or Free paxutils, or check the - command line arguments." - exit 1 - ;; - - *) - echo 1>&2 "\ -WARNING: \`$1' is needed, and is $msg. - You might have modified some files without having the - proper tools for further handling them. Check the \`README' file, - it often tells you about the needed prerequisites for installing - this package. You may also peek at any GNU archive site, in case - some other package would contain this missing \`$1' program." - exit 1 - ;; -esac - -exit 0 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" -# time-stamp-end: "; # UTC" -# End: diff -Nru emu8051-1.1.1/config-h.in emu8051-2.0.1/config-h.in --- emu8051-1.1.1/config-h.in 2011-12-12 04:55:54.000000000 +0000 +++ emu8051-2.0.1/config-h.in 2014-03-22 18:26:15.000000000 +0000 @@ -1,14 +1,14 @@ /* config-h.in. Generated from configure.ac by autoheader. */ -/* Set to 1 to enable debugging messages. */ -#undef DEBUG - /* Set to 1 to enable GTK+ support for building GUI. */ #undef HAVE_GTK /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H +/* Define if you have libreadline */ +#undef HAVE_LIBREADLINE + /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H @@ -33,9 +33,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H -/* Define to 1 if your C compiler doesn't accept -c and -o together. */ -#undef NO_MINUS_C_MINUS_O - /* Name of package */ #undef PACKAGE @@ -63,6 +60,10 @@ /* Version number of package */ #undef VERSION +/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a + `char[]'. */ +#undef YYTEXT_POINTER + /* Define to empty if `const' does not conform to ANSI C. */ #undef const diff -Nru emu8051-1.1.1/configure emu8051-2.0.1/configure --- emu8051-1.1.1/configure 2011-12-12 04:55:41.000000000 +0000 +++ emu8051-2.0.1/configure 2014-03-22 18:26:15.000000000 +0000 @@ -1,11 +1,11 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for emu8051 1.1.1. +# Generated by GNU Autoconf 2.69 for emu8051 2.0.1. # +# Report bugs to . # -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software -# Foundation, Inc. +# +# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation @@ -134,6 +134,31 @@ # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +as_fn_exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh @@ -167,7 +192,8 @@ else exitcode=1; echo positional parameters were not saved. fi -test x\$exitcode = x0 || exit 1" +test x\$exitcode = x0 || exit 1 +test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && @@ -212,21 +238,25 @@ if test "x$CONFIG_SHELL" != x; then : - # We cannot yet assume a decent shell, so we have to provide a - # neutralization value for shells without unset; and this also - # works around shells that cannot unset nonexistent variables. - # Preserve -v and -x to the replacement shell. - BASH_ENV=/dev/null - ENV=/dev/null - (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV - export CONFIG_SHELL - case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; - esac - exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 fi if test x$as_have_required = xno; then : @@ -236,10 +266,11 @@ $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else - $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, -$0: including any error possibly output before this -$0: message. Then install a modern shell, or manually run -$0: the script under such a shell if you do have one." + $as_echo "$0: Please tell bug-autoconf@gnu.org and hugo@hugovil.com +$0: about your system, including any error possibly output +$0: before this message. Then install a modern shell, or +$0: manually run the script under such a shell if you do +$0: have one." fi exit 1 fi @@ -328,6 +359,14 @@ } # as_fn_mkdir_p + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take @@ -449,6 +488,10 @@ chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). @@ -483,16 +526,16 @@ # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. + # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' + as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null @@ -504,28 +547,8 @@ as_mkdir_p=false fi -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x +as_test_x='test -x' +as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -557,12 +580,12 @@ # Identity of this package. PACKAGE_NAME='emu8051' PACKAGE_TARNAME='emu8051' -PACKAGE_VERSION='1.1.1' -PACKAGE_STRING='emu8051 1.1.1' -PACKAGE_BUGREPORT='' -PACKAGE_URL='' +PACKAGE_VERSION='2.0.1' +PACKAGE_STRING='emu8051 2.0.1' +PACKAGE_BUGREPORT='hugo@hugovil.com' +PACKAGE_URL='http://www.hugovil.com/fr/emu8051/' -ac_unique_file="src/cpu8051.c" +ac_unique_file="src/common/cpu8051.c" # Factoring default headers for most tests. ac_includes_default="\ #include @@ -604,17 +627,42 @@ LTLIBOBJS LIBOBJS ac_aux_dir +WARNINGCFLAGS +ZLIB_LIBS +zlib_LIBS +zlib_CFLAGS +USE_AS51_FALSE +USE_AS51_TRUE +USE_AS504_FALSE +USE_AS504_TRUE +USE_AS504HV_FALSE +USE_AS504HV_TRUE +RUN_TESTS_FALSE +RUN_TESTS_TRUE +ASEM51_CHECK +AS504_CHECK USE_GTK_FALSE USE_GTK_TRUE GTK_LIBS GTK_CFLAGS +GLIB_LIBS +GLIB_CFLAGS +PKG_CONFIG_LIBDIR +PKG_CONFIG_PATH PKG_CONFIG EGREP GREP CPP +YFLAGS +YACC +LEXLIB +LEX_OUTPUT_ROOT +LEX +LIBREADLINE am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE +am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE @@ -628,8 +676,13 @@ LDFLAGS CFLAGS CC +ac_ct_AR +AR +RANLIB AM_BACKSLASH AM_DEFAULT_VERBOSITY +AM_DEFAULT_V +AM_V am__untar am__tar AMTAR @@ -696,7 +749,7 @@ enable_option_checking enable_silent_rules enable_dependency_tracking -enable_debug +with_readline enable_gui ' ac_precious_vars='build_alias @@ -707,10 +760,18 @@ LDFLAGS LIBS CPPFLAGS +YACC +YFLAGS CPP PKG_CONFIG +PKG_CONFIG_PATH +PKG_CONFIG_LIBDIR +GLIB_CFLAGS +GLIB_LIBS GTK_CFLAGS -GTK_LIBS' +GTK_LIBS +zlib_CFLAGS +zlib_LIBS' # Initialize some variables set by options. @@ -1166,8 +1227,6 @@ if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe - $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used" >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi @@ -1253,7 +1312,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures emu8051 1.1.1 to adapt to many kinds of systems. +\`configure' configures emu8051 2.0.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1319,7 +1378,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of emu8051 1.1.1:";; + short | recursive ) echo "Configuration of emu8051 2.0.1:";; esac cat <<\_ACEOF @@ -1327,13 +1386,19 @@ --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --enable-silent-rules less verbose build output (undo: `make V=1') - --disable-silent-rules verbose build output (undo: `make V=0') - --disable-dependency-tracking speeds up one-time build - --enable-dependency-tracking do not reject slow dependency extractors - --enable-debug enable debugging messages on console (default is NO) + --enable-silent-rules less verbose build output (undo: "make V=1") + --disable-silent-rules verbose build output (undo: "make V=0") + --enable-dependency-tracking + do not reject slow dependency extractors + --disable-dependency-tracking + speeds up one-time build --enable-gui Enable building the GUI (default=yes) +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --without-readline disable support for readline + Some influential environment variables: CC C compiler command CFLAGS C compiler flags @@ -1342,15 +1407,30 @@ LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory + YACC The `Yet Another Compiler Compiler' implementation to use. + Defaults to the first program found out of: `bison -y', `byacc', + `yacc'. + YFLAGS The list of arguments that will be passed by default to $YACC. + This script will default YFLAGS to the empty string to avoid a + default value of `-d' given by some make applications. CPP C preprocessor PKG_CONFIG path to pkg-config utility + PKG_CONFIG_PATH + directories to add to pkg-config's search path + PKG_CONFIG_LIBDIR + path overriding pkg-config's built-in search path + GLIB_CFLAGS C compiler flags for GLIB, overriding pkg-config + GLIB_LIBS linker flags for GLIB, overriding pkg-config GTK_CFLAGS C compiler flags for GTK, overriding pkg-config GTK_LIBS linker flags for GTK, overriding pkg-config + zlib_CFLAGS C compiler flags for zlib, overriding pkg-config + zlib_LIBS linker flags for zlib, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. -Report bugs to the package provider. +Report bugs to . +emu8051 home page: . _ACEOF ac_status=$? fi @@ -1413,10 +1493,10 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -emu8051 configure 1.1.1 -generated by GNU Autoconf 2.68 +emu8051 configure 2.0.1 +generated by GNU Autoconf 2.69 -Copyright (C) 2010 Free Software Foundation, Inc. +Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -1465,6 +1545,52 @@ } # ac_fn_c_try_compile +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache @@ -1632,8 +1758,8 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by emu8051 $as_me 1.1.1, which was -generated by GNU Autoconf 2.68. Invocation command line was +It was created by emu8051 $as_me 2.0.1, which was +generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -1981,7 +2107,7 @@ ac_aux_dir= -for ac_dir in config "$srcdir"/config; do +for ac_dir in build-aux "$srcdir"/build-aux; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" @@ -1997,7 +2123,7 @@ fi done if test -z "$ac_aux_dir"; then - as_fn_error $? "cannot find install-sh, install.sh, or shtool in config \"$srcdir\"/config" "$LINENO" 5 + as_fn_error $? "cannot find install-sh, install.sh, or shtool in build-aux \"$srcdir\"/build-aux" "$LINENO" 5 fi # These three variables are undocumented and unsupported, @@ -2012,7 +2138,7 @@ ac_config_headers="$ac_config_headers config.h:config-h.in" -am__api_version='1.11' +am__api_version='1.14' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or @@ -2051,7 +2177,7 @@ # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. @@ -2109,9 +2235,6 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } -# Just in case -sleep 1 -echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' @@ -2122,32 +2245,40 @@ esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) - as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; + as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; esac -# Do `set' in a subshell so we don't clobber the current shell's +# Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( - set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` - if test "$*" = "X"; then - # -L didn't work. - set X `ls -t "$srcdir/configure" conftest.file` - fi - rm -f conftest.file - if test "$*" != "X $srcdir/configure conftest.file" \ - && test "$*" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - as_fn_error $? "ls -t appears to fail. Make sure there is not a broken -alias in your environment" "$LINENO" 5 - fi + am_has_slept=no + for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + as_fn_error $? "ls -t appears to fail. Make sure there is not a broken + alias in your environment" "$LINENO" 5 + fi + if test "$2" = conftest.file || test $am_try -eq 2; then + break + fi + # Just in case. + sleep 1 + am_has_slept=yes + done test "$2" = conftest.file ) then @@ -2159,6 +2290,16 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } +# If we didn't sleep, we still need to ensure time stamps of config.status and +# generated files are strictly newer. +am_sleep_pid= +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & + am_sleep_pid=$! +fi + +rm -f conftest.file + test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. @@ -2181,12 +2322,12 @@ esac fi # Use eval to expand $SHELL -if eval "$MISSING --run true"; then - am_missing_run="$MISSING --run " +if eval "$MISSING --is-lightweight"; then + am_missing_run="$MISSING " else am_missing_run= - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 -$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 +$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh}" != xset; then @@ -2198,10 +2339,10 @@ esac fi -# Installed binaries are usually stripped using `strip' when the user -# run `make install-strip'. However `strip' might not be the right +# Installed binaries are usually stripped using 'strip' when the user +# run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake -# will honor the `STRIP' environment variable to overrule this program. +# will honor the 'STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. @@ -2220,7 +2361,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2260,7 +2401,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2311,7 +2452,7 @@ test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do - { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue + as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ @@ -2340,12 +2481,6 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } -mkdir_p="$MKDIR_P" -case $mkdir_p in - [\\/$]* | ?:[\\/]*) ;; - */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; -esac - for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. @@ -2364,7 +2499,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2428,6 +2563,45 @@ fi rmdir .tst 2>/dev/null +# Check whether --enable-silent-rules was given. +if test "${enable_silent_rules+set}" = set; then : + enableval=$enable_silent_rules; +fi + +case $enable_silent_rules in # ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=1;; +esac +am_make=${MAKE-make} +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 +$as_echo_n "checking whether $am_make supports nested variables... " >&6; } +if ${am_cv_make_support_nested_variables+:} false; then : + $as_echo_n "(cached) " >&6 +else + if $as_echo 'TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 +$as_echo "$am_cv_make_support_nested_variables" >&6; } +if test $am_cv_make_support_nested_variables = yes; then + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AM_BACKSLASH='\' + if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." @@ -2450,7 +2624,7 @@ # Define the identity of the package. PACKAGE='emu8051' - VERSION='1.1.1' + VERSION='2.0.1' cat >>confdefs.h <<_ACEOF @@ -2478,31 +2652,209 @@ MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} +# For better backward compatibility. To be removed once Automake 1.9.x +# dies out for good. For more background, see: +# +# +mkdir_p='$(MKDIR_P)' + # We need awk for the "check" target. The system "awk" is bad on # some platforms. -# Always define AMTAR for backward compatibility. +# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AMTAR='$${TAR-tar}' + + +# We'll loop over all known methods to create a tar archive until one works. +_am_tools='gnutar pax cpio none' + +am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' + + -AMTAR=${AMTAR-"${am_missing_run}tar"} -am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' +# POSIX will say in a future version that running "rm -f" with no argument +# is OK; and we want to be able to make that assumption in our Makefile +# recipes. So use an aggressive probe to check that the usage we want is +# actually supported "in the wild" to an acceptable degree. +# See automake bug#10828. +# To make any issue more visible, cause the running configure to be aborted +# by default if the 'rm' program in use doesn't match our expectations; the +# user can still override this though. +if rm -f && rm -fr && rm -rf; then : OK; else + cat >&2 <<'END' +Oops! +Your 'rm' program seems unable to run without file operands specified +on the command line, even when the '-f' option is present. This is contrary +to the behaviour of most rm programs out there, and not conforming with +the upcoming POSIX standard: +Please tell bug-automake@gnu.org about your system, including the value +of your $PATH and any error possibly output before this message. This +can help us improve future automake versions. +END + if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then + echo 'Configuration will proceed anyway, since you have set the' >&2 + echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 + echo >&2 + else + cat >&2 <<'END' +Aborting the configuration process, to ensure you take notice of the issue. + +You can download and install GNU coreutils to get an 'rm' implementation +that behaves properly: . + +If you want to complete the configuration process using your problematic +'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM +to "yes", and re-run configure. + +END + as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 + fi +fi # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi -case $enable_silent_rules in -yes) AM_DEFAULT_VERBOSITY=0;; -no) AM_DEFAULT_VERBOSITY=1;; -*) AM_DEFAULT_VERBOSITY=0;; +case $enable_silent_rules in # ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=0;; esac +am_make=${MAKE-make} +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 +$as_echo_n "checking whether $am_make supports nested variables... " >&6; } +if ${am_cv_make_support_nested_variables+:} false; then : + $as_echo_n "(cached) " >&6 +else + if $as_echo 'TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 +$as_echo "$am_cv_make_support_nested_variables" >&6; } +if test $am_cv_make_support_nested_variables = yes; then + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi AM_BACKSLASH='\' +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_RANLIB+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +$as_echo "$RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +$as_echo "$ac_ct_RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi +else + RANLIB="$ac_cv_prog_RANLIB" +fi + DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" @@ -2522,7 +2874,7 @@ _am_result=none # First try GNU make style include. echo "include confinc" > confmf -# Ignore all kinds of additional output from `make'. +# Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include @@ -2555,6 +2907,7 @@ if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' + am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= @@ -2587,7 +2940,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2627,7 +2980,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2680,7 +3033,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2721,7 +3074,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue @@ -2779,7 +3132,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2823,7 +3176,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3269,8 +3622,7 @@ /* end confdefs.h. */ #include #include -#include -#include +struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); @@ -3355,6 +3707,65 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 +$as_echo_n "checking whether $CC understands -c and -o together... " >&6; } +if ${am_cv_prog_cc_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF + # Make sure it works both with $CC and with simple cc. + # Following AC_PROG_CC_C_O, we do the test twice because some + # compilers refuse to overwrite an existing .o file with -o, + # though they will create one. + am_cv_prog_cc_c_o=yes + for am_i in 1 2; do + if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 + ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } \ + && test -f conftest2.$ac_objext; then + : OK + else + am_cv_prog_cc_c_o=no + break + fi + done + rm -f core conftest* + unset am_i +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 +$as_echo "$am_cv_prog_cc_c_o" >&6; } +if test "$am_cv_prog_cc_c_o" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 @@ -3366,8 +3777,9 @@ # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. @@ -3401,16 +3813,16 @@ : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch sub/conftst$i.h + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - # We check with `-c' and `-o' for the sake of the "dashmstdout" + # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in @@ -3419,16 +3831,16 @@ test "$am__universal" = false || continue ;; nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; - msvisualcpp | msvcmsys) - # This compiler won't grok `-c -o', but also, the minuso test has + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} @@ -3482,139 +3894,439 @@ fi -if test "x$CC" != xcc; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC and cc understand -c and -o together" >&5 -$as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cc understands -c and -o together" >&5 -$as_echo_n "checking whether cc understands -c and -o together... " >&6; } -fi -set dummy $CC; ac_cc=`$as_echo "$2" | - sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` -if eval \${ac_cv_prog_cc_${ac_cc}_c_o+:} false; then : + +if test -n "$ac_tool_prefix"; then + for ac_prog in ar lib "link -lib" + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AR+:} false; then : $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AR="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS -int -main () -{ +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +$as_echo "$AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi - ; - return 0; -} -_ACEOF -# Make sure it works both with $CC and with simple cc. -# We do the test twice because some compilers refuse to overwrite an -# existing .o file with -o, though they will create one. -ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5' -rm -f conftest2.* -if { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && - test -f conftest2.$ac_objext && { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; -then - eval ac_cv_prog_cc_${ac_cc}_c_o=yes - if test "x$CC" != xcc; then - # Test first that cc exists at all. - if { ac_try='cc -c conftest.$ac_ext >&5' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; + + test -n "$AR" && break + done +fi +if test -z "$AR"; then + ac_ct_AR=$AR + for ac_prog in ar lib "link -lib" +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_AR="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +$as_echo "$ac_ct_AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_AR" && break +done + + if test "x$ac_ct_AR" = x; then + AR="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 + AR=$ac_ct_AR + fi +fi + +: ${AR=ar} + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the archiver ($AR) interface" >&5 +$as_echo_n "checking the archiver ($AR) interface... " >&6; } +if ${am_cv_ar_interface+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + am_cv_ar_interface=ar + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int some_variable = 0; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$am_ar_try\""; } >&5 + (eval $am_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5' - rm -f conftest2.* - if { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 + test $ac_status = 0; } + if test "$ac_status" -eq 0; then + am_cv_ar_interface=ar + else + am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$am_ar_try\""; } >&5 + (eval $am_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && - test -f conftest2.$ac_objext && { { case "(($ac_try" in + test $ac_status = 0; } + if test "$ac_status" -eq 0; then + am_cv_ar_interface=lib + else + am_cv_ar_interface=unknown + fi + fi + rm -f conftest.lib libconftest.a + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_ar_interface" >&5 +$as_echo "$am_cv_ar_interface" >&6; } + +case $am_cv_ar_interface in +ar) + ;; +lib) + # Microsoft lib, so override with the ar-lib wrapper script. + # FIXME: It is wrong to rewrite AR. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__AR in this case, + # and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or something + # similar. + AR="$am_aux_dir/ar-lib $AR" + ;; +unknown) + as_fn_error $? "could not determine $AR interface" "$LINENO" 5 + ;; +esac + + + +# Check whether --with-readline was given. +if test "${with_readline+set}" = set; then : + withval=$with_readline; +else + with_readline=yes +fi + + +LIBREADLINE= + if test "x$with_readline" != xno; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lreadline" >&5 +$as_echo_n "checking for main in -lreadline... " >&6; } +if ${ac_cv_lib_readline_main+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lreadline + $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +int +main () +{ +return main (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_readline_main=yes +else + ac_cv_lib_readline_main=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_main" >&5 +$as_echo "$ac_cv_lib_readline_main" >&6; } +if test "x$ac_cv_lib_readline_main" = xyes; then : + LIBREADLINE="-lreadline" + + +$as_echo "#define HAVE_LIBREADLINE 1" >>confdefs.h + + +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "readline test failed (--without-readline to disable) +See \`config.log' for more details" "$LINENO" 5; } +fi + +fi + +for ac_prog in flex lex +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_LEX+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$LEX"; then + ac_cv_prog_LEX="$LEX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_LEX="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +LEX=$ac_cv_prog_LEX +if test -n "$LEX"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LEX" >&5 +$as_echo "$LEX" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$LEX" && break +done +test -n "$LEX" || LEX=":" + +if test "x$LEX" != "x:"; then + cat >conftest.l <<_ACEOF +%% +a { ECHO; } +b { REJECT; } +c { yymore (); } +d { yyless (1); } +e { /* IRIX 6.5 flex 2.5.4 underquotes its yyless argument. */ + yyless ((input () != 0)); } +f { unput (yytext[0]); } +. { BEGIN INITIAL; } +%% +#ifdef YYTEXT_POINTER +extern char *yytext; +#endif +int +main (void) +{ + return ! yylex () + ! yywrap (); +} +_ACEOF +{ { ac_try="$LEX conftest.l" +case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 + (eval "$LEX conftest.l") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; - then - # cc works too. - : - else - # cc exists but doesn't like -o. - eval ac_cv_prog_cc_${ac_cc}_c_o=no - fi - fi - fi + test $ac_status = 0; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking lex output file root" >&5 +$as_echo_n "checking lex output file root... " >&6; } +if ${ac_cv_prog_lex_root+:} false; then : + $as_echo_n "(cached) " >&6 +else + +if test -f lex.yy.c; then + ac_cv_prog_lex_root=lex.yy +elif test -f lexyy.c; then + ac_cv_prog_lex_root=lexyy +else + as_fn_error $? "cannot find output from $LEX; giving up" "$LINENO" 5 +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_lex_root" >&5 +$as_echo "$ac_cv_prog_lex_root" >&6; } +LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root + +if test -z "${LEXLIB+set}"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking lex library" >&5 +$as_echo_n "checking lex library... " >&6; } +if ${ac_cv_lib_lex+:} false; then : + $as_echo_n "(cached) " >&6 else - eval ac_cv_prog_cc_${ac_cc}_c_o=no + + ac_save_LIBS=$LIBS + ac_cv_lib_lex='none needed' + for ac_lib in '' -lfl -ll; do + LIBS="$ac_lib $ac_save_LIBS" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +`cat $LEX_OUTPUT_ROOT.c` +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_lex=$ac_lib fi -rm -f core conftest* +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + test "$ac_cv_lib_lex" != 'none needed' && break + done + LIBS=$ac_save_LIBS fi -if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lex" >&5 +$as_echo "$ac_cv_lib_lex" >&6; } + test "$ac_cv_lib_lex" != 'none needed' && LEXLIB=$ac_cv_lib_lex +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether yytext is a pointer" >&5 +$as_echo_n "checking whether yytext is a pointer... " >&6; } +if ${ac_cv_prog_lex_yytext_pointer+:} false; then : + $as_echo_n "(cached) " >&6 else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + # POSIX says lex can declare yytext either as a pointer or an array; the +# default is implementation-dependent. Figure out which it is, since +# not all implementations provide the %pointer and %array declarations. +ac_cv_prog_lex_yytext_pointer=no +ac_save_LIBS=$LIBS +LIBS="$LEXLIB $ac_save_LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ -$as_echo "#define NO_MINUS_C_MINUS_O 1" >>confdefs.h + #define YYTEXT_POINTER 1 +`cat $LEX_OUTPUT_ROOT.c` +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_prog_lex_yytext_pointer=yes +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_save_LIBS fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_lex_yytext_pointer" >&5 +$as_echo "$ac_cv_prog_lex_yytext_pointer" >&6; } +if test $ac_cv_prog_lex_yytext_pointer = yes; then + +$as_echo "#define YYTEXT_POINTER 1" >>confdefs.h -# FIXME: we rely on the cache variable name because -# there is no other way. -set dummy $CC -am_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` -eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o -if test "$am_t" != yes; then - # Losing compiler, so override with the script. - # FIXME: It is wrong to rewrite CC. - # But if we don't then we get into trouble of one sort or another. - # A longer-term fix would be to have automake use am__CC in this case, - # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" - CC="$am_aux_dir/compile $CC" fi +rm -f conftest.l $LEX_OUTPUT_ROOT.c +fi +for ac_prog in 'bison -y' byacc +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_YACC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$YACC"; then + ac_cv_prog_YACC="$YACC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_YACC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu +fi +fi +YACC=$ac_cv_prog_YACC +if test -n "$YACC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $YACC" >&5 +$as_echo "$YACC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + test -n "$YACC" && break +done +test -n "$YACC" || YACC="yacc" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 $as_echo_n "checking for an ANSI C-conforming const... " >&6; } @@ -3627,11 +4339,11 @@ int main () { -/* FIXME: Include the comments suggested by Paul. */ + #ifndef __cplusplus - /* Ultrix mips cc rejects this. */ + /* Ultrix mips cc rejects this sort of thing. */ typedef int charset[2]; - const charset cs; + const charset cs = { 0, 0 }; /* SunOS 4.1.1 cc rejects this. */ char const *const *pcpcc; char **ppc; @@ -3648,8 +4360,9 @@ ++pcpcc; ppc = (char**) pcpcc; pcpcc = (char const *const *) ppc; - { /* SCO 3.2v4 cc rejects this. */ - char *t; + { /* SCO 3.2v4 cc rejects this sort of thing. */ + char tx; + char *t = &tx; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; @@ -3665,10 +4378,10 @@ iptr p = 0; ++p; } - { /* AIX XL C 1.02.0.0 rejects this saying + { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ - struct s { int j; const int *ap[3]; }; - struct s *b; b->j = 5; + struct s { int j; const int *ap[3]; } bx; + struct s *b = &bx; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; @@ -3850,7 +4563,7 @@ for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue + as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in @@ -3916,7 +4629,7 @@ for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue + as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in @@ -4116,46 +4829,14 @@ fi -CFLAGS="${CFLAGS} -Wall" - +WARNINGCFLAGS="-Wall -Wextra -Wformat -Wformat-security" -# Check whether --enable-debug was given. -if test "${enable_debug+set}" = set; then : - enableval=$enable_debug; - if test x"${enableval}" = xyes; then - debug_messages=1 -$as_echo "#define DEBUG 1" >>confdefs.h - elif test x"${enableval}" = xno; then - debug_messages=0 - else - as_fn_error $? "bad value for --enable-debug option" "$LINENO" 5 - fi -else - debug_messages=0 -fi -if test x"${debug_messages}" = x1; then - CFLAGS="${CFLAGS} -g -gdwarf-2 -g3" -fi - -# Check whether --enable-gui was given. -if test "${enable_gui+set}" = set; then : - enableval=$enable_gui; ac_cv_enable_gui=$enableval -else - ac_cv_enable_gui=yes -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build GUI" >&5 -$as_echo_n "checking whether to build GUI... " >&6; } -if test x$ac_cv_enable_gui = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test -n "$ac_tool_prefix"; then @@ -4177,7 +4858,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -4220,7 +4901,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -4269,9 +4950,114 @@ $as_echo "no" >&6; } PKG_CONFIG="" fi +fi + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLIB" >&5 +$as_echo_n "checking for GLIB... " >&6; } + +if test -n "$GLIB_CFLAGS"; then + pkg_cv_GLIB_CFLAGS="$GLIB_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 >= 2.26.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "glib-2.0 >= 2.26.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_GLIB_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 >= 2.26.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$GLIB_LIBS"; then + pkg_cv_GLIB_LIBS="$GLIB_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 >= 2.26.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "glib-2.0 >= 2.26.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_GLIB_LIBS=`$PKG_CONFIG --libs "glib-2.0 >= 2.26.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + GLIB_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "glib-2.0 >= 2.26.0" 2>&1` + else + GLIB_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "glib-2.0 >= 2.26.0" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$GLIB_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements (glib-2.0 >= 2.26.0) were not met: + +$GLIB_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables GLIB_CFLAGS +and GLIB_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables GLIB_CFLAGS +and GLIB_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details" "$LINENO" 5; } +else + GLIB_CFLAGS=$pkg_cv_GLIB_CFLAGS + GLIB_LIBS=$pkg_cv_GLIB_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + + +# Check whether --enable-gui was given. +if test "${enable_gui+set}" = set; then : + enableval=$enable_gui; ac_cv_enable_gui=$enableval +else + ac_cv_enable_gui=yes fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build GUI" >&5 +$as_echo_n "checking whether to build GUI... " >&6; } +if test x$ac_cv_enable_gui = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GTK" >&5 $as_echo_n "checking for GTK... " >&6; } @@ -4280,12 +5066,13 @@ pkg_cv_GTK_CFLAGS="$GTK_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gtk+-2.0 >= 2.0.5\""; } >&5 - ($PKG_CONFIG --exists --print-errors "gtk+-2.0 >= 2.0.5") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gtk+-2.0 >= 2.4.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "gtk+-2.0 >= 2.4.0") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_GTK_CFLAGS=`$PKG_CONFIG --cflags "gtk+-2.0 >= 2.0.5" 2>/dev/null` + pkg_cv_GTK_CFLAGS=`$PKG_CONFIG --cflags "gtk+-2.0 >= 2.4.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi @@ -4296,12 +5083,13 @@ pkg_cv_GTK_LIBS="$GTK_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gtk+-2.0 >= 2.0.5\""; } >&5 - ($PKG_CONFIG --exists --print-errors "gtk+-2.0 >= 2.0.5") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gtk+-2.0 >= 2.4.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "gtk+-2.0 >= 2.4.0") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_GTK_LIBS=`$PKG_CONFIG --libs "gtk+-2.0 >= 2.0.5" 2>/dev/null` + pkg_cv_GTK_LIBS=`$PKG_CONFIG --libs "gtk+-2.0 >= 2.4.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi @@ -4312,6 +5100,8 @@ if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -4319,30 +5109,34 @@ _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - GTK_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "gtk+-2.0 >= 2.0.5" 2>&1` + GTK_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "gtk+-2.0 >= 2.4.0" 2>&1` else - GTK_PKG_ERRORS=`$PKG_CONFIG --print-errors "gtk+-2.0 >= 2.0.5" 2>&1` + GTK_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "gtk+-2.0 >= 2.4.0" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$GTK_PKG_ERRORS" >&5 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ac_cv_enable_gui=no + ac_cv_enable_gui=no elif test $pkg_failed = untried; then - ac_cv_enable_gui=no + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ac_cv_enable_gui=no else GTK_CFLAGS=$pkg_cv_GTK_CFLAGS GTK_LIBS=$pkg_cv_GTK_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - : + fi + if test x$ac_cv_enable_gui = xyes; then $as_echo "#define HAVE_GTK 1" >>confdefs.h + GTK_CFLAGS="${GTK_CFLAGS} -DGDK_PIXBUF_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED" + + fi else @@ -4359,11 +5153,280 @@ fi +run_tests=no + +# Extract the first word of "as504", so it can be a program name with args. +set dummy as504; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AS504_CHECK+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AS504_CHECK"; then + ac_cv_prog_AS504_CHECK="$AS504_CHECK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AS504_CHECK="yes" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AS504_CHECK=$ac_cv_prog_AS504_CHECK +if test -n "$AS504_CHECK"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AS504_CHECK" >&5 +$as_echo "$AS504_CHECK" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +if test x"$AS504_CHECK" = x"yes" ; then + run_tests=yes + + AS504HV_CHECK=no + if as504 2>&1 | grep -q Ooutfile; then + AS504HV_CHECK=yes + fi +fi + +# Extract the first word of "asem", so it can be a program name with args. +set dummy asem; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ASEM51_CHECK+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ASEM51_CHECK"; then + ac_cv_prog_ASEM51_CHECK="$ASEM51_CHECK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ASEM51_CHECK="yes" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ASEM51_CHECK=$ac_cv_prog_ASEM51_CHECK +if test -n "$ASEM51_CHECK"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ASEM51_CHECK" >&5 +$as_echo "$ASEM51_CHECK" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +if test x"$ASEM51_CHECK" = x"yes" ; then + run_tests=yes +fi + +if test x"$run_tests" != x"yes" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Please install as504 (http://www.vanwal.nl/as504/) or ASEM-51 (http://plit.de/asem-51) to run test suite." >&5 +$as_echo "$as_me: WARNING: Please install as504 (http://www.vanwal.nl/as504/) or ASEM-51 (http://plit.de/asem-51) to run test suite." >&2;} +fi + + if test x"$run_tests" = x"yes"; then + RUN_TESTS_TRUE= + RUN_TESTS_FALSE='#' +else + RUN_TESTS_TRUE='#' + RUN_TESTS_FALSE= +fi + + if test x"$AS504HV_CHECK" = x"yes"; then + USE_AS504HV_TRUE= + USE_AS504HV_FALSE='#' +else + USE_AS504HV_TRUE='#' + USE_AS504HV_FALSE= +fi + + if test x"$AS504_CHECK" = x"yes"; then + USE_AS504_TRUE= + USE_AS504_FALSE='#' +else + USE_AS504_TRUE='#' + USE_AS504_FALSE= +fi + + if test x"$ASEM51_CHECK" = x"yes"; then + USE_AS51_TRUE= + USE_AS51_FALSE='#' +else + USE_AS51_TRUE='#' + USE_AS51_FALSE= +fi + + +ac_have_zlib=no + + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for zlib" >&5 +$as_echo_n "checking for zlib... " >&6; } + +if test -n "$zlib_CFLAGS"; then + pkg_cv_zlib_CFLAGS="$zlib_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"zlib > 1.2.1\""; } >&5 + ($PKG_CONFIG --exists --print-errors "zlib > 1.2.1") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_zlib_CFLAGS=`$PKG_CONFIG --cflags "zlib > 1.2.1" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$zlib_LIBS"; then + pkg_cv_zlib_LIBS="$zlib_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"zlib > 1.2.1\""; } >&5 + ($PKG_CONFIG --exists --print-errors "zlib > 1.2.1") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_zlib_LIBS=`$PKG_CONFIG --libs "zlib > 1.2.1" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + zlib_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "zlib > 1.2.1" 2>&1` + else + zlib_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "zlib > 1.2.1" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$zlib_PKG_ERRORS" >&5 + as_fn_error $? "Package requirements (zlib > 1.2.1) were not met: +$zlib_PKG_ERRORS -ac_config_files="$ac_config_files Makefile src/Makefile doc/Makefile" +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables zlib_CFLAGS +and zlib_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables zlib_CFLAGS +and zlib_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details" "$LINENO" 5; } +else + zlib_CFLAGS=$pkg_cv_zlib_CFLAGS + zlib_LIBS=$pkg_cv_zlib_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for crc32 in -lz" >&5 +$as_echo_n "checking for crc32 in -lz... " >&6; } +if ${ac_cv_lib_z_crc32+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lz $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char crc32 (); +int +main () +{ +return crc32 (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_z_crc32=yes +else + ac_cv_lib_z_crc32=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_crc32" >&5 +$as_echo "$ac_cv_lib_z_crc32" >&6; } +if test "x$ac_cv_lib_z_crc32" = xyes; then : + ac_have_zlib=yes +else + ac_have_zlib=no +fi + +fi + +if test x"$ac_have_zlib" = x"yes" ; then + ZLIB_LIBS='-lz' + +else + as_fn_error $? "Please install zlib and zlib-devel packages" "$LINENO" 5 +fi + + + + + +ac_config_files="$ac_config_files Makefile src/common/Makefile src/cli/Makefile src/gtk/Makefile data/Makefile doc/Makefile tests/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -4459,7 +5522,6 @@ ac_libobjs= ac_ltlibobjs= -U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' @@ -4474,6 +5536,14 @@ LTLIBOBJS=$ac_ltlibobjs +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 +$as_echo_n "checking that generated files are newer than configure... " >&6; } + if test -n "$am_sleep_pid"; then + # Hide warnings about reused PIDs. + wait $am_sleep_pid 2>/dev/null + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 +$as_echo "done" >&6; } if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' @@ -4494,6 +5564,22 @@ as_fn_error $? "conditional \"USE_GTK\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${RUN_TESTS_TRUE}" && test -z "${RUN_TESTS_FALSE}"; then + as_fn_error $? "conditional \"RUN_TESTS\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${USE_AS504HV_TRUE}" && test -z "${USE_AS504HV_FALSE}"; then + as_fn_error $? "conditional \"USE_AS504HV\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${USE_AS504_TRUE}" && test -z "${USE_AS504_FALSE}"; then + as_fn_error $? "conditional \"USE_AS504\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${USE_AS51_TRUE}" && test -z "${USE_AS51_FALSE}"; then + as_fn_error $? "conditional \"USE_AS51\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 @@ -4792,16 +5878,16 @@ # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. + # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' + as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null @@ -4861,28 +5947,16 @@ as_mkdir_p=false fi -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -4903,8 +5977,8 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by emu8051 $as_me 1.1.1, which was -generated by GNU Autoconf 2.68. Invocation command line was +This file was extended by emu8051 $as_me 2.0.1, which was +generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -4963,17 +6037,18 @@ Configuration commands: $config_commands -Report bugs to the package provider." +Report bugs to . +emu8051 home page: ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -emu8051 config.status 1.1.1 -configured by $0, generated by GNU Autoconf 2.68, +emu8051 config.status 2.0.1 +configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" -Copyright (C) 2010 Free Software Foundation, Inc. +Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -5064,7 +6139,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then - set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' @@ -5101,8 +6176,12 @@ "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h:config-h.in" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; + "src/common/Makefile") CONFIG_FILES="$CONFIG_FILES src/common/Makefile" ;; + "src/cli/Makefile") CONFIG_FILES="$CONFIG_FILES src/cli/Makefile" ;; + "src/gtk/Makefile") CONFIG_FILES="$CONFIG_FILES src/gtk/Makefile" ;; + "data/Makefile") CONFIG_FILES="$CONFIG_FILES data/Makefile" ;; "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; + "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac @@ -5699,7 +6778,7 @@ case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { - # Autoconf 2.62 quotes --file arguments for eval, but not when files + # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in @@ -5712,7 +6791,7 @@ # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named `Makefile.in', but + # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. @@ -5746,21 +6825,19 @@ continue fi # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running `make'. + # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "am__include" && continue + test -z "$am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || @@ -5831,31 +6908,3 @@ $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi - -echo \ -"--------------------------------------------------------------------------- -Configuration: - - Install path: ${prefix} - Compiler: ${CC} - Compiler flags: ${CFLAGS} - Linker flags: ${LIBS}" - -echo -n " Build GUI: " -if test x"${ac_cv_enable_gui}" = xyes; then - echo "yes" -else - echo "no" -fi - -echo -n " Debugging messages: " -if test x"${debug_messages}" = x1; then - echo "yes" -else - echo "no" -fi - -echo \ -" - See config.h for further configuration information. ----------------------------------------------------------------------------" diff -Nru emu8051-1.1.1/configure.ac emu8051-2.0.1/configure.ac --- emu8051-1.1.1/configure.ac 2011-12-12 04:55:12.000000000 +0000 +++ emu8051-2.0.1/configure.ac 2014-03-22 18:25:51.000000000 +0000 @@ -1,33 +1,54 @@ # configure.ac -- Process this file with autoconf to produce configure dnl Initialization stuff. -AC_INIT(emu8051, 1.1.1) -AC_CONFIG_AUX_DIR(config) -AC_CONFIG_SRCDIR(src/cpu8051.c) +AC_INIT([emu8051], [2.0.1], [hugo@hugovil.com], [emu8051], + [http://www.hugovil.com/fr/emu8051/]) +AC_CONFIG_AUX_DIR([build-aux]) +AC_CONFIG_SRCDIR(src/common/cpu8051.c) AM_CONFIG_HEADER(config.h:config-h.in) dnl Checking if the NEWS file has been updated to reflect the current version. -AM_INIT_AUTOMAKE(check-news) +AM_INIT_AUTOMAKE(check-news -Wall std-options color-tests parallel-tests) AM_SILENT_RULES([yes]) dnl Testing the C compiler. -AM_PROG_CC_C_O AC_LANG_C +dnl Testing for libtool support. +AC_PROG_RANLIB +AM_PROG_AR + +AC_ARG_WITH([readline], + [AS_HELP_STRING([--without-readline], [disable support for readline])], + [], + [with_readline=yes]) + +LIBREADLINE= + AS_IF([test "x$with_readline" != xno], + [AC_CHECK_LIB([readline], [main], + [AC_SUBST([LIBREADLINE], ["-lreadline"]) + AC_DEFINE([HAVE_LIBREADLINE], [1], + [Define if you have libreadline]) + ], + [AC_MSG_FAILURE( + [readline test failed (--without-readline to disable)])], + [] +)]) + +dnl Testing for Lex/Yacc +AC_PROG_LEX +AC_PROG_YACC + dnl Checking for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_PID_T AC_TYPE_SIZE_T -dnl Basic CFLAGS values -CFLAGS="${CFLAGS} -Wall" - -dnl Checks for '--enable-debug' option -HV_CHECK_FOR_DEBUG +dnl Basic warning CFLAGS values +WARNINGCFLAGS="-Wall -Wextra -Wformat -Wformat-security" -if test x"${debug_messages}" = x1; then -dnl -g is for GDB debugging - CFLAGS="${CFLAGS} -g -gdwarf-2 -g3" -fi +PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.26.0]) +AC_SUBST(GLIB_CFLAGS) +AC_SUBST(GLIB_LIBS) dnl Checks for Gtk+-2.0 AC_ARG_ENABLE(gui, @@ -36,9 +57,14 @@ AC_MSG_CHECKING([whether to build GUI]) if test x$ac_cv_enable_gui = xyes; then AC_MSG_RESULT(yes) - PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.0.5, :, ac_cv_enable_gui=no) + PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.4.0, [], dnl + ac_cv_enable_gui=no) + if test x$ac_cv_enable_gui = xyes; then AC_DEFINE([HAVE_GTK],1,[Set to 1 to enable GTK+ support for building GUI.]) + + GTK_CFLAGS="${GTK_CFLAGS} -DGDK_PIXBUF_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED" + AC_SUBST(GTK_CFLAGS) AC_SUBST(GTK_LIBS) fi @@ -48,37 +74,59 @@ AM_CONDITIONAL([USE_GTK], [test x${ac_cv_enable_gui} = xyes]) -AC_SUBST(CFLAGS) -AC_SUBST(LIBS) -AC_SUBST(ac_aux_dir) +dnl Try to locate valid 8051 assembler to generate test files (.hex) +run_tests=no -dnl Creating output file(s) -AC_OUTPUT(Makefile src/Makefile doc/Makefile) +AC_CHECK_PROG(AS504_CHECK,as504,yes) +if test x"$AS504_CHECK" = x"yes" ; then + run_tests=yes + + dnl Check if as504 has been patched to support option -O: + dnl See http://www.hugovil.com/repository/hvlinux/patches/as504-add-output-file-option.patch + AS504HV_CHECK=no + if as504 2>&1 | grep -q Ooutfile; then + AS504HV_CHECK=yes + fi +fi -echo \ -"--------------------------------------------------------------------------- -Configuration: - - Install path: ${prefix} - Compiler: ${CC} - Compiler flags: ${CFLAGS} - Linker flags: ${LIBS}" - -echo -n " Build GUI: " -if test x"${ac_cv_enable_gui}" = xyes; then - echo "yes" -else - echo "no" +AC_CHECK_PROG(ASEM51_CHECK,asem,yes) +if test x"$ASEM51_CHECK" = x"yes" ; then + run_tests=yes +fi + +if test x"$run_tests" != x"yes" ; then + AC_MSG_WARN([Please install as504 (http://www.vanwal.nl/as504/) or ASEM-51 (http://plit.de/asem-51) to run test suite.]) fi -echo -n " Debugging messages: " -if test x"${debug_messages}" = x1; then - echo "yes" +AM_CONDITIONAL([RUN_TESTS],[test x"$run_tests" = x"yes"]) +AM_CONDITIONAL([USE_AS504HV],[test x"$AS504HV_CHECK" = x"yes"]) +AM_CONDITIONAL([USE_AS504],[test x"$AS504_CHECK" = x"yes"]) +AM_CONDITIONAL([USE_AS51],[test x"$ASEM51_CHECK" = x"yes"]) + +dnl zlib required for its crc32 function +ac_have_zlib=no + +PKG_CHECK_MODULES([zlib], [zlib > 1.2.1], + [AC_CHECK_LIB([z], [crc32], + [ac_have_zlib=yes], + [ac_have_zlib=no])]) + +if test x"$ac_have_zlib" = x"yes" ; then + ZLIB_LIBS='-lz' + AC_SUBST(ZLIB_LIBS) else - echo "no" + AC_MSG_ERROR([Please install zlib and zlib-devel packages]) fi -echo \ -" - See config.h for further configuration information. ----------------------------------------------------------------------------" +AC_SUBST(WARNINGCFLAGS) +AC_SUBST(LIBS) +AC_SUBST(ac_aux_dir) + +dnl Creating output file(s) +AC_OUTPUT(Makefile + src/common/Makefile + src/cli/Makefile + src/gtk/Makefile + data/Makefile + doc/Makefile + tests/Makefile) diff -Nru emu8051-1.1.1/data/emu8051.conf emu8051-2.0.1/data/emu8051.conf --- emu8051-1.1.1/data/emu8051.conf 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/data/emu8051.conf 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,9 @@ + +[emulation] +clear_ram_on_file_load=false + +[ui] +win_width=500 +win_height=300 +hpane_pos=100 +vpane_pos=200 diff -Nru emu8051-1.1.1/data/Makefile.am emu8051-2.0.1/data/Makefile.am --- emu8051-1.1.1/data/Makefile.am 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/data/Makefile.am 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,11 @@ + +defconfdir=$(sysconfdir)/xdg/emu8051/default +defconf_DATA = \ + emu8051.conf + +EXTRA_DIST= \ + $(defconf_DATA) + +CLEANFILES = *~ + +MAINTAINERCLEANFILES = Makefile.in diff -Nru emu8051-1.1.1/data/Makefile.in emu8051-2.0.1/data/Makefile.in --- emu8051-1.1.1/data/Makefile.in 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/data/Makefile.in 2014-03-22 18:26:16.000000000 +0000 @@ -0,0 +1,471 @@ +# Makefile.in generated by automake 1.14 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 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@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +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 = : +subdir = data +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(defconfdir)" +DATA = $(defconf_DATA) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS504_CHECK = @AS504_CHECK@ +ASEM51_CHECK = @ASEM51_CHECK@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GREP = @GREP@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_LIBS = @GTK_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBOBJS = @LIBOBJS@ +LIBREADLINE = @LIBREADLINE@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +OBJEXT = @OBJEXT@ +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@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +WARNINGCFLAGS = @WARNINGCFLAGS@ +YACC = @YACC@ +YFLAGS = @YFLAGS@ +ZLIB_LIBS = @ZLIB_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_aux_dir = @ac_aux_dir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +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_alias = @build_alias@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host_alias = @host_alias@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +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_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +zlib_CFLAGS = @zlib_CFLAGS@ +zlib_LIBS = @zlib_LIBS@ +defconfdir = $(sysconfdir)/xdg/emu8051/default +defconf_DATA = \ + emu8051.conf + +EXTRA_DIST = \ + $(defconf_DATA) + +CLEANFILES = *~ +MAINTAINERCLEANFILES = Makefile.in +all: all-am + +.SUFFIXES: +$(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 data/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu data/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): +install-defconfDATA: $(defconf_DATA) + @$(NORMAL_INSTALL) + @list='$(defconf_DATA)'; test -n "$(defconfdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(defconfdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(defconfdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(defconfdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(defconfdir)" || exit $$?; \ + done + +uninstall-defconfDATA: + @$(NORMAL_UNINSTALL) + @list='$(defconf_DATA)'; test -n "$(defconfdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(defconfdir)'; $(am__uninstall_files_from_dir) +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + + +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 $(DATA) +installdirs: + for dir in "$(DESTDIR)$(defconfdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +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: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +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." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-defconfDATA + +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 -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-defconfDATA + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic cscopelist-am \ + ctags-am distclean distclean-generic distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-defconfDATA 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-generic pdf \ + pdf-am ps ps-am tags-am uninstall uninstall-am \ + uninstall-defconfDATA + + +# 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 -Nru emu8051-1.1.1/debian/changelog emu8051-2.0.1/debian/changelog --- emu8051-1.1.1/debian/changelog 2018-04-03 12:21:45.000000000 +0000 +++ emu8051-2.0.1/debian/changelog 2019-08-13 13:55:09.000000000 +0000 @@ -1,8 +1,17 @@ -emu8051 (1.1.1-1build1) bionic; urgency=high +emu8051 (2.0.1-1) unstable; urgency=medium - * No change rebuild to pick up -fPIE compiler default + * Adopt package on behalf of Debian Electronics Team (Closes: #846812) + * Update upstream home page + * Update debian/watch + * New upstream release (Closes: #932352) + * Switch to debhelper 12 + * Set Rules-Requires-Root: no + * Simplify debian/rules + * Update debian/copyright + * Drop debian/menu, see #741573 + * Bump Standards-Version to 4.4.0, no changes - -- Balint Reczey Tue, 03 Apr 2018 12:21:45 +0000 + -- Graham Inggs Tue, 13 Aug 2019 13:55:09 +0000 emu8051 (1.1.1-1) unstable; urgency=low diff -Nru emu8051-1.1.1/debian/compat emu8051-2.0.1/debian/compat --- emu8051-1.1.1/debian/compat 2013-12-31 13:45:28.000000000 +0000 +++ emu8051-2.0.1/debian/compat 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -7 diff -Nru emu8051-1.1.1/debian/control emu8051-2.0.1/debian/control --- emu8051-1.1.1/debian/control 2013-12-31 13:46:03.000000000 +0000 +++ emu8051-2.0.1/debian/control 2019-08-13 13:55:09.000000000 +0000 @@ -1,17 +1,20 @@ Source: emu8051 Section: electronics Priority: optional -Maintainer: Bhavani Shankar -Build-Depends: debhelper (>= 7.0.50~), libgtk2.0-dev, autotools-dev -Homepage: http://www.hugovil.com/fr/emu8051/index.html -Standards-Version: 3.9.5 +Maintainer: Debian Electronics Team +Uploaders: Graham Inggs +Build-Depends: debhelper-compat (= 12), libgtk2.0-dev, libreadline-dev +Homepage: http://www.hugovil.com/projet.php?proj=emu8051&lang=en_US +Standards-Version: 4.4.0 +Rules-Requires-Root: no +Vcs-Browser: https://salsa.debian.org/electronics-team/emu8051 +Vcs-Git: https://salsa.debian.org/electronics-team/emu8051.git Package: emu8051 Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} +Depends: ${misc:Depends}, ${shlibs:Depends} Description: Emulator and simulator for 8051 microcontrollers - Emu8051 is a simulator/emulator for the Intel 8051 family of + Emu8051 is a simulator/emulator for the Intel 8051 family of microcontrollers. It allows the developers to simulate 8051 microcontrollers to test their code and debug it. The program can load Intel HEX files. - diff -Nru emu8051-1.1.1/debian/copyright emu8051-2.0.1/debian/copyright --- emu8051-1.1.1/debian/copyright 2013-12-31 13:29:34.000000000 +0000 +++ emu8051-2.0.1/debian/copyright 2019-08-13 13:55:09.000000000 +0000 @@ -1,12 +1,12 @@ -Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Upstream-Contact: Hugo Villeneuve , +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Contact: Hugo Villeneuve , Jonathan St-André , Pascal Fecteau Upstream-Name: emu8051 -Source: http://www.hugovil.com/en/emu8051/download.html +Source: http://www.hugovil.com/projet.php?proj=emu8051&lang=en_US&page=download Files: * -Copyright: 1999-2011, Hugo Villeneuve , +Copyright: 1999-2014, Hugo Villeneuve , Jonathan St-André , Pascal Fecteau License: GPL-2+ @@ -14,6 +14,7 @@ Files: debian/* Copyright: 2009-2010 Pierre Ferrari 2010-2013 Bhavani Shankar + 2019 Graham Inggs License: GPL-2+ License: GPL-2+ @@ -28,4 +29,3 @@ . On Debian GNU/Linux systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL-2. - diff -Nru emu8051-1.1.1/debian/install emu8051-2.0.1/debian/install --- emu8051-1.1.1/debian/install 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/debian/install 2019-08-13 13:55:09.000000000 +0000 @@ -0,0 +1 @@ +debian/emu8051.desktop usr/share/applications diff -Nru emu8051-1.1.1/debian/links emu8051-2.0.1/debian/links --- emu8051-1.1.1/debian/links 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/debian/links 2019-08-13 13:55:09.000000000 +0000 @@ -0,0 +1,2 @@ +/usr/share/man/man1/emu8051.1 /usr/share/man/man1/emu8051-cli.1 +/usr/share/man/man1/emu8051.1 /usr/share/man/man1/emu8051-gtk.1 diff -Nru emu8051-1.1.1/debian/menu emu8051-2.0.1/debian/menu --- emu8051-1.1.1/debian/menu 2013-12-29 09:19:19.000000000 +0000 +++ emu8051-2.0.1/debian/menu 1970-01-01 00:00:00.000000000 +0000 @@ -1,6 +0,0 @@ -?package(emu8051):needs="X11" \ - section="Applications/Education" \ - hints="GNOME" \ - title="Emu8051" \ - longtitle="intel 8051 emulator" \ - command="/usr/bin/emu8051-gtk" diff -Nru emu8051-1.1.1/debian/rules emu8051-2.0.1/debian/rules --- emu8051-1.1.1/debian/rules 2013-12-31 13:45:12.000000000 +0000 +++ emu8051-2.0.1/debian/rules 2019-08-13 13:55:09.000000000 +0000 @@ -1,22 +1,9 @@ #!/usr/bin/make -f - -LDFLAGS+=-Wl,-z,defs -Wl,--as-needed + +export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed # Enable all hardening flags export DEB_BUILD_MAINT_OPTIONS = hardening=+all %: - dh ${@} - -override_dh_auto_install: - dh_auto_install - #Add command here to install desktop file - $(MAKE) DESTDIR=$(CURDIR)/debian/emu8051 install - dh_install debian/emu8051.desktop usr/share/applications - #Link executables for man file - dh_link /usr/share/man/man1/emu8051.1 /usr/share/man/man1/emu8051-gtk.1 - dh_link /usr/share/man/man1/emu8051.1 /usr/share/man/man1/emu8051-cli.1 - - - - + dh $@ diff -Nru emu8051-1.1.1/debian/watch emu8051-2.0.1/debian/watch --- emu8051-1.1.1/debian/watch 2013-12-29 07:53:47.000000000 +0000 +++ emu8051-2.0.1/debian/watch 2019-08-13 13:05:00.000000000 +0000 @@ -1,2 +1,3 @@ -version=3 -http://www.hugovil.com/fr/emu8051/download.html .*/emu8051-(\d.*)\.(?:tgz|tar\.(?:gz|bz2|xz)) +version=4 +http://www.hugovil.com/repository/emu8051 \ + emu8051-(.+)@ARCHIVE_EXT@ diff -Nru emu8051-1.1.1/doc/emu8051.man emu8051-2.0.1/doc/emu8051.man --- emu8051-1.1.1/doc/emu8051.man 2011-10-29 21:06:32.000000000 +0000 +++ emu8051-2.0.1/doc/emu8051.man 2014-03-22 18:25:51.000000000 +0000 @@ -24,7 +24,7 @@ output version information and exit .SH CREDITS -\fBemu8051\fR was originally written by Jonathan St-André, Hugo Villeneuve and Pascal Fecteau. +\fBemu8051\fR was originally written by Jonathan St-André, Hugo Villeneuve and Pascal Fecteau. .SH COPYRIGHT \fBemu8051\fR is free; anyone may redistribute it to anyone under the terms diff -Nru emu8051-1.1.1/doc/Makefile.in emu8051-2.0.1/doc/Makefile.in --- emu8051-1.1.1/doc/Makefile.in 2011-12-12 04:55:40.000000000 +0000 +++ emu8051-2.0.1/doc/Makefile.in 2014-03-22 18:26:16.000000000 +0000 @@ -1,9 +1,8 @@ -# Makefile.in generated by automake 1.11.1 from Makefile.am. +# Makefile.in generated by automake 1.14 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. +# Copyright (C) 1994-2013 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. @@ -15,6 +14,51 @@ @SET_MAKE@ VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -32,24 +76,34 @@ PRE_UNINSTALL = : POST_UNINSTALL = : subdir = doc -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/config/debug.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = -AM_V_GEN = $(am__v_GEN_$(V)) -am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) -am__v_GEN_0 = @echo " GEN " $@; -AM_V_at = $(am__v_at_$(V)) -am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ +am__v_at_1 = SOURCES = DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ @@ -71,14 +125,24 @@ am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } man1dir = $(mandir)/man1 am__installdirs = "$(DESTDIR)$(man1dir)" NROFF = nroff MANS = $(man1_MANS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS504_CHECK = @AS504_CHECK@ +ASEM51_CHECK = @ASEM51_CHECK@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -96,6 +160,8 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ GREP = @GREP@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ @@ -105,7 +171,11 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBOBJS = @LIBOBJS@ +LIBREADLINE = @LIBREADLINE@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ @@ -120,15 +190,23 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +WARNINGCFLAGS = @WARNINGCFLAGS@ +YACC = @YACC@ +YFLAGS = @YFLAGS@ +ZLIB_LIBS = @ZLIB_LIBS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_aux_dir = @ac_aux_dir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ @@ -167,6 +245,8 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ +zlib_CFLAGS = @zlib_CFLAGS@ +zlib_LIBS = @zlib_LIBS@ man1_MANS = emu8051.man EXTRA_DIST = $(man1_MANS) CLEANFILES = *~ @@ -206,9 +286,18 @@ $(am__aclocal_m4_deps): install-man1: $(man1_MANS) @$(NORMAL_INSTALL) - test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)" - @list='$(man1_MANS)'; test -n "$(man1dir)" || exit 0; \ - { for i in $$list; do echo "$$i"; done; \ + @list1='$(man1_MANS)'; \ + list2=''; \ + test -n "$(man1dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.1[a-z]*$$/p'; \ + fi; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ @@ -235,30 +324,15 @@ files=`{ for i in $$list; do echo "$$i"; done; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ - test -z "$$files" || { \ - echo " ( cd '$(DESTDIR)$(man1dir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(man1dir)" && rm -f $$files; } -tags: TAGS -TAGS: + dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) +tags TAGS: + +ctags CTAGS: -ctags: CTAGS -CTAGS: +cscope cscopelist: distdir: $(DISTFILES) - @list='$(MANS)'; if test -n "$$list"; then \ - list=`for p in $$list; do \ - if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ - if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ - if test -n "$$list" && \ - grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ - echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ - grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ - echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ - echo " typically \`make maintainer-clean' will remove them" >&2; \ - exit 1; \ - else :; fi; \ - else :; fi @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ @@ -305,10 +379,15 @@ 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 + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: @@ -392,16 +471,17 @@ .MAKE: install-am install-strip -.PHONY: all all-am check check-am clean clean-generic distclean \ - distclean-generic 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-man1 install-pdf install-pdf-am install-ps \ - install-ps-am install-strip installcheck installcheck-am \ - installdirs maintainer-clean maintainer-clean-generic \ - mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \ - uninstall-am uninstall-man uninstall-man1 +.PHONY: all all-am check check-am clean clean-generic cscopelist-am \ + ctags-am distclean distclean-generic 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-man1 install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ + pdf-am ps ps-am tags-am uninstall uninstall-am uninstall-man \ + uninstall-man1 # Tell versions [3.59,3.63) of GNU make to not export all variables. diff -Nru emu8051-1.1.1/Makefile.am emu8051-2.0.1/Makefile.am --- emu8051-1.1.1/Makefile.am 2011-10-29 21:06:32.000000000 +0000 +++ emu8051-2.0.1/Makefile.am 2014-03-22 18:25:51.000000000 +0000 @@ -1,14 +1,13 @@ ## Makefile.am -- Process this file with automake to produce Makefile.in +.PHONY: changelog + AUTOMAKE_OPTIONS = gnu -SUBDIRS = src doc +SUBDIRS = src/common src/cli src/gtk data doc tests ## We want these in the dist tarball -EXTRA_DIST = autogen.sh \ - $(ac_aux_dir)/debug.m4 \ - pixmaps \ - test-files +EXTRA_DIST = pixmaps ACLOCAL = aclocal -I $(ac_aux_dir) @@ -17,8 +16,21 @@ DISTCLEANFILES = .deps/*.P MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure config-h.in \ - stamp-h.in $(ac_aux_dir)/depcomp \ + stamp-h.in ChangeLog $(ac_aux_dir)/depcomp \ $(ac_aux_dir)/install-sh $(ac_aux_dir)/missing \ $(ac_aux_dir)/mkinstalldirs $(ac_aux_dir)/config.guess \ $(ac_aux_dir)/config.sub $(ac_aux_dir)/ltmain.sh \ - $(ac_aux_dir)/compile + $(ac_aux_dir)/compile \ + $(ac_aux_dir)/test-driver \ + $(ac_aux_dir)/ar-lib \ + $(ac_aux_dir)/ylwrap + +changelog: + @if test -d $(srcdir)/.git; then \ + $(srcdir)/build-aux/gitlog-to-changelog \ + --format='%s%n%n%b%n' \ + --no-cluster \ + --strip-tab \ + --strip-cherry-pick \ + >ChangeLog; \ + fi diff -Nru emu8051-1.1.1/Makefile.in emu8051-2.0.1/Makefile.in --- emu8051-1.1.1/Makefile.in 2011-12-12 04:55:41.000000000 +0000 +++ emu8051-2.0.1/Makefile.in 2014-03-22 18:26:16.000000000 +0000 @@ -1,9 +1,8 @@ -# Makefile.in generated by automake 1.11.1 from Makefile.am. +# Makefile.in generated by automake 1.14 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. +# Copyright (C) 1994-2013 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. @@ -15,6 +14,51 @@ @SET_MAKE@ VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -32,14 +76,16 @@ PRE_UNINSTALL = : POST_UNINSTALL = : subdir = . -DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in $(srcdir)/config-h.in \ - $(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \ - TODO config/compile config/depcomp config/install-sh \ - config/missing +DIST_COMMON = INSTALL NEWS README AUTHORS ChangeLog \ + $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(top_srcdir)/configure $(am__configure_deps) \ + $(srcdir)/config-h.in COPYING TODO build-aux/ar-lib \ + build-aux/compile build-aux/install-sh build-aux/missing \ + $(top_srcdir)/build-aux/ar-lib $(top_srcdir)/build-aux/compile \ + $(top_srcdir)/build-aux/install-sh \ + $(top_srcdir)/build-aux/missing ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/config/debug.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ @@ -48,36 +94,73 @@ CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = -AM_V_GEN = $(am__v_GEN_$(V)) -am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) -am__v_GEN_0 = @echo " GEN " $@; -AM_V_at = $(am__v_at_$(V)) -am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ +am__v_at_1 = SOURCES = DIST_SOURCES = -RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ - html-recursive info-recursive install-data-recursive \ - install-dvi-recursive install-exec-recursive \ - install-html-recursive install-info-recursive \ - install-pdf-recursive install-ps-recursive install-recursive \ - installcheck-recursive installdirs-recursive pdf-recursive \ - ps-recursive uninstall-recursive +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive -AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ - $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ - distdir dist dist-all distcheck +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + cscope distdir dist dist-all distcheck +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ + $(LISP)config-h.in +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags +CSCOPE = cscope DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ - { test ! -d "$(distdir)" \ - || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ - && rm -fr "$(distdir)"; }; } + if test -d "$(distdir)"; then \ + find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -rf "$(distdir)" \ + || { sleep 5 && rm -rf "$(distdir)"; }; \ + else :; fi +am__post_remove_distdir = $(am__remove_distdir) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ @@ -105,11 +188,17 @@ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best +DIST_TARGETS = dist-gzip distuninstallcheck_listfiles = find . -type f -print +am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ + | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLOCAL = aclocal -I $(ac_aux_dir) AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS504_CHECK = @AS504_CHECK@ +ASEM51_CHECK = @ASEM51_CHECK@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -127,6 +216,8 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ GREP = @GREP@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ @@ -136,7 +227,11 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBOBJS = @LIBOBJS@ +LIBREADLINE = @LIBREADLINE@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ @@ -151,15 +246,23 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +WARNINGCFLAGS = @WARNINGCFLAGS@ +YACC = @YACC@ +YFLAGS = @YFLAGS@ +ZLIB_LIBS = @ZLIB_LIBS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_aux_dir = @ac_aux_dir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ @@ -198,27 +301,28 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ +zlib_CFLAGS = @zlib_CFLAGS@ +zlib_LIBS = @zlib_LIBS@ AUTOMAKE_OPTIONS = gnu -SUBDIRS = src doc -EXTRA_DIST = autogen.sh \ - $(ac_aux_dir)/debug.m4 \ - pixmaps \ - test-files - +SUBDIRS = src/common src/cli src/gtk data doc tests +EXTRA_DIST = pixmaps CLEANFILES = *~ DISTCLEANFILES = .deps/*.P MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure config-h.in \ - stamp-h.in $(ac_aux_dir)/depcomp \ + stamp-h.in ChangeLog $(ac_aux_dir)/depcomp \ $(ac_aux_dir)/install-sh $(ac_aux_dir)/missing \ $(ac_aux_dir)/mkinstalldirs $(ac_aux_dir)/config.guess \ $(ac_aux_dir)/config.sub $(ac_aux_dir)/ltmain.sh \ - $(ac_aux_dir)/compile + $(ac_aux_dir)/compile \ + $(ac_aux_dir)/test-driver \ + $(ac_aux_dir)/ar-lib \ + $(ac_aux_dir)/ylwrap all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: -am--refresh: +am--refresh: Makefile @: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ @@ -254,10 +358,8 @@ $(am__aclocal_m4_deps): config.h: stamp-h1 - @if test ! -f $@; then \ - rm -f stamp-h1; \ - $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \ - else :; fi + @test -f $@ || rm -f stamp-h1 + @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 stamp-h1: $(srcdir)/config-h.in $(top_builddir)/config.status @rm -f stamp-h1 @@ -271,22 +373,25 @@ -rm -f config.h stamp-h1 # This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @fail= failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ @@ -301,57 +406,12 @@ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" -$(RECURSIVE_CLEAN_TARGETS): - @fail= failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +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; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: tags-recursive $(HEADERS) $(SOURCES) config-h.in $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ @@ -367,12 +427,7 @@ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ - list='$(SOURCES) $(HEADERS) config-h.in $(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; }; }'`; \ + $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ @@ -384,15 +439,11 @@ $$unique; \ fi; \ fi -ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config-h.in $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) config-h.in $(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; }; }'`; \ +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique @@ -401,9 +452,31 @@ here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" +cscope: cscope.files + test ! -s cscope.files \ + || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) +clean-cscope: + -rm -f cscope.files +cscope.files: clean-cscope cscopelist +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + -rm -f cscope.out cscope.in.out cscope.po.out cscope.files distdir: $(DISTFILES) @case `sed 15q $(srcdir)/NEWS` in \ @@ -445,13 +518,10 @@ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ - test -d "$(distdir)/$$subdir" \ - || $(MKDIR_P) "$(distdir)/$$subdir" \ - || exit 1; \ - fi; \ - done - @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ @@ -480,36 +550,42 @@ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__remove_distdir) + $(am__post_remove_distdir) dist-bzip2: distdir - tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 - $(am__remove_distdir) + tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 + $(am__post_remove_distdir) -dist-lzma: distdir - tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma - $(am__remove_distdir) +dist-lzip: distdir + tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz + $(am__post_remove_distdir) dist-xz: distdir - tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz - $(am__remove_distdir) + tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz + $(am__post_remove_distdir) dist-tarZ: distdir + @echo WARNING: "Support for shar distribution archives is" \ + "deprecated." >&2 + @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z - $(am__remove_distdir) + $(am__post_remove_distdir) dist-shar: distdir + @echo WARNING: "Support for distribution archives compressed with" \ + "legacy program 'compress' is deprecated." >&2 + @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz - $(am__remove_distdir) + $(am__post_remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) - $(am__remove_distdir) + $(am__post_remove_distdir) -dist dist-all: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__remove_distdir) +dist dist-all: + $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' + $(am__post_remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another @@ -520,8 +596,8 @@ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ - *.tar.lzma*) \ - lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ + *.tar.lz*) \ + lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ @@ -531,9 +607,9 @@ *.zip*) \ unzip $(distdir).zip ;;\ esac - chmod -R a-w $(distdir); chmod a+w $(distdir) - mkdir $(distdir)/_build - mkdir $(distdir)/_inst + chmod -R a-w $(distdir) + chmod u+w $(distdir) + mkdir $(distdir)/_build $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ @@ -541,6 +617,7 @@ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ @@ -564,13 +641,21 @@ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 - $(am__remove_distdir) + $(am__post_remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: - @$(am__cd) '$(distuninstallcheck_dir)' \ - && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ + @test -n '$(distuninstallcheck_dir)' || { \ + echo 'ERROR: trying to run $@ with an empty' \ + '$$(distuninstallcheck_dir)' >&2; \ + exit 1; \ + }; \ + $(am__cd) '$(distuninstallcheck_dir)' || { \ + echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ + exit 1; \ + }; \ + test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ @@ -601,10 +686,15 @@ installcheck: installcheck-recursive 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 + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: @@ -688,24 +778,36 @@ uninstall-am: -.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \ - ctags-recursive install-am install-strip tags-recursive - -.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ - all all-am am--refresh check check-am clean clean-generic \ - ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \ - dist-lzma dist-shar dist-tarZ dist-xz dist-zip distcheck \ - distclean distclean-generic distclean-hdr distclean-tags \ - distcleancheck distdir distuninstallcheck 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 installdirs-am maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ - pdf-am ps ps-am tags tags-recursive uninstall uninstall-am +.MAKE: $(am__recursive_targets) all install-am install-strip +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ + am--refresh check check-am clean clean-cscope clean-generic \ + cscope cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \ + dist-gzip dist-lzip dist-shar dist-tarZ dist-xz dist-zip \ + distcheck distclean distclean-generic distclean-hdr \ + distclean-tags distcleancheck distdir distuninstallcheck 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 installdirs-am \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am + + +.PHONY: changelog + +changelog: + @if test -d $(srcdir)/.git; then \ + $(srcdir)/build-aux/gitlog-to-changelog \ + --format='%s%n%n%b%n' \ + --no-cluster \ + --strip-tab \ + --strip-cherry-pick \ + >ChangeLog; \ + fi # 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. diff -Nru emu8051-1.1.1/NEWS emu8051-2.0.1/NEWS --- emu8051-1.1.1/NEWS 2011-12-12 04:53:43.000000000 +0000 +++ emu8051-2.0.1/NEWS 2014-03-22 18:25:51.000000000 +0000 @@ -1,3 +1,83 @@ +2014-01-14: emu8051-2.0.1 has been released + + Convert manpage to UTF-8 + + Do not display registers at CLI version startup + + Dont exit application in case of hexfile reading failure + + Fix C99 standard types uintN_t + + Fix test script to work in external build directory + + Add support for GNU readline (adds commands history). + + Allow hex numbers to begin with 0x or $ prefix in CLI version + + Allow to set all SFR registers in CLI version + + Convert CLI version input parsing to Lex/Yacc + + Remove address parameter from RUN and TRACE CLI commands + + Add better error checking when loading invalid hex files + + Allow EM command to be specified without arguments + + Add two timers (independent of internal 8051 timers) + + See the file 'ChangeLog' for further details. + +2014-01-14: emu8051-2.0.0 has been released + + Fix error with ADDC instruction: the carry flag was not added to the + result. + + Fix bug when processing interrupts + + Fix bug with timers mode 0 (8 bits with 5-bit prescaler) + + Fix error with timer1 being written to timer0 + + Fix error with EM command in CLI mode + + Add option to automatically run and stop CLI emulator for + regression testing + + Add parity bit update each instruction cycle + + Fix bug with MOV DPTR,#data16 instruction + + Fix bugs with ORL and ANL instructions + + Fix error with ADD instruction and AC bit + + Fix error with JMP @A,DPTR instruction + + Fix error with RETI instruction + + Add Timers 0 and 1 to SFR window + + Add option to specify memory sizes + + Add live option to change windows layout (8 or 16 bytes width) + + Add external memory window + + Memory and register windows values can now be edited + + Save paned positions and main window size to config file + Add support for saving UI settings to config file + + Replace fixed frames with scrollable and resizable windows + + Update code to compile with GTK3 + + See the file 'ChangeLog' for further details. + +2013-09-07: emu8051-1.1.2 has been released + Fix error with CJNE instruction. + 2011-12-11: emu8051-1.1.1 has been released (from emu8051-1.1.1-rc2). 2011-11-20: emu8051-1.1.1-rc2 has been released. diff -Nru emu8051-1.1.1/pixmaps/.svn/all-wcprops emu8051-2.0.1/pixmaps/.svn/all-wcprops --- emu8051-1.1.1/pixmaps/.svn/all-wcprops 2011-10-29 21:06:32.000000000 +0000 +++ emu8051-2.0.1/pixmaps/.svn/all-wcprops 1970-01-01 00:00:00.000000000 +0000 @@ -1,29 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 29 -/svn/!svn/ver/1/trunk/pixmaps -END -reset.xpm -K 25 -svn:wc:ra_dav:version-url -V 39 -/svn/!svn/ver/1/trunk/pixmaps/reset.xpm -END -run.xpm -K 25 -svn:wc:ra_dav:version-url -V 37 -/svn/!svn/ver/1/trunk/pixmaps/run.xpm -END -stop.xpm -K 25 -svn:wc:ra_dav:version-url -V 38 -/svn/!svn/ver/1/trunk/pixmaps/stop.xpm -END -step.xpm -K 25 -svn:wc:ra_dav:version-url -V 38 -/svn/!svn/ver/1/trunk/pixmaps/step.xpm -END diff -Nru emu8051-1.1.1/pixmaps/.svn/entries emu8051-2.0.1/pixmaps/.svn/entries --- emu8051-1.1.1/pixmaps/.svn/entries 2011-10-29 21:06:32.000000000 +0000 +++ emu8051-2.0.1/pixmaps/.svn/entries 1970-01-01 00:00:00.000000000 +0000 @@ -1,164 +0,0 @@ -10 - -dir -21 -https://emu8051.googlecode.com/svn/trunk/pixmaps -https://emu8051.googlecode.com/svn - - - -2004-05-08T02:56:47.789250Z -1 - - - - - - - - - - - - - - - -b16f683b-584c-df02-229f-e7a19a03f390 - -reset.xpm -file - - - - -2011-10-29T21:06:32.000000Z -686bdec71766a36e9f30aedb8889c047 -2004-05-08T02:56:47.789250Z -1 - - - - - - - - - - - - - - - - - - - - - - -2592 - -run.xpm -file - - - - -2011-10-29T21:06:32.000000Z -a9aa98d4c693cb1c4b514a1d9caa92fb -2004-05-08T02:56:47.789250Z -1 - - - - - - - - - - - - - - - - - - - - - - -2605 - -stop.xpm -file - - - - -2011-10-29T21:06:32.000000Z -a1d8a48bf31cefcfd274928591840a02 -2004-05-08T02:56:47.789250Z -1 - - - - - - - - - - - - - - - - - - - - - - -2606 - -step.xpm -file - - - - -2011-10-29T21:06:32.000000Z -b8a173d47ad6d0fe595b58ac9298c180 -2004-05-08T02:56:47.789250Z -1 - - - - - - - - - - - - - - - - - - - - - - -2621 - diff -Nru emu8051-1.1.1/pixmaps/.svn/text-base/reset.xpm.svn-base emu8051-2.0.1/pixmaps/.svn/text-base/reset.xpm.svn-base --- emu8051-1.1.1/pixmaps/.svn/text-base/reset.xpm.svn-base 2011-10-29 21:06:32.000000000 +0000 +++ emu8051-2.0.1/pixmaps/.svn/text-base/reset.xpm.svn-base 1970-01-01 00:00:00.000000000 +0000 @@ -1,54 +0,0 @@ -/* XPM */ -static char * reset_xpm[] = { -"48 48 3 1", -" c None", -". c #005A9C", -"+ c #FFFFFF", -"................................................", -"................................................", -"................................................", -"................................................", -"................................................", -"................................................", -"................................................", -"................................................", -"................................................", -"................................................", -"................................................", -"................................................", -"................................................", -"................................................", -"................................................", -"................................................", -"................................................", -"................................................", -"..+++++++..++++++++..+++++++.++++++++.++++++++..", -"..++++++++.++++++++.++++++++.++++++++.++++++++..", -"..++....++.++.......++.......++..........++.....", -"..++....++.++.......++.......++..........++.....", -"..++....++.++.......++.......++..........++.....", -"..++....++.+++++++..+++++++..+++++++.....++.....", -"..+++++++..+++++++...+++++++.+++++++.....++.....", -"..+++++++..++.............++.++..........++.....", -"..++....++.++.............++.++..........++.....", -"..++....++.++.............++.++..........++.....", -"..++....++.++++++++.++++++++.++++++++....++.....", -"..++....++.++++++++.+++++++..++++++++....++.....", -"................................................", -"................................................", -"................................................", -"................................................", -"................................................", -"................................................", -"................................................", -"................................................", -"................................................", -"................................................", -"................................................", -"................................................", -"................................................", -"................................................", -"................................................", -"................................................", -"................................................", -"................................................"}; diff -Nru emu8051-1.1.1/pixmaps/.svn/text-base/run.xpm.svn-base emu8051-2.0.1/pixmaps/.svn/text-base/run.xpm.svn-base --- emu8051-1.1.1/pixmaps/.svn/text-base/run.xpm.svn-base 2011-10-29 21:06:32.000000000 +0000 +++ emu8051-2.0.1/pixmaps/.svn/text-base/run.xpm.svn-base 1970-01-01 00:00:00.000000000 +0000 @@ -1,55 +0,0 @@ -/* XPM */ -static char * run_xpm[] = { -"48 48 4 1", -" c None", -". c #000000", -"+ c #008C6B", -"@ c #FFFFFF", -" ........... ", -" ................... ", -" ........+++++++........ ", -" ......+++++++++++++++...... ", -" .....+++++++++++++++++++..... ", -" .....+++++++++++++++++++++++..... ", -" .....+++++++++++++++++++++++++..... ", -" ....+++++++++++++++++++++++++++++.... ", -" ...+++++++++++++++++++++++++++++++... ", -" ...+++++++++++++++++++++++++++++++++... ", -" ....+++++++++++++++++++++++++++++++++.... ", -" ...+++++++++++++++++++++++++++++++++++... ", -" ...+++++++++++++++++++++++++++++++++++++... ", -" ...+++++++++++++++++++++++++++++++++++++... ", -" ...+++++++++++++++++++++++++++++++++++++++... ", -" ...+++++++++++++++++++++++++++++++++++++++... ", -" ..+++++++++++++++++++++++++++++++++++++++++.. ", -" ..++++++++@@@@@@@++@@++++@@+@@++++@@+++++++.. ", -"...++++++++@@@@@@@@+@@++++@@+@@@+++@@+++++++... ", -"...++++++++@@++++@@+@@++++@@+@@@+++@@+++++++... ", -"..+++++++++@@++++@@+@@++++@@+@@@@++@@++++++++.. ", -"..+++++++++@@++++@@+@@++++@@+@@@@++@@++++++++.. ", -"..+++++++++@@++++@@+@@++++@@+@@+@@+@@++++++++.. ", -"..+++++++++@@@@@@@++@@++++@@+@@+@@+@@++++++++.. ", -"..+++++++++@@@@@@@++@@++++@@+@@++@@@@++++++++.. ", -"..+++++++++@@++++@@+@@++++@@+@@++@@@@++++++++.. ", -"..+++++++++@@++++@@+@@++++@@+@@+++@@@++++++++.. ", -"...++++++++@@++++@@+@@@@@@@@+@@+++@@@+++++++... ", -"...++++++++@@++++@@++@@@@@@++@@++++@@+++++++... ", -" ..+++++++++++++++++++++++++++++++++++++++++.. ", -" ..+++++++++++++++++++++++++++++++++++++++++.. ", -" ...+++++++++++++++++++++++++++++++++++++++... ", -" ...+++++++++++++++++++++++++++++++++++++++... ", -" ...+++++++++++++++++++++++++++++++++++++... ", -" ...+++++++++++++++++++++++++++++++++++++... ", -" ...+++++++++++++++++++++++++++++++++++... ", -" ....+++++++++++++++++++++++++++++++++.... ", -" ...+++++++++++++++++++++++++++++++++... ", -" ...+++++++++++++++++++++++++++++++... ", -" ....+++++++++++++++++++++++++++++.... ", -" .....+++++++++++++++++++++++++..... ", -" .....+++++++++++++++++++++++..... ", -" .....+++++++++++++++++++..... ", -" ......+++++++++++++++...... ", -" ........+++++++........ ", -" ................... ", -" ........... ", -" "}; diff -Nru emu8051-1.1.1/pixmaps/.svn/text-base/step.xpm.svn-base emu8051-2.0.1/pixmaps/.svn/text-base/step.xpm.svn-base --- emu8051-1.1.1/pixmaps/.svn/text-base/step.xpm.svn-base 2011-10-29 21:06:32.000000000 +0000 +++ emu8051-2.0.1/pixmaps/.svn/text-base/step.xpm.svn-base 1970-01-01 00:00:00.000000000 +0000 @@ -1,56 +0,0 @@ -/* XPM */ -static char * step_xpm[] = { -"48 48 5 1", -" c None", -". c #FFDE08", -"+ c #000000", -"@ c #FFFFFF", -"# c #080800", -"..........++++++++++++............++++++++++++..", -"...........++++++++++++............++++++++++++.", -"............++++++++++++............++++++++++++", -"+............++++++++++++............+++++++++++", -"++............++++++++++++............++++++++++", -"+++............++++++++++++............+++++++++", -"++++............++++++++++++............++++++++", -"+++++............++++++++++++............+++++++", -"++++++............++++++++++++............++++++", -"+++++++............++++++++++++............+++++", -"++++++++............++++++++++++............++++", -"+++++++++............++++++++++++............+++", -"++++++++++............++++++++++++............++", -"+++++++++++............++++++++++++............+", -"++++++++++++............++++++++++++............", -".++++++++++++++++++++++++++++++++++++++++++++...", -"..+++++++++++++++++++++++++++++++++++++++++++...", -"...++++++++++++++++++++++++++++++++++++++++++...", -"....++++@@@@@@@+@@@@@@@@+@@@@@@@@+@@@@@@@++++...", -"....+++@@@@@@@@+@@@@@@@@+@@@@@@@@+@@@@@@@@+++...", -"....+++@@++++++++++@@++++@@+++++++@@++++@@+++...", -"....+++@@++++++++++@@++++@@+++++++@@++++@@+++...", -"....+++@@++++++++++@@++++@@+++++++@@++++@@+++...", -"....+++@@@@@@@+++++@@++++@@@@@@@++@@++++@@+++...", -"....++++@@@@@@@++++@@++++@@@@@@@++@@@@@@@@++++..", -"....+++++++++@@++++@@++++@@+++++++@@@@@@@++++++.", -"....+++++++++@@++++@@++++@@+++++++@@++++++++++++", -"+...+++++++++@@++++@@++++@@+++++++@@++++++++++++", -"++..+++@@@@@@@@++++@@++++@@@@@@@@+@@++++++++++++", -"+++.+++@@@@@@@+++++@@++++@@@@@@@@+@@++++++++++++", -"++++++++++++++++++++++++++++++++++++++++++++++++", -"++++++++++++++++++++++++++++++++++++++++++++++++", -"++++++++++++++++++++++++++++++++++++++++++++++++", -"+++++++............++++++++++++............+++++", -"++++++++............++++++++++++............++++", -"+++++++++............+#++++++++++............+++", -"++++++++++............++++++++++++............++", -"#++++++++++............++++++++++++............+", -"++++++++++++............++++++++++++............", -".+#++++++++++............+#++++++++++...........", -"..++++++++++++............+#++++++++++..........", -"...++++++++++++............++++++++++++.........", -"....++++++++++++............++++++++++++........", -".....+#++++++++++............+#++++++++++.......", -"......++++++++++++............++++++++++++......", -".......++++++++++++............++++++++++++.....", -"........+#++++++++++............++++++++++++....", -".........++++++++++++............+#++++++++++..."}; diff -Nru emu8051-1.1.1/pixmaps/.svn/text-base/stop.xpm.svn-base emu8051-2.0.1/pixmaps/.svn/text-base/stop.xpm.svn-base --- emu8051-1.1.1/pixmaps/.svn/text-base/stop.xpm.svn-base 2011-10-29 21:06:32.000000000 +0000 +++ emu8051-2.0.1/pixmaps/.svn/text-base/stop.xpm.svn-base 1970-01-01 00:00:00.000000000 +0000 @@ -1,55 +0,0 @@ -/* XPM */ -static char * stop_xpm[] = { -"48 48 4 1", -" c None", -". c #000000", -"+ c #C60021", -"@ c #FFFFFF", -" .................... ", -" .++++++++++++++++++++. ", -" .++@@@@@@@@@@@@@@@@@@++. ", -" .++@@++++++++++++++++@@++. ", -" .++@@++++++++++++++++++@@++. ", -" .++@@++++++++++++++++++++@@++. ", -" .++@@++++++++++++++++++++++@@++. ", -" .++@@++++++++++++++++++++++++@@++. ", -" .++@@++++++++++++++++++++++++++@@++. ", -" .++@@++++++++++++++++++++++++++++@@++. ", -" .++@@++++++++++++++++++++++++++++++@@++. ", -" .++@@++++++++++++++++++++++++++++++++@@++. ", -" .++@@++++++++++++++++++++++++++++++++++@@++. ", -" .++@@++++++++++++++++++++++++++++++++++++@@++. ", -".++@@++++++++++++++++++++++++++++++++++++++@@++.", -".+@@++++++++++++++++++++++++++++++++++++++++@@+.", -".+@++++++++++++++++++++++++++++++++++++++++++@+.", -".+@++++++++++++++++++++++++++++++++++++++++++@+.", -".+@+++++@@@@@@@+@@@@@@@@++@@@@@@++@@@@@@@++++@+.", -".+@++++@@@@@@@@+@@@@@@@@++@@@@@@++@@@@@@@@+++@+.", -".+@++++@@++++++++++@@++++@@@++@@@+@@++++@@+++@+.", -".+@++++@@++++++++++@@++++@@++++@@+@@++++@@+++@+.", -".+@++++@@++++++++++@@++++@@++++@@+@@++++@@+++@+.", -".+@++++@@@@@@@+++++@@++++@@++++@@+@@++++@@+++@+.", -".+@+++++@@@@@@@++++@@++++@@++++@@+@@@@@@@@+++@+.", -".+@++++++++++@@++++@@++++@@++++@@+@@@@@@@++++@+.", -".+@++++++++++@@++++@@++++@@++++@@+@@+++++++++@+.", -".+@++++++++++@@++++@@++++@@@++@@@+@@+++++++++@+.", -".+@++++@@@@@@@@++++@@+++++@@@@@@++@@+++++++++@+.", -".+@++++@@@@@@@+++++@@+++++@@@@@@++@@+++++++++@+.", -".+@++++++++++++++++++++++++++++++++++++++++++@+.", -".+@++++++++++++++++++++++++++++++++++++++++++@+.", -".+@@++++++++++++++++++++++++++++++++++++++++@@+.", -".++@@++++++++++++++++++++++++++++++++++++++@@++.", -" .++@@++++++++++++++++++++++++++++++++++++@@++. ", -" .++@@++++++++++++++++++++++++++++++++++@@++. ", -" .++@@++++++++++++++++++++++++++++++++@@++. ", -" .++@@++++++++++++++++++++++++++++++@@++. ", -" .++@@++++++++++++++++++++++++++++@@++. ", -" .++@@++++++++++++++++++++++++++@@++. ", -" .++@@++++++++++++++++++++++++@@++. ", -" .++@@++++++++++++++++++++++@@++. ", -" .++@@++++++++++++++++++++@@++. ", -" .++@@++++++++++++++++++@@++. ", -" .++@@++++++++++++++++@@++. ", -" .++@@@@@@@@@@@@@@@@@@@+. ", -" .++++++++++++++++++++. ", -" .................... "}; diff -Nru emu8051-1.1.1/README emu8051-2.0.1/README --- emu8051-1.1.1/README 2011-10-29 21:06:32.000000000 +0000 +++ emu8051-2.0.1/README 2014-03-22 18:25:51.000000000 +0000 @@ -1,20 +1,54 @@ Emu8051 -Emu8051 is a simulator/emulator for the Intel 8051 family of microcontrollers. It is -available in two versions: a console (text-only) version and a graphical version (using -the GTK+ toolkit). This is an Open-Source project. The program can load Intel HEX files. -Once loaded, a program can be run (it will run indefinitely or until a breakpoint is -encountered). You can also use the STEP button to execute only a single instruction at -a time and see the effects on registers and memory. It is written in C++, and uses Perl -scripts to generate automatically C++ functions corresponding to each assembly instruction -of the 8051 microcontroller. +Emu8051 is a simulator/emulator for the Intel 8051 family of microcontrollers. +It is available in two versions: a console (text-only) version and a graphical +version (using the GTK+ toolkit). This is an Open-Source project. The program +can load Intel HEX files. Once loaded, a program can be run (it will run +indefinitely or until a breakpoint is encountered). You can also use the STEP +button to execute only a single instruction at a time and see the effects on +registers and memory. It is written in C, and uses Perl scripts to generate +automatically C functions corresponding to each assembly instruction of the +8051 microcontroller. + +For recent project news, see the NEWS file. + Project website: - http://www.hugovil.com/en/emu8051 -This program was tested on the following systems: - "Linux From Scratch 4.0" - -For installation instructions, see the INSTALL file. + http://www.hugovil.com/en/emu8051 -For recent project news, see the NEWS file. + +Installation: + + For installation instructions, see the INSTALL file. + + +Regression testing: + + Emu8051 now supports automatic regression tests. This feature is mainly for + developers who want to make sure that whatever features they implement or + whatever bug they fix don't create additional or new problems. + + To support that feature, you must have a compatible 8051 assembler installed. + At the moment, these two assemblers are supported: + + as504 -- http://www.vanwal.nl/as504 + ASEM-51 -- http://plit.de/asem-51 + + I recommend to compile as504 with this patch to support option "-O": + http://www.hugovil.com/repository/hvlinux/patches/as504-add-output-file-option.patch + as504 doesn't come with an installation script so compile and install it with: + $> make + $> sudo install as504 /usr/local/bin + + Then reconfigure emu8051 so that as504 can be detected and regression testing + enabled. + You can run regression testing by issuing: + $> make check + + Adding a new test case implies adding a new asm source file inside the tests + subdirectory and adding its name to two variables in tests/Makefile.am. + + +This program was tested on the following systems: + "Linux From Scratch 4.0" diff -Nru emu8051-1.1.1/src/cli/keyboard.c emu8051-2.0.1/src/cli/keyboard.c --- emu8051-1.1.1/src/cli/keyboard.c 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/cli/keyboard.c 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,72 @@ +/* + * keyboard.c + * + * Copyright (C) 1999 Jonathan St-André + * Copyright (C) 1999 Hugo Villeneuve + * + * This file is released under the GPLv2 + */ + +#include +#include + +static struct termios orig, newtio; +static int peek = -1; + +int +kbhit(void) +{ + char ch; + int nread; + + if (peek != -1) + return 1; + + newtio.c_cc[VMIN] = 0; + tcsetattr(0, TCSANOW, &newtio); + nread = read(0, &ch, 1); + newtio.c_cc[VMIN] = 1; + tcsetattr(0, TCSANOW, &newtio); + + if (nread == 1) { + peek = ch; + return 1; + } + + return 0; +} + +int +getch(void) +{ + char ch; + + if (peek != -1) { + ch = peek; + peek = -1; + return ch; + } + + read(0, &ch, 1); + + return ch; +} + +void +keyboard_init(void) +{ + tcgetattr(0, &orig); + newtio = orig; + newtio.c_lflag &= ~ICANON; + newtio.c_lflag &= ~ECHO; + newtio.c_lflag &= ~ISIG; + newtio.c_cc[VMIN] = 1; + newtio.c_cc[VTIME] = 0; + tcsetattr(0, TCSANOW, &newtio); +} + +void +keyboard_reset(void) +{ + tcsetattr(0, TCSANOW, &orig); +} diff -Nru emu8051-1.1.1/src/cli/keyboard.h emu8051-2.0.1/src/cli/keyboard.h --- emu8051-1.1.1/src/cli/keyboard.h 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/cli/keyboard.h 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,25 @@ +/* + * keyboard.h + * + * Copyright (C) 1999 Jonathan St-André + * Copyright (C) 1999 Hugo Villeneuve + * + * This file is released under the GPLv2 + */ + +#ifndef _KEYBOARD_H_ +#define _KEYBOARD_H_ + +int +kbhit(void); + +int +getch(void); + +void +keyboard_init(void); + +void +keyboard_reset(void); + +#endif /* _KEYBOARD_H_ */ diff -Nru emu8051-1.1.1/src/cli/main.c emu8051-2.0.1/src/cli/main.c --- emu8051-1.1.1/src/cli/main.c 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/cli/main.c 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,50 @@ +/* + * main.c + * + * Copyright (C) 1999 Jonathan St-André + * Copyright (C) 1999 Hugo Villeneuve + * + * This file is released under the GPLv2 + */ + +#include "config.h" + +#include +#include + +#include "common.h" +#include "cpu8051.h" +#include "options.h" +#include "hexfile.h" +#include "menu.h" +#include "parser.h" + +extern struct options_t options; + +int +main(int argc, char **argv) +{ + int rc; + + parse_command_line_options(argc, argv); + + cpu8051_init(); + + if (options.filename != NULL) { + rc = hexfile_load(options.filename); + if (!rc) + exit(EXIT_FAILURE); + } + + console_reset(); + + if (options.stop_address != 0) { + /* Automatically run program and stop at specified address. */ + console_exec(-1); + } else { + menu_display_usage(); + (void) yyparse(); + } + + exit(EXIT_SUCCESS); +} diff -Nru emu8051-1.1.1/src/cli/Makefile.am emu8051-2.0.1/src/cli/Makefile.am --- emu8051-1.1.1/src/cli/Makefile.am 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/cli/Makefile.am 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,34 @@ +# This file is processed by GNU automake to generate Makefile.in + +AM_CPPFLAGS = \ + $(WARNINGCFLAGS) \ + -I@top_srcdir@ \ + -I@top_srcdir@/src/common + +# Option -d: produce header file scanner.h +AM_LFLAGS = --header-file=scanner.h + +# Option -d: produce header file parser.h +AM_YFLAGS = -d + +LDADD = \ + $(LIBREADLINE) \ + $(top_builddir)/src/common/libemu8051.a + +bin_PROGRAMS = emu8051-cli + +emu8051_cli_SOURCES = \ + parser.y scanner.l \ + main.c \ + menu.c menu.h \ + keyboard.c keyboard.h + +# We want these in the dist tarball +EXTRA_DIST = scanner.h + +CLEANFILES = *~ + +MAINTAINERCLEANFILES = \ + Makefile.in \ + scanner.h scanner.c \ + parser.h parser.c diff -Nru emu8051-1.1.1/src/cli/Makefile.in emu8051-2.0.1/src/cli/Makefile.in --- emu8051-1.1.1/src/cli/Makefile.in 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/cli/Makefile.in 2014-03-22 18:26:16.000000000 +0000 @@ -0,0 +1,655 @@ +# Makefile.in generated by automake 1.14 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 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@ + +# This file is processed by GNU automake to generate Makefile.in + +VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +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 = : +bin_PROGRAMS = emu8051-cli$(EXEEXT) +subdir = src/cli +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am parser.h \ + parser.c scanner.c $(top_srcdir)/build-aux/depcomp \ + $(top_srcdir)/build-aux/ylwrap +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" +PROGRAMS = $(bin_PROGRAMS) +am_emu8051_cli_OBJECTS = parser.$(OBJEXT) scanner.$(OBJEXT) \ + main.$(OBJEXT) menu.$(OBJEXT) keyboard.$(OBJEXT) +emu8051_cli_OBJECTS = $(am_emu8051_cli_OBJECTS) +emu8051_cli_LDADD = $(LDADD) +am__DEPENDENCIES_1 = +emu8051_cli_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(top_builddir)/src/common/libemu8051.a +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +LEXCOMPILE = $(LEX) $(AM_LFLAGS) $(LFLAGS) +AM_V_LEX = $(am__v_LEX_@AM_V@) +am__v_LEX_ = $(am__v_LEX_@AM_DEFAULT_V@) +am__v_LEX_0 = @echo " LEX " $@; +am__v_LEX_1 = +YLWRAP = $(top_srcdir)/build-aux/ylwrap +am__yacc_c2h = sed -e s/cc$$/hh/ -e s/cpp$$/hpp/ -e s/cxx$$/hxx/ \ + -e s/c++$$/h++/ -e s/c$$/h/ +YACCCOMPILE = $(YACC) $(AM_YFLAGS) $(YFLAGS) +AM_V_YACC = $(am__v_YACC_@AM_V@) +am__v_YACC_ = $(am__v_YACC_@AM_DEFAULT_V@) +am__v_YACC_0 = @echo " YACC " $@; +am__v_YACC_1 = +SOURCES = $(emu8051_cli_SOURCES) +DIST_SOURCES = $(emu8051_cli_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS504_CHECK = @AS504_CHECK@ +ASEM51_CHECK = @ASEM51_CHECK@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GREP = @GREP@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_LIBS = @GTK_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBOBJS = @LIBOBJS@ +LIBREADLINE = @LIBREADLINE@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +OBJEXT = @OBJEXT@ +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@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +WARNINGCFLAGS = @WARNINGCFLAGS@ +YACC = @YACC@ +YFLAGS = @YFLAGS@ +ZLIB_LIBS = @ZLIB_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_aux_dir = @ac_aux_dir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +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_alias = @build_alias@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host_alias = @host_alias@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +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_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +zlib_CFLAGS = @zlib_CFLAGS@ +zlib_LIBS = @zlib_LIBS@ +AM_CPPFLAGS = \ + $(WARNINGCFLAGS) \ + -I@top_srcdir@ \ + -I@top_srcdir@/src/common + + +# Option -d: produce header file scanner.h +AM_LFLAGS = --header-file=scanner.h + +# Option -d: produce header file parser.h +AM_YFLAGS = -d +LDADD = \ + $(LIBREADLINE) \ + $(top_builddir)/src/common/libemu8051.a + +emu8051_cli_SOURCES = \ + parser.y scanner.l \ + main.c \ + menu.c menu.h \ + keyboard.c keyboard.h + + +# We want these in the dist tarball +EXTRA_DIST = scanner.h +CLEANFILES = *~ +MAINTAINERCLEANFILES = \ + Makefile.in \ + scanner.h scanner.c \ + parser.h parser.c + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .l .o .obj .y +$(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/cli/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/cli/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): +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p \ + ; then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' \ + -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' \ + `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) + +installcheck-binPROGRAMS: $(bin_PROGRAMS) + bad=0; pid=$$$$; list="$(bin_PROGRAMS)"; for p in $$list; do \ + case ' $(AM_INSTALLCHECK_STD_OPTIONS_EXEMPT) ' in \ + *" $$p "* | *" $(srcdir)/$$p "*) continue;; \ + esac; \ + f=`echo "$$p" | \ + sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + for opt in --help --version; do \ + if "$(DESTDIR)$(bindir)/$$f" $$opt >c$${pid}_.out \ + 2>c$${pid}_.err &2; bad=1; fi; \ + done; \ + done; rm -f c$${pid}_.???; exit $$bad +parser.h: parser.c + @if test ! -f $@; then rm -f parser.c; else :; fi + @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) parser.c; else :; fi + +emu8051-cli$(EXEEXT): $(emu8051_cli_OBJECTS) $(emu8051_cli_DEPENDENCIES) $(EXTRA_emu8051_cli_DEPENDENCIES) + @rm -f emu8051-cli$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(emu8051_cli_OBJECTS) $(emu8051_cli_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/keyboard.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/menu.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parser.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scanner.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.l.c: + $(AM_V_LEX)$(am__skiplex) $(SHELL) $(YLWRAP) $< $(LEX_OUTPUT_ROOT).c $@ -- $(LEXCOMPILE) + +.y.c: + $(AM_V_YACC)$(am__skipyacc) $(SHELL) $(YLWRAP) $< y.tab.c $@ y.tab.h `echo $@ | $(am__yacc_c2h)` y.output $*.output -- $(YACCCOMPILE) + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + 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-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + 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" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +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 $(PROGRAMS) +installdirs: + for dir in "$(DESTDIR)$(bindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +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: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +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." + -rm -f parser.c + -rm -f parser.h + -rm -f scanner.c + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic 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-binPROGRAMS + +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: installcheck-binPROGRAMS + +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 + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \ + clean-binPROGRAMS clean-generic cscopelist-am ctags ctags-am \ + distclean distclean-compile distclean-generic distclean-tags \ + distdir dvi dvi-am html html-am info info-am install \ + install-am install-binPROGRAMS 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 \ + installcheck-binPROGRAMS installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am uninstall-binPROGRAMS + + +# 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 -Nru emu8051-1.1.1/src/cli/menu.c emu8051-2.0.1/src/cli/menu.c --- emu8051-1.1.1/src/cli/menu.c 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/cli/menu.c 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,287 @@ +/* + * menu.c + * + * Copyright (C) 1999 Jonathan St-André + * Copyright (C) 1999 Hugo Villeneuve + * + * This file is released under the GPLv2 + */ + +#include "config.h" + +#include +#include +#include +#include +#ifdef HAVE_LIBREADLINE +#include +#include +#endif /* HAVE_LIBREADLINE */ + +#include "common.h" +#include "cpu8051.h" +#include "reg8051.h" +#include "sfr.h" +#include "memory.h" +#include "timers.h" +#include "options.h" +#include "hexfile.h" +#include "keyboard.h" +#include "scanner.h" +#include "menu.h" + +extern struct options_t options; + +#define YY_NULL 0 + +#define MENU_PROMPT "-> " + +int +menu_get_input(char *buf, ssize_t size) +{ + char *line; + int max_len; + + max_len = size - 2; + + if (feof(yyin)) + return YY_NULL; + +#ifdef HAVE_LIBREADLINE + /* Get the input line, and if non-empty, place it in the history. */ + line = readline(MENU_PROMPT); + if (!line) + return YY_NULL; + + if (line && *line) + add_history(line); + + if ((int) strlen(line) > max_len) { + printf("input line too long"); + free(line); + return YY_NULL; + } + + strcpy(buf, line); + + /* Readline never gives you the last '\n', so add it back for Lex. */ + strcat(buf, "\n"); + + free(line); +#else + /* It's okay to print a prompt if we are redirecting stdout, + * as long as stdin is still a tty. Otherwise, don't print + * a prompt at all if stdin is redirected. + */ + (void) fputs(MENU_PROMPT, stdout); + (void) fflush(stdout); /* for svr4 */ + line = fgets(buf, max_len, stdin); + if (!line) + return YY_NULL; +#endif + + return strlen(buf); +} + +void +menu_display_usage(void) +{ + int id; + + printf(" " PACKAGE_NAME " commands, [] = options:\n" + "\n" + " sb [ADDRESS] Set breakpoint at PC or ADDRESS\n" + " rb [ADDRESS] Remove breakpoint at PC or ADDRESS\n" + " ADDRESS = all: clear all breakpoints\n" + " db Display breakpoints\n" + " de ADDRESS NUM Dump NUM bytes from ADDRESS in external data" + " memory\n" + " di ADDRESS NUM Dump NUM bytes from ADDRESS in internal data" + " memory\n" + " dp ADDRESS NUM Dump NUM bytes from ADDRESS in program" + " memory\n" + " dr Display registers\n" + " h or ? Display this help menu\n" + " q Quit\n" + " r [NUM] Run until breakpoint or for NUM " + "instructions\n" + " s Step (execute 1 instruction)\n" + " u [ADDRESS] [NUM] Unassemble NUM instructions at ADDRESS\n" + " we ADDRESS VAL Write VAL at ADDRESS in external data memory\n" + " wi ADDRESS VAL Write VAL at ADDRESS in internal data memory\n" + " wp ADDRESS VAL Write VAL at ADDRESS in program memory\n" + " wr REGISTER VAL Write VAL at REGISTER (REGISTER is name of" + " register)\n" + " z Reset processor\n" + " zt ID Reset emulator timer ID ("); + + for (id = 0; id < GP_TIMERS_COUNT; id++) { + printf("%c", 'A' + id); + if (id < (GP_TIMERS_COUNT - 1)) + printf(", "); + } + printf(")\n"); +} + +/* Disassemble num instructions at address */ +void +disassemble_num(unsigned int address, int num) +{ + char str[255]; + int row; + + for (row = 0; row < num; row++) { + address += cpu8051_disasm(address, str); + printf("%s\n", str); + + if (address > 0xFFFF) + return; + } +} + +/* Capitalize all letters in buffer */ +static void +uppercase(char *buffer) +{ + size_t k; + + for (k = 0; k < strlen(buffer); k++) + buffer[k] = toupper(buffer[k]); +} + +/* Set NewValue to Register */ +void +register_set(char *name, int value) +{ + struct regwin_infos_t *regwin_infos; + + uppercase(name); + + log_debug(" Modify register %s to $%04X", name, value); + + regwin_infos = sfr_get_infos(name); + + if (regwin_infos == NULL) { + printf("Invalid register name\n"); + return; + } + + regwin_write(regwin_infos, value); +} + +/* CPU reset and Console UI update */ +void +console_reset(void) +{ + log_info("Resetting..."); + cpu8051_reset(); + log_info("Done"); +} + +/* + * CPU exec and Console UI update + * num = number of instructions to execute. + * set to -1: run to infinity + */ +void +console_exec(int num) +{ + keyboard_init(); + + log_info("Program executing..."); + + (void) cpu8051_run(num, kbhit); + + if (kbhit()) { + (void) getch(); /* Flush key */ + log_info("Caught break signal!"); + } + + keyboard_reset(); + console_show_registers(); + disassemble_num(cpu8051.pc, 1); +} + +/* CPU trace and Console UI update */ +void +console_trace(void) +{ + (void) cpu8051_exec(); + console_show_registers(); + disassemble_num(cpu8051.pc, 1); +} + +/* Show CPU registers, one per line */ +static void +console_dump_sfr_registers_detailed(void) +{ + int k; + + for (k = 0; k < SFR_REGS; k++) { + struct regwin_infos_t *regwin_infos; + int val; + + regwin_infos = sfr_get_infos_from_row(k); + + printf("%s = ", regwin_infos->name); + + val = regwin_read(k); + if (regwin_infos->w == 2) + printf("$%02X", val); + else if (regwin_infos->w == 4) + printf("$%04X", val); + + printf("\n"); + } +} + +/* Show CPU registers, compact format */ +static void +console_dump_sfr_registers_compact(void) +{ + int id; + unsigned char PSW = mem_read_direct(_PSW_); + int bank_sel = (PSW & 0x18); + + printf("----------------------------------------------------------------------\n"); + printf("| PC | SP | DPTR | ACC | B | PSW: CY AC F0 RS1 RS0 OV - P |\n"); + printf("| %.4X | %.2X | %.4X | %.2X | %.2X |", cpu8051.pc, + mem_read_direct(_SP_), mem_sfr_read_dptr(), + mem_read_direct(_ACC_), mem_read_direct(_B_)); + printf(" %d %d %d %d %d %d %d %d |", + (PSW >> 7) & 1, (PSW >> 6) & 1, (PSW >> 5) & 1, (PSW >> 4) & 1, + (PSW >> 3) & 1, (PSW >> 2) & 1, (PSW >> 1) & 1, PSW & 1); + printf("\n"); + printf("----------------------------------------------------------------------\n"); + + printf("| TCON | TMOD | IE | IP | R0 | R1 | R2 | R3 | R4 | R5 | R6 | R7 | |\n"); + printf("| %.2X | %.2X | %.2X | %.2X ", mem_read_direct(_TCON_), + mem_read_direct(_TMOD_), mem_read_direct(_IE_), mem_read_direct(_IP_)); + printf("| %.2X | %.2X | %.2X | %.2X ", + mem_read_direct(bank_sel + _R0_), + mem_read_direct(bank_sel + _R1_), + mem_read_direct(bank_sel + _R2_), + mem_read_direct(bank_sel + _R3_)); + printf("| %.2X | %.2X | %.2X | %.2X ", + mem_read_direct(bank_sel + _R4_), + mem_read_direct(bank_sel + _R5_), + mem_read_direct(bank_sel + _R6_), + mem_read_direct(bank_sel + _R7_)); + printf("| |\n"); + printf("----------------------------------------------------------------------\n"); + + for (id = 0; id < GP_TIMERS_COUNT; id++) + printf("| Emulator timer %c: %08d |\n", 'A' + id, gp_timer_read(id)); + + printf("------------------------------\n"); +} + +/* Show CPU registers */ +void +console_show_registers(void) +{ + if (options.stop_address != 0) + console_dump_sfr_registers_detailed(); + else + console_dump_sfr_registers_compact(); +} diff -Nru emu8051-1.1.1/src/cli/menu.h emu8051-2.0.1/src/cli/menu.h --- emu8051-1.1.1/src/cli/menu.h 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/cli/menu.h 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,40 @@ +/* + * menu.h + * + * Copyright (C) 1999 Jonathan St-André + * Copyright (C) 1999 Hugo Villeneuve + * + * This file is released under the GPLv2 + */ + +#ifndef _MENU_H_ +#define _MENU_H_ + +int +yyparse(void); + +int +menu_get_input(char *buf, ssize_t size); + +void +menu_display_usage(void); + +void +console_show_registers(void); + +void +register_set(char *name, int value); + +void +console_reset(void); + +void +console_exec(int num); + +void +console_trace(void); + +void +disassemble_num(unsigned int address, int num); + +#endif /* _MENU_H_ */ diff -Nru emu8051-1.1.1/src/cli/parser.c emu8051-2.0.1/src/cli/parser.c --- emu8051-1.1.1/src/cli/parser.c 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/cli/parser.c 2014-03-22 18:26:22.000000000 +0000 @@ -0,0 +1,2001 @@ +/* A Bison parser, made by GNU Bison 2.5. */ + +/* Bison implementation for Yacc-like parsers in C + + Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Bison version. */ +#define YYBISON_VERSION "2.5" + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 0 + +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + +/* Using locations. */ +#define YYLSP_NEEDED 0 + + + +/* Copy the first part of user declarations. */ + +/* Line 268 of yacc.c */ +#line 1 "parser.y" + +#include +#include +#include +#include + +#include "config.h" +#include "log.h" +#include "menu.h" +#include "memory.h" +#include "timers.h" +#include "memory.h" +#include "cpu8051.h" + +/* int yydebug = 1; */ + +/* To get rid of compiler warning. */ +int yylex(); + +int yyerror(const char *str) +{ + fprintf(stderr,"error: %s\n", str); + return 0; +} + + + +/* Line 268 of yacc.c */ +#line 99 "parser.c" + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 +#endif + +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE 0 +#endif + + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + NUMBER = 258, + WORD = 259, + TOK_ENTER = 260, + TOK_ALL = 261, + TOK_SB = 262, + TOK_RB = 263, + TOK_DB = 264, + TOK_DE = 265, + TOK_DI = 266, + TOK_DP = 267, + TOK_DR = 268, + TOK_HELP = 269, + TOK_RUN = 270, + TOK_RST = 271, + TOK_RST_TIMER = 272, + TOK_STEP = 273, + TOK_UNASM = 274, + TOK_MOD_EXT = 275, + TOK_MOD_INT = 276, + TOK_MOD_PROG = 277, + TOK_MOD_REG = 278, + TOK_QUIT = 279, + TOK_A = 280, + TOK_B = 281, + TOK_C = 282, + TOK_D = 283 + }; +#endif +/* Tokens. */ +#define NUMBER 258 +#define WORD 259 +#define TOK_ENTER 260 +#define TOK_ALL 261 +#define TOK_SB 262 +#define TOK_RB 263 +#define TOK_DB 264 +#define TOK_DE 265 +#define TOK_DI 266 +#define TOK_DP 267 +#define TOK_DR 268 +#define TOK_HELP 269 +#define TOK_RUN 270 +#define TOK_RST 271 +#define TOK_RST_TIMER 272 +#define TOK_STEP 273 +#define TOK_UNASM 274 +#define TOK_MOD_EXT 275 +#define TOK_MOD_INT 276 +#define TOK_MOD_PROG 277 +#define TOK_MOD_REG 278 +#define TOK_QUIT 279 +#define TOK_A 280 +#define TOK_B 281 +#define TOK_C 282 +#define TOK_D 283 + + + + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE +{ + +/* Line 293 of yacc.c */ +#line 29 "parser.y" + + int number; + char *string; + + + +/* Line 293 of yacc.c */ +#line 198 "parser.c" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +#endif + + +/* Copy the second part of user declarations. */ + + +/* Line 343 of yacc.c */ +#line 210 "parser.c" + +#ifdef short +# undef short +#endif + +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; +#endif + +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#elif (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +typedef signed char yytype_int8; +#else +typedef short int yytype_int8; +#endif + +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; +#endif + +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int +# endif +#endif + +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + +#ifndef YY_ +# if defined YYENABLE_NLS && YYENABLE_NLS +# if ENABLE_NLS +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_(msgid) dgettext ("bison-runtime", msgid) +# endif +# endif +# ifndef YY_ +# define YY_(msgid) msgid +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(e) ((void) (e)) +#else +# define YYUSE(e) /* empty */ +#endif + +/* Identity function, used to suppress warnings about constant conditions. */ +#ifndef lint +# define YYID(n) (n) +#else +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static int +YYID (int yyi) +#else +static int +YYID (yyi) + int yyi; +#endif +{ + return yyi; +} +#endif + +#if ! defined yyoverflow || YYERROR_VERBOSE + +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined EXIT_SUCCESS \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# endif +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ + + +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; +}; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + + YYSTACK_GAP_MAXIMUM) + +# define YYCOPY_NEEDED 1 + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (YYID (0)) + +#endif + +#if defined YYCOPY_NEEDED && YYCOPY_NEEDED +/* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# else +# define YYCOPY(To, From, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (YYID (0)) +# endif +# endif +#endif /* !YYCOPY_NEEDED */ + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 4 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 99 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 29 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 15 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 44 +/* YYNRULES -- Number of states. */ +#define YYNSTATES 88 + +/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 283 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +static const yytype_uint8 yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28 +}; + +#if YYDEBUG +/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ +static const yytype_uint8 yyprhs[] = +{ + 0, 0, 3, 6, 9, 12, 13, 15, 17, 19, + 21, 23, 25, 27, 29, 31, 33, 35, 37, 41, + 44, 48, 51, 55, 58, 63, 68, 73, 76, 81, + 86, 91, 96, 99, 102, 106, 109, 112, 116, 120, + 124, 128, 131, 136, 140 +}; + +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const yytype_int8 yyrhs[] = +{ + 30, 0, -1, 30, 31, -1, 1, 5, -1, 30, + 5, -1, -1, 32, -1, 33, -1, 34, -1, 35, + -1, 36, -1, 40, -1, 37, -1, 38, -1, 41, + -1, 39, -1, 42, -1, 43, -1, 8, 3, 5, + -1, 8, 5, -1, 8, 6, 5, -1, 7, 5, + -1, 7, 3, 5, -1, 9, 5, -1, 10, 3, + 3, 5, -1, 11, 3, 3, 5, -1, 12, 3, + 3, 5, -1, 13, 5, -1, 20, 3, 3, 5, + -1, 21, 3, 3, 5, -1, 22, 3, 3, 5, + -1, 23, 4, 3, 5, -1, 24, 5, -1, 15, + 5, -1, 15, 3, 5, -1, 14, 5, -1, 16, + 5, -1, 17, 25, 5, -1, 17, 26, 5, -1, + 17, 27, 5, -1, 17, 28, 5, -1, 18, 5, + -1, 19, 3, 3, 5, -1, 19, 3, 5, -1, + 19, 5, -1 +}; + +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +static const yytype_uint16 yyrline[] = +{ + 0, 50, 50, 51, 55, 56, 60, 62, 64, 66, + 68, 70, 72, 74, 76, 78, 80, 82, 86, 92, + 98, 106, 113, 121, 129, 135, 141, 149, 157, 163, + 169, 175, 182, 190, 196, 204, 211, 216, 221, 226, + 231, 238, 245, 250, 256 +}; +#endif + +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "NUMBER", "WORD", "TOK_ENTER", "TOK_ALL", + "TOK_SB", "TOK_RB", "TOK_DB", "TOK_DE", "TOK_DI", "TOK_DP", "TOK_DR", + "TOK_HELP", "TOK_RUN", "TOK_RST", "TOK_RST_TIMER", "TOK_STEP", + "TOK_UNASM", "TOK_MOD_EXT", "TOK_MOD_INT", "TOK_MOD_PROG", "TOK_MOD_REG", + "TOK_QUIT", "TOK_A", "TOK_B", "TOK_C", "TOK_D", "$accept", "start", + "command", "breakpoint_clr", "breakpoint_set", "breakpoint_display", + "dump_mem", "display_regs", "modify", "quit", "run", "help", "reset", + "step", "unasm", 0 +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to + token YYLEX-NUM. */ +static const yytype_uint16 yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283 +}; +# endif + +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 29, 30, 30, 30, 30, 31, 31, 31, 31, + 31, 31, 31, 31, 31, 31, 31, 31, 32, 32, + 32, 33, 33, 34, 35, 35, 35, 36, 37, 37, + 37, 37, 38, 39, 39, 40, 41, 41, 41, 41, + 41, 42, 43, 43, 43 +}; + +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 2, 2, 2, 0, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 3, 2, + 3, 2, 3, 2, 4, 4, 4, 2, 4, 4, + 4, 4, 2, 2, 3, 2, 2, 3, 3, 3, + 3, 2, 4, 3, 2 +}; + +/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE doesn't specify something else to do. Zero + means the default is an error. */ +static const yytype_uint8 yydefact[] = +{ + 0, 0, 0, 3, 1, 4, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 2, 6, 7, 8, 9, 10, + 12, 13, 15, 11, 14, 16, 17, 0, 21, 0, + 19, 0, 23, 0, 0, 0, 27, 35, 0, 33, + 36, 0, 0, 0, 0, 41, 0, 44, 0, 0, + 0, 0, 32, 22, 18, 20, 0, 0, 0, 34, + 37, 38, 39, 40, 0, 43, 0, 0, 0, 0, + 24, 25, 26, 42, 28, 29, 30, 31 +}; + +/* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int8 yydefgoto[] = +{ + -1, 2, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36 +}; + +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +#define YYPACT_NINF -3 +static const yytype_int8 yypact[] = +{ + 0, -2, 25, -3, -3, -3, -1, 47, 26, 3, + 48, 56, 57, 58, 51, 59, 1, 60, 52, 63, + 64, 65, 66, 67, -3, -3, -3, -3, -3, -3, + -3, -3, -3, -3, -3, -3, -3, 68, -3, 69, + -3, 70, -3, 73, 74, 75, -3, -3, 76, -3, + -3, 77, 78, 79, 80, -3, 55, -3, 83, 84, + 85, 86, -3, -3, -3, -3, 87, 88, 89, -3, + -3, -3, -3, -3, 90, -3, 91, 92, 93, 94, + -3, -3, -3, -3, -3, -3, -3, -3 +}; + +/* YYPGOTO[NTERM-NUM]. */ +static const yytype_int8 yypgoto[] = +{ + -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, + -3, -3, -3, -3, -3 +}; + +/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule which + number is the opposite. If YYTABLE_NINF, syntax error. */ +#define YYTABLE_NINF -6 +static const yytype_int8 yytable[] = +{ + -5, 1, 37, 3, 38, -5, 43, -5, -5, -5, + -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, + -5, -5, -5, -5, -5, 4, 51, 52, 53, 54, + 5, 42, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 39, 44, 40, 41, 48, 56, 49, 57, 74, 45, + 75, 0, 46, 47, 50, 55, 58, 59, 60, 0, + 61, 0, 62, 63, 64, 65, 66, 67, 68, 0, + 0, 69, 70, 71, 72, 73, 76, 77, 78, 79, + 0, 0, 80, 81, 82, 83, 84, 85, 86, 87 +}; + +#define yypact_value_is_default(yystate) \ + ((yystate) == (-3)) + +#define yytable_value_is_error(yytable_value) \ + YYID (0) + +static const yytype_int8 yycheck[] = +{ + 0, 1, 3, 5, 5, 5, 3, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 0, 25, 26, 27, 28, + 5, 5, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 3, 3, 5, 6, 3, 3, 5, 5, 3, 3, + 5, -1, 5, 5, 5, 5, 3, 3, 3, -1, + 4, -1, 5, 5, 5, 5, 3, 3, 3, -1, + -1, 5, 5, 5, 5, 5, 3, 3, 3, 3, + -1, -1, 5, 5, 5, 5, 5, 5, 5, 5 +}; + +/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const yytype_uint8 yystos[] = +{ + 0, 1, 30, 5, 0, 5, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 3, 5, 3, + 5, 6, 5, 3, 3, 3, 5, 5, 3, 5, + 5, 25, 26, 27, 28, 5, 3, 5, 3, 3, + 3, 4, 5, 5, 5, 5, 3, 3, 3, 5, + 5, 5, 5, 5, 3, 5, 3, 3, 3, 3, + 5, 5, 5, 5, 5, 5, 5, 5 +}; + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + + +/* Like YYERROR except do call yyerror. This remains here temporarily + to ease the transition to the new meaning of YYERROR, for GCC. + Once GCC version 2 has supplanted version 1, this can go. However, + YYFAIL appears to be in use. Nevertheless, it is formally deprecated + in Bison 2.4.2's NEWS entry, where a plan to phase it out is + discussed. */ + +#define YYFAIL goto yyerrlab +#if defined YYFAIL + /* This is here to suppress warnings from the GCC cpp's + -Wunused-macros. Normally we don't worry about that warning, but + some users do, and we want to make it easy for users to remove + YYFAIL uses, which will produce warnings from Bison 2.5. */ +#endif + +#define YYRECOVERING() (!!yyerrstatus) + +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (1); \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ +while (YYID (0)) + + +#define YYTERROR 1 +#define YYERRCODE 256 + + +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ + +#define YYRHSLOC(Rhs, K) ((Rhs)[K]) +#ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (YYID (N)) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ + while (YYID (0)) +#endif + + +/* This macro is provided for backward compatibility. */ + +#ifndef YY_LOCATION_PRINT +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +#endif + + +/* YYLEX -- calling `yylex' with the right arguments. */ + +#ifdef YYLEX_PARAM +# define YYLEX yylex (YYLEX_PARAM) +#else +# define YYLEX yylex () +#endif + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (YYID (0)) + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (YYID (0)) + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else +static void +yy_symbol_value_print (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; +#endif +{ + if (!yyvaluep) + return; +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# else + YYUSE (yyoutput); +# endif + switch (yytype) + { + default: + break; + } +} + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else +static void +yy_symbol_print (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; +#endif +{ + if (yytype < YYNTOKENS) + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + + yy_symbol_value_print (yyoutput, yytype, yyvaluep); + YYFPRINTF (yyoutput, ")"); +} + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +#else +static void +yy_stack_print (yybottom, yytop) + yytype_int16 *yybottom; + yytype_int16 *yytop; +#endif +{ + YYFPRINTF (stderr, "Stack now"); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (YYID (0)) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_reduce_print (YYSTYPE *yyvsp, int yyrule) +#else +static void +yy_reduce_print (yyvsp, yyrule) + YYSTYPE *yyvsp; + int yyrule; +#endif +{ + int yynrhs = yyr2[yyrule]; + int yyi; + unsigned long int yylno = yyrline[yyrule]; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], + &(yyvsp[(yyi + 1) - (yynrhs)]) + ); + YYFPRINTF (stderr, "\n"); + } +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyvsp, Rule); \ +} while (YYID (0)) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !YYDEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH 10000 +#endif + + +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined __GLIBC__ && defined _STRING_H +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static YYSIZE_T +yystrlen (const char *yystr) +#else +static YYSIZE_T +yystrlen (yystr) + const char *yystr; +#endif +{ + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) + continue; + return yylen; +} +# endif +# endif + +# ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static char * +yystpcpy (char *yydest, const char *yysrc) +#else +static char * +yystpcpy (yydest, yysrc) + char *yydest; + const char *yysrc; +#endif +{ + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + YYSIZE_T yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message + about the unexpected token YYTOKEN for the state stack whose top is + YYSSP. + + Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is + not large enough to hold the message. In that case, also set + *YYMSG_ALLOC to the required number of bytes. Return 2 if the + required number of bytes is too large to store. */ +static int +yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, + yytype_int16 *yyssp, int yytoken) +{ + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + /* Internationalized format string. */ + const char *yyformat = 0; + /* Arguments of yyformat. */ + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + /* Number of reported tokens (one for the "unexpected", one per + "expected"). */ + int yycount = 0; + + /* There are many possibilities here to consider: + - Assume YYFAIL is not used. It's too flawed to consider. See + + for details. YYERROR is fine as it does not invoke this + function. + - If this state is a consistent state with a default action, then + the only way this function was invoked is if the default action + is an error action. In that case, don't check for expected + tokens because there are none. + - The only way there can be no lookahead present (in yychar) is if + this state is a consistent state with a default action. Thus, + detecting the absence of a lookahead is sufficient to determine + that there is no unexpected or expected token to report. In that + case, just report a simple "syntax error". + - Don't assume there isn't a lookahead just because this state is a + consistent state with a default action. There might have been a + previous inconsistent state, consistent state with a non-default + action, or user semantic action that manipulated yychar. + - Of course, the expected token list depends on states to have + correct lookahead information, and it depends on the parser not + to perform extra reductions after fetching a lookahead from the + scanner and before detecting a syntax error. Thus, state merging + (from LALR or IELR) and default reductions corrupt the expected + token list. However, the list is correct for canonical LR with + one exception: it will still contain any token that will not be + accepted due to an error action in a later state. + */ + if (yytoken != YYEMPTY) + { + int yyn = yypact[*yyssp]; + yyarg[yycount++] = yytname[yytoken]; + if (!yypact_value_is_default (yyn)) + { + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. In other words, skip the first -YYN actions for + this state because they are default actions. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yyx; + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR + && !yytable_value_is_error (yytable[yyx + yyn])) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + if (! (yysize <= yysize1 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + } + } + + switch (yycount) + { +# define YYCASE_(N, S) \ + case N: \ + yyformat = S; \ + break + YYCASE_(0, YY_("syntax error")); + YYCASE_(1, YY_("syntax error, unexpected %s")); + YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); + YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); + YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); + YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); +# undef YYCASE_ + } + + yysize1 = yysize + yystrlen (yyformat); + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + + if (*yymsg_alloc < yysize) + { + *yymsg_alloc = 2 * yysize; + if (! (yysize <= *yymsg_alloc + && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) + *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; + return 1; + } + + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + { + char *yyp = *yymsg; + int yyi = 0; + while ((*yyp = *yyformat) != '\0') + if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyformat += 2; + } + else + { + yyp++; + yyformat++; + } + } + return 0; +} +#endif /* YYERROR_VERBOSE */ + +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) +#else +static void +yydestruct (yymsg, yytype, yyvaluep) + const char *yymsg; + int yytype; + YYSTYPE *yyvaluep; +#endif +{ + YYUSE (yyvaluep); + + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + switch (yytype) + { + + default: + break; + } +} + + +/* Prevent warnings from -Wmissing-prototypes. */ +#ifdef YYPARSE_PARAM +#if defined __STDC__ || defined __cplusplus +int yyparse (void *YYPARSE_PARAM); +#else +int yyparse (); +#endif +#else /* ! YYPARSE_PARAM */ +#if defined __STDC__ || defined __cplusplus +int yyparse (void); +#else +int yyparse (); +#endif +#endif /* ! YYPARSE_PARAM */ + + +/* The lookahead symbol. */ +int yychar; + +/* The semantic value of the lookahead symbol. */ +YYSTYPE yylval; + +/* Number of syntax errors so far. */ +int yynerrs; + + +/*----------. +| yyparse. | +`----------*/ + +#ifdef YYPARSE_PARAM +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (void *YYPARSE_PARAM) +#else +int +yyparse (YYPARSE_PARAM) + void *YYPARSE_PARAM; +#endif +#else /* ! YYPARSE_PARAM */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (void) +#else +int +yyparse () + +#endif +#endif +{ + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + + /* The stacks and their tools: + `yyss': related to states. + `yyvs': related to semantic values. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; + + YYSIZE_T yystacksize; + + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken; + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; + + yytoken = 0; + yyss = yyssa; + yyvs = yyvsa; + yystacksize = YYINITDEPTH; + + YYDPRINTF ((stderr, "Starting parse\n")); + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + + /* Initialize stack pointers. + Waste one element of value and location stack + so that they stay on the same level as the state stack. + The wasted elements are never initialized. */ + yyssp = yyss; + yyvsp = yyvs; + + goto yysetstate; + +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. So pushing a state here evens the stacks. */ + yyssp++; + + yysetstate: + *yyssp = yystate; + + if (yyss + yystacksize - 1 <= yyssp) + { + /* Get the current used size of the three stacks, in elements. */ + YYSIZE_T yysize = yyssp - yyss + 1; + +#ifdef yyoverflow + { + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; + } +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyexhaustedlab; +# else + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + goto yyexhaustedlab; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif +#endif /* no yyoverflow */ + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; + + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + + if (yystate == YYFINAL) + YYACCEPT; + + goto yybackup; + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: + + /* Do appropriate processing given the current state. Read a + lookahead token if we need one and don't already have one. */ + + /* First try to decide what to do without reference to lookahead token. */ + yyn = yypact[yystate]; + if (yypact_value_is_default (yyn)) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = YYLEX; + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + goto yydefault; + yyn = yytable[yyn]; + if (yyn <= 0) + { + if (yytable_value_is_error (yyn)) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + /* Shift the lookahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token. */ + yychar = YYEMPTY; + + yystate = yyn; + *++yyvsp = yylval; + + goto yynewstate; + + +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ +yyreduce: + /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; + + /* If YYLEN is nonzero, implement the default value of the action: + `$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + + + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 3: + +/* Line 1806 of yacc.c */ +#line 51 "parser.y" + { + /* In case of error, discard entire line */ + yyerrok; + } + break; + + case 18: + +/* Line 1806 of yacc.c */ +#line 87 "parser.y" + { + log_debug(" Remove breakpoint at $%04X", (yyvsp[(2) - (3)].number)); + breakpoint_clr((yyvsp[(2) - (3)].number)); + } + break; + + case 19: + +/* Line 1806 of yacc.c */ +#line 93 "parser.y" + { + log_debug(" Remove breakpoint at PC"); + breakpoint_clr(cpu8051.pc); + } + break; + + case 20: + +/* Line 1806 of yacc.c */ +#line 99 "parser.y" + { + log_debug(" Remove all breakpoints"); + breakpoints_clr_all(); + } + break; + + case 21: + +/* Line 1806 of yacc.c */ +#line 107 "parser.y" + { + log_debug(" Set breakpoint at PC"); + breakpoint_set(cpu8051.pc); + } + break; + + case 22: + +/* Line 1806 of yacc.c */ +#line 114 "parser.y" + { + log_debug(" Set breakpoint at $%04X", (yyvsp[(2) - (3)].number)); + breakpoint_set((yyvsp[(2) - (3)].number)); + } + break; + + case 23: + +/* Line 1806 of yacc.c */ +#line 122 "parser.y" + { + log_debug(" Display breakpoints"); + breakpoints_show(); + } + break; + + case 24: + +/* Line 1806 of yacc.c */ +#line 130 "parser.y" + { + log_debug(" Dump External Data Memory at $%04X, len %d", (yyvsp[(2) - (4)].number), (yyvsp[(3) - (4)].number)); + mem_dump((yyvsp[(2) - (4)].number), (yyvsp[(3) - (4)].number), EXT_MEM_ID); + } + break; + + case 25: + +/* Line 1806 of yacc.c */ +#line 136 "parser.y" + { + log_debug(" Dump Internal Data Memory at $%04X, len %d", (yyvsp[(2) - (4)].number), (yyvsp[(3) - (4)].number)); + mem_dump((yyvsp[(2) - (4)].number), (yyvsp[(3) - (4)].number), INT_MEM_ID); + } + break; + + case 26: + +/* Line 1806 of yacc.c */ +#line 142 "parser.y" + { + log_debug(" Dump Program Memory at $%04X, len %d", (yyvsp[(2) - (4)].number), (yyvsp[(3) - (4)].number)); + mem_dump((yyvsp[(2) - (4)].number), (yyvsp[(3) - (4)].number), PGM_MEM_ID); + } + break; + + case 27: + +/* Line 1806 of yacc.c */ +#line 150 "parser.y" + { + log_debug(" Display Registers"); + console_show_registers(); + } + break; + + case 28: + +/* Line 1806 of yacc.c */ +#line 158 "parser.y" + { + log_debug(" Modify external memory"); + mem_write8(EXT_MEM_ID, (yyvsp[(2) - (4)].number), (yyvsp[(3) - (4)].number)); + } + break; + + case 29: + +/* Line 1806 of yacc.c */ +#line 164 "parser.y" + { + log_debug(" Modify internal memory"); + mem_write8(INT_MEM_ID, (yyvsp[(2) - (4)].number), (yyvsp[(3) - (4)].number)); + } + break; + + case 30: + +/* Line 1806 of yacc.c */ +#line 170 "parser.y" + { + log_debug(" Modify program memory"); + mem_write8(PGM_MEM_ID, (yyvsp[(2) - (4)].number), (yyvsp[(3) - (4)].number)); + } + break; + + case 31: + +/* Line 1806 of yacc.c */ +#line 176 "parser.y" + { + register_set((yyvsp[(2) - (4)].string), (yyvsp[(3) - (4)].number)); + } + break; + + case 32: + +/* Line 1806 of yacc.c */ +#line 183 "parser.y" + { + printf(" Quit"); + YYACCEPT; + } + break; + + case 33: + +/* Line 1806 of yacc.c */ +#line 191 "parser.y" + { + log_debug(" Run"); + console_exec(-1); + } + break; + + case 34: + +/* Line 1806 of yacc.c */ +#line 197 "parser.y" + { + log_debug(" Run %d instructions", (yyvsp[(2) - (3)].number)); + console_exec((yyvsp[(2) - (3)].number)); + } + break; + + case 35: + +/* Line 1806 of yacc.c */ +#line 205 "parser.y" + { + menu_display_usage(); + } + break; + + case 36: + +/* Line 1806 of yacc.c */ +#line 212 "parser.y" + { + cpu8051_reset(); + } + break; + + case 37: + +/* Line 1806 of yacc.c */ +#line 217 "parser.y" + { + gp_timer_reset(0); + } + break; + + case 38: + +/* Line 1806 of yacc.c */ +#line 222 "parser.y" + { + gp_timer_reset(1); + } + break; + + case 39: + +/* Line 1806 of yacc.c */ +#line 227 "parser.y" + { + gp_timer_reset(2); + } + break; + + case 40: + +/* Line 1806 of yacc.c */ +#line 232 "parser.y" + { + gp_timer_reset(3); + } + break; + + case 41: + +/* Line 1806 of yacc.c */ +#line 239 "parser.y" + { + console_trace(); + } + break; + + case 42: + +/* Line 1806 of yacc.c */ +#line 246 "parser.y" + { + disassemble_num((yyvsp[(2) - (4)].number), (yyvsp[(3) - (4)].number)); + } + break; + + case 43: + +/* Line 1806 of yacc.c */ +#line 251 "parser.y" + { + disassemble_num(cpu8051.pc, (yyvsp[(2) - (3)].number)); + } + break; + + case 44: + +/* Line 1806 of yacc.c */ +#line 257 "parser.y" + { + disassemble_num(cpu8051.pc, 16); + } + break; + + + +/* Line 1806 of yacc.c */ +#line 1773 "parser.c" + default: break; + } + /* User semantic actions sometimes alter yychar, and that requires + that yytoken be updated with the new translation. We take the + approach of translating immediately before every use of yytoken. + One alternative is translating here after every semantic action, + but that translation would be missed if the semantic action invokes + YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or + if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an + incorrect destructor might then be invoked immediately. In the + case of YYERROR or YYBACKUP, subsequent parser actions might lead + to an incorrect destructor call or verbose syntax error message + before the lookahead is translated. */ + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval; + + /* Now `shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTOKENS]; + + goto yynewstate; + + +/*------------------------------------. +| yyerrlab -- here on detecting error | +`------------------------------------*/ +yyerrlab: + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); + + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; +#if ! YYERROR_VERBOSE + yyerror (YY_("syntax error")); +#else +# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ + yyssp, yytoken) + { + char const *yymsgp = YY_("syntax error"); + int yysyntax_error_status; + yysyntax_error_status = YYSYNTAX_ERROR; + if (yysyntax_error_status == 0) + yymsgp = yymsg; + else if (yysyntax_error_status == 1) + { + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); + if (!yymsg) + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + yysyntax_error_status = 2; + } + else + { + yysyntax_error_status = YYSYNTAX_ERROR; + yymsgp = yymsg; + } + } + yyerror (yymsgp); + if (yysyntax_error_status == 2) + goto yyexhaustedlab; + } +# undef YYSYNTAX_ERROR +#endif + } + + + + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + if (yychar <= YYEOF) + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } + else + { + yydestruct ("Error: discarding", + yytoken, &yylval); + yychar = YYEMPTY; + } + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; + + +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (/*CONSTCOND*/ 0) + goto yyerrorlab; + + /* Do not reclaim the symbols of the rule which action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + yystate = *yyssp; + goto yyerrlab1; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + yyn = yypact[yystate]; + if (!yypact_value_is_default (yyn)) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; + + + yydestruct ("Error: popping", + yystos[yystate], yyvsp); + YYPOPSTACK (1); + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); + } + + *++yyvsp = yylval; + + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + + yystate = yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +#if !defined(yyoverflow) || YYERROR_VERBOSE +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (YY_("memory exhausted")); + yyresult = 2; + /* Fall through. */ +#endif + +yyreturn: + if (yychar != YYEMPTY) + { + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = YYTRANSLATE (yychar); + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval); + } + /* Do not reclaim the symbols of the rule which action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp); + YYPOPSTACK (1); + } +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + /* Make sure YYID is used. */ + return YYID (yyresult); +} + + + diff -Nru emu8051-1.1.1/src/cli/parser.h emu8051-2.0.1/src/cli/parser.h --- emu8051-1.1.1/src/cli/parser.h 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/cli/parser.h 2014-03-22 18:26:22.000000000 +0000 @@ -0,0 +1,121 @@ +/* A Bison parser, made by GNU Bison 2.5. */ + +/* Bison interface for Yacc-like parsers in C + + Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + NUMBER = 258, + WORD = 259, + TOK_ENTER = 260, + TOK_ALL = 261, + TOK_SB = 262, + TOK_RB = 263, + TOK_DB = 264, + TOK_DE = 265, + TOK_DI = 266, + TOK_DP = 267, + TOK_DR = 268, + TOK_HELP = 269, + TOK_RUN = 270, + TOK_RST = 271, + TOK_RST_TIMER = 272, + TOK_STEP = 273, + TOK_UNASM = 274, + TOK_MOD_EXT = 275, + TOK_MOD_INT = 276, + TOK_MOD_PROG = 277, + TOK_MOD_REG = 278, + TOK_QUIT = 279, + TOK_A = 280, + TOK_B = 281, + TOK_C = 282, + TOK_D = 283 + }; +#endif +/* Tokens. */ +#define NUMBER 258 +#define WORD 259 +#define TOK_ENTER 260 +#define TOK_ALL 261 +#define TOK_SB 262 +#define TOK_RB 263 +#define TOK_DB 264 +#define TOK_DE 265 +#define TOK_DI 266 +#define TOK_DP 267 +#define TOK_DR 268 +#define TOK_HELP 269 +#define TOK_RUN 270 +#define TOK_RST 271 +#define TOK_RST_TIMER 272 +#define TOK_STEP 273 +#define TOK_UNASM 274 +#define TOK_MOD_EXT 275 +#define TOK_MOD_INT 276 +#define TOK_MOD_PROG 277 +#define TOK_MOD_REG 278 +#define TOK_QUIT 279 +#define TOK_A 280 +#define TOK_B 281 +#define TOK_C 282 +#define TOK_D 283 + + + + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE +{ + +/* Line 2068 of yacc.c */ +#line 29 "parser.y" + + int number; + char *string; + + + +/* Line 2068 of yacc.c */ +#line 113 "parser.h" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +#endif + +extern YYSTYPE yylval; + + diff -Nru emu8051-1.1.1/src/cli/parser.y emu8051-2.0.1/src/cli/parser.y --- emu8051-1.1.1/src/cli/parser.y 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/cli/parser.y 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,262 @@ +%{ +#include +#include +#include +#include + +#include "config.h" +#include "log.h" +#include "menu.h" +#include "memory.h" +#include "timers.h" +#include "memory.h" +#include "cpu8051.h" + +/* int yydebug = 1; */ + +/* To get rid of compiler warning. */ +int yylex(); + +int yyerror(const char *str) +{ + fprintf(stderr,"error: %s\n", str); + return 0; +} + +%} + +%union +{ + int number; + char *string; +} + +%token NUMBER +%token WORD +%token TOK_ENTER TOK_ALL +%token TOK_SB TOK_RB TOK_DB +%token TOK_DE TOK_DI TOK_DP TOK_DR +%token TOK_HELP +%token TOK_RUN +%token TOK_RST TOK_RST_TIMER +%token TOK_STEP +%token TOK_UNASM +%token TOK_MOD_EXT TOK_MOD_INT TOK_MOD_PROG TOK_MOD_REG +%token TOK_QUIT +%token TOK_A TOK_B TOK_C TOK_D + +%% + +start : start command + | error TOK_ENTER { + /* In case of error, discard entire line */ + yyerrok; + } + | start TOK_ENTER + | + ; + +command: + breakpoint_clr + | + breakpoint_set + | + breakpoint_display + | + dump_mem + | + display_regs + | + help + | + modify + | + quit + | + reset + | + run + | + step + | + unasm + ; + +breakpoint_clr: + TOK_RB NUMBER TOK_ENTER + { + log_debug(" Remove breakpoint at $%04X", $2); + breakpoint_clr($2); + } + | + TOK_RB TOK_ENTER + { + log_debug(" Remove breakpoint at PC"); + breakpoint_clr(cpu8051.pc); + } + | + TOK_RB TOK_ALL TOK_ENTER + { + log_debug(" Remove all breakpoints"); + breakpoints_clr_all(); + } + ; + +breakpoint_set: + TOK_SB TOK_ENTER + { + log_debug(" Set breakpoint at PC"); + breakpoint_set(cpu8051.pc); + } + | + + TOK_SB NUMBER TOK_ENTER + { + log_debug(" Set breakpoint at $%04X", $2); + breakpoint_set($2); + } + ; + +breakpoint_display: + TOK_DB TOK_ENTER + { + log_debug(" Display breakpoints"); + breakpoints_show(); + } + ; + +dump_mem: + TOK_DE NUMBER NUMBER TOK_ENTER + { + log_debug(" Dump External Data Memory at $%04X, len %d", $2, $3); + mem_dump($2, $3, EXT_MEM_ID); + } + | + TOK_DI NUMBER NUMBER TOK_ENTER + { + log_debug(" Dump Internal Data Memory at $%04X, len %d", $2, $3); + mem_dump($2, $3, INT_MEM_ID); + } + | + TOK_DP NUMBER NUMBER TOK_ENTER + { + log_debug(" Dump Program Memory at $%04X, len %d", $2, $3); + mem_dump($2, $3, PGM_MEM_ID); + } + ; + +display_regs: + TOK_DR TOK_ENTER + { + log_debug(" Display Registers"); + console_show_registers(); + } + ; + +modify: + TOK_MOD_EXT NUMBER NUMBER TOK_ENTER + { + log_debug(" Modify external memory"); + mem_write8(EXT_MEM_ID, $2, $3); + } + | + TOK_MOD_INT NUMBER NUMBER TOK_ENTER + { + log_debug(" Modify internal memory"); + mem_write8(INT_MEM_ID, $2, $3); + } + | + TOK_MOD_PROG NUMBER NUMBER TOK_ENTER + { + log_debug(" Modify program memory"); + mem_write8(PGM_MEM_ID, $2, $3); + } + | + TOK_MOD_REG WORD NUMBER TOK_ENTER + { + register_set($2, $3); + } + ; + +quit: + TOK_QUIT TOK_ENTER + { + printf(" Quit"); + YYACCEPT; + } + ; + +run: + TOK_RUN TOK_ENTER + { + log_debug(" Run"); + console_exec(-1); + } + | + TOK_RUN NUMBER TOK_ENTER + { + log_debug(" Run %d instructions", $2); + console_exec($2); + } + ; + +help: + TOK_HELP TOK_ENTER + { + menu_display_usage(); + } + ; + +reset: + TOK_RST TOK_ENTER + { + cpu8051_reset(); + } + | + TOK_RST_TIMER TOK_A TOK_ENTER + { + gp_timer_reset(0); + } + | + TOK_RST_TIMER TOK_B TOK_ENTER + { + gp_timer_reset(1); + } + | + TOK_RST_TIMER TOK_C TOK_ENTER + { + gp_timer_reset(2); + } + | + TOK_RST_TIMER TOK_D TOK_ENTER + { + gp_timer_reset(3); + } + ; + +step: + TOK_STEP TOK_ENTER + { + console_trace(); + } + ; + +unasm: + TOK_UNASM NUMBER NUMBER TOK_ENTER + { + disassemble_num($2, $3); + } + | + TOK_UNASM NUMBER TOK_ENTER + { + disassemble_num(cpu8051.pc, $2); + } + ; + | + TOK_UNASM TOK_ENTER + { + disassemble_num(cpu8051.pc, 16); + } + ; + + diff -Nru emu8051-1.1.1/src/cli/scanner.c emu8051-2.0.1/src/cli/scanner.c --- emu8051-1.1.1/src/cli/scanner.c 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/cli/scanner.c 2014-03-22 18:26:22.000000000 +0000 @@ -0,0 +1,1957 @@ + +#line 3 "scanner.c" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 35 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include +#include +#include +#include + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have . Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! C99 */ + +#endif /* ! FLEXINT_H */ + +#ifdef __cplusplus + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) + +#define YY_USE_CONST + +#endif /* defined (__STDC__) */ +#endif /* ! __cplusplus */ + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN (yy_start) = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START (((yy_start) - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE yyrestart(yyin ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else +#define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ +#endif + +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +extern int yyleng; + +extern FILE *yyin, *yyout; + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + + #define YY_LESS_LINENO(n) + +/* Return all but the first "n" matched characters back to the input stream. */ +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = (yy_hold_char); \ + YY_RESTORE_YY_MORE_OFFSET \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, (yytext_ptr) ) + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* Stack of input buffers. */ +static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ +static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ +static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + * + * Returns the top of the stack, or NULL. + */ +#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ + ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ + : NULL) + +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] + +/* yy_hold_char holds the character lost when yytext is formed. */ +static char yy_hold_char; +static int yy_n_chars; /* number of characters read into yy_ch_buf */ +int yyleng; + +/* Points to current character in buffer. */ +static char *yy_c_buf_p = (char *) 0; +static int yy_init = 0; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ + +/* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... + */ +static int yy_did_buffer_switch_on_eof; + +void yyrestart (FILE *input_file ); +void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); +void yy_delete_buffer (YY_BUFFER_STATE b ); +void yy_flush_buffer (YY_BUFFER_STATE b ); +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); +void yypop_buffer_state (void ); + +static void yyensure_buffer_stack (void ); +static void yy_load_buffer_state (void ); +static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); + +#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) + +YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); +YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); +YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); + +void *yyalloc (yy_size_t ); +void *yyrealloc (void *,yy_size_t ); +void yyfree (void * ); + +#define yy_new_buffer yy_create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer(yyin,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer(yyin,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* Begin user sect3 */ + +#define yywrap(n) 1 +#define YY_SKIP_YYWRAP + +typedef unsigned char YY_CHAR; + +FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; + +typedef int yy_state_type; + +extern int yylineno; + +int yylineno = 1; + +extern char *yytext; +#define yytext_ptr yytext + +static yy_state_type yy_get_previous_state (void ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); +static int yy_get_next_buffer (void ); +static void yy_fatal_error (yyconst char msg[] ); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + (yytext_ptr) = yy_bp; \ + yyleng = (size_t) (yy_cp - yy_bp); \ + (yy_hold_char) = *yy_cp; \ + *yy_cp = '\0'; \ + (yy_c_buf_p) = yy_cp; + +#define YY_NUM_RULES 31 +#define YY_END_OF_BUFFER 32 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_accept[67] = + { 0, + 0, 0, 32, 30, 29, 28, 30, 3, 3, 4, + 23, 24, 25, 26, 27, 4, 13, 12, 14, 15, + 27, 20, 29, 2, 3, 0, 27, 27, 27, 7, + 8, 9, 10, 11, 6, 5, 16, 17, 18, 19, + 21, 2, 1, 1, 22, 2, 1, 1, 2, 1, + 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, + 2, 1, 1, 1, 1, 0 + } ; + +static yyconst flex_int32_t yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 1, 1, 1, 4, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 5, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 1, 1, 1, + 1, 1, 7, 1, 8, 8, 8, 8, 8, 8, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 9, 1, 1, + 1, 1, 1, 1, 1, 1, 10, 11, 12, 13, + + 14, 15, 16, 17, 18, 16, 16, 19, 16, 16, + 16, 20, 21, 22, 23, 24, 25, 16, 26, 27, + 16, 28, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static yyconst flex_int32_t yy_meta[29] = + { 0, + 1, 1, 1, 1, 2, 2, 1, 3, 4, 2, + 2, 2, 2, 2, 2, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4 + } ; + +static yyconst flex_int16_t yy_base[84] = + { 0, + 0, 0, 104, 203, 93, 203, 0, 24, 26, 203, + 25, 84, 73, 43, 69, 67, 65, 27, 28, 64, + 57, 31, 70, 0, 36, 0, 61, 75, 34, 60, + 59, 58, 55, 53, 51, 50, 49, 47, 41, 40, + 39, 0, 0, 86, 38, 0, 0, 97, 0, 0, + 108, 0, 0, 119, 0, 0, 130, 0, 0, 141, + 203, 0, 152, 203, 37, 203, 166, 168, 171, 173, + 175, 177, 179, 181, 183, 185, 187, 189, 191, 193, + 195, 197, 199 + } ; + +static yyconst flex_int16_t yy_def[84] = + { 0, + 66, 1, 66, 66, 66, 66, 67, 68, 68, 66, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 66, 69, 68, 70, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 71, 72, 28, 68, 73, 74, 28, 75, 76, + 28, 77, 78, 28, 79, 80, 28, 81, 82, 28, + 66, 83, 28, 66, 68, 0, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66 + } ; + +static yyconst flex_int16_t yy_nxt[232] = + { 0, + 4, 5, 6, 7, 8, 9, 10, 4, 4, 11, + 12, 13, 14, 15, 15, 15, 16, 15, 15, 15, + 17, 18, 19, 15, 20, 21, 15, 22, 25, 25, + 25, 25, 26, 66, 66, 66, 66, 35, 36, 66, + 25, 25, 66, 29, 66, 66, 66, 66, 66, 66, + 28, 66, 45, 30, 41, 66, 31, 66, 66, 66, + 32, 66, 33, 66, 34, 66, 66, 66, 66, 66, + 37, 23, 66, 66, 38, 66, 39, 66, 40, 44, + 44, 66, 43, 66, 44, 44, 44, 44, 44, 44, + 48, 48, 66, 47, 23, 48, 48, 48, 48, 48, + + 48, 51, 51, 66, 50, 66, 51, 51, 51, 51, + 51, 51, 54, 54, 66, 53, 66, 54, 54, 54, + 54, 54, 54, 57, 57, 66, 56, 66, 57, 57, + 57, 57, 57, 57, 60, 60, 66, 59, 66, 60, + 60, 60, 60, 60, 60, 63, 63, 66, 62, 66, + 63, 63, 63, 63, 63, 63, 65, 65, 66, 64, + 66, 65, 65, 65, 65, 65, 65, 24, 24, 27, + 66, 27, 42, 42, 43, 43, 46, 46, 47, 47, + 49, 49, 50, 50, 52, 52, 53, 53, 55, 55, + 56, 56, 58, 58, 59, 59, 61, 61, 62, 62, + + 64, 64, 3, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66 + } ; + +static yyconst flex_int16_t yy_chk[232] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, + 9, 9, 8, 11, 9, 18, 19, 18, 19, 22, + 25, 25, 29, 11, 25, 65, 45, 41, 40, 39, + 8, 14, 29, 14, 22, 38, 14, 37, 36, 35, + 14, 34, 14, 33, 14, 21, 32, 31, 30, 27, + 21, 23, 20, 17, 21, 16, 21, 15, 21, 28, + 28, 13, 28, 28, 28, 28, 28, 28, 28, 28, + 44, 44, 12, 44, 5, 44, 44, 44, 44, 44, + + 44, 48, 48, 3, 48, 0, 48, 48, 48, 48, + 48, 48, 51, 51, 0, 51, 0, 51, 51, 51, + 51, 51, 51, 54, 54, 0, 54, 0, 54, 54, + 54, 54, 54, 54, 57, 57, 0, 57, 0, 57, + 57, 57, 57, 57, 57, 60, 60, 0, 60, 0, + 60, 60, 60, 60, 60, 60, 63, 63, 0, 63, + 0, 63, 63, 63, 63, 63, 63, 67, 67, 68, + 0, 68, 69, 69, 70, 70, 71, 71, 72, 72, + 73, 73, 74, 74, 75, 75, 76, 76, 77, 77, + 78, 78, 79, 79, 80, 80, 81, 81, 82, 82, + + 83, 83, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66 + } ; + +static yy_state_type yy_last_accepting_state; +static char *yy_last_accepting_cpos; + +extern int yy_flex_debug; +int yy_flex_debug = 0; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET +char *yytext; +#line 1 "scanner.l" +#define YY_NO_INPUT 1 +#line 5 "scanner.l" + #include "menu.h" + #include "parser.h" + #include "hexfile.h" + +#undef YY_INPUT +#define YY_INPUT(buf,result,max_size) result = menu_get_input(buf, max_size); + +#line 544 "scanner.c" + +#define INITIAL 0 + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +static int yy_init_globals (void ); + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int yylex_destroy (void ); + +int yyget_debug (void ); + +void yyset_debug (int debug_flag ); + +YY_EXTRA_TYPE yyget_extra (void ); + +void yyset_extra (YY_EXTRA_TYPE user_defined ); + +FILE *yyget_in (void ); + +void yyset_in (FILE * in_str ); + +FILE *yyget_out (void ); + +void yyset_out (FILE * out_str ); + +int yyget_leng (void ); + +char *yyget_text (void ); + +int yyget_lineno (void ); + +void yyset_lineno (int line_number ); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int yywrap (void ); +#else +extern int yywrap (void ); +#endif +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy (char *,yyconst char *,int ); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * ); +#endif + +#ifndef YY_NO_INPUT + +#ifdef __cplusplus +static int yyinput (void ); +#else +static int input (void ); +#endif + +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else +#define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ +#endif + +/* Copy whatever the last rule matched to the standard output. */ +#ifndef ECHO +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + size_t n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } \ + }\ +\ + +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) +#endif + +/* end tables serialization structures and prototypes */ + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int yylex (void); + +#define YY_DECL int yylex (void) +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +#define YY_RULE_SETUP \ + YY_USER_ACTION + +/** The main scanner function which does all the work. + */ +YY_DECL +{ + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + +#line 21 "scanner.l" + +#line 731 "scanner.c" + + if ( !(yy_init) ) + { + (yy_init) = 1; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! (yy_start) ) + (yy_start) = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! YY_CURRENT_BUFFER ) { + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer(yyin,YY_BUF_SIZE ); + } + + yy_load_buffer_state( ); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = (yy_c_buf_p); + + /* Support of yytext. */ + *yy_cp = (yy_hold_char); + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = (yy_start); +yy_match: + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 67 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 203 ); + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + yy_act = yy_accept[yy_current_state]; + } + + YY_DO_BEFORE_ACTION; + +do_action: /* This label is used only to access EOF actions. */ + + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = (yy_hold_char); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + goto yy_find_action; + +case 1: +YY_RULE_SETUP +#line 22 "scanner.l" +{ + /* + * No need to check return value of asciihex2int, because lex + * always passes a valid ASCII hex string. + */ + yylval.number = asciihex2int(&yytext[2]); /* Skip "0x" prefix */ + return NUMBER; + } + YY_BREAK +case 2: +YY_RULE_SETUP +#line 30 "scanner.l" +{ + /* + * No need to check return value of asciihex2int, because lex + * always passes a valid ASCII hex string. + */ + yylval.number = asciihex2int(&yytext[1]); /* Skip "$" prefix */ + return NUMBER; + } + YY_BREAK +case 3: +YY_RULE_SETUP +#line 40 "scanner.l" +{ yylval.number = atoi(yytext); return NUMBER; } + YY_BREAK +case 4: +YY_RULE_SETUP +#line 41 "scanner.l" +return TOK_HELP; + YY_BREAK +case 5: +YY_RULE_SETUP +#line 42 "scanner.l" +return TOK_SB; + YY_BREAK +case 6: +YY_RULE_SETUP +#line 43 "scanner.l" +return TOK_RB; + YY_BREAK +case 7: +YY_RULE_SETUP +#line 44 "scanner.l" +return TOK_DB; + YY_BREAK +case 8: +YY_RULE_SETUP +#line 45 "scanner.l" +return TOK_DE; + YY_BREAK +case 9: +YY_RULE_SETUP +#line 46 "scanner.l" +return TOK_DI; + YY_BREAK +case 10: +YY_RULE_SETUP +#line 47 "scanner.l" +return TOK_DP; + YY_BREAK +case 11: +YY_RULE_SETUP +#line 48 "scanner.l" +return TOK_DR; + YY_BREAK +case 12: +YY_RULE_SETUP +#line 49 "scanner.l" +return TOK_RUN; + YY_BREAK +case 13: +YY_RULE_SETUP +#line 50 "scanner.l" +return TOK_QUIT; + YY_BREAK +case 14: +YY_RULE_SETUP +#line 51 "scanner.l" +return TOK_STEP; + YY_BREAK +case 15: +YY_RULE_SETUP +#line 52 "scanner.l" +return TOK_UNASM; + YY_BREAK +case 16: +YY_RULE_SETUP +#line 53 "scanner.l" +return TOK_MOD_EXT; + YY_BREAK +case 17: +YY_RULE_SETUP +#line 54 "scanner.l" +return TOK_MOD_INT; + YY_BREAK +case 18: +YY_RULE_SETUP +#line 55 "scanner.l" +return TOK_MOD_PROG; + YY_BREAK +case 19: +YY_RULE_SETUP +#line 56 "scanner.l" +return TOK_MOD_REG; + YY_BREAK +case 20: +YY_RULE_SETUP +#line 57 "scanner.l" +return TOK_RST; + YY_BREAK +case 21: +YY_RULE_SETUP +#line 58 "scanner.l" +return TOK_RST_TIMER; + YY_BREAK +case 22: +YY_RULE_SETUP +#line 59 "scanner.l" +return TOK_ALL; + YY_BREAK +case 23: +YY_RULE_SETUP +#line 60 "scanner.l" +return TOK_A; + YY_BREAK +case 24: +YY_RULE_SETUP +#line 61 "scanner.l" +return TOK_B; + YY_BREAK +case 25: +YY_RULE_SETUP +#line 62 "scanner.l" +return TOK_C; + YY_BREAK +case 26: +YY_RULE_SETUP +#line 63 "scanner.l" +return TOK_D; + YY_BREAK +case 27: +YY_RULE_SETUP +#line 64 "scanner.l" +{ yylval.string = strdup(yytext); return WORD; } + YY_BREAK +case 28: +/* rule 28 can match eol */ +YY_RULE_SETUP +#line 65 "scanner.l" +return TOK_ENTER; + YY_BREAK +case 29: +YY_RULE_SETUP +#line 66 "scanner.l" +{ /* ignore whitespace */ } + YY_BREAK +case 30: +YY_RULE_SETUP +#line 67 "scanner.l" +{ return yytext[0]; } + YY_BREAK +case 31: +YY_RULE_SETUP +#line 68 "scanner.l" +ECHO; + YY_BREAK +#line 984 "scanner.c" +case YY_STATE_EOF(INITIAL): + yyterminate(); + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = (yy_hold_char); + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++(yy_c_buf_p); + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = (yy_c_buf_p); + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_END_OF_FILE: + { + (yy_did_buffer_switch_on_eof) = 0; + + if ( yywrap( ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = + (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + (yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ +} /* end of yylex */ + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ +static int yy_get_next_buffer (void) +{ + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = (yytext_ptr); + register int number_to_move, i; + int ret_val; + + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; + + else + { + int num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + + int yy_c_buf_p_offset = + (int) ((yy_c_buf_p) - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), (size_t) num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + if ( (yy_n_chars) == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart(yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + } + + (yy_n_chars) += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; + + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + + static yy_state_type yy_get_previous_state (void) +{ + register yy_state_type yy_current_state; + register char *yy_cp; + + yy_current_state = (yy_start); + + for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 67 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + } + + return yy_current_state; +} + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) +{ + register int yy_is_jam; + register char *yy_cp = (yy_c_buf_p); + + register YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 67 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 66); + + return yy_is_jam ? 0 : yy_current_state; +} + +#ifndef YY_NO_INPUT +#ifdef __cplusplus + static int yyinput (void) +#else + static int input (void) +#endif + +{ + int c; + + *(yy_c_buf_p) = (yy_hold_char); + + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + /* This was really a NUL. */ + *(yy_c_buf_p) = '\0'; + + else + { /* need more input */ + int offset = (yy_c_buf_p) - (yytext_ptr); + ++(yy_c_buf_p); + + switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + yyrestart(yyin ); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( yywrap( ) ) + return EOF; + + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(); +#else + return input(); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = (yytext_ptr) + offset; + break; + } + } + } + + c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ + *(yy_c_buf_p) = '\0'; /* preserve yytext */ + (yy_hold_char) = *++(yy_c_buf_p); + + return c; +} +#endif /* ifndef YY_NO_INPUT */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * + * @note This function does not reset the start condition to @c INITIAL . + */ + void yyrestart (FILE * input_file ) +{ + + if ( ! YY_CURRENT_BUFFER ){ + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer(yyin,YY_BUF_SIZE ); + } + + yy_init_buffer(YY_CURRENT_BUFFER,input_file ); + yy_load_buffer_state( ); +} + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * + */ + void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) +{ + + /* TODO. We should be able to replace this entire function body + * with + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); + */ + yyensure_buffer_stack (); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + yy_load_buffer_state( ); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + (yy_did_buffer_switch_on_eof) = 1; +} + +static void yy_load_buffer_state (void) +{ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + (yy_hold_char) = *(yy_c_buf_p); +} + +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * + * @return the allocated buffer state. + */ + YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_init_buffer(b,file ); + + return b; +} + +/** Destroy the buffer. + * @param b a buffer created with yy_create_buffer() + * + */ + void yy_delete_buffer (YY_BUFFER_STATE b ) +{ + + if ( ! b ) + return; + + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yyfree((void *) b->yy_ch_buf ); + + yyfree((void *) b ); +} + +#ifndef _UNISTD_H /* assume unistd.h has isatty() for us */ +#ifdef __cplusplus +extern "C" { +#endif +#ifdef __THROW /* this is a gnuism */ +extern int isatty (int ) __THROW; +#else +extern int isatty (int ); +#endif +#ifdef __cplusplus +} +#endif +#endif + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a yyrestart() or at EOF. + */ + static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) + +{ + int oerrno = errno; + + yy_flush_buffer(b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then yy_init_buffer was _probably_ + * called from yyrestart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; + + errno = oerrno; +} + +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * + */ + void yy_flush_buffer (YY_BUFFER_STATE b ) +{ + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == YY_CURRENT_BUFFER ) + yy_load_buffer_state( ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * + */ +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) +{ + if (new_buffer == NULL) + return; + + yyensure_buffer_stack(); + + /* This block is copied from yy_switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from yy_switch_to_buffer. */ + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * + */ +void yypop_buffer_state (void) +{ + if (!YY_CURRENT_BUFFER) + return; + + yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); + + if (YY_CURRENT_BUFFER) { + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; + } +} + +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void yyensure_buffer_stack (void) +{ + int num_to_alloc; + + if (!(yy_buffer_stack)) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; + (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; + } + + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc + ((yy_buffer_stack), + num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); + (yy_buffer_stack_max) = num_to_alloc; + } +} + +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) +{ + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + yy_switch_to_buffer(b ); + + return b; +} + +/** Setup the input buffer state to scan a string. The next call to yylex() will + * scan from a @e copy of @a str. + * @param yystr a NUL-terminated string to scan + * + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * yy_scan_bytes() instead. + */ +YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) +{ + + return yy_scan_bytes(yystr,strlen(yystr) ); +} + +/** Setup the input buffer state to scan the given bytes. The next call to yylex() will + * scan from a @e copy of @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) +{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = _yybytes_len + 2; + buf = (char *) yyalloc(n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; + + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer(buf,n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; +} + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +static void yy_fatal_error (yyconst char* msg ) +{ + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); +} + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + yytext[yyleng] = (yy_hold_char); \ + (yy_c_buf_p) = yytext + yyless_macro_arg; \ + (yy_hold_char) = *(yy_c_buf_p); \ + *(yy_c_buf_p) = '\0'; \ + yyleng = yyless_macro_arg; \ + } \ + while ( 0 ) + +/* Accessor methods (get/set functions) to struct members. */ + +/** Get the current line number. + * + */ +int yyget_lineno (void) +{ + + return yylineno; +} + +/** Get the input stream. + * + */ +FILE *yyget_in (void) +{ + return yyin; +} + +/** Get the output stream. + * + */ +FILE *yyget_out (void) +{ + return yyout; +} + +/** Get the length of the current token. + * + */ +int yyget_leng (void) +{ + return yyleng; +} + +/** Get the current token. + * + */ + +char *yyget_text (void) +{ + return yytext; +} + +/** Set the current line number. + * @param line_number + * + */ +void yyset_lineno (int line_number ) +{ + + yylineno = line_number; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param in_str A readable stream. + * + * @see yy_switch_to_buffer + */ +void yyset_in (FILE * in_str ) +{ + yyin = in_str ; +} + +void yyset_out (FILE * out_str ) +{ + yyout = out_str ; +} + +int yyget_debug (void) +{ + return yy_flex_debug; +} + +void yyset_debug (int bdebug ) +{ + yy_flex_debug = bdebug ; +} + +static int yy_init_globals (void) +{ + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from yylex_destroy(), so don't allocate here. + */ + + (yy_buffer_stack) = 0; + (yy_buffer_stack_top) = 0; + (yy_buffer_stack_max) = 0; + (yy_c_buf_p) = (char *) 0; + (yy_init) = 0; + (yy_start) = 0; + +/* Defined in main.c */ +#ifdef YY_STDINIT + yyin = stdin; + yyout = stdout; +#else + yyin = (FILE *) 0; + yyout = (FILE *) 0; +#endif + + /* For future reference: Set errno on error, since we are called by + * yylex_init() + */ + return 0; +} + +/* yylex_destroy is for both reentrant and non-reentrant scanners. */ +int yylex_destroy (void) +{ + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + yypop_buffer_state(); + } + + /* Destroy the stack itself. */ + yyfree((yy_buffer_stack) ); + (yy_buffer_stack) = NULL; + + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * yylex() is called, initialization will occur. */ + yy_init_globals( ); + + return 0; +} + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) +{ + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * s ) +{ + register int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +void *yyalloc (yy_size_t size ) +{ + return (void *) malloc( size ); +} + +void *yyrealloc (void * ptr, yy_size_t size ) +{ + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); +} + +void yyfree (void * ptr ) +{ + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ +} + +#define YYTABLES_NAME "yytables" + +#line 68 "scanner.l" + + + diff -Nru emu8051-1.1.1/src/cli/scanner.h emu8051-2.0.1/src/cli/scanner.h --- emu8051-1.1.1/src/cli/scanner.h 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/cli/scanner.h 2014-03-22 18:26:22.000000000 +0000 @@ -0,0 +1,333 @@ +#ifndef yyHEADER_H +#define yyHEADER_H 1 +#define yyIN_HEADER 1 + +#line 6 "scanner.h" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 35 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include +#include +#include +#include + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have . Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! C99 */ + +#endif /* ! FLEXINT_H */ + +#ifdef __cplusplus + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) + +#define YY_USE_CONST + +#endif /* defined (__STDC__) */ +#endif /* ! __cplusplus */ + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else +#define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ +#endif + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +extern int yyleng; + +extern FILE *yyin, *yyout; + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +void yyrestart (FILE *input_file ); +void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); +void yy_delete_buffer (YY_BUFFER_STATE b ); +void yy_flush_buffer (YY_BUFFER_STATE b ); +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); +void yypop_buffer_state (void ); + +YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); +YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); +YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); + +void *yyalloc (yy_size_t ); +void *yyrealloc (void *,yy_size_t ); +void yyfree (void * ); + +/* Begin user sect3 */ + +#define yywrap(n) 1 +#define YY_SKIP_YYWRAP + +extern int yylineno; + +extern char *yytext; +#define yytext_ptr yytext + +#ifdef YY_HEADER_EXPORT_START_CONDITIONS +#define INITIAL 0 + +#endif + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int yylex_destroy (void ); + +int yyget_debug (void ); + +void yyset_debug (int debug_flag ); + +YY_EXTRA_TYPE yyget_extra (void ); + +void yyset_extra (YY_EXTRA_TYPE user_defined ); + +FILE *yyget_in (void ); + +void yyset_in (FILE * in_str ); + +FILE *yyget_out (void ); + +void yyset_out (FILE * out_str ); + +int yyget_leng (void ); + +char *yyget_text (void ); + +int yyget_lineno (void ); + +void yyset_lineno (int line_number ); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int yywrap (void ); +#else +extern int yywrap (void ); +#endif +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy (char *,yyconst char *,int ); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * ); +#endif + +#ifndef YY_NO_INPUT + +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else +#define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int yylex (void); + +#define YY_DECL int yylex (void) +#endif /* !YY_DECL */ + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + +#undef YY_NEW_FILE +#undef YY_FLUSH_BUFFER +#undef yy_set_bol +#undef yy_new_buffer +#undef yy_set_interactive +#undef YY_DO_BEFORE_ACTION + +#ifdef YY_DECL_IS_OURS +#undef YY_DECL_IS_OURS +#undef YY_DECL +#endif + +#line 68 "scanner.l" + + +#line 332 "scanner.h" +#undef yyIN_HEADER +#endif /* yyHEADER_H */ diff -Nru emu8051-1.1.1/src/cli/scanner.l emu8051-2.0.1/src/cli/scanner.l --- emu8051-1.1.1/src/cli/scanner.l 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/cli/scanner.l 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,68 @@ +%option noyywrap +%option noinput +%option nounput +%{ + #include "menu.h" + #include "parser.h" + #include "hexfile.h" + +#undef YY_INPUT +#define YY_INPUT(buf,result,max_size) result = menu_get_input(buf, max_size); + +%} + +digit [0-9] +alpha [a-fA-F] +hextail ({digit}|{alpha}){1,8} +hex1 0[xX]{hextail} +hex2 ${hextail} + + +%% +{hex1} { + /* + * No need to check return value of asciihex2int, because lex + * always passes a valid ASCII hex string. + */ + yylval.number = asciihex2int(&yytext[2]); /* Skip "0x" prefix */ + return NUMBER; + } +{hex2} { + /* + * No need to check return value of asciihex2int, because lex + * always passes a valid ASCII hex string. + */ + yylval.number = asciihex2int(&yytext[1]); /* Skip "$" prefix */ + return NUMBER; + } + + +[0-9]+ { yylval.number = atoi(yytext); return NUMBER; } +[h?] return TOK_HELP; +sb return TOK_SB; +rb return TOK_RB; +db return TOK_DB; +de return TOK_DE; +di return TOK_DI; +dp return TOK_DP; +dr return TOK_DR; +r return TOK_RUN; +q return TOK_QUIT; +s return TOK_STEP; +u return TOK_UNASM; +we return TOK_MOD_EXT; +wi return TOK_MOD_INT; +wp return TOK_MOD_PROG; +wr return TOK_MOD_REG; +z return TOK_RST; +zt return TOK_RST_TIMER; +all return TOK_ALL; +a return TOK_A; +b return TOK_B; +c return TOK_C; +d return TOK_D; +[a-z0-9]+ { yylval.string = strdup(yytext); return WORD; } +[\n] return TOK_ENTER; +[ \t]+ { /* ignore whitespace */ } +. { return yytext[0]; } +%% diff -Nru emu8051-1.1.1/src/common/common.h emu8051-2.0.1/src/common/common.h --- emu8051-1.1.1/src/common/common.h 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/common/common.h 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,44 @@ +/* + * common.h + * + * Copyright (C) 1999 Jonathan St-André + * Copyright (C) 1999 Hugo Villeneuve + * + * This file is released under the GPLv2 + */ + +#ifndef COMMON_H +#define COMMON_H 1 + +#include +#include +#include + +#if STDC_HEADERS +# include +#elif HAVE_STRINGS_H +# include +#endif + +#include "log.h" + +#define FIXED_FONT "monospace 12" + +#define MAX_FILENAME_LENGTH 1024 + +/* Common constants. */ +#ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# define EXIT_FAILURE 1 +#endif + +/* Returns TRUE if the strings 'a' and 'b' are equal. */ +#define STREQ(a, b) (strcasecmp((a), (b)) == 0) + +/* Returns TRUE if the first 'c' characters of strings 'a' and 'b' are equal. */ +#define STREQ_LEN(a, b, c) (strncasecmp((a), (b), (c)) == 0) + +void * +xmalloc(size_t size, const char *filename, int line_number); + +#endif /* COMMON_H */ diff -Nru emu8051-1.1.1/src/common/cpu8051.c emu8051-2.0.1/src/common/cpu8051.c --- emu8051-1.1.1/src/common/cpu8051.c 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/common/cpu8051.c 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,559 @@ +/* + * cpu8051.c + * + * Copyright (C) 1999 Jonathan St-André + * Copyright (C) 1999 Hugo Villeneuve + * + * This file is released under the GPLv2 + */ + +/* Define only here, for not having extern scope on local variables. */ +#define CPU8051_M 1 + +#include +#include +#include + +#include "common.h" +#include "reg8051.h" +#include "cpu8051.h" +#include "memory.h" +#include "psw.h" +#include "timers.h" +#include "opcodes.h" +#include "options.h" +#include "instructions_8051.h" + +extern struct options_t options; + +/* Check if the address is a breakpoint */ +int +breakpoint_is_defined(unsigned int address) +{ + int k; + + for (k = 0; k < cpu8051.bp_count; k++) { + if (cpu8051.bp[k] == address) + return true; + } + + /* The address was not found in the list of breakpoints */ + return false; +} + +/* Show Breakpoints list */ +void +breakpoints_show(void) +{ + int k; + + if (cpu8051.bp_count) { + printf("Breakpoints:\n"); + for (k = 0; k < cpu8051.bp_count; k++) + printf(" $%.4X\n", cpu8051.bp[k]); + } else { + printf("No breakpoints defined\n"); + } +} + +/* Set Breakpoint at address at the end of the breakpoint list */ +void +breakpoint_set(unsigned int address) +{ + int rc; + + rc = mem_check_address(PGM_MEM_ID, address, DISPLAY_ERROR_YES); + if (!rc) + return; /* Error */ + + /* Check if breakpoint is already defined. */ + if ((breakpoint_is_defined(address) == false) && + (cpu8051.bp_count < MAXBP)) + cpu8051.bp[cpu8051.bp_count++] = address; +} + +/* Clear Breakpoint at Address from list */ +void +breakpoint_clr(unsigned int address) +{ + int k; + int rc; + + rc = mem_check_address(PGM_MEM_ID, address, DISPLAY_ERROR_YES); + if (!rc) + return; /* Error */ + + /* Check if breakpoint is defined. */ + if (breakpoint_is_defined(address) == false) { + log_err("No breakpoint defined at address $%X", address); + return; + } + + for (k = 0; k < cpu8051.bp_count; k++) { + if (cpu8051.bp[k] == address) { + /* Fill removed breakpoint slot with last entry */ + cpu8051.bp[k] = cpu8051.bp[cpu8051.bp_count - 1]; + cpu8051.bp_count--; + } + } +} + +/* Clear all breakpoints */ +void +breakpoints_clr_all(void) +{ + cpu8051.bp_count = 0; +} + +/* Toggle the breakpoint at Address. */ +void +breakpoint_toggle(unsigned int address) +{ + if (breakpoint_is_defined(address)) + breakpoint_clr(address); + else + breakpoint_set(address); +} + +/* Check if the address is a stop point */ +static int +stop_point_is_defined(unsigned int address) +{ + if ((options.stop_address != 0) && (options.stop_address == address)) + return true; + else + return false; +} + +void +cpu8051_init(void) +{ + int id; + + mem_init(); + + for (id = 0; id < GP_TIMERS_COUNT; id++) + gp_timer_reset(id); + + cpu8051.pc = 0; + cpu8051.clock = 0; + cpu8051.active_priority = -1; + cpu8051.bp_count = 0; +} + +/* Reset the registers and CPU state */ +void +cpu8051_reset(void) +{ + cpu8051.pc = 0; + cpu8051.clock = 0; + cpu8051.active_priority = -1; + + /* Clear IRAM and SFR. */ + mem_clear(INT_MEM_ID); + + mem_sfr_write8(_P0_, 0xFF); + mem_sfr_write8(_P1_, 0xFF); + mem_sfr_write8(_P2_, 0xFF); + mem_sfr_write8(_P3_, 0xFF); + + /* The default value of SP (after system reset) is 07 */ + mem_sfr_write8(_SP_, 0x07); +} + +static int +cpu8051_interrupt_fire(int interrupt_no, int priority) +{ + if (mem_read_direct(_IP_) & INTERRUPT_MASK(interrupt_no)) + return priority; + else + return !priority; +} + +static int +cpu8051_interrupt_enabled(int interrupt_no) +{ + return (mem_read_direct(_IE_) & INTERRUPT_MASK(interrupt_no)) ? + 1 : 0; +} + +static void +cpu8051_process_interrupt(int pc, int pri) +{ + stack_push16(cpu8051.pc); + cpu8051.pc = pc; + cpu8051.active_priority = pri; +} + + +/* Check interrupts state and process them as needed */ +static void +cpu8051_check_interrupts(void) +{ + int i; + + if ((mem_read_direct(_IE_) & 0x80) == 0) + return; + + for (i = INTERRUPT_PRIORITY_HIGH; i >= INTERRUPT_PRIORITY_LOW; i--) { + if (cpu8051.active_priority < i) { + /* Interrupt timer 0 */ + if (cpu8051_interrupt_enabled(INTERRUPT_1) && + cpu8051_interrupt_fire(INTERRUPT_1, i) && + (mem_read_direct(_TCON_) & 0x20)) { + mem_write_direct( + _TCON_, + mem_read_direct(_TCON_) & 0xDF); + cpu8051_process_interrupt(0x0B, i); + return; + } + /* Interrupt timer 1 */ + if (cpu8051_interrupt_enabled(INTERRUPT_3) && + cpu8051_interrupt_fire(INTERRUPT_3, i) && + (mem_read_direct(_TCON_) & 0x80)) { + mem_write_direct( + _TCON_, + mem_read_direct(_TCON_) & 0x7F); + cpu8051_process_interrupt(0x1B, i); + return; + } + /* Serial Interrupts */ + if (cpu8051_interrupt_enabled(INTERRUPT_4) && + cpu8051_interrupt_fire(INTERRUPT_4, i) && + (mem_read_direct(_SCON_) & 0x03)) { + cpu8051_process_interrupt(0x23, i); + return; + } + /* Interrupt timer 2 */ + if (cpu8051_interrupt_enabled(INTERRUPT_5) && + cpu8051_interrupt_fire(INTERRUPT_5, i) && + (mem_read_direct(_T2CON_) & 0x80)) { + cpu8051_process_interrupt(0x2B, i); + return; + } + } + } +} + +/* Execute at address cpu8051.pc from PGMMem */ +int +cpu8051_exec(void) +{ + int i; + int rc; + unsigned char opcode; + int insttiming; + + /* Basic address check (may fail later if opcode has operands). */ + rc = mem_check_address(PGM_MEM_ID, cpu8051.pc, DISPLAY_ERROR_NO); + if (!rc) { + log_err("Trying to run past program memory limit"); + return false; /* Error */ + } + + opcode = mem_read8(PGM_MEM_ID, cpu8051.pc); + cpu8051.pc++; + insttiming = (*opcode_table[opcode])(); /* Function callback. */ + + /* + * Parity bit (p): is automatically set or cleared in each machine + * cycle to establish even parity in the accumulator. + */ + psw_compute_parity_bit(); + + gp_timers_increment(insttiming); + + for (i = 0; i < insttiming; i++) { + cpu8051_check_interrupts(); + timers_check(); + cpu8051.clock++; + } + + return true; +} + +/* + * Run specified number of instructions, or when encountering a + * breakpoint or a stop point. + * Set instr_count to -1 to disable running for a specific number + * of instructions. + * + * Returns TRUE when a breakpoint is encountered. + */ +int +cpu8051_run(int instr_count, int (*interface_stop)(void)) +{ + int rc; + int run = true; + int breakpoint_hit = false; + + while (run) { + rc = cpu8051_exec(); + if (!rc) { + run = false; + } else { + if (instr_count > 0) + instr_count--; + + if (instr_count == 0) { + run = false; + log_info("Number of instructions reached"); + } + + if (breakpoint_is_defined(cpu8051.pc)) { + run = false; + breakpoint_hit = true; + log_info("Breakpoint hit at %.4X", cpu8051.pc); + } + + if (stop_point_is_defined(cpu8051.pc)) { + run = false; + log_info("Stoppoint hit at %.4X", cpu8051.pc); + } + + if (interface_stop != NULL) { + if (interface_stop()) { + run = false; + log_info("Caught break signal"); + } + } + } + } + + return breakpoint_hit; +} + +/* + * Addressing modes defined in the order as they appear in disasm.h + * from table argstext[] + */ +#define ADDR11 0 +#define ADDR16 1 +#define DIRECT 3 +#define BITADDR 14 +#define RELADDR 15 +#define DATAIMM 16 +#define DATA16 22 +#define CBITADDR 23 + +/* + * SFR Memory map [80h - FFh] + * --------------------------------------------------------------- + * F8 | | | | | | | | | FF + * F0 | B | | | | | | | | F7 + * E8 | | | | | | | | | EF + * E0 | ACC | | | | | | | | E7 + * D8 | | | | | | | | | DF + * D0 | PSW | | | | | | | | D7 + * C8 | T2CON| |RCAP2L|RCAP2H| TL2 | TH2 | | | CF + * C0 | | | | | | | | | C7 + * B8 | IP | | | | | | | | BF + * B0 | P3 | | | | | | | | B7 + * A8 | IE | | | | | | | | AF + * A0 | P2 | | | | | | | | A7 + * 98 | SCON | SBUF | | | | | | | 9F + * 90 | P1 | | | | | | | | 97 + * 88 | TCON | TMOD | TL0 | TL1 | TH0 | TH1 | | | 8F + * 80 | P0 | SP | DPL | DPH | | | | PCON | 87 + * --------------------------------------------------------------- + */ + +/* Return as Text the name of the SFR register at Address if any */ +static int +cpu8051_sfr_mem_info(unsigned int address, char *text) +{ + switch (address) { + case 0x80: return sprintf(text, "P0"); + case 0x81: return sprintf(text, "SP"); + case 0x82: return sprintf(text, "DPL"); + case 0x83: return sprintf(text, "DPH"); + case 0x87: return sprintf(text, "PCON"); + case 0x88: return sprintf(text, "TCON"); + case 0x89: return sprintf(text, "TMOD"); + case 0x8A: return sprintf(text, "TL0"); + case 0x8B: return sprintf(text, "TL1"); + case 0x8C: return sprintf(text, "TH0"); + case 0x8D: return sprintf(text, "TH1"); + case 0x90: return sprintf(text, "P1"); + case 0x98: return sprintf(text, "SCON"); + case 0x99: return sprintf(text, "SBUF"); + case 0xA0: return sprintf(text, "P2"); + case 0xA8: return sprintf(text, "IE"); + case 0xB0: return sprintf(text, "P3"); + case 0xB8: return sprintf(text, "IP"); + case 0xC8: return sprintf(text, "T2CON"); + case 0xCA: return sprintf(text, "RCAP2L"); + case 0xCB: return sprintf(text, "RCAP2H"); + case 0xCC: return sprintf(text, "TL2"); + case 0xCD: return sprintf(text, "TH2"); + case 0xD0: return sprintf(text, "PSW"); + case 0xE0: return sprintf(text, "ACC"); + case 0xF0: return sprintf(text, "B"); + default: return sprintf(text, "%.2XH", address); + } +} + +/* Return as text the decoded bit address */ +static void +cpu8051_int_mem_bit_info(uint8_t bit_address, char *text) +{ + uint8_t byte_address; + uint8_t bit_number; + int len; + + mem_convert_bit_address(bit_address, &byte_address, &bit_number); + + len = cpu8051_sfr_mem_info(byte_address, text); + sprintf(&text[len], ".%X", bit_address); +} + +/* Display instruction mnemonic. */ +int +cpu8051_disasm_mnemonic(unsigned char opcode, char *buf) +{ + return sprintf(buf, "%s", opcodes_get_instr_type_str(opcode)); +} + +/* Disasm instruction arguments starting at address into a text string */ +void +cpu8051_disasm_args(unsigned int address, char *buf) +{ + int len = 0; + char str[20]; + unsigned char opcode; + int args_table_offset; + int i; + + buf[0] = '\0'; + + opcode = mem_read8(PGM_MEM_ID, address); + args_table_offset = opcode << 2; + address++; + + /* + * MOV direct, direct (opcode 85h) is peculiar, the operands + * are inverted + */ + if (opcode == 0x85) { + cpu8051_sfr_mem_info(mem_read8(PGM_MEM_ID, address + 1), + str); + len += sprintf(&buf[len], "%s,", str); + cpu8051_sfr_mem_info(mem_read8(PGM_MEM_ID, address), + str); + len += sprintf(&buf[len], "%s", str); + address += 2; + return; + } + + for (i = 1; i <= opcodes_get_instr_arg_type_id(args_table_offset); + i++) { + switch (opcodes_get_instr_arg_type_id(args_table_offset + i)) { + case ADDR11: { + len += sprintf(&buf[len], + "%.4XH", ((opcode << 3) & 0xF00) + + (mem_read8(PGM_MEM_ID, address))); + address++; + break; + } + case ADDR16: { + len += sprintf( + &buf[len], "%.4XH", + ((mem_read8(PGM_MEM_ID, address) << 8) + + mem_read8(PGM_MEM_ID, address + 1))); + address += 2; + break; + } + case DIRECT: { + cpu8051_sfr_mem_info(mem_read8(PGM_MEM_ID, address), + str); + len += sprintf(&buf[len], "%s", str); + address++; + break; + } + case BITADDR: { + cpu8051_int_mem_bit_info( + (mem_read8(PGM_MEM_ID, address) & 0xF8), + str); + len += sprintf(&buf[len], "%s.%X" , str, + (mem_read8(PGM_MEM_ID, address) & 7)); + address++; + break; + } + case RELADDR: { + address++; + len += sprintf(&buf[len], "%.4XH", (address & 0xFF00) + + (((address & 0xFF) + + mem_read8(PGM_MEM_ID, + address - 1)) & 0xFF)); + break; + } + case DATAIMM: { + len += sprintf(&buf[len], "#%.2XH", + mem_read8(PGM_MEM_ID, address)); + address++; + break; + } + case DATA16: { + len += sprintf(&buf[len], "#%.4XH", + ((mem_read8(PGM_MEM_ID, + address) << 8) + + mem_read8(PGM_MEM_ID, address+1))); + address += 2; + break; + } + case CBITADDR: { + cpu8051_int_mem_bit_info((mem_read8(PGM_MEM_ID, + address) & 0xF8), + str); + len += sprintf(&buf[len], "/%s.%X", str, + (mem_read8(PGM_MEM_ID, address) & 7)); + address++; + break; + } + default: { + len += sprintf(&buf[len], "%s", + opcodes_get_instr_arg_type_str( + args_table_offset + i)); + } + } + if (i < opcodes_get_instr_arg_type_id(args_table_offset)) + len += sprintf(&buf[len], ","); + } +} + +/* Disasm one instruction at address into a Text string */ +int +cpu8051_disasm(unsigned int address, char *text) +{ + int len = 0; + unsigned char opcode; + int inst_size; + int i; + + /* Display address. */ + len += sprintf(text, " %.4X ", address); + + opcode = mem_read8(PGM_MEM_ID, address); + inst_size = opcodes_get_instr_size(opcode); + + /* Display hex bytes. */ + for (i = 0; i < inst_size; i++) + len += sprintf(&text[len], " %.2X", + mem_read8(PGM_MEM_ID, address + i)); + + /* Padd remaining area with spaces. */ + for (; len < 17;) + len += sprintf(&text[len], " "); + + /* Display instruction mnemonic. */ + len += cpu8051_disasm_mnemonic(opcode, &text[len]); + + /* Padd remaining area with spaces. */ + for (; len < 25;) + len += sprintf(&text[len], " "); + + /* Display instruction arguments. */ + cpu8051_disasm_args(address, &text[len]); + + return inst_size; +} diff -Nru emu8051-1.1.1/src/common/cpu8051.h emu8051-2.0.1/src/common/cpu8051.h --- emu8051-1.1.1/src/common/cpu8051.h 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/common/cpu8051.h 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,86 @@ +/* + * cpu8051.h + * + * Copyright (C) 1999 Jonathan St-André + * Copyright (C) 1999 Hugo Villeneuve + * + * This file is released under the GPLv2 + */ + +#ifndef CPU8051_H +#define CPU8051_H 1 + +#include + +/* Maximum number of BreakPoints */ +#define MAXBP 32 + +#define INTERRUPT_0 (0) +#define INTERRUPT_1 (1) +#define INTERRUPT_2 (2) +#define INTERRUPT_3 (3) +#define INTERRUPT_4 (4) +#define INTERRUPT_5 (5) +#define INTERRUPT_MASK(n) (1 << n) + +#define INTERRUPT_PRIORITY_HIGH (1) +#define INTERRUPT_PRIORITY_LOW (0) + +struct cpu8051_t { + unsigned int pc; /* Program counter */ + unsigned long clock; + int active_priority; + int bp_count; + unsigned int bp[MAXBP]; /* List of breakpoints */ +}; + +/* Exported variables */ +#undef _SCOPE_ +#ifdef CPU8051_M +# define _SCOPE_ /**/ +#else +# define _SCOPE_ extern +#endif + +_SCOPE_ struct cpu8051_t cpu8051; + +int +breakpoint_is_defined(unsigned int address); + +void +breakpoints_show(void); + +void +breakpoint_set(unsigned int address); + +void +breakpoint_clr(unsigned int address); + +void +breakpoints_clr_all(void); + +void +breakpoint_toggle(unsigned int address); + +void +cpu8051_init(void); + +int +cpu8051_exec(void); + +int +cpu8051_run(int instr_count, int (*interface_stop)(void)); + +void +cpu8051_reset(void); + +int +cpu8051_disasm_mnemonic(unsigned char opcode, char *buf); + +void +cpu8051_disasm_args(unsigned int address, char *buf); + +int +cpu8051_disasm(unsigned int address, char *text); + +#endif /* CPU8051_H */ diff -Nru emu8051-1.1.1/src/common/hexfile.c emu8051-2.0.1/src/common/hexfile.c --- emu8051-1.1.1/src/common/hexfile.c 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/common/hexfile.c 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,205 @@ +/* + * Functions for loading an Intel HEX file. + * + * Copyright (C) 1999 Jonathan St-André + * Copyright (C) 1999 Hugo Villeneuve + * + * This file is released under the GPLv2 + */ + +#if HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include +#include + +#if STDC_HEADERS +# include +#elif HAVE_STRINGS_H +# include +#endif + +#include "common.h" +#include "memory.h" + +/* Maximum of 75 digits with 32-bytes data records. */ +#define HEXFILE_LINE_BUFFER_LEN 128 + +static int asciihex2int_error; + +int +asciihex2int_get_error(void) +{ + return asciihex2int_error; +} + +/* Convert integer to ASCII hex string. */ +void +int2asciihex(int val, char *str, int width) +{ + if (width == 1) + sprintf(str , "%.1X", (uint8_t) val); + else if (width == 2) + sprintf(str , "%.2X", (uint8_t) val); + else if (width == 4) + sprintf(str , "%.4X", (uint16_t) val); + else + sprintf(str , "Err"); +} + +/* + * Convert ASCII string in hexadecimal notation to integer, up to length + * characters. + * The string contains only [0-9] and [a-f] characters (no "0x" prefix). + */ +static unsigned int +asciihex2int_len(char *str, int length) +{ + unsigned int result = 0; + int i, ascii_code; + + asciihex2int_error = false; + + if (!length || (length > (int) strlen(str))) + length = strlen(str); + + for (i = 0; i < length; i++) { + ascii_code = str[i]; + if (ascii_code > 0x39) + ascii_code &= 0xDF; + + if ((ascii_code >= 0x30 && ascii_code <= 0x39) || + (ascii_code >= 0x41 && ascii_code <= 0x46)) { + ascii_code -= 0x30; + if (ascii_code > 9) + ascii_code -= 7; + + result <<= 4; + result += ascii_code; + } else { + log_err("ASCII to hex conversion failure"); + asciihex2int_error = true; + return 0; + } + } + return result; +} + +/* + * Convert ASCII string in hexadecimal notation to integer, up to \0 end character. + * The string must not contain prefix "0x", only [0-9] and [a-f] characters. + */ +unsigned int +asciihex2int(char *str) +{ + /* Set length to zero to use full length of string. */ + return asciihex2int_len(str, 0); +} + +/* + * Return value: + * true: success + * false: failure + */ +int +hexfile_load(const char *filename) +{ + int i, j, rec_len, load_offset, rec_type, data, checksum; + FILE *fp; + int status; + char line[HEXFILE_LINE_BUFFER_LEN]; + int valid = false; + int line_num = 1; + + log_debug("LoadHexFile"); + + if (filename == NULL) { + log_err("No file specified"); + return false; + } + + /* Trying to open the file. */ + fp = fopen(filename, "r"); + if (fp == NULL) { + log_err("Error opening hex file <%s>: %s", filename, + strerror(errno)); + return false; + } + + /* Reading one line of data from the hex file. */ + /* char *fgets(char *s, int size, FILE *stream); + Reading stops after an EOF or a newline. If a newline is read, it is + stored into the buffer. A '\0' is stored after the last character + in the buffer. + */ + while (fgets(line, HEXFILE_LINE_BUFFER_LEN, fp) != NULL) { + i = 0; + checksum = 0; + + if (line[i++] != ':') { + log_err("hexfile line not beginning with \":\""); + goto close_file; + } + + rec_len = asciihex2int_len(&line[i], 2); + i += 2; + checksum += rec_len; + + load_offset = asciihex2int_len(&line[i], 4); + checksum += load_offset / 256; + checksum += load_offset % 256; + i += 4; + + rec_type = asciihex2int_len(&line[i], 2); + i += 2; + checksum += rec_type; + + if (rec_type == 0) { + for (j = 0; j < rec_len; j++) { + data = asciihex2int_len(&line[i], 2); + mem_write8(PGM_MEM_ID, + (unsigned int) (load_offset + j), + (unsigned char) data); + i += 2; + checksum += data; + } + } + + /* Read and add checksum value */ + checksum += asciihex2int_len(&line[i], 2); + checksum &= 0x000000FF; + + if (asciihex2int_error) { + log_err("hexfile parse error at line %d", line_num); + goto close_file; + } else if (checksum) { + log_err("hexfile checksum mismatch"); + goto close_file; + } + + if (rec_type == 0) { + log_debug("hex record: data"); + } else if (rec_type == 1) { + log_debug("hex record: End Of File"); + valid = true; + goto close_file; + } else { + log_warn("hex record: Unsupported ($%02X)", rec_type); + } + + line_num++; + } + +close_file: + status = fclose(fp); + if (status != EXIT_SUCCESS) { + log_err("Error closing hex file"); + valid = false; + } else if (!valid) { + log_err("Error parsing hex file"); + } + + return valid; +} diff -Nru emu8051-1.1.1/src/common/hexfile.h emu8051-2.0.1/src/common/hexfile.h --- emu8051-1.1.1/src/common/hexfile.h 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/common/hexfile.h 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,25 @@ +/* + * hexfile.h + * + * Copyright (C) 1999 Jonathan St-André + * Copyright (C) 1999 Hugo Villeneuve + * + * This file is released under the GPLv2 + */ + +#ifndef HEXFILE_H +#define HEXFILE_H 1 + +int +asciihex2int_get_error(void); + +void +int2asciihex(int val, char *str, int width); + +unsigned int +asciihex2int(char *str); + +int +hexfile_load(const char *filename); + +#endif /* HEXFILE_H */ diff -Nru emu8051-1.1.1/src/common/instructions_8051.c emu8051-2.0.1/src/common/instructions_8051.c --- emu8051-1.1.1/src/common/instructions_8051.c 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/common/instructions_8051.c 2014-03-22 18:26:21.000000000 +0000 @@ -0,0 +1,3566 @@ +/* + * instructions_8051.c + * + * Do not modify this file directly, as it was created by opcodes2c.pl + * Any modifications made directly to this file will be lost. + * + * Copyright (C) 1999 Jonathan St-André + * Copyright (C) 1999 Hugo Villeneuve + * + * This file is released under the GPLv2 + */ + +/* Define only here, for not having extern scope on local variables. */ +#define INSTRUCTIONS_8051_M 1 + + +#include "reg8051.h" +#include "cpu8051.h" +#include "memory.h" +#include "psw.h" +#include "operations.h" +#include "instructions_8051.h" + + +/***************************************************************************** + * Instruction "NOP" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_00(void) +{ + return 1; +} + +/***************************************************************************** + * Instruction "AJMP addr11" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_01(void) +{ + unsigned int addr11 = ( ( mem_read8( PGM_MEM_ID, cpu8051.pc - 1 ) << 3 ) & 0xF00 ) + mem_read8( PGM_MEM_ID, cpu8051.pc ); + cpu8051.pc++; + cpu8051.pc = ( cpu8051.pc & 0xF800 ) | addr11; + return 2; +} + +/***************************************************************************** + * Instruction "LJMP addr16" takes 2 cycle(s) and 3 byte(s). + ****************************************************************************/ +int +cpu8051_OP_02(void) +{ + uint16_t addr16 = pgm_read_addr16(cpu8051.pc); + cpu8051.pc += 2; + cpu8051.pc = addr16; + return 2; +} + +/***************************************************************************** + * Instruction "RR A" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_03(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + destination = ( destination >> 1 ) | ( destination << 7 ); + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "INC A" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_04(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + destination++; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "INC direct" takes 1 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_05(void) +{ + unsigned char destaddr = mem_read8( PGM_MEM_ID, cpu8051.pc++ ); + unsigned char destination = mem_read_direct( destaddr ); + destination++; + mem_write_direct( destaddr, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "INC @R0" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_06(void) +{ + unsigned char destination = mem_read_indirect ( mem_read_direct( BANKPSW + _R0_ ) ); + destination++; + mem_write_indirect( mem_read_direct( BANKPSW + _R0_ ), destination ); + return 1; +} + +/***************************************************************************** + * Instruction "INC @R1" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_07(void) +{ + unsigned char destination = mem_read_indirect ( mem_read_direct( BANKPSW + _R1_ ) ); + destination++; + mem_write_indirect( mem_read_direct( BANKPSW + _R1_ ), destination ); + return 1; +} + +/***************************************************************************** + * Instruction "INC R0" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_08(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R0_ ); + destination++; + mem_write_direct( BANKPSW + _R0_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "INC R1" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_09(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R1_ ); + destination++; + mem_write_direct( BANKPSW + _R1_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "INC R2" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_0A(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R2_ ); + destination++; + mem_write_direct( BANKPSW + _R2_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "INC R3" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_0B(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R3_ ); + destination++; + mem_write_direct( BANKPSW + _R3_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "INC R4" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_0C(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R4_ ); + destination++; + mem_write_direct( BANKPSW + _R4_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "INC R5" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_0D(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R5_ ); + destination++; + mem_write_direct( BANKPSW + _R5_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "INC R6" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_0E(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R6_ ); + destination++; + mem_write_direct( BANKPSW + _R6_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "INC R7" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_0F(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R7_ ); + destination++; + mem_write_direct( BANKPSW + _R7_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "JBC bitaddr,reladdr" takes 2 cycle(s) and 3 byte(s). + ****************************************************************************/ +int +cpu8051_OP_10(void) +{ + unsigned char destination, dstbitaddr = mem_read8( PGM_MEM_ID, cpu8051.pc++ ); + destination = mem_read_bit( dstbitaddr ); + (cpu8051.pc)++; + unsigned int source = ((char) mem_read8(PGM_MEM_ID, cpu8051.pc - 1)) + cpu8051.pc; + if ( destination == 1 ) { cpu8051.pc = source; destination = 0; } + mem_write_bit( dstbitaddr, destination ); + return 2; +} + +/***************************************************************************** + * Instruction "ACALL addr11" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_11(void) +{ + unsigned int addr11 = ( ( mem_read8( PGM_MEM_ID, cpu8051.pc - 1 ) << 3 ) & 0xF00 ) + mem_read8( PGM_MEM_ID, cpu8051.pc ); + cpu8051.pc++; + stack_push16(cpu8051.pc); + cpu8051.pc = ( cpu8051.pc & 0xF800 ) | addr11; + return 2; +} + +/***************************************************************************** + * Instruction "LCALL addr16" takes 2 cycle(s) and 3 byte(s). + ****************************************************************************/ +int +cpu8051_OP_12(void) +{ + uint16_t addr16 = pgm_read_addr16(cpu8051.pc); + cpu8051.pc += 2; + stack_push16(cpu8051.pc); + cpu8051.pc = addr16; + return 2; +} + +/***************************************************************************** + * Instruction "RRC A" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_13(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char new_cy = destination & 0x01; + destination = ( destination >> 1 ) | (psw_read_cy() << 7); + psw_write_cy(new_cy); + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "DEC A" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_14(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + destination--; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "DEC direct" takes 1 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_15(void) +{ + unsigned char destaddr = mem_read8( PGM_MEM_ID, cpu8051.pc++ ); + unsigned char destination = mem_read_direct( destaddr ); + destination--; + mem_write_direct( destaddr, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "DEC @R0" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_16(void) +{ + unsigned char destination = mem_read_indirect ( mem_read_direct( BANKPSW + _R0_ ) ); + destination--; + mem_write_indirect( mem_read_direct( BANKPSW + _R0_ ), destination ); + return 1; +} + +/***************************************************************************** + * Instruction "DEC @R1" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_17(void) +{ + unsigned char destination = mem_read_indirect ( mem_read_direct( BANKPSW + _R1_ ) ); + destination--; + mem_write_indirect( mem_read_direct( BANKPSW + _R1_ ), destination ); + return 1; +} + +/***************************************************************************** + * Instruction "DEC R0" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_18(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R0_ ); + destination--; + mem_write_direct( BANKPSW + _R0_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "DEC R1" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_19(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R1_ ); + destination--; + mem_write_direct( BANKPSW + _R1_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "DEC R2" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_1A(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R2_ ); + destination--; + mem_write_direct( BANKPSW + _R2_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "DEC R3" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_1B(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R3_ ); + destination--; + mem_write_direct( BANKPSW + _R3_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "DEC R4" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_1C(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R4_ ); + destination--; + mem_write_direct( BANKPSW + _R4_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "DEC R5" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_1D(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R5_ ); + destination--; + mem_write_direct( BANKPSW + _R5_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "DEC R6" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_1E(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R6_ ); + destination--; + mem_write_direct( BANKPSW + _R6_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "DEC R7" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_1F(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R7_ ); + destination--; + mem_write_direct( BANKPSW + _R7_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "JB bitaddr,reladdr" takes 2 cycle(s) and 3 byte(s). + ****************************************************************************/ +int +cpu8051_OP_20(void) +{ + unsigned char destination, dstbitaddr = mem_read8( PGM_MEM_ID, cpu8051.pc++ ); + destination = mem_read_bit( dstbitaddr ); + (cpu8051.pc)++; + unsigned int source = ((char) mem_read8(PGM_MEM_ID, cpu8051.pc - 1)) + cpu8051.pc; + if ( destination == 1 ) { cpu8051.pc = source; } + mem_write_bit( dstbitaddr, destination ); + return 2; +} + +/***************************************************************************** + * Instruction "AJMP addr11" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_21(void) +{ + unsigned int addr11 = ( ( mem_read8( PGM_MEM_ID, cpu8051.pc - 1 ) << 3 ) & 0xF00 ) + mem_read8( PGM_MEM_ID, cpu8051.pc ); + cpu8051.pc++; + cpu8051.pc = ( cpu8051.pc & 0xF800 ) | addr11; + return 2; +} + +/***************************************************************************** + * Instruction "RET" takes 2 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_22(void) +{ + cpu8051.pc = stack_pop16(); + return 2; +} + +/***************************************************************************** + * Instruction "RL A" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_23(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + destination = ( destination << 1 ) | ( destination >> 7 ); + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "ADD A,#data" takes 1 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_24(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + destination = addition(destination, source, 0); + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "ADD A,direct" takes 1 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_25(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char srcaddr = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + unsigned char source = mem_read_direct( srcaddr ); + destination = addition(destination, source, 0); + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "ADD A,@R0" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_26(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_indirect ( mem_read_direct( BANKPSW + _R0_ ) ); + destination = addition(destination, source, 0); + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "ADD A,@R1" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_27(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_indirect ( mem_read_direct( BANKPSW + _R1_ ) ); + destination = addition(destination, source, 0); + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "ADD A,R0" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_28(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R0_ ); + destination = addition(destination, source, 0); + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "ADD A,R1" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_29(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R1_ ); + destination = addition(destination, source, 0); + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "ADD A,R2" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_2A(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R2_ ); + destination = addition(destination, source, 0); + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "ADD A,R3" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_2B(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R3_ ); + destination = addition(destination, source, 0); + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "ADD A,R4" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_2C(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R4_ ); + destination = addition(destination, source, 0); + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "ADD A,R5" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_2D(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R5_ ); + destination = addition(destination, source, 0); + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "ADD A,R6" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_2E(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R6_ ); + destination = addition(destination, source, 0); + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "ADD A,R7" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_2F(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R7_ ); + destination = addition(destination, source, 0); + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "JNB bitaddr,reladdr" takes 2 cycle(s) and 3 byte(s). + ****************************************************************************/ +int +cpu8051_OP_30(void) +{ + unsigned char destination, dstbitaddr = mem_read8( PGM_MEM_ID, cpu8051.pc++ ); + destination = mem_read_bit( dstbitaddr ); + (cpu8051.pc)++; + unsigned int source = ((char) mem_read8(PGM_MEM_ID, cpu8051.pc - 1)) + cpu8051.pc; + if ( destination == 0 ) { cpu8051.pc = source; } + mem_write_bit( dstbitaddr, destination ); + return 2; +} + +/***************************************************************************** + * Instruction "ACALL addr11" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_31(void) +{ + unsigned int addr11 = ( ( mem_read8( PGM_MEM_ID, cpu8051.pc - 1 ) << 3 ) & 0xF00 ) + mem_read8( PGM_MEM_ID, cpu8051.pc ); + cpu8051.pc++; + stack_push16(cpu8051.pc); + cpu8051.pc = ( cpu8051.pc & 0xF800 ) | addr11; + return 2; +} + +/***************************************************************************** + * Instruction "RETI" takes 2 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_32(void) +{ + cpu8051.active_priority = -1; + cpu8051.pc = stack_pop16(); + return 2; +} + +/***************************************************************************** + * Instruction "RLC A" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_33(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char new_cy = destination & 0x80; + destination = ( destination << 1 ) | psw_read_cy(); + psw_write_cy(new_cy); + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "ADDC A,#data" takes 1 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_34(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + unsigned char carryflag = psw_read_cy(); + destination = addition(destination, source, carryflag); + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "ADDC A,direct" takes 1 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_35(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char srcaddr = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + unsigned char source = mem_read_direct( srcaddr ); + unsigned char carryflag = psw_read_cy(); + destination = addition(destination, source, carryflag); + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "ADDC A,@R0" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_36(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_indirect ( mem_read_direct( BANKPSW + _R0_ ) ); + unsigned char carryflag = psw_read_cy(); + destination = addition(destination, source, carryflag); + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "ADDC A,@R1" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_37(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_indirect ( mem_read_direct( BANKPSW + _R1_ ) ); + unsigned char carryflag = psw_read_cy(); + destination = addition(destination, source, carryflag); + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "ADDC A,R0" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_38(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R0_ ); + unsigned char carryflag = psw_read_cy(); + destination = addition(destination, source, carryflag); + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "ADDC A,R1" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_39(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R1_ ); + unsigned char carryflag = psw_read_cy(); + destination = addition(destination, source, carryflag); + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "ADDC A,R2" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_3A(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R2_ ); + unsigned char carryflag = psw_read_cy(); + destination = addition(destination, source, carryflag); + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "ADDC A,R3" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_3B(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R3_ ); + unsigned char carryflag = psw_read_cy(); + destination = addition(destination, source, carryflag); + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "ADDC A,R4" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_3C(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R4_ ); + unsigned char carryflag = psw_read_cy(); + destination = addition(destination, source, carryflag); + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "ADDC A,R5" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_3D(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R5_ ); + unsigned char carryflag = psw_read_cy(); + destination = addition(destination, source, carryflag); + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "ADDC A,R6" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_3E(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R6_ ); + unsigned char carryflag = psw_read_cy(); + destination = addition(destination, source, carryflag); + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "ADDC A,R7" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_3F(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R7_ ); + unsigned char carryflag = psw_read_cy(); + destination = addition(destination, source, carryflag); + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "JC reladdr" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_40(void) +{ + cpu8051.pc++; + unsigned int destination = ((char) mem_read8(PGM_MEM_ID, cpu8051.pc - 1)) + cpu8051.pc; + if (psw_read_cy()) { cpu8051.pc = destination; } + return 2; +} + +/***************************************************************************** + * Instruction "AJMP addr11" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_41(void) +{ + unsigned int addr11 = ( ( mem_read8( PGM_MEM_ID, cpu8051.pc - 1 ) << 3 ) & 0xF00 ) + mem_read8( PGM_MEM_ID, cpu8051.pc ); + cpu8051.pc++; + cpu8051.pc = ( cpu8051.pc & 0xF800 ) | addr11; + return 2; +} + +/***************************************************************************** + * Instruction "ORL direct,A" takes 1 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_42(void) +{ + unsigned char destaddr = mem_read8( PGM_MEM_ID, cpu8051.pc++ ); + unsigned char destination = mem_read_direct( destaddr ); + unsigned char source = mem_read_direct( _ACC_ ); + destination |= source; + mem_write_direct( destaddr, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "ORL direct,#data" takes 2 cycle(s) and 3 byte(s). + ****************************************************************************/ +int +cpu8051_OP_43(void) +{ + unsigned char destaddr = mem_read8( PGM_MEM_ID, cpu8051.pc++ ); + unsigned char destination = mem_read_direct( destaddr ); + unsigned char source = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + destination |= source; + mem_write_direct( destaddr, destination ); + return 2; +} + +/***************************************************************************** + * Instruction "ORL A,#data" takes 1 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_44(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + destination |= source; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "ORL A,direct" takes 1 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_45(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char srcaddr = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + unsigned char source = mem_read_direct( srcaddr ); + destination |= source; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "ORL A,@R0" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_46(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_indirect ( mem_read_direct( BANKPSW + _R0_ ) ); + destination |= source; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "ORL A,@R1" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_47(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_indirect ( mem_read_direct( BANKPSW + _R1_ ) ); + destination |= source; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "ORL A,R0" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_48(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R0_ ); + destination |= source; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "ORL A,R1" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_49(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R1_ ); + destination |= source; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "ORL A,R2" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_4A(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R2_ ); + destination |= source; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "ORL A,R3" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_4B(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R3_ ); + destination |= source; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "ORL A,R4" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_4C(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R4_ ); + destination |= source; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "ORL A,R5" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_4D(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R5_ ); + destination |= source; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "ORL A,R6" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_4E(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R6_ ); + destination |= source; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "ORL A,R7" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_4F(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R7_ ); + destination |= source; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "JNC reladdr" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_50(void) +{ + cpu8051.pc++; + unsigned int destination = ((char) mem_read8(PGM_MEM_ID, cpu8051.pc - 1)) + cpu8051.pc; + if (psw_read_cy() == 0) { cpu8051.pc = destination; } + return 2; +} + +/***************************************************************************** + * Instruction "ACALL addr11" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_51(void) +{ + unsigned int addr11 = ( ( mem_read8( PGM_MEM_ID, cpu8051.pc - 1 ) << 3 ) & 0xF00 ) + mem_read8( PGM_MEM_ID, cpu8051.pc ); + cpu8051.pc++; + stack_push16(cpu8051.pc); + cpu8051.pc = ( cpu8051.pc & 0xF800 ) | addr11; + return 2; +} + +/***************************************************************************** + * Instruction "ANL direct,A" takes 1 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_52(void) +{ + unsigned char destaddr = mem_read8( PGM_MEM_ID, cpu8051.pc++ ); + unsigned char destination = mem_read_direct( destaddr ); + unsigned char source = mem_read_direct( _ACC_ ); + destination &= source; + mem_write_direct( destaddr, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "ANL direct,#data" takes 2 cycle(s) and 3 byte(s). + ****************************************************************************/ +int +cpu8051_OP_53(void) +{ + unsigned char destaddr = mem_read8( PGM_MEM_ID, cpu8051.pc++ ); + unsigned char destination = mem_read_direct( destaddr ); + unsigned char source = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + destination &= source; + mem_write_direct( destaddr, destination ); + return 2; +} + +/***************************************************************************** + * Instruction "ANL A,#data" takes 1 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_54(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + destination &= source; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "ANL A,direct" takes 1 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_55(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char srcaddr = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + unsigned char source = mem_read_direct( srcaddr ); + destination &= source; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "ANL A,@R0" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_56(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_indirect ( mem_read_direct( BANKPSW + _R0_ ) ); + destination &= source; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "ANL A,@R1" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_57(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_indirect ( mem_read_direct( BANKPSW + _R1_ ) ); + destination &= source; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "ANL A,R0" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_58(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R0_ ); + destination &= source; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "ANL A,R1" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_59(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R1_ ); + destination &= source; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "ANL A,R2" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_5A(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R2_ ); + destination &= source; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "ANL A,R3" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_5B(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R3_ ); + destination &= source; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "ANL A,R4" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_5C(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R4_ ); + destination &= source; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "ANL A,R5" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_5D(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R5_ ); + destination &= source; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "ANL A,R6" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_5E(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R6_ ); + destination &= source; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "ANL A,R7" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_5F(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R7_ ); + destination &= source; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "JZ reladdr" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_60(void) +{ + cpu8051.pc++; + unsigned int destination = ((char) mem_read8(PGM_MEM_ID, cpu8051.pc - 1)) + cpu8051.pc; + if ( mem_read_direct( _ACC_ ) == 0 ) { cpu8051.pc = destination; } + return 2; +} + +/***************************************************************************** + * Instruction "AJMP addr11" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_61(void) +{ + unsigned int addr11 = ( ( mem_read8( PGM_MEM_ID, cpu8051.pc - 1 ) << 3 ) & 0xF00 ) + mem_read8( PGM_MEM_ID, cpu8051.pc ); + cpu8051.pc++; + cpu8051.pc = ( cpu8051.pc & 0xF800 ) | addr11; + return 2; +} + +/***************************************************************************** + * Instruction "XRL direct,A" takes 1 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_62(void) +{ + unsigned char destaddr = mem_read8( PGM_MEM_ID, cpu8051.pc++ ); + unsigned char destination = mem_read_direct( destaddr ); + unsigned char source = mem_read_direct( _ACC_ ); + destination ^= source; + mem_write_direct( destaddr, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "XRL direct,#data" takes 2 cycle(s) and 3 byte(s). + ****************************************************************************/ +int +cpu8051_OP_63(void) +{ + unsigned char destaddr = mem_read8( PGM_MEM_ID, cpu8051.pc++ ); + unsigned char destination = mem_read_direct( destaddr ); + unsigned char source = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + destination ^= source; + mem_write_direct( destaddr, destination ); + return 2; +} + +/***************************************************************************** + * Instruction "XRL A,#data" takes 1 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_64(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + destination ^= source; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "XRL A,direct" takes 1 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_65(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char srcaddr = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + unsigned char source = mem_read_direct( srcaddr ); + destination ^= source; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "XRL A,@R0" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_66(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_indirect ( mem_read_direct( BANKPSW + _R0_ ) ); + destination ^= source; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "XRL A,@R1" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_67(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_indirect ( mem_read_direct( BANKPSW + _R1_ ) ); + destination ^= source; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "XRL A,R0" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_68(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R0_ ); + destination ^= source; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "XRL A,R1" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_69(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R1_ ); + destination ^= source; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "XRL A,R2" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_6A(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R2_ ); + destination ^= source; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "XRL A,R3" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_6B(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R3_ ); + destination ^= source; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "XRL A,R4" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_6C(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R4_ ); + destination ^= source; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "XRL A,R5" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_6D(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R5_ ); + destination ^= source; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "XRL A,R6" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_6E(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R6_ ); + destination ^= source; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "XRL A,R7" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_6F(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R7_ ); + destination ^= source; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "JNZ reladdr" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_70(void) +{ + cpu8051.pc++; + unsigned int destination = ((char) mem_read8(PGM_MEM_ID, cpu8051.pc - 1)) + cpu8051.pc; + if ( mem_read_direct( _ACC_ ) != 0 ) { cpu8051.pc = destination; } + return 2; +} + +/***************************************************************************** + * Instruction "ACALL addr11" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_71(void) +{ + unsigned int addr11 = ( ( mem_read8( PGM_MEM_ID, cpu8051.pc - 1 ) << 3 ) & 0xF00 ) + mem_read8( PGM_MEM_ID, cpu8051.pc ); + cpu8051.pc++; + stack_push16(cpu8051.pc); + cpu8051.pc = ( cpu8051.pc & 0xF800 ) | addr11; + return 2; +} + +/***************************************************************************** + * Instruction "ORL C,bitaddr" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_72(void) +{ + unsigned char destination = psw_read_cy(); + unsigned char source, srcbitaddr = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + source = mem_read_bit( srcbitaddr ); + destination |= source; + psw_write_cy(destination); + return 2; +} + +/***************************************************************************** + * Instruction "JMP @A+DPTR" takes 2 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_73(void) +{ + unsigned int destination = mem_read_direct( _ACC_ ) + mem_sfr_read_dptr(); + cpu8051.pc = destination; + return 2; +} + +/***************************************************************************** + * Instruction "MOV A,#data" takes 1 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_74(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + destination = source; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "MOV direct,#data" takes 2 cycle(s) and 3 byte(s). + ****************************************************************************/ +int +cpu8051_OP_75(void) +{ + unsigned char destaddr = mem_read8( PGM_MEM_ID, cpu8051.pc++ ); + unsigned char destination = mem_read_direct( destaddr ); + unsigned char source = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + destination = source; + mem_write_direct( destaddr, destination ); + return 2; +} + +/***************************************************************************** + * Instruction "MOV @R0,#data" takes 1 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_76(void) +{ + unsigned char destination = mem_read_indirect ( mem_read_direct( BANKPSW + _R0_ ) ); + unsigned char source = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + destination = source; + mem_write_indirect( mem_read_direct( BANKPSW + _R0_ ), destination ); + return 1; +} + +/***************************************************************************** + * Instruction "MOV @R1,#data" takes 1 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_77(void) +{ + unsigned char destination = mem_read_indirect ( mem_read_direct( BANKPSW + _R1_ ) ); + unsigned char source = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + destination = source; + mem_write_indirect( mem_read_direct( BANKPSW + _R1_ ), destination ); + return 1; +} + +/***************************************************************************** + * Instruction "MOV R0,#data" takes 1 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_78(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R0_ ); + unsigned char source = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + destination = source; + mem_write_direct( BANKPSW + _R0_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "MOV R1,#data" takes 1 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_79(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R1_ ); + unsigned char source = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + destination = source; + mem_write_direct( BANKPSW + _R1_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "MOV R2,#data" takes 1 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_7A(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R2_ ); + unsigned char source = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + destination = source; + mem_write_direct( BANKPSW + _R2_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "MOV R3,#data" takes 1 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_7B(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R3_ ); + unsigned char source = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + destination = source; + mem_write_direct( BANKPSW + _R3_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "MOV R4,#data" takes 1 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_7C(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R4_ ); + unsigned char source = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + destination = source; + mem_write_direct( BANKPSW + _R4_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "MOV R5,#data" takes 1 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_7D(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R5_ ); + unsigned char source = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + destination = source; + mem_write_direct( BANKPSW + _R5_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "MOV R6,#data" takes 1 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_7E(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R6_ ); + unsigned char source = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + destination = source; + mem_write_direct( BANKPSW + _R6_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "MOV R7,#data" takes 1 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_7F(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R7_ ); + unsigned char source = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + destination = source; + mem_write_direct( BANKPSW + _R7_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "SJMP reladdr" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_80(void) +{ + cpu8051.pc++; + unsigned int destination = ((char) mem_read8(PGM_MEM_ID, cpu8051.pc - 1)) + cpu8051.pc; + cpu8051.pc = destination; + return 2; +} + +/***************************************************************************** + * Instruction "AJMP addr11" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_81(void) +{ + unsigned int addr11 = ( ( mem_read8( PGM_MEM_ID, cpu8051.pc - 1 ) << 3 ) & 0xF00 ) + mem_read8( PGM_MEM_ID, cpu8051.pc ); + cpu8051.pc++; + cpu8051.pc = ( cpu8051.pc & 0xF800 ) | addr11; + return 2; +} + +/***************************************************************************** + * Instruction "ANL C,bitaddr" takes 1 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_82(void) +{ + unsigned char destination = psw_read_cy(); + unsigned char source, srcbitaddr = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + source = mem_read_bit( srcbitaddr ); + destination &= source; + psw_write_cy(destination); + return 1; +} + +/***************************************************************************** + * Instruction "MOVC A,@A+PC" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_83(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read8( PGM_MEM_ID, mem_read_direct( _ACC_ ) + ( ++cpu8051.pc ) ); + destination = source; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "DIV AB" takes 4 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_84(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( _B_ ); + psw_clr_cy(); + if (source != 0) { + mem_write_direct(_ACC_, destination/source); + mem_write_direct( _B_, destination%source); + psw_clr_ov(); + } else { + psw_set_ov(); + } + return 4; +} + +/***************************************************************************** + * Instruction "MOV direct,direct" takes 1 cycle(s) and 3 byte(s). + ****************************************************************************/ +int +cpu8051_OP_85(void) +{ + unsigned char srcaddr = mem_read8( PGM_MEM_ID, cpu8051.pc++ ); + unsigned char source = mem_read_direct( srcaddr ); + unsigned char destaddr = mem_read8( PGM_MEM_ID, cpu8051.pc++ ); + unsigned char destination = mem_read_direct( destaddr ); + destination = source; + mem_write_direct( destaddr, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "MOV direct,@R0" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_86(void) +{ + unsigned char destaddr = mem_read8( PGM_MEM_ID, cpu8051.pc++ ); + unsigned char destination = mem_read_direct( destaddr ); + unsigned char source = mem_read_indirect ( mem_read_direct( BANKPSW + _R0_ ) ); + destination = source; + mem_write_direct( destaddr, destination ); + return 2; +} + +/***************************************************************************** + * Instruction "MOV direct,@R1" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_87(void) +{ + unsigned char destaddr = mem_read8( PGM_MEM_ID, cpu8051.pc++ ); + unsigned char destination = mem_read_direct( destaddr ); + unsigned char source = mem_read_indirect ( mem_read_direct( BANKPSW + _R1_ ) ); + destination = source; + mem_write_direct( destaddr, destination ); + return 2; +} + +/***************************************************************************** + * Instruction "MOV direct,R0" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_88(void) +{ + unsigned char destaddr = mem_read8( PGM_MEM_ID, cpu8051.pc++ ); + unsigned char destination = mem_read_direct( destaddr ); + unsigned char source = mem_read_direct( BANKPSW + _R0_ ); + destination = source; + mem_write_direct( destaddr, destination ); + return 2; +} + +/***************************************************************************** + * Instruction "MOV direct,R1" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_89(void) +{ + unsigned char destaddr = mem_read8( PGM_MEM_ID, cpu8051.pc++ ); + unsigned char destination = mem_read_direct( destaddr ); + unsigned char source = mem_read_direct( BANKPSW + _R1_ ); + destination = source; + mem_write_direct( destaddr, destination ); + return 2; +} + +/***************************************************************************** + * Instruction "MOV direct,R2" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_8A(void) +{ + unsigned char destaddr = mem_read8( PGM_MEM_ID, cpu8051.pc++ ); + unsigned char destination = mem_read_direct( destaddr ); + unsigned char source = mem_read_direct( BANKPSW + _R2_ ); + destination = source; + mem_write_direct( destaddr, destination ); + return 2; +} + +/***************************************************************************** + * Instruction "MOV direct,R3" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_8B(void) +{ + unsigned char destaddr = mem_read8( PGM_MEM_ID, cpu8051.pc++ ); + unsigned char destination = mem_read_direct( destaddr ); + unsigned char source = mem_read_direct( BANKPSW + _R3_ ); + destination = source; + mem_write_direct( destaddr, destination ); + return 2; +} + +/***************************************************************************** + * Instruction "MOV direct,R4" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_8C(void) +{ + unsigned char destaddr = mem_read8( PGM_MEM_ID, cpu8051.pc++ ); + unsigned char destination = mem_read_direct( destaddr ); + unsigned char source = mem_read_direct( BANKPSW + _R4_ ); + destination = source; + mem_write_direct( destaddr, destination ); + return 2; +} + +/***************************************************************************** + * Instruction "MOV direct,R5" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_8D(void) +{ + unsigned char destaddr = mem_read8( PGM_MEM_ID, cpu8051.pc++ ); + unsigned char destination = mem_read_direct( destaddr ); + unsigned char source = mem_read_direct( BANKPSW + _R5_ ); + destination = source; + mem_write_direct( destaddr, destination ); + return 2; +} + +/***************************************************************************** + * Instruction "MOV direct,R6" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_8E(void) +{ + unsigned char destaddr = mem_read8( PGM_MEM_ID, cpu8051.pc++ ); + unsigned char destination = mem_read_direct( destaddr ); + unsigned char source = mem_read_direct( BANKPSW + _R6_ ); + destination = source; + mem_write_direct( destaddr, destination ); + return 2; +} + +/***************************************************************************** + * Instruction "MOV direct,R7" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_8F(void) +{ + unsigned char destaddr = mem_read8( PGM_MEM_ID, cpu8051.pc++ ); + unsigned char destination = mem_read_direct( destaddr ); + unsigned char source = mem_read_direct( BANKPSW + _R7_ ); + destination = source; + mem_write_direct( destaddr, destination ); + return 2; +} + +/***************************************************************************** + * Instruction "MOV DPTR,#data16" takes 2 cycle(s) and 3 byte(s). + ****************************************************************************/ +int +cpu8051_OP_90(void) +{ + unsigned int destination = mem_sfr_read_dptr(); + uint16_t source = pgm_read_addr16(cpu8051.pc); + cpu8051.pc += 2; + destination = source; + mem_sfr_write_dptr(destination); + return 2; +} + +/***************************************************************************** + * Instruction "ACALL addr11" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_91(void) +{ + unsigned int addr11 = ( ( mem_read8( PGM_MEM_ID, cpu8051.pc - 1 ) << 3 ) & 0xF00 ) + mem_read8( PGM_MEM_ID, cpu8051.pc ); + cpu8051.pc++; + stack_push16(cpu8051.pc); + cpu8051.pc = ( cpu8051.pc & 0xF800 ) | addr11; + return 2; +} + +/***************************************************************************** + * Instruction "MOV bitaddr,C" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_92(void) +{ + unsigned char destination, dstbitaddr = mem_read8( PGM_MEM_ID, cpu8051.pc++ ); + destination = mem_read_bit( dstbitaddr ); + unsigned char source = psw_read_cy(); + destination = source; + mem_write_bit( dstbitaddr, destination ); + return 2; +} + +/***************************************************************************** + * Instruction "MOVC A,@A+DPTR" takes 2 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_93(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read8( PGM_MEM_ID, mem_read_direct( _ACC_ ) + mem_sfr_read_dptr()); + destination = source; + mem_write_direct( _ACC_, destination ); + return 2; +} + +/***************************************************************************** + * Instruction "SUBB A,#data" takes 1 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_94(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + unsigned char carryflag = psw_read_cy(); + psw_clr_cy(); + psw_clr_ac(); + psw_clr_ov(); + if ( destination < ( source + carryflag ) ) { + psw_set_cy(); + if ((destination & 0x7F) > ((source + carryflag) & 0x7F)) psw_set_ov(); + } else if ((destination & 0x7F) < ((source + carryflag) & 0x7F)) psw_set_ov(); + if ((destination & 0x0F) < ((source + carryflag) & 0x0F)) psw_set_ac(); + destination -= source + carryflag; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "SUBB A,direct" takes 1 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_95(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char srcaddr = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + unsigned char source = mem_read_direct( srcaddr ); + unsigned char carryflag = psw_read_cy(); + psw_clr_cy(); + psw_clr_ac(); + psw_clr_ov(); + if ( destination < ( source + carryflag ) ) { + psw_set_cy(); + if ((destination & 0x7F) > ((source + carryflag) & 0x7F)) psw_set_ov(); + } else if ((destination & 0x7F) < ((source + carryflag) & 0x7F)) psw_set_ov(); + if ((destination & 0x0F) < ((source + carryflag) & 0x0F)) psw_set_ac(); + destination -= source + carryflag; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "SUBB A,@R0" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_96(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_indirect ( mem_read_direct( BANKPSW + _R0_ ) ); + unsigned char carryflag = psw_read_cy(); + psw_clr_cy(); + psw_clr_ac(); + psw_clr_ov(); + if ( destination < ( source + carryflag ) ) { + psw_set_cy(); + if ((destination & 0x7F) > ((source + carryflag) & 0x7F)) psw_set_ov(); + } else if ((destination & 0x7F) < ((source + carryflag) & 0x7F)) psw_set_ov(); + if ((destination & 0x0F) < ((source + carryflag) & 0x0F)) psw_set_ac(); + destination -= source + carryflag; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "SUBB A,@R1" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_97(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_indirect ( mem_read_direct( BANKPSW + _R1_ ) ); + unsigned char carryflag = psw_read_cy(); + psw_clr_cy(); + psw_clr_ac(); + psw_clr_ov(); + if ( destination < ( source + carryflag ) ) { + psw_set_cy(); + if ((destination & 0x7F) > ((source + carryflag) & 0x7F)) psw_set_ov(); + } else if ((destination & 0x7F) < ((source + carryflag) & 0x7F)) psw_set_ov(); + if ((destination & 0x0F) < ((source + carryflag) & 0x0F)) psw_set_ac(); + destination -= source + carryflag; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "SUBB A,R0" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_98(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R0_ ); + unsigned char carryflag = psw_read_cy(); + psw_clr_cy(); + psw_clr_ac(); + psw_clr_ov(); + if ( destination < ( source + carryflag ) ) { + psw_set_cy(); + if ((destination & 0x7F) > ((source + carryflag) & 0x7F)) psw_set_ov(); + } else if ((destination & 0x7F) < ((source + carryflag) & 0x7F)) psw_set_ov(); + if ((destination & 0x0F) < ((source + carryflag) & 0x0F)) psw_set_ac(); + destination -= source + carryflag; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "SUBB A,R1" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_99(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R1_ ); + unsigned char carryflag = psw_read_cy(); + psw_clr_cy(); + psw_clr_ac(); + psw_clr_ov(); + if ( destination < ( source + carryflag ) ) { + psw_set_cy(); + if ((destination & 0x7F) > ((source + carryflag) & 0x7F)) psw_set_ov(); + } else if ((destination & 0x7F) < ((source + carryflag) & 0x7F)) psw_set_ov(); + if ((destination & 0x0F) < ((source + carryflag) & 0x0F)) psw_set_ac(); + destination -= source + carryflag; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "SUBB A,R2" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_9A(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R2_ ); + unsigned char carryflag = psw_read_cy(); + psw_clr_cy(); + psw_clr_ac(); + psw_clr_ov(); + if ( destination < ( source + carryflag ) ) { + psw_set_cy(); + if ((destination & 0x7F) > ((source + carryflag) & 0x7F)) psw_set_ov(); + } else if ((destination & 0x7F) < ((source + carryflag) & 0x7F)) psw_set_ov(); + if ((destination & 0x0F) < ((source + carryflag) & 0x0F)) psw_set_ac(); + destination -= source + carryflag; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "SUBB A,R3" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_9B(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R3_ ); + unsigned char carryflag = psw_read_cy(); + psw_clr_cy(); + psw_clr_ac(); + psw_clr_ov(); + if ( destination < ( source + carryflag ) ) { + psw_set_cy(); + if ((destination & 0x7F) > ((source + carryflag) & 0x7F)) psw_set_ov(); + } else if ((destination & 0x7F) < ((source + carryflag) & 0x7F)) psw_set_ov(); + if ((destination & 0x0F) < ((source + carryflag) & 0x0F)) psw_set_ac(); + destination -= source + carryflag; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "SUBB A,R4" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_9C(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R4_ ); + unsigned char carryflag = psw_read_cy(); + psw_clr_cy(); + psw_clr_ac(); + psw_clr_ov(); + if ( destination < ( source + carryflag ) ) { + psw_set_cy(); + if ((destination & 0x7F) > ((source + carryflag) & 0x7F)) psw_set_ov(); + } else if ((destination & 0x7F) < ((source + carryflag) & 0x7F)) psw_set_ov(); + if ((destination & 0x0F) < ((source + carryflag) & 0x0F)) psw_set_ac(); + destination -= source + carryflag; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "SUBB A,R5" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_9D(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R5_ ); + unsigned char carryflag = psw_read_cy(); + psw_clr_cy(); + psw_clr_ac(); + psw_clr_ov(); + if ( destination < ( source + carryflag ) ) { + psw_set_cy(); + if ((destination & 0x7F) > ((source + carryflag) & 0x7F)) psw_set_ov(); + } else if ((destination & 0x7F) < ((source + carryflag) & 0x7F)) psw_set_ov(); + if ((destination & 0x0F) < ((source + carryflag) & 0x0F)) psw_set_ac(); + destination -= source + carryflag; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "SUBB A,R6" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_9E(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R6_ ); + unsigned char carryflag = psw_read_cy(); + psw_clr_cy(); + psw_clr_ac(); + psw_clr_ov(); + if ( destination < ( source + carryflag ) ) { + psw_set_cy(); + if ((destination & 0x7F) > ((source + carryflag) & 0x7F)) psw_set_ov(); + } else if ((destination & 0x7F) < ((source + carryflag) & 0x7F)) psw_set_ov(); + if ((destination & 0x0F) < ((source + carryflag) & 0x0F)) psw_set_ac(); + destination -= source + carryflag; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "SUBB A,R7" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_9F(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R7_ ); + unsigned char carryflag = psw_read_cy(); + psw_clr_cy(); + psw_clr_ac(); + psw_clr_ov(); + if ( destination < ( source + carryflag ) ) { + psw_set_cy(); + if ((destination & 0x7F) > ((source + carryflag) & 0x7F)) psw_set_ov(); + } else if ((destination & 0x7F) < ((source + carryflag) & 0x7F)) psw_set_ov(); + if ((destination & 0x0F) < ((source + carryflag) & 0x0F)) psw_set_ac(); + destination -= source + carryflag; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "ORL C,/bitaddr" takes 1 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_A0(void) +{ + unsigned char destination = psw_read_cy(); + unsigned char source, srcbitaddr = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + source = ( mem_read_bit( srcbitaddr ) ^ 1 ); + destination |= source; + psw_write_cy(destination); + return 1; +} + +/***************************************************************************** + * Instruction "AJMP addr11" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_A1(void) +{ + unsigned int addr11 = ( ( mem_read8( PGM_MEM_ID, cpu8051.pc - 1 ) << 3 ) & 0xF00 ) + mem_read8( PGM_MEM_ID, cpu8051.pc ); + cpu8051.pc++; + cpu8051.pc = ( cpu8051.pc & 0xF800 ) | addr11; + return 2; +} + +/***************************************************************************** + * Instruction "MOV C,bitaddr" takes 1 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_A2(void) +{ + unsigned char destination = psw_read_cy(); + unsigned char source, srcbitaddr = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + source = mem_read_bit( srcbitaddr ); + destination = source; + psw_write_cy(destination); + return 1; +} + +/***************************************************************************** + * Instruction "INC DPTR" takes 2 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_A3(void) +{ + unsigned int destination = mem_sfr_read_dptr(); + destination++; + mem_sfr_write_dptr(destination); + return 2; +} + +/***************************************************************************** + * Instruction "MUL AB" takes 4 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_A4(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( _B_ ); + psw_clr_cy(); + mem_write_direct(_ACC_, destination * source); + mem_write_direct(_B_, (destination * source) / 0x100); + if (mem_read_direct(_B_) > 0) + psw_set_ov(); + else + psw_clr_ov(); + return 4; +} + +/***************************************************************************** + * Instruction "INVALID" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_A5(void) +{ + return 1; +} + +/***************************************************************************** + * Instruction "MOV @R0,direct" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_A6(void) +{ + unsigned char destination = mem_read_indirect ( mem_read_direct( BANKPSW + _R0_ ) ); + unsigned char srcaddr = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + unsigned char source = mem_read_direct( srcaddr ); + destination = source; + mem_write_indirect( mem_read_direct( BANKPSW + _R0_ ), destination ); + return 2; +} + +/***************************************************************************** + * Instruction "MOV @R1,direct" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_A7(void) +{ + unsigned char destination = mem_read_indirect ( mem_read_direct( BANKPSW + _R1_ ) ); + unsigned char srcaddr = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + unsigned char source = mem_read_direct( srcaddr ); + destination = source; + mem_write_indirect( mem_read_direct( BANKPSW + _R1_ ), destination ); + return 2; +} + +/***************************************************************************** + * Instruction "MOV R0,direct" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_A8(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R0_ ); + unsigned char srcaddr = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + unsigned char source = mem_read_direct( srcaddr ); + destination = source; + mem_write_direct( BANKPSW + _R0_, destination ); + return 2; +} + +/***************************************************************************** + * Instruction "MOV R1,direct" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_A9(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R1_ ); + unsigned char srcaddr = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + unsigned char source = mem_read_direct( srcaddr ); + destination = source; + mem_write_direct( BANKPSW + _R1_, destination ); + return 2; +} + +/***************************************************************************** + * Instruction "MOV R2,direct" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_AA(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R2_ ); + unsigned char srcaddr = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + unsigned char source = mem_read_direct( srcaddr ); + destination = source; + mem_write_direct( BANKPSW + _R2_, destination ); + return 2; +} + +/***************************************************************************** + * Instruction "MOV R3,direct" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_AB(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R3_ ); + unsigned char srcaddr = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + unsigned char source = mem_read_direct( srcaddr ); + destination = source; + mem_write_direct( BANKPSW + _R3_, destination ); + return 2; +} + +/***************************************************************************** + * Instruction "MOV R4,direct" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_AC(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R4_ ); + unsigned char srcaddr = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + unsigned char source = mem_read_direct( srcaddr ); + destination = source; + mem_write_direct( BANKPSW + _R4_, destination ); + return 2; +} + +/***************************************************************************** + * Instruction "MOV R5,direct" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_AD(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R5_ ); + unsigned char srcaddr = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + unsigned char source = mem_read_direct( srcaddr ); + destination = source; + mem_write_direct( BANKPSW + _R5_, destination ); + return 2; +} + +/***************************************************************************** + * Instruction "MOV R6,direct" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_AE(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R6_ ); + unsigned char srcaddr = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + unsigned char source = mem_read_direct( srcaddr ); + destination = source; + mem_write_direct( BANKPSW + _R6_, destination ); + return 2; +} + +/***************************************************************************** + * Instruction "MOV R7,direct" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_AF(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R7_ ); + unsigned char srcaddr = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + unsigned char source = mem_read_direct( srcaddr ); + destination = source; + mem_write_direct( BANKPSW + _R7_, destination ); + return 2; +} + +/***************************************************************************** + * Instruction "ANL C,/bitaddr" takes 1 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_B0(void) +{ + unsigned char destination = psw_read_cy(); + unsigned char source, srcbitaddr = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + source = ( mem_read_bit( srcbitaddr ) ^ 1 ); + destination &= source; + psw_write_cy(destination); + return 1; +} + +/***************************************************************************** + * Instruction "ACALL addr11" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_B1(void) +{ + unsigned int addr11 = ( ( mem_read8( PGM_MEM_ID, cpu8051.pc - 1 ) << 3 ) & 0xF00 ) + mem_read8( PGM_MEM_ID, cpu8051.pc ); + cpu8051.pc++; + stack_push16(cpu8051.pc); + cpu8051.pc = ( cpu8051.pc & 0xF800 ) | addr11; + return 2; +} + +/***************************************************************************** + * Instruction "CPL bitaddr" takes 1 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_B2(void) +{ + unsigned char destination, dstbitaddr = mem_read8( PGM_MEM_ID, cpu8051.pc++ ); + destination = mem_read_bit( dstbitaddr ); + destination ^= 0x01; + mem_write_bit( dstbitaddr, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "CPL C" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_B3(void) +{ + unsigned char destination = psw_read_cy(); + destination ^= 0x01; + psw_write_cy(destination); + return 1; +} + +/***************************************************************************** + * Instruction "CJNE A,#data,reladdr" takes 2 cycle(s) and 3 byte(s). + ****************************************************************************/ +int +cpu8051_OP_B4(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + unsigned int reladdr = ((char) mem_read8(PGM_MEM_ID, cpu8051.pc)) + (cpu8051.pc + 1); + psw_clr_cy(); + if ( destination < source ) psw_set_cy(); + if ( destination != source ) cpu8051.pc = reladdr; else cpu8051.pc++; + mem_write_direct( _ACC_, destination ); + return 2; +} + +/***************************************************************************** + * Instruction "CJNE A,direct,reladdr" takes 2 cycle(s) and 3 byte(s). + ****************************************************************************/ +int +cpu8051_OP_B5(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char srcaddr = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + unsigned char source = mem_read_direct( srcaddr ); + unsigned int reladdr = ((char) mem_read8(PGM_MEM_ID, cpu8051.pc)) + (cpu8051.pc + 1); + psw_clr_cy(); + if ( destination < source ) psw_set_cy(); + if ( destination != source ) cpu8051.pc = reladdr; else cpu8051.pc++; + mem_write_direct( _ACC_, destination ); + return 2; +} + +/***************************************************************************** + * Instruction "CJNE @R0,#data,reladdr" takes 2 cycle(s) and 3 byte(s). + ****************************************************************************/ +int +cpu8051_OP_B6(void) +{ + unsigned char destination = mem_read_indirect ( mem_read_direct( BANKPSW + _R0_ ) ); + unsigned char source = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + unsigned int reladdr = ((char) mem_read8(PGM_MEM_ID, cpu8051.pc)) + (cpu8051.pc + 1); + psw_clr_cy(); + if ( destination < source ) psw_set_cy(); + if ( destination != source ) cpu8051.pc = reladdr; else cpu8051.pc++; + mem_write_indirect( mem_read_direct( BANKPSW + _R0_ ), destination ); + return 2; +} + +/***************************************************************************** + * Instruction "CJNE @R1,#data,reladdr" takes 2 cycle(s) and 3 byte(s). + ****************************************************************************/ +int +cpu8051_OP_B7(void) +{ + unsigned char destination = mem_read_indirect ( mem_read_direct( BANKPSW + _R1_ ) ); + unsigned char source = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + unsigned int reladdr = ((char) mem_read8(PGM_MEM_ID, cpu8051.pc)) + (cpu8051.pc + 1); + psw_clr_cy(); + if ( destination < source ) psw_set_cy(); + if ( destination != source ) cpu8051.pc = reladdr; else cpu8051.pc++; + mem_write_indirect( mem_read_direct( BANKPSW + _R1_ ), destination ); + return 2; +} + +/***************************************************************************** + * Instruction "CJNE R0,#data,reladdr" takes 2 cycle(s) and 3 byte(s). + ****************************************************************************/ +int +cpu8051_OP_B8(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R0_ ); + unsigned char source = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + unsigned int reladdr = ((char) mem_read8(PGM_MEM_ID, cpu8051.pc)) + (cpu8051.pc + 1); + psw_clr_cy(); + if ( destination < source ) psw_set_cy(); + if ( destination != source ) cpu8051.pc = reladdr; else cpu8051.pc++; + mem_write_direct( BANKPSW + _R0_, destination ); + return 2; +} + +/***************************************************************************** + * Instruction "CJNE R1,#data,reladdr" takes 2 cycle(s) and 3 byte(s). + ****************************************************************************/ +int +cpu8051_OP_B9(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R1_ ); + unsigned char source = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + unsigned int reladdr = ((char) mem_read8(PGM_MEM_ID, cpu8051.pc)) + (cpu8051.pc + 1); + psw_clr_cy(); + if ( destination < source ) psw_set_cy(); + if ( destination != source ) cpu8051.pc = reladdr; else cpu8051.pc++; + mem_write_direct( BANKPSW + _R1_, destination ); + return 2; +} + +/***************************************************************************** + * Instruction "CJNE R2,#data,reladdr" takes 2 cycle(s) and 3 byte(s). + ****************************************************************************/ +int +cpu8051_OP_BA(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R2_ ); + unsigned char source = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + unsigned int reladdr = ((char) mem_read8(PGM_MEM_ID, cpu8051.pc)) + (cpu8051.pc + 1); + psw_clr_cy(); + if ( destination < source ) psw_set_cy(); + if ( destination != source ) cpu8051.pc = reladdr; else cpu8051.pc++; + mem_write_direct( BANKPSW + _R2_, destination ); + return 2; +} + +/***************************************************************************** + * Instruction "CJNE R3,#data,reladdr" takes 2 cycle(s) and 3 byte(s). + ****************************************************************************/ +int +cpu8051_OP_BB(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R3_ ); + unsigned char source = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + unsigned int reladdr = ((char) mem_read8(PGM_MEM_ID, cpu8051.pc)) + (cpu8051.pc + 1); + psw_clr_cy(); + if ( destination < source ) psw_set_cy(); + if ( destination != source ) cpu8051.pc = reladdr; else cpu8051.pc++; + mem_write_direct( BANKPSW + _R3_, destination ); + return 2; +} + +/***************************************************************************** + * Instruction "CJNE R4,#data,reladdr" takes 2 cycle(s) and 3 byte(s). + ****************************************************************************/ +int +cpu8051_OP_BC(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R4_ ); + unsigned char source = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + unsigned int reladdr = ((char) mem_read8(PGM_MEM_ID, cpu8051.pc)) + (cpu8051.pc + 1); + psw_clr_cy(); + if ( destination < source ) psw_set_cy(); + if ( destination != source ) cpu8051.pc = reladdr; else cpu8051.pc++; + mem_write_direct( BANKPSW + _R4_, destination ); + return 2; +} + +/***************************************************************************** + * Instruction "CJNE R5,#data,reladdr" takes 2 cycle(s) and 3 byte(s). + ****************************************************************************/ +int +cpu8051_OP_BD(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R5_ ); + unsigned char source = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + unsigned int reladdr = ((char) mem_read8(PGM_MEM_ID, cpu8051.pc)) + (cpu8051.pc + 1); + psw_clr_cy(); + if ( destination < source ) psw_set_cy(); + if ( destination != source ) cpu8051.pc = reladdr; else cpu8051.pc++; + mem_write_direct( BANKPSW + _R5_, destination ); + return 2; +} + +/***************************************************************************** + * Instruction "CJNE R6,#data,reladdr" takes 2 cycle(s) and 3 byte(s). + ****************************************************************************/ +int +cpu8051_OP_BE(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R6_ ); + unsigned char source = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + unsigned int reladdr = ((char) mem_read8(PGM_MEM_ID, cpu8051.pc)) + (cpu8051.pc + 1); + psw_clr_cy(); + if ( destination < source ) psw_set_cy(); + if ( destination != source ) cpu8051.pc = reladdr; else cpu8051.pc++; + mem_write_direct( BANKPSW + _R6_, destination ); + return 2; +} + +/***************************************************************************** + * Instruction "CJNE R7,#data,reladdr" takes 2 cycle(s) and 3 byte(s). + ****************************************************************************/ +int +cpu8051_OP_BF(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R7_ ); + unsigned char source = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + unsigned int reladdr = ((char) mem_read8(PGM_MEM_ID, cpu8051.pc)) + (cpu8051.pc + 1); + psw_clr_cy(); + if ( destination < source ) psw_set_cy(); + if ( destination != source ) cpu8051.pc = reladdr; else cpu8051.pc++; + mem_write_direct( BANKPSW + _R7_, destination ); + return 2; +} + +/***************************************************************************** + * Instruction "PUSH direct" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_C0(void) +{ + unsigned char destaddr = mem_read8( PGM_MEM_ID, cpu8051.pc++ ); + unsigned char destination = mem_read_direct( destaddr ); + stack_push8(destination); + mem_write_direct( destaddr, destination ); + return 2; +} + +/***************************************************************************** + * Instruction "AJMP addr11" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_C1(void) +{ + unsigned int addr11 = ( ( mem_read8( PGM_MEM_ID, cpu8051.pc - 1 ) << 3 ) & 0xF00 ) + mem_read8( PGM_MEM_ID, cpu8051.pc ); + cpu8051.pc++; + cpu8051.pc = ( cpu8051.pc & 0xF800 ) | addr11; + return 2; +} + +/***************************************************************************** + * Instruction "CLR bitaddr" takes 1 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_C2(void) +{ + unsigned char destination, dstbitaddr = mem_read8( PGM_MEM_ID, cpu8051.pc++ ); + destination = mem_read_bit( dstbitaddr ); + destination = 0; + mem_write_bit( dstbitaddr, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "CLR C" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_C3(void) +{ + unsigned char destination = psw_read_cy(); + destination = 0; + psw_write_cy(destination); + return 1; +} + +/***************************************************************************** + * Instruction "SWAP A" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_C4(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + destination = ( destination << 4 ) + ( destination >> 4 ); + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "XCH A,direct" takes 1 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_C5(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char srcaddr = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + unsigned char source = mem_read_direct( srcaddr ); + unsigned char tmpval = destination; + destination = source; source = tmpval; + mem_write_direct( _ACC_, destination ); + mem_write_direct( srcaddr, source ); + return 1; +} + +/***************************************************************************** + * Instruction "XCH A,@R0" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_C6(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_indirect ( mem_read_direct( BANKPSW + _R0_ ) ); + unsigned char tmpval = destination; + destination = source; source = tmpval; + mem_write_direct( _ACC_, destination ); + mem_write_indirect( mem_read_direct( BANKPSW + _R0_ ), source ); + return 1; +} + +/***************************************************************************** + * Instruction "XCH A,@R1" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_C7(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_indirect ( mem_read_direct( BANKPSW + _R1_ ) ); + unsigned char tmpval = destination; + destination = source; source = tmpval; + mem_write_direct( _ACC_, destination ); + mem_write_indirect( mem_read_direct( BANKPSW + _R1_ ), source ); + return 1; +} + +/***************************************************************************** + * Instruction "XCH A,R0" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_C8(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R0_ ); + unsigned char tmpval = destination; + destination = source; source = tmpval; + mem_write_direct( _ACC_, destination ); + mem_write_direct( BANKPSW + _R0_, source ); + return 1; +} + +/***************************************************************************** + * Instruction "XCH A,R1" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_C9(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R1_ ); + unsigned char tmpval = destination; + destination = source; source = tmpval; + mem_write_direct( _ACC_, destination ); + mem_write_direct( BANKPSW + _R1_, source ); + return 1; +} + +/***************************************************************************** + * Instruction "XCH A,R2" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_CA(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R2_ ); + unsigned char tmpval = destination; + destination = source; source = tmpval; + mem_write_direct( _ACC_, destination ); + mem_write_direct( BANKPSW + _R2_, source ); + return 1; +} + +/***************************************************************************** + * Instruction "XCH A,R3" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_CB(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R3_ ); + unsigned char tmpval = destination; + destination = source; source = tmpval; + mem_write_direct( _ACC_, destination ); + mem_write_direct( BANKPSW + _R3_, source ); + return 1; +} + +/***************************************************************************** + * Instruction "XCH A,R4" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_CC(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R4_ ); + unsigned char tmpval = destination; + destination = source; source = tmpval; + mem_write_direct( _ACC_, destination ); + mem_write_direct( BANKPSW + _R4_, source ); + return 1; +} + +/***************************************************************************** + * Instruction "XCH A,R5" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_CD(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R5_ ); + unsigned char tmpval = destination; + destination = source; source = tmpval; + mem_write_direct( _ACC_, destination ); + mem_write_direct( BANKPSW + _R5_, source ); + return 1; +} + +/***************************************************************************** + * Instruction "XCH A,R6" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_CE(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R6_ ); + unsigned char tmpval = destination; + destination = source; source = tmpval; + mem_write_direct( _ACC_, destination ); + mem_write_direct( BANKPSW + _R6_, source ); + return 1; +} + +/***************************************************************************** + * Instruction "XCH A,R7" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_CF(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R7_ ); + unsigned char tmpval = destination; + destination = source; source = tmpval; + mem_write_direct( _ACC_, destination ); + mem_write_direct( BANKPSW + _R7_, source ); + return 1; +} + +/***************************************************************************** + * Instruction "POP direct" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_D0(void) +{ + unsigned char destaddr = mem_read8( PGM_MEM_ID, cpu8051.pc++ ); + unsigned char destination = mem_read_direct( destaddr ); + destination = stack_pop8(); + mem_write_direct( destaddr, destination ); + return 2; +} + +/***************************************************************************** + * Instruction "ACALL addr11" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_D1(void) +{ + unsigned int addr11 = ( ( mem_read8( PGM_MEM_ID, cpu8051.pc - 1 ) << 3 ) & 0xF00 ) + mem_read8( PGM_MEM_ID, cpu8051.pc ); + cpu8051.pc++; + stack_push16(cpu8051.pc); + cpu8051.pc = ( cpu8051.pc & 0xF800 ) | addr11; + return 2; +} + +/***************************************************************************** + * Instruction "SETB bitaddr" takes 1 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_D2(void) +{ + unsigned char destination, dstbitaddr = mem_read8( PGM_MEM_ID, cpu8051.pc++ ); + destination = mem_read_bit( dstbitaddr ); + destination = 1; + mem_write_bit( dstbitaddr, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "SETB C" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_D3(void) +{ + unsigned char destination = psw_read_cy(); + destination = 1; + psw_write_cy(destination); + return 1; +} + +/***************************************************************************** + * Instruction "DA A" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_D4(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + if (((destination & 0x0F) > 9) || psw_read_ac()) { + if ( ( destination + 6 ) > 0xFF) psw_set_cy(); + destination += 6; + } + if ( psw_read_cy() || ( ( destination & 0xF0 ) > 0x90 ) ) { + if ( ( destination + 0x60 ) > 0xFF ) psw_set_cy(); + destination += 0x60; + } + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "DJNZ direct,reladdr" takes 2 cycle(s) and 3 byte(s). + ****************************************************************************/ +int +cpu8051_OP_D5(void) +{ + unsigned char destaddr = mem_read8( PGM_MEM_ID, cpu8051.pc++ ); + unsigned char destination = mem_read_direct( destaddr ); + (cpu8051.pc)++; + unsigned int source = ((char) mem_read8(PGM_MEM_ID, cpu8051.pc - 1)) + cpu8051.pc; + destination--; + if ( destination != 0 ) cpu8051.pc = source; + mem_write_direct( destaddr, destination ); + return 2; +} + +/***************************************************************************** + * Instruction "XCHD A,@R0" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_D6(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_indirect ( mem_read_direct( BANKPSW + _R0_ ) ); + unsigned char tmpval = ( destination & 0x0F ); + destination = ( destination & 0xF0 ) + ( source & 0x0F ); + source = ( source & 0xF0 ) + tmpval; + mem_write_direct( _ACC_, destination ); + mem_write_indirect( mem_read_direct( BANKPSW + _R0_ ), source ); + return 1; +} + +/***************************************************************************** + * Instruction "XCHD A,@R1" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_D7(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_indirect ( mem_read_direct( BANKPSW + _R1_ ) ); + unsigned char tmpval = ( destination & 0x0F ); + destination = ( destination & 0xF0 ) + ( source & 0x0F ); + source = ( source & 0xF0 ) + tmpval; + mem_write_direct( _ACC_, destination ); + mem_write_indirect( mem_read_direct( BANKPSW + _R1_ ), source ); + return 1; +} + +/***************************************************************************** + * Instruction "DJNZ R0,reladdr" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_D8(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R0_ ); + (cpu8051.pc)++; + unsigned int source = ((char) mem_read8(PGM_MEM_ID, cpu8051.pc - 1)) + cpu8051.pc; + destination--; + if ( destination != 0 ) cpu8051.pc = source; + mem_write_direct( BANKPSW + _R0_, destination ); + return 2; +} + +/***************************************************************************** + * Instruction "DJNZ R1,reladdr" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_D9(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R1_ ); + (cpu8051.pc)++; + unsigned int source = ((char) mem_read8(PGM_MEM_ID, cpu8051.pc - 1)) + cpu8051.pc; + destination--; + if ( destination != 0 ) cpu8051.pc = source; + mem_write_direct( BANKPSW + _R1_, destination ); + return 2; +} + +/***************************************************************************** + * Instruction "DJNZ R2,reladdr" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_DA(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R2_ ); + (cpu8051.pc)++; + unsigned int source = ((char) mem_read8(PGM_MEM_ID, cpu8051.pc - 1)) + cpu8051.pc; + destination--; + if ( destination != 0 ) cpu8051.pc = source; + mem_write_direct( BANKPSW + _R2_, destination ); + return 2; +} + +/***************************************************************************** + * Instruction "DJNZ R3,reladdr" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_DB(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R3_ ); + (cpu8051.pc)++; + unsigned int source = ((char) mem_read8(PGM_MEM_ID, cpu8051.pc - 1)) + cpu8051.pc; + destination--; + if ( destination != 0 ) cpu8051.pc = source; + mem_write_direct( BANKPSW + _R3_, destination ); + return 2; +} + +/***************************************************************************** + * Instruction "DJNZ R4,reladdr" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_DC(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R4_ ); + (cpu8051.pc)++; + unsigned int source = ((char) mem_read8(PGM_MEM_ID, cpu8051.pc - 1)) + cpu8051.pc; + destination--; + if ( destination != 0 ) cpu8051.pc = source; + mem_write_direct( BANKPSW + _R4_, destination ); + return 2; +} + +/***************************************************************************** + * Instruction "DJNZ R5,reladdr" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_DD(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R5_ ); + (cpu8051.pc)++; + unsigned int source = ((char) mem_read8(PGM_MEM_ID, cpu8051.pc - 1)) + cpu8051.pc; + destination--; + if ( destination != 0 ) cpu8051.pc = source; + mem_write_direct( BANKPSW + _R5_, destination ); + return 2; +} + +/***************************************************************************** + * Instruction "DJNZ R6,reladdr" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_DE(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R6_ ); + (cpu8051.pc)++; + unsigned int source = ((char) mem_read8(PGM_MEM_ID, cpu8051.pc - 1)) + cpu8051.pc; + destination--; + if ( destination != 0 ) cpu8051.pc = source; + mem_write_direct( BANKPSW + _R6_, destination ); + return 2; +} + +/***************************************************************************** + * Instruction "DJNZ R7,reladdr" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_DF(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R7_ ); + (cpu8051.pc)++; + unsigned int source = ((char) mem_read8(PGM_MEM_ID, cpu8051.pc - 1)) + cpu8051.pc; + destination--; + if ( destination != 0 ) cpu8051.pc = source; + mem_write_direct( BANKPSW + _R7_, destination ); + return 2; +} + +/***************************************************************************** + * Instruction "MOVX A,@DPTR" takes 2 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_E0(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_indirect(mem_sfr_read_dptr()); + destination = source; + mem_write_direct( _ACC_, destination ); + return 2; +} + +/***************************************************************************** + * Instruction "AJMP addr11" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_E1(void) +{ + unsigned int addr11 = ( ( mem_read8( PGM_MEM_ID, cpu8051.pc - 1 ) << 3 ) & 0xF00 ) + mem_read8( PGM_MEM_ID, cpu8051.pc ); + cpu8051.pc++; + cpu8051.pc = ( cpu8051.pc & 0xF800 ) | addr11; + return 2; +} + +/***************************************************************************** + * Instruction "MOVX A,@R0" takes 2 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_E2(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_indirect ( mem_read_direct( BANKPSW + _R0_ ) ); + destination = source; + mem_write_direct( _ACC_, destination ); + return 2; +} + +/***************************************************************************** + * Instruction "MOVX A,@R1" takes 2 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_E3(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_indirect ( mem_read_direct( BANKPSW + _R1_ ) ); + destination = source; + mem_write_direct( _ACC_, destination ); + return 2; +} + +/***************************************************************************** + * Instruction "CLR A" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_E4(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + destination = 0; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "MOV A,direct" takes 1 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_E5(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char srcaddr = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ ); + unsigned char source = mem_read_direct( srcaddr ); + destination = source; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "MOV A,@R0" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_E6(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_indirect ( mem_read_direct( BANKPSW + _R0_ ) ); + destination = source; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "MOV A,@R1" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_E7(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_indirect ( mem_read_direct( BANKPSW + _R1_ ) ); + destination = source; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "MOV A,R0" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_E8(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R0_ ); + destination = source; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "MOV A,R1" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_E9(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R1_ ); + destination = source; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "MOV A,R2" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_EA(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R2_ ); + destination = source; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "MOV A,R3" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_EB(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R3_ ); + destination = source; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "MOV A,R4" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_EC(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R4_ ); + destination = source; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "MOV A,R5" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_ED(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R5_ ); + destination = source; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "MOV A,R6" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_EE(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R6_ ); + destination = source; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "MOV A,R7" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_EF(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + unsigned char source = mem_read_direct( BANKPSW + _R7_ ); + destination = source; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "MOVX @DPTR,A" takes 2 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_F0(void) +{ + unsigned char destination = mem_read_indirect(mem_sfr_read_dptr()); + unsigned char source = mem_read_direct( _ACC_ ); + destination = source; + mem_write_indirect(mem_sfr_read_dptr(), destination); + return 2; +} + +/***************************************************************************** + * Instruction "ACALL addr11" takes 2 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_F1(void) +{ + unsigned int addr11 = ( ( mem_read8( PGM_MEM_ID, cpu8051.pc - 1 ) << 3 ) & 0xF00 ) + mem_read8( PGM_MEM_ID, cpu8051.pc ); + cpu8051.pc++; + stack_push16(cpu8051.pc); + cpu8051.pc = ( cpu8051.pc & 0xF800 ) | addr11; + return 2; +} + +/***************************************************************************** + * Instruction "MOVX @R0,A" takes 2 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_F2(void) +{ + unsigned char destination = mem_read_indirect ( mem_read_direct( BANKPSW + _R0_ ) ); + unsigned char source = mem_read_direct( _ACC_ ); + destination = source; + mem_write_indirect( mem_read_direct( BANKPSW + _R0_ ), destination ); + return 2; +} + +/***************************************************************************** + * Instruction "MOVX @R1,A" takes 2 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_F3(void) +{ + unsigned char destination = mem_read_indirect ( mem_read_direct( BANKPSW + _R1_ ) ); + unsigned char source = mem_read_direct( _ACC_ ); + destination = source; + mem_write_indirect( mem_read_direct( BANKPSW + _R1_ ), destination ); + return 2; +} + +/***************************************************************************** + * Instruction "CPL A" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_F4(void) +{ + unsigned char destination = mem_read_direct( _ACC_ ); + destination ^= 0xFF; + mem_write_direct( _ACC_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "MOV direct,A" takes 1 cycle(s) and 2 byte(s). + ****************************************************************************/ +int +cpu8051_OP_F5(void) +{ + unsigned char destaddr = mem_read8( PGM_MEM_ID, cpu8051.pc++ ); + unsigned char destination = mem_read_direct( destaddr ); + unsigned char source = mem_read_direct( _ACC_ ); + destination = source; + mem_write_direct( destaddr, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "MOV @R0,A" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_F6(void) +{ + unsigned char destination = mem_read_indirect ( mem_read_direct( BANKPSW + _R0_ ) ); + unsigned char source = mem_read_direct( _ACC_ ); + destination = source; + mem_write_indirect( mem_read_direct( BANKPSW + _R0_ ), destination ); + return 1; +} + +/***************************************************************************** + * Instruction "MOV @R1,A" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_F7(void) +{ + unsigned char destination = mem_read_indirect ( mem_read_direct( BANKPSW + _R1_ ) ); + unsigned char source = mem_read_direct( _ACC_ ); + destination = source; + mem_write_indirect( mem_read_direct( BANKPSW + _R1_ ), destination ); + return 1; +} + +/***************************************************************************** + * Instruction "MOV R0,A" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_F8(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R0_ ); + unsigned char source = mem_read_direct( _ACC_ ); + destination = source; + mem_write_direct( BANKPSW + _R0_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "MOV R1,A" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_F9(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R1_ ); + unsigned char source = mem_read_direct( _ACC_ ); + destination = source; + mem_write_direct( BANKPSW + _R1_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "MOV R2,A" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_FA(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R2_ ); + unsigned char source = mem_read_direct( _ACC_ ); + destination = source; + mem_write_direct( BANKPSW + _R2_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "MOV R3,A" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_FB(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R3_ ); + unsigned char source = mem_read_direct( _ACC_ ); + destination = source; + mem_write_direct( BANKPSW + _R3_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "MOV R4,A" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_FC(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R4_ ); + unsigned char source = mem_read_direct( _ACC_ ); + destination = source; + mem_write_direct( BANKPSW + _R4_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "MOV R5,A" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_FD(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R5_ ); + unsigned char source = mem_read_direct( _ACC_ ); + destination = source; + mem_write_direct( BANKPSW + _R5_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "MOV R6,A" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_FE(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R6_ ); + unsigned char source = mem_read_direct( _ACC_ ); + destination = source; + mem_write_direct( BANKPSW + _R6_, destination ); + return 1; +} + +/***************************************************************************** + * Instruction "MOV R7,A" takes 1 cycle(s) and 1 byte(s). + ****************************************************************************/ +int +cpu8051_OP_FF(void) +{ + unsigned char destination = mem_read_direct( BANKPSW + _R7_ ); + unsigned char source = mem_read_direct( _ACC_ ); + destination = source; + mem_write_direct( BANKPSW + _R7_, destination ); + return 1; +} + diff -Nru emu8051-1.1.1/src/common/instructions_8051.h emu8051-2.0.1/src/common/instructions_8051.h --- emu8051-1.1.1/src/common/instructions_8051.h 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/common/instructions_8051.h 2014-03-22 18:26:21.000000000 +0000 @@ -0,0 +1,1056 @@ +/* + * instructions_8051.h + * + * Do not modify this file directly, as it was created by opcodes2c.pl + * Any modifications made directly to this file will be lost. + * + * Copyright (C) 1999 Jonathan St-André + * Copyright (C) 1999 Hugo Villeneuve + * + * This file is released under the GPLv2 + */ + +#ifndef INSTRUCTIONS_8051_H +#define INSTRUCTIONS_8051_H 1 + + +#define BANKPSW (mem_read_direct(_PSW_) & 0x18) + +typedef int (*OPCODE_FP)(void); + + +int +cpu8051_OP_00(void); + +int +cpu8051_OP_01(void); + +int +cpu8051_OP_02(void); + +int +cpu8051_OP_03(void); + +int +cpu8051_OP_04(void); + +int +cpu8051_OP_05(void); + +int +cpu8051_OP_06(void); + +int +cpu8051_OP_07(void); + +int +cpu8051_OP_08(void); + +int +cpu8051_OP_09(void); + +int +cpu8051_OP_0A(void); + +int +cpu8051_OP_0B(void); + +int +cpu8051_OP_0C(void); + +int +cpu8051_OP_0D(void); + +int +cpu8051_OP_0E(void); + +int +cpu8051_OP_0F(void); + +int +cpu8051_OP_10(void); + +int +cpu8051_OP_11(void); + +int +cpu8051_OP_12(void); + +int +cpu8051_OP_13(void); + +int +cpu8051_OP_14(void); + +int +cpu8051_OP_15(void); + +int +cpu8051_OP_16(void); + +int +cpu8051_OP_17(void); + +int +cpu8051_OP_18(void); + +int +cpu8051_OP_19(void); + +int +cpu8051_OP_1A(void); + +int +cpu8051_OP_1B(void); + +int +cpu8051_OP_1C(void); + +int +cpu8051_OP_1D(void); + +int +cpu8051_OP_1E(void); + +int +cpu8051_OP_1F(void); + +int +cpu8051_OP_20(void); + +int +cpu8051_OP_21(void); + +int +cpu8051_OP_22(void); + +int +cpu8051_OP_23(void); + +int +cpu8051_OP_24(void); + +int +cpu8051_OP_25(void); + +int +cpu8051_OP_26(void); + +int +cpu8051_OP_27(void); + +int +cpu8051_OP_28(void); + +int +cpu8051_OP_29(void); + +int +cpu8051_OP_2A(void); + +int +cpu8051_OP_2B(void); + +int +cpu8051_OP_2C(void); + +int +cpu8051_OP_2D(void); + +int +cpu8051_OP_2E(void); + +int +cpu8051_OP_2F(void); + +int +cpu8051_OP_30(void); + +int +cpu8051_OP_31(void); + +int +cpu8051_OP_32(void); + +int +cpu8051_OP_33(void); + +int +cpu8051_OP_34(void); + +int +cpu8051_OP_35(void); + +int +cpu8051_OP_36(void); + +int +cpu8051_OP_37(void); + +int +cpu8051_OP_38(void); + +int +cpu8051_OP_39(void); + +int +cpu8051_OP_3A(void); + +int +cpu8051_OP_3B(void); + +int +cpu8051_OP_3C(void); + +int +cpu8051_OP_3D(void); + +int +cpu8051_OP_3E(void); + +int +cpu8051_OP_3F(void); + +int +cpu8051_OP_40(void); + +int +cpu8051_OP_41(void); + +int +cpu8051_OP_42(void); + +int +cpu8051_OP_43(void); + +int +cpu8051_OP_44(void); + +int +cpu8051_OP_45(void); + +int +cpu8051_OP_46(void); + +int +cpu8051_OP_47(void); + +int +cpu8051_OP_48(void); + +int +cpu8051_OP_49(void); + +int +cpu8051_OP_4A(void); + +int +cpu8051_OP_4B(void); + +int +cpu8051_OP_4C(void); + +int +cpu8051_OP_4D(void); + +int +cpu8051_OP_4E(void); + +int +cpu8051_OP_4F(void); + +int +cpu8051_OP_50(void); + +int +cpu8051_OP_51(void); + +int +cpu8051_OP_52(void); + +int +cpu8051_OP_53(void); + +int +cpu8051_OP_54(void); + +int +cpu8051_OP_55(void); + +int +cpu8051_OP_56(void); + +int +cpu8051_OP_57(void); + +int +cpu8051_OP_58(void); + +int +cpu8051_OP_59(void); + +int +cpu8051_OP_5A(void); + +int +cpu8051_OP_5B(void); + +int +cpu8051_OP_5C(void); + +int +cpu8051_OP_5D(void); + +int +cpu8051_OP_5E(void); + +int +cpu8051_OP_5F(void); + +int +cpu8051_OP_60(void); + +int +cpu8051_OP_61(void); + +int +cpu8051_OP_62(void); + +int +cpu8051_OP_63(void); + +int +cpu8051_OP_64(void); + +int +cpu8051_OP_65(void); + +int +cpu8051_OP_66(void); + +int +cpu8051_OP_67(void); + +int +cpu8051_OP_68(void); + +int +cpu8051_OP_69(void); + +int +cpu8051_OP_6A(void); + +int +cpu8051_OP_6B(void); + +int +cpu8051_OP_6C(void); + +int +cpu8051_OP_6D(void); + +int +cpu8051_OP_6E(void); + +int +cpu8051_OP_6F(void); + +int +cpu8051_OP_70(void); + +int +cpu8051_OP_71(void); + +int +cpu8051_OP_72(void); + +int +cpu8051_OP_73(void); + +int +cpu8051_OP_74(void); + +int +cpu8051_OP_75(void); + +int +cpu8051_OP_76(void); + +int +cpu8051_OP_77(void); + +int +cpu8051_OP_78(void); + +int +cpu8051_OP_79(void); + +int +cpu8051_OP_7A(void); + +int +cpu8051_OP_7B(void); + +int +cpu8051_OP_7C(void); + +int +cpu8051_OP_7D(void); + +int +cpu8051_OP_7E(void); + +int +cpu8051_OP_7F(void); + +int +cpu8051_OP_80(void); + +int +cpu8051_OP_81(void); + +int +cpu8051_OP_82(void); + +int +cpu8051_OP_83(void); + +int +cpu8051_OP_84(void); + +int +cpu8051_OP_85(void); + +int +cpu8051_OP_86(void); + +int +cpu8051_OP_87(void); + +int +cpu8051_OP_88(void); + +int +cpu8051_OP_89(void); + +int +cpu8051_OP_8A(void); + +int +cpu8051_OP_8B(void); + +int +cpu8051_OP_8C(void); + +int +cpu8051_OP_8D(void); + +int +cpu8051_OP_8E(void); + +int +cpu8051_OP_8F(void); + +int +cpu8051_OP_90(void); + +int +cpu8051_OP_91(void); + +int +cpu8051_OP_92(void); + +int +cpu8051_OP_93(void); + +int +cpu8051_OP_94(void); + +int +cpu8051_OP_95(void); + +int +cpu8051_OP_96(void); + +int +cpu8051_OP_97(void); + +int +cpu8051_OP_98(void); + +int +cpu8051_OP_99(void); + +int +cpu8051_OP_9A(void); + +int +cpu8051_OP_9B(void); + +int +cpu8051_OP_9C(void); + +int +cpu8051_OP_9D(void); + +int +cpu8051_OP_9E(void); + +int +cpu8051_OP_9F(void); + +int +cpu8051_OP_A0(void); + +int +cpu8051_OP_A1(void); + +int +cpu8051_OP_A2(void); + +int +cpu8051_OP_A3(void); + +int +cpu8051_OP_A4(void); + +int +cpu8051_OP_A5(void); + +int +cpu8051_OP_A6(void); + +int +cpu8051_OP_A7(void); + +int +cpu8051_OP_A8(void); + +int +cpu8051_OP_A9(void); + +int +cpu8051_OP_AA(void); + +int +cpu8051_OP_AB(void); + +int +cpu8051_OP_AC(void); + +int +cpu8051_OP_AD(void); + +int +cpu8051_OP_AE(void); + +int +cpu8051_OP_AF(void); + +int +cpu8051_OP_B0(void); + +int +cpu8051_OP_B1(void); + +int +cpu8051_OP_B2(void); + +int +cpu8051_OP_B3(void); + +int +cpu8051_OP_B4(void); + +int +cpu8051_OP_B5(void); + +int +cpu8051_OP_B6(void); + +int +cpu8051_OP_B7(void); + +int +cpu8051_OP_B8(void); + +int +cpu8051_OP_B9(void); + +int +cpu8051_OP_BA(void); + +int +cpu8051_OP_BB(void); + +int +cpu8051_OP_BC(void); + +int +cpu8051_OP_BD(void); + +int +cpu8051_OP_BE(void); + +int +cpu8051_OP_BF(void); + +int +cpu8051_OP_C0(void); + +int +cpu8051_OP_C1(void); + +int +cpu8051_OP_C2(void); + +int +cpu8051_OP_C3(void); + +int +cpu8051_OP_C4(void); + +int +cpu8051_OP_C5(void); + +int +cpu8051_OP_C6(void); + +int +cpu8051_OP_C7(void); + +int +cpu8051_OP_C8(void); + +int +cpu8051_OP_C9(void); + +int +cpu8051_OP_CA(void); + +int +cpu8051_OP_CB(void); + +int +cpu8051_OP_CC(void); + +int +cpu8051_OP_CD(void); + +int +cpu8051_OP_CE(void); + +int +cpu8051_OP_CF(void); + +int +cpu8051_OP_D0(void); + +int +cpu8051_OP_D1(void); + +int +cpu8051_OP_D2(void); + +int +cpu8051_OP_D3(void); + +int +cpu8051_OP_D4(void); + +int +cpu8051_OP_D5(void); + +int +cpu8051_OP_D6(void); + +int +cpu8051_OP_D7(void); + +int +cpu8051_OP_D8(void); + +int +cpu8051_OP_D9(void); + +int +cpu8051_OP_DA(void); + +int +cpu8051_OP_DB(void); + +int +cpu8051_OP_DC(void); + +int +cpu8051_OP_DD(void); + +int +cpu8051_OP_DE(void); + +int +cpu8051_OP_DF(void); + +int +cpu8051_OP_E0(void); + +int +cpu8051_OP_E1(void); + +int +cpu8051_OP_E2(void); + +int +cpu8051_OP_E3(void); + +int +cpu8051_OP_E4(void); + +int +cpu8051_OP_E5(void); + +int +cpu8051_OP_E6(void); + +int +cpu8051_OP_E7(void); + +int +cpu8051_OP_E8(void); + +int +cpu8051_OP_E9(void); + +int +cpu8051_OP_EA(void); + +int +cpu8051_OP_EB(void); + +int +cpu8051_OP_EC(void); + +int +cpu8051_OP_ED(void); + +int +cpu8051_OP_EE(void); + +int +cpu8051_OP_EF(void); + +int +cpu8051_OP_F0(void); + +int +cpu8051_OP_F1(void); + +int +cpu8051_OP_F2(void); + +int +cpu8051_OP_F3(void); + +int +cpu8051_OP_F4(void); + +int +cpu8051_OP_F5(void); + +int +cpu8051_OP_F6(void); + +int +cpu8051_OP_F7(void); + +int +cpu8051_OP_F8(void); + +int +cpu8051_OP_F9(void); + +int +cpu8051_OP_FA(void); + +int +cpu8051_OP_FB(void); + +int +cpu8051_OP_FC(void); + +int +cpu8051_OP_FD(void); + +int +cpu8051_OP_FE(void); + +int +cpu8051_OP_FF(void); + + +/* Exported variables. */ +#ifdef INSTRUCTIONS_8051_M +OPCODE_FP opcode_table[256] = { + cpu8051_OP_00, + cpu8051_OP_01, + cpu8051_OP_02, + cpu8051_OP_03, + cpu8051_OP_04, + cpu8051_OP_05, + cpu8051_OP_06, + cpu8051_OP_07, + cpu8051_OP_08, + cpu8051_OP_09, + cpu8051_OP_0A, + cpu8051_OP_0B, + cpu8051_OP_0C, + cpu8051_OP_0D, + cpu8051_OP_0E, + cpu8051_OP_0F, + cpu8051_OP_10, + cpu8051_OP_11, + cpu8051_OP_12, + cpu8051_OP_13, + cpu8051_OP_14, + cpu8051_OP_15, + cpu8051_OP_16, + cpu8051_OP_17, + cpu8051_OP_18, + cpu8051_OP_19, + cpu8051_OP_1A, + cpu8051_OP_1B, + cpu8051_OP_1C, + cpu8051_OP_1D, + cpu8051_OP_1E, + cpu8051_OP_1F, + cpu8051_OP_20, + cpu8051_OP_21, + cpu8051_OP_22, + cpu8051_OP_23, + cpu8051_OP_24, + cpu8051_OP_25, + cpu8051_OP_26, + cpu8051_OP_27, + cpu8051_OP_28, + cpu8051_OP_29, + cpu8051_OP_2A, + cpu8051_OP_2B, + cpu8051_OP_2C, + cpu8051_OP_2D, + cpu8051_OP_2E, + cpu8051_OP_2F, + cpu8051_OP_30, + cpu8051_OP_31, + cpu8051_OP_32, + cpu8051_OP_33, + cpu8051_OP_34, + cpu8051_OP_35, + cpu8051_OP_36, + cpu8051_OP_37, + cpu8051_OP_38, + cpu8051_OP_39, + cpu8051_OP_3A, + cpu8051_OP_3B, + cpu8051_OP_3C, + cpu8051_OP_3D, + cpu8051_OP_3E, + cpu8051_OP_3F, + cpu8051_OP_40, + cpu8051_OP_41, + cpu8051_OP_42, + cpu8051_OP_43, + cpu8051_OP_44, + cpu8051_OP_45, + cpu8051_OP_46, + cpu8051_OP_47, + cpu8051_OP_48, + cpu8051_OP_49, + cpu8051_OP_4A, + cpu8051_OP_4B, + cpu8051_OP_4C, + cpu8051_OP_4D, + cpu8051_OP_4E, + cpu8051_OP_4F, + cpu8051_OP_50, + cpu8051_OP_51, + cpu8051_OP_52, + cpu8051_OP_53, + cpu8051_OP_54, + cpu8051_OP_55, + cpu8051_OP_56, + cpu8051_OP_57, + cpu8051_OP_58, + cpu8051_OP_59, + cpu8051_OP_5A, + cpu8051_OP_5B, + cpu8051_OP_5C, + cpu8051_OP_5D, + cpu8051_OP_5E, + cpu8051_OP_5F, + cpu8051_OP_60, + cpu8051_OP_61, + cpu8051_OP_62, + cpu8051_OP_63, + cpu8051_OP_64, + cpu8051_OP_65, + cpu8051_OP_66, + cpu8051_OP_67, + cpu8051_OP_68, + cpu8051_OP_69, + cpu8051_OP_6A, + cpu8051_OP_6B, + cpu8051_OP_6C, + cpu8051_OP_6D, + cpu8051_OP_6E, + cpu8051_OP_6F, + cpu8051_OP_70, + cpu8051_OP_71, + cpu8051_OP_72, + cpu8051_OP_73, + cpu8051_OP_74, + cpu8051_OP_75, + cpu8051_OP_76, + cpu8051_OP_77, + cpu8051_OP_78, + cpu8051_OP_79, + cpu8051_OP_7A, + cpu8051_OP_7B, + cpu8051_OP_7C, + cpu8051_OP_7D, + cpu8051_OP_7E, + cpu8051_OP_7F, + cpu8051_OP_80, + cpu8051_OP_81, + cpu8051_OP_82, + cpu8051_OP_83, + cpu8051_OP_84, + cpu8051_OP_85, + cpu8051_OP_86, + cpu8051_OP_87, + cpu8051_OP_88, + cpu8051_OP_89, + cpu8051_OP_8A, + cpu8051_OP_8B, + cpu8051_OP_8C, + cpu8051_OP_8D, + cpu8051_OP_8E, + cpu8051_OP_8F, + cpu8051_OP_90, + cpu8051_OP_91, + cpu8051_OP_92, + cpu8051_OP_93, + cpu8051_OP_94, + cpu8051_OP_95, + cpu8051_OP_96, + cpu8051_OP_97, + cpu8051_OP_98, + cpu8051_OP_99, + cpu8051_OP_9A, + cpu8051_OP_9B, + cpu8051_OP_9C, + cpu8051_OP_9D, + cpu8051_OP_9E, + cpu8051_OP_9F, + cpu8051_OP_A0, + cpu8051_OP_A1, + cpu8051_OP_A2, + cpu8051_OP_A3, + cpu8051_OP_A4, + cpu8051_OP_A5, + cpu8051_OP_A6, + cpu8051_OP_A7, + cpu8051_OP_A8, + cpu8051_OP_A9, + cpu8051_OP_AA, + cpu8051_OP_AB, + cpu8051_OP_AC, + cpu8051_OP_AD, + cpu8051_OP_AE, + cpu8051_OP_AF, + cpu8051_OP_B0, + cpu8051_OP_B1, + cpu8051_OP_B2, + cpu8051_OP_B3, + cpu8051_OP_B4, + cpu8051_OP_B5, + cpu8051_OP_B6, + cpu8051_OP_B7, + cpu8051_OP_B8, + cpu8051_OP_B9, + cpu8051_OP_BA, + cpu8051_OP_BB, + cpu8051_OP_BC, + cpu8051_OP_BD, + cpu8051_OP_BE, + cpu8051_OP_BF, + cpu8051_OP_C0, + cpu8051_OP_C1, + cpu8051_OP_C2, + cpu8051_OP_C3, + cpu8051_OP_C4, + cpu8051_OP_C5, + cpu8051_OP_C6, + cpu8051_OP_C7, + cpu8051_OP_C8, + cpu8051_OP_C9, + cpu8051_OP_CA, + cpu8051_OP_CB, + cpu8051_OP_CC, + cpu8051_OP_CD, + cpu8051_OP_CE, + cpu8051_OP_CF, + cpu8051_OP_D0, + cpu8051_OP_D1, + cpu8051_OP_D2, + cpu8051_OP_D3, + cpu8051_OP_D4, + cpu8051_OP_D5, + cpu8051_OP_D6, + cpu8051_OP_D7, + cpu8051_OP_D8, + cpu8051_OP_D9, + cpu8051_OP_DA, + cpu8051_OP_DB, + cpu8051_OP_DC, + cpu8051_OP_DD, + cpu8051_OP_DE, + cpu8051_OP_DF, + cpu8051_OP_E0, + cpu8051_OP_E1, + cpu8051_OP_E2, + cpu8051_OP_E3, + cpu8051_OP_E4, + cpu8051_OP_E5, + cpu8051_OP_E6, + cpu8051_OP_E7, + cpu8051_OP_E8, + cpu8051_OP_E9, + cpu8051_OP_EA, + cpu8051_OP_EB, + cpu8051_OP_EC, + cpu8051_OP_ED, + cpu8051_OP_EE, + cpu8051_OP_EF, + cpu8051_OP_F0, + cpu8051_OP_F1, + cpu8051_OP_F2, + cpu8051_OP_F3, + cpu8051_OP_F4, + cpu8051_OP_F5, + cpu8051_OP_F6, + cpu8051_OP_F7, + cpu8051_OP_F8, + cpu8051_OP_F9, + cpu8051_OP_FA, + cpu8051_OP_FB, + cpu8051_OP_FC, + cpu8051_OP_FD, + cpu8051_OP_FE, + cpu8051_OP_FF, +}; +#else +OPCODE_FP opcode_table[256]; +#endif + + +#endif /* INSTRUCTIONS_8051_H */ diff -Nru emu8051-1.1.1/src/common/log.c emu8051-2.0.1/src/common/log.c --- emu8051-1.1.1/src/common/log.c 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/common/log.c 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,126 @@ +/* + * log.c -- debug functions for logging. + * + * Copyright (C) 2011 Hugo Villeneuve + * + * This file is released under the GPLv2 + */ + +#include "config.h" + +#include +#include +#include +#include + +#include "common.h" +#include "options.h" + +#define PREFIX_PACKAGE_NAME 1 +#define ADD_LINEFEED 1 + +extern struct options_t options; + +static void +log_prefix_package_name(FILE *stream, const char *severity) +{ +#if PREFIX_PACKAGE_NAME + /* Printing the name of the program first if desired. */ + fprintf(stream, "%s %s: ", PACKAGE_NAME, severity); +#endif /* PREFIX_PACKAGE_NAME */ +} + +static void +log_suffix_newline(FILE *stream) +{ +#if ADD_LINEFEED + fprintf(stream, "\n"); +#endif /* ADD_LINEFEED */ +} + +void +log_debug(const char *format, ...) +{ + FILE *stream = stdout; + + if (options.log >= LOG_LEVEL_DEBUG) { + va_list ap; + + log_prefix_package_name(stream, "debug"); + + va_start(ap, format); + (void) vfprintf(stream, format, ap); + va_end(ap); + + log_suffix_newline(stream); + } +} + +void +log_info(const char *format, ...) +{ + FILE *stream = stdout; + + if (options.log >= LOG_LEVEL_INFO) { + va_list ap; + + log_prefix_package_name(stream, "info"); + + va_start(ap, format); + (void) vfprintf(stream, format, ap); + va_end(ap); + + log_suffix_newline(stream); + } +} + +void +log_warn(const char *format, ...) +{ + FILE *stream = stderr; + + if (options.log >= LOG_LEVEL_WARN) { + va_list ap; + + log_prefix_package_name(stream, "warn"); + + va_start(ap, format); + (void) vfprintf(stream, format, ap); + va_end(ap); + + log_suffix_newline(stream); + } +} + +void +log_err(const char *format, ...) +{ + FILE *stream = stderr; + va_list ap; + + log_prefix_package_name(stream, "error"); + + va_start(ap, format); + (void) vfprintf(stream, format, ap); + va_end(ap); + + log_suffix_newline(stream); +} + +/* Log error message and exits with error code. */ +void +log_fail(const char *format, ...) +{ + FILE *stream = stderr; + va_list ap; + + log_prefix_package_name(stream, "error"); + + va_start(ap, format); + (void) vfprintf(stream, format, ap); + va_end(ap); + + log_suffix_newline(stream); + + exit(EXIT_FAILURE); +} diff -Nru emu8051-1.1.1/src/common/log.h emu8051-2.0.1/src/common/log.h --- emu8051-1.1.1/src/common/log.h 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/common/log.h 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,43 @@ +/* + * log.h + * + * Copyright (C) 2011 Hugo Villeneuve + * + * This file is released under the GPLv2 + */ + +#ifndef LOG_H +#define LOG_H 1 + +#include +#include +#include +#include +#include + +#include "common.h" + +enum LOG_LEVEL { + LOG_LEVEL_ERR = 0, /* Display only errors */ + LOG_LEVEL_WARN, /* Display warnings */ + LOG_LEVEL_INFO, /* Display information messages */ + LOG_LEVEL_DEBUG, /* Display all messages */ +}; + +void +log_debug(const char *format, ...); + +void +log_info(const char *format, ...); + +void +log_warn(const char *format, ...); + +void +log_err(const char *format, ...); + +/* Log error message and exits with error code. */ +void +log_fail(const char *format, ...); + +#endif /* LOG_H */ diff -Nru emu8051-1.1.1/src/common/Makefile.am emu8051-2.0.1/src/common/Makefile.am --- emu8051-1.1.1/src/common/Makefile.am 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/common/Makefile.am 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,40 @@ +# This file is processed by GNU automake to generate Makefile.in + +AM_CPPFLAGS = \ + $(WARNINGCFLAGS) \ + -I$(top_srcdir) + +noinst_LIBRARIES = libemu8051.a + +libemu8051_a_SOURCES = \ + instructions_8051.c instructions_8051.h \ + opcodes.c opcodes.h \ + options.c options.h \ + log.c log.h \ + hexfile.c hexfile.h \ + cpu8051.c cpu8051.h \ + memory.c memory.h \ + psw.c psw.h \ + sfr.c sfr.h \ + operations.c operations.h \ + timers.c timers.h \ + common.h \ + reg8051.h + +# These files are generated automatically by a perl script. +instructions_8051.c instructions_8051.h opcodes.h opcodes.c : opcodes2c.pl opcodes.lst + @echo " PERL opcodes2c.pl" + @./opcodes2c.pl + +CLEANFILES = *~ + +MAINTAINERCLEANFILES = \ + Makefile.in \ + instructions_8051.c \ + instructions_8051.h \ + opcodes.h \ + opcodes.c + +EXTRA_DIST = \ + opcodes2c.pl \ + opcodes.lst diff -Nru emu8051-1.1.1/src/common/Makefile.in emu8051-2.0.1/src/common/Makefile.in --- emu8051-1.1.1/src/common/Makefile.in 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/common/Makefile.in 2014-03-22 18:26:16.000000000 +0000 @@ -0,0 +1,588 @@ +# Makefile.in generated by automake 1.14 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 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@ + +# This file is processed by GNU automake to generate Makefile.in + +VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +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 = : +subdir = src/common +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(top_srcdir)/build-aux/depcomp +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LIBRARIES = $(noinst_LIBRARIES) +ARFLAGS = cru +AM_V_AR = $(am__v_AR_@AM_V@) +am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@) +am__v_AR_0 = @echo " AR " $@; +am__v_AR_1 = +libemu8051_a_AR = $(AR) $(ARFLAGS) +libemu8051_a_LIBADD = +am_libemu8051_a_OBJECTS = instructions_8051.$(OBJEXT) \ + opcodes.$(OBJEXT) options.$(OBJEXT) log.$(OBJEXT) \ + hexfile.$(OBJEXT) cpu8051.$(OBJEXT) memory.$(OBJEXT) \ + psw.$(OBJEXT) sfr.$(OBJEXT) operations.$(OBJEXT) \ + timers.$(OBJEXT) +libemu8051_a_OBJECTS = $(am_libemu8051_a_OBJECTS) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libemu8051_a_SOURCES) +DIST_SOURCES = $(libemu8051_a_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS504_CHECK = @AS504_CHECK@ +ASEM51_CHECK = @ASEM51_CHECK@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GREP = @GREP@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_LIBS = @GTK_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBOBJS = @LIBOBJS@ +LIBREADLINE = @LIBREADLINE@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +OBJEXT = @OBJEXT@ +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@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +WARNINGCFLAGS = @WARNINGCFLAGS@ +YACC = @YACC@ +YFLAGS = @YFLAGS@ +ZLIB_LIBS = @ZLIB_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_aux_dir = @ac_aux_dir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +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_alias = @build_alias@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host_alias = @host_alias@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +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_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +zlib_CFLAGS = @zlib_CFLAGS@ +zlib_LIBS = @zlib_LIBS@ +AM_CPPFLAGS = \ + $(WARNINGCFLAGS) \ + -I$(top_srcdir) + +noinst_LIBRARIES = libemu8051.a +libemu8051_a_SOURCES = \ + instructions_8051.c instructions_8051.h \ + opcodes.c opcodes.h \ + options.c options.h \ + log.c log.h \ + hexfile.c hexfile.h \ + cpu8051.c cpu8051.h \ + memory.c memory.h \ + psw.c psw.h \ + sfr.c sfr.h \ + operations.c operations.h \ + timers.c timers.h \ + common.h \ + reg8051.h + +CLEANFILES = *~ +MAINTAINERCLEANFILES = \ + Makefile.in \ + instructions_8051.c \ + instructions_8051.h \ + opcodes.h \ + opcodes.c + +EXTRA_DIST = \ + opcodes2c.pl \ + opcodes.lst + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .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/common/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/common/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) + +libemu8051.a: $(libemu8051_a_OBJECTS) $(libemu8051_a_DEPENDENCIES) $(EXTRA_libemu8051_a_DEPENDENCIES) + $(AM_V_at)-rm -f libemu8051.a + $(AM_V_AR)$(libemu8051_a_AR) libemu8051.a $(libemu8051_a_OBJECTS) $(libemu8051_a_LIBADD) + $(AM_V_at)$(RANLIB) libemu8051.a + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu8051.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hexfile.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/instructions_8051.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memory.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/opcodes.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/operations.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/options.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/psw.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sfr.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timers.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + 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-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + 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" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +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: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +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." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic 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 + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ + clean-noinstLIBRARIES cscopelist-am ctags ctags-am distclean \ + distclean-compile distclean-generic 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 pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am + + +# These files are generated automatically by a perl script. +instructions_8051.c instructions_8051.h opcodes.h opcodes.c : opcodes2c.pl opcodes.lst + @echo " PERL opcodes2c.pl" + @./opcodes2c.pl + +# 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 -Nru emu8051-1.1.1/src/common/memory.c emu8051-2.0.1/src/common/memory.c --- emu8051-1.1.1/src/common/memory.c 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/common/memory.c 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,340 @@ +/* + * memory.c + * + * Copyright (C) 1999 Jonathan St-André + * Copyright (C) 1999 Hugo Villeneuve + * + * This file is released under the GPLv2 + */ + +#include +#include +#include + +#include "common.h" +#include "cpu8051.h" +#include "reg8051.h" +#include "hexfile.h" +#include "memory.h" +#include "options.h" + +struct mem_infos_t { + int size; + int max_size; + uint8_t *buf; +}; + +struct mem_infos_t mem_infos[MEM_ID_COUNT]; + +extern struct options_t options; + +/* Init each 8051 memory sections. */ +void +mem_init(void) +{ + int k; + struct mem_infos_t *m; + + /* Set desired and maximum allowable sizes for each memory type. */ + mem_infos[PGM_MEM_ID].size = options.pram_size; + mem_infos[PGM_MEM_ID].max_size = PGM_MEM_MAX_SIZE; + + mem_infos[INT_MEM_ID].size = options.iram_size; + mem_infos[INT_MEM_ID].max_size = INT_MEM_MAX_SIZE; + + mem_infos[EXT_MEM_ID].size = options.xram_size; + mem_infos[EXT_MEM_ID].max_size = EXT_MEM_MAX_SIZE; + + /* Verify if desired sizes are valid, and if so allocate memory. */ + for (k = 0; k < MEM_ID_COUNT; k++) { + m = &mem_infos[k]; + + if (m->size > m->max_size) { + log_fail("Memory size invalid (max = %d)", m->max_size); + } + + m->buf = malloc(m->size); + if (m->buf == NULL) { + log_fail("%s", strerror(errno)); + } + + memset(m->buf, 0x00, m->size); + } +} + +/* Return true if address is valid, false otherwise. */ +int +mem_check_address(enum mem_id_t id, unsigned long address, int display_error) +{ + if (address >= (unsigned long) mem_infos[id].max_size) { + if (display_error == DISPLAY_ERROR_YES) + log_err("Address out of range ($%X >= $%X", address, + mem_infos[id].max_size - 1); + return false; + } else { + return true; + } +} + +void +mem_convert_bit_address(uint8_t bit_address, uint8_t *byte_address, + uint8_t *bit_number) +{ + if (bit_address > 0x7F) { + /* SFR 80-FF */ + *byte_address = bit_address & 0xF8; + *bit_number = bit_address & 0x07; + } else { + /* 20-2F */ + *byte_address = (bit_address >> 3) + 0x20; + *bit_number = bit_address & 0x07; + } +} + +uint8_t * +mem_getbuf(enum mem_id_t id, unsigned long address) +{ + return &mem_infos[id].buf[address]; +} + +void +mem_clear(enum mem_id_t id) +{ + memset(mem_infos[id].buf, 0, mem_infos[id].size); +} + +void +mem_write8(enum mem_id_t id, unsigned long address, uint8_t value) +{ + if (address >= (unsigned long) mem_infos[id].max_size) { + log_err("Error writing to memory ID: %d\n" + " Address (%lu) greater than maximum memory size", + id, address); + return; + } else { + mem_infos[id].buf[address] = value; + } +} + +/* Write with a direct addressing mode at Address the new Value */ +void +mem_write_direct(unsigned int address, unsigned char value) +{ + mem_write8(INT_MEM_ID, address, value); +} + +/* Write with an indirect addressing mode at Address the new Value */ +void +mem_write_indirect(unsigned int address, unsigned char value) +{ + if (address > 0x7F) { + mem_write8(EXT_MEM_ID, address, value); + return; + } + + mem_write8(INT_MEM_ID, address, value); +} + +/* Write with a bit addressing mode at BitAddress the new Value */ +void +mem_write_bit(uint8_t bit_address, uint8_t value) +{ + uint8_t byte_address; + uint8_t bit_number; + unsigned char byte_val, byte_mask; + + mem_convert_bit_address(bit_address, &byte_address, &bit_number); + + byte_mask = ((1 << bit_number) ^ 0xFF); + byte_val = mem_read_direct(byte_address) & byte_mask; + byte_val += value << bit_number; + mem_write_direct(byte_address, byte_val); +} + +void +mem_sfr_write8(unsigned long address, uint8_t value) +{ + /* SFR registers are from addresses $80 to $FF. */ + mem_write8(INT_MEM_ID, address, value); +} + +void +mem_sfr_write_dptr(uint16_t value) +{ + mem_write8(INT_MEM_ID, _DPTRHIGH_, value >> 8); + mem_write8(INT_MEM_ID, _DPTRLOW_, (uint8_t) value); +} + +uint8_t +mem_read8(enum mem_id_t id, unsigned long address) +{ + if (address >= (unsigned long) mem_infos[id].max_size) { + log_err("Error reading from memory ID: %d\n" + " Address (%lu) greater than maximum memory size", + id, address); + return 0; + } else { + return mem_infos[id].buf[address]; + } +} + +/* Read with a direct addressing mode at Address */ +unsigned char +mem_read_direct(unsigned int address) +{ + if (address > 0xFF) + return mem_read8(EXT_MEM_ID, address); + else + return mem_read8(INT_MEM_ID, address); +} + +/* Read with a indirect addressing mode at Address */ +unsigned char +mem_read_indirect(unsigned int address) +{ + if (address > 0x7F) + return mem_read8(EXT_MEM_ID, address); + else + return mem_read8(INT_MEM_ID, address); +} + +/* Read with a bit addressing mode at bit_address */ +unsigned char +mem_read_bit(uint8_t bit_address) +{ + uint8_t byte_address; + uint8_t bit_number; + unsigned char bit_value; + + mem_convert_bit_address(bit_address, &byte_address, &bit_number); + + bit_value = (mem_read_direct(byte_address) >> bit_number); + bit_value &= 1; + return bit_value; +} + +uint8_t +mem_sfr_read8(unsigned long address) +{ + /* SFR registers are from addresses $80 to $FF. */ + return mem_read8(INT_MEM_ID, address); +} + +uint16_t +mem_sfr_read_dptr(void) +{ + return (mem_read8(INT_MEM_ID, _DPTRHIGH_) << 8) + + mem_read8(INT_MEM_ID, _DPTRLOW_); +} + +void +stack_push8(uint8_t value) +{ + uint8_t sp; + + sp = mem_read8(INT_MEM_ID, _SP_); + + mem_write8(INT_MEM_ID, ++sp, value); + mem_write8(INT_MEM_ID, _SP_, sp); /* Save new stack pointer */ +} + +void +stack_push16(uint16_t value) +{ + uint8_t sp; + + sp = mem_read8(INT_MEM_ID, _SP_); + + mem_write8(INT_MEM_ID, ++sp, (uint8_t) value); /* Write LSB */ + mem_write8(INT_MEM_ID, ++sp, value >> 8); /* Write MSB */ + mem_write8(INT_MEM_ID, _SP_, sp); /* Save new stack pointer */ +} + +uint8_t +stack_pop8(void) +{ + uint8_t sp; + uint8_t value; + + sp = mem_read8(INT_MEM_ID, _SP_); + + value = mem_read8(INT_MEM_ID, sp--); + mem_write8(INT_MEM_ID, _SP_, sp); /* Save new stack pointer */ + + return value; +} + +uint16_t +stack_pop16(void) +{ + uint8_t sp; + uint16_t value; + + sp = mem_read8(INT_MEM_ID, _SP_); + + value = mem_read8(INT_MEM_ID, sp--) << 8; /* Read MSB */ + value |= mem_read8(INT_MEM_ID, sp--); /* Read LSB */ + mem_write8(INT_MEM_ID, _SP_, sp); /* Save new stack pointer */ + + return value; +} + +/* Read a 16-bit address from PGM memory, starting at offset */ +uint16_t +pgm_read_addr16(uint16_t base) +{ + uint16_t addr; + + addr = mem_read8(PGM_MEM_ID, base) << 8; /* MSB */ + addr |= mem_read8(PGM_MEM_ID, base + 1); /* LSB */ + + return addr; +} + +/* Dump memory */ +void +mem_dump(unsigned int address, int size, enum mem_id_t id) +{ + int rc; + int offset, col; + + if (size == 0) { + log_err("invalid size: 0"); + return; + } + + /* Validate start address. */ + rc = mem_check_address(id, address, DISPLAY_ERROR_YES); + if (!rc) { + /* Validate end address. */ + rc = mem_check_address(id, address + (size - 1), + DISPLAY_ERROR_NO); + if (!rc) + log_err("Trying to read beyond memory limit"); + } + + if (!rc) + return; + + for (offset = 0; offset < size; offset += 16) { + uint8_t data[16]; + + printf("%.4X ", address + offset); + + for (col = 0; col < 16; col++) { + data[col] = mem_read8(id, address + offset + col); + printf(" %.2X", data[col]); + } + printf(" "); + + /* Display any ASCII characters */ + for (col = 0; col < 16; col++) { + if ((int) data[col] >= 32 && + (int) data[col] <= 126) + printf("%c", (char) data[col]); + else + printf("."); + } + printf("\n"); + } +} diff -Nru emu8051-1.1.1/src/common/memory.h emu8051-2.0.1/src/common/memory.h --- emu8051-1.1.1/src/common/memory.h 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/common/memory.h 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,107 @@ +/* + * memory.h + * + * Copyright (C) 1999 Jonathan St-André + * Copyright (C) 1999 Hugo Villeneuve + * + * This file is released under the GPLv2 + */ + +#ifndef MEMORY_H +#define MEMORY_H 1 + +#include + +#define PGM_MEM_MAX_SIZE 65536 +/* + * Direct addressing $00 to $7F = IRAM (8051) + * Direct addressing $80 to $FF = SFR (8051) + * Indirect addressing $80 to $FF = IRAM (8052) + */ +#define INT_MEM_MAX_SIZE 256 +#define EXT_MEM_MAX_SIZE 65536 + +#define PGM_MEM_DEFAULT_SIZE PGM_MEM_MAX_SIZE +#define EXT_MEM_DEFAULT_SIZE 256 + +enum mem_id_t { + PGM_MEM_ID, + INT_MEM_ID, + EXT_MEM_ID, + MEM_ID_COUNT +}; + +#define DISPLAY_ERROR_NO 0 +#define DISPLAY_ERROR_YES 1 + +void +mem_init(void); + +int +mem_check_address(enum mem_id_t id, unsigned long address, int display_error); + +void +mem_convert_bit_address(uint8_t bit_address, uint8_t *byte_address, + uint8_t *bit_number); + +uint8_t * +mem_getbuf(enum mem_id_t id, unsigned long address); + +void +mem_clear(enum mem_id_t id); + +void +mem_write8(enum mem_id_t id, unsigned long address, uint8_t value); + +void +mem_write_direct(unsigned int address, unsigned char value); + +void +mem_write_indirect(unsigned int address, unsigned char value); + +void +mem_write_bit(uint8_t bit_address, uint8_t value); + +void +mem_sfr_write8(unsigned long address, uint8_t value); + +void +mem_sfr_write_dptr(uint16_t value); + +uint8_t +mem_read8(enum mem_id_t id, unsigned long address); + +unsigned char +mem_read_direct(unsigned int address); + +unsigned char +mem_read_indirect(unsigned int address); + +unsigned char +mem_read_bit(uint8_t bit_address); + +uint8_t +mem_sfr_read8(unsigned long address); + +uint16_t +mem_sfr_read_dptr(void); + +void +stack_push8(uint8_t value); + +void +stack_push16(uint16_t value); + +uint8_t +stack_pop8(void); + +uint16_t +stack_pop16(void); + +uint16_t +pgm_read_addr16(uint16_t base); + +void +mem_dump(unsigned int address, int size, enum mem_id_t id); + +#endif /* MEMORY_H */ diff -Nru emu8051-1.1.1/src/common/opcodes2c.pl emu8051-2.0.1/src/common/opcodes2c.pl --- emu8051-1.1.1/src/common/opcodes2c.pl 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/common/opcodes2c.pl 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,901 @@ +#!/usr/bin/perl +# +# Copyright (C) 1999 Jonathan St-André +# Copyright (C) 1999 Hugo Villeneuve +# +# This file is released under the GPLv2 + +open INST_DEF, ">instructions_8051.h" or die "Error creating : $!\n"; +open INST_IMP, ">instructions_8051.c" or die "Error creating : $!\n"; +open OPCODELST, "opcodes.lst" or die "Error opening : $!\n"; +open OPCODES_DEF, ">opcodes.h" or die "Error creating : $!\n"; +open OPCODES_IMP, ">opcodes.c" or die "Error creating : $!\n"; + +# Write GPL license +# Argument 0 is file descriptor +sub write_header +{ + my $fd = $_[0]; + + print $fd " *\n"; + print $fd " * Do not modify this file directly, as it was created by opcodes2c.pl\n"; + print $fd " * Any modifications made directly to this file will be lost.\n"; + print $fd " *\n"; + print $fd " * Copyright (C) 1999 Jonathan St-André\n"; + print $fd " * Copyright (C) 1999 Hugo Villeneuve \n"; + print $fd " *\n"; + print $fd " * This file is released under the GPLv2\n"; + print $fd " */\n\n"; +} + +# Write C function source code line to INST_IMP file. +# Prefix each line with a tab (indentation) and add newline character at the end. +sub cfw +{ + print INST_IMP "\t",$_[0],"\n"; +} + +# Header for instructions_8051.c +print INST_IMP "/*\n"; +print INST_IMP " * instructions_8051.c\n"; +write_header(INST_IMP); +print INST_IMP "/* Define only here, for not having extern scope on local variables. */\n"; +print INST_IMP "#define INSTRUCTIONS_8051_M 1\n\n\n"; +print INST_IMP "#include \"reg8051.h\"\n"; +print INST_IMP "#include \"cpu8051.h\"\n"; +print INST_IMP "#include \"memory.h\"\n"; +print INST_IMP "#include \"psw.h\"\n"; +print INST_IMP "#include \"operations.h\"\n"; +print INST_IMP "#include \"instructions_8051.h\"\n\n\n"; + +# Header for opcodes.h +print OPCODES_DEF "/*\n"; +print OPCODES_DEF " * opcodes.h\n"; +write_header(OPCODES_DEF); +print OPCODES_DEF "#ifndef OPCODES_H\n"; +print OPCODES_DEF "#define OPCODES_H 1\n\n"; + +print OPCODES_DEF "int\n"; +print OPCODES_DEF "opcodes_get_instr_size(uint8_t opcode);\n"; +print OPCODES_DEF "char *\n"; +print OPCODES_DEF "opcodes_get_instr_type_str(uint8_t opcode);\n"; +print OPCODES_DEF "int\n"; +print OPCODES_DEF "opcodes_get_instr_arg_type_id(unsigned int offset);\n"; +print OPCODES_DEF "char *\n"; +print OPCODES_DEF "opcodes_get_instr_arg_type_str(unsigned int offset);\n"; + +# opcodes.c +print OPCODES_IMP "/*\n"; +print OPCODES_IMP " * opcodes.c\n"; +write_header(OPCODES_IMP); +print OPCODES_IMP "#include \n\n"; + +# Column indexes in opcodes.lst table +use constant COL_OPCODE => 0; +use constant COL_INSTR => 1; +use constant COL_ARGS => 2; + +use constant COL_COUNT_NO_ARGS => 4; + +$nbinst=0; +$nbaddr=0; +$nbargs=0; +$instnumb=0; + +# Read file describing each instruction/opcode + +# Discard first two lines, which are comments +$ligne = ; +$ligne = ; + +while($ligne=) { + chop $ligne; + + if (length $ligne < 2) { + next; + } + + @wordlist = split ' ',$ligne; + $nbword = @wordlist; + $instruction = $wordlist[COL_INSTR]; + + for ($i = (COL_INSTR + 1); $i < ($nbword - 2); $i++) { + $instruction = "$instruction $wordlist[$i]"; + } + + $a_instruction[$instnumb] = $instruction; + $a_bytes[$instnumb] = $wordlist[$nbword - 2]; + $a_cycles[$instnumb] = $wordlist[$nbword - 1]; + $a_opcodehex[$instnumb] = $wordlist[COL_OPCODE]; + + $instfunction[$instnumb] = "CPU8051::OP_$wordlist[COL_OPCODE]"; + + $instargs[$instnumb << 2] = $instargs[($instnumb << 2) + 1] = + $instargs[($instnumb << 2) + 2] = $instargs[($instnumb << 2) + 3] = 0; + + if ($nbword > COL_COUNT_NO_ARGS) { + @argslist = split /\,/,$wordlist[COL_ARGS]; + $argslistsize = @argslist; + $instargs[$instnumb << 2] = $argslistsize; + for ($i = 0; $i < $argslistsize; $i++) { + if (not exists $argstypes{$argslist[$i]}) { + $argstypes[$nbargs] = $argslist[$i]; + $argstypes{$argslist[$i]} = $nbargs++; + } + $instargs[($instnumb << 2) + $i + 1] = $argstypes{$argslist[$i]}; + } + } + + if (not exists $insttext{$wordlist[COL_INSTR]}) { + $insttext[$nbinst] = $wordlist[COL_INSTR]; + $insttext{$wordlist[COL_INSTR]} = $nbinst++; + } + + $insttype[$instnumb] = $insttext{$wordlist[COL_INSTR]}; + + if (not exists $addrmode{$wordlist[COL_ARGS]}) { + $addrmode[$nbaddr] = $wordlist[COL_ARGS]; + $addrmode{$wordlist[COL_ARGS]} = $nbaddr++; + } + + $nbbytes[$instnumb] = $wordlist[$nbword - 2]; + + $instaddr[$instnumb] = $addrmode{$wordlist[COL_ARGS]}; + + $instnumb++; +} + +# ------------------------------------------------------------------------------ +print OPCODES_IMP "/* Size(in bytes) of each instruction (offset in table is instruction opcode) */\n"; + +$nbelement = @nbbytes; + +print OPCODES_IMP "static int instr_size[$nbelement] = {"; + +for ($i = 0; $i < $nbelement; $i++) { + if ($i % 16 == 0) { + print OPCODES_IMP "\n\t"; + } else { + print OPCODES_IMP " "; + } + print OPCODES_IMP "$nbbytes[$i],"; +} +print OPCODES_IMP "\n"; +print OPCODES_IMP "};\n"; +print OPCODES_IMP "\n"; + +# ------------------------------------------------------------------------------ +print OPCODES_IMP "/*\n"; +print OPCODES_IMP " * For all 256 opcodes, the value in this table gives the instruction type\n"; +print OPCODES_IMP " * ex.: MOV, INC, CLR, CPL,...\n"; +print OPCODES_IMP " * To know what is the instruction type, use\n"; +print OPCODES_IMP " * the number as an offset in instr_type_str[]\n"; +print OPCODES_IMP " */\n"; + +$nbelement = @insttype; + +print OPCODES_IMP "static int instr_type_id[$nbelement] = {"; + +for ($i = 0; $i < $nbelement; $i++) { + if ($i % 16 == 0) { + print OPCODES_IMP "\n\t"; + } else { + print OPCODES_IMP " "; + } + print OPCODES_IMP "$insttype[$i],"; +} +print OPCODES_IMP "\n"; +print OPCODES_IMP "};\n"; +print OPCODES_IMP "\n"; + +# ------------------------------------------------------------------------------ +print OPCODES_IMP "/* List of instructions types referenced by instr_type_id[] */\n"; +$nbelement = @insttext; +$elementnb = 0; +print OPCODES_IMP "static char *instr_type_str[$nbelement] = {\n"; + +foreach $instruc (@insttext) { + print OPCODES_IMP "\t\"$instruc\""; + if ($elementnb++ < ($nbelement - 1)) { + print OPCODES_IMP ","; + } + print OPCODES_IMP "\n"; +} + +print OPCODES_IMP "};\n"; +print OPCODES_IMP "\n"; + +# ------------------------------------------------------------------------------ +print OPCODES_IMP "/*\n"; +print OPCODES_IMP " * Table describing all arguments types of an instruction\n"; +print OPCODES_IMP " * The table is indexed instr_arg_type_id[ opcode * 4]\n"; +print OPCODES_IMP " * instr_arg_type_id[opcode*4 + 1] gives number of instruction arguments\n"; +print OPCODES_IMP " * instr_arg_type_id[opcode*4 + i] for i=1,2 and 3 gives type of each argument\n"; +print OPCODES_IMP " * for most instructions, the 3rd argument isn't used\n"; +print OPCODES_IMP " * the argument type is referenced to instr_arg_type_str[]\n"; +print OPCODES_IMP " */\n"; + +$nbelement = @instargs; + +print OPCODES_IMP "static int instr_arg_type_id[$nbelement] = {"; + +for ($i = 0; $i < $nbelement; $i++) { + if ($i % 16 == 0) { + print OPCODES_IMP "\n\t"; + } else { + print OPCODES_IMP " "; + } + + print OPCODES_IMP "$instargs[$i],"; +} +print OPCODES_IMP "\n"; +print OPCODES_IMP "};\n"; +print OPCODES_IMP "\n"; + +# ------------------------------------------------------------------------------ +print OPCODES_IMP "/*\n"; +print OPCODES_IMP " * List all types of arguments available to instructions\n"; +print OPCODES_IMP " * Referenced by instr_arg_type_id[]\n"; +print OPCODES_IMP " */\n"; + +$nbelement = @argstypes; +$elementnb = 0; + +print OPCODES_IMP "static char *instr_arg_type_str[$nbelement] = {\n"; + +foreach $args (@argstypes) { + print OPCODES_IMP "\t\"$args\""; + if ($elementnb++ < $nbelement-1) { + print OPCODES_IMP ","; + } + print OPCODES_IMP "\n"; +} +print OPCODES_IMP "};\n"; +print OPCODES_IMP "\n"; + +print OPCODES_IMP "int\n"; +print OPCODES_IMP "opcodes_get_instr_size(uint8_t opcode)\n"; +print OPCODES_IMP "{\n"; +print OPCODES_IMP "\treturn instr_size[opcode];\n"; +print OPCODES_IMP "}\n"; +print OPCODES_IMP "\n"; + +print OPCODES_IMP "char *\n"; +print OPCODES_IMP "opcodes_get_instr_type_str(uint8_t opcode)\n"; +print OPCODES_IMP "{\n"; +print OPCODES_IMP "\treturn instr_type_str[instr_type_id[opcode]];\n"; +print OPCODES_IMP "}\n"; +print OPCODES_IMP "\n"; + +print OPCODES_IMP "int\n"; +print OPCODES_IMP "opcodes_get_instr_arg_type_id(unsigned int offset)\n"; +print OPCODES_IMP "{\n"; +print OPCODES_IMP "\treturn instr_arg_type_id[offset];\n"; +print OPCODES_IMP "}\n"; +print OPCODES_IMP "\n"; + +print OPCODES_IMP "char *\n"; +print OPCODES_IMP "opcodes_get_instr_arg_type_str(unsigned int offset)\n"; +print OPCODES_IMP "{\n"; +print OPCODES_IMP "\treturn instr_arg_type_str[instr_arg_type_id[offset]];\n"; +print OPCODES_IMP "}\n"; +print OPCODES_IMP "\n"; + + +# ------------------------------------------------------------------------------ +for ($i = 0 ; $i < 256; $i++) { + print INST_IMP "/*","*"x76,"\n"; + print INST_IMP " * Instruction \"$a_instruction[$i]\" takes $a_cycles[$i] cycle(s) and $a_bytes[$i] byte(s).\n"; + print INST_IMP " ","*"x76,"/\n"; + print INST_IMP "int\n"; + print INST_IMP "cpu8051_OP_$a_opcodehex[$i](void)\n"; + print INST_IMP "{\n"; + + if( $i == 0x85 ) { + # Cas particulier pour MOV direct,direct -> src et dest sont inverses dans la memoire + print INST_IMP " unsigned char srcaddr = mem_read8( PGM_MEM_ID, cpu8051.pc++ );\n"; + print INST_IMP " unsigned char source = mem_read_direct( srcaddr );\n"; + print INST_IMP " unsigned char destaddr = mem_read8( PGM_MEM_ID, cpu8051.pc++ );\n"; + print INST_IMP " unsigned char destination = mem_read_direct( destaddr );\n"; + print INST_IMP " destination = source;\n"; + print INST_IMP " mem_write_direct( destaddr, destination );\n"; + } + else { + if ($instargs[$i*4] > 0) { + $op_destination=$instargs[$i*4+1]; + if ($op_destination == 0) { # addr11 + cfw("unsigned int addr11 = ( ( mem_read8( PGM_MEM_ID, cpu8051.pc - 1 ) << 3 ) & 0xF00 ) + mem_read8( PGM_MEM_ID, cpu8051.pc );"); + cfw("cpu8051.pc++;"); + } + if ($op_destination == 1) { # addr16 + cfw("uint16_t addr16 = pgm_read_addr16(cpu8051.pc);"); + cfw("cpu8051.pc += 2;"); + } + if ($op_destination == 2) { # A + cfw("unsigned char destination = mem_read_direct( _ACC_ );"); + } + if ($op_destination == 3) { # direct + cfw("unsigned char destaddr = mem_read8( PGM_MEM_ID, cpu8051.pc++ );"); + cfw("unsigned char destination = mem_read_direct( destaddr );"); + } + if ($op_destination == 4) { # @R0 + cfw("unsigned char destination = mem_read_indirect ( mem_read_direct( BANKPSW + _R0_ ) );"); + } + if ($op_destination == 5) { # @R1 + cfw("unsigned char destination = mem_read_indirect ( mem_read_direct( BANKPSW + _R1_ ) );"); + } + if ($op_destination == 6) { # R0 + cfw("unsigned char destination = mem_read_direct( BANKPSW + _R0_ );"); + } + if ($op_destination == 7) { # R1 + cfw("unsigned char destination = mem_read_direct( BANKPSW + _R1_ );"); + } + if ($op_destination == 8) { # R2 + cfw("unsigned char destination = mem_read_direct( BANKPSW + _R2_ );"); + } + if ($op_destination == 9) { # R3 + cfw("unsigned char destination = mem_read_direct( BANKPSW + _R3_ );"); + } + if ($op_destination == 10) { # R4 + cfw("unsigned char destination = mem_read_direct( BANKPSW + _R4_ );"); + } + if ($op_destination == 11) { # R5 + cfw("unsigned char destination = mem_read_direct( BANKPSW + _R5_ );"); + } + if ($op_destination == 12) { # R6 + cfw("unsigned char destination = mem_read_direct( BANKPSW + _R6_ );"); + } + if ($op_destination == 13) { # R7 + cfw("unsigned char destination = mem_read_direct( BANKPSW + _R7_ );"); + } + if ($op_destination == 14) { # bitaddr + cfw("unsigned char destination, dstbitaddr = mem_read8( PGM_MEM_ID, cpu8051.pc++ );"); + cfw("destination = mem_read_bit( dstbitaddr );"); + } + if ($op_destination == 15) { # reladdr + cfw("cpu8051.pc++;"); + cfw("unsigned int destination = ((char) mem_read8(PGM_MEM_ID, cpu8051.pc - 1)) + cpu8051.pc;"); + } + if ($op_destination == 16) { # #data + cfw("unsigned char destination = mem_read8( PGM_MEM_ID, cpu8051.pc++ );"); + } + if ($op_destination == 17) { # C + cfw("unsigned char destination = psw_read_cy();"); + } + if ($op_destination == 18) { # @A+DPTR + cfw("unsigned int destination = mem_read_direct( _ACC_ ) + mem_sfr_read_dptr();"); + } + if ($op_destination == 20) { # AB + cfw("unsigned char destination = mem_read_direct( _ACC_ );"); + cfw("unsigned char source = mem_read_direct( _B_ );"); + } + if ($op_destination == 21) { # DPTR + cfw("unsigned int destination = mem_sfr_read_dptr();"); + } + if ($op_destination == 23) { # /bitaddr + cfw("unsigned char destination, dstbitaddr = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ );"); + cfw("destination = ( mem_read_bit( dstbitaddr ) ^ 1 );"); + } + if ($op_destination == 24) { # @DPTR + cfw("unsigned char destination = mem_read_indirect(mem_sfr_read_dptr());"); + } + } + + if ($instargs[$i*4] > 1) { + $op_source=$instargs[$i*4+2]; + if ($op_source == 0) { # addr11 + cfw("unsigned int addr11 = ( ( mem_read8( PGM_MEM_ID, cpu8051.pc - 1 ) << 3 ) & 0xF00 ) + mem_read8( PGM_MEM_ID, (cpu8051.pc)++ );"); + } + if ($op_source == 1) { # addr16 + cfw("uint16_t addr16 = pgm_read_addr16(cpu8051.pc);"); + cfw("cpu8051.pc += 2;"); + } + if ($op_source == 2) { # A + cfw("unsigned char source = mem_read_direct( _ACC_ );"); + } + if ($op_source == 3) { # direct + cfw("unsigned char srcaddr = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ );"); + cfw("unsigned char source = mem_read_direct( srcaddr );"); + } + if ($op_source == 4) { # @R0 + cfw("unsigned char source = mem_read_indirect ( mem_read_direct( BANKPSW + _R0_ ) );"); + } + if ($op_source == 5) { # @R1 + cfw("unsigned char source = mem_read_indirect ( mem_read_direct( BANKPSW + _R1_ ) );"); + } + if ($op_source == 6) { # R0 + cfw("unsigned char source = mem_read_direct( BANKPSW + _R0_ );"); + } + if ($op_source == 7) { # R1 + cfw("unsigned char source = mem_read_direct( BANKPSW + _R1_ );"); + } + if ($op_source == 8) { # R2 + cfw("unsigned char source = mem_read_direct( BANKPSW + _R2_ );"); + } + if ($op_source == 9) { # R3 + cfw("unsigned char source = mem_read_direct( BANKPSW + _R3_ );"); + } + if ($op_source == 10) { # R4 + cfw("unsigned char source = mem_read_direct( BANKPSW + _R4_ );"); + } + if ($op_source == 11) { # R5 + cfw("unsigned char source = mem_read_direct( BANKPSW + _R5_ );"); + } + if ($op_source == 12) { # R6 + cfw("unsigned char source = mem_read_direct( BANKPSW + _R6_ );"); + } + if ($op_source == 13) { # R7 + cfw("unsigned char source = mem_read_direct( BANKPSW + _R7_ );"); + } + + if ($op_source == 14) { # bitaddr + cfw("unsigned char source, srcbitaddr = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ );"); + cfw("source = mem_read_bit( srcbitaddr );"); + } + if ($op_source == 15) { # reladdr + cfw("(cpu8051.pc)++;"); + cfw("unsigned int source = ((char) mem_read8(PGM_MEM_ID, cpu8051.pc - 1)) + cpu8051.pc;"); + } + if ($op_source == 16) { # #data + cfw("unsigned char source = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ );"); + } + if ($op_source == 17) { # C + cfw("unsigned char source = psw_read_cy();"); + } + if ($op_source == 18) { # @A+DPTR + cfw("unsigned char source = mem_read8( PGM_MEM_ID, mem_read_direct( _ACC_ ) + mem_sfr_read_dptr());"); + } + if ($op_source == 19) { # @A+PC + cfw("unsigned char source = mem_read8( PGM_MEM_ID, mem_read_direct( _ACC_ ) + ( ++cpu8051.pc ) );"); + } + if ($op_source == 21) { # DPTR + cfw("unsigned int source = mem_sfr_read_dptr();"); + } + if ($op_source == 22) { # #data16 + cfw("uint16_t source = pgm_read_addr16(cpu8051.pc);"); + cfw("cpu8051.pc += 2;"); + } + if ($op_source == 23) { # /bitaddr + cfw("unsigned char source, srcbitaddr = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ );"); + cfw("source = ( mem_read_bit( srcbitaddr ) ^ 1 );"); + } + if ($op_source == 24) { # @DPTR + cfw("unsigned char source = mem_read_indirect(mem_sfr_read_dptr());"); + } + } + +############################################################################## + $modifysrc=0; + + # RR + if ($insttype[$i] == 3) { + cfw("destination = ( destination >> 1 ) | ( destination << 7 );"); + } + + # INC + if ($insttype[$i] == 4) { + cfw("destination++;"); + } + + # JBC + if ($insttype[$i] == 5) { + cfw("if ( destination == 1 ) { cpu8051.pc = source; destination = 0; }"); + } + + # ACALL + if ($insttype[$i] == 6) { + cfw("stack_push16(cpu8051.pc);"); + } + + # LCALL + if ($insttype[$i] == 7) { + cfw("stack_push16(cpu8051.pc);"); + } + + # RRC + if ($insttype[$i] == 8) { + cfw("unsigned char new_cy = destination & 0x01;"); + cfw("destination = ( destination >> 1 ) | (psw_read_cy() << 7);"); + cfw("psw_write_cy(new_cy);"); + } + + # DEC + if ($insttype[$i] == 9) { + cfw("destination--;"); + } + + # JB + if ($insttype[$i] == 10) { + cfw("if ( destination == 1 ) { cpu8051.pc = source; }"); + } + + # RET + if ($insttype[$i] == 11) { + cfw("cpu8051.pc = stack_pop16();"); + } + + # RL + if ($insttype[$i] == 12) { + cfw("destination = ( destination << 1 ) | ( destination >> 7 );"); + } + + # ADD + if ($insttype[$i] == 13) { + cfw("destination = addition(destination, source, 0);"); + } + + # JNB + if ($insttype[$i] == 14) { + cfw("if ( destination == 0 ) { cpu8051.pc = source; }"); + } + + # RETI + if ($insttype[$i] == 15) { + cfw("cpu8051.active_priority = -1;"); + cfw("cpu8051.pc = stack_pop16();"); + } + + # RLC + if ($insttype[$i] == 16) { + cfw("unsigned char new_cy = destination & 0x80;"); + cfw("destination = ( destination << 1 ) | psw_read_cy();"); + cfw("psw_write_cy(new_cy);"); + } + + # ADDC + # ADD and ADDC function identically except that ADDC adds the value of + # operand as well as the value of the Carry flag whereas ADD does not + # add the Carry flag to the result. + if ($insttype[$i] == 17) { + cfw("unsigned char carryflag = psw_read_cy();"); + cfw("destination = addition(destination, source, carryflag);"); + } + + # JC + if ($insttype[$i] == 18) { + cfw("if (psw_read_cy()) { cpu8051.pc = destination; }"); + } + + # ORL + if ($insttype[$i] == 19) { + cfw("destination |= source;"); + } + + # JNC + if ($insttype[$i] == 20) { + cfw("if (psw_read_cy() == 0) { cpu8051.pc = destination; }"); + } + + # ANL + if ($insttype[$i] == 21) { + cfw("destination &= source;"); + } + + # JZ + if ($insttype[$i] == 22) { + cfw("if ( mem_read_direct( _ACC_ ) == 0 ) { cpu8051.pc = destination; }"); + } + + # XRL + if ($insttype[$i] == 23) { + cfw("destination ^= source;"); + } + + # JNZ + if ($insttype[$i] == 24) { + cfw("if ( mem_read_direct( _ACC_ ) != 0 ) { cpu8051.pc = destination; }"); + } + + # JMP + if ($insttype[$i] == 25) { + cfw("cpu8051.pc = destination;"); + } + + # MOV + if ($insttype[$i] == 26) { + cfw("destination = source;"); + } + + # SJMP + if ($insttype[$i] == 27) { + cfw("cpu8051.pc = destination;"); + } + + # MOVC + if ($insttype[$i] == 28) { + cfw("destination = source;"); + } + + # DIV + if ($insttype[$i] == 29) { + # A = destination + # B = source + cfw("psw_clr_cy();"); + # If B is zero, the OV flag will be set indicating a + # division-by-zero error + cfw("if (source != 0) {"); + cfw(" mem_write_direct(_ACC_, destination/source);"); + cfw(" mem_write_direct( _B_, destination%source);"); + cfw(" psw_clr_ov();"); + cfw("} else {"); + cfw(" psw_set_ov();"); + cfw("}"); + } + + # SUBB + if ($insttype[$i] == 30) { + cfw("unsigned char carryflag = psw_read_cy();"); + cfw("psw_clr_cy();"); + cfw("psw_clr_ac();"); + cfw("psw_clr_ov();"); + cfw("if ( destination < ( source + carryflag ) ) {"); + cfw(" psw_set_cy();"); + cfw(" if ((destination & 0x7F) > ((source + carryflag) & 0x7F)) psw_set_ov();"); + cfw("} else if ((destination & 0x7F) < ((source + carryflag) & 0x7F)) psw_set_ov();"); + cfw("if ((destination & 0x0F) < ((source + carryflag) & 0x0F)) psw_set_ac();"); + cfw("destination -= source + carryflag;"); + } + + # MUL + if ($insttype[$i] == 31) { + # A = destination + # B = source + cfw("psw_clr_cy();"); + cfw("mem_write_direct(_ACC_, destination * source);"); + cfw("mem_write_direct(_B_, (destination * source) / 0x100);"); + cfw("if (mem_read_direct(_B_) > 0)"); + cfw(" psw_set_ov();"); + cfw("else"); + cfw(" psw_clr_ov();"); + } + + # CPL + if ($insttype[$i] == 33) { + if ($instargs[$i*4+1] == 2) { cfw("destination ^= 0xFF;"); } + else { cfw("destination ^= 0x01;"); } + } + + # CJNE + if ($insttype[$i] == 34) { + cfw("unsigned int reladdr = ((char) mem_read8(PGM_MEM_ID, cpu8051.pc)) + (cpu8051.pc + 1);"); + cfw("psw_clr_cy();"); + cfw("if ( destination < source ) psw_set_cy();"); + cfw("if ( destination != source ) cpu8051.pc = reladdr; else cpu8051.pc++;"); + } + + # PUSH + if ($insttype[$i] == 35) { + cfw("stack_push8(destination);"); + } + + # CLR + if ($insttype[$i] == 36) { + cfw("destination = 0;"); + } + + # SWAP + if ($insttype[$i] == 37) { + cfw("destination = ( destination << 4 ) + ( destination >> 4 );"); + } + + # XCH + if ($insttype[$i] == 38) { + cfw("unsigned char tmpval = destination;"); + cfw("destination = source; source = tmpval;"); + $modifysrc=1; + } + + # POP + if ($insttype[$i] == 39) { + cfw("destination = stack_pop8();"); + } + + # SETB + if ($insttype[$i] == 40) { + cfw("destination = 1;"); + } + + # DA + if ($insttype[$i] == 41) { + cfw("if (((destination & 0x0F) > 9) || psw_read_ac()) {"); + cfw(" if ( ( destination + 6 ) > 0xFF) psw_set_cy();"); + cfw(" destination += 6;"); + cfw("}"); + cfw("if ( psw_read_cy() || ( ( destination & 0xF0 ) > 0x90 ) ) {"); + cfw(" if ( ( destination + 0x60 ) > 0xFF ) psw_set_cy();"); + cfw(" destination += 0x60;"); + cfw("}"); + } + + # DJNZ + if ($insttype[$i] == 42) { + cfw("destination--;"); + cfw("if ( destination != 0 ) cpu8051.pc = source;"); + } + + # XCHD + if ($insttype[$i] == 43) { + cfw("unsigned char tmpval = ( destination & 0x0F );"); + cfw("destination = ( destination & 0xF0 ) + ( source & 0x0F );"); + cfw("source = ( source & 0xF0 ) + tmpval;"); + $modifysrc=1; + } + + # MOVX + if ($insttype[$i] == 44) { + cfw("destination = source;"); + } + + + +############################################################################## + + + if ($instargs[$i*4] > 0) { + $op_destination=$instargs[$i*4+1]; + if ($op_destination == 0) { # addr11 + cfw("cpu8051.pc = ( cpu8051.pc & 0xF800 ) | addr11;"); + } + if ($op_destination == 1) { # addr16 + cfw("cpu8051.pc = addr16;"); + } + if ($op_destination == 2) { # A + cfw("mem_write_direct( _ACC_, destination );"); + } + if ($op_destination == 3) { # direct + cfw("mem_write_direct( destaddr, destination );"); + } + if ($op_destination == 4) { # @R0 + cfw("mem_write_indirect( mem_read_direct( BANKPSW + _R0_ ), destination );"); + } + if ($op_destination == 5) { # @R1 + cfw("mem_write_indirect( mem_read_direct( BANKPSW + _R1_ ), destination );"); + } + if ($op_destination == 6) { # R0 + cfw("mem_write_direct( BANKPSW + _R0_, destination );"); + } + if ($op_destination == 7) { # R1 + cfw("mem_write_direct( BANKPSW + _R1_, destination );"); + } + if ($op_destination == 8) { # R2 + cfw("mem_write_direct( BANKPSW + _R2_, destination );"); + } + if ($op_destination == 9) { # R3 + cfw("mem_write_direct( BANKPSW + _R3_, destination );"); + } + if ($op_destination == 10) { # R4 + cfw("mem_write_direct( BANKPSW + _R4_, destination );"); + } + if ($op_destination == 11) { # R5 + cfw("mem_write_direct( BANKPSW + _R5_, destination );"); + } + if ($op_destination == 12) { # R6 + cfw("mem_write_direct( BANKPSW + _R6_, destination );"); + } + if ($op_destination == 13) { # R7 + cfw("mem_write_direct( BANKPSW + _R7_, destination );"); + } + + if ($op_destination == 14) { # bitaddr + cfw("mem_write_bit( dstbitaddr, destination );"); + } + if ($op_destination == 17) { # C + cfw("psw_write_cy(destination);"); + } + if ($op_destination == 21) { # DPTR + cfw("mem_sfr_write_dptr(destination);"); + } + if ($op_destination == 23) { # /bitaddr + cfw("mem_write_bit( dstbitaddr, destination );"); + } + if ($op_destination == 24) { # @DPTR + cfw("mem_write_indirect(mem_sfr_read_dptr(), destination);"); + } + } + + if ($modifysrc == 1) { + if ($instargs[$i*4] > 1) { + $op_source=$instargs[$i*4+2]; + if ($op_source == 0) { # addr11 + cfw("cpu8051.pc = ( cpu8051.pc & 0xF800 ) | addr11;"); + } + if ($op_source == 1) { # addr16 + cfw("cpu8051.pc = addr16;"); + } + if ($op_source == 2) { # A + cfw("mem_write_direct( _ACC_, source );"); + } + if ($op_source == 3) { # direct + cfw("mem_write_direct( srcaddr, source );"); + } + if ($op_source == 4) { # @R0 + cfw("mem_write_indirect( mem_read_direct( BANKPSW + _R0_ ), source );"); + } + if ($op_source == 5) { # @R1 + cfw("mem_write_indirect( mem_read_direct( BANKPSW + _R1_ ), source );"); + } + if ($op_source == 6) { # R0 + cfw("mem_write_direct( BANKPSW + _R0_, source );"); + } + if ($op_source == 7) { # R1 + cfw("mem_write_direct( BANKPSW + _R1_, source );"); + } + if ($op_source == 8) { # R2 + cfw("mem_write_direct( BANKPSW + _R2_, source );"); + } + if ($op_source == 9) { # R3 + cfw("mem_write_direct( BANKPSW + _R3_, source );"); + } + if ($op_source == 10) { # R4 + cfw("mem_write_direct( BANKPSW + _R4_, source );"); + } + if ($op_source == 11) { # R5 + cfw("mem_write_direct( BANKPSW + _R5_, source );"); + } + if ($op_source == 12) { # R6 + cfw("mem_write_direct( BANKPSW + _R6_, source );"); + } + if ($op_source == 13) { # R7 + cfw("mem_write_direct( BANKPSW + _R7_, source );"); + } + if ($op_source == 14) { # bitaddr + cfw("mem_write_bit( srcbitaddr, source );"); + } + if ($op_source == 17) { # C + cfw("psw_write_cy(source);"); + } + if ($op_source == 21) { # DPTR + cfw("mem_sfr_write_dptr(source);"); + } + if ($op_source == 23) { # /bitaddr + cfw("mem_write_bit( srcbitaddr, source );"); + } + if ($op_source == 24) { # @DPTR + cfw("mem_write_indirect(mem_sfr_read_dptr(), source);"); + } + } + } + } + cfw("return $a_cycles[$i];"); + print INST_IMP "}\n"; + print INST_IMP "\n"; +} +# ------------------------------------------------------------------------------ + + +# Header for instructions_8051.h +print INST_DEF "/*\n"; +print INST_DEF " * instructions_8051.h\n"; +write_header(INST_DEF); +print INST_DEF "#ifndef INSTRUCTIONS_8051_H\n"; +print INST_DEF "#define INSTRUCTIONS_8051_H 1\n\n\n"; +print INST_DEF "#define BANKPSW (mem_read_direct(_PSW_) & 0x18)\n\n"; +print INST_DEF "typedef int (*OPCODE_FP)(void);\n\n\n"; +for( $i=0; $i<256; $i++ ) { + print INST_DEF "int\n"; + print INST_DEF "cpu8051_OP_$a_opcodehex[$i](void);\n\n"; +} +print INST_DEF "\n"; +print INST_DEF "/* Exported variables. */\n"; +print INST_DEF "#ifdef INSTRUCTIONS_8051_M\n"; +print INST_DEF "OPCODE_FP opcode_table[256] = {\n"; + +for ($i = 0; $i < 256; $i++) { + $ifunc = substr($instfunction[$i], 9); + + print INST_DEF "\tcpu8051_$ifunc,\n"; +} +print INST_DEF "};\n"; +print INST_DEF "#else\n"; +print INST_DEF "OPCODE_FP opcode_table[256];\n"; +print INST_DEF "#endif\n\n\n"; + +print INST_DEF "#endif /* INSTRUCTIONS_8051_H */\n"; + +print OPCODES_DEF "#endif /* OPCODES_IMP */\n"; + +close OPCODES_DEF; +close OPCODES_IMP; +close OPCODELST; +close INST_DEF; +close INST_IMP; diff -Nru emu8051-1.1.1/src/common/opcodes.c emu8051-2.0.1/src/common/opcodes.c --- emu8051-1.1.1/src/common/opcodes.c 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/common/opcodes.c 2014-03-22 18:26:21.000000000 +0000 @@ -0,0 +1,239 @@ +/* + * opcodes.c + * + * Do not modify this file directly, as it was created by opcodes2c.pl + * Any modifications made directly to this file will be lost. + * + * Copyright (C) 1999 Jonathan St-André + * Copyright (C) 1999 Hugo Villeneuve + * + * This file is released under the GPLv2 + */ + +#include + +/* Size(in bytes) of each instruction (offset in table is instruction opcode) */ +static int instr_size[256] = { + 1, 2, 3, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 3, 2, 3, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 3, 2, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 3, 2, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 3, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 3, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 3, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 1, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 1, 1, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 3, 2, 2, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 2, 2, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 1, 1, 3, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, + 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +}; + +/* + * For all 256 opcodes, the value in this table gives the instruction type + * ex.: MOV, INC, CLR, CPL,... + * To know what is the instruction type, use + * the number as an offset in instr_type_str[] + */ +static int instr_type_id[256] = { + 0, 1, 2, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 5, 6, 7, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 10, 1, 11, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 14, 6, 15, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 18, 1, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 20, 6, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 22, 1, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 24, 6, 19, 25, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, + 27, 1, 21, 28, 29, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, + 26, 6, 26, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + 19, 1, 26, 4, 31, 32, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, + 21, 6, 33, 33, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, + 35, 1, 36, 36, 37, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, + 39, 6, 40, 40, 41, 42, 43, 43, 42, 42, 42, 42, 42, 42, 42, 42, + 44, 1, 44, 44, 36, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, + 44, 6, 44, 44, 33, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, +}; + +/* List of instructions types referenced by instr_type_id[] */ +static char *instr_type_str[45] = { + "NOP", + "AJMP", + "LJMP", + "RR", + "INC", + "JBC", + "ACALL", + "LCALL", + "RRC", + "DEC", + "JB", + "RET", + "RL", + "ADD", + "JNB", + "RETI", + "RLC", + "ADDC", + "JC", + "ORL", + "JNC", + "ANL", + "JZ", + "XRL", + "JNZ", + "JMP", + "MOV", + "SJMP", + "MOVC", + "DIV", + "SUBB", + "MUL", + "INVALID", + "CPL", + "CJNE", + "PUSH", + "CLR", + "SWAP", + "XCH", + "POP", + "SETB", + "DA", + "DJNZ", + "XCHD", + "MOVX" +}; + +/* + * Table describing all arguments types of an instruction + * The table is indexed instr_arg_type_id[ opcode * 4] + * instr_arg_type_id[opcode*4 + 1] gives number of instruction arguments + * instr_arg_type_id[opcode*4 + i] for i=1,2 and 3 gives type of each argument + * for most instructions, the 3rd argument isn't used + * the argument type is referenced to instr_arg_type_str[] + */ +static int instr_arg_type_id[1024] = { + 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 2, 0, 0, + 1, 2, 0, 0, 1, 3, 0, 0, 1, 4, 0, 0, 1, 5, 0, 0, + 1, 6, 0, 0, 1, 7, 0, 0, 1, 8, 0, 0, 1, 9, 0, 0, + 1, 10, 0, 0, 1, 11, 0, 0, 1, 12, 0, 0, 1, 13, 0, 0, + 2, 14, 15, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 2, 0, 0, + 1, 2, 0, 0, 1, 3, 0, 0, 1, 4, 0, 0, 1, 5, 0, 0, + 1, 6, 0, 0, 1, 7, 0, 0, 1, 8, 0, 0, 1, 9, 0, 0, + 1, 10, 0, 0, 1, 11, 0, 0, 1, 12, 0, 0, 1, 13, 0, 0, + 2, 14, 15, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 0, + 2, 2, 16, 0, 2, 2, 3, 0, 2, 2, 4, 0, 2, 2, 5, 0, + 2, 2, 6, 0, 2, 2, 7, 0, 2, 2, 8, 0, 2, 2, 9, 0, + 2, 2, 10, 0, 2, 2, 11, 0, 2, 2, 12, 0, 2, 2, 13, 0, + 2, 14, 15, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 0, + 2, 2, 16, 0, 2, 2, 3, 0, 2, 2, 4, 0, 2, 2, 5, 0, + 2, 2, 6, 0, 2, 2, 7, 0, 2, 2, 8, 0, 2, 2, 9, 0, + 2, 2, 10, 0, 2, 2, 11, 0, 2, 2, 12, 0, 2, 2, 13, 0, + 1, 15, 0, 0, 1, 0, 0, 0, 2, 3, 2, 0, 2, 3, 16, 0, + 2, 2, 16, 0, 2, 2, 3, 0, 2, 2, 4, 0, 2, 2, 5, 0, + 2, 2, 6, 0, 2, 2, 7, 0, 2, 2, 8, 0, 2, 2, 9, 0, + 2, 2, 10, 0, 2, 2, 11, 0, 2, 2, 12, 0, 2, 2, 13, 0, + 1, 15, 0, 0, 1, 0, 0, 0, 2, 3, 2, 0, 2, 3, 16, 0, + 2, 2, 16, 0, 2, 2, 3, 0, 2, 2, 4, 0, 2, 2, 5, 0, + 2, 2, 6, 0, 2, 2, 7, 0, 2, 2, 8, 0, 2, 2, 9, 0, + 2, 2, 10, 0, 2, 2, 11, 0, 2, 2, 12, 0, 2, 2, 13, 0, + 1, 15, 0, 0, 1, 0, 0, 0, 2, 3, 2, 0, 2, 3, 16, 0, + 2, 2, 16, 0, 2, 2, 3, 0, 2, 2, 4, 0, 2, 2, 5, 0, + 2, 2, 6, 0, 2, 2, 7, 0, 2, 2, 8, 0, 2, 2, 9, 0, + 2, 2, 10, 0, 2, 2, 11, 0, 2, 2, 12, 0, 2, 2, 13, 0, + 1, 15, 0, 0, 1, 0, 0, 0, 2, 17, 14, 0, 1, 18, 0, 0, + 2, 2, 16, 0, 2, 3, 16, 0, 2, 4, 16, 0, 2, 5, 16, 0, + 2, 6, 16, 0, 2, 7, 16, 0, 2, 8, 16, 0, 2, 9, 16, 0, + 2, 10, 16, 0, 2, 11, 16, 0, 2, 12, 16, 0, 2, 13, 16, 0, + 1, 15, 0, 0, 1, 0, 0, 0, 2, 17, 14, 0, 2, 2, 19, 0, + 1, 20, 0, 0, 2, 3, 3, 0, 2, 3, 4, 0, 2, 3, 5, 0, + 2, 3, 6, 0, 2, 3, 7, 0, 2, 3, 8, 0, 2, 3, 9, 0, + 2, 3, 10, 0, 2, 3, 11, 0, 2, 3, 12, 0, 2, 3, 13, 0, + 2, 21, 22, 0, 1, 0, 0, 0, 2, 14, 17, 0, 2, 2, 18, 0, + 2, 2, 16, 0, 2, 2, 3, 0, 2, 2, 4, 0, 2, 2, 5, 0, + 2, 2, 6, 0, 2, 2, 7, 0, 2, 2, 8, 0, 2, 2, 9, 0, + 2, 2, 10, 0, 2, 2, 11, 0, 2, 2, 12, 0, 2, 2, 13, 0, + 2, 17, 23, 0, 1, 0, 0, 0, 2, 17, 14, 0, 1, 21, 0, 0, + 1, 20, 0, 0, 0, 0, 0, 0, 2, 4, 3, 0, 2, 5, 3, 0, + 2, 6, 3, 0, 2, 7, 3, 0, 2, 8, 3, 0, 2, 9, 3, 0, + 2, 10, 3, 0, 2, 11, 3, 0, 2, 12, 3, 0, 2, 13, 3, 0, + 2, 17, 23, 0, 1, 0, 0, 0, 1, 14, 0, 0, 1, 17, 0, 0, + 3, 2, 16, 15, 3, 2, 3, 15, 3, 4, 16, 15, 3, 5, 16, 15, + 3, 6, 16, 15, 3, 7, 16, 15, 3, 8, 16, 15, 3, 9, 16, 15, + 3, 10, 16, 15, 3, 11, 16, 15, 3, 12, 16, 15, 3, 13, 16, 15, + 1, 3, 0, 0, 1, 0, 0, 0, 1, 14, 0, 0, 1, 17, 0, 0, + 1, 2, 0, 0, 2, 2, 3, 0, 2, 2, 4, 0, 2, 2, 5, 0, + 2, 2, 6, 0, 2, 2, 7, 0, 2, 2, 8, 0, 2, 2, 9, 0, + 2, 2, 10, 0, 2, 2, 11, 0, 2, 2, 12, 0, 2, 2, 13, 0, + 1, 3, 0, 0, 1, 0, 0, 0, 1, 14, 0, 0, 1, 17, 0, 0, + 1, 2, 0, 0, 2, 3, 15, 0, 2, 2, 4, 0, 2, 2, 5, 0, + 2, 6, 15, 0, 2, 7, 15, 0, 2, 8, 15, 0, 2, 9, 15, 0, + 2, 10, 15, 0, 2, 11, 15, 0, 2, 12, 15, 0, 2, 13, 15, 0, + 2, 2, 24, 0, 1, 0, 0, 0, 2, 2, 4, 0, 2, 2, 5, 0, + 1, 2, 0, 0, 2, 2, 3, 0, 2, 2, 4, 0, 2, 2, 5, 0, + 2, 2, 6, 0, 2, 2, 7, 0, 2, 2, 8, 0, 2, 2, 9, 0, + 2, 2, 10, 0, 2, 2, 11, 0, 2, 2, 12, 0, 2, 2, 13, 0, + 2, 24, 2, 0, 1, 0, 0, 0, 2, 4, 2, 0, 2, 5, 2, 0, + 1, 2, 0, 0, 2, 3, 2, 0, 2, 4, 2, 0, 2, 5, 2, 0, + 2, 6, 2, 0, 2, 7, 2, 0, 2, 8, 2, 0, 2, 9, 2, 0, + 2, 10, 2, 0, 2, 11, 2, 0, 2, 12, 2, 0, 2, 13, 2, 0, +}; + +/* + * List all types of arguments available to instructions + * Referenced by instr_arg_type_id[] + */ +static char *instr_arg_type_str[25] = { + "addr11", + "addr16", + "A", + "direct", + "@R0", + "@R1", + "R0", + "R1", + "R2", + "R3", + "R4", + "R5", + "R6", + "R7", + "bitaddr", + "reladdr", + "#data", + "C", + "@A+DPTR", + "@A+PC", + "AB", + "DPTR", + "#data16", + "/bitaddr", + "@DPTR" +}; + +int +opcodes_get_instr_size(uint8_t opcode) +{ + return instr_size[opcode]; +} + +char * +opcodes_get_instr_type_str(uint8_t opcode) +{ + return instr_type_str[instr_type_id[opcode]]; +} + +int +opcodes_get_instr_arg_type_id(unsigned int offset) +{ + return instr_arg_type_id[offset]; +} + +char * +opcodes_get_instr_arg_type_str(unsigned int offset) +{ + return instr_arg_type_str[instr_arg_type_id[offset]]; +} + diff -Nru emu8051-1.1.1/src/common/opcodes.h emu8051-2.0.1/src/common/opcodes.h --- emu8051-1.1.1/src/common/opcodes.h 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/common/opcodes.h 2014-03-22 18:26:21.000000000 +0000 @@ -0,0 +1,24 @@ +/* + * opcodes.h + * + * Do not modify this file directly, as it was created by opcodes2c.pl + * Any modifications made directly to this file will be lost. + * + * Copyright (C) 1999 Jonathan St-André + * Copyright (C) 1999 Hugo Villeneuve + * + * This file is released under the GPLv2 + */ + +#ifndef OPCODES_H +#define OPCODES_H 1 + +int +opcodes_get_instr_size(uint8_t opcode); +char * +opcodes_get_instr_type_str(uint8_t opcode); +int +opcodes_get_instr_arg_type_id(unsigned int offset); +char * +opcodes_get_instr_arg_type_str(unsigned int offset); +#endif /* OPCODES_IMP */ diff -Nru emu8051-1.1.1/src/common/opcodes.lst emu8051-2.0.1/src/common/opcodes.lst --- emu8051-1.1.1/src/common/opcodes.lst 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/common/opcodes.lst 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,258 @@ +Opcode Instruction Bytes Cycles +---------------------------------------------- +00 NOP 1 1 +01 AJMP addr11 2 2 +02 LJMP addr16 3 2 +03 RR A 1 1 +04 INC A 1 1 +05 INC direct 2 1 +06 INC @R0 1 1 +07 INC @R1 1 1 +08 INC R0 1 1 +09 INC R1 1 1 +0A INC R2 1 1 +0B INC R3 1 1 +0C INC R4 1 1 +0D INC R5 1 1 +0E INC R6 1 1 +0F INC R7 1 1 +10 JBC bitaddr,reladdr 3 2 +11 ACALL addr11 2 2 +12 LCALL addr16 3 2 +13 RRC A 1 1 +14 DEC A 1 1 +15 DEC direct 2 1 +16 DEC @R0 1 1 +17 DEC @R1 1 1 +18 DEC R0 1 1 +19 DEC R1 1 1 +1A DEC R2 1 1 +1B DEC R3 1 1 +1C DEC R4 1 1 +1D DEC R5 1 1 +1E DEC R6 1 1 +1F DEC R7 1 1 +20 JB bitaddr,reladdr 3 2 +21 AJMP addr11 2 2 +22 RET 1 2 +23 RL A 1 1 +24 ADD A,#data 2 1 +25 ADD A,direct 2 1 +26 ADD A,@R0 1 1 +27 ADD A,@R1 1 1 +28 ADD A,R0 1 1 +29 ADD A,R1 1 1 +2A ADD A,R2 1 1 +2B ADD A,R3 1 1 +2C ADD A,R4 1 1 +2D ADD A,R5 1 1 +2E ADD A,R6 1 1 +2F ADD A,R7 1 1 +30 JNB bitaddr,reladdr 3 2 +31 ACALL addr11 2 2 +32 RETI 1 2 +33 RLC A 1 1 +34 ADDC A,#data 2 1 +35 ADDC A,direct 2 1 +36 ADDC A,@R0 1 1 +37 ADDC A,@R1 1 1 +38 ADDC A,R0 1 1 +39 ADDC A,R1 1 1 +3A ADDC A,R2 1 1 +3B ADDC A,R3 1 1 +3C ADDC A,R4 1 1 +3D ADDC A,R5 1 1 +3E ADDC A,R6 1 1 +3F ADDC A,R7 1 1 +40 JC reladdr 2 2 +41 AJMP addr11 2 2 +42 ORL direct,A 2 1 +43 ORL direct,#data 3 2 +44 ORL A,#data 2 1 +45 ORL A,direct 2 1 +46 ORL A,@R0 1 1 +47 ORL A,@R1 1 1 +48 ORL A,R0 1 1 +49 ORL A,R1 1 1 +4A ORL A,R2 1 1 +4B ORL A,R3 1 1 +4C ORL A,R4 1 1 +4D ORL A,R5 1 1 +4E ORL A,R6 1 1 +4F ORL A,R7 1 1 +50 JNC reladdr 2 2 +51 ACALL addr11 2 2 +52 ANL direct,A 2 1 +53 ANL direct,#data 3 2 +54 ANL A,#data 2 1 +55 ANL A,direct 2 1 +56 ANL A,@R0 1 1 +57 ANL A,@R1 1 1 +58 ANL A,R0 1 1 +59 ANL A,R1 1 1 +5A ANL A,R2 1 1 +5B ANL A,R3 1 1 +5C ANL A,R4 1 1 +5D ANL A,R5 1 1 +5E ANL A,R6 1 1 +5F ANL A,R7 1 1 +60 JZ reladdr 2 2 +61 AJMP addr11 2 2 +62 XRL direct,A 2 1 +63 XRL direct,#data 3 2 +64 XRL A,#data 2 1 +65 XRL A,direct 2 1 +66 XRL A,@R0 1 1 +67 XRL A,@R1 1 1 +68 XRL A,R0 1 1 +69 XRL A,R1 1 1 +6A XRL A,R2 1 1 +6B XRL A,R3 1 1 +6C XRL A,R4 1 1 +6D XRL A,R5 1 1 +6E XRL A,R6 1 1 +6F XRL A,R7 1 1 +70 JNZ reladdr 2 2 +71 ACALL addr11 2 2 +72 ORL C,bitaddr 2 2 +73 JMP @A+DPTR 1 2 +74 MOV A,#data 2 1 +75 MOV direct,#data 3 2 +76 MOV @R0,#data 2 1 +77 MOV @R1,#data 2 1 +78 MOV R0,#data 2 1 +79 MOV R1,#data 2 1 +7A MOV R2,#data 2 1 +7B MOV R3,#data 2 1 +7C MOV R4,#data 2 1 +7D MOV R5,#data 2 1 +7E MOV R6,#data 2 1 +7F MOV R7,#data 2 1 +80 SJMP reladdr 2 2 +81 AJMP addr11 2 2 +82 ANL C,bitaddr 2 1 +83 MOVC A,@A+PC 1 1 +84 DIV AB 1 4 +85 MOV direct,direct 3 1 +86 MOV direct,@R0 2 2 +87 MOV direct,@R1 2 2 +88 MOV direct,R0 2 2 +89 MOV direct,R1 2 2 +8A MOV direct,R2 2 2 +8B MOV direct,R3 2 2 +8C MOV direct,R4 2 2 +8D MOV direct,R5 2 2 +8E MOV direct,R6 2 2 +8F MOV direct,R7 2 2 +90 MOV DPTR,#data16 3 2 +91 ACALL addr11 2 2 +92 MOV bitaddr,C 2 2 +93 MOVC A,@A+DPTR 1 2 +94 SUBB A,#data 2 1 +95 SUBB A,direct 2 1 +96 SUBB A,@R0 1 1 +97 SUBB A,@R1 1 1 +98 SUBB A,R0 1 1 +99 SUBB A,R1 1 1 +9A SUBB A,R2 1 1 +9B SUBB A,R3 1 1 +9C SUBB A,R4 1 1 +9D SUBB A,R5 1 1 +9E SUBB A,R6 1 1 +9F SUBB A,R7 1 1 +A0 ORL C,/bitaddr 2 1 +A1 AJMP addr11 2 2 +A2 MOV C,bitaddr 2 1 +A3 INC DPTR 1 2 +A4 MUL AB 1 4 +A5 INVALID 1 1 +A6 MOV @R0,direct 2 2 +A7 MOV @R1,direct 2 2 +A8 MOV R0,direct 2 2 +A9 MOV R1,direct 2 2 +AA MOV R2,direct 2 2 +AB MOV R3,direct 2 2 +AC MOV R4,direct 2 2 +AD MOV R5,direct 2 2 +AE MOV R6,direct 2 2 +AF MOV R7,direct 2 2 +B0 ANL C,/bitaddr 2 1 +B1 ACALL addr11 2 2 +B2 CPL bitaddr 2 1 +B3 CPL C 1 1 +B4 CJNE A,#data,reladdr 3 2 +B5 CJNE A,direct,reladdr 3 2 +B6 CJNE @R0,#data,reladdr 3 2 +B7 CJNE @R1,#data,reladdr 3 2 +B8 CJNE R0,#data,reladdr 3 2 +B9 CJNE R1,#data,reladdr 3 2 +BA CJNE R2,#data,reladdr 3 2 +BB CJNE R3,#data,reladdr 3 2 +BC CJNE R4,#data,reladdr 3 2 +BD CJNE R5,#data,reladdr 3 2 +BE CJNE R6,#data,reladdr 3 2 +BF CJNE R7,#data,reladdr 3 2 +C0 PUSH direct 2 2 +C1 AJMP addr11 2 2 +C2 CLR bitaddr 2 1 +C3 CLR C 1 1 +C4 SWAP A 1 1 +C5 XCH A,direct 2 1 +C6 XCH A,@R0 1 1 +C7 XCH A,@R1 1 1 +C8 XCH A,R0 1 1 +C9 XCH A,R1 1 1 +CA XCH A,R2 1 1 +CB XCH A,R3 1 1 +CC XCH A,R4 1 1 +CD XCH A,R5 1 1 +CE XCH A,R6 1 1 +CF XCH A,R7 1 1 +D0 POP direct 2 2 +D1 ACALL addr11 2 2 +D2 SETB bitaddr 2 1 +D3 SETB C 1 1 +D4 DA A 1 1 +D5 DJNZ direct,reladdr 3 2 +D6 XCHD A,@R0 1 1 +D7 XCHD A,@R1 1 1 +D8 DJNZ R0,reladdr 2 2 +D9 DJNZ R1,reladdr 2 2 +DA DJNZ R2,reladdr 2 2 +DB DJNZ R3,reladdr 2 2 +DC DJNZ R4,reladdr 2 2 +DD DJNZ R5,reladdr 2 2 +DE DJNZ R6,reladdr 2 2 +DF DJNZ R7,reladdr 2 2 +E0 MOVX A,@DPTR 1 2 +E1 AJMP addr11 2 2 +E2 MOVX A,@R0 1 2 +E3 MOVX A,@R1 1 2 +E4 CLR A 1 1 +E5 MOV A,direct 2 1 +E6 MOV A,@R0 1 1 +E7 MOV A,@R1 1 1 +E8 MOV A,R0 1 1 +E9 MOV A,R1 1 1 +EA MOV A,R2 1 1 +EB MOV A,R3 1 1 +EC MOV A,R4 1 1 +ED MOV A,R5 1 1 +EE MOV A,R6 1 1 +EF MOV A,R7 1 1 +F0 MOVX @DPTR,A 1 2 +F1 ACALL addr11 2 2 +F2 MOVX @R0,A 1 2 +F3 MOVX @R1,A 1 2 +F4 CPL A 1 1 +F5 MOV direct,A 2 1 +F6 MOV @R0,A 1 1 +F7 MOV @R1,A 1 1 +F8 MOV R0,A 1 1 +F9 MOV R1,A 1 1 +FA MOV R2,A 1 1 +FB MOV R3,A 1 1 +FC MOV R4,A 1 1 +FD MOV R5,A 1 1 +FE MOV R6,A 1 1 +FF MOV R7,A 1 1 diff -Nru emu8051-1.1.1/src/common/operations.c emu8051-2.0.1/src/common/operations.c --- emu8051-1.1.1/src/common/operations.c 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/common/operations.c 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,56 @@ +/* + * operations.c + * + * Copyright (C) 2014 Hugo Villeneuve + * + * This file is released under the GPLv2 + */ + +#if HAVE_CONFIG_H +# include "config.h" +#endif + +#include "common.h" +#include "reg8051.h" +#include "cpu8051.h" +#include "sfr.h" +#include "psw.h" +#include "memory.h" +#include "operations.h" + +/* + * ADD and ADDC function identically except that ADDC adds the value of operand + * as well as the value of the Carry flag whereas ADD does not add the Carry + * flag to the result. + */ +int +addition(int dst, int src, int carry) +{ + psw_clr_cy(); + psw_clr_ac(); + psw_clr_ov(); + + /* + * The Overflow (OV) bit is set if there is a carry-out of bit 6 or + * out of bit 7, but not both. In other words, if the addition of the + * Accumulator, operand and (in the case of ADDC) the Carry flag + * treated as signed values results in a value that is out of the + * range of a signed byte (-128 through +127) the Overflow flag is + * set. Otherwise, the Overflow flag is cleared. + */ + if (dst + src + carry > 0xFF) { + /* Carry from bit 7. */ + psw_set_cy(); + + if (((dst & 0x7F) + (src & 0x7F) + carry) < 0x80) + psw_set_ov(); /* If no carry from bit 6, set OV. */ + } else if (((dst & 0x7F) + (src & 0x7F) + carry) > 0x7F) { + /* If no carry from bit 7, but carry from bit 6, set OV. */ + psw_set_ov(); + } + + if (((dst & 0x0F) + (src & 0x0F) + carry) > 0x0F) + psw_set_ac(); + + return dst + src + carry; +} diff -Nru emu8051-1.1.1/src/common/operations.h emu8051-2.0.1/src/common/operations.h --- emu8051-1.1.1/src/common/operations.h 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/common/operations.h 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,15 @@ +/* + * operations.h + * + * Copyright (C) 2014 Hugo Villeneuve + * + * This file is released under the GPLv2 + */ + +#ifndef OPERATIONS_H +#define OPERATIONS_H 1 + +int +addition(int dest, int src, int carry); + +#endif /* OPERATIONS_H */ diff -Nru emu8051-1.1.1/src/common/options.c emu8051-2.0.1/src/common/options.c --- emu8051-1.1.1/src/common/options.c 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/common/options.c 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,179 @@ +/* + * options.c -- functions for processing command-line options and arguments + * + * Copyright (C) 2011 Hugo Villeneuve + * + * This file is released under the GPLv2 + */ + +#if HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include +#include + +#if STDC_HEADERS +# include +#elif HAVE_STRINGS_H +# include +#endif + +#include "common.h" +#include "options.h" +#include "memory.h" + +const char *argp_program_version = PACKAGE_VERSION; +const char *argp_program_bug_address = PACKAGE_BUGREPORT; + +/* + * Program documentation. + * Adjacent string constants are concatenated as one string constant. + */ +static const char str_doc[] = PACKAGE_NAME " -- " PACKAGE_DESCRIPTION; + +/* How many non-option arguments we accept. */ +#define ARGS_COUNT 1 + +/* A description of the non-option arguments we accept. */ +static const char args_doc[] = "[FILENAME]"; + +/* The options we understand. */ +static struct argp_option argp_options[] = { + {"debug", 'd', "level", 0, "Produce debugging output", 0}, + {"pram", 'p', "size", 0, "Set program memory size", 0}, + {"xram", 'x', "size", 0, + "Set external ram size (default is 1024)", 0}, + {"stop", 's', "addr", 0, + "Automatically run program and stop at address", 0}, + {NULL, 0, NULL, 0, NULL, 0} +}; + +struct options_t options; + +static void +decode_debug_option(char *arg, struct argp_state *state) +{ + char *endptr; + int log_level; + + log_level = (int) strtol(arg, &endptr, 0); + + if (*endptr != '\0') { + log_err("Invalid log level"); + argp_usage(state); + } + + if (log_level > LOG_LEVEL_DEBUG) { + log_err("Invalid log level (0 to 3)"); + argp_usage(state); + } + + options.log = log_level; +} + +static void +decode_memory_size(char *arg, struct argp_state *state, int memid) +{ + char *endptr; + int *dest; + + if (memid == PGM_MEM_ID) + dest = &options.pram_size; + else if (memid == INT_MEM_ID) + dest = &options.iram_size; + else if (memid == EXT_MEM_ID) + dest = &options.xram_size; + else + exit(EXIT_FAILURE); /* Programming error. */ + + /* + * Sizes versus max memory sizes will be checked when calling + * memory_init(). + */ + *dest = (int) strtol(arg, &endptr, 0); + + if (*endptr != '\0') { + log_err("Invalid memory size"); + argp_usage(state); + } +} + +static void +decode_address(char *arg, struct argp_state *state, uint16_t *dest) +{ + char *endptr; + + *dest = (uint16_t) strtol(arg, &endptr, 0); + + if (*endptr != '\0') { + log_err("Invalid address"); + argp_usage(state); + } +} + +/* Parse a single option. */ +static error_t +parse_opt(int key, char *arg, struct argp_state *state) +{ + switch (key) { + case 'd': + decode_debug_option(arg, state); + break; + case 'i': + decode_memory_size(arg, state, INT_MEM_ID); + break; + case 'p': + decode_memory_size(arg, state, PGM_MEM_ID); + break; + case 's': + decode_address(arg, state, &options.stop_address); + break; + case 'x': + decode_memory_size(arg, state, EXT_MEM_ID); + break; + case ARGP_KEY_ARG: + if (state->arg_num >= ARGS_COUNT) { + /* Too many arguments. */ + argp_usage(state); + } + + options.filename = arg; + break; + case ARGP_KEY_END: + if (state->arg_num < ARGS_COUNT) { + /* Not enough arguments, but the filename is optional. + So no error. */ + } + break; + default: + return ARGP_ERR_UNKNOWN; + } + + return 0; +} + +/* Our argp parser. */ +static struct argp argp = {argp_options, parse_opt, args_doc, str_doc, + NULL, NULL, NULL}; + +/* Initializes the different options passed as arguments on the command line. */ +void +parse_command_line_options(int argc, char *argv[]) +{ + error_t rc; + + /* Setting default values. */ + options.filename = NULL; + options.pram_size = PGM_MEM_DEFAULT_SIZE; + options.iram_size = INT_MEM_MAX_SIZE; + options.xram_size = EXT_MEM_DEFAULT_SIZE; + options.log = LOG_LEVEL_ERR; + options.stop_address = 0; /* 0 means stop address is disabled. */ + + /* Parse our arguments. */ + rc = argp_parse(&argp, argc, argv, 0, 0, NULL); + if (rc != 0) + log_fail("Failure to parse command line arguments"); +} diff -Nru emu8051-1.1.1/src/common/options.h emu8051-2.0.1/src/common/options.h --- emu8051-1.1.1/src/common/options.h 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/common/options.h 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,28 @@ +/* + * options.h + * + * Copyright (C) 1999 Hugo Villeneuve + * + * This file is released under the GPLv2 + */ + +#ifndef OPTIONS_H +#define OPTIONS_H 1 + +#define PACKAGE_COPYRIGHT "(c) Hugo Villeneuve" + +#define PACKAGE_DESCRIPTION "Emulator for 8051 family microcontrollers" + +struct options_t { + int pram_size; /* Maximum program memory size. */ + int iram_size; /* Maximum internal ram size. */ + int xram_size; /* Maximum external ram size. */ + char *filename; + int log; + uint16_t stop_address; /* Run program up to that adress and exit. */ +} options_t; + +void +parse_command_line_options(int argc, char *argv[]); + +#endif /* OPTIONS_H */ diff -Nru emu8051-1.1.1/src/common/psw.c emu8051-2.0.1/src/common/psw.c --- emu8051-1.1.1/src/common/psw.c 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/common/psw.c 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,125 @@ +/* + * psw.c + * + * Copyright (C) 2013 Hugo Villeneuve + * + * This file is released under the GPLv2 + */ + +#include "common.h" +#include "reg8051.h" +#include "memory.h" + +/* Returns 0 or 1 */ +int +psw_read_bit(unsigned int bit) +{ + return (mem_read8(INT_MEM_ID, _PSW_) >> bit) & 0x01; +} + +void +psw_write_bit(unsigned int bit, int val) +{ + uint8_t psw = mem_read8(INT_MEM_ID, _PSW_); + + if (val) + psw |= (1 << bit); /* Set */ + else + psw &= ~(1 << bit); /* Clear */ + + mem_write8(INT_MEM_ID, _PSW_, psw); /* Save updated value */ +} + +/* Returns 0 or 1 */ +int +psw_read_cy(void) +{ + return psw_read_bit(PSW_BIT_CY); +} + +void +psw_write_cy(int cy) +{ + psw_write_bit(PSW_BIT_CY, cy); +} + +void +psw_set_cy(void) +{ + psw_write_bit(PSW_BIT_CY, 1); +} + +void +psw_clr_cy(void) +{ + psw_write_bit(PSW_BIT_CY, 0); +} + +/* Returns 0 or 1 */ +int +psw_read_ac(void) +{ + return psw_read_bit(PSW_BIT_AC); +} + +void +psw_write_ac(int ac) +{ + psw_write_bit(PSW_BIT_AC, ac); +} + +void +psw_set_ac(void) +{ + psw_write_bit(PSW_BIT_AC, 1); +} + +void +psw_clr_ac(void) +{ + psw_write_bit(PSW_BIT_AC, 0); +} + +/* Returns 0 or 1 */ +int +psw_read_ov(void) +{ + return psw_read_bit(PSW_BIT_OV); +} + +void +psw_write_ov(int ov) +{ + psw_write_bit(PSW_BIT_OV, ov); +} + +void +psw_set_ov(void) +{ + psw_write_bit(PSW_BIT_OV, 1); +} + +void +psw_clr_ov(void) +{ + psw_write_bit(PSW_BIT_OV, 0); +} + +/* + * Compute parity of bits in accumulator: + * parity = 0: even number of ones in accumulator + * parity = 1: odd number of ones in accumulator + */ +void +psw_compute_parity_bit(void) +{ + int parity = 0; + uint8_t acc = mem_read8(INT_MEM_ID, _ACC_); + + while (acc) { + parity = !parity; + acc = acc & (acc - 1); + } + + psw_write_bit(PSW_BIT_P, parity); +} diff -Nru emu8051-1.1.1/src/common/psw.h emu8051-2.0.1/src/common/psw.h --- emu8051-1.1.1/src/common/psw.h 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/common/psw.h 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,57 @@ +/* + * psw.h + * + * Copyright (C) 2013 Hugo Villeneuve + * + * This file is released under the GPLv2 + */ + +#ifndef PSW_H +#define PSW_H 1 + +int +psw_read_bit(unsigned int bit); + +void +psw_write_bit(unsigned int bit, int val); + +int +psw_read_cy(void); + +void +psw_write_cy(int cy); + +void +psw_clr_cy(void); + +void +psw_set_cy(void); + +int +psw_read_ac(void); + +void +psw_write_ac(int ac); + +void +psw_clr_ac(void); + +void +psw_set_ac(void); + +int +psw_read_ov(void); + +void +psw_write_ov(int ov); + +void +psw_clr_ov(void); + +void +psw_set_ov(void); + +void +psw_compute_parity_bit(void); + +#endif /* PSW_H */ diff -Nru emu8051-1.1.1/src/common/reg8051.h emu8051-2.0.1/src/common/reg8051.h --- emu8051-1.1.1/src/common/reg8051.h 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/common/reg8051.h 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,63 @@ +/* + * reg8051.h + * + * Copyright (C) 1999 Jonathan St-André + * Copyright (C) 1999 Hugo Villeneuve + * + * This file is released under the GPLv2 + */ + +#ifndef REG8051_H +#define REG8051_H 1 + +/* SFR Registers ( $80 - $FF ) */ +#define _ACC_ 0xE0 +#define _B_ 0xF0 +#define _PSW_ 0xD0 +#define _SP_ 0x81 +#define _DPTRLOW_ _DPL_ +#define _DPTRHIGH_ _DPH_ +#define _DPL_ 0x82 +#define _DPH_ 0x83 +#define _P0_ 0x80 +#define _P1_ 0x90 +#define _P2_ 0xA0 +#define _P3_ 0xB0 +#define _IP_ 0xB8 +#define _IE_ 0xA8 +#define _TMOD_ 0x89 +#define _TCON_ 0x88 +#define _TH0_ 0x8C +#define _TL0_ 0x8A +#define _TH1_ 0x8D +#define _TL1_ 0x8B +#define _SCON_ 0x98 +#define _SBUF_ 0x99 +#define _PCON_ 0x87 +#define _T2CON_ 0xC8 + +#define _R0_ 0x00 +#define _R1_ 0x01 +#define _R2_ 0x02 +#define _R3_ 0x03 +#define _R4_ 0x04 +#define _R5_ 0x05 +#define _R6_ 0x06 +#define _R7_ 0x07 + +#define _BANK0_ 0x00 +#define _BANK1_ 0x08 +#define _BANK2_ 0x10 +#define _BANK3_ 0x18 + +#define PSW_BIT_CY 7 +#define PSW_BIT_AC 6 +#define PSW_BIT_OV 2 +#define PSW_BIT_P 0 + +#define PSW_FLAG_CY (1 << PSW_BIT_CY) +#define PSW_FLAG_AC (1 << PSW_BIT_AC) +#define PSW_FLAG_OV (1 << PSW_BIT_OV) +#define PSW_FLAG_P (1 << PSW_BIT_P) + +#endif /* REG8051_H */ diff -Nru emu8051-1.1.1/src/common/sfr.c emu8051-2.0.1/src/common/sfr.c --- emu8051-1.1.1/src/common/sfr.c 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/common/sfr.c 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,357 @@ +/* + * sfr.c + * + * Copyright (C) 2013 Hugo Villeneuve + * + * This file is released under the GPLv2 + */ + +#if HAVE_CONFIG_H +# include "config.h" +#endif + +#include + +#include "common.h" +#include "reg8051.h" +#include "cpu8051.h" +#include "sfr.h" +#include "memory.h" +#include "instructions_8051.h" + +#define HEX_DIGITS_2 2 +#define HEX_DIGITS_4 4 + +/* Specific read/write functions for special registers. */ + +static unsigned int +regwin_read_pc(int dummy) +{ + (void) dummy; /* Remove compiler warning about unused variable. */ + + return cpu8051.pc; +} + +static void +regwin_write_pc(int param, int val) +{ + (void) param; /* Remove compiler warning about unused variable. */ + + cpu8051.pc = (uint16_t) val; +} + +static unsigned int +regwin_read_timer(int timer_low_addr) +{ + return (mem_sfr_read8(timer_low_addr + 2) << 8) | + mem_sfr_read8(timer_low_addr); +} + +static void +regwin_write_timer(int timer_low_addr, int val) +{ + mem_sfr_write8(timer_low_addr + 2, + (uint8_t) ((val & 0x0000FFFF) >> 8)); + mem_sfr_write8(timer_low_addr, (uint8_t) val); +} + +static uint8_t +regwin_read_bank_offset(void) +{ + return mem_sfr_read8(_PSW_) & 0x18; +} + +static unsigned int +regwin_read_bank(int dummy) +{ + (void) dummy; /* Remove compiler warning about unused variable. */ + + return regwin_read_bank_offset() >> 3; +} + +static void +regwin_write_bank(int param, int bank_number) +{ + uint8_t psw = mem_sfr_read8(_PSW_); + + (void) param; /* Remove compiler warning about unused variable. */ + + if ((bank_number < 0) || (bank_number > 3)) { + log_info("Error: invalid bank number: %d", bank_number); + bank_number = 0; + } + + mem_sfr_write8(_PSW_, (psw & ~0x18) | (bank_number << 3)); +} + +/* Indirect read of R0 - R7 in current bank from internal memory. */ +static unsigned int +regwin_read_rx(int offset) +{ + return mem_read8(INT_MEM_ID, regwin_read_bank_offset() + offset); +} + +/* Indirect write to R0 - R7 in current bank to internal memory. */ +static void +regwin_write_rx(int offset, int val) +{ + mem_write8(INT_MEM_ID, regwin_read_bank_offset() + offset, + (uint8_t) val); +} + +/* This array defines how to read value for each register. */ +static struct regwin_infos_t regwin_infos[SFR_REGS] = { + { + "PC", + HEX_DIGITS_4, + regwin_read_pc, regwin_write_pc, + 0, /* Dummy */ + }, + { + "SP", + HEX_DIGITS_2, + NULL, NULL, + _SP_, + }, + { + "PSW", + HEX_DIGITS_2, + NULL, NULL, + _PSW_, + }, + { + "A", + HEX_DIGITS_2, + NULL, NULL, + _ACC_, + }, + { + "B", + HEX_DIGITS_2, + NULL, NULL, + _B_, + }, + { + "DPTR", + HEX_DIGITS_4, + NULL, NULL, + _DPL_, + }, + { + "P0", + HEX_DIGITS_2, + NULL, NULL, + _P0_, + }, + { + "P1", + HEX_DIGITS_2, + NULL, NULL, + _P1_, + }, + { + "P2", + HEX_DIGITS_2, + NULL, NULL, + _P2_, + }, + { + "P3", + HEX_DIGITS_2, + NULL, NULL, + _P3_, + }, + { + "TCON", + HEX_DIGITS_2, + NULL, NULL, + _TCON_, + }, + { + "TMOD", + HEX_DIGITS_2, + NULL, NULL, + _TMOD_, + }, + { + "TIMER0", + HEX_DIGITS_4, + regwin_read_timer, regwin_write_timer, + _TL0_, + }, + { + "TIMER1", + HEX_DIGITS_4, + regwin_read_timer, regwin_write_timer, + _TL1_, + }, + { + "SCON", + HEX_DIGITS_2, + NULL, NULL, + _SCON_, + }, + { + "IE", + HEX_DIGITS_2, + NULL, NULL, + _IE_, + }, + { + "IP", + HEX_DIGITS_2, + NULL, NULL, + _IP_, + }, + { + "BANK", + HEX_DIGITS_2, + regwin_read_bank, regwin_write_bank, + 0, /* Dummy */ + }, + /* R0-R7 Registers in current Bank */ + { + "R0", + HEX_DIGITS_2, + regwin_read_rx, regwin_write_rx, + _R0_, + }, + { + "R1", + HEX_DIGITS_2, + regwin_read_rx, regwin_write_rx, + _R1_, + }, + { + "R2", + HEX_DIGITS_2, + regwin_read_rx, regwin_write_rx, + _R2_, + }, + { + "R3", + HEX_DIGITS_2, + regwin_read_rx, regwin_write_rx, + _R3_, + }, + { + "R4", + HEX_DIGITS_2, + regwin_read_rx, regwin_write_rx, + _R4_, + }, + { + "R5", + HEX_DIGITS_2, + regwin_read_rx, regwin_write_rx, + _R5_, + }, + { + "R6", + HEX_DIGITS_2, + regwin_read_rx, regwin_write_rx, + _R6_, + }, + { + "R7", + HEX_DIGITS_2, + regwin_read_rx, regwin_write_rx, + _R7_, + }, +}; + +/* Generic read/write functions */ +static unsigned int +regwin_read_generic(int addr, int width) +{ + if (width == 2) { + return mem_sfr_read8(addr); + } else if (width == 4) { + /* Address is low address. */ + return (mem_sfr_read8(addr + 1) << 8) | + mem_sfr_read8(addr); + } else { + return 0xFFFFFFFF; + } +} + +static void +regwin_write_generic(int addr, int val, int width) +{ + if (width == 2) { + mem_sfr_write8(addr, (uint8_t) val); + } else if (width == 4) { + /* Address is low address. */ + mem_sfr_write8(addr + 1, (uint8_t) ((val & 0x0000FFFF) >> 8)); + mem_sfr_write8(addr, (uint8_t) val); + } +} + +int +regwin_read(int row) +{ + int val; + + if (regwin_infos[row].read_func == NULL) { + /* + * Read register value using generic 8 or 16 bits read + * function, depending on width. + */ + val = regwin_read_generic(regwin_infos[row].param, + regwin_infos[row].w); + } else { + /* Read register value using custom function pointer. */ + val = regwin_infos[row].read_func( + regwin_infos[row].param); + } + + return val; +} + +int +regwin_write(struct regwin_infos_t *p, int new) +{ + int max_value; + + max_value = (1 << (4 * p->w)) - 1; /* 16^w - 1 */ + + /* Check that the new value is not too large for the register type. */ + if (new > max_value) { + /* Display message for CLI version */ + printf("Value out of range\n"); + return -1; + } + + if (p->write_func == NULL) { + /* + * Write register value using generic 8 or 16 bits write + * function, depending on width. + */ + regwin_write_generic(p->param, new, p->w); + } else { + /* Write register value using custom function pointer. */ + p->write_func(p->param, new); + } + + return 0; +} + +struct regwin_infos_t * +sfr_get_infos(const char *regname) +{ + int row; + + for (row = 0; row < SFR_REGS; row++) { + if (strcmp(regwin_infos[row].name, regname) == 0) + return ®win_infos[row]; + } + + return NULL; /* Register not found. */ +} + +struct regwin_infos_t * +sfr_get_infos_from_row(int row) +{ + return ®win_infos[row]; +} + diff -Nru emu8051-1.1.1/src/common/sfr.h emu8051-2.0.1/src/common/sfr.h --- emu8051-1.1.1/src/common/sfr.h 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/common/sfr.h 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,34 @@ +/* + * sfr.h + * + * Copyright (C) 2013 Hugo Villeneuve + * + * This file is released under the GPLv2 + */ + +#ifndef SFR_H +#define SFR_H 1 + +#define SFR_REGS 26 + +struct regwin_infos_t { + char *name; /* Register name */ + int w; /* Number of hex digits to display */ + unsigned int (*read_func)(int addr); /* Function to read value */ + void (*write_func)(int param, int val); /* Function to write value */ + int param; /* Optional parameter to pass to read function. */ +}; + +int +regwin_read(int row); + +int +regwin_write(struct regwin_infos_t *p, int new); + +struct regwin_infos_t * +sfr_get_infos(const char *regname); + +struct regwin_infos_t * +sfr_get_infos_from_row(int row); + +#endif /* SFR_H */ diff -Nru emu8051-1.1.1/src/common/timers.c emu8051-2.0.1/src/common/timers.c --- emu8051-1.1.1/src/common/timers.c 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/common/timers.c 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,166 @@ +/* + * timers.c + * + * Copyright (C) 1999 Jonathan St-André + * Copyright (C) 1999 Hugo Villeneuve + * + * This file is released under the GPLv2 + */ + +#include +#include +#include +#include "config.h" + +#include "common.h" +#include "reg8051.h" +#include "cpu8051.h" +#include "memory.h" +#include "psw.h" +#include "options.h" +#include "instructions_8051.h" +#include "timers.h" + +static int gp_timer_value[GP_TIMERS_COUNT]; + +extern struct options_t options; + +void +gp_timer_reset(int id) +{ + log_debug("gp timer %d reset", id); + gp_timer_value[id] = 0; +} + +void +gp_timers_increment(int count) +{ + int id; + + log_debug("gp timers increment"); + + for (id = 0; id < GP_TIMERS_COUNT; id++) + gp_timer_value[id] += count; +} + +int +gp_timer_read(int id) +{ + return gp_timer_value[id]; +} + +static void +timer_increment_check_overflow(uint8_t counter_address, uint8_t tf_mask) +{ + unsigned int tmp; + + tmp = mem_read_direct(counter_address); + tmp++; + tmp &= 0xFF; + if (tmp == 0) { + /* If overflow set TFx */ + mem_write_direct(_TCON_, + mem_read_direct(_TCON_) | tf_mask); + } + + mem_write_direct(counter_address, tmp); /* Save new value. */ +} + +static void +timer_with_prescaler(uint8_t tl, uint8_t th, uint8_t tf_mask, + int prescaler_width) +{ + unsigned int prescaler; + + prescaler = mem_read_direct(tl); + prescaler++; + + prescaler &= (1 << prescaler_width) - 1; /* Keep only required bits */ + mem_write_direct(tl, prescaler); + + if (prescaler == 0) + timer_increment_check_overflow(th, tf_mask); +} + +static void +process_timer(uint8_t tl, uint8_t th, uint8_t tf_mask, uint8_t TR, uint8_t mode, + uint8_t gate, uint32_t timer_counter) +{ + unsigned int tmp; + + switch (mode) { + case 0: + /* Mode 0, 8-bit timer "TH" with "TL" as 5-bit prescaler. */ + timer_with_prescaler(tl, th, tf_mask, 5); + break; + case 1: + /* Mode 1, 16-bits counter */ + timer_with_prescaler(tl, th, tf_mask, 8); + break; + case 2: + /* Mode 2, 8-bits counter with Auto-Reload */ + tmp = mem_read_direct(tl); + tmp++; + tmp &= 0xFF; + if (tmp == 0) { + /* If overflow -> reload and set TF0 */ + mem_write_direct( + _TCON_, + mem_read_direct(_TCON_) | tf_mask); + mem_write_direct(tl, mem_read_direct(th)); + } else { + mem_write_direct(tl, tmp); + } + break; + case 3: + /* + * Mode 3: + * inactive mode for timer 1 + * 2 independents 8-bits timers for timer 0. + */ + + if (tl == _TL1_) + break; + + if (TR && !gate && !timer_counter) + timer_increment_check_overflow(tl, tf_mask); + + /* TH0 uses TR1 et TF1. */ + TR = mem_read_direct(_TCON_) & 0x40; + + if (TR) + timer_increment_check_overflow(th, 0x80); + + break; + } +} + +/* Run 8051 timers */ +void +timers_check(void) +{ + unsigned int tr; + unsigned int mode; + unsigned int gate; + unsigned int timer_counter; + + /* Timer 0 */ + tr = mem_read_direct(_TCON_) & 0x10; + mode = mem_read_direct(_TMOD_) & 0x03; + gate = mem_read_direct(_TMOD_) & 0x08; + timer_counter = mem_read_direct(_TMOD_) & 0x04; + + if ((tr && !gate && !timer_counter) || (mode == 3)) + process_timer(_TL0_, _TH0_, 0x20, tr, mode, gate, + timer_counter); + + /* Timer 1 */ + tr = mem_read_direct(_TCON_) & 0x40; + mode = (mem_read_direct(_TMOD_) & 0x30) >> 4; + gate = mem_read_direct(_TMOD_) & 0x80; + timer_counter = mem_read_direct(_TMOD_) & 0x40; + + if (tr && !gate && !timer_counter) + process_timer(_TL1_, _TH1_, 0x80, tr, mode, gate, + timer_counter); +} diff -Nru emu8051-1.1.1/src/common/timers.h emu8051-2.0.1/src/common/timers.h --- emu8051-1.1.1/src/common/timers.h 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/common/timers.h 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,29 @@ +/* + * timers.h + * + * Copyright (C) 2013 Hugo Villeneuve + * + * This file is released under the GPLv2 + */ + +#ifndef TIMERS_H +#define TIMERS_H 1 + +#include + +/* Maximum of 4 for CLI version */ +#define GP_TIMERS_COUNT 2 + +void +gp_timer_reset(int id); + +void +gp_timers_increment(int count); + +int +gp_timer_read(int id); + +void +timers_check(void); + +#endif /* TIMERS_H */ diff -Nru emu8051-1.1.1/src/common.h emu8051-2.0.1/src/common.h --- emu8051-1.1.1/src/common.h 2011-10-29 21:06:32.000000000 +0000 +++ emu8051-2.0.1/src/common.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,59 +0,0 @@ -/* - * common.h - * - * Copyright (C) 1999 Jonathan St-André - * Copyright (C) 1999 Hugo Villeneuve - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef COMMON_H -#define COMMON_H 1 - -/* Define this to have debugging output. */ -/* #define EMU8051_DEBUG 1 */ - -#include -#include -#include - -#if STDC_HEADERS -# include -#elif HAVE_STRINGS_H -# include -#endif - -#define FIXED_FONT "monospace 12" - -/* Common constants. */ -#ifndef EXIT_SUCCESS -# define EXIT_SUCCESS 0 -# define EXIT_FAILURE 1 -#endif - -/* Returns TRUE if the strings 'a' and 'b' are equal. */ -#define STREQ(a, b) (strcasecmp((a), (b)) == 0) - -/* Returns TRUE if the first 'c' characters of strings 'a' and 'b' are equal. */ -#define STREQ_LEN(a, b, c) (strncasecmp((a), (b), (c)) == 0) - - -inline void -ErrorLocation(const char *file, int line); - -void * -xmalloc(size_t size, const char *filename, int line_number); - -#endif /* COMMON_H */ diff -Nru emu8051-1.1.1/src/cpu8051.c emu8051-2.0.1/src/cpu8051.c --- emu8051-1.1.1/src/cpu8051.c 2011-10-29 21:06:32.000000000 +0000 +++ emu8051-2.0.1/src/cpu8051.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,596 +0,0 @@ -/* - * cpu8051.c - * - * Copyright (C) 1999 Jonathan St-André - * Copyright (C) 1999 Hugo Villeneuve - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* Define only here, for not having extern scope on local variables. */ -#define CPU8051_M 1 - -#include -#include - -#include "reg8051.h" -#include "cpu8051.h" -#include "memory.h" -#include "disasm.h" -#include "instructions_8051.h" - -/* Check if the address is a breakpoint */ -int -IsBreakpoint(unsigned int address) -{ - int k; - - for (k = 0; k < cpu8051.bp_count; k++) { - if (cpu8051.bp[k] == address) - return 1; - } - - /* The address was not found in the list of breakpoints */ - return 0; -} - -/* Show Breakpoints list */ -void -ShowBreakpoints(void) -{ - int k; - - for (k = 0; k < cpu8051.bp_count; k++) - printf("Breakpoint at address = %.4X\n", cpu8051.bp[k]); -} - -/* Set Breakpoint at address at the end of the breakpoint list */ -void -SetBreakpoint(unsigned int address) -{ - if (IsBreakpoint(address)) - return; /* Already a breakpoint */ - - if (cpu8051.bp_count < MAXBP) - cpu8051.bp[cpu8051.bp_count++] = address; -} - -/* Clear Breakpoint at Address from list */ -void -ClearBreakpoint(unsigned int address) -{ - int k; - - for (k = 0; k < cpu8051.bp_count; k++) { - if (cpu8051.bp[k] == address) { - /* Fill removed breakpoint slot with last entry */ - cpu8051.bp[k] = cpu8051.bp[cpu8051.bp_count - 1]; - cpu8051.bp_count--; - } - } -} - -/* Toggle the breakpoint at Address. */ -void -ToggleBreakpoint(unsigned int address) -{ - if (IsBreakpoint(address)) - ClearBreakpoint(address); - else - SetBreakpoint(address); -} - -void -cpu8051_init(void) -{ - cpu8051.pc = 0; - cpu8051.clock = 0; - cpu8051.active_priority = -1; - cpu8051.bp_count = 0; -} - -/* Reset the registers and CPU state */ -void -cpu8051_Reset(void) -{ - int i; - - cpu8051.pc = 0; - cpu8051.clock = 0; - cpu8051.active_priority = -1; - - /* Reset registers */ - - for (i = 0; i < 256; i++) { - /* Clear IRAM nad SFR */ - memory_write8(INT_MEM_ID, i, 0); - } - - memory_write8(INT_MEM_ID, _P0_, 0xFF); - memory_write8(INT_MEM_ID, _P1_, 0xFF); - memory_write8(INT_MEM_ID, _P2_, 0xFF); - memory_write8(INT_MEM_ID, _P3_, 0xFF); - memory_write8(INT_MEM_ID, _SP_, 0x07); -} - -static void -cpu8051_convert_bit_address(uint8_t bit_address, uint8_t *byte_address, - uint8_t *bit_number) -{ - if (bit_address > 0x7F) { - /* SFR 80-FF */ - *byte_address = bit_address & 0xF8; - *bit_number = bit_address & 0x07; - } else { - /* 20-2F */ - *byte_address = (bit_address >> 3) + 0x20; - *bit_number = bit_address & 0x07; - } -} - -/* Write with a direct addressing mode at Address the new Value */ -void -cpu8051_WriteD(unsigned int Address, unsigned char Value) -{ - memory_write8(INT_MEM_ID, Address, Value); -} - -/* Write with an indirect addressing mode at Address the new Value */ -void -cpu8051_WriteI(unsigned int Address, unsigned char Value) -{ - if (Address > 0x7F) { - memory_write8(EXT_MEM_ID, Address, Value); - return; - } - - memory_write8(INT_MEM_ID, Address, Value); -} - -/* Write with a bit addressing mode at BitAddress the new Value */ -void -cpu8051_WriteB(uint8_t bit_address, uint8_t value) -{ - uint8_t byte_address; - uint8_t bit_number; - unsigned char ByteValue, ByteMask; - - cpu8051_convert_bit_address(bit_address, &byte_address, &bit_number); - - ByteMask = ((1 << bit_number) ^ 0xFF); - ByteValue = cpu8051_ReadD(byte_address) & ByteMask; - ByteValue += value << bit_number; - cpu8051_WriteD(byte_address, ByteValue); -} - -/* Read with a direct addressing mode at Address */ -unsigned char -cpu8051_ReadD(unsigned int Address) -{ - if (Address > 0xFF) - return memory_read8(EXT_MEM_ID, Address); - else - return memory_read8(INT_MEM_ID, Address); -} - -/* Read with a indirect addressing mode at Address */ -unsigned char -cpu8051_ReadI(unsigned int Address) -{ - if (Address > 0x7F) - return memory_read8(EXT_MEM_ID, Address); - else - return memory_read8(INT_MEM_ID, Address); -} - -/* Read with a bit addressing mode at BitAddress */ -unsigned char -cpu8051_ReadB(uint8_t bit_address) -{ - uint8_t byte_address; - uint8_t bit_number; - unsigned char BitValue; - - cpu8051_convert_bit_address(bit_address, &byte_address, &bit_number); - - BitValue = (cpu8051_ReadD(byte_address) >> bit_number); - BitValue &= 1; - return BitValue; -} - -static void -cpu8051_process_interrupt(int pc, int pri) -{ - unsigned char SP; - - SP = cpu8051_ReadD(_SP_); - cpu8051_WriteI(++SP, (cpu8051.pc & 0xFF)); - cpu8051_WriteI(++SP, (cpu8051.pc >> 8)); - cpu8051_WriteD(_SP_, SP); - cpu8051.pc = 0x0B; - cpu8051.active_priority = pri; -} - - -/* Check interrupts state and process them as needed */ -static void -cpu8051_CheckInterrupts(void) -{ - int i; - - if ((cpu8051_ReadD(_IE_) & 0x80) == 0) - return; - - for (i = 1; i >= 0; i--) { - if (cpu8051.active_priority < i) { - /* Interrupt timer 0 */ - if ((cpu8051_ReadD(_IE_) & 0x02) && - ((cpu8051_ReadD(_IP_ & 0x02) ? i : !i) && - (cpu8051_ReadD(_TCON_) & 0x20))) { - cpu8051_WriteD(_TCON_, - cpu8051_ReadD(_TCON_) & 0xDF); - cpu8051_process_interrupt(0x0B, i); - return; - } - /* Interrupt timer 1 */ - if ((cpu8051_ReadD(_IE_) & 0x08) && - ((cpu8051_ReadD(_IP_) & 0x08) ? i : !i) && - (cpu8051_ReadD(_TCON_) & 0x80)) { - cpu8051_WriteD(_TCON_, - cpu8051_ReadD(_TCON_) & 0x7F); - cpu8051_process_interrupt(0x1B, i); - return; - } - /* Serial Interrupts */ - if ((cpu8051_ReadD(_IE_) & 0x10) && - ((cpu8051_ReadD(_IP_) & 0x10) ? i : !i) && - (cpu8051_ReadD(_SCON_) & 0x03)) { - cpu8051_process_interrupt(0x23, i); - return; - } - /* Interrupt timer 2 */ - if ((cpu8051_ReadD(_IE_) & 0x20) && - ((cpu8051_ReadD(_IP_) & 0x20) ? i : !i) && - (cpu8051_ReadD(_T2CON_) & 0x80)) { - cpu8051_process_interrupt(0x2B, i); - return; - } - } - } -} - -static void -process_timer(uint8_t tl, uint8_t th, uint8_t tf_mask, uint8_t TR, uint8_t mode, - uint8_t GATE, uint32_t TimerCounter) -{ - unsigned int tmp; - - switch (mode) { - case 0: - /* Mode 0, 13-bits counter. */ - tmp = cpu8051_ReadD(th) * 0x100 + cpu8051_ReadD(tl); - tmp++; - tmp &= 0x1FFF; /* We keep only 13 bits */ - - if (tmp == 0) /* If overflow set TF0 */ - cpu8051_WriteD(_TCON_, cpu8051_ReadD(_TCON_) | tf_mask); - cpu8051_WriteD(_TH0_, tmp / 0x100); - cpu8051_WriteD(_TL0_, tmp & 0xFF); - break; - case 1: - /* Mode 1, 16-bits counter */ - tmp = cpu8051_ReadD(th) * 0x100 + cpu8051_ReadD(tl); - tmp++; - tmp &= 0xFFFF; /* We keep only 16 bits */ - if (tmp == 0) /* If overflow set TF0 */ - cpu8051_WriteD(_TCON_, cpu8051_ReadD(_TCON_) | tf_mask); - cpu8051_WriteD(_TH0_, (tmp / 0x100)); - cpu8051_WriteD(_TL0_, (tmp & 0xFF)); - break; - case 2: - /* Mode 2, 8-bits counter with Auto-Reload */ - tmp = cpu8051_ReadD(tl); - tmp++; - tmp &= 0xFF; - if (tmp == 0) { - /* If overflow -> reload and set TF0 */ - cpu8051_WriteD(_TCON_, cpu8051_ReadD(_TCON_) | tf_mask); - cpu8051_WriteD(tl, cpu8051_ReadD(th)); - } else - cpu8051_WriteD(tl, tmp); - break; - case 3: - /* Mode 3 : inactive mode for timer 1 */ - if (tl == _TL0_) { - /* TL0 and TH0 are 2 independents 8-bits timers. */ - if (TR && !GATE && !TimerCounter) { - tmp = cpu8051_ReadD(tl); - tmp++; - tmp &= 0xFF; - if (tmp == 0) /* If TL0 overflow set TF0 */ - cpu8051_WriteD(_TCON_, - cpu8051_ReadD(_TCON_) | - tf_mask); - cpu8051_WriteD(tl, tmp); - } /* TH0 utilise TR1 et TF1. */ - TR = cpu8051_ReadD(_TCON_) & 0x40; - if (TR) { - tmp = cpu8051_ReadD(th); - tmp++; - tmp &= 0xFF; - if (tmp == 0) /* If TH0 overflow set TF1 */ - cpu8051_WriteD(_TCON_, - cpu8051_ReadD(_TCON_) | - 0x80); - cpu8051_WriteD(_TH0_, tmp); - } - } - break; - } -} - -/* Run timers */ -static void -cpu8051_DoTimers(void) -{ - unsigned int TR; - unsigned int MODE; - unsigned int GATE; - unsigned int TimerCounter; - - /* Timer 0 */ - TR = cpu8051_ReadD(_TCON_) & 0x10; - MODE = cpu8051_ReadD(_TMOD_) & 0x03; - GATE = cpu8051_ReadD(_TMOD_) & 0x08; - TimerCounter = cpu8051_ReadD(_TMOD_) & 0x04; - - if ((TR && !GATE && !TimerCounter) || (MODE == 3)) - process_timer(_TL0_, _TH0_, 0x20, TR, MODE, GATE, TimerCounter); - - /* Timer 1 */ - TR = cpu8051_ReadD(_TCON_) & 0x40; - MODE = (cpu8051_ReadD(_TMOD_) & 0x30) >> 4 ; - GATE = cpu8051_ReadD(_TMOD_) & 0x80; - TimerCounter = cpu8051_ReadD(_TMOD_) & 0x40; - - if (TR && !GATE && !TimerCounter) - process_timer(_TL1_, _TH1_, 0x80, TR, MODE, GATE, TimerCounter); -} - -/* Execute at address cpu8051.pc from PGMMem */ -void -cpu8051_Exec(void) -{ - int i; - unsigned char opcode; - int insttiming; - - opcode = memory_read8(PGM_MEM_ID, cpu8051.pc); - cpu8051.pc++; - insttiming = (*opcode_table[opcode])(); /* Function callback. */ - - for (i = 0; i < insttiming; i++) { - cpu8051_CheckInterrupts(); - cpu8051_DoTimers(); - cpu8051.clock++; - } -} - -/* - * Addressing modes defined in the order as they appear in disasm.h - * from table argstext[] - */ -#define ADDR11 0 -#define ADDR16 1 -#define DIRECT 3 -#define BITADDR 14 -#define RELADDR 15 -#define DATAIMM 16 -#define DATA16 22 -#define CBITADDR 23 - -/* - * SFR Memory map [80h - FFh] - * --------------------------------------------------------------- - * F8 | | | | | | | | | FF - * F0 | B | | | | | | | | F7 - * E8 | | | | | | | | | EF - * E0 | ACC | | | | | | | | E7 - * D8 | | | | | | | | | DF - * D0 | PSW | | | | | | | | D7 - * C8 | T2CON| |RCAP2L|RCAP2H| TL2 | TH2 | | | CF - * C0 | | | | | | | | | C7 - * B8 | IP | | | | | | | | BF - * B0 | P3 | | | | | | | | B7 - * A8 | IE | | | | | | | | AF - * A0 | P2 | | | | | | | | A7 - * 98 | SCON | SBUF | | | | | | | 9F - * 90 | P1 | | | | | | | | 97 - * 88 | TCON | TMOD | TL0 | TL1 | TH0 | TH1 | | | 8F - * 80 | P0 | SP | DPL | DPH | | | | PCON | 87 - * --------------------------------------------------------------- - */ - -/* Return as Text the name of the SFR register at Address if any */ -static int -cpu8051_SFRMemInfo(unsigned int Address, char *Text) -{ - switch (Address) { - case 0x80: return sprintf(Text, "P0"); - case 0x81: return sprintf(Text, "SP"); - case 0x82: return sprintf(Text, "DPL"); - case 0x83: return sprintf(Text, "DPH"); - case 0x87: return sprintf(Text, "PCON"); - case 0x88: return sprintf(Text, "TCON"); - case 0x89: return sprintf(Text, "TMOD"); - case 0x8A: return sprintf(Text, "TL0"); - case 0x8B: return sprintf(Text, "TL1"); - case 0x8C: return sprintf(Text, "TH0"); - case 0x8D: return sprintf(Text, "TH1"); - case 0x90: return sprintf(Text, "P1"); - case 0x98: return sprintf(Text, "SCON"); - case 0x99: return sprintf(Text, "SBUF"); - case 0xA0: return sprintf(Text, "P2"); - case 0xA8: return sprintf(Text, "IE"); - case 0xB0: return sprintf(Text, "P3"); - case 0xB8: return sprintf(Text, "IP"); - case 0xC8: return sprintf(Text, "T2CON"); - case 0xCA: return sprintf(Text, "RCAP2L"); - case 0xCB: return sprintf(Text, "RCAP2H"); - case 0xCC: return sprintf(Text, "TL2"); - case 0xCD: return sprintf(Text, "TH2"); - case 0xD0: return sprintf(Text, "PSW"); - case 0xE0: return sprintf(Text, "ACC"); - case 0xF0: return sprintf(Text, "B"); - default: return sprintf(Text, "%.2XH", Address); - } -} - -/* Return as Text the decoded BitAddress */ -static void -cpu8051_IntMemBitInfo(uint8_t bit_address, char *text) -{ - uint8_t byte_address; - uint8_t bit_number; - int len; - - cpu8051_convert_bit_address(bit_address, &byte_address, &bit_number); - - len = cpu8051_SFRMemInfo(byte_address, text); - sprintf(&text[len], ".%X", bit_address); -} - -/* Disasm one instruction at Address into a Text string */ -int -cpu8051_Disasm(unsigned int Address, char *Text) -{ - int len = 0; - char TextTmp[20]; - unsigned char OpCode; - int ArgTblOfs; - int InstSize; - int i; - - OpCode = memory_read8(PGM_MEM_ID, Address); - InstSize = InstSizesTbl[OpCode]; - - len += sprintf(Text, " %.4X ", Address); - - for (i = 0; i < InstSize; i++) - len += sprintf(&Text[len], " %.2X", - memory_read8(PGM_MEM_ID, Address + i)); - - Address++; - - for (; len < 17;) - len += sprintf(&Text[len], " "); - - len += sprintf(&Text[len], "%s ", - InstTextTbl[InstTypesTbl[OpCode]]); - ArgTblOfs = OpCode << 2; - - for (; len < 25;) - len += sprintf(&Text[len], " "); - - /* - * MOV direct, direct (OpCode 85h) is peculiar, the operands - * are inverted - */ - if (OpCode == 0x85) { - cpu8051_SFRMemInfo(memory_read8(PGM_MEM_ID, Address + 1), - TextTmp); - len += sprintf(&Text[len], "%s,", TextTmp); - cpu8051_SFRMemInfo(memory_read8(PGM_MEM_ID, Address), - TextTmp); - len += sprintf(&Text[len], "%s", TextTmp); - Address += 2; - return InstSize; - } - - for (i = 1; i <= InstArgTbl[ArgTblOfs]; i++) { - switch (InstArgTbl[ArgTblOfs + i]) { - case ADDR11: { - len += sprintf(&Text[len], - "%.4XH", ((OpCode << 3) & 0xF00) + - (memory_read8(PGM_MEM_ID, Address))); - Address++; - break; - } - case ADDR16: { - len += sprintf( - &Text[len], "%.4XH", - ((memory_read8(PGM_MEM_ID, Address) << 8) + - memory_read8(PGM_MEM_ID, Address + 1))); - Address += 2; - break; - } - case DIRECT: { - cpu8051_SFRMemInfo(memory_read8(PGM_MEM_ID, Address), - TextTmp); - len += sprintf(&Text[len], "%s", TextTmp); - Address++; - break; - } - case BITADDR: { - cpu8051_IntMemBitInfo( - (memory_read8(PGM_MEM_ID, Address) & 0xF8), - TextTmp); - len += sprintf(&Text[len], "%s.%X" , TextTmp, - (memory_read8(PGM_MEM_ID, Address) & 7)); - Address++; - break; - } - case RELADDR: { - Address++; - len += sprintf(&Text[len], "%.4XH", (Address & 0xFF00) + - (((Address & 0xFF) + - memory_read8(PGM_MEM_ID, - Address - 1)) & 0xFF)); - break; - } - case DATAIMM: { - len += sprintf(&Text[len], "#%.2XH", - memory_read8(PGM_MEM_ID, Address)); - Address++; - break; - } - case DATA16: { - len += sprintf(&Text[len], "#%.4XH", - ((memory_read8(PGM_MEM_ID, - Address) << 8) + - memory_read8(PGM_MEM_ID, Address+1))); - Address += 2; - break; - } - case CBITADDR: { - cpu8051_IntMemBitInfo((memory_read8(PGM_MEM_ID, - Address) & 0xF8), - TextTmp); - len += sprintf(&Text[len], "/%s.%X", TextTmp, - (memory_read8(PGM_MEM_ID, Address) & 7)); - Address++; - break; - } - default: { - len += sprintf(&Text[len], "%s", - ArgsTextTbl[InstArgTbl[ArgTblOfs + i]]); - } - } - if (i < InstArgTbl[ArgTblOfs]) - len += sprintf(&Text[len], ","); - } - - return InstSize; -} diff -Nru emu8051-1.1.1/src/cpu8051.h emu8051-2.0.1/src/cpu8051.h --- emu8051-1.1.1/src/cpu8051.h 2011-10-29 21:06:32.000000000 +0000 +++ emu8051-2.0.1/src/cpu8051.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,93 +0,0 @@ -/* - * cpu8051.h - * - * Copyright (C) 1999 Jonathan St-André - * Copyright (C) 1999 Hugo Villeneuve - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef CPU8051_H -#define CPU8051_H 1 - -#include - -/* Maximum number of BreakPoints */ -#define MAXBP 32 - -struct cpu8051_t { - unsigned int pc; /* Program counter */ - unsigned long clock; - int active_priority; - int bp_count; - unsigned int bp[MAXBP]; /* List of breakpoints */ -}; - -/* Exported variables */ -#undef _SCOPE_ -#ifdef CPU8051_M -# define _SCOPE_ /**/ -#else -# define _SCOPE_ extern -#endif - -_SCOPE_ struct cpu8051_t cpu8051; - -int -IsBreakpoint(unsigned int Address); - -void -ShowBreakpoints(void); - -void -SetBreakpoint(unsigned int Address); - -void -ClearBreakpoint(unsigned int Address); - -void -ToggleBreakpoint(unsigned int Address); - -void -cpu8051_init(void); - -void -cpu8051_Exec(void); - -void -cpu8051_Reset(void); - -void -cpu8051_WriteD(unsigned int Address, unsigned char Value); - -void -cpu8051_WriteI(unsigned int Address, unsigned char Value); - -void -cpu8051_WriteB(uint8_t bit_address, uint8_t value); - -unsigned char -cpu8051_ReadD(unsigned int Address); - -unsigned char -cpu8051_ReadI(unsigned int Address); - -unsigned char -cpu8051_ReadB(uint8_t bit_address); - -int -cpu8051_Disasm(unsigned int Address, char *Text); - -#endif /* CPU8051_H */ diff -Nru emu8051-1.1.1/src/disasm.h emu8051-2.0.1/src/disasm.h --- emu8051-1.1.1/src/disasm.h 2011-11-20 21:31:29.000000000 +0000 +++ emu8051-2.0.1/src/disasm.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,232 +0,0 @@ -/* - * disasm.h - * - * Do not modify this file directly, as it was created by opcode2c.pl - * Any modifications made directly to this file will be lost. - * - * Copyright (C) 1999 Jonathan St-André - * Copyright (C) 1999 Hugo Villeneuve - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -#ifndef DISASM_H -#define DISASM_H 1 - -/* - * For all 256 opcodes, the value in this table gives the instruction type - * ex.: MOV, INC, CLR, CPL,... - * To know what is the instruction type, use - * the number as an offset in the InstTextTbl[] - */ -static int InstTypesTbl[] = { - 0, 1, 2, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 5, 6, 7, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 10, 1, 11, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 14, 6, 15, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 18, 1, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 20, 6, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 22, 1, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, - 24, 6, 19, 25, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, - 27, 1, 21, 28, 29, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, - 26, 6, 26, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, - 19, 1, 26, 4, 31, 32, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, - 21, 6, 33, 33, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 35, 1, 36, 36, 37, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, - 39, 6, 40, 40, 41, 42, 43, 43, 42, 42, 42, 42, 42, 42, 42, 42, - 44, 1, 44, 44, 36, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, - 44, 6, 44, 44, 33, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26 -}; - -/* Size(in bytes) of each instruction (offset in table is instruction opcode) */ -static int InstSizesTbl[] = { - 1, 2, 3, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 3, 2, 3, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 3, 2, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 3, 2, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 2, 2, 2, 3, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 2, 2, 2, 3, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 2, 2, 2, 3, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 2, 2, 2, 1, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 1, 1, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 3, 2, 2, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 2, 2, 2, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 2, 2, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 2, 2, 2, 1, 1, 3, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, - 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 -}; - -/* List of instructions types referenced by InstTypesTbl[] */ -#define InstTextTblLength 45 -static char *InstTextTbl[] = { - "NOP", - "AJMP", - "LJMP", - "RR", - "INC", - "JBC", - "ACALL", - "LCALL", - "RRC", - "DEC", - "JB", - "RET", - "RL", - "ADD", - "JNB", - "RETI", - "RLC", - "ADDC", - "JC", - "ORL", - "JNC", - "ANL", - "JZ", - "XRL", - "JNZ", - "JMP", - "MOV", - "SJMP", - "MOVC", - "DIV", - "SUBB", - "MUL", - "INVALID", - "CPL", - "CJNE", - "PUSH", - "CLR", - "SWAP", - "XCH", - "POP", - "SETB", - "DA", - "DJNZ", - "XCHD", - "MOVX" -}; - -/* - * Table describing all arguments types of an instruction - * The table is indexed InstArgTbl[ opcode * 4] - * InstArgTbl[opcode*4 + 1] gives the number of arguments the instruction has - * InstArgTbl[opcode*4 + i] for i=1,2 and 3 give the type of each argument - * for most instructions, the 3rd argument isn't used - * the argument type is referecing to ArgsTextTbl[] - */ -#define InstArgTblLength 256 -static int InstArgTbl[] = { - 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 2, 0, 0, - 1, 2, 0, 0, 1, 3, 0, 0, 1, 4, 0, 0, 1, 5, 0, 0, - 1, 6, 0, 0, 1, 7, 0, 0, 1, 8, 0, 0, 1, 9, 0, 0, - 1, 10, 0, 0, 1, 11, 0, 0, 1, 12, 0, 0, 1, 13, 0, 0, - 2, 14, 15, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 2, 0, 0, - 1, 2, 0, 0, 1, 3, 0, 0, 1, 4, 0, 0, 1, 5, 0, 0, - 1, 6, 0, 0, 1, 7, 0, 0, 1, 8, 0, 0, 1, 9, 0, 0, - 1, 10, 0, 0, 1, 11, 0, 0, 1, 12, 0, 0, 1, 13, 0, 0, - 2, 14, 15, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 0, - 2, 2, 16, 0, 2, 2, 3, 0, 2, 2, 4, 0, 2, 2, 5, 0, - 2, 2, 6, 0, 2, 2, 7, 0, 2, 2, 8, 0, 2, 2, 9, 0, - 2, 2, 10, 0, 2, 2, 11, 0, 2, 2, 12, 0, 2, 2, 13, 0, - 2, 14, 15, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 0, - 2, 2, 16, 0, 2, 2, 3, 0, 2, 2, 4, 0, 2, 2, 5, 0, - 2, 2, 6, 0, 2, 2, 7, 0, 2, 2, 8, 0, 2, 2, 9, 0, - 2, 2, 10, 0, 2, 2, 11, 0, 2, 2, 12, 0, 2, 2, 13, 0, - 1, 15, 0, 0, 1, 0, 0, 0, 2, 3, 2, 0, 2, 3, 16, 0, - 2, 2, 16, 0, 2, 2, 3, 0, 2, 2, 4, 0, 2, 2, 5, 0, - 2, 2, 6, 0, 2, 2, 7, 0, 2, 2, 8, 0, 2, 2, 9, 0, - 2, 2, 10, 0, 2, 2, 11, 0, 2, 2, 12, 0, 2, 2, 13, 0, - 1, 15, 0, 0, 1, 0, 0, 0, 2, 3, 2, 0, 2, 3, 16, 0, - 2, 2, 16, 0, 2, 2, 3, 0, 2, 2, 4, 0, 2, 2, 5, 0, - 2, 2, 6, 0, 2, 2, 7, 0, 2, 2, 8, 0, 2, 2, 9, 0, - 2, 2, 10, 0, 2, 2, 11, 0, 2, 2, 12, 0, 2, 2, 13, 0, - 1, 15, 0, 0, 1, 0, 0, 0, 2, 3, 2, 0, 2, 3, 16, 0, - 2, 2, 16, 0, 2, 2, 3, 0, 2, 2, 4, 0, 2, 2, 5, 0, - 2, 2, 6, 0, 2, 2, 7, 0, 2, 2, 8, 0, 2, 2, 9, 0, - 2, 2, 10, 0, 2, 2, 11, 0, 2, 2, 12, 0, 2, 2, 13, 0, - 1, 15, 0, 0, 1, 0, 0, 0, 2, 17, 14, 0, 1, 18, 0, 0, - 2, 2, 16, 0, 2, 3, 16, 0, 2, 4, 16, 0, 2, 5, 16, 0, - 2, 6, 16, 0, 2, 7, 16, 0, 2, 8, 16, 0, 2, 9, 16, 0, - 2, 10, 16, 0, 2, 11, 16, 0, 2, 12, 16, 0, 2, 13, 16, 0, - 1, 15, 0, 0, 1, 0, 0, 0, 2, 17, 14, 0, 2, 2, 19, 0, - 1, 20, 0, 0, 2, 3, 3, 0, 2, 3, 4, 0, 2, 3, 5, 0, - 2, 3, 6, 0, 2, 3, 7, 0, 2, 3, 8, 0, 2, 3, 9, 0, - 2, 3, 10, 0, 2, 3, 11, 0, 2, 3, 12, 0, 2, 3, 13, 0, - 2, 21, 22, 0, 1, 0, 0, 0, 2, 14, 17, 0, 2, 2, 18, 0, - 2, 2, 16, 0, 2, 2, 3, 0, 2, 2, 4, 0, 2, 2, 5, 0, - 2, 2, 6, 0, 2, 2, 7, 0, 2, 2, 8, 0, 2, 2, 9, 0, - 2, 2, 10, 0, 2, 2, 11, 0, 2, 2, 12, 0, 2, 2, 13, 0, - 2, 17, 23, 0, 1, 0, 0, 0, 2, 17, 14, 0, 1, 21, 0, 0, - 1, 20, 0, 0, 0, 0, 0, 0, 2, 4, 3, 0, 2, 5, 3, 0, - 2, 6, 3, 0, 2, 7, 3, 0, 2, 8, 3, 0, 2, 9, 3, 0, - 2, 10, 3, 0, 2, 11, 3, 0, 2, 12, 3, 0, 2, 13, 3, 0, - 2, 17, 23, 0, 1, 0, 0, 0, 1, 14, 0, 0, 1, 17, 0, 0, - 3, 2, 16, 15, 3, 2, 3, 15, 3, 4, 16, 15, 3, 5, 16, 15, - 3, 6, 16, 15, 3, 7, 16, 15, 3, 8, 16, 15, 3, 9, 16, 15, - 3, 10, 16, 15, 3, 11, 16, 15, 3, 12, 16, 15, 3, 13, 16, 15, - 1, 3, 0, 0, 1, 0, 0, 0, 1, 14, 0, 0, 1, 17, 0, 0, - 1, 2, 0, 0, 2, 2, 3, 0, 2, 2, 4, 0, 2, 2, 5, 0, - 2, 2, 6, 0, 2, 2, 7, 0, 2, 2, 8, 0, 2, 2, 9, 0, - 2, 2, 10, 0, 2, 2, 11, 0, 2, 2, 12, 0, 2, 2, 13, 0, - 1, 3, 0, 0, 1, 0, 0, 0, 1, 14, 0, 0, 1, 17, 0, 0, - 1, 2, 0, 0, 2, 3, 15, 0, 2, 2, 4, 0, 2, 2, 5, 0, - 2, 6, 15, 0, 2, 7, 15, 0, 2, 8, 15, 0, 2, 9, 15, 0, - 2, 10, 15, 0, 2, 11, 15, 0, 2, 12, 15, 0, 2, 13, 15, 0, - 2, 2, 24, 0, 1, 0, 0, 0, 2, 2, 4, 0, 2, 2, 5, 0, - 1, 2, 0, 0, 2, 2, 3, 0, 2, 2, 4, 0, 2, 2, 5, 0, - 2, 2, 6, 0, 2, 2, 7, 0, 2, 2, 8, 0, 2, 2, 9, 0, - 2, 2, 10, 0, 2, 2, 11, 0, 2, 2, 12, 0, 2, 2, 13, 0, - 2, 24, 2, 0, 1, 0, 0, 0, 2, 4, 2, 0, 2, 5, 2, 0, - 1, 2, 0, 0, 2, 3, 2, 0, 2, 4, 2, 0, 2, 5, 2, 0, - 2, 6, 2, 0, 2, 7, 2, 0, 2, 8, 2, 0, 2, 9, 2, 0, - 2, 10, 2, 0, 2, 11, 2, 0, 2, 12, 2, 0, 2, 13, 2, 0 -}; - -/* - * List all types of arguments available to instructions - * Referenced by InstArgsTbl[] - */ -#define ArgsTextTblLength 25 -static char *ArgsTextTbl[] = { - "addr11", - "addr16", - "A", - "direct", - "@R0", - "@R1", - "R0", - "R1", - "R2", - "R3", - "R4", - "R5", - "R6", - "R7", - "bitaddr", - "reladdr", - "#data", - "C", - "@A+DPTR", - "@A+PC", - "AB", - "DPTR", - "#data16", - "/bitaddr", - "@DPTR" -}; - -#endif /* DISASM_H */ diff -Nru emu8051-1.1.1/src/emuconsole.c emu8051-2.0.1/src/emuconsole.c --- emu8051-1.1.1/src/emuconsole.c 2011-11-20 21:11:17.000000000 +0000 +++ emu8051-2.0.1/src/emuconsole.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,474 +0,0 @@ -/* - * emuconsole.c - * - * Copyright (C) 1999 Jonathan St-André - * Copyright (C) 1999 Hugo Villeneuve - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#define _GNU_SOURCE /* For getline() */ -#include -#include -#include /* For isblank, toupper() */ -#include "config.h" - -#include "common.h" -#include "cpu8051.h" -#include "reg8051.h" -#include "memory.h" -#include "options.h" -#include "hexfile.h" -#include "keyboard.h" - -/* Capitalize all letters in buffer */ -static void -Capitalize(char *buffer) -{ - int k; - - for (k = 0; k < strlen(buffer); k++) - buffer[k] = toupper(buffer[k]); -} - -/* Remove leading spaces from string in buffer */ -static void -RemoveSpaces(char *buffer) -{ - int k = 0; - - while ((k < strlen(buffer)) && isblank(buffer[k])) - k++; - - if (k != 0) - strcpy(buffer, &buffer[k]); -} - -/* CPU exec and Console UI update */ -static void -console_exec(char *Address, char *NumberInst) -{ - char dummy; - int NbInst = -1; /* -1 is infinity */ - if (strlen(Address) == 0) { - printf("Invalid address\n"); - return; - } - - if (STREQ(Address, "PC")) - cpu8051.pc = Ascii2Hex(Address, strlen(Address)); - - if (strlen(NumberInst) != 0) - NbInst = Ascii2Hex(NumberInst, strlen(NumberInst)); - - InitUnixKB(); - - printf("Program executing...\n"); - - do { - cpu8051_Exec(); - if (NbInst > 0) - NbInst--; - } while (!IsBreakpoint(cpu8051.pc) && (NbInst != 0) && !kbhit()); - if (kbhit()) { - dummy = getch(); /* Flush key */ - printf("Caught break signal!\n"); - } - if (NbInst == 0) - printf("Number of instructions reached! Stopping!\n"); - if (IsBreakpoint(cpu8051.pc)) - printf("Breakpoint hit at %.4X! Stopping!\n", cpu8051.pc); - - ResetUnixKB(); -} - -/* Disassemble NumberInst instructions at Address */ -static void -DisasmN(unsigned int Address, int NumberInst) -{ - char TextTmp[255]; - int Row; - - for (Row = 0; Row < NumberInst ; Row++) { - Address += cpu8051_Disasm(Address, TextTmp); - printf("%s\n", TextTmp); - } -} - -/* Disassemble 16 instructions at Address */ -static void -Disasm(char *Address, char *NumberInst) -{ - unsigned int MemAddress, NbInst; - - if ((strlen(Address) == 0) || (STREQ(Address, "PC"))) - MemAddress = cpu8051.pc; - else - MemAddress = Ascii2Hex(Address, strlen(Address)); - - if (strlen(NumberInst) == 0) - NumberInst = "10"; - NbInst = Ascii2Hex(NumberInst, strlen(NumberInst)); - DisasmN(MemAddress, NbInst); -} - -/* Set NewValue to Register */ -static void -SetRegister(char *Register, char *NewValue) -{ - if (STREQ(Register, "PC")) - cpu8051.pc = Ascii2Hex(NewValue, 4); - else if (STREQ(Register, "A")) - cpu8051_WriteD(_ACC_, Ascii2Hex(NewValue, 2)); - else if (STREQ(Register, "B")) - cpu8051_WriteD(_B_, Ascii2Hex(NewValue, 2)); - else if (STREQ(Register, "SP")) - cpu8051_WriteD(_SP_, Ascii2Hex(NewValue, 2)); - else { - printf("\nInvalid register name!\n"); - printf("Valid registers are A, B, PC and SP.\n"); - } -} - -/* Show CPU registers */ -static void -console_show_registers(void) -{ - unsigned char PSW = cpu8051_ReadD(_PSW_); - int BankSelect = (PSW & 0x18); - - printf("---------------------------------------------------------------" - "-------\n"); - printf("| PC | SP | DPTR | ACC | B | PSW: CY AC F0 RS1 RS0 OV" - " - P |\n"); - printf("| %.4X | %.2X | %.4X | %.2X | %.2X |", cpu8051.pc, - cpu8051_ReadD(_SP_), - (cpu8051_ReadD(_DPTRHIGH_) << 8) + cpu8051_ReadD(_DPTRLOW_), - cpu8051_ReadD(_ACC_), cpu8051_ReadD(_B_)); - printf(" %d %d %d %d %d %d %d %d |", - (PSW >> 7) & 1, (PSW >> 6) & 1, (PSW >> 5) & 1, (PSW >> 4) & 1, - (PSW >> 3) & 1, (PSW >> 2) & 1, (PSW >> 1) & 1, PSW & 1); - printf("\n"); - printf("---------------------------------------------------------------" - "-------\n"); - - printf("| TCON | TMOD | IE | IP | R0 | R1 | R2 | R3 | R4 | R5 | R6 | R7" - " | |\n"); - printf("| %.2X | %.2X | %.2X | %.2X ", cpu8051_ReadD(_TCON_), - cpu8051_ReadD(_TMOD_), cpu8051_ReadD(_IE_), cpu8051_ReadD(_IP_)); - printf("| %.2X | %.2X | %.2X | %.2X ", - cpu8051_ReadD(BankSelect + _R0_), - cpu8051_ReadD(BankSelect + _R1_), - cpu8051_ReadD(BankSelect + _R2_), - cpu8051_ReadD(BankSelect + _R3_)); - printf("| %.2X | %.2X | %.2X | %.2X ", - cpu8051_ReadD(BankSelect + _R4_), - cpu8051_ReadD(BankSelect + _R5_), - cpu8051_ReadD(BankSelect + _R6_), - cpu8051_ReadD(BankSelect + _R7_)); - printf("| |\n"); - printf("---------------------------------------------------------------" - "-------\n"); -} - -/* CPU reset and Console UI update */ -static void -console_reset(void) -{ - printf("Resetting... "); - cpu8051_Reset(); - printf("Done.\n"); - console_show_registers(); -} - -/* CPU trace and Console UI update */ -static void -console_trace(char *Address) -{ - if (strlen(Address) != 0) - cpu8051.pc = Ascii2Hex(Address, strlen(Address)); - cpu8051_Exec(); - console_show_registers(); - DisasmN(cpu8051.pc, 1); -} - -/* EmuConsole main loop */ -static void -console_main(void) -{ - unsigned int Index; - char *line = NULL; - - char prompt[] = "-> "; - - char *Title[] = { " *******************", - " * 8051 Emulator *", - " *******************", - "", 0 }; - - char *Menu[] = { - " Available commands, [ ] = options", - "", - " Set Breakpoint.............. SB [address]", - " Remove Breakpoint........... RB [address]", - " Display Breakpoint(s)....... DB", - " Dump External Data Memory... DE [address] [size]", - " Dump Internal Data Memory... DI [address] [size]", - " Dump Program Memory......... DP [address] [size]", - " Display Registers content... DR", - " Execute..................... EM [address" - " [number of instructions]]", - " Help........................ H", - " Modify External Data Memory. ME address value", - " Modify Internal Data Memory. MI address value", - " Modify Program Memory....... MP address value", - " Modify Register............. MR register value", - " Quit Emulator............... Q", - " Trace mode.................. T [address]", - " Unassemble.................. U [address]" - " [number of instructions]", - " Reset processor............. Z", 0 }; - - Index = 0; - while (Title[Index] != 0) - printf("%s\n", Title[Index++]); - - Index = 0; - while (Menu[Index] != 0) - printf("%s\n", Menu[Index++]); - - console_reset(); - - int QuitRequest = 0; - - while (!QuitRequest) { - int slen; - size_t len = 0; - ssize_t bytes_read; - char Command[256]; - char Args[256]; - char Parameter1[256]; - char Parameter2[256]; - - Parameter1[0] = '\0'; - Parameter2[0] = '\0'; - - printf(prompt); - bytes_read = getline(&line, &len, stdin); - Capitalize(line); - RemoveSpaces(line); - - /* Strip trailing newline */ - slen = strlen(line); - if (line[slen - 1] == '\n') - line[slen - 1] = '\0'; - - /* Find command-arguments delimiter */ - for (Index = 0; Index < strlen(line); Index++) { - if (isblank(line[Index])) - break; - } - - /* Keep only the Command part from the input line */ - memcpy(Command, &line[0], Index); - Command[Index] = '\0'; - - /* Keep only the arguments part from the input line */ - if (Index < strlen(line)) { - slen = strlen(line) - Index; - memcpy(Args, &line[Index + 1], slen); - } else { - slen = 0; - } - Args[slen] = '\0'; - RemoveSpaces(Args); - - /* Find multi-arguments delimiter */ - for (Index = 0; Index < strlen(Args); Index++) { - if (isblank(Args[Index])) - break; - } - - memcpy(Parameter1, &Args[0], Index); - Parameter1[Index] = '\0'; - - if (Index < strlen(Args)) { - slen = strlen(Args) - Index; - memcpy(Parameter2, &Args[Index + 1], slen); - } else { - slen = 0; - } - Parameter2[slen] = '\0'; - RemoveSpaces(Parameter2); - - if (strlen(Command) == 0) { - goto syntax_error; - continue; - } - - if ((strlen(Parameter1) > 4) || (strlen(Parameter2) > 4)) { - printf("Invalid Parameter Format!\n"); - continue; - } - - switch (Command[0]) { - case 'D': - if (STREQ(Command, "DB") && - (strlen(Parameter1) == 0)) - ShowBreakpoints(); - else if (STREQ(Command, "DE")) - DumpMem(Parameter1, Parameter2, EXT_MEM_ID); - else if (STREQ(Command, "DI")) - DumpMem(Parameter1, Parameter2, INT_MEM_ID); - else if (STREQ(Command, "DP")) { - if ((strlen(Parameter1) == 0)) - strcpy(Parameter1, "PC"); - DumpMem(Parameter1, Parameter2, PGM_MEM_ID); - } else if (STREQ(Command, "DR") && - (strlen(Parameter1) == 0)) - console_show_registers(); - else - goto syntax_error; - break; - case 'E': - if (STREQ(Command, "EM")) - console_exec(Parameter1, Parameter2); - else - goto syntax_error; - break; - case 'H': - if (STREQ(Command, "H") && (strlen(Parameter1) == 0) && - (strlen(Parameter2) == 0)) { - Index = 0; - while (Menu[Index] != 0) - printf("%s\n", Menu[Index++]); - } else - goto syntax_error; - break; - case 'M': - if ((strlen(Parameter1) == 0) || - (strlen(Parameter2) == 0)) - printf("Missing Parameter!\n"); - else if (STREQ(Command, "ME")) { - unsigned int adresse = Ascii2Hex(Parameter1, 4); - unsigned char valeur = Ascii2Hex(Parameter2, 2); - memory_write8(EXT_MEM_ID, adresse, valeur); - } else if (STREQ(Command, "MI")) { - unsigned int adresse = Ascii2Hex(Parameter1, 2); - unsigned char valeur = Ascii2Hex(Parameter2, 2); - memory_write8(INT_MEM_ID, adresse, valeur); - } else if (STREQ(Command, "MP")) { - unsigned int adresse = Ascii2Hex(Parameter1, 4); - unsigned char valeur = Ascii2Hex(Parameter2, 2); - memory_write8(PGM_MEM_ID, adresse, valeur); - } else if (STREQ(Command, "MR")) - SetRegister(Parameter1, Parameter2); - else - goto syntax_error; - break; - case 'Q': - if (STREQ(Command, "Q") && (strlen(Parameter1) == 0) && - (strlen(Parameter2) == 0)) - QuitRequest = 1; - else - goto syntax_error; - break; - case 'R': - if (strlen(Parameter2) != 0) - goto TooMuchParameters; - if (STREQ(Command, "RB")) { - if (strlen(Parameter1) == 0) - ClearBreakpoint(cpu8051.pc); - else - ClearBreakpoint( - Ascii2Hex(Parameter1, 4)); - } else - goto syntax_error; - break; - case 'S': - if (strlen(Parameter2) != 0) - goto TooMuchParameters; - - if (STREQ(Command, "SB")) { - if (strlen(Parameter1) == 0) - SetBreakpoint(cpu8051.pc); - else - SetBreakpoint(Ascii2Hex(Parameter1, 4)); - } else - goto syntax_error; - break; - case 'T': - if (strlen(Parameter2) != 0) - printf("Wrong Number of Parameters!\n"); - - if (STREQ(Command, "T")) - console_trace(Parameter1); - else - goto syntax_error; - break; - case 'U': - if (STREQ(Command, "U")) - Disasm(Parameter1, Parameter2); - else - goto syntax_error; - break; - case 'Z': - if (STREQ(Command, "Z") && (strlen(Parameter1) == 0) && - (strlen(Parameter2) == 0)) - cpu8051_Reset(); - else - goto syntax_error; - break; - case '\n': - break; - default: - goto syntax_error; - } - continue; - -syntax_error: - printf("Syntax Error!\n"); - continue; -TooMuchParameters: - printf("Wrong Number of Parameters!\n"); - continue; - } - - if (line) - free(line); -} - -int -main(int argc, char **argv) -{ - char *hex_file; - - ParseCommandLineOptions(argc, argv); - - cpu8051_init(); - - hex_file = get_hex_filename(); - - if (hex_file != NULL) - LoadHexFile(hex_file); - - console_main(); - -#ifdef EMU8051_DEBUG - printf("End of program.\n"); -#endif - - return 0; -} diff -Nru emu8051-1.1.1/src/emugtk.c emu8051-2.0.1/src/emugtk.c --- emu8051-1.1.1/src/emugtk.c 2011-10-29 21:06:32.000000000 +0000 +++ emu8051-2.0.1/src/emugtk.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,374 +0,0 @@ -/* - * emugtk.c - * - * Copyright (C) 1999 Jonathan St-André - * Copyright (C) 1999 Hugo Villeneuve - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include -#include "config.h" - -#include - -#include "common.h" -#include "cpu8051.h" -#include "options.h" -#include "hexfile.h" - -#include "emugtk.h" -#include "reset.xpm" -#include "run.xpm" -#include "stop.xpm" -#include "step.xpm" -#include "filemenu.h" -#include "viewmenu.h" -#include "helpmenu.h" -#include "regwin.h" -#include "pgmwin.h" -#include "memwin.h" - -static int running; -static int running_function_tag; -static GtkWidget *mainwin; - -/* Signal DestroyEvent */ -static void -WindowDestroyEvent(GtkWidget *widget, gpointer data) -{ -#ifdef EMU8051_DEBUG - g_print("emugtk_DestroyEvent(...)\n"); -#endif - - gtk_main_quit(); -} - -/* Step out of running state */ -static void -emugtk_stop_running() -{ - if (running) { -#ifdef EMU8051_DEBUG - printf("emugtk_StopRunning()\n"); -#endif - gtk_idle_remove(running_function_tag); - running = 0; - regwin_Show(); - pgmwin_Disasm(); - memwin_DumpD("00"); - } -} - -/* Running function called when idle from gtk_main */ -static gboolean -emugtk_running(gpointer data) -{ - cpu8051_Exec(); - if (IsBreakpoint(cpu8051.pc)) { -#ifdef EMU8051_DEBUG - g_print("Breakpoint Hit, stopping!\n"); -#endif - emugtk_stop_running(); - } - - return TRUE; -} - -/* Get in the running state */ -static void -emugtk_start_running(void) -{ - if (!running) { -#ifdef EMU8051_DEBUG - printf("emugtk_StartRunning()\n"); -#endif - running_function_tag = gtk_idle_add(emugtk_running, 0); - running = 1; - } -} - -/* Taken from the Gxine source code. */ -static GtkWidget * -AddPixButton(GtkWidget *box, gchar **pixmap_array) -{ - GtkWidget *button, *icon; - GdkPixmap *image; - GdkBitmap *transparent; - - button = gtk_button_new(); - gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NORMAL); - image = gdk_pixmap_colormap_create_from_xpm_d( - NULL, gdk_colormap_get_system(), - &transparent, NULL, pixmap_array); - icon = gtk_pixmap_new(image, transparent); - gtk_container_add(GTK_CONTAINER(button), icon); - - gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 0); - - return button; -} - -/* CPU reset and Gtk UI update */ -static void -emugtk_Reset(void) -{ - cpu8051_Reset(); - regwin_Show(); - pgmwin_Disasm(); - memwin_DumpD("00"); -} - -/* Signal ResetEvent (ResetButton) */ -static void -emugtk_ResetEvent(GtkWidget *widget, GdkEvent *event, gpointer data) -{ -#ifdef EMU8051_DEBUG - g_print("emugtk_ResetEvent(...)\n"); -#endif - emugtk_stop_running(); - emugtk_Reset(); -} - -/* CPU Step and Gtk UI update */ -static void -emugtk_Step(void) -{ - cpu8051_Exec(); - regwin_Show(); - pgmwin_Disasm(); - memwin_DumpD("00"); -} - -/* Signal RunEvent (RunButton) */ -static void -emugtk_RunEvent(GtkWidget *widget, GdkEvent *event, gpointer data) -{ -#ifdef EMU8051_DEBUG - g_print("emugtk_RunEvent(...)\n"); -#endif - if (running) - emugtk_stop_running(); - else - emugtk_start_running(); -} - -/* Signal StopEvent (StopButton) */ -static void -emugtk_StopEvent(GtkWidget *widget, GdkEvent *event, gpointer data) -{ -#ifdef EMU8051_DEBUG - g_print("emugtk_StopEvent(...)\n"); -#endif - emugtk_stop_running(); -} - -/* Signal StepEvent (StepButton) */ -static void -emugtk_StepEvent(GtkWidget *widget, GdkEvent *event, gpointer data) -{ -#ifdef EMU8051_DEBUG - g_print("emugtk_StepEvent(...)\n"); -#endif - emugtk_stop_running(); - emugtk_Step(); -} - -/* Creates the Reset, Run, Stop and Step buttons. */ -static GtkWidget * -AddButtons(void) -{ - GtkWidget *button_hbox; - GtkWidget *button; - - /* The buttons of the hbox are NOT given equal space in the box. */ - button_hbox = gtk_hbox_new(FALSE, 0); - - /* Creating the RESET button. */ - button = AddPixButton(button_hbox, reset_xpm); - gtk_signal_connect(GTK_OBJECT(button), "clicked", - GTK_SIGNAL_FUNC(emugtk_ResetEvent), - NULL); - - /* Creating the RUN button. */ - button = AddPixButton(button_hbox, run_xpm); - gtk_signal_connect(GTK_OBJECT(button), "clicked", - GTK_SIGNAL_FUNC(emugtk_RunEvent), - NULL); - - /* Creating STOP button. */ - button = AddPixButton(button_hbox, stop_xpm); - gtk_signal_connect(GTK_OBJECT(button), "clicked", - GTK_SIGNAL_FUNC(emugtk_StopEvent), - NULL); - - /* Creating STEP button. */ - button = AddPixButton(button_hbox, step_xpm); - gtk_signal_connect(GTK_OBJECT(button), "clicked", - GTK_SIGNAL_FUNC(emugtk_StepEvent), - NULL); - - return button_hbox; -} - -static GtkWidget * -AddMenu(void) -{ - GtkWidget *menu_bar; - - /* Creating menu item. */ - menu_bar = gtk_menu_bar_new(); - - /* Adding the 'File' submenu */ - FileAddMenu(menu_bar); - - /* Adding the 'View' submenu */ - ViewAddMenu(menu_bar); - - /* Adding the 'Help' submenu */ - HelpAddMenu(menu_bar); - - gtk_widget_show_all(GTK_WIDGET(menu_bar)); - - return menu_bar; -} - -static void -emugtk_window_init(void) -{ - GtkWidget *main_vbox; - GtkWidget *menu_bar; - GtkWidget *buttons_bar; - GtkWidget *emufixed; - GtkWidget *fixed_frame; - - mainwin = gtk_window_new(GTK_WINDOW_TOPLEVEL); - gtk_window_set_title(GTK_WINDOW(mainwin), PACKAGE); - gtk_widget_set_usize(GTK_WIDGET(mainwin), - MAIN_WIN_WIDTH, MAIN_WIN_HEIGHT); - gtk_container_set_border_width(GTK_CONTAINER(mainwin), 0); - - /* Window DESTROY event. */ - gtk_signal_connect(GTK_OBJECT(mainwin), "destroy", - GTK_SIGNAL_FUNC(WindowDestroyEvent), NULL); - - /* - * Setting main window geometry based on command line options - * (if specified). - */ - /*MainWindowSetGeometry();*/ - - /* - * main_vbox contains the menu bar and body_vbox (for all remaining - * items). - */ - main_vbox = gtk_vbox_new(FALSE, 1); - - /* Creating the menu bar. */ - menu_bar = AddMenu(); - /* Adding menu bar to main_vbox */ - gtk_box_pack_start(GTK_BOX(main_vbox), menu_bar, FALSE, FALSE, 1); - - /* Creating the buttons bar. */ - buttons_bar = AddButtons(); - /* Adding buttons bar to main_vbox */ - gtk_box_pack_start(GTK_BOX(main_vbox), buttons_bar, FALSE, FALSE, 1); - - /* Emulator fixed window. */ - emufixed = gtk_fixed_new(); - gtk_widget_set_usize(GTK_WIDGET(emufixed), MAIN_WIN_WIDTH, - REG_WIN_HEIGHT + MEM_WIN_HEIGHT + 10); - - /* 8051 registers frame. */ - fixed_frame = regwin_init(REG_WIN_WIDTH, REG_WIN_HEIGHT); - gtk_fixed_put(GTK_FIXED(emufixed), fixed_frame, 0, 0); - - /* Program disassembly frame. */ - fixed_frame = pgmwin_init(PGM_WIN_WIDTH, PGM_WIN_HEIGHT); - gtk_fixed_put(GTK_FIXED(emufixed), fixed_frame, REG_WIN_WIDTH + 10, 0); - - /* Memory dump frame. */ - fixed_frame = memwin_init(MEM_WIN_WIDTH, MEM_WIN_HEIGHT); - gtk_fixed_put(GTK_FIXED(emufixed), fixed_frame, 0, REG_WIN_HEIGHT); - - /* Adding fixed window to main_vbox */ - gtk_box_pack_start(GTK_BOX(main_vbox), emufixed, FALSE, FALSE, 1); - - /* Adding the main_vbox to the main window. */ - gtk_container_add(GTK_CONTAINER(mainwin), main_vbox); - - gtk_widget_show_all(mainwin); -} - -static void -emugtk_UpdateDisplay(void) -{ -#ifdef EMU8051_DEBUG - g_print("emugtk_UpdateDisplay()\n"); -#endif - - regwin_Show(); - pgmwin_Disasm(); - memwin_DumpD("00"); -} - -void -AddMenuSeparator(GtkWidget *menu) -{ - GtkWidget *item; - - item = gtk_menu_item_new(); - gtk_menu_append(GTK_MENU(menu), item); -} - -void -emugtk_new_file(char *file) -{ - emugtk_stop_running(); - - LoadHexFile(file); - - emugtk_Reset(); - emugtk_UpdateDisplay(); -} - -int -main(int argc, char **argv) -{ - char *hex_file; - - ParseCommandLineOptions(argc, argv); - - cpu8051_init(); - - running = 0; - - gtk_init(&argc, &argv); - - emugtk_window_init(); - - hex_file = get_hex_filename(); - - if (hex_file != NULL) - emugtk_new_file(hex_file); - - gtk_main(); - -#ifdef EMU8051_DEBUG - printf("End of program.\n"); -#endif - - return EXIT_SUCCESS; -} diff -Nru emu8051-1.1.1/src/emugtk.h emu8051-2.0.1/src/emugtk.h --- emu8051-1.1.1/src/emugtk.h 2011-10-29 21:06:32.000000000 +0000 +++ emu8051-2.0.1/src/emugtk.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,34 +0,0 @@ -/* - * emugtk.h - * - * Copyright (C) 1999 Jonathan St-André - * Copyright (C) 1999 Hugo Villeneuve - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef EMUGTK_H -#define EMUGTK_H 1 - -#include -#include "gtksizes.h" - -void -AddMenuSeparator(GtkWidget *menu); - -void -emugtk_new_file(char *file); - -#endif /* EMUGTK_H */ diff -Nru emu8051-1.1.1/src/filemenu.c emu8051-2.0.1/src/filemenu.c --- emu8051-1.1.1/src/filemenu.c 2011-10-29 21:06:32.000000000 +0000 +++ emu8051-2.0.1/src/filemenu.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,135 +0,0 @@ -/* - * filemenu.c - * - * Copyright (C) 1999 Jonathan St-André - * Copyright (C) 1999 Hugo Villeneuve - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#if HAVE_CONFIG_H -# include "config.h" -#endif - -#include /* UNIX standard function definitions */ -#include -#include - -#include "common.h" -#include "emugtk.h" -#include "messagebox.h" -#include "filemenu.h" - -#define FILENAME_DESCRIPTION "Open Intel Hex file" - -static void -FileOpenDialog_OK(GtkWidget *widget, gpointer file_dialog) -{ - char *selected_file; - -#if defined(DEBUG) - g_print("FileOpenDialog_OK()\n"); -#endif - - /* - * The cast to (char *) is to remove a warning in GTK2, because the - * return value of the gtk_file_selection_get_filename() function is - * 'G_CONST_RETURN gchar *'. - */ - selected_file = (char *) gtk_file_selection_get_filename( - GTK_FILE_SELECTION(file_dialog)); - - g_print("emugtk_File = %s\n", selected_file); - - emugtk_new_file(selected_file); - - gtk_widget_destroy(GTK_WIDGET(file_dialog)); -} - -void -FileOpenEvent(GtkObject *object, gpointer data) -{ - GtkWidget *file_dialog; - -#if defined(DEBUG) - g_print("FileOpenEvent()\n"); -#endif - - /* Create a new file selection widget. */ - file_dialog = gtk_file_selection_new(FILENAME_DESCRIPTION); - - /* Connect the file dialog's OK button up to a handler. */ - gtk_signal_connect( - GTK_OBJECT(GTK_FILE_SELECTION(file_dialog)->ok_button), - "clicked", GTK_SIGNAL_FUNC(FileOpenDialog_OK), file_dialog); - - /* - * Ensure that the file selection dialog box is destroyed when the user - * clicks CANCEL. - */ - gtk_signal_connect_object( - GTK_OBJECT(GTK_FILE_SELECTION(file_dialog)->cancel_button), - "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), - (gpointer) file_dialog); - - /* Show the dialog. */ - gtk_widget_show(GTK_WIDGET(file_dialog)); - - /* - * To have the main window of our application being unusable while - * using the dialog. - */ - gtk_window_set_modal(GTK_WINDOW(file_dialog), TRUE); -} - -static void -FileQuitEvent(gchar *string) -{ -#if defined(DEBUG) - g_print("%s\n", string); -#endif - - gtk_main_quit(); -} - -void -FileAddMenu(GtkWidget *menu_bar) -{ - GtkWidget *item; - GtkWidget *menu; - - menu = gtk_menu_new(); - - /* Create the 'open' item. */ - item = gtk_menu_item_new_with_label(FILENAME_DESCRIPTION); - gtk_menu_append(GTK_MENU(menu), item); - /* Attach the callback functions to the activate signal. */ - gtk_signal_connect_object(GTK_OBJECT(item), "activate", - GTK_SIGNAL_FUNC(FileOpenEvent), NULL); - - AddMenuSeparator(menu); - - item = gtk_menu_item_new_with_label("Exit"); - gtk_menu_append(GTK_MENU(menu), item); - /* We can attach the Quit menu item to our exit function */ - gtk_signal_connect_object(GTK_OBJECT(item), "activate", - GTK_SIGNAL_FUNC(FileQuitEvent), - (gpointer) "file.quit"); - - /* Adding submenu title. */ - item = gtk_menu_item_new_with_label("File"); - gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), menu); - gtk_menu_bar_append(GTK_MENU_BAR(menu_bar), item); -} diff -Nru emu8051-1.1.1/src/filemenu.h emu8051-2.0.1/src/filemenu.h --- emu8051-1.1.1/src/filemenu.h 2011-10-29 21:06:32.000000000 +0000 +++ emu8051-2.0.1/src/filemenu.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,36 +0,0 @@ -/* - * filemenu.h - * - * Copyright (C) 1999 Jonathan St-André - * Copyright (C) 1999 Hugo Villeneuve - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef FILEMENU_H -#define FILEMENU_H 1 - -#include - -void -FileOpenEvent(GtkObject *object, gpointer data); - -void -FileResetEvent(GtkObject *object, gpointer data); - -void -FileAddMenu(GtkWidget *menu_bar); - -#endif /* FILEMENU_H */ diff -Nru emu8051-1.1.1/src/gtk/app-config.c emu8051-2.0.1/src/gtk/app-config.c --- emu8051-1.1.1/src/gtk/app-config.c 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/gtk/app-config.c 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,201 @@ +/* + * Handle loading and saving of application configuration settings + * + * Copyright (C) 2013 Hugo Villeneuve + * + * This file is released under the GPLv2 + */ + +#if HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include +#include +#include +#include + +#if STDC_HEADERS +# include +#elif HAVE_STRINGS_H +# include +#endif + +#include + +#include "common.h" +#include "app-config.h" + +static const char profile_name[] = "default"; +static struct app_config_t app_config; + +struct app_config_t *cfg = &app_config; + +static void +app_config_init(void) +{ + /* Emulation options */ + cfg->clear_ram_on_file_load = false; + + /* UI settings */ + cfg->win_width = 640; + cfg->win_height = 480; + cfg->hpane_pos = 100; + cfg->vpane_pos = 200; + cfg->main_pane_pos = 200; + + /* View menu options */ + cfg->layout = UI_LAYOUT1; + cfg->view_int_memory = 1; + cfg->view_ext_memory = 1; + cfg->bytes_per_row = 16; /* 8 or 16 */ +} + +static int +app_config_key_file_get_int(GKeyFile *kf, const char *grp, const char *key, + int *value) +{ + char *str = g_key_file_get_value(kf, grp, key, NULL); + + log_debug("key: %s", key); + + if (G_LIKELY(str)) { + *value = atoi(str); + log_debug(" value = %d", *value); + g_free(str); + } + + return str != NULL; +} + +static void +app_config_load_from_key_file(GKeyFile *kf) +{ + /* Emulation options */ + app_config_key_file_get_int(kf, "emulation", "clear_ram_on_file_load", + &cfg->clear_ram_on_file_load); + + /* ui */ + app_config_key_file_get_int(kf, "ui", "win_width", &cfg->win_width); + app_config_key_file_get_int(kf, "ui", "win_height", &cfg->win_height); + app_config_key_file_get_int(kf, "ui", "hpane_pos", &cfg->hpane_pos); + app_config_key_file_get_int(kf, "ui", "vpane_pos", &cfg->vpane_pos); + app_config_key_file_get_int(kf, "ui", "main_pane_pos", + &cfg->main_pane_pos); + + /* View */ + app_config_key_file_get_int(kf, "view", "layout", &cfg->layout); + if ((cfg->layout != UI_LAYOUT1) && (cfg->layout != UI_LAYOUT2)) { + log_err("Invalid layout, defaulting to layout 1"); + cfg->layout = UI_LAYOUT1; + } + app_config_key_file_get_int(kf, "view", "int_memory", + &cfg->view_int_memory); + app_config_key_file_get_int(kf, "view", "ext_memory", + &cfg->view_ext_memory); + app_config_key_file_get_int(kf, "view", "bytes_per_row", + &cfg->bytes_per_row); +} + +static char * +app_config_get_dir_path(void) +{ + char *dir_path; + + dir_path = g_build_filename(g_get_user_config_dir(), PACKAGE, + profile_name, NULL); + + return dir_path; +} + +static char * +app_config_get_file_path(void) +{ + char *file_path; + char *dir_path; + char file[MAX_FILENAME_LENGTH]; + + sprintf(file, "%s.conf", PACKAGE); + + dir_path = app_config_get_dir_path(); + + file_path = g_build_filename(dir_path, file, NULL); + + log_info("app. config file = %s", file_path); + + g_free(dir_path); + + return file_path; +} + +int +app_config_load(void) +{ + char *file_path; + GKeyFile *kf; + + /* Load default values before config file */ + app_config_init(); + + kf = g_key_file_new(); + + file_path = app_config_get_file_path(); + + if (g_key_file_load_from_file(kf, file_path, 0, NULL)) + app_config_load_from_key_file(kf); + + g_free(file_path); + + g_key_file_free(kf); + + /* ??? */ + return 0; +} + +int +app_config_save(void) +{ + char *dir_path; + + dir_path = app_config_get_dir_path(); + + if (g_mkdir_with_parents(dir_path, 0700) != -1) { + char *file_path; + GString *buf = g_string_sized_new(1024); + + g_string_append(buf, "\n[emulation]\n"); + + g_string_append_printf(buf, "clear_ram_on_file_load=%d\n", + cfg->clear_ram_on_file_load); + + g_string_append(buf, "\n[ui]\n"); + + g_string_append_printf(buf, "win_width=%d\n", cfg->win_width); + g_string_append_printf(buf, "win_height=%d\n", cfg->win_height); + g_string_append_printf(buf, "hpane_pos=%d\n", cfg->hpane_pos); + g_string_append_printf(buf, "vpane_pos=%d\n", cfg->vpane_pos); + g_string_append_printf(buf, "main_pane_pos=%d\n", + cfg->main_pane_pos); + + g_string_append(buf, "\n[view]\n"); + g_string_append_printf(buf, "layout=%d\n", cfg->layout); + g_string_append_printf(buf, "int_memory=%d\n", + cfg->view_int_memory); + g_string_append_printf(buf, "ext_memory=%d\n", + cfg->view_ext_memory); + g_string_append_printf(buf, "bytes_per_row=%d\n", + cfg->bytes_per_row); + + file_path = app_config_get_file_path(); + + g_file_set_contents(file_path, buf->str, buf->len, NULL); + g_string_free(buf, TRUE); + g_free(file_path); + } + + g_free(dir_path); + + /* ??? */ + return 0; +} diff -Nru emu8051-1.1.1/src/gtk/app-config.h emu8051-2.0.1/src/gtk/app-config.h --- emu8051-1.1.1/src/gtk/app-config.h 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/gtk/app-config.h 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,50 @@ +/* + * app_config.h + * + * Copyright (C) 1999 Hugo Villeneuve + * + * This file is released under the GPLv2 + */ + +#ifndef APP_CONFIG_H +#define APP_CONFIG_H 1 + +/* + * Layout1: Layout2: + * + * REGS | PROGRAM | | IRAM + * -------------- REGS | PROGRAM | ---- + * IRAM | | XRAM + * -------------- + * XRAM + */ +enum layout_t { + UI_LAYOUT1 = 1, + UI_LAYOUT2, +}; + +struct app_config_t { + /* Emulation options */ + int clear_ram_on_file_load; + + /* UI settings */ + int win_width; + int win_height; + int hpane_pos; /* For registers and program windows. */ + int vpane_pos; /* For internal and external memory windows. */ + int main_pane_pos; /* Between hpane and vpane. */ + + /* View menu options */ + int layout; /* UI Layout 1 or 2 */ + int view_int_memory; + int view_ext_memory; + int bytes_per_row; /* 8 or 16 */ +}; + +int +app_config_load(void); + +int +app_config_save(void); + +#endif /* APP_CONFIG_H */ diff -Nru emu8051-1.1.1/src/gtk/filemenu.c emu8051-2.0.1/src/gtk/filemenu.c --- emu8051-1.1.1/src/gtk/filemenu.c 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/gtk/filemenu.c 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,134 @@ +/* + * filemenu.c + * + * Copyright (C) 1999 Jonathan St-André + * Copyright (C) 1999 Hugo Villeneuve + * + * This file is released under the GPLv2 + */ + +#if HAVE_CONFIG_H +# include "config.h" +#endif + +#include /* UNIX standard function definitions */ +#include +#include + +#include "common.h" +#include "main.h" +#include "messagebox.h" +#include "filemenu.h" + +#define FILENAME_DESCRIPTION "Open Intel Hex file" + +static char previous_folder[MAX_FILENAME_LENGTH + 1]; + +static void +remember_current_folder(GtkFileChooser *chooser) +{ + char *folder; + + folder = gtk_file_chooser_get_current_folder(chooser); + + if (folder != NULL) { + if (strlen(folder) >= MAX_FILENAME_LENGTH) { + /* Non-critical error */ + log_warn("current folder name too long for buffer"); + } else { + log_info("current folder = %s", folder); + strncpy(previous_folder, folder, MAX_FILENAME_LENGTH); + } + + g_free(folder); + } +} + +static void +file_open_event(GtkObject *object, gpointer data) +{ + GtkWidget *file_dialog; + char *dir; + char *cwd = NULL; + + /* Remove compiler warning about unused variables. */ + (void) object; + (void) data; + + log_info("file_open_event()"); + + /* Create a new file selection widget. */ + file_dialog = gtk_file_chooser_dialog_new( + FILENAME_DESCRIPTION, NULL, GTK_FILE_CHOOSER_ACTION_OPEN, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL); + + if (strlen(previous_folder) == 0) { + /* Opening file chooser to current working directory. */ + cwd = g_get_current_dir(); + dir = cwd; + } else { + /* Opening file chooser to previous opened directory. */ + dir = previous_folder; + } + + gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(file_dialog), dir); + + if (cwd) + g_free(cwd); + + if (gtk_dialog_run(GTK_DIALOG(file_dialog)) == GTK_RESPONSE_ACCEPT) { + char *selected_file; + + selected_file = gtk_file_chooser_get_filename( + GTK_FILE_CHOOSER(file_dialog)); + + if (selected_file != NULL) { + log_info("emugtk_File = %s", selected_file); + + remember_current_folder(GTK_FILE_CHOOSER(file_dialog)); + + emugtk_new_file(selected_file); + g_free(selected_file); + } + } + + gtk_widget_destroy(file_dialog); +} + +static void +file_quit_event(gchar *string) +{ + /* Remove compiler warning about unused variables. */ + (void) string; + + emugtk_quit_gui(); +} + +void +file_add_menu(GtkWidget *menu_bar) +{ + GtkWidget *item; + GtkWidget *menu; + + menu = gtk_menu_new(); + + /* Create the 'open' item. */ + item = gtk_menu_item_new_with_label(FILENAME_DESCRIPTION); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); + /* Attach the callback functions to the activate signal. */ + g_signal_connect(item, "activate", G_CALLBACK(file_open_event), NULL); + + add_menu_separator(menu); + + item = gtk_menu_item_new_with_label("Exit"); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); + /* We can attach the Quit menu item to our exit function */ + g_signal_connect(item, "activate", G_CALLBACK(file_quit_event), + (gpointer) "file.quit"); + + /* Adding submenu title. */ + item = gtk_menu_item_new_with_label("File"); + gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), menu); + gtk_menu_shell_append((GtkMenuShell *) menu_bar, item); +} diff -Nru emu8051-1.1.1/src/gtk/filemenu.h emu8051-2.0.1/src/gtk/filemenu.h --- emu8051-1.1.1/src/gtk/filemenu.h 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/gtk/filemenu.h 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,18 @@ +/* + * filemenu.h + * + * Copyright (C) 1999 Jonathan St-André + * Copyright (C) 1999 Hugo Villeneuve + * + * This file is released under the GPLv2 + */ + +#ifndef FILEMENU_H +#define FILEMENU_H 1 + +#include + +void +file_add_menu(GtkWidget *menu_bar); + +#endif /* FILEMENU_H */ diff -Nru emu8051-1.1.1/src/gtk/helpmenu.c emu8051-2.0.1/src/gtk/helpmenu.c --- emu8051-1.1.1/src/gtk/helpmenu.c 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/gtk/helpmenu.c 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,94 @@ +/* + * helpmenu.c + * + * Copyright (C) 1999 Jonathan St-André + * Copyright (C) 1999 Hugo Villeneuve + * + * This file is released under the GPLv2 + */ + +#if HAVE_CONFIG_H +# include "config.h" +#endif + +#include + +#if STDC_HEADERS +# include +#elif HAVE_STRINGS_H +# include +#endif + +#include + +#include "common.h" +#include "options.h" +#include "main.h" +#include "messagebox.h" +#include "helpmenu.h" + +static void +help_about_event(GtkWidget *widget, gpointer data) +{ + /* Remove compiler warning about unused variables. */ + (void) widget; + (void) data; + + const char *authors[] = { + "Hugo Villeneuve ", + "Jonathan St-André", + "Pascal Fecteau", + "Jimmy Ringuette", + NULL, + }; + + const char *license = + "This program is free software; you can redistribute it" + " and/or" + " modify it under the terms of the GNU General Public License" + " as published by the Free Software Foundation; either" + " version 2 of the License, or (at your option) any later" + " version.\n\n" + "This program is distributed in the hope that it will be" + " useful, but WITHOUT ANY WARRANTY; without even the implied" + " warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR" + " PURPOSE. See the GNU General Public License for more" + " details.\n\n" + "You should have received a copy of the GNU General Public" + " License along with this program. If not, see\n" + " "; + + gtk_show_about_dialog( + NULL, + "name", PACKAGE_NAME, + "title", "About Dialog", + "version", PACKAGE_VERSION, + "logo-icon-name", PACKAGE_TARNAME, + "comments", PACKAGE_DESCRIPTION, + "authors", authors, + "website", PACKAGE_URL, + "copyright", PACKAGE_COPYRIGHT, + "license", license, + "wrap-license", true, + NULL); +} + +void +help_add_menu(GtkWidget *menu_bar) +{ + GtkWidget *item; + GtkWidget *menu; + + menu = gtk_menu_new(); + + /* Create the 'Help About' item. */ + item = gtk_menu_item_new_with_label("About " PACKAGE); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); + /* Attach the callback functions to the activate signal. */ + g_signal_connect(item, "activate", G_CALLBACK(help_about_event), NULL); + + /* Adding submenu title. */ + item = gtk_menu_item_new_with_label("Help"); + gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), menu); + gtk_menu_shell_append((GtkMenuShell *) menu_bar, item); +} diff -Nru emu8051-1.1.1/src/gtk/helpmenu.h emu8051-2.0.1/src/gtk/helpmenu.h --- emu8051-1.1.1/src/gtk/helpmenu.h 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/gtk/helpmenu.h 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,18 @@ +/* + * helpmenu.h + * + * Copyright (C) 1999 Jonathan St-André + * Copyright (C) 1999 Hugo Villeneuve + * + * This file is released under the GPLv2 + */ + +#ifndef HELPMENU_H +#define HELPMENU_H 1 + +#include + +void +help_add_menu(GtkWidget *menu_bar); + +#endif /* HELPMENU_H */ diff -Nru emu8051-1.1.1/src/gtk/main.c emu8051-2.0.1/src/gtk/main.c --- emu8051-1.1.1/src/gtk/main.c 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/gtk/main.c 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,622 @@ +/* + * main.c + * + * Copyright (C) 1999 Jonathan St-André + * Copyright (C) 1999 Hugo Villeneuve + * + * This file is released under the GPLv2 + */ + +#include +#include "config.h" + +#include +#include + +#include + +#include "common.h" +#include "cpu8051.h" +#include "memory.h" +#include "options.h" +#include "hexfile.h" +#include "timers.h" +#include "main.h" +#include "reset.xpm" +#include "run.xpm" +#include "stop.xpm" +#include "step.xpm" +#include "filemenu.h" +#include "viewmenu.h" +#include "helpmenu.h" +#include "messagebox.h" +#include "regwin.h" +#include "pgmwin.h" +#include "memwin.h" +#include "pswwin.h" +#include "timerwin.h" +#include "app-config.h" + +#define BUTTONS_BORDER 2 + +static int running; +static int running_function_tag; + +static int emugtk_window_init_complete; +static GtkWidget *vpaned1; +static GtkWidget *scrollwin_int; +static GtkWidget *scrollwin_ext; + +GtkWidget *mainwin; + +extern struct app_config_t *cfg; +extern struct options_t options; + +void +emugtk_update_display(void) +{ + log_debug("update display"); + regwin_refresh(); + pgmwin_refresh(); + pswwin_refresh(); + timerwin_update(); + + if (cfg->view_int_memory && scrollwin_int) + memwin_refresh(INT_MEM_ID); + + if (cfg->view_ext_memory && scrollwin_ext) + memwin_refresh(EXT_MEM_ID); +} + +/* Step out of running state */ +static void +emugtk_stop_running() +{ + if (running) { + log_info("stop running"); + g_source_remove(running_function_tag); + running = 0; + emugtk_update_display(); + } +} + +/* Running function called when idle from gtk_main */ +static gboolean +emugtk_running(gpointer data) +{ + int breakpoint_hit; + + (void) data; /* Remove compiler warning about unused variable. */ + + breakpoint_hit = cpu8051_run(1, NULL); + + if (breakpoint_hit) + emugtk_stop_running(); + + return TRUE; +} + +/* Get in the running state */ +static void +emugtk_start_running(void) +{ + if (!running) { + log_info("start running"); + running_function_tag = g_idle_add(emugtk_running, 0); + running = 1; + } +} + +/* Taken from the Gxine source code. */ +static GtkWidget * +button_add_pix(GtkWidget *box, char **xpm) +{ + GtkWidget *button, *icon; + + button = gtk_button_new(); + gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NORMAL); + + icon = gtk_image_new_from_pixbuf( + gdk_pixbuf_new_from_xpm_data((const char **) xpm)); + gtk_container_add(GTK_CONTAINER(button), icon); + + gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, BUTTONS_BORDER); + + return button; +} + +/* CPU reset and Gtk UI update */ +static void +emugtk_reset(void) +{ + cpu8051_reset(); + emugtk_update_display(); +} + +/* Signal ResetEvent (ResetButton) */ +static void +emugtk_reset_event(GtkWidget *widget, GdkEvent *event, gpointer data) +{ + /* Remove compiler warning about unused variables. */ + (void) widget; + (void) event; + (void) data; + + log_info("ResetEvent()"); + emugtk_stop_running(); + emugtk_reset(); +} + +/* CPU Step and Gtk UI update */ +static void +emugtk_step(void) +{ + cpu8051_exec(); + emugtk_update_display(); +} + +/* Signal RunEvent (RunButton) */ +static void +emugtk_run_event(GtkWidget *widget, GdkEvent *event, gpointer data) +{ + /* Remove compiler warning about unused variables. */ + (void) widget; + (void) event; + (void) data; + + log_info("RunEvent()"); + + if (running) + emugtk_stop_running(); + else + emugtk_start_running(); +} + +/* Signal StopEvent (StopButton) */ +static void +emugtk_stop_event(GtkWidget *widget, GdkEvent *event, gpointer data) +{ + /* Remove compiler warning about unused variables. */ + (void) widget; + (void) event; + (void) data; + + log_info("StopEvent()"); + emugtk_stop_running(); +} + +/* Signal StepEvent (StepButton) */ +static void +emugtk_step_event(GtkWidget *widget, GdkEvent *event, gpointer data) +{ + /* Remove compiler warning about unused variables. */ + (void) widget; + (void) event; + (void) data; + + log_info("StepEvent()"); + emugtk_stop_running(); + emugtk_step(); +} + +/* Creates the Reset, Run, Stop and Step buttons. */ +static GtkWidget * +add_buttons(void) +{ + GtkWidget *button_hbox; + GtkWidget *button; + + /* The buttons of the hbox are NOT given equal space in the box. */ + button_hbox = gtk_hbox_new(FALSE, 0); + + /* Creating the RESET button. */ + button = button_add_pix(button_hbox, reset_xpm); + g_signal_connect(button, "clicked", + G_CALLBACK(emugtk_reset_event), + NULL); + + /* Creating the RUN button. */ + button = button_add_pix(button_hbox, run_xpm); + g_signal_connect(button, "clicked", + G_CALLBACK(emugtk_run_event), + NULL); + + /* Creating STOP button. */ + button = button_add_pix(button_hbox, stop_xpm); + g_signal_connect(GTK_OBJECT(button), "clicked", + G_CALLBACK(emugtk_stop_event), + NULL); + + /* Creating STEP button. */ + button = button_add_pix(button_hbox, step_xpm); + g_signal_connect(GTK_OBJECT(button), "clicked", + G_CALLBACK(emugtk_step_event), + NULL); + + return button_hbox; +} + +static GtkWidget * +add_menu(void) +{ + GtkWidget *menu_bar; + + /* Creating menu item. */ + menu_bar = gtk_menu_bar_new(); + + /* Adding the 'File' submenu */ + file_add_menu(menu_bar); + + /* Adding the 'View' submenu */ + view_add_menu(menu_bar); + + /* Adding the 'Help' submenu */ + help_add_menu(menu_bar); + + return menu_bar; +} + +static int +mainwin_configure_event(GtkWindow *window, GdkEvent *event, gpointer data) +{ + /* Remove compiler warning about unused variables. */ + (void) window; + (void) data; + + cfg->win_width = event->configure.width; + cfg->win_height = event->configure.height; + + /* + * Important: + * Returning false allows event to propagate to children. If not, they + * will not be resized when we resize the main window. + */ + return FALSE; +} + +static void +hpaned_notify_event(GtkWindow *window, GdkEvent *event, gpointer data) +{ + GtkWidget *paned = data; + + /* Remove compiler warning about unused variables. */ + (void) window; + (void) event; + + cfg->hpane_pos = gtk_paned_get_position(GTK_PANED(paned)); +} + +static void +vpaned_notify_event(GtkWindow *window, GdkEvent *event, gpointer data) +{ + GtkWidget *paned = data; + + /* Remove compiler warning about unused variables. */ + (void) window; + (void) event; + + cfg->vpane_pos = gtk_paned_get_position(GTK_PANED(paned)); +} + +static void +main_paned_notify_event(GtkWindow *window, GdkEvent *event, gpointer data) +{ + GtkWidget *paned = data; + + /* Remove compiler warning about unused variables. */ + (void) window; + (void) event; + + cfg->main_pane_pos = gtk_paned_get_position(GTK_PANED(paned)); +} + +void +emugtk_quit_gui(void) +{ + gtk_main_quit(); +} + +static void +emugtk_show_memory_paned(void) +{ + gtk_widget_show_all(mainwin); + emugtk_update_display(); +} + +void +emugtk_create_int_memory_paned(void) +{ + scrollwin_int = memwin_init("Internal memory (IRAM)", + INT_MEM_ID); + gtk_paned_pack1(GTK_PANED(vpaned1), scrollwin_int, + FALSE, FALSE); + if (emugtk_window_init_complete) + emugtk_show_memory_paned(); +} + +void +emugtk_destroy_int_memory_paned(void) +{ + if (scrollwin_int == NULL) + return; + + gtk_widget_destroy(scrollwin_int); + scrollwin_int = NULL; +} + +void +emugtk_create_ext_memory_paned(void) +{ + scrollwin_ext = memwin_init("External memory (XRAM)", + EXT_MEM_ID); + + gtk_paned_pack2(GTK_PANED(vpaned1), scrollwin_ext, + TRUE, FALSE); + + if (emugtk_window_init_complete) + emugtk_show_memory_paned(); +} + +void +emugtk_destroy_ext_memory_paned(void) +{ + if (scrollwin_ext == NULL) + return; + + gtk_widget_destroy(scrollwin_ext); + scrollwin_ext = NULL; +} + +void +emugtk_recreate_memory_paned(void) +{ + if (cfg->view_int_memory) { + emugtk_destroy_int_memory_paned(); + emugtk_create_int_memory_paned(); + } + + if (cfg->view_ext_memory) { + emugtk_destroy_ext_memory_paned(); + emugtk_create_ext_memory_paned(); + } + + if (emugtk_window_init_complete) + emugtk_show_memory_paned(); +} + +static GtkWidget * +emugtk_create_memory_paned(void) +{ + /* Create vpaned (memory windows) only if necessary. */ + if (cfg->view_int_memory || cfg->view_ext_memory) { + vpaned1 = gtk_vpaned_new(); + + gtk_paned_set_position(GTK_PANED(vpaned1), cfg->vpane_pos); + g_signal_connect(G_OBJECT(vpaned1), "notify::position", + G_CALLBACK(vpaned_notify_event), vpaned1); + + emugtk_recreate_memory_paned(); + + return vpaned1; + } else { + return NULL; + } +} + +/* + * mainwin + * +---------------------------------------------------------------------+ + * | | + * | vbox | + * | +---------------------------------------------------------------+ | + * | | | | + * | | menu_bar | | + * | | +----------------------+ | | + * | | | File View Help | | | + * | | +----------------------+ | | + * | | | | + * | |---------------------------------------------------------------| | + * | | | | + * | | buttons_bar | | + * | | +-----------------------+ | | + * | | | RST RUN STOP STEP | | | + * | | +-----------------------+ | | + * | | | | + * | |---------------------------------------------------------------| | + * | | | | + * | | main_paned | | + * | | +---------------------------------------------------------+ | | + * | | | | | | + * | | | hpaned | | | + * | | | +---------------------------------------------------+ | | | + * | | | | | | | | | + * | | | | scrollwin | scrollwin | | | | + * | | | | +------------------+ * +--------------------+ | | | | + * | | | | | REGISTERS window | * | Disassembly window | | | | | + * | | | | +------------------+ | +--------------------+ | | | | + * | | | | | | | | | + * | | | +---------------------------------------------------+ | | | + * | | | | | | + * | | |--------------------------***----------------------------- | | + * | | | | | | + * | | | vpaned | | | + * | | | +---------------------------------------------------+ | | | + * | | | | | | | | + * | | | | scrollwin | | | | + * | | | | +---------------------------------------------+ | | | | + * | | | | | Internal memory window | | | | | + * | | | | +---------------------------------------------+ | | | | + * | | | | | | | | + * | | | +-----------------------***-------------------------| | | | + * | | | | | | | | + * | | | | scrollwin | | | | + * | | | | +---------------------------------------------+ | | | | + * | | | | | External memory window | | | | | + * | | | | +---------------------------------------------+ | | | | + * | | | | | | | | + * | | | +---------------------------------------------------+ | | | + * | | | | | | + * | | +---------------------------------------------------------+ | | + * | | | | + * | | | | + * | +---------------------------------------------------------------+ | + * | | + * | | + * +---------------------------------------------------------------------+ + */ +static void +emugtk_window_init(void) +{ + int id; + GtkWidget *vbox; + GtkWidget *menu_bar; + GtkWidget *buttons_bar; + GtkWidget *scrollwin; + GtkWidget *hpaned; + GtkWidget *vpaned; + GtkWidget *main_paned; + + emugtk_window_init_complete = false; + + mainwin = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(mainwin), PACKAGE); + gtk_window_set_default_size(GTK_WINDOW(mainwin), + cfg->win_width, cfg->win_height); + gtk_container_set_border_width(GTK_CONTAINER(mainwin), 0); + + /* Window DESTROY event. */ + g_signal_connect(mainwin, "destroy", + G_CALLBACK(gtk_main_quit), NULL); + + g_signal_connect(G_OBJECT(mainwin), "configure-event", + G_CALLBACK(mainwin_configure_event), NULL); + + /* Creating the menu bar. */ + menu_bar = add_menu(); + + /* Creating the buttons bar. */ + buttons_bar = add_buttons(); + + scrollwin = pswwin_init(); + gtk_box_pack_start(GTK_BOX(buttons_bar), scrollwin, FALSE, FALSE, 50); + + for (id = 0; id < GP_TIMERS_COUNT; id++) { + scrollwin = timerwin_init(id); + gtk_box_pack_start(GTK_BOX(buttons_bar), scrollwin, + FALSE, FALSE, 15); + } + + /* hpaned will contain registers and disassembly windows. */ + hpaned = gtk_hpaned_new(); + gtk_paned_set_position(GTK_PANED(hpaned), cfg->hpane_pos); + g_signal_connect(G_OBJECT(hpaned), "notify::position", + G_CALLBACK(hpaned_notify_event), hpaned); + + /* 8051 registers frame. */ + scrollwin = regwin_init(); + gtk_paned_pack1(GTK_PANED(hpaned), scrollwin, FALSE, FALSE); + + /* Program disassembly frame. */ + scrollwin = pgmwin_init(); + gtk_paned_pack2(GTK_PANED(hpaned), scrollwin, TRUE, FALSE); + + /* + * main_paned will contain two groups: + * group1: registers and disassembly windows. + * group2: memory windows + */ + if (cfg->layout == UI_LAYOUT1) + main_paned = gtk_vpaned_new(); + else + main_paned = gtk_hpaned_new(); + + gtk_paned_set_position(GTK_PANED(main_paned), cfg->main_pane_pos); + g_signal_connect(G_OBJECT(main_paned), "notify::position", + G_CALLBACK(main_paned_notify_event), main_paned); + gtk_paned_pack1(GTK_PANED(main_paned), hpaned, FALSE, FALSE); + + vpaned = emugtk_create_memory_paned(); + if (vpaned != NULL) + gtk_paned_pack2(GTK_PANED(main_paned), vpaned, + TRUE, FALSE); + + /* + * vbox contains the menu bar and body_vbox (for all remaining + * items). + */ + vbox = gtk_vbox_new(FALSE, 1); + gtk_box_pack_start(GTK_BOX(vbox), menu_bar, FALSE, FALSE, 1); + gtk_box_pack_start(GTK_BOX(vbox), buttons_bar, FALSE, FALSE, 1); + gtk_box_pack_start(GTK_BOX(vbox), main_paned, true, true, 1); + + /* Adding the vbox to the main window. */ + gtk_container_add(GTK_CONTAINER(mainwin), vbox); + + g_signal_connect(mainwin, "destroy", G_CALLBACK(emugtk_quit_gui), NULL); + + gtk_widget_show_all(mainwin); + + emugtk_window_init_complete = true; +} + +void +add_menu_separator(GtkWidget *menu) +{ + GtkWidget *item; + + item = gtk_menu_item_new(); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); +} + +void +emugtk_new_file(char *file) +{ + int rc; + + emugtk_stop_running(); + + rc = hexfile_load(file); + if (!rc) { + message_show_error("Error parsing hex file"); + } else { + if (cfg->clear_ram_on_file_load) + emugtk_reset(); + + emugtk_update_display(); + } +} + +int +main(int argc, char **argv) +{ + int rc_load_hexfile = true; + + parse_command_line_options(argc, argv); + app_config_load(); + + cpu8051_init(); + + running = 0; + + gtk_init(&argc, &argv); + + if (options.filename != NULL) + rc_load_hexfile = hexfile_load(options.filename); + + cpu8051_reset(); + + log_info("Init GUI"); + emugtk_window_init(); + emugtk_update_display(); + + if (!rc_load_hexfile) + message_show_error("Error parsing hex file"); + + gtk_main(); + + log_info("Terminate"); + + app_config_save(); + + return EXIT_SUCCESS; +} diff -Nru emu8051-1.1.1/src/gtk/main.h emu8051-2.0.1/src/gtk/main.h --- emu8051-1.1.1/src/gtk/main.h 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/gtk/main.h 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,42 @@ +/* + * main.h + * + * Copyright (C) 1999 Jonathan St-André + * Copyright (C) 1999 Hugo Villeneuve + * + * This file is released under the GPLv2 + */ + +#ifndef MAIN_H +#define MAIN_H 1 + +#include + +void +add_menu_separator(GtkWidget *menu); + +void +emugtk_new_file(char *file); + +void +emugtk_update_display(void); + +void +emugtk_quit_gui(void); + +void +emugtk_create_int_memory_paned(void); + +void +emugtk_destroy_int_memory_paned(void); + +void +emugtk_create_ext_memory_paned(void); + +void +emugtk_destroy_ext_memory_paned(void); + +void +emugtk_recreate_memory_paned(void); + +#endif /* MAIN_H */ diff -Nru emu8051-1.1.1/src/gtk/Makefile.am emu8051-2.0.1/src/gtk/Makefile.am --- emu8051-1.1.1/src/gtk/Makefile.am 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/gtk/Makefile.am 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,40 @@ +# This file is processed by GNU automake to generate Makefile.in + +AM_CPPFLAGS = \ + $(WARNINGCFLAGS) \ + -I@top_srcdir@ \ + -I@top_srcdir@/src/common \ + -I$(top_srcdir)/pixmaps \ + @GTK_CFLAGS@ \ + @GLIB_CFLAGS@ \ + -DDATADIR=\"$(datadir)\" \ + -DGDK_PIXBUF_DISABLE_DEPRECATED \ + -DGDK_DISABLE_DEPRECATED \ + -DGTK_DISABLE_DEPRECATED + +LDADD = \ + $(top_builddir)/src/common/libemu8051.a \ + @GTK_LIBS@ \ + @ZLIB_LIBS@ \ + @GLIB_LIBS@ + +bin_PROGRAMS = emu8051-gtk + +emu8051_gtk_SOURCES = \ + main.c main.h \ + app-config.c app-config.h \ + memwin.c memwin.h \ + pgmwin.c pgmwin.h \ + regwin.c regwin.h \ + pswwin.c pswwin.h \ + timerwin.c timerwin.h \ + filemenu.c filemenu.h \ + viewmenu.c viewmenu.h \ + helpmenu.c helpmenu.h \ + messagebox.c messagebox.h + +EXTRA_DIST = + +CLEANFILES = *~ + +MAINTAINERCLEANFILES = Makefile.in diff -Nru emu8051-1.1.1/src/gtk/Makefile.in emu8051-2.0.1/src/gtk/Makefile.in --- emu8051-1.1.1/src/gtk/Makefile.in 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/gtk/Makefile.in 2014-03-22 18:26:16.000000000 +0000 @@ -0,0 +1,639 @@ +# Makefile.in generated by automake 1.14 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 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@ + +# This file is processed by GNU automake to generate Makefile.in + +VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +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 = : +bin_PROGRAMS = emu8051-gtk$(EXEEXT) +subdir = src/gtk +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(top_srcdir)/build-aux/depcomp +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" +PROGRAMS = $(bin_PROGRAMS) +am_emu8051_gtk_OBJECTS = main.$(OBJEXT) app-config.$(OBJEXT) \ + memwin.$(OBJEXT) pgmwin.$(OBJEXT) regwin.$(OBJEXT) \ + pswwin.$(OBJEXT) timerwin.$(OBJEXT) filemenu.$(OBJEXT) \ + viewmenu.$(OBJEXT) helpmenu.$(OBJEXT) messagebox.$(OBJEXT) +emu8051_gtk_OBJECTS = $(am_emu8051_gtk_OBJECTS) +emu8051_gtk_LDADD = $(LDADD) +emu8051_gtk_DEPENDENCIES = $(top_builddir)/src/common/libemu8051.a +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(emu8051_gtk_SOURCES) +DIST_SOURCES = $(emu8051_gtk_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS504_CHECK = @AS504_CHECK@ +ASEM51_CHECK = @ASEM51_CHECK@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GREP = @GREP@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_LIBS = @GTK_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBOBJS = @LIBOBJS@ +LIBREADLINE = @LIBREADLINE@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +OBJEXT = @OBJEXT@ +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@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +WARNINGCFLAGS = @WARNINGCFLAGS@ +YACC = @YACC@ +YFLAGS = @YFLAGS@ +ZLIB_LIBS = @ZLIB_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_aux_dir = @ac_aux_dir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +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_alias = @build_alias@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host_alias = @host_alias@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +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_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +zlib_CFLAGS = @zlib_CFLAGS@ +zlib_LIBS = @zlib_LIBS@ +AM_CPPFLAGS = \ + $(WARNINGCFLAGS) \ + -I@top_srcdir@ \ + -I@top_srcdir@/src/common \ + -I$(top_srcdir)/pixmaps \ + @GTK_CFLAGS@ \ + @GLIB_CFLAGS@ \ + -DDATADIR=\"$(datadir)\" \ + -DGDK_PIXBUF_DISABLE_DEPRECATED \ + -DGDK_DISABLE_DEPRECATED \ + -DGTK_DISABLE_DEPRECATED + +LDADD = \ + $(top_builddir)/src/common/libemu8051.a \ + @GTK_LIBS@ \ + @ZLIB_LIBS@ \ + @GLIB_LIBS@ + +emu8051_gtk_SOURCES = \ + main.c main.h \ + app-config.c app-config.h \ + memwin.c memwin.h \ + pgmwin.c pgmwin.h \ + regwin.c regwin.h \ + pswwin.c pswwin.h \ + timerwin.c timerwin.h \ + filemenu.c filemenu.h \ + viewmenu.c viewmenu.h \ + helpmenu.c helpmenu.h \ + messagebox.c messagebox.h + +EXTRA_DIST = +CLEANFILES = *~ +MAINTAINERCLEANFILES = Makefile.in +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .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/gtk/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/gtk/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): +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p \ + ; then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' \ + -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' \ + `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) + +installcheck-binPROGRAMS: $(bin_PROGRAMS) + bad=0; pid=$$$$; list="$(bin_PROGRAMS)"; for p in $$list; do \ + case ' $(AM_INSTALLCHECK_STD_OPTIONS_EXEMPT) ' in \ + *" $$p "* | *" $(srcdir)/$$p "*) continue;; \ + esac; \ + f=`echo "$$p" | \ + sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + for opt in --help --version; do \ + if "$(DESTDIR)$(bindir)/$$f" $$opt >c$${pid}_.out \ + 2>c$${pid}_.err &2; bad=1; fi; \ + done; \ + done; rm -f c$${pid}_.???; exit $$bad + +emu8051-gtk$(EXEEXT): $(emu8051_gtk_OBJECTS) $(emu8051_gtk_DEPENDENCIES) $(EXTRA_emu8051_gtk_DEPENDENCIES) + @rm -f emu8051-gtk$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(emu8051_gtk_OBJECTS) $(emu8051_gtk_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/app-config.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filemenu.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/helpmenu.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memwin.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/messagebox.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pgmwin.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pswwin.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/regwin.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timerwin.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/viewmenu.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + 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-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + 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" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +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 $(PROGRAMS) +installdirs: + for dir in "$(DESTDIR)$(bindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +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: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +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." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic 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-binPROGRAMS + +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: installcheck-binPROGRAMS + +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 + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \ + clean-binPROGRAMS clean-generic cscopelist-am ctags ctags-am \ + distclean distclean-compile distclean-generic distclean-tags \ + distdir dvi dvi-am html html-am info info-am install \ + install-am install-binPROGRAMS 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 \ + installcheck-binPROGRAMS installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am uninstall-binPROGRAMS + + +# 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 -Nru emu8051-1.1.1/src/gtk/memwin.c emu8051-2.0.1/src/gtk/memwin.c --- emu8051-1.1.1/src/gtk/memwin.c 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/gtk/memwin.c 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,384 @@ +/* + * memwin.c + * + * Copyright (C) 1999 Jonathan St-André + * Copyright (C) 1999 Hugo Villeneuve + * + * This file is released under the GPLv2 + */ + +#if HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include +#include +#include /* For isprint */ +#include /* For crc32 routine */ + +#include "common.h" +#include "memory.h" +#include "hexfile.h" +#include "cpu8051.h" +#include "regwin.h" +#include "memwin.h" +#include "main.h" +#include "options.h" +#include "log.h" +#include "app-config.h" + +extern struct app_config_t *cfg; +extern struct options_t options; + +static int COL_ASCII; +static int N_COLUMNS; + +enum { + COL_ADDRESS = 0, + COL_DATA0, +}; + +/* Contains informations for the two different memory window types. */ +struct memwin_infos_t { + GtkWidget *memlist; + int data_rows; + uint32_t *crc; + int crc_init; +}; + +static struct memwin_infos_t memwin_infos_internal; +static struct memwin_infos_t memwin_infos_external; +static struct memwin_infos_t *memwin_infos; + +/* Creating a model */ +static GtkListStore * +memwin_init_store(int data_rows) +{ + GtkTreeIter iter; + int row; + int col; + GtkListStore *store; + GType col_types[N_COLUMNS]; + + /* No need for static array, all our columns are of the same type. */ + for (col = 0; col < N_COLUMNS; col++) + col_types[col] = G_TYPE_STRING; + + store = gtk_list_store_newv(N_COLUMNS, col_types); + + /* Add rows. */ + for (row = 0; row < data_rows; row++) + gtk_list_store_append(store, &iter); + + return store; +} + +static void +memwin_cell_edited(GtkCellRendererText *cell, gchar *path_string, + gchar *new_str, gpointer model) +{ + guint column; + enum mem_id_t memory_id; + gpointer columnptr; + gpointer memory_id_ptr; + GtkTreeIter iter; + int address; + uint8_t old; + int new; + char *str; + + if (!model) + log_err("Unable to get model from cell renderer"); + + /* Column number is passed as renderer object data */ + columnptr = g_object_get_data(G_OBJECT(cell), "column"); + column = GPOINTER_TO_UINT(columnptr); + + /* Memory ID is passed as renderer object data */ + memory_id_ptr = g_object_get_data(G_OBJECT(cell), "memory_id"); + memory_id = GPOINTER_TO_UINT(memory_id_ptr); + + /* Get the iterator */ + gtk_tree_model_get_iter_from_string(model, &iter, path_string); + + /* Get base address. */ + gtk_tree_model_get(model, &iter, COL_ADDRESS, &str, -1); + + /* No need to check error, has already been validated. */ + address = asciihex2int(str); + + /* Convert column number (1, 2, 3...) to index (0, 1, 2...) */ + address += (column - COL_DATA0); + old = mem_read8(memory_id, address); + + log_info("Address: $%02X", address); + log_info(" old value: $%02X", old); + + /* Convert new value (asciihex) to integer. */ + new = asciihex2int(new_str); + if (asciihex2int_get_error()) { + log_warn(" new value: invalid"); + return; + } else if ((new < 0) || (new > 255)) { + log_warn(" new value: out of range"); + return; + } else { + log_info(" new value: $%02X", new); + } + + /* Store new value in emulator memory. */ + mem_write8(memory_id, address, new); + + /* Convert to text. */ + int2asciihex(new, str, 2); + + /* Store new value in gtk model. */ + gtk_list_store_set(GTK_LIST_STORE(model), &iter, column, str, -1); + + /* + * Make sure to update all registers and memory. + * For example, BANKed registers depends on internal memory. + */ + emugtk_update_display(); +}; + +static void +memwin_init_columns(GtkWidget *listview, enum mem_id_t memory_id) +{ + int i; + GtkCellRenderer *renderer; + GtkTreeViewColumn *column; + + /* Columns and cell renderers */ + renderer = gtk_cell_renderer_text_new(); + + /* Add address column */ + column = gtk_tree_view_column_new_with_attributes( + "Address", renderer, "text", COL_ADDRESS, NULL); + gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); + gtk_tree_view_append_column(GTK_TREE_VIEW(listview), column); + + for (i = COL_DATA0; i < (COL_DATA0 + cfg->bytes_per_row); i++) { + char col_name[8]; + + /* Create new renderer for each editable cell. */ + renderer = gtk_cell_renderer_text_new(); + + /* Allow edition, align to left side. */ + g_object_set(renderer, "editable", TRUE, "xalign", 0, NULL); + + g_signal_connect(renderer, "edited", + G_CALLBACK(memwin_cell_edited), + gtk_tree_view_get_model( + GTK_TREE_VIEW(listview))); + + /* Add column index and memory_id, used when editing the cell */ + g_object_set_data(G_OBJECT(renderer), "column", + GUINT_TO_POINTER(i)); + g_object_set_data(G_OBJECT(renderer), "memory_id", + GUINT_TO_POINTER(memory_id)); + + /* Use two digits only if DATA_ROWS > 10 */ + if (cfg->bytes_per_row < 10) + sprintf(col_name, "B%1d", i - COL_DATA0); + else + sprintf(col_name, "B%02d", i - COL_DATA0); + + column = gtk_tree_view_column_new_with_attributes( + col_name, renderer, "text", i, NULL); + gtk_tree_view_column_set_sizing(column, + GTK_TREE_VIEW_COLUMN_AUTOSIZE); + gtk_tree_view_append_column(GTK_TREE_VIEW(listview), column); + } + + /* Add ASCII column, using fixed-font. */ + renderer = gtk_cell_renderer_text_new(); + g_object_set(renderer, "family", "Monospace", NULL); + column = gtk_tree_view_column_new_with_attributes( + "ASCII", renderer, "text", COL_ASCII, NULL); + gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); + gtk_tree_view_append_column(GTK_TREE_VIEW(listview), column); +} + +static void +memwin_infos_select(enum mem_id_t memory_id) +{ + if (memory_id == INT_MEM_ID) { + log_debug("memory ID = INTERNAL"); + memwin_infos = &memwin_infos_internal; + } else if (memory_id == EXT_MEM_ID) { + log_debug("memory ID = EXTERNAL"); + memwin_infos = &memwin_infos_external; + } else { + log_fail("Invalid memory type"); + exit(1); + } +} + +static void +compute_data_rows(int memory_id) +{ + if (memory_id == INT_MEM_ID) + memwin_infos->data_rows = options.iram_size / + cfg->bytes_per_row; + else if (memory_id == EXT_MEM_ID) + memwin_infos->data_rows = options.xram_size / + cfg->bytes_per_row; + + if (memwin_infos->crc) + free(memwin_infos->crc); + + memwin_infos->crc = malloc(memwin_infos->data_rows * sizeof(uint32_t)); + memwin_infos->crc_init = false; +} + +GtkWidget * +memwin_init(char *title, enum mem_id_t memory_id) +{ + GtkWidget *frame; + GtkWidget *scrollwin; + GtkListStore *store; + + log_debug("memwin_init"); + + COL_ASCII = cfg->bytes_per_row + 1; + N_COLUMNS = COL_ASCII + 1; + + frame = gtk_frame_new(title); + + scrollwin = gtk_scrolled_window_new(NULL, NULL); + gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrollwin), + GTK_SHADOW_ETCHED_OUT); + + /* Automatically add scrollbars when necessary. */ + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrollwin), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + + gtk_container_add(GTK_CONTAINER(frame), scrollwin); + + memwin_infos_select(memory_id); + compute_data_rows(memory_id); + + /* Creating a model */ + store = memwin_init_store(memwin_infos->data_rows); + + /* Creating the view component */ + memwin_infos->memlist = gtk_tree_view_new_with_model( + GTK_TREE_MODEL(store)); + gtk_tree_view_set_headers_visible( + GTK_TREE_VIEW(memwin_infos->memlist), TRUE); + gtk_container_add(GTK_CONTAINER(scrollwin), memwin_infos->memlist); + + memwin_init_columns(memwin_infos->memlist, memory_id); + + /* + * The tree view has acquired its own reference to the model, so we can + * drop ours. That way the model will be freed automatically when the + * tree view is destroyed. + */ + g_object_unref(store); + + return frame; +} + +/* + * Use CRC to detect which rows have changed. This is only to + * improve performance when using stepping mode, as we then only update + * rows which have been modified. + */ +static int +memwin_row_changed(enum mem_id_t memory_id, int row, unsigned int address) +{ + int row_changed; + uint32_t crc_new = 0; + uint8_t *buf8; + + buf8 = mem_getbuf(memory_id, address); + crc_new = crc32(0L, Z_NULL, 0); + crc_new = crc32(crc_new, buf8, cfg->bytes_per_row); + + if ((memwin_infos->crc_init) && + (crc_new == memwin_infos->crc[row])) { + row_changed = false; + } else { + memwin_infos->crc[row] = crc_new; + log_debug(" Row %02d value(s) change", row); + row_changed = true; + } + + return row_changed; +} + +/* Dump internal or external memory. */ +void +memwin_refresh(enum mem_id_t memory_id) +{ + int row; + unsigned int address = 0; + GtkListStore *store; + + log_debug("memwin_refresh"); + + memwin_infos_select(memory_id); + + store = GTK_LIST_STORE(gtk_tree_view_get_model( + GTK_TREE_VIEW(memwin_infos->memlist))); + + for (row = 0; row < memwin_infos->data_rows; + row++, address += cfg->bytes_per_row) { + int valid; + GtkTreeIter iter; + char str[4+1]; /* Max. str len for address column (4 digits) */ + char ascii_str[16+1]; /* Maximum 16 data columns. */ + int col; + + if (row == 0) { + /* Get first row in list store */ + valid = gtk_tree_model_get_iter_first( + GTK_TREE_MODEL(store), &iter); + } else { + /* Get next row in list store */ + valid = gtk_tree_model_iter_next( + GTK_TREE_MODEL(store), &iter); + } + + if (!valid) { + log_err("Tree model: invalid iter"); + return; + } + + /* Only update row if it has been modified. */ + if (memwin_row_changed(memory_id, row, address)) { + /* Display base address. */ + int2asciihex(address, str, 4); + + gtk_list_store_set(store, &iter, COL_ADDRESS, str, -1); + + for (col = 0; col < cfg->bytes_per_row; col++) { + uint8_t data; + + data = mem_read8(memory_id, address + col); + + /* Display hex data */ + int2asciihex(data, str, 2); + + gtk_list_store_set(store, &iter, col + 1, str, + -1); + + /* Append to ASCII string (if applicable). */ + if (!isprint(data)) + data = '.'; + sprintf(&ascii_str[col], "%c", data); + } + + /* Display ASCII characters. */ + gtk_list_store_set(store, &iter, COL_ASCII, ascii_str, + -1); + } + } + + /* At this point we know all rows crc have been initialized. */ + memwin_infos->crc_init = true; +} diff -Nru emu8051-1.1.1/src/gtk/memwin.h emu8051-2.0.1/src/gtk/memwin.h --- emu8051-1.1.1/src/gtk/memwin.h 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/gtk/memwin.h 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,21 @@ +/* + * memwin.h + * + * Copyright (C) 1999 Jonathan St-André + * Copyright (C) 1999 Hugo Villeneuve + * + * This file is released under the GPLv2 + */ + +#ifndef MEMWIN_H +#define MEMWIN_H 1 + +#include + +GtkWidget * +memwin_init(char *title, enum mem_id_t memory_id); + +void +memwin_refresh(enum mem_id_t memory_id); + +#endif /* MEMWIN_H */ diff -Nru emu8051-1.1.1/src/gtk/messagebox.c emu8051-2.0.1/src/gtk/messagebox.c --- emu8051-1.1.1/src/gtk/messagebox.c 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/gtk/messagebox.c 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,47 @@ +/* + * messagebox.c + * + * Copyright (C) 1999 Jonathan St-André + * Copyright (C) 1999 Hugo Villeneuve + * + * This file is released under the GPLv2 + */ + +#if HAVE_CONFIG_H +# include "config.h" +#endif + +#include + +#include "common.h" +#include "messagebox.h" + +extern GtkWidget *mainwin; + +void +message_show_error(char *message) +{ + GtkWidget *dialog; + + dialog = gtk_message_dialog_new(GTK_WINDOW(mainwin), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_CLOSE, + message, NULL); + gtk_dialog_run(GTK_DIALOG(dialog)); + gtk_widget_destroy(dialog); +} + +void +message_show_information(char *message) +{ + GtkWidget *dialog; + + dialog = gtk_message_dialog_new(GTK_WINDOW(mainwin), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_INFO, + GTK_BUTTONS_CLOSE, + message, NULL); + gtk_dialog_run(GTK_DIALOG(dialog)); + gtk_widget_destroy(dialog); +} diff -Nru emu8051-1.1.1/src/gtk/messagebox.h emu8051-2.0.1/src/gtk/messagebox.h --- emu8051-1.1.1/src/gtk/messagebox.h 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/gtk/messagebox.h 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,21 @@ +/* + * messagebox.h + * + * Copyright (C) 1999 Jonathan St-André + * Copyright (C) 1999 Hugo Villeneuve + * + * This file is released under the GPLv2 + */ + +#ifndef MESSAGEBOX_H +#define MESSAGEBOX_H 1 + +#include + +void +message_show_error(char *message); + +void +message_show_information(char *message); + +#endif /* MESSAGEBOX_H */ diff -Nru emu8051-1.1.1/src/gtk/pgmwin.c emu8051-2.0.1/src/gtk/pgmwin.c --- emu8051-1.1.1/src/gtk/pgmwin.c 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/gtk/pgmwin.c 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,293 @@ +/* + * pgmwin.c + * + * Copyright (C) 1999 Jonathan St-André + * Copyright (C) 1999 Hugo Villeneuve + * + * This file is released under the GPLv2 + */ + +#if HAVE_CONFIG_H +# include "config.h" +#endif + +#include + +#include "common.h" +#include "memory.h" +#include "cpu8051.h" +#include "opcodes.h" +#include "pgmwin.h" +#include "hexfile.h" + +static GtkWidget *pgmlist; + +#define LIST_VIEW_NAME "Program" +#define DATA_ROWS 100 + +enum { + COL_BREAKPT = 0, + COL_ADDR, + COL_B0, + COL_B1, + COL_B2, + COL_INST, + COL_ARGS, + COL_COLOR, + N_COLUMNS, +}; + +static char *col_names[N_COLUMNS] = { + "BPT", + "Address", + "B0", + "B1", + "B2", + "Mnemonic", + "Arguments", + "COLOR", /* Not displayed, used to set foreground color of cell. */ +}; + +/* Creating a model */ +static GtkListStore * +pgmwin_init_store(void) +{ + GtkTreeIter iter; + int row; + int col; + GtkListStore *store; + GType col_types[N_COLUMNS]; + + /* No need for static array, all our columns are of the same type. */ + for (col = 0; col < N_COLUMNS; col++) + col_types[col] = G_TYPE_STRING; + + store = gtk_list_store_newv(N_COLUMNS, col_types); + + /* Add rows. */ + for (row = 0; row < DATA_ROWS; row++) { + gtk_list_store_append(store, &iter); + + /* Color first row in red (current instruction). */ + if (row == 0) + gtk_list_store_set(store, &iter, COL_COLOR, "red", -1); + else + gtk_list_store_set(store, &iter, COL_COLOR, "black", + -1); + } + + return store; +} + +static void +pgmwin_init_columns(void) +{ + int k; + GtkCellRenderer *renderer; + + /* Create renderer */ + renderer = gtk_cell_renderer_text_new(); + + /* Add columns, except for last one (COL_COLOR). */ + for (k = 0; k < COL_COLOR; k++) { + GtkTreeViewColumn *col; + + /* Create tree view column */ + col = gtk_tree_view_column_new(); + gtk_tree_view_column_set_title(col, col_names[k]); + gtk_tree_view_column_set_sizing(col, + GTK_TREE_VIEW_COLUMN_AUTOSIZE); + gtk_tree_view_append_column(GTK_TREE_VIEW(pgmlist), col); + + /* Pack cell renderer into column */ + gtk_tree_view_column_pack_start(col, renderer, TRUE); + + /* Establish connection between cell renderer and data store. */ + gtk_tree_view_column_set_attributes(col, renderer, "text", k, + "foreground", COL_COLOR, + NULL); + } +} + +/* Mouse button pressed in the window. */ +static gint +pgmwin_sel_changed_event(GtkWidget *widget, GdkEvent *event, gpointer data) +{ + GtkTreeSelection *selection; + GtkTreeModel *model; + GtkTreeIter iter; + + /* Remove compiler warning about unused variables. */ + (void) widget; + (void) event; + (void) data; + + log_debug("pgmwin_sel_changed_event()"); + + /* This will only work in single or browse selection mode! */ + selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(pgmlist)); + + if (gtk_tree_selection_get_selected(selection, &model, &iter)) { + char *str_addr; + int val; + + gtk_tree_model_get(model, &iter, COL_ADDR, &str_addr, -1); + + /* Convert hex address in ASCII to integer. */ + /* No need to check error, has already been validated. */ + val = asciihex2int(str_addr); + + log_debug(" row address is: $%04X", val); + + breakpoint_toggle(val); + pgmwin_refresh(); + + g_free(str_addr); + } else { + log_debug(" no row selected"); + } + + return FALSE; +} + +GtkWidget * +pgmwin_init(void) +{ + GtkWidget *frame; + GtkWidget *scrollwin; + GtkListStore *store; + GtkTreeSelection *selection; + + frame = gtk_frame_new(LIST_VIEW_NAME); + + scrollwin = gtk_scrolled_window_new(NULL, NULL); + gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrollwin), + GTK_SHADOW_ETCHED_OUT); + + /* Automatically add scrollbars when necessary. */ + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrollwin), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + + gtk_container_add(GTK_CONTAINER(frame), scrollwin); + + /* Creating a model */ + store = pgmwin_init_store(); + + /* Creating the view component */ + pgmlist = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store)); + gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(pgmlist), TRUE); + gtk_container_add(GTK_CONTAINER(scrollwin), pgmlist); + + selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(pgmlist)); + + /* Only one row can be selected at a time. */ + gtk_tree_selection_set_mode(selection, GTK_SELECTION_BROWSE); + + g_signal_connect(selection, "changed", + G_CALLBACK(pgmwin_sel_changed_event), NULL); + + pgmwin_init_columns(); + + /* + * The tree view has acquired its own reference to the model, so we can + * drop ours. That way the model will be freed automatically when the + * tree view is destroyed. + */ + g_object_unref(store); + + return frame; +} + +/* Show disassembled program. */ +void +pgmwin_refresh(void) +{ + int row; + GtkListStore *store; + unsigned int address; + + address = cpu8051.pc; + + store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(pgmlist))); + + for (row = 0; row < DATA_ROWS; row++) { + int valid; + GtkTreeIter iter; + char str[128]; + int k; + int col_id; + int inst_size; + unsigned char opcode; + + if (row == 0) { + /* Get first row in list store */ + valid = gtk_tree_model_get_iter_first( + GTK_TREE_MODEL(store), &iter); + } else { + /* Get next row in list store */ + valid = gtk_tree_model_iter_next( + GTK_TREE_MODEL(store), &iter); + } + + if (!valid) { + log_err("Tree model: invalid iter"); + return; + } + + if (address > 0xFFFF) { + /* + * Not the most elegant solution, but it works to not + * display instructions past last address, 0xFFFF. + */ + gtk_list_store_set(store, &iter, + COL_BREAKPT, NULL, + COL_ADDR, NULL, + COL_B0, NULL, + COL_B1, NULL, + COL_B2, NULL, + COL_INST, NULL, + COL_ARGS, NULL, + COL_COLOR, NULL, + -1); + } else { + /* Display breakpoints. */ + if (breakpoint_is_defined(address)) + sprintf(str, "*"); + else + str[0] = '\0'; + + gtk_list_store_set(store, &iter, COL_BREAKPT, str, -1); + + /* Display base address. */ + int2asciihex(address, str, 4); + gtk_list_store_set(store, &iter, COL_ADDR, str, -1); + + opcode = mem_read8(PGM_MEM_ID, address); + inst_size = opcodes_get_instr_size(opcode); + + /* Display instruction hex bytes. */ + for (k = 0, col_id = COL_B0; k < 3; k++, col_id++) { + if (k < inst_size) + int2asciihex(mem_read8(PGM_MEM_ID, + address + k), + str, 2); + else + str[0] = '\0'; + + gtk_list_store_set(store, &iter, col_id, str, + -1); + } + + /* Display instruction menmonic. */ + (void) cpu8051_disasm_mnemonic(opcode, str); + gtk_list_store_set(store, &iter, COL_INST, str, -1); + + /* Display instruction arguments (if applicable). */ + cpu8051_disasm_args(address, str); + gtk_list_store_set(store, &iter, COL_ARGS, str, -1); + + address += inst_size; + } + } +} diff -Nru emu8051-1.1.1/src/gtk/pgmwin.h emu8051-2.0.1/src/gtk/pgmwin.h --- emu8051-1.1.1/src/gtk/pgmwin.h 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/gtk/pgmwin.h 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,21 @@ +/* + * pgmwin.h + * + * Copyright (C) 1999 Jonathan St-André + * Copyright (C) 1999 Hugo Villeneuve + * + * This file is released under the GPLv2 + */ + +#ifndef PGMWIN_H +#define PGMWIN_H 1 + +#include + +GtkWidget * +pgmwin_init(void); + +void +pgmwin_refresh(void); + +#endif /* PGMWIN_H */ diff -Nru emu8051-1.1.1/src/gtk/pswwin.c emu8051-2.0.1/src/gtk/pswwin.c --- emu8051-1.1.1/src/gtk/pswwin.c 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/gtk/pswwin.c 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,241 @@ +/* + * pswwin.c + * + * Copyright (C) 1999 Jonathan St-André + * Copyright (C) 1999 Hugo Villeneuve + * + * This file is released under the GPLv2 + */ + +#if HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include + +#include "common.h" +#include "reg8051.h" +#include "cpu8051.h" +#include "memory.h" +#include "pswwin.h" +#include "memwin.h" +#include "pgmwin.h" +#include "psw.h" +#include "instructions_8051.h" +#include "hexfile.h" +#include "main.h" + +static GtkWidget *pswlist; + +#define DATA_ROWS 1 +#define LIST_VIEW_NAME "PSW" + +enum { + COL_CY = 0, + COL_AC, + COL_F0, + COL_RS1, + COL_RS0, + COL_OV, + COL_RESERVED, + COL_P, + N_COLUMNS, +}; + +static char *col_names[N_COLUMNS] = { + "CY", + "AC", + "F0", + "RS1", + "RS0", + "OV", + "-", + "P", +}; + +/* Creating a model */ +static GtkListStore * +pswwin_init_store(void) +{ + GtkTreeIter iter; + int row; + int col; + GtkListStore *store; + GType col_types[N_COLUMNS]; + + /* No need for static array, all our columns are of the same type. */ + for (col = 0; col < N_COLUMNS; col++) + col_types[col] = G_TYPE_STRING; + + store = gtk_list_store_newv(N_COLUMNS, col_types); + + /* Add rows. */ + for (row = 0; row < DATA_ROWS; row++) + gtk_list_store_append(store, &iter); + + return store; +} + +static void +pswwin_cell_edited(GtkCellRendererText *cell, gchar *path_string, + gchar *new_str, gpointer model) +{ + guint column; + gpointer columnptr; + GtkTreeIter iter; + uint8_t old; + int new; + char str[10]; + int bit_index; + + if (!model) + log_err("Unable to get model from cell renderer"); + + /* Column number is passed as renderer object data */ + columnptr = g_object_get_data(G_OBJECT(cell), "column"); + column = GPOINTER_TO_UINT(columnptr); + + log_info("column = $%02X", column); + + /* Get the iterator */ + gtk_tree_model_get_iter_from_string(model, &iter, path_string); + + bit_index = 7 - column; + + old = psw_read_bit(bit_index); + + log_info(" old value: %d", old); + + /* Convert new value (asciihex) to integer. */ + new = asciihex2int(new_str); + + if (asciihex2int_get_error()) { + log_warn(" new value: invalid"); + return; + } else if ((new != 0) && (new != 1)) { + log_warn(" new value: out of range"); + return; + } else { + log_info(" new value: %d", new); + } + + /* Store new value in emulator memory. */ + psw_write_bit(bit_index, new); + + /* Convert to text. */ + int2asciihex(new, str, 1); + + /* Store new value in gtk model. */ + gtk_list_store_set(GTK_LIST_STORE(model), &iter, column, str, -1); + + /* + * Make sure to update all registers and memory. + * For example, BANKed registers depends on internal memory. + */ + emugtk_update_display(); +}; + +static void +pswwin_init_columns(void) +{ + int k; + + /* Add column for each bit in PSW. */ + for (k = 0; k < N_COLUMNS; k++) { + GtkCellRenderer *renderer; + GtkTreeViewColumn *column; + + /* Create new renderer for value column (editable). */ + renderer = gtk_cell_renderer_text_new(); + + /* Allow edition, align to center. */ + g_object_set(renderer, "editable", TRUE, "xalign", 0.5, NULL); + + g_signal_connect(renderer, "edited", + G_CALLBACK(pswwin_cell_edited), + gtk_tree_view_get_model( + GTK_TREE_VIEW(pswlist))); + + /* Add column index, used when editing the cell. */ + g_object_set_data(G_OBJECT(renderer), "column", + GUINT_TO_POINTER(k)); + + column = gtk_tree_view_column_new_with_attributes( + col_names[k], renderer, "text", k, NULL); + + /* Center column name */ + g_object_set(column, "alignment", 0.5, NULL); + + /* Hardcoded width... */ + gtk_tree_view_column_set_sizing(column, + GTK_TREE_VIEW_COLUMN_FIXED); + gtk_tree_view_column_set_fixed_width(column, 35); + + gtk_tree_view_append_column(GTK_TREE_VIEW(pswlist), column); + } +} + +GtkWidget * +pswwin_init(void) +{ + GtkWidget *frame; + GtkListStore *store; + + frame = gtk_frame_new(LIST_VIEW_NAME); + + /* Creating a model */ + store = pswwin_init_store(); + + /* Creating the view component */ + pswlist = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store)); + + gtk_tree_view_set_grid_lines(GTK_TREE_VIEW(pswlist), + GTK_TREE_VIEW_GRID_LINES_BOTH); + + gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(pswlist), TRUE); + gtk_container_add(GTK_CONTAINER(frame), pswlist); + + pswwin_init_columns(); + + /* + * The tree view has acquired its own reference to the model, so we can + * drop ours. That way the model will be freed automatically when the + * tree view is destroyed. + */ + g_object_unref(store); + + return frame; +} + +/* Show registers. */ +void +pswwin_refresh(void) +{ + GtkListStore *store; + int valid; + GtkTreeIter iter; + int k; + + store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(pswlist))); + + /* Get first row in list store */ + valid = gtk_tree_model_get_iter_first( + GTK_TREE_MODEL(store), &iter); + + if (!valid) { + log_err("Tree model: invalid iter"); + return; + } + + /* Display bit values. */ + for (k = 0; k < N_COLUMNS; k++) { + char str[4]; + int bit_index; + + bit_index = 7 - k; + + int2asciihex(psw_read_bit(bit_index), str, 1); + gtk_list_store_set(store, &iter, k, str, -1); + } +} diff -Nru emu8051-1.1.1/src/gtk/pswwin.h emu8051-2.0.1/src/gtk/pswwin.h --- emu8051-1.1.1/src/gtk/pswwin.h 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/gtk/pswwin.h 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,21 @@ +/* + * pswwin.h + * + * Copyright (C) 1999 Jonathan St-André + * Copyright (C) 1999 Hugo Villeneuve + * + * This file is released under the GPLv2 + */ + +#ifndef PSWWIN_H +#define PSWWIN_H 1 + +#include + +GtkWidget * +pswwin_init(void); + +void +pswwin_refresh(void); + +#endif /* PSWWIN_H */ diff -Nru emu8051-1.1.1/src/gtk/regwin.c emu8051-2.0.1/src/gtk/regwin.c --- emu8051-1.1.1/src/gtk/regwin.c 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/gtk/regwin.c 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,235 @@ +/* + * regwin.c + * + * Copyright (C) 1999 Jonathan St-André + * Copyright (C) 1999 Hugo Villeneuve + * + * This file is released under the GPLv2 + */ + +#if HAVE_CONFIG_H +# include "config.h" +#endif + +#include + +#include "common.h" +#include "reg8051.h" +#include "cpu8051.h" +#include "sfr.h" +#include "memory.h" +#include "regwin.h" +#include "memwin.h" +#include "pgmwin.h" +#include "instructions_8051.h" +#include "hexfile.h" +#include "main.h" + +static GtkWidget *reglist; + +#define LIST_VIEW_NAME "Registers" +#define DATA_ROWS SFR_REGS + +enum { + COL_NAME = 0, + COL_VAL, + N_COLUMNS, +}; + +/* Creating a model */ +static GtkListStore * +regwin_init_store(void) +{ + GtkTreeIter iter; + int row; + int col; + GtkListStore *store; + GType col_types[N_COLUMNS]; + + /* No need for static array, all our columns are of the same type. */ + for (col = 0; col < N_COLUMNS; col++) + col_types[col] = G_TYPE_STRING; + + store = gtk_list_store_newv(N_COLUMNS, col_types); + + /* Add rows. */ + for (row = 0; row < DATA_ROWS; row++) + gtk_list_store_append(store, &iter); + + return store; +} + +static void +regwin_cell_edited(GtkCellRendererText *cell, gchar *path_string, + gchar *new_str, gpointer model) +{ + GtkTreeIter iter; + int old; + int new; + char *str; + int rc; + struct regwin_infos_t *regwin_infos; + + (void) cell; /* Remove compiler warning about unused variables. */ + + if (!model) + log_err("Unable to get model from cell renderer"); + + /* Get the iterator */ + gtk_tree_model_get_iter_from_string(model, &iter, path_string); + + /* Get register name. */ + gtk_tree_model_get(model, &iter, COL_NAME, &str, -1); + + log_info("Register: %s", str); + regwin_infos = sfr_get_infos(str); + log_info(" width: %d bits", 4 * regwin_infos->w); + + /* Read current (old) value. */ + gtk_tree_model_get(model, &iter, COL_VAL, &str, -1); + + /* No need to check error, has already been validated. */ + old = asciihex2int(str); + log_info(" old value: $%04X", old); + + new = asciihex2int(new_str); + if (asciihex2int_get_error()) { + log_warn(" new value: invalid"); + return; + } + + log_info(" new value: $%04X", new); + + /* Store new value in emulator register (if in range). */ + rc = regwin_write(regwin_infos, new); + if (rc == 0) { + /* Store new value in gtk model. */ + int2asciihex(new, str, regwin_infos->w); + gtk_list_store_set(GTK_LIST_STORE(model), &iter, COL_VAL, str, + -1); + + /* + * Make sure to update all windows. + * For example, R0-R7 values depends on internal memory values. + */ + emugtk_update_display(); + } +}; + +static void +regwin_init_columns(void) +{ + GtkCellRenderer *renderer; + GtkTreeViewColumn *column; + + /* Columns and cell renderers */ + renderer = gtk_cell_renderer_text_new(); + + /* Add Register column */ + column = gtk_tree_view_column_new_with_attributes( + "Name", renderer, "text", COL_NAME, NULL); + gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); + gtk_tree_view_append_column(GTK_TREE_VIEW(reglist), column); + + /* Add Value column */ + + /* Create new renderer for value column (editable). */ + renderer = gtk_cell_renderer_text_new(); + + /* Allow edition, align to right side. */ + g_object_set(renderer, "editable", TRUE, "xalign", 1.0, NULL); + + g_signal_connect(renderer, "edited", + G_CALLBACK(regwin_cell_edited), + gtk_tree_view_get_model(GTK_TREE_VIEW(reglist))); + + column = gtk_tree_view_column_new_with_attributes( + "Value", renderer, "text", COL_VAL, NULL); + gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); + gtk_tree_view_append_column(GTK_TREE_VIEW(reglist), column); +} + +GtkWidget * +regwin_init(void) +{ + GtkWidget *frame; + GtkWidget *scrollwin; + GtkListStore *store; + + frame = gtk_frame_new(LIST_VIEW_NAME); + + scrollwin = gtk_scrolled_window_new(NULL, NULL); + gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrollwin), + GTK_SHADOW_ETCHED_OUT); + + /* Automatically add scrollbars when necessary. */ + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrollwin), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + + gtk_container_add(GTK_CONTAINER(frame), scrollwin); + + /* Creating a model */ + store = regwin_init_store(); + + /* Creating the view component */ + reglist = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store)); + gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(reglist), TRUE); + gtk_container_add(GTK_CONTAINER(scrollwin), reglist); + + regwin_init_columns(); + + /* + * The tree view has acquired its own reference to the model, so we can + * drop ours. That way the model will be freed automatically when the + * tree view is destroyed. + */ + g_object_unref(store); + + return frame; +} + +/* Show registers. */ +void +regwin_refresh(void) +{ + int row; + GtkListStore *store; + + store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(reglist))); + + for (row = 0; row < DATA_ROWS; row++) { + int valid; + GtkTreeIter iter; + int val; + char str[8]; + struct regwin_infos_t *regwin_infos; + + if (row == 0) { + /* Get first row in list store */ + valid = gtk_tree_model_get_iter_first( + GTK_TREE_MODEL(store), &iter); + } else { + /* Get next row in list store */ + valid = gtk_tree_model_iter_next( + GTK_TREE_MODEL(store), &iter); + } + + if (!valid) { + log_err("Tree model: invalid iter"); + return; + } + + regwin_infos = sfr_get_infos_from_row(row); + + val = regwin_read(row); + + /* Convert to specified number of hex digits. */ + int2asciihex(val, str, regwin_infos->w); + + gtk_list_store_set(store, &iter, + COL_NAME, regwin_infos->name, + COL_VAL, str, + -1); + } +} diff -Nru emu8051-1.1.1/src/gtk/regwin.h emu8051-2.0.1/src/gtk/regwin.h --- emu8051-1.1.1/src/gtk/regwin.h 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/gtk/regwin.h 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,21 @@ +/* + * regwin.h + * + * Copyright (C) 1999 Jonathan St-André + * Copyright (C) 1999 Hugo Villeneuve + * + * This file is released under the GPLv2 + */ + +#ifndef REGWIN_H +#define REGWIN_H 1 + +#include + +GtkWidget * +regwin_init(void); + +void +regwin_refresh(void); + +#endif /* REGWIN_H */ diff -Nru emu8051-1.1.1/src/gtk/timerwin.c emu8051-2.0.1/src/gtk/timerwin.c --- emu8051-1.1.1/src/gtk/timerwin.c 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/gtk/timerwin.c 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,112 @@ +/* + * timerwin.c + * + * Copyright (C) 1999 Jonathan St-André + * Copyright (C) 1999 Hugo Villeneuve + * + * This file is released under the GPLv2 + */ + +#if HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include +#include + +#include "common.h" +#include "timers.h" +#include "main.h" + +static GtkWidget *label[GP_TIMERS_COUNT]; + +static GtkWidget * +button_add_stock(GtkWidget *box, gchar *stock_id, int display_label) +{ + GtkWidget *button; + + /* Create the button. */ + if (display_label) { + /* By default, a label is appended to stock buttons. */ + button = gtk_button_new_from_stock(stock_id); + } else { + GtkWidget *icon; + + button = gtk_button_new(); + gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NORMAL); + icon = gtk_image_new_from_stock(stock_id, + GTK_ICON_SIZE_SMALL_TOOLBAR); + gtk_container_add(GTK_CONTAINER(button), icon); + } + + gtk_box_pack_start(GTK_BOX(box), button, false, false, 2); + + return button; +} + +void +timerwin_update(void) +{ + int id; + char buf[128]; + + for (id = 0; id < GP_TIMERS_COUNT; id++) { + /* Display textin bold, with big font size. */ + sprintf(buf , "%08d cycles", + gp_timer_read(id)); + + gtk_label_set_markup(GTK_LABEL(label[id]), buf); + } +} + +static void +timer_reset_callback(GtkWidget *widget, gpointer data) +{ + int id = GPOINTER_TO_INT(data); + + /* Remove compiler warning about unused variables. */ + (void) widget; + + log_info("timer_reset_callback ID = %d", id); + + gp_timer_reset(id); + timerwin_update(); +} + +GtkWidget * +timerwin_init(int id) +{ + GtkWidget *frame; + GtkWidget *hbox; + GtkWidget *vbox; + GtkWidget *timer_reset_button; + char title[100]; + + log_debug("timer window init"); + + sprintf(title, "Emulator timer %c", 'A' + id); + frame = gtk_frame_new(title); + + /* The items of the hbox are NOT given equal space in the box. */ + hbox = gtk_hbox_new(false, 0); + + /* + * If the button was added directly to the hbox, it would be as high + * as the frame widget (ugly). Adding it first to a vbox makes it have + * a box shape. + */ + vbox = gtk_vbox_new(true, 0); + timer_reset_button = button_add_stock(vbox, GTK_STOCK_REFRESH, false); + g_signal_connect(G_OBJECT(timer_reset_button), "clicked", + G_CALLBACK(timer_reset_callback), GINT_TO_POINTER(id)); + gtk_box_pack_start(GTK_BOX(hbox), vbox, false, false, 3); + + label[id] = gtk_label_new(NULL); + gtk_label_set_markup(GTK_LABEL(label[id]), "Small text"); + gtk_box_pack_start(GTK_BOX(hbox), label[id], false, false, 10); + + gtk_container_add(GTK_CONTAINER(frame), hbox); + + return frame; +} diff -Nru emu8051-1.1.1/src/gtk/timerwin.h emu8051-2.0.1/src/gtk/timerwin.h --- emu8051-1.1.1/src/gtk/timerwin.h 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/gtk/timerwin.h 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,21 @@ +/* + * timerwin.h + * + * Copyright (C) 1999 Jonathan St-André + * Copyright (C) 1999 Hugo Villeneuve + * + * This file is released under the GPLv2 + */ + +#ifndef TIMERWIN_H +#define TIMERWIN_H 1 + +#include + +GtkWidget * +timerwin_init(int id); + +void +timerwin_update(void); + +#endif /* TIMERWIN_H */ diff -Nru emu8051-1.1.1/src/gtk/viewmenu.c emu8051-2.0.1/src/gtk/viewmenu.c --- emu8051-1.1.1/src/gtk/viewmenu.c 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/gtk/viewmenu.c 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,189 @@ +/* + * viewmenu.c + * + * Copyright (C) 1999 Jonathan St-André + * Copyright (C) 1999 Hugo Villeneuve + * + * This file is released under the GPLv2 + */ + +#if HAVE_CONFIG_H +# include "config.h" +#endif + +#include + +#include "common.h" +#include "main.h" /* For AddMenuSeparator() function. */ +#include "messagebox.h" +#include "viewmenu.h" +#include "app-config.h" + +extern struct app_config_t *cfg; + +void toggle_layout(GtkWidget *widget, gpointer data) +{ + int id; + + id = GPOINTER_TO_UINT(data); + + if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) { + log_info(" Switching to layout %d", id); + cfg->layout = id; + + message_show_information( + "You must restart for the changes to take effect"); + } +} + +void toggle_bytes_per_row(GtkWidget *widget, gpointer data) +{ + int bytes_per_row; + + bytes_per_row = GPOINTER_TO_UINT(data); + + if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) { + log_info(" Bytes per row = %d", bytes_per_row); + cfg->bytes_per_row = bytes_per_row; + emugtk_destroy_int_memory_paned(); + emugtk_destroy_ext_memory_paned(); + emugtk_recreate_memory_paned(); + } +} + +void toggle_int_memory(GtkWidget *widget, gpointer data) +{ + (void) data; /* Remove compiler warning about unused variables. */ + + if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) { + log_info(" View internal memory"); + cfg->view_int_memory = 1; + emugtk_create_int_memory_paned(); + } else { + cfg->view_int_memory = 0; + emugtk_destroy_int_memory_paned(); + } +} + +void toggle_ext_memory(GtkWidget *widget, gpointer data) +{ + (void) data; /* Remove compiler warning about unused variables. */ + + if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) { + log_info(" View external memory"); + cfg->view_ext_memory = 1; + emugtk_create_ext_memory_paned(); + } else { + cfg->view_ext_memory = 0; + emugtk_destroy_ext_memory_paned(); + } +} + +void +view_add_layout_submenu(GtkWidget *parent) +{ + GtkWidget *submenu; + GtkWidget *layout; + GtkWidget *layout1; + GtkWidget *layout2; + GSList *group = NULL; + + submenu = gtk_menu_new(); + + layout = gtk_menu_item_new_with_label("Layout"); + + layout1 = gtk_radio_menu_item_new_with_label(group, "Layout1"); + group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(layout1)); + layout2 = gtk_radio_menu_item_new_with_label(group, "Layout2"); + + if (cfg->layout == UI_LAYOUT1) + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(layout1), + TRUE); + else + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(layout2), + TRUE); + + g_signal_connect(G_OBJECT(layout1), "activate", + G_CALLBACK(toggle_layout), (gpointer) UI_LAYOUT1); + g_signal_connect(G_OBJECT(layout2), "activate", + G_CALLBACK(toggle_layout), (gpointer) UI_LAYOUT2); + + gtk_menu_item_set_submenu(GTK_MENU_ITEM(layout), submenu); + gtk_menu_shell_append(GTK_MENU_SHELL(submenu), layout1); + gtk_menu_shell_append(GTK_MENU_SHELL(submenu), layout2); + gtk_menu_shell_append(GTK_MENU_SHELL(parent), layout); +} + +void +view_add_bytes_per_row_submenu(GtkWidget *parent) +{ + GtkWidget *submenu; + GtkWidget *item; + GtkWidget *item1; + GtkWidget *item2; + GSList *group = NULL; + + submenu = gtk_menu_new(); + + item = gtk_menu_item_new_with_label("Bytes per row"); + + item1 = gtk_radio_menu_item_new_with_label(group, "8"); + group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(item1)); + item2 = gtk_radio_menu_item_new_with_label(group, "16"); + + if (cfg->bytes_per_row == 8) + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item1), + TRUE); + else + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item2), + TRUE); + + g_signal_connect(G_OBJECT(item1), "activate", + G_CALLBACK(toggle_bytes_per_row), (gpointer) 8); + g_signal_connect(G_OBJECT(item2), "activate", + G_CALLBACK(toggle_bytes_per_row), (gpointer) 16); + + gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu); + gtk_menu_shell_append(GTK_MENU_SHELL(submenu), item1); + gtk_menu_shell_append(GTK_MENU_SHELL(submenu), item2); + gtk_menu_shell_append(GTK_MENU_SHELL(parent), item); +} + +void +view_add_menu(GtkWidget *menu_bar) +{ + GtkWidget *item; + GtkWidget *menu; + GtkWidget *view; + + menu = gtk_menu_new(); + + view = gtk_menu_item_new_with_label("View"); + + item = gtk_check_menu_item_new_with_label("Internal Memory"); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), + cfg->view_int_memory); + g_signal_connect(G_OBJECT(item), "activate", + G_CALLBACK(toggle_int_memory), NULL); + + item = gtk_check_menu_item_new_with_label("External Memory"); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), + cfg->view_ext_memory); + g_signal_connect(G_OBJECT(item), "activate", + G_CALLBACK(toggle_ext_memory), NULL); + + add_menu_separator(menu); + + /* Add layout submenu */ + view_add_layout_submenu(menu); + + add_menu_separator(menu); + + /* Add bytes per row submenu */ + view_add_bytes_per_row_submenu(menu); + + gtk_menu_item_set_submenu(GTK_MENU_ITEM(view), menu); + gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), view); +} diff -Nru emu8051-1.1.1/src/gtk/viewmenu.h emu8051-2.0.1/src/gtk/viewmenu.h --- emu8051-1.1.1/src/gtk/viewmenu.h 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/src/gtk/viewmenu.h 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,18 @@ +/* + * viewmenu.h + * + * Copyright (C) 1999 Jonathan St-André + * Copyright (C) 1999 Hugo Villeneuve + * + * This file is released under the GPLv2 + */ + +#ifndef VIEWMENU_H +#define VIEWMENU_H 1 + +#include + +void +view_add_menu(GtkWidget *menu_bar); + +#endif /* VIEWMENU_H */ diff -Nru emu8051-1.1.1/src/gtksizes.h emu8051-2.0.1/src/gtksizes.h --- emu8051-1.1.1/src/gtksizes.h 2011-10-29 21:06:32.000000000 +0000 +++ emu8051-2.0.1/src/gtksizes.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,52 +0,0 @@ -/* - * gtksizes.h - * - * Copyright (C) 1999 Jonathan St-André - * Copyright (C) 1999 Hugo Villeneuve - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef _GTKSIZES_H_ -#define _GTKSIZES_H_ - -/* Width, in pixels, of a fixed font symbol. */ -#define FIXED_FONT_SYMBOL_WIDTH 10 - -/* Height, in pixels, of a fixed font symbol. */ -#define FIXED_FONT_SYMBOL_HEIGHT 22 - -#define NUMBER_OF_BUTTONS 5 -#define BUTTON_WIDTH 60 -#define BUTTON_HEIGHT 60 -#define BUTTONS_BAR_WIDTH (NUMBER_OF_BUTTONS * BUTTON_WIDTH) -#define BUTTONS_BAR_HEIGHT BUTTON_HEIGHT - -/* 12 symbols + border. */ -#define REG_WIN_WIDTH (FIXED_FONT_SYMBOL_WIDTH * 13) -#define REG_WIN_HEIGHT (FIXED_FONT_SYMBOL_HEIGHT * 24) - -#define MEM_WIN_WIDTH (FIXED_FONT_SYMBOL_WIDTH * 68) /* 68 symbols. */ -#define MEM_WIN_HEIGHT (FIXED_FONT_SYMBOL_HEIGHT * 17) - -#define PGM_WIN_WIDTH (MEM_WIN_WIDTH - REG_WIN_WIDTH) -#define PGM_WIN_HEIGHT REG_WIN_HEIGHT - -#define MENU_BAR_HEIGHT 0 - -#define MAIN_WIN_WIDTH MEM_WIN_WIDTH -#define MAIN_WIN_HEIGHT (BUTTONS_BAR_HEIGHT + REG_WIN_HEIGHT + MEM_WIN_HEIGHT) - -#endif /* _GTKSIZES_H_ */ diff -Nru emu8051-1.1.1/src/helpmenu.c emu8051-2.0.1/src/helpmenu.c --- emu8051-1.1.1/src/helpmenu.c 2011-10-29 21:06:32.000000000 +0000 +++ emu8051-2.0.1/src/helpmenu.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,84 +0,0 @@ -/* - * helpmenu.c - * - * Copyright (C) 1999 Jonathan St-André - * Copyright (C) 1999 Hugo Villeneuve - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#if HAVE_CONFIG_H -# include "config.h" -#endif - -#if STDC_HEADERS -# include -#elif HAVE_STRINGS_H -# include -#endif - -#include - -#include "common.h" -#include "options.h" -#include "emugtk.h" -#include "messagebox.h" -#include "helpmenu.h" - -static void -HelpCommandsEvent(gchar *string) -{ - ShowMessage("Command Line Options", COMMAND_LINE_OPTIONS, - GTK_JUSTIFY_LEFT, MESSAGE_DIALOG_FIXED_FONT); -} - -static void -HelpAboutEvent(gchar *string) -{ - ShowMessage("About", VERSION_STRING, GTK_JUSTIFY_CENTER, - MESSAGE_DIALOG_NORMAL_FONT); -} - -void -HelpAddMenu(GtkWidget *menu_bar) -{ - GtkWidget *item; - GtkWidget *menu; - - menu = gtk_menu_new(); - - /* Create the 'Help Command Line Options' item. */ - item = gtk_menu_item_new_with_label("Command Line Options"); - gtk_menu_append(GTK_MENU(menu), item); - /* Attach the callback functions to the activate signal. */ - gtk_signal_connect_object(GTK_OBJECT(item), "activate", - GTK_SIGNAL_FUNC(HelpCommandsEvent), - NULL); - - AddMenuSeparator(menu); - - /* Create the 'Help About' item. */ - item = gtk_menu_item_new_with_label("About " PACKAGE); - gtk_menu_append(GTK_MENU(menu), item); - /* Attach the callback functions to the activate signal. */ - gtk_signal_connect_object(GTK_OBJECT(item), "activate", - GTK_SIGNAL_FUNC(HelpAboutEvent), - NULL); - - /* Adding submenu title. */ - item = gtk_menu_item_new_with_label("Help"); - gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), menu); - gtk_menu_bar_append(GTK_MENU_BAR(menu_bar), item); -} diff -Nru emu8051-1.1.1/src/helpmenu.h emu8051-2.0.1/src/helpmenu.h --- emu8051-1.1.1/src/helpmenu.h 2011-10-29 21:06:32.000000000 +0000 +++ emu8051-2.0.1/src/helpmenu.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ -/* - * helpmenu.h - * - * Copyright (C) 1999 Jonathan St-André - * Copyright (C) 1999 Hugo Villeneuve - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef HELPMENU_H -#define HELPMENU_H 1 - -#include - -void -HelpAddMenu(GtkWidget *menu_bar); - -#endif /* HELPMENU_H */ diff -Nru emu8051-1.1.1/src/hexfile.c emu8051-2.0.1/src/hexfile.c --- emu8051-1.1.1/src/hexfile.c 2011-10-29 21:06:32.000000000 +0000 +++ emu8051-2.0.1/src/hexfile.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,161 +0,0 @@ -/* - * Functions for loading an Intel HEX file. - * - * Copyright (C) 1999 Jonathan St-André - * Copyright (C) 1999 Hugo Villeneuve - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#if HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include -#include - -#if STDC_HEADERS -# include -#elif HAVE_STRINGS_H -# include -#endif - -#include "common.h" -#include "memory.h" - -/* Convert an ascii string to an hexadecimal number. */ -unsigned int -Ascii2Hex(char *istring, int length) -{ - unsigned int result = 0; - int i, ascii_code; - - if (!length || (length > (int) strlen(istring))) - length = strlen(istring); - - for (i = 0; i < length; i++) { - ascii_code = istring[i]; - if (ascii_code > 0x39) - ascii_code &= 0xDF; - - if ((ascii_code >= 0x30 && ascii_code <= 0x39) || - (ascii_code >= 0x41 && ascii_code <= 0x46)) { - ascii_code -= 0x30; - if (ascii_code > 9) - ascii_code -= 7; - - result <<= 4; - result += ascii_code; - } else { - printf("%s: In Ascii2Hex(), syntax error.\n", PACKAGE); - printf(" str=%s, length=%d\n", istring, length); - } - } - return result; -} - -void -LoadHexFile(const char *filename) -{ - int i, j, RecLength, LoadOffset, RecType, Data, Checksum; - -#define LINE_BUFFER_LEN 256 - FILE *fp; - int status; - char line[LINE_BUFFER_LEN]; - - if (filename == NULL) { - printf("%s: No file specified\n", PACKAGE); - exit(EXIT_FAILURE); - } - - /* Trying to open the file. */ - fp = fopen(filename, "r"); - if (fp == NULL) { - perror(PACKAGE); - /*ErrorLocation(__FILE__, __LINE__);*/ - exit(EXIT_FAILURE); - } - - /* Reading one line of data from the hex file. */ - /* char *fgets(char *s, int size, FILE *stream); - Reading stops after an EOF or a newline. If a newline is read, it is - stored into the buffer. A '\0' is stored after the last character - in the buffer. - */ - while (fgets(line, LINE_BUFFER_LEN, fp) != NULL) { - i = 0; - Checksum = 0; - - if (line[i++] != ':') { - printf("%s: line not beginning with \":\"\n", PACKAGE); - goto close_file; - } - - RecLength = Ascii2Hex(&line[i], 2); - i += 2; - Checksum += RecLength; - - LoadOffset = Ascii2Hex(&line[i], 4); - Checksum += LoadOffset / 256; - Checksum += LoadOffset % 256; - i += 4; - - RecType = Ascii2Hex(&line[i], 2); - i += 2; - Checksum += RecType; - - if (RecType == 1) { - Checksum += Ascii2Hex(&line[i], 2); - Checksum &= 0x000000FF; - - if (Checksum) { - /* Error. */ - printf("%s: Invalid format\n", PACKAGE); - goto close_file; - } else { - /* OK */ - goto close_file; - } - } - - for (j = 0; j < RecLength; j++) { - Data = Ascii2Hex(&line[i], 2); - memory_write8(PGM_MEM_ID, - (unsigned int)(LoadOffset + j), - (unsigned char)Data); - i += 2; - Checksum += Data; - } - - RecType = Ascii2Hex(&line[i], 2); - Checksum += RecType; - Checksum &= 0x000000FF; - - if (Checksum) { - printf("%s: Invalid format\n", PACKAGE); - goto close_file; - } - } - -close_file: - status = fclose(fp); - if (status != EXIT_SUCCESS) { - fprintf(stderr, "%s: Error closing hex file.\n", PACKAGE); - /*ErrorLocation(__FILE__, __LINE__);*/ - exit(EXIT_FAILURE); - } -} diff -Nru emu8051-1.1.1/src/hexfile.h emu8051-2.0.1/src/hexfile.h --- emu8051-1.1.1/src/hexfile.h 2011-10-29 21:06:32.000000000 +0000 +++ emu8051-2.0.1/src/hexfile.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,31 +0,0 @@ -/* - * hexfile.h - * - * Copyright (C) 1999 Jonathan St-André - * Copyright (C) 1999 Hugo Villeneuve - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef HEXFILE_H -#define HEXFILE_H 1 - -unsigned int -Ascii2Hex(char *istring, int length); - -void -LoadHexFile(const char *filename); - -#endif /* HEXFILE_H */ diff -Nru emu8051-1.1.1/src/instructions_8051.c emu8051-2.0.1/src/instructions_8051.c --- emu8051-1.1.1/src/instructions_8051.c 2011-11-20 21:31:29.000000000 +0000 +++ emu8051-2.0.1/src/instructions_8051.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,3964 +0,0 @@ -/* - * instructions_8051.c - * - * Do not modify this file directly, as it was created by opcode2c.pl - * Any modifications made directly to this file will be lost. - * - * Copyright (C) 1999 Jonathan St-André - * Copyright (C) 1999 Hugo Villeneuve - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -/* Define only here, for not having extern scope on local variables. */ -#define INSTRUCTIONS_8051_M 1 - - -#include "reg8051.h" -#include "cpu8051.h" -#include "memory.h" -#include "instructions_8051.h" - - -/***************************************************************************** - * Instruction "NOP" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_00(void) -{ -return 1; -} - - -/***************************************************************************** - * Instruction "AJMP addr11" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_01(void) -{ - unsigned int addr11 = ( ( memory_read8( PGM_MEM_ID, cpu8051.pc - 1 ) << 3 ) & 0xF00 ) + memory_read8( PGM_MEM_ID, cpu8051.pc++ ); -cpu8051.pc = ( cpu8051.pc & 0xF800 ) | addr11; -return 2; -} - - -/***************************************************************************** - * Instruction "LJMP addr16" takes 2 cycle(s) and 3 byte(s). - ****************************************************************************/ -int -cpu8051_OP_02(void) -{ -unsigned int addr16 = ( memory_read8( PGM_MEM_ID, cpu8051.pc++ ) << 8 ); -addr16 += memory_read8( PGM_MEM_ID, cpu8051.pc++ ); -cpu8051.pc = addr16; -return 2; -} - - -/***************************************************************************** - * Instruction "RR A" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_03(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -destination = ( destination >> 1 ) | ( destination << 7 ); -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "INC A" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_04(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -destination++; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "INC direct" takes 1 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_05(void) -{ -unsigned char destaddr = memory_read8( PGM_MEM_ID, cpu8051.pc++ ); -unsigned char destination = cpu8051_ReadD( destaddr ); -destination++; -cpu8051_WriteD( destaddr, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "INC @R0" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_06(void) -{ -unsigned char destination = cpu8051_ReadI ( cpu8051_ReadD( BANKPSW + _R0_ ) ); -destination++; -cpu8051_WriteI( cpu8051_ReadD( BANKPSW + _R0_ ), destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "INC @R1" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_07(void) -{ -unsigned char destination = cpu8051_ReadI ( cpu8051_ReadD( BANKPSW + _R1_ ) ); -destination++; -cpu8051_WriteI( cpu8051_ReadD( BANKPSW + _R1_ ), destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "INC R0" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_08(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R0_ ); -destination++; -cpu8051_WriteD( BANKPSW + _R0_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "INC R1" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_09(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R1_ ); -destination++; -cpu8051_WriteD( BANKPSW + _R1_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "INC R2" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_0A(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R2_ ); -destination++; -cpu8051_WriteD( BANKPSW + _R2_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "INC R3" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_0B(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R3_ ); -destination++; -cpu8051_WriteD( BANKPSW + _R3_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "INC R4" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_0C(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R4_ ); -destination++; -cpu8051_WriteD( BANKPSW + _R4_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "INC R5" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_0D(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R5_ ); -destination++; -cpu8051_WriteD( BANKPSW + _R5_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "INC R6" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_0E(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R6_ ); -destination++; -cpu8051_WriteD( BANKPSW + _R6_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "INC R7" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_0F(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R7_ ); -destination++; -cpu8051_WriteD( BANKPSW + _R7_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "JBC bitaddr,reladdr" takes 2 cycle(s) and 3 byte(s). - ****************************************************************************/ -int -cpu8051_OP_10(void) -{ -unsigned char destination, dstbitaddr = memory_read8( PGM_MEM_ID, cpu8051.pc++ ); -destination = cpu8051_ReadB( dstbitaddr ); -(cpu8051.pc)++; -unsigned int source = ((char) memory_read8(PGM_MEM_ID, cpu8051.pc - 1)) + cpu8051.pc; -if ( destination == 1 ) { cpu8051.pc = source; destination = 0; } -cpu8051_WriteB( dstbitaddr, destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "ACALL addr11" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_11(void) -{ - unsigned int addr11 = ( ( memory_read8( PGM_MEM_ID, cpu8051.pc - 1 ) << 3 ) & 0xF00 ) + memory_read8( PGM_MEM_ID, cpu8051.pc++ ); -unsigned char SP = cpu8051_ReadD( _SP_ ); -cpu8051_WriteI( ++SP, ( cpu8051.pc & 0x00FF ) ); -cpu8051_WriteI( ++SP, ( cpu8051.pc >> 8 ) ); -cpu8051_WriteD( _SP_, SP ); -cpu8051.pc = ( cpu8051.pc & 0xF800 ) | addr11; -return 2; -} - - -/***************************************************************************** - * Instruction "LCALL addr16" takes 2 cycle(s) and 3 byte(s). - ****************************************************************************/ -int -cpu8051_OP_12(void) -{ -unsigned int addr16 = ( memory_read8( PGM_MEM_ID, cpu8051.pc++ ) << 8 ); -addr16 += memory_read8( PGM_MEM_ID, cpu8051.pc++ ); -unsigned char SP = cpu8051_ReadD( _SP_ ); -cpu8051_WriteI( ++SP, ( cpu8051.pc & 0x00FF ) ); -cpu8051_WriteI( ++SP, ( cpu8051.pc >> 8 ) ); -cpu8051_WriteD( _SP_, SP ); -cpu8051.pc = addr16; -return 2; -} - - -/***************************************************************************** - * Instruction "RRC A" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_13(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char tmpval = destination; -destination = ( destination >> 1 ) | ( cpu8051_ReadD( _PSW_ ) & 0x80 ); -cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x7F ) | ( tmpval << 7 ) ); -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "DEC A" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_14(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -destination--; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "DEC direct" takes 1 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_15(void) -{ -unsigned char destaddr = memory_read8( PGM_MEM_ID, cpu8051.pc++ ); -unsigned char destination = cpu8051_ReadD( destaddr ); -destination--; -cpu8051_WriteD( destaddr, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "DEC @R0" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_16(void) -{ -unsigned char destination = cpu8051_ReadI ( cpu8051_ReadD( BANKPSW + _R0_ ) ); -destination--; -cpu8051_WriteI( cpu8051_ReadD( BANKPSW + _R0_ ), destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "DEC @R1" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_17(void) -{ -unsigned char destination = cpu8051_ReadI ( cpu8051_ReadD( BANKPSW + _R1_ ) ); -destination--; -cpu8051_WriteI( cpu8051_ReadD( BANKPSW + _R1_ ), destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "DEC R0" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_18(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R0_ ); -destination--; -cpu8051_WriteD( BANKPSW + _R0_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "DEC R1" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_19(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R1_ ); -destination--; -cpu8051_WriteD( BANKPSW + _R1_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "DEC R2" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_1A(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R2_ ); -destination--; -cpu8051_WriteD( BANKPSW + _R2_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "DEC R3" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_1B(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R3_ ); -destination--; -cpu8051_WriteD( BANKPSW + _R3_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "DEC R4" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_1C(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R4_ ); -destination--; -cpu8051_WriteD( BANKPSW + _R4_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "DEC R5" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_1D(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R5_ ); -destination--; -cpu8051_WriteD( BANKPSW + _R5_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "DEC R6" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_1E(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R6_ ); -destination--; -cpu8051_WriteD( BANKPSW + _R6_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "DEC R7" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_1F(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R7_ ); -destination--; -cpu8051_WriteD( BANKPSW + _R7_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "JB bitaddr,reladdr" takes 2 cycle(s) and 3 byte(s). - ****************************************************************************/ -int -cpu8051_OP_20(void) -{ -unsigned char destination, dstbitaddr = memory_read8( PGM_MEM_ID, cpu8051.pc++ ); -destination = cpu8051_ReadB( dstbitaddr ); -(cpu8051.pc)++; -unsigned int source = ((char) memory_read8(PGM_MEM_ID, cpu8051.pc - 1)) + cpu8051.pc; -if ( destination == 1 ) { cpu8051.pc = source; } -cpu8051_WriteB( dstbitaddr, destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "AJMP addr11" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_21(void) -{ - unsigned int addr11 = ( ( memory_read8( PGM_MEM_ID, cpu8051.pc - 1 ) << 3 ) & 0xF00 ) + memory_read8( PGM_MEM_ID, cpu8051.pc++ ); -cpu8051.pc = ( cpu8051.pc & 0xF800 ) | addr11; -return 2; -} - - -/***************************************************************************** - * Instruction "RET" takes 2 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_22(void) -{ -unsigned char SP = cpu8051_ReadD( _SP_ ); -cpu8051.pc = ( cpu8051_ReadI( SP-- ) << 8 ); -cpu8051.pc += cpu8051_ReadI ( SP-- ); -cpu8051_WriteD( _SP_, SP ); -return 2; -} - - -/***************************************************************************** - * Instruction "RL A" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_23(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -destination = ( destination << 1 ) | ( destination >> 7 ); -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "ADD A,#data" takes 1 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_24(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x3B ) ); -if ( destination + source > 0xFF ) { - cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) ); - if ( ( destination & 0x7F ) + ( source & 0x7F ) < 0x80 ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -} else if ( ( destination & 0x7F ) + ( source & 0x7F ) > 0x7F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -if ( ( destination & 0x0F ) + ( source & 0x0F ) > 0x0F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -destination += source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "ADD A,direct" takes 1 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_25(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char srcaddr = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -unsigned char source = cpu8051_ReadD( srcaddr ); -cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x3B ) ); -if ( destination + source > 0xFF ) { - cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) ); - if ( ( destination & 0x7F ) + ( source & 0x7F ) < 0x80 ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -} else if ( ( destination & 0x7F ) + ( source & 0x7F ) > 0x7F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -if ( ( destination & 0x0F ) + ( source & 0x0F ) > 0x0F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -destination += source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "ADD A,@R0" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_26(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadI ( cpu8051_ReadD( BANKPSW + _R0_ ) ); -cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x3B ) ); -if ( destination + source > 0xFF ) { - cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) ); - if ( ( destination & 0x7F ) + ( source & 0x7F ) < 0x80 ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -} else if ( ( destination & 0x7F ) + ( source & 0x7F ) > 0x7F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -if ( ( destination & 0x0F ) + ( source & 0x0F ) > 0x0F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -destination += source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "ADD A,@R1" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_27(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadI ( cpu8051_ReadD( BANKPSW + _R1_ ) ); -cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x3B ) ); -if ( destination + source > 0xFF ) { - cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) ); - if ( ( destination & 0x7F ) + ( source & 0x7F ) < 0x80 ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -} else if ( ( destination & 0x7F ) + ( source & 0x7F ) > 0x7F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -if ( ( destination & 0x0F ) + ( source & 0x0F ) > 0x0F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -destination += source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "ADD A,R0" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_28(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R0_ ); -cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x3B ) ); -if ( destination + source > 0xFF ) { - cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) ); - if ( ( destination & 0x7F ) + ( source & 0x7F ) < 0x80 ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -} else if ( ( destination & 0x7F ) + ( source & 0x7F ) > 0x7F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -if ( ( destination & 0x0F ) + ( source & 0x0F ) > 0x0F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -destination += source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "ADD A,R1" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_29(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R1_ ); -cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x3B ) ); -if ( destination + source > 0xFF ) { - cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) ); - if ( ( destination & 0x7F ) + ( source & 0x7F ) < 0x80 ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -} else if ( ( destination & 0x7F ) + ( source & 0x7F ) > 0x7F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -if ( ( destination & 0x0F ) + ( source & 0x0F ) > 0x0F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -destination += source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "ADD A,R2" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_2A(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R2_ ); -cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x3B ) ); -if ( destination + source > 0xFF ) { - cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) ); - if ( ( destination & 0x7F ) + ( source & 0x7F ) < 0x80 ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -} else if ( ( destination & 0x7F ) + ( source & 0x7F ) > 0x7F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -if ( ( destination & 0x0F ) + ( source & 0x0F ) > 0x0F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -destination += source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "ADD A,R3" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_2B(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R3_ ); -cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x3B ) ); -if ( destination + source > 0xFF ) { - cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) ); - if ( ( destination & 0x7F ) + ( source & 0x7F ) < 0x80 ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -} else if ( ( destination & 0x7F ) + ( source & 0x7F ) > 0x7F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -if ( ( destination & 0x0F ) + ( source & 0x0F ) > 0x0F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -destination += source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "ADD A,R4" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_2C(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R4_ ); -cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x3B ) ); -if ( destination + source > 0xFF ) { - cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) ); - if ( ( destination & 0x7F ) + ( source & 0x7F ) < 0x80 ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -} else if ( ( destination & 0x7F ) + ( source & 0x7F ) > 0x7F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -if ( ( destination & 0x0F ) + ( source & 0x0F ) > 0x0F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -destination += source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "ADD A,R5" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_2D(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R5_ ); -cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x3B ) ); -if ( destination + source > 0xFF ) { - cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) ); - if ( ( destination & 0x7F ) + ( source & 0x7F ) < 0x80 ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -} else if ( ( destination & 0x7F ) + ( source & 0x7F ) > 0x7F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -if ( ( destination & 0x0F ) + ( source & 0x0F ) > 0x0F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -destination += source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "ADD A,R6" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_2E(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R6_ ); -cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x3B ) ); -if ( destination + source > 0xFF ) { - cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) ); - if ( ( destination & 0x7F ) + ( source & 0x7F ) < 0x80 ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -} else if ( ( destination & 0x7F ) + ( source & 0x7F ) > 0x7F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -if ( ( destination & 0x0F ) + ( source & 0x0F ) > 0x0F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -destination += source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "ADD A,R7" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_2F(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R7_ ); -cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x3B ) ); -if ( destination + source > 0xFF ) { - cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) ); - if ( ( destination & 0x7F ) + ( source & 0x7F ) < 0x80 ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -} else if ( ( destination & 0x7F ) + ( source & 0x7F ) > 0x7F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -if ( ( destination & 0x0F ) + ( source & 0x0F ) > 0x0F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -destination += source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "JNB bitaddr,reladdr" takes 2 cycle(s) and 3 byte(s). - ****************************************************************************/ -int -cpu8051_OP_30(void) -{ -unsigned char destination, dstbitaddr = memory_read8( PGM_MEM_ID, cpu8051.pc++ ); -destination = cpu8051_ReadB( dstbitaddr ); -(cpu8051.pc)++; -unsigned int source = ((char) memory_read8(PGM_MEM_ID, cpu8051.pc - 1)) + cpu8051.pc; -if ( destination == 0 ) { cpu8051.pc = source; } -cpu8051_WriteB( dstbitaddr, destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "ACALL addr11" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_31(void) -{ - unsigned int addr11 = ( ( memory_read8( PGM_MEM_ID, cpu8051.pc - 1 ) << 3 ) & 0xF00 ) + memory_read8( PGM_MEM_ID, cpu8051.pc++ ); -unsigned char SP = cpu8051_ReadD( _SP_ ); -cpu8051_WriteI( ++SP, ( cpu8051.pc & 0x00FF ) ); -cpu8051_WriteI( ++SP, ( cpu8051.pc >> 8 ) ); -cpu8051_WriteD( _SP_, SP ); -cpu8051.pc = ( cpu8051.pc & 0xF800 ) | addr11; -return 2; -} - - -/***************************************************************************** - * Instruction "RETI" takes 2 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_32(void) -{ -cpu8051.active_priority = -1; -unsigned char SP = cpu8051_ReadD( _SP_ ); -cpu8051.pc = ( cpu8051_ReadI( SP-- ) << 8 ); -cpu8051.pc += cpu8051_ReadI( SP-- ); -return 2; -} - - -/***************************************************************************** - * Instruction "RLC A" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_33(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char tmpval = destination; -destination = ( destination << 1 ) | ( ( cpu8051_ReadD( _PSW_ ) & 0x80 ) >> 7 ); -cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x7F ) | ( tmpval & 0x80 ) ); -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "ADDC A,#data" takes 1 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_34(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -unsigned char carryflag = ( cpu8051_ReadD( _PSW_ ) >> 7 ); -cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x3B ) ); -if ( destination + source + carryflag > 0xFF ) { - cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) ); - if ( ( destination & 0x7F ) + ( source & 0x7F ) + carryflag < 0x80 ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -} else if ( ( destination & 0x7F ) + ( source & 0x7F ) + carryflag > 0x7F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -if ( ( destination & 0x0F ) + ( source & 0x0F ) + carryflag > 0x0F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x40 ) ); -destination += source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "ADDC A,direct" takes 1 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_35(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char srcaddr = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -unsigned char source = cpu8051_ReadD( srcaddr ); -unsigned char carryflag = ( cpu8051_ReadD( _PSW_ ) >> 7 ); -cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x3B ) ); -if ( destination + source + carryflag > 0xFF ) { - cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) ); - if ( ( destination & 0x7F ) + ( source & 0x7F ) + carryflag < 0x80 ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -} else if ( ( destination & 0x7F ) + ( source & 0x7F ) + carryflag > 0x7F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -if ( ( destination & 0x0F ) + ( source & 0x0F ) + carryflag > 0x0F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x40 ) ); -destination += source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "ADDC A,@R0" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_36(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadI ( cpu8051_ReadD( BANKPSW + _R0_ ) ); -unsigned char carryflag = ( cpu8051_ReadD( _PSW_ ) >> 7 ); -cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x3B ) ); -if ( destination + source + carryflag > 0xFF ) { - cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) ); - if ( ( destination & 0x7F ) + ( source & 0x7F ) + carryflag < 0x80 ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -} else if ( ( destination & 0x7F ) + ( source & 0x7F ) + carryflag > 0x7F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -if ( ( destination & 0x0F ) + ( source & 0x0F ) + carryflag > 0x0F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x40 ) ); -destination += source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "ADDC A,@R1" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_37(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadI ( cpu8051_ReadD( BANKPSW + _R1_ ) ); -unsigned char carryflag = ( cpu8051_ReadD( _PSW_ ) >> 7 ); -cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x3B ) ); -if ( destination + source + carryflag > 0xFF ) { - cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) ); - if ( ( destination & 0x7F ) + ( source & 0x7F ) + carryflag < 0x80 ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -} else if ( ( destination & 0x7F ) + ( source & 0x7F ) + carryflag > 0x7F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -if ( ( destination & 0x0F ) + ( source & 0x0F ) + carryflag > 0x0F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x40 ) ); -destination += source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "ADDC A,R0" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_38(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R0_ ); -unsigned char carryflag = ( cpu8051_ReadD( _PSW_ ) >> 7 ); -cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x3B ) ); -if ( destination + source + carryflag > 0xFF ) { - cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) ); - if ( ( destination & 0x7F ) + ( source & 0x7F ) + carryflag < 0x80 ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -} else if ( ( destination & 0x7F ) + ( source & 0x7F ) + carryflag > 0x7F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -if ( ( destination & 0x0F ) + ( source & 0x0F ) + carryflag > 0x0F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x40 ) ); -destination += source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "ADDC A,R1" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_39(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R1_ ); -unsigned char carryflag = ( cpu8051_ReadD( _PSW_ ) >> 7 ); -cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x3B ) ); -if ( destination + source + carryflag > 0xFF ) { - cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) ); - if ( ( destination & 0x7F ) + ( source & 0x7F ) + carryflag < 0x80 ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -} else if ( ( destination & 0x7F ) + ( source & 0x7F ) + carryflag > 0x7F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -if ( ( destination & 0x0F ) + ( source & 0x0F ) + carryflag > 0x0F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x40 ) ); -destination += source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "ADDC A,R2" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_3A(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R2_ ); -unsigned char carryflag = ( cpu8051_ReadD( _PSW_ ) >> 7 ); -cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x3B ) ); -if ( destination + source + carryflag > 0xFF ) { - cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) ); - if ( ( destination & 0x7F ) + ( source & 0x7F ) + carryflag < 0x80 ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -} else if ( ( destination & 0x7F ) + ( source & 0x7F ) + carryflag > 0x7F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -if ( ( destination & 0x0F ) + ( source & 0x0F ) + carryflag > 0x0F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x40 ) ); -destination += source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "ADDC A,R3" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_3B(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R3_ ); -unsigned char carryflag = ( cpu8051_ReadD( _PSW_ ) >> 7 ); -cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x3B ) ); -if ( destination + source + carryflag > 0xFF ) { - cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) ); - if ( ( destination & 0x7F ) + ( source & 0x7F ) + carryflag < 0x80 ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -} else if ( ( destination & 0x7F ) + ( source & 0x7F ) + carryflag > 0x7F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -if ( ( destination & 0x0F ) + ( source & 0x0F ) + carryflag > 0x0F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x40 ) ); -destination += source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "ADDC A,R4" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_3C(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R4_ ); -unsigned char carryflag = ( cpu8051_ReadD( _PSW_ ) >> 7 ); -cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x3B ) ); -if ( destination + source + carryflag > 0xFF ) { - cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) ); - if ( ( destination & 0x7F ) + ( source & 0x7F ) + carryflag < 0x80 ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -} else if ( ( destination & 0x7F ) + ( source & 0x7F ) + carryflag > 0x7F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -if ( ( destination & 0x0F ) + ( source & 0x0F ) + carryflag > 0x0F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x40 ) ); -destination += source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "ADDC A,R5" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_3D(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R5_ ); -unsigned char carryflag = ( cpu8051_ReadD( _PSW_ ) >> 7 ); -cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x3B ) ); -if ( destination + source + carryflag > 0xFF ) { - cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) ); - if ( ( destination & 0x7F ) + ( source & 0x7F ) + carryflag < 0x80 ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -} else if ( ( destination & 0x7F ) + ( source & 0x7F ) + carryflag > 0x7F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -if ( ( destination & 0x0F ) + ( source & 0x0F ) + carryflag > 0x0F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x40 ) ); -destination += source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "ADDC A,R6" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_3E(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R6_ ); -unsigned char carryflag = ( cpu8051_ReadD( _PSW_ ) >> 7 ); -cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x3B ) ); -if ( destination + source + carryflag > 0xFF ) { - cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) ); - if ( ( destination & 0x7F ) + ( source & 0x7F ) + carryflag < 0x80 ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -} else if ( ( destination & 0x7F ) + ( source & 0x7F ) + carryflag > 0x7F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -if ( ( destination & 0x0F ) + ( source & 0x0F ) + carryflag > 0x0F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x40 ) ); -destination += source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "ADDC A,R7" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_3F(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R7_ ); -unsigned char carryflag = ( cpu8051_ReadD( _PSW_ ) >> 7 ); -cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x3B ) ); -if ( destination + source + carryflag > 0xFF ) { - cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) ); - if ( ( destination & 0x7F ) + ( source & 0x7F ) + carryflag < 0x80 ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -} else if ( ( destination & 0x7F ) + ( source & 0x7F ) + carryflag > 0x7F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -if ( ( destination & 0x0F ) + ( source & 0x0F ) + carryflag > 0x0F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x40 ) ); -destination += source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "JC reladdr" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_40(void) -{ -cpu8051.pc++; -unsigned int destination = ((char) memory_read8(PGM_MEM_ID, cpu8051.pc - 1)) + cpu8051.pc; -if ( cpu8051_ReadD( _PSW_ ) > 0x7F) { cpu8051.pc = destination; } -return 2; -} - - -/***************************************************************************** - * Instruction "AJMP addr11" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_41(void) -{ - unsigned int addr11 = ( ( memory_read8( PGM_MEM_ID, cpu8051.pc - 1 ) << 3 ) & 0xF00 ) + memory_read8( PGM_MEM_ID, cpu8051.pc++ ); -cpu8051.pc = ( cpu8051.pc & 0xF800 ) | addr11; -return 2; -} - - -/***************************************************************************** - * Instruction "ORL direct,A" takes 1 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_42(void) -{ -unsigned char destaddr = memory_read8( PGM_MEM_ID, cpu8051.pc++ ); -unsigned char destination = cpu8051_ReadD( destaddr ); -unsigned char source = cpu8051_ReadD( _ACC_ ); -destination |= source; -cpu8051_WriteD( destaddr, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "ORL direct,#data" takes 2 cycle(s) and 3 byte(s). - ****************************************************************************/ -int -cpu8051_OP_43(void) -{ -unsigned char destaddr = memory_read8( PGM_MEM_ID, cpu8051.pc++ ); -unsigned char destination = cpu8051_ReadD( destaddr ); -unsigned char source = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -destination |= source; -cpu8051_WriteD( destaddr, destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "ORL A,#data" takes 1 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_44(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -destination |= source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "ORL A,direct" takes 1 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_45(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char srcaddr = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -unsigned char source = cpu8051_ReadD( srcaddr ); -destination |= source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "ORL A,@R0" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_46(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadI ( cpu8051_ReadD( BANKPSW + _R0_ ) ); -destination |= source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "ORL A,@R1" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_47(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadI ( cpu8051_ReadD( BANKPSW + _R1_ ) ); -destination |= source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "ORL A,R0" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_48(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R0_ ); -destination |= source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "ORL A,R1" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_49(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R1_ ); -destination |= source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "ORL A,R2" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_4A(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R2_ ); -destination |= source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "ORL A,R3" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_4B(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R3_ ); -destination |= source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "ORL A,R4" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_4C(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R4_ ); -destination |= source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "ORL A,R5" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_4D(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R5_ ); -destination |= source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "ORL A,R6" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_4E(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R6_ ); -destination |= source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "ORL A,R7" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_4F(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R7_ ); -destination |= source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "JNC reladdr" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_50(void) -{ -cpu8051.pc++; -unsigned int destination = ((char) memory_read8(PGM_MEM_ID, cpu8051.pc - 1)) + cpu8051.pc; -if ( cpu8051_ReadD( _PSW_ ) < 0x80 ) { cpu8051.pc = destination; } -return 2; -} - - -/***************************************************************************** - * Instruction "ACALL addr11" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_51(void) -{ - unsigned int addr11 = ( ( memory_read8( PGM_MEM_ID, cpu8051.pc - 1 ) << 3 ) & 0xF00 ) + memory_read8( PGM_MEM_ID, cpu8051.pc++ ); -unsigned char SP = cpu8051_ReadD( _SP_ ); -cpu8051_WriteI( ++SP, ( cpu8051.pc & 0x00FF ) ); -cpu8051_WriteI( ++SP, ( cpu8051.pc >> 8 ) ); -cpu8051_WriteD( _SP_, SP ); -cpu8051.pc = ( cpu8051.pc & 0xF800 ) | addr11; -return 2; -} - - -/***************************************************************************** - * Instruction "ANL direct,A" takes 1 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_52(void) -{ -unsigned char destaddr = memory_read8( PGM_MEM_ID, cpu8051.pc++ ); -unsigned char destination = cpu8051_ReadD( destaddr ); -unsigned char source = cpu8051_ReadD( _ACC_ ); -destination &= source; -cpu8051_WriteD( destaddr, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "ANL direct,#data" takes 2 cycle(s) and 3 byte(s). - ****************************************************************************/ -int -cpu8051_OP_53(void) -{ -unsigned char destaddr = memory_read8( PGM_MEM_ID, cpu8051.pc++ ); -unsigned char destination = cpu8051_ReadD( destaddr ); -unsigned char source = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -destination &= source; -cpu8051_WriteD( destaddr, destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "ANL A,#data" takes 1 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_54(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -destination &= source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "ANL A,direct" takes 1 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_55(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char srcaddr = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -unsigned char source = cpu8051_ReadD( srcaddr ); -destination &= source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "ANL A,@R0" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_56(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadI ( cpu8051_ReadD( BANKPSW + _R0_ ) ); -destination &= source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "ANL A,@R1" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_57(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadI ( cpu8051_ReadD( BANKPSW + _R1_ ) ); -destination &= source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "ANL A,R0" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_58(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R0_ ); -destination &= source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "ANL A,R1" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_59(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R1_ ); -destination &= source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "ANL A,R2" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_5A(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R2_ ); -destination &= source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "ANL A,R3" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_5B(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R3_ ); -destination &= source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "ANL A,R4" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_5C(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R4_ ); -destination &= source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "ANL A,R5" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_5D(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R5_ ); -destination &= source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "ANL A,R6" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_5E(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R6_ ); -destination &= source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "ANL A,R7" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_5F(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R7_ ); -destination &= source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "JZ reladdr" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_60(void) -{ -cpu8051.pc++; -unsigned int destination = ((char) memory_read8(PGM_MEM_ID, cpu8051.pc - 1)) + cpu8051.pc; -if ( cpu8051_ReadD( _ACC_ ) == 0 ) { cpu8051.pc = destination; } -return 2; -} - - -/***************************************************************************** - * Instruction "AJMP addr11" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_61(void) -{ - unsigned int addr11 = ( ( memory_read8( PGM_MEM_ID, cpu8051.pc - 1 ) << 3 ) & 0xF00 ) + memory_read8( PGM_MEM_ID, cpu8051.pc++ ); -cpu8051.pc = ( cpu8051.pc & 0xF800 ) | addr11; -return 2; -} - - -/***************************************************************************** - * Instruction "XRL direct,A" takes 1 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_62(void) -{ -unsigned char destaddr = memory_read8( PGM_MEM_ID, cpu8051.pc++ ); -unsigned char destination = cpu8051_ReadD( destaddr ); -unsigned char source = cpu8051_ReadD( _ACC_ ); -destination ^= source; -cpu8051_WriteD( destaddr, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "XRL direct,#data" takes 2 cycle(s) and 3 byte(s). - ****************************************************************************/ -int -cpu8051_OP_63(void) -{ -unsigned char destaddr = memory_read8( PGM_MEM_ID, cpu8051.pc++ ); -unsigned char destination = cpu8051_ReadD( destaddr ); -unsigned char source = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -destination ^= source; -cpu8051_WriteD( destaddr, destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "XRL A,#data" takes 1 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_64(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -destination ^= source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "XRL A,direct" takes 1 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_65(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char srcaddr = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -unsigned char source = cpu8051_ReadD( srcaddr ); -destination ^= source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "XRL A,@R0" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_66(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadI ( cpu8051_ReadD( BANKPSW + _R0_ ) ); -destination ^= source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "XRL A,@R1" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_67(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadI ( cpu8051_ReadD( BANKPSW + _R1_ ) ); -destination ^= source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "XRL A,R0" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_68(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R0_ ); -destination ^= source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "XRL A,R1" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_69(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R1_ ); -destination ^= source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "XRL A,R2" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_6A(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R2_ ); -destination ^= source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "XRL A,R3" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_6B(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R3_ ); -destination ^= source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "XRL A,R4" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_6C(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R4_ ); -destination ^= source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "XRL A,R5" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_6D(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R5_ ); -destination ^= source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "XRL A,R6" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_6E(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R6_ ); -destination ^= source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "XRL A,R7" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_6F(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R7_ ); -destination ^= source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "JNZ reladdr" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_70(void) -{ -cpu8051.pc++; -unsigned int destination = ((char) memory_read8(PGM_MEM_ID, cpu8051.pc - 1)) + cpu8051.pc; -if ( cpu8051_ReadD( _ACC_ ) != 0 ) { cpu8051.pc = destination; } -return 2; -} - - -/***************************************************************************** - * Instruction "ACALL addr11" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_71(void) -{ - unsigned int addr11 = ( ( memory_read8( PGM_MEM_ID, cpu8051.pc - 1 ) << 3 ) & 0xF00 ) + memory_read8( PGM_MEM_ID, cpu8051.pc++ ); -unsigned char SP = cpu8051_ReadD( _SP_ ); -cpu8051_WriteI( ++SP, ( cpu8051.pc & 0x00FF ) ); -cpu8051_WriteI( ++SP, ( cpu8051.pc >> 8 ) ); -cpu8051_WriteD( _SP_, SP ); -cpu8051.pc = ( cpu8051.pc & 0xF800 ) | addr11; -return 2; -} - - -/***************************************************************************** - * Instruction "ORL C,bitaddr" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_72(void) -{ -unsigned char destination = ( cpu8051_ReadD( _PSW_ ) >> 7 ); -unsigned char source, srcbitaddr = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -source = cpu8051_ReadB( srcbitaddr ); -cpu8051_WriteD( _PSW_ , ( ( destination | source ) << 7 ) ); -cpu8051_WriteD( _PSW_, ( ( cpu8051_ReadD( _PSW_ ) & 0x7F) | ( destination << 7 ) ) ); -return 2; -} - - -/***************************************************************************** - * Instruction "JMP @A+DPTR" takes 2 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_73(void) -{ -unsigned int destination = cpu8051_ReadI( cpu8051_ReadD( _ACC_ ) + cpu8051_ReadD( _DPTRLOW_ ) + ( cpu8051_ReadD( _DPTRHIGH_ ) << 8 ) ); -cpu8051.pc = destination; -return 2; -} - - -/***************************************************************************** - * Instruction "MOV A,#data" takes 1 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_74(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -destination = source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "MOV direct,#data" takes 2 cycle(s) and 3 byte(s). - ****************************************************************************/ -int -cpu8051_OP_75(void) -{ -unsigned char destaddr = memory_read8( PGM_MEM_ID, cpu8051.pc++ ); -unsigned char destination = cpu8051_ReadD( destaddr ); -unsigned char source = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -destination = source; -cpu8051_WriteD( destaddr, destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "MOV @R0,#data" takes 1 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_76(void) -{ -unsigned char destination = cpu8051_ReadI ( cpu8051_ReadD( BANKPSW + _R0_ ) ); -unsigned char source = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -destination = source; -cpu8051_WriteI( cpu8051_ReadD( BANKPSW + _R0_ ), destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "MOV @R1,#data" takes 1 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_77(void) -{ -unsigned char destination = cpu8051_ReadI ( cpu8051_ReadD( BANKPSW + _R1_ ) ); -unsigned char source = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -destination = source; -cpu8051_WriteI( cpu8051_ReadD( BANKPSW + _R1_ ), destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "MOV R0,#data" takes 1 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_78(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R0_ ); -unsigned char source = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -destination = source; -cpu8051_WriteD( BANKPSW + _R0_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "MOV R1,#data" takes 1 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_79(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R1_ ); -unsigned char source = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -destination = source; -cpu8051_WriteD( BANKPSW + _R1_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "MOV R2,#data" takes 1 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_7A(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R2_ ); -unsigned char source = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -destination = source; -cpu8051_WriteD( BANKPSW + _R2_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "MOV R3,#data" takes 1 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_7B(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R3_ ); -unsigned char source = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -destination = source; -cpu8051_WriteD( BANKPSW + _R3_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "MOV R4,#data" takes 1 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_7C(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R4_ ); -unsigned char source = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -destination = source; -cpu8051_WriteD( BANKPSW + _R4_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "MOV R5,#data" takes 1 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_7D(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R5_ ); -unsigned char source = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -destination = source; -cpu8051_WriteD( BANKPSW + _R5_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "MOV R6,#data" takes 1 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_7E(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R6_ ); -unsigned char source = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -destination = source; -cpu8051_WriteD( BANKPSW + _R6_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "MOV R7,#data" takes 1 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_7F(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R7_ ); -unsigned char source = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -destination = source; -cpu8051_WriteD( BANKPSW + _R7_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "SJMP reladdr" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_80(void) -{ -cpu8051.pc++; -unsigned int destination = ((char) memory_read8(PGM_MEM_ID, cpu8051.pc - 1)) + cpu8051.pc; -cpu8051.pc = destination; -return 2; -} - - -/***************************************************************************** - * Instruction "AJMP addr11" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_81(void) -{ - unsigned int addr11 = ( ( memory_read8( PGM_MEM_ID, cpu8051.pc - 1 ) << 3 ) & 0xF00 ) + memory_read8( PGM_MEM_ID, cpu8051.pc++ ); -cpu8051.pc = ( cpu8051.pc & 0xF800 ) | addr11; -return 2; -} - - -/***************************************************************************** - * Instruction "ANL C,bitaddr" takes 1 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_82(void) -{ -unsigned char destination = ( cpu8051_ReadD( _PSW_ ) >> 7 ); -unsigned char source, srcbitaddr = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -source = cpu8051_ReadB( srcbitaddr ); -cpu8051_WriteD( _PSW_, ( ( destination & source) << 7 ) ); -cpu8051_WriteD( _PSW_, ( ( cpu8051_ReadD( _PSW_ ) & 0x7F) | ( destination << 7 ) ) ); -return 1; -} - - -/***************************************************************************** - * Instruction "MOVC A,@A+PC" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_83(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = memory_read8( PGM_MEM_ID, cpu8051_ReadD( _ACC_ ) + ( ++cpu8051.pc ) ); -destination = source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "DIV AB" takes 4 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_84(void) -{ -unsigned char A = cpu8051_ReadD( _ACC_ ), B = cpu8051_ReadD( _B_ ); -cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x7B ) ); -if ( B != 0 ) { -cpu8051_WriteD( _ACC_, A/B ); cpu8051_WriteD( _B_, A%B ); -} else cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -return 4; -} - - -/***************************************************************************** - * Instruction "MOV direct,direct" takes 1 cycle(s) and 3 byte(s). - ****************************************************************************/ -int -cpu8051_OP_85(void) -{ - unsigned char srcaddr = memory_read8( PGM_MEM_ID, cpu8051.pc++ ); - unsigned char source = cpu8051_ReadD( srcaddr ); - unsigned char destaddr = memory_read8( PGM_MEM_ID, cpu8051.pc++ ); - unsigned char destination = cpu8051_ReadD( destaddr ); - destination = source; - cpu8051_WriteD( destaddr, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "MOV direct,@R0" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_86(void) -{ -unsigned char destaddr = memory_read8( PGM_MEM_ID, cpu8051.pc++ ); -unsigned char destination = cpu8051_ReadD( destaddr ); -unsigned char source = cpu8051_ReadI ( cpu8051_ReadD( BANKPSW + _R0_ ) ); -destination = source; -cpu8051_WriteD( destaddr, destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "MOV direct,@R1" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_87(void) -{ -unsigned char destaddr = memory_read8( PGM_MEM_ID, cpu8051.pc++ ); -unsigned char destination = cpu8051_ReadD( destaddr ); -unsigned char source = cpu8051_ReadI ( cpu8051_ReadD( BANKPSW + _R1_ ) ); -destination = source; -cpu8051_WriteD( destaddr, destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "MOV direct,R0" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_88(void) -{ -unsigned char destaddr = memory_read8( PGM_MEM_ID, cpu8051.pc++ ); -unsigned char destination = cpu8051_ReadD( destaddr ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R0_ ); -destination = source; -cpu8051_WriteD( destaddr, destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "MOV direct,R1" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_89(void) -{ -unsigned char destaddr = memory_read8( PGM_MEM_ID, cpu8051.pc++ ); -unsigned char destination = cpu8051_ReadD( destaddr ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R1_ ); -destination = source; -cpu8051_WriteD( destaddr, destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "MOV direct,R2" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_8A(void) -{ -unsigned char destaddr = memory_read8( PGM_MEM_ID, cpu8051.pc++ ); -unsigned char destination = cpu8051_ReadD( destaddr ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R2_ ); -destination = source; -cpu8051_WriteD( destaddr, destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "MOV direct,R3" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_8B(void) -{ -unsigned char destaddr = memory_read8( PGM_MEM_ID, cpu8051.pc++ ); -unsigned char destination = cpu8051_ReadD( destaddr ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R3_ ); -destination = source; -cpu8051_WriteD( destaddr, destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "MOV direct,R4" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_8C(void) -{ -unsigned char destaddr = memory_read8( PGM_MEM_ID, cpu8051.pc++ ); -unsigned char destination = cpu8051_ReadD( destaddr ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R4_ ); -destination = source; -cpu8051_WriteD( destaddr, destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "MOV direct,R5" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_8D(void) -{ -unsigned char destaddr = memory_read8( PGM_MEM_ID, cpu8051.pc++ ); -unsigned char destination = cpu8051_ReadD( destaddr ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R5_ ); -destination = source; -cpu8051_WriteD( destaddr, destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "MOV direct,R6" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_8E(void) -{ -unsigned char destaddr = memory_read8( PGM_MEM_ID, cpu8051.pc++ ); -unsigned char destination = cpu8051_ReadD( destaddr ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R6_ ); -destination = source; -cpu8051_WriteD( destaddr, destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "MOV direct,R7" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_8F(void) -{ -unsigned char destaddr = memory_read8( PGM_MEM_ID, cpu8051.pc++ ); -unsigned char destination = cpu8051_ReadD( destaddr ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R7_ ); -destination = source; -cpu8051_WriteD( destaddr, destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "MOV DPTR,#data16" takes 2 cycle(s) and 3 byte(s). - ****************************************************************************/ -int -cpu8051_OP_90(void) -{ -unsigned int destination = ( cpu8051_ReadD( _DPTRHIGH_ ) << 8 ) + cpu8051_ReadD( _DPTRLOW_ ); -unsigned char source = ( memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ) << 8 ); -source += memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -destination = source; -cpu8051_WriteD( _DPTRHIGH_, ( destination >> 8 ) ); -cpu8051_WriteD( _DPTRLOW_, ( destination & 0xFF ) ); -return 2; -} - - -/***************************************************************************** - * Instruction "ACALL addr11" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_91(void) -{ - unsigned int addr11 = ( ( memory_read8( PGM_MEM_ID, cpu8051.pc - 1 ) << 3 ) & 0xF00 ) + memory_read8( PGM_MEM_ID, cpu8051.pc++ ); -unsigned char SP = cpu8051_ReadD( _SP_ ); -cpu8051_WriteI( ++SP, ( cpu8051.pc & 0x00FF ) ); -cpu8051_WriteI( ++SP, ( cpu8051.pc >> 8 ) ); -cpu8051_WriteD( _SP_, SP ); -cpu8051.pc = ( cpu8051.pc & 0xF800 ) | addr11; -return 2; -} - - -/***************************************************************************** - * Instruction "MOV bitaddr,C" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_92(void) -{ -unsigned char destination, dstbitaddr = memory_read8( PGM_MEM_ID, cpu8051.pc++ ); -destination = cpu8051_ReadB( dstbitaddr ); -unsigned char source = ( cpu8051_ReadD( _PSW_ ) >> 7 ); -destination = source; -cpu8051_WriteB( dstbitaddr, destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "MOVC A,@A+DPTR" takes 2 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_93(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = memory_read8( PGM_MEM_ID, cpu8051_ReadD( _ACC_ ) + cpu8051_ReadD( _DPTRLOW_ ) + ( cpu8051_ReadD( _DPTRHIGH_ ) << 8 ) ); -destination = source; -cpu8051_WriteD( _ACC_, destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "SUBB A,#data" takes 1 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_94(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -unsigned char carryflag = cpu8051_ReadD( _PSW_ ) >> 7; -cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x3B ) ); -if ( destination < ( source + carryflag ) ) { - cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) ); - if ( ( destination & 0x7F ) > ( ( source + carryflag ) & 0x7F ) ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -} else if ( ( destination & 0x7F ) < ( ( source + carryflag ) & 0x7F ) ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -if ( ( destination & 0x0F ) < ( ( source + carryflag ) & 0x0F ) ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x40 ) ); -destination -= source + carryflag; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "SUBB A,direct" takes 1 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_95(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char srcaddr = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -unsigned char source = cpu8051_ReadD( srcaddr ); -unsigned char carryflag = cpu8051_ReadD( _PSW_ ) >> 7; -cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x3B ) ); -if ( destination < ( source + carryflag ) ) { - cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) ); - if ( ( destination & 0x7F ) > ( ( source + carryflag ) & 0x7F ) ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -} else if ( ( destination & 0x7F ) < ( ( source + carryflag ) & 0x7F ) ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -if ( ( destination & 0x0F ) < ( ( source + carryflag ) & 0x0F ) ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x40 ) ); -destination -= source + carryflag; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "SUBB A,@R0" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_96(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadI ( cpu8051_ReadD( BANKPSW + _R0_ ) ); -unsigned char carryflag = cpu8051_ReadD( _PSW_ ) >> 7; -cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x3B ) ); -if ( destination < ( source + carryflag ) ) { - cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) ); - if ( ( destination & 0x7F ) > ( ( source + carryflag ) & 0x7F ) ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -} else if ( ( destination & 0x7F ) < ( ( source + carryflag ) & 0x7F ) ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -if ( ( destination & 0x0F ) < ( ( source + carryflag ) & 0x0F ) ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x40 ) ); -destination -= source + carryflag; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "SUBB A,@R1" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_97(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadI ( cpu8051_ReadD( BANKPSW + _R1_ ) ); -unsigned char carryflag = cpu8051_ReadD( _PSW_ ) >> 7; -cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x3B ) ); -if ( destination < ( source + carryflag ) ) { - cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) ); - if ( ( destination & 0x7F ) > ( ( source + carryflag ) & 0x7F ) ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -} else if ( ( destination & 0x7F ) < ( ( source + carryflag ) & 0x7F ) ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -if ( ( destination & 0x0F ) < ( ( source + carryflag ) & 0x0F ) ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x40 ) ); -destination -= source + carryflag; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "SUBB A,R0" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_98(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R0_ ); -unsigned char carryflag = cpu8051_ReadD( _PSW_ ) >> 7; -cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x3B ) ); -if ( destination < ( source + carryflag ) ) { - cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) ); - if ( ( destination & 0x7F ) > ( ( source + carryflag ) & 0x7F ) ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -} else if ( ( destination & 0x7F ) < ( ( source + carryflag ) & 0x7F ) ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -if ( ( destination & 0x0F ) < ( ( source + carryflag ) & 0x0F ) ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x40 ) ); -destination -= source + carryflag; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "SUBB A,R1" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_99(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R1_ ); -unsigned char carryflag = cpu8051_ReadD( _PSW_ ) >> 7; -cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x3B ) ); -if ( destination < ( source + carryflag ) ) { - cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) ); - if ( ( destination & 0x7F ) > ( ( source + carryflag ) & 0x7F ) ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -} else if ( ( destination & 0x7F ) < ( ( source + carryflag ) & 0x7F ) ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -if ( ( destination & 0x0F ) < ( ( source + carryflag ) & 0x0F ) ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x40 ) ); -destination -= source + carryflag; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "SUBB A,R2" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_9A(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R2_ ); -unsigned char carryflag = cpu8051_ReadD( _PSW_ ) >> 7; -cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x3B ) ); -if ( destination < ( source + carryflag ) ) { - cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) ); - if ( ( destination & 0x7F ) > ( ( source + carryflag ) & 0x7F ) ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -} else if ( ( destination & 0x7F ) < ( ( source + carryflag ) & 0x7F ) ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -if ( ( destination & 0x0F ) < ( ( source + carryflag ) & 0x0F ) ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x40 ) ); -destination -= source + carryflag; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "SUBB A,R3" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_9B(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R3_ ); -unsigned char carryflag = cpu8051_ReadD( _PSW_ ) >> 7; -cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x3B ) ); -if ( destination < ( source + carryflag ) ) { - cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) ); - if ( ( destination & 0x7F ) > ( ( source + carryflag ) & 0x7F ) ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -} else if ( ( destination & 0x7F ) < ( ( source + carryflag ) & 0x7F ) ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -if ( ( destination & 0x0F ) < ( ( source + carryflag ) & 0x0F ) ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x40 ) ); -destination -= source + carryflag; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "SUBB A,R4" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_9C(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R4_ ); -unsigned char carryflag = cpu8051_ReadD( _PSW_ ) >> 7; -cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x3B ) ); -if ( destination < ( source + carryflag ) ) { - cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) ); - if ( ( destination & 0x7F ) > ( ( source + carryflag ) & 0x7F ) ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -} else if ( ( destination & 0x7F ) < ( ( source + carryflag ) & 0x7F ) ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -if ( ( destination & 0x0F ) < ( ( source + carryflag ) & 0x0F ) ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x40 ) ); -destination -= source + carryflag; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "SUBB A,R5" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_9D(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R5_ ); -unsigned char carryflag = cpu8051_ReadD( _PSW_ ) >> 7; -cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x3B ) ); -if ( destination < ( source + carryflag ) ) { - cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) ); - if ( ( destination & 0x7F ) > ( ( source + carryflag ) & 0x7F ) ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -} else if ( ( destination & 0x7F ) < ( ( source + carryflag ) & 0x7F ) ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -if ( ( destination & 0x0F ) < ( ( source + carryflag ) & 0x0F ) ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x40 ) ); -destination -= source + carryflag; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "SUBB A,R6" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_9E(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R6_ ); -unsigned char carryflag = cpu8051_ReadD( _PSW_ ) >> 7; -cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x3B ) ); -if ( destination < ( source + carryflag ) ) { - cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) ); - if ( ( destination & 0x7F ) > ( ( source + carryflag ) & 0x7F ) ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -} else if ( ( destination & 0x7F ) < ( ( source + carryflag ) & 0x7F ) ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -if ( ( destination & 0x0F ) < ( ( source + carryflag ) & 0x0F ) ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x40 ) ); -destination -= source + carryflag; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "SUBB A,R7" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_9F(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R7_ ); -unsigned char carryflag = cpu8051_ReadD( _PSW_ ) >> 7; -cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x3B ) ); -if ( destination < ( source + carryflag ) ) { - cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) ); - if ( ( destination & 0x7F ) > ( ( source + carryflag ) & 0x7F ) ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -} else if ( ( destination & 0x7F ) < ( ( source + carryflag ) & 0x7F ) ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -if ( ( destination & 0x0F ) < ( ( source + carryflag ) & 0x0F ) ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x40 ) ); -destination -= source + carryflag; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "ORL C,/bitaddr" takes 1 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_A0(void) -{ -unsigned char destination = ( cpu8051_ReadD( _PSW_ ) >> 7 ); -unsigned char source, srcbitaddr = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -source = ( cpu8051_ReadB( srcbitaddr ) ^ 1 ); -cpu8051_WriteD( _PSW_ , ( ( destination | source ) << 7 ) ); -cpu8051_WriteD( _PSW_, ( ( cpu8051_ReadD( _PSW_ ) & 0x7F) | ( destination << 7 ) ) ); -return 1; -} - - -/***************************************************************************** - * Instruction "AJMP addr11" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_A1(void) -{ - unsigned int addr11 = ( ( memory_read8( PGM_MEM_ID, cpu8051.pc - 1 ) << 3 ) & 0xF00 ) + memory_read8( PGM_MEM_ID, cpu8051.pc++ ); -cpu8051.pc = ( cpu8051.pc & 0xF800 ) | addr11; -return 2; -} - - -/***************************************************************************** - * Instruction "MOV C,bitaddr" takes 1 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_A2(void) -{ -unsigned char destination = ( cpu8051_ReadD( _PSW_ ) >> 7 ); -unsigned char source, srcbitaddr = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -source = cpu8051_ReadB( srcbitaddr ); -destination = source; -cpu8051_WriteD( _PSW_, ( ( cpu8051_ReadD( _PSW_ ) & 0x7F) | ( destination << 7 ) ) ); -return 1; -} - - -/***************************************************************************** - * Instruction "INC DPTR" takes 2 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_A3(void) -{ -unsigned int destination = ( cpu8051_ReadD( _DPTRHIGH_ ) << 8 ) + cpu8051_ReadD( _DPTRLOW_ ); -destination++; -cpu8051_WriteD( _DPTRHIGH_, ( destination >> 8 ) ); -cpu8051_WriteD( _DPTRLOW_, ( destination & 0xFF ) ); -return 2; -} - - -/***************************************************************************** - * Instruction "MUL AB" takes 4 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_A4(void) -{ -unsigned char A = cpu8051_ReadD( _ACC_ ), B = cpu8051_ReadD( _B_ ); -cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x7B ) ); -cpu8051_WriteD( _ACC_ , ( ( A * B ) & 0x00FF ) ); cpu8051_WriteD( _B_, ( A * B ) / 0x100 ); -if ( cpu8051_ReadD( _B_ ) > 0) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) ); -return 4; -} - - -/***************************************************************************** - * Instruction "INVALID" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_A5(void) -{ -return 1; -} - - -/***************************************************************************** - * Instruction "MOV @R0,direct" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_A6(void) -{ -unsigned char destination = cpu8051_ReadI ( cpu8051_ReadD( BANKPSW + _R0_ ) ); -unsigned char srcaddr = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -unsigned char source = cpu8051_ReadD( srcaddr ); -destination = source; -cpu8051_WriteI( cpu8051_ReadD( BANKPSW + _R0_ ), destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "MOV @R1,direct" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_A7(void) -{ -unsigned char destination = cpu8051_ReadI ( cpu8051_ReadD( BANKPSW + _R1_ ) ); -unsigned char srcaddr = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -unsigned char source = cpu8051_ReadD( srcaddr ); -destination = source; -cpu8051_WriteI( cpu8051_ReadD( BANKPSW + _R1_ ), destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "MOV R0,direct" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_A8(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R0_ ); -unsigned char srcaddr = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -unsigned char source = cpu8051_ReadD( srcaddr ); -destination = source; -cpu8051_WriteD( BANKPSW + _R0_, destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "MOV R1,direct" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_A9(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R1_ ); -unsigned char srcaddr = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -unsigned char source = cpu8051_ReadD( srcaddr ); -destination = source; -cpu8051_WriteD( BANKPSW + _R1_, destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "MOV R2,direct" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_AA(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R2_ ); -unsigned char srcaddr = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -unsigned char source = cpu8051_ReadD( srcaddr ); -destination = source; -cpu8051_WriteD( BANKPSW + _R2_, destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "MOV R3,direct" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_AB(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R3_ ); -unsigned char srcaddr = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -unsigned char source = cpu8051_ReadD( srcaddr ); -destination = source; -cpu8051_WriteD( BANKPSW + _R3_, destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "MOV R4,direct" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_AC(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R4_ ); -unsigned char srcaddr = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -unsigned char source = cpu8051_ReadD( srcaddr ); -destination = source; -cpu8051_WriteD( BANKPSW + _R4_, destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "MOV R5,direct" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_AD(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R5_ ); -unsigned char srcaddr = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -unsigned char source = cpu8051_ReadD( srcaddr ); -destination = source; -cpu8051_WriteD( BANKPSW + _R5_, destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "MOV R6,direct" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_AE(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R6_ ); -unsigned char srcaddr = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -unsigned char source = cpu8051_ReadD( srcaddr ); -destination = source; -cpu8051_WriteD( BANKPSW + _R6_, destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "MOV R7,direct" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_AF(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R7_ ); -unsigned char srcaddr = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -unsigned char source = cpu8051_ReadD( srcaddr ); -destination = source; -cpu8051_WriteD( BANKPSW + _R7_, destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "ANL C,/bitaddr" takes 1 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_B0(void) -{ -unsigned char destination = ( cpu8051_ReadD( _PSW_ ) >> 7 ); -unsigned char source, srcbitaddr = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -source = ( cpu8051_ReadB( srcbitaddr ) ^ 1 ); -cpu8051_WriteD( _PSW_, ( ( destination & source) << 7 ) ); -cpu8051_WriteD( _PSW_, ( ( cpu8051_ReadD( _PSW_ ) & 0x7F) | ( destination << 7 ) ) ); -return 1; -} - - -/***************************************************************************** - * Instruction "ACALL addr11" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_B1(void) -{ - unsigned int addr11 = ( ( memory_read8( PGM_MEM_ID, cpu8051.pc - 1 ) << 3 ) & 0xF00 ) + memory_read8( PGM_MEM_ID, cpu8051.pc++ ); -unsigned char SP = cpu8051_ReadD( _SP_ ); -cpu8051_WriteI( ++SP, ( cpu8051.pc & 0x00FF ) ); -cpu8051_WriteI( ++SP, ( cpu8051.pc >> 8 ) ); -cpu8051_WriteD( _SP_, SP ); -cpu8051.pc = ( cpu8051.pc & 0xF800 ) | addr11; -return 2; -} - - -/***************************************************************************** - * Instruction "CPL bitaddr" takes 1 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_B2(void) -{ -unsigned char destination, dstbitaddr = memory_read8( PGM_MEM_ID, cpu8051.pc++ ); -destination = cpu8051_ReadB( dstbitaddr ); -destination ^= 0x01; -cpu8051_WriteB( dstbitaddr, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "CPL C" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_B3(void) -{ -unsigned char destination = ( cpu8051_ReadD( _PSW_ ) >> 7 ); -destination ^= 0x01; -cpu8051_WriteD( _PSW_, ( ( cpu8051_ReadD( _PSW_ ) & 0x7F) | ( destination << 7 ) ) ); -return 1; -} - - -/***************************************************************************** - * Instruction "CJNE A,#data,reladdr" takes 2 cycle(s) and 3 byte(s). - ****************************************************************************/ -int -cpu8051_OP_B4(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -unsigned int reladdr = ((char) memory_read8(PGM_MEM_ID, cpu8051.pc)) + (cpu8051.pc + 1); -cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x7F ) ); -if ( destination < source ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) ); -if ( destination != source ) cpu8051.pc = reladdr; -cpu8051_WriteD( _ACC_, destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "CJNE A,direct,reladdr" takes 2 cycle(s) and 3 byte(s). - ****************************************************************************/ -int -cpu8051_OP_B5(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char srcaddr = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -unsigned char source = cpu8051_ReadD( srcaddr ); -unsigned int reladdr = ((char) memory_read8(PGM_MEM_ID, cpu8051.pc)) + (cpu8051.pc + 1); -cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x7F ) ); -if ( destination < source ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) ); -if ( destination != source ) cpu8051.pc = reladdr; -cpu8051_WriteD( _ACC_, destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "CJNE @R0,#data,reladdr" takes 2 cycle(s) and 3 byte(s). - ****************************************************************************/ -int -cpu8051_OP_B6(void) -{ -unsigned char destination = cpu8051_ReadI ( cpu8051_ReadD( BANKPSW + _R0_ ) ); -unsigned char source = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -unsigned int reladdr = ((char) memory_read8(PGM_MEM_ID, cpu8051.pc)) + (cpu8051.pc + 1); -cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x7F ) ); -if ( destination < source ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) ); -if ( destination != source ) cpu8051.pc = reladdr; -cpu8051_WriteI( cpu8051_ReadD( BANKPSW + _R0_ ), destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "CJNE @R1,#data,reladdr" takes 2 cycle(s) and 3 byte(s). - ****************************************************************************/ -int -cpu8051_OP_B7(void) -{ -unsigned char destination = cpu8051_ReadI ( cpu8051_ReadD( BANKPSW + _R1_ ) ); -unsigned char source = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -unsigned int reladdr = ((char) memory_read8(PGM_MEM_ID, cpu8051.pc)) + (cpu8051.pc + 1); -cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x7F ) ); -if ( destination < source ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) ); -if ( destination != source ) cpu8051.pc = reladdr; -cpu8051_WriteI( cpu8051_ReadD( BANKPSW + _R1_ ), destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "CJNE R0,#data,reladdr" takes 2 cycle(s) and 3 byte(s). - ****************************************************************************/ -int -cpu8051_OP_B8(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R0_ ); -unsigned char source = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -unsigned int reladdr = ((char) memory_read8(PGM_MEM_ID, cpu8051.pc)) + (cpu8051.pc + 1); -cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x7F ) ); -if ( destination < source ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) ); -if ( destination != source ) cpu8051.pc = reladdr; -cpu8051_WriteD( BANKPSW + _R0_, destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "CJNE R1,#data,reladdr" takes 2 cycle(s) and 3 byte(s). - ****************************************************************************/ -int -cpu8051_OP_B9(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R1_ ); -unsigned char source = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -unsigned int reladdr = ((char) memory_read8(PGM_MEM_ID, cpu8051.pc)) + (cpu8051.pc + 1); -cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x7F ) ); -if ( destination < source ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) ); -if ( destination != source ) cpu8051.pc = reladdr; -cpu8051_WriteD( BANKPSW + _R1_, destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "CJNE R2,#data,reladdr" takes 2 cycle(s) and 3 byte(s). - ****************************************************************************/ -int -cpu8051_OP_BA(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R2_ ); -unsigned char source = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -unsigned int reladdr = ((char) memory_read8(PGM_MEM_ID, cpu8051.pc)) + (cpu8051.pc + 1); -cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x7F ) ); -if ( destination < source ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) ); -if ( destination != source ) cpu8051.pc = reladdr; -cpu8051_WriteD( BANKPSW + _R2_, destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "CJNE R3,#data,reladdr" takes 2 cycle(s) and 3 byte(s). - ****************************************************************************/ -int -cpu8051_OP_BB(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R3_ ); -unsigned char source = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -unsigned int reladdr = ((char) memory_read8(PGM_MEM_ID, cpu8051.pc)) + (cpu8051.pc + 1); -cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x7F ) ); -if ( destination < source ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) ); -if ( destination != source ) cpu8051.pc = reladdr; -cpu8051_WriteD( BANKPSW + _R3_, destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "CJNE R4,#data,reladdr" takes 2 cycle(s) and 3 byte(s). - ****************************************************************************/ -int -cpu8051_OP_BC(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R4_ ); -unsigned char source = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -unsigned int reladdr = ((char) memory_read8(PGM_MEM_ID, cpu8051.pc)) + (cpu8051.pc + 1); -cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x7F ) ); -if ( destination < source ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) ); -if ( destination != source ) cpu8051.pc = reladdr; -cpu8051_WriteD( BANKPSW + _R4_, destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "CJNE R5,#data,reladdr" takes 2 cycle(s) and 3 byte(s). - ****************************************************************************/ -int -cpu8051_OP_BD(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R5_ ); -unsigned char source = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -unsigned int reladdr = ((char) memory_read8(PGM_MEM_ID, cpu8051.pc)) + (cpu8051.pc + 1); -cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x7F ) ); -if ( destination < source ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) ); -if ( destination != source ) cpu8051.pc = reladdr; -cpu8051_WriteD( BANKPSW + _R5_, destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "CJNE R6,#data,reladdr" takes 2 cycle(s) and 3 byte(s). - ****************************************************************************/ -int -cpu8051_OP_BE(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R6_ ); -unsigned char source = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -unsigned int reladdr = ((char) memory_read8(PGM_MEM_ID, cpu8051.pc)) + (cpu8051.pc + 1); -cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x7F ) ); -if ( destination < source ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) ); -if ( destination != source ) cpu8051.pc = reladdr; -cpu8051_WriteD( BANKPSW + _R6_, destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "CJNE R7,#data,reladdr" takes 2 cycle(s) and 3 byte(s). - ****************************************************************************/ -int -cpu8051_OP_BF(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R7_ ); -unsigned char source = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -unsigned int reladdr = ((char) memory_read8(PGM_MEM_ID, cpu8051.pc)) + (cpu8051.pc + 1); -cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x7F ) ); -if ( destination < source ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) ); -if ( destination != source ) cpu8051.pc = reladdr; -cpu8051_WriteD( BANKPSW + _R7_, destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "PUSH direct" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_C0(void) -{ -unsigned char destaddr = memory_read8( PGM_MEM_ID, cpu8051.pc++ ); -unsigned char destination = cpu8051_ReadD( destaddr ); -unsigned char SP = cpu8051_ReadD( _SP_ ); -cpu8051_WriteI( ++SP, destination ); -cpu8051_WriteD( _SP_, SP ); -cpu8051_WriteD( destaddr, destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "AJMP addr11" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_C1(void) -{ - unsigned int addr11 = ( ( memory_read8( PGM_MEM_ID, cpu8051.pc - 1 ) << 3 ) & 0xF00 ) + memory_read8( PGM_MEM_ID, cpu8051.pc++ ); -cpu8051.pc = ( cpu8051.pc & 0xF800 ) | addr11; -return 2; -} - - -/***************************************************************************** - * Instruction "CLR bitaddr" takes 1 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_C2(void) -{ -unsigned char destination, dstbitaddr = memory_read8( PGM_MEM_ID, cpu8051.pc++ ); -destination = cpu8051_ReadB( dstbitaddr ); -destination = 0; -cpu8051_WriteB( dstbitaddr, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "CLR C" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_C3(void) -{ -unsigned char destination = ( cpu8051_ReadD( _PSW_ ) >> 7 ); -destination = 0; -cpu8051_WriteD( _PSW_, ( ( cpu8051_ReadD( _PSW_ ) & 0x7F) | ( destination << 7 ) ) ); -return 1; -} - - -/***************************************************************************** - * Instruction "SWAP A" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_C4(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -destination = ( destination << 4 ) + ( destination >> 4 ); -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "XCH A,direct" takes 1 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_C5(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char srcaddr = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -unsigned char source = cpu8051_ReadD( srcaddr ); -unsigned char tmpval = destination; -destination = source; source = tmpval; -cpu8051_WriteD( _ACC_, destination ); -cpu8051_WriteD( srcaddr, source ); -return 1; -} - - -/***************************************************************************** - * Instruction "XCH A,@R0" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_C6(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadI ( cpu8051_ReadD( BANKPSW + _R0_ ) ); -unsigned char tmpval = destination; -destination = source; source = tmpval; -cpu8051_WriteD( _ACC_, destination ); -cpu8051_WriteI( cpu8051_ReadD( BANKPSW + _R0_ ), source ); -return 1; -} - - -/***************************************************************************** - * Instruction "XCH A,@R1" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_C7(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadI ( cpu8051_ReadD( BANKPSW + _R1_ ) ); -unsigned char tmpval = destination; -destination = source; source = tmpval; -cpu8051_WriteD( _ACC_, destination ); -cpu8051_WriteI( cpu8051_ReadD( BANKPSW + _R1_ ), source ); -return 1; -} - - -/***************************************************************************** - * Instruction "XCH A,R0" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_C8(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R0_ ); -unsigned char tmpval = destination; -destination = source; source = tmpval; -cpu8051_WriteD( _ACC_, destination ); -cpu8051_WriteD( BANKPSW + _R0_, source ); -return 1; -} - - -/***************************************************************************** - * Instruction "XCH A,R1" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_C9(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R1_ ); -unsigned char tmpval = destination; -destination = source; source = tmpval; -cpu8051_WriteD( _ACC_, destination ); -cpu8051_WriteD( BANKPSW + _R1_, source ); -return 1; -} - - -/***************************************************************************** - * Instruction "XCH A,R2" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_CA(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R2_ ); -unsigned char tmpval = destination; -destination = source; source = tmpval; -cpu8051_WriteD( _ACC_, destination ); -cpu8051_WriteD( BANKPSW + _R2_, source ); -return 1; -} - - -/***************************************************************************** - * Instruction "XCH A,R3" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_CB(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R3_ ); -unsigned char tmpval = destination; -destination = source; source = tmpval; -cpu8051_WriteD( _ACC_, destination ); -cpu8051_WriteD( BANKPSW + _R3_, source ); -return 1; -} - - -/***************************************************************************** - * Instruction "XCH A,R4" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_CC(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R4_ ); -unsigned char tmpval = destination; -destination = source; source = tmpval; -cpu8051_WriteD( _ACC_, destination ); -cpu8051_WriteD( BANKPSW + _R4_, source ); -return 1; -} - - -/***************************************************************************** - * Instruction "XCH A,R5" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_CD(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R5_ ); -unsigned char tmpval = destination; -destination = source; source = tmpval; -cpu8051_WriteD( _ACC_, destination ); -cpu8051_WriteD( BANKPSW + _R5_, source ); -return 1; -} - - -/***************************************************************************** - * Instruction "XCH A,R6" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_CE(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R6_ ); -unsigned char tmpval = destination; -destination = source; source = tmpval; -cpu8051_WriteD( _ACC_, destination ); -cpu8051_WriteD( BANKPSW + _R6_, source ); -return 1; -} - - -/***************************************************************************** - * Instruction "XCH A,R7" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_CF(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R7_ ); -unsigned char tmpval = destination; -destination = source; source = tmpval; -cpu8051_WriteD( _ACC_, destination ); -cpu8051_WriteD( BANKPSW + _R7_, source ); -return 1; -} - - -/***************************************************************************** - * Instruction "POP direct" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_D0(void) -{ -unsigned char destaddr = memory_read8( PGM_MEM_ID, cpu8051.pc++ ); -unsigned char destination = cpu8051_ReadD( destaddr ); -unsigned char SP = cpu8051_ReadD( _SP_ ); -destination = cpu8051_ReadI( SP-- ); -cpu8051_WriteD( _SP_, SP ); -cpu8051_WriteD( destaddr, destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "ACALL addr11" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_D1(void) -{ - unsigned int addr11 = ( ( memory_read8( PGM_MEM_ID, cpu8051.pc - 1 ) << 3 ) & 0xF00 ) + memory_read8( PGM_MEM_ID, cpu8051.pc++ ); -unsigned char SP = cpu8051_ReadD( _SP_ ); -cpu8051_WriteI( ++SP, ( cpu8051.pc & 0x00FF ) ); -cpu8051_WriteI( ++SP, ( cpu8051.pc >> 8 ) ); -cpu8051_WriteD( _SP_, SP ); -cpu8051.pc = ( cpu8051.pc & 0xF800 ) | addr11; -return 2; -} - - -/***************************************************************************** - * Instruction "SETB bitaddr" takes 1 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_D2(void) -{ -unsigned char destination, dstbitaddr = memory_read8( PGM_MEM_ID, cpu8051.pc++ ); -destination = cpu8051_ReadB( dstbitaddr ); -destination = 1; -cpu8051_WriteB( dstbitaddr, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "SETB C" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_D3(void) -{ -unsigned char destination = ( cpu8051_ReadD( _PSW_ ) >> 7 ); -destination = 1; -cpu8051_WriteD( _PSW_, ( ( cpu8051_ReadD( _PSW_ ) & 0x7F) | ( destination << 7 ) ) ); -return 1; -} - - -/***************************************************************************** - * Instruction "DA A" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_D4(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -if ( ( ( destination & 0x0F ) > 9) || ( cpu8051_ReadD( _PSW_ ) | 0x40)) { - if ( ( destination + 6 ) > 0xFF) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) ); - destination += 6; -} -if ( ( cpu8051_ReadD( _PSW_ ) & 0x80) || ( ( destination & 0xF0 ) > 0x90 ) ) { - if ( ( destination + 0x60 ) > 0xFF ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) ); - destination += 0x60; -} -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "DJNZ direct,reladdr" takes 2 cycle(s) and 3 byte(s). - ****************************************************************************/ -int -cpu8051_OP_D5(void) -{ -unsigned char destaddr = memory_read8( PGM_MEM_ID, cpu8051.pc++ ); -unsigned char destination = cpu8051_ReadD( destaddr ); -(cpu8051.pc)++; -unsigned int source = ((char) memory_read8(PGM_MEM_ID, cpu8051.pc - 1)) + cpu8051.pc; -destination--; -if ( destination != 0 ) cpu8051.pc = source; -cpu8051_WriteD( destaddr, destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "XCHD A,@R0" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_D6(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadI ( cpu8051_ReadD( BANKPSW + _R0_ ) ); -unsigned char tmpval = ( destination & 0x0F ); -destination = ( destination & 0xF0 ) + ( source & 0x0F ); -source = ( source & 0xF0 ) + tmpval; -cpu8051_WriteD( _ACC_, destination ); -cpu8051_WriteI( cpu8051_ReadD( BANKPSW + _R0_ ), source ); -return 1; -} - - -/***************************************************************************** - * Instruction "XCHD A,@R1" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_D7(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadI ( cpu8051_ReadD( BANKPSW + _R1_ ) ); -unsigned char tmpval = ( destination & 0x0F ); -destination = ( destination & 0xF0 ) + ( source & 0x0F ); -source = ( source & 0xF0 ) + tmpval; -cpu8051_WriteD( _ACC_, destination ); -cpu8051_WriteI( cpu8051_ReadD( BANKPSW + _R1_ ), source ); -return 1; -} - - -/***************************************************************************** - * Instruction "DJNZ R0,reladdr" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_D8(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R0_ ); -(cpu8051.pc)++; -unsigned int source = ((char) memory_read8(PGM_MEM_ID, cpu8051.pc - 1)) + cpu8051.pc; -destination--; -if ( destination != 0 ) cpu8051.pc = source; -cpu8051_WriteD( BANKPSW + _R0_, destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "DJNZ R1,reladdr" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_D9(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R1_ ); -(cpu8051.pc)++; -unsigned int source = ((char) memory_read8(PGM_MEM_ID, cpu8051.pc - 1)) + cpu8051.pc; -destination--; -if ( destination != 0 ) cpu8051.pc = source; -cpu8051_WriteD( BANKPSW + _R1_, destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "DJNZ R2,reladdr" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_DA(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R2_ ); -(cpu8051.pc)++; -unsigned int source = ((char) memory_read8(PGM_MEM_ID, cpu8051.pc - 1)) + cpu8051.pc; -destination--; -if ( destination != 0 ) cpu8051.pc = source; -cpu8051_WriteD( BANKPSW + _R2_, destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "DJNZ R3,reladdr" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_DB(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R3_ ); -(cpu8051.pc)++; -unsigned int source = ((char) memory_read8(PGM_MEM_ID, cpu8051.pc - 1)) + cpu8051.pc; -destination--; -if ( destination != 0 ) cpu8051.pc = source; -cpu8051_WriteD( BANKPSW + _R3_, destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "DJNZ R4,reladdr" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_DC(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R4_ ); -(cpu8051.pc)++; -unsigned int source = ((char) memory_read8(PGM_MEM_ID, cpu8051.pc - 1)) + cpu8051.pc; -destination--; -if ( destination != 0 ) cpu8051.pc = source; -cpu8051_WriteD( BANKPSW + _R4_, destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "DJNZ R5,reladdr" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_DD(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R5_ ); -(cpu8051.pc)++; -unsigned int source = ((char) memory_read8(PGM_MEM_ID, cpu8051.pc - 1)) + cpu8051.pc; -destination--; -if ( destination != 0 ) cpu8051.pc = source; -cpu8051_WriteD( BANKPSW + _R5_, destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "DJNZ R6,reladdr" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_DE(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R6_ ); -(cpu8051.pc)++; -unsigned int source = ((char) memory_read8(PGM_MEM_ID, cpu8051.pc - 1)) + cpu8051.pc; -destination--; -if ( destination != 0 ) cpu8051.pc = source; -cpu8051_WriteD( BANKPSW + _R6_, destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "DJNZ R7,reladdr" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_DF(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R7_ ); -(cpu8051.pc)++; -unsigned int source = ((char) memory_read8(PGM_MEM_ID, cpu8051.pc - 1)) + cpu8051.pc; -destination--; -if ( destination != 0 ) cpu8051.pc = source; -cpu8051_WriteD( BANKPSW + _R7_, destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "MOVX A,@DPTR" takes 2 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_E0(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadI( ( cpu8051_ReadD( _DPTRHIGH_ ) << 8 ) + cpu8051_ReadD( _DPTRLOW_) ); -destination = source; -cpu8051_WriteD( _ACC_, destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "AJMP addr11" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_E1(void) -{ - unsigned int addr11 = ( ( memory_read8( PGM_MEM_ID, cpu8051.pc - 1 ) << 3 ) & 0xF00 ) + memory_read8( PGM_MEM_ID, cpu8051.pc++ ); -cpu8051.pc = ( cpu8051.pc & 0xF800 ) | addr11; -return 2; -} - - -/***************************************************************************** - * Instruction "MOVX A,@R0" takes 2 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_E2(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadI ( cpu8051_ReadD( BANKPSW + _R0_ ) ); -destination = source; -cpu8051_WriteD( _ACC_, destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "MOVX A,@R1" takes 2 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_E3(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadI ( cpu8051_ReadD( BANKPSW + _R1_ ) ); -destination = source; -cpu8051_WriteD( _ACC_, destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "CLR A" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_E4(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -destination = 0; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "MOV A,direct" takes 1 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_E5(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char srcaddr = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ); -unsigned char source = cpu8051_ReadD( srcaddr ); -destination = source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "MOV A,@R0" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_E6(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadI ( cpu8051_ReadD( BANKPSW + _R0_ ) ); -destination = source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "MOV A,@R1" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_E7(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadI ( cpu8051_ReadD( BANKPSW + _R1_ ) ); -destination = source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "MOV A,R0" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_E8(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R0_ ); -destination = source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "MOV A,R1" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_E9(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R1_ ); -destination = source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "MOV A,R2" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_EA(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R2_ ); -destination = source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "MOV A,R3" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_EB(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R3_ ); -destination = source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "MOV A,R4" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_EC(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R4_ ); -destination = source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "MOV A,R5" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_ED(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R5_ ); -destination = source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "MOV A,R6" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_EE(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R6_ ); -destination = source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "MOV A,R7" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_EF(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -unsigned char source = cpu8051_ReadD( BANKPSW + _R7_ ); -destination = source; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "MOVX @DPTR,A" takes 2 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_F0(void) -{ -unsigned char destination = cpu8051_ReadI( ( cpu8051_ReadD( _DPTRHIGH_ ) << 8 ) + cpu8051_ReadD( _DPTRLOW_) ); -unsigned char source = cpu8051_ReadD( _ACC_ ); -destination = source; -cpu8051_WriteI( ( cpu8051_ReadD( _DPTRHIGH_ ) << 8 ) + cpu8051_ReadD( _DPTRLOW_ ), destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "ACALL addr11" takes 2 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_F1(void) -{ - unsigned int addr11 = ( ( memory_read8( PGM_MEM_ID, cpu8051.pc - 1 ) << 3 ) & 0xF00 ) + memory_read8( PGM_MEM_ID, cpu8051.pc++ ); -unsigned char SP = cpu8051_ReadD( _SP_ ); -cpu8051_WriteI( ++SP, ( cpu8051.pc & 0x00FF ) ); -cpu8051_WriteI( ++SP, ( cpu8051.pc >> 8 ) ); -cpu8051_WriteD( _SP_, SP ); -cpu8051.pc = ( cpu8051.pc & 0xF800 ) | addr11; -return 2; -} - - -/***************************************************************************** - * Instruction "MOVX @R0,A" takes 2 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_F2(void) -{ -unsigned char destination = cpu8051_ReadI ( cpu8051_ReadD( BANKPSW + _R0_ ) ); -unsigned char source = cpu8051_ReadD( _ACC_ ); -destination = source; -cpu8051_WriteI( cpu8051_ReadD( BANKPSW + _R0_ ), destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "MOVX @R1,A" takes 2 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_F3(void) -{ -unsigned char destination = cpu8051_ReadI ( cpu8051_ReadD( BANKPSW + _R1_ ) ); -unsigned char source = cpu8051_ReadD( _ACC_ ); -destination = source; -cpu8051_WriteI( cpu8051_ReadD( BANKPSW + _R1_ ), destination ); -return 2; -} - - -/***************************************************************************** - * Instruction "CPL A" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_F4(void) -{ -unsigned char destination = cpu8051_ReadD( _ACC_ ); -destination ^= 0xFF; -cpu8051_WriteD( _ACC_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "MOV direct,A" takes 1 cycle(s) and 2 byte(s). - ****************************************************************************/ -int -cpu8051_OP_F5(void) -{ -unsigned char destaddr = memory_read8( PGM_MEM_ID, cpu8051.pc++ ); -unsigned char destination = cpu8051_ReadD( destaddr ); -unsigned char source = cpu8051_ReadD( _ACC_ ); -destination = source; -cpu8051_WriteD( destaddr, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "MOV @R0,A" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_F6(void) -{ -unsigned char destination = cpu8051_ReadI ( cpu8051_ReadD( BANKPSW + _R0_ ) ); -unsigned char source = cpu8051_ReadD( _ACC_ ); -destination = source; -cpu8051_WriteI( cpu8051_ReadD( BANKPSW + _R0_ ), destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "MOV @R1,A" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_F7(void) -{ -unsigned char destination = cpu8051_ReadI ( cpu8051_ReadD( BANKPSW + _R1_ ) ); -unsigned char source = cpu8051_ReadD( _ACC_ ); -destination = source; -cpu8051_WriteI( cpu8051_ReadD( BANKPSW + _R1_ ), destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "MOV R0,A" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_F8(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R0_ ); -unsigned char source = cpu8051_ReadD( _ACC_ ); -destination = source; -cpu8051_WriteD( BANKPSW + _R0_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "MOV R1,A" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_F9(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R1_ ); -unsigned char source = cpu8051_ReadD( _ACC_ ); -destination = source; -cpu8051_WriteD( BANKPSW + _R1_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "MOV R2,A" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_FA(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R2_ ); -unsigned char source = cpu8051_ReadD( _ACC_ ); -destination = source; -cpu8051_WriteD( BANKPSW + _R2_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "MOV R3,A" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_FB(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R3_ ); -unsigned char source = cpu8051_ReadD( _ACC_ ); -destination = source; -cpu8051_WriteD( BANKPSW + _R3_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "MOV R4,A" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_FC(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R4_ ); -unsigned char source = cpu8051_ReadD( _ACC_ ); -destination = source; -cpu8051_WriteD( BANKPSW + _R4_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "MOV R5,A" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_FD(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R5_ ); -unsigned char source = cpu8051_ReadD( _ACC_ ); -destination = source; -cpu8051_WriteD( BANKPSW + _R5_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "MOV R6,A" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_FE(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R6_ ); -unsigned char source = cpu8051_ReadD( _ACC_ ); -destination = source; -cpu8051_WriteD( BANKPSW + _R6_, destination ); -return 1; -} - - -/***************************************************************************** - * Instruction "MOV R7,A" takes 1 cycle(s) and 1 byte(s). - ****************************************************************************/ -int -cpu8051_OP_FF(void) -{ -unsigned char destination = cpu8051_ReadD( BANKPSW + _R7_ ); -unsigned char source = cpu8051_ReadD( _ACC_ ); -destination = source; -cpu8051_WriteD( BANKPSW + _R7_, destination ); -return 1; -} - - diff -Nru emu8051-1.1.1/src/instructions_8051.h emu8051-2.0.1/src/instructions_8051.h --- emu8051-1.1.1/src/instructions_8051.h 2011-11-20 21:31:29.000000000 +0000 +++ emu8051-2.0.1/src/instructions_8051.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,1068 +0,0 @@ -/* - * instructions_8051.h - * - * Do not modify this file directly, as it was created by opcode2c.pl - * Any modifications made directly to this file will be lost. - * - * Copyright (C) 1999 Jonathan St-André - * Copyright (C) 1999 Hugo Villeneuve - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -#ifndef INSTRUCTIONS_8051_H -#define INSTRUCTIONS_8051_H 1 - - -#define BANKPSW (cpu8051_ReadD(_PSW_) & 0x18) - -typedef int (*OPCODE_FP)(void); - - -int -cpu8051_OP_00(void); - -int -cpu8051_OP_01(void); - -int -cpu8051_OP_02(void); - -int -cpu8051_OP_03(void); - -int -cpu8051_OP_04(void); - -int -cpu8051_OP_05(void); - -int -cpu8051_OP_06(void); - -int -cpu8051_OP_07(void); - -int -cpu8051_OP_08(void); - -int -cpu8051_OP_09(void); - -int -cpu8051_OP_0A(void); - -int -cpu8051_OP_0B(void); - -int -cpu8051_OP_0C(void); - -int -cpu8051_OP_0D(void); - -int -cpu8051_OP_0E(void); - -int -cpu8051_OP_0F(void); - -int -cpu8051_OP_10(void); - -int -cpu8051_OP_11(void); - -int -cpu8051_OP_12(void); - -int -cpu8051_OP_13(void); - -int -cpu8051_OP_14(void); - -int -cpu8051_OP_15(void); - -int -cpu8051_OP_16(void); - -int -cpu8051_OP_17(void); - -int -cpu8051_OP_18(void); - -int -cpu8051_OP_19(void); - -int -cpu8051_OP_1A(void); - -int -cpu8051_OP_1B(void); - -int -cpu8051_OP_1C(void); - -int -cpu8051_OP_1D(void); - -int -cpu8051_OP_1E(void); - -int -cpu8051_OP_1F(void); - -int -cpu8051_OP_20(void); - -int -cpu8051_OP_21(void); - -int -cpu8051_OP_22(void); - -int -cpu8051_OP_23(void); - -int -cpu8051_OP_24(void); - -int -cpu8051_OP_25(void); - -int -cpu8051_OP_26(void); - -int -cpu8051_OP_27(void); - -int -cpu8051_OP_28(void); - -int -cpu8051_OP_29(void); - -int -cpu8051_OP_2A(void); - -int -cpu8051_OP_2B(void); - -int -cpu8051_OP_2C(void); - -int -cpu8051_OP_2D(void); - -int -cpu8051_OP_2E(void); - -int -cpu8051_OP_2F(void); - -int -cpu8051_OP_30(void); - -int -cpu8051_OP_31(void); - -int -cpu8051_OP_32(void); - -int -cpu8051_OP_33(void); - -int -cpu8051_OP_34(void); - -int -cpu8051_OP_35(void); - -int -cpu8051_OP_36(void); - -int -cpu8051_OP_37(void); - -int -cpu8051_OP_38(void); - -int -cpu8051_OP_39(void); - -int -cpu8051_OP_3A(void); - -int -cpu8051_OP_3B(void); - -int -cpu8051_OP_3C(void); - -int -cpu8051_OP_3D(void); - -int -cpu8051_OP_3E(void); - -int -cpu8051_OP_3F(void); - -int -cpu8051_OP_40(void); - -int -cpu8051_OP_41(void); - -int -cpu8051_OP_42(void); - -int -cpu8051_OP_43(void); - -int -cpu8051_OP_44(void); - -int -cpu8051_OP_45(void); - -int -cpu8051_OP_46(void); - -int -cpu8051_OP_47(void); - -int -cpu8051_OP_48(void); - -int -cpu8051_OP_49(void); - -int -cpu8051_OP_4A(void); - -int -cpu8051_OP_4B(void); - -int -cpu8051_OP_4C(void); - -int -cpu8051_OP_4D(void); - -int -cpu8051_OP_4E(void); - -int -cpu8051_OP_4F(void); - -int -cpu8051_OP_50(void); - -int -cpu8051_OP_51(void); - -int -cpu8051_OP_52(void); - -int -cpu8051_OP_53(void); - -int -cpu8051_OP_54(void); - -int -cpu8051_OP_55(void); - -int -cpu8051_OP_56(void); - -int -cpu8051_OP_57(void); - -int -cpu8051_OP_58(void); - -int -cpu8051_OP_59(void); - -int -cpu8051_OP_5A(void); - -int -cpu8051_OP_5B(void); - -int -cpu8051_OP_5C(void); - -int -cpu8051_OP_5D(void); - -int -cpu8051_OP_5E(void); - -int -cpu8051_OP_5F(void); - -int -cpu8051_OP_60(void); - -int -cpu8051_OP_61(void); - -int -cpu8051_OP_62(void); - -int -cpu8051_OP_63(void); - -int -cpu8051_OP_64(void); - -int -cpu8051_OP_65(void); - -int -cpu8051_OP_66(void); - -int -cpu8051_OP_67(void); - -int -cpu8051_OP_68(void); - -int -cpu8051_OP_69(void); - -int -cpu8051_OP_6A(void); - -int -cpu8051_OP_6B(void); - -int -cpu8051_OP_6C(void); - -int -cpu8051_OP_6D(void); - -int -cpu8051_OP_6E(void); - -int -cpu8051_OP_6F(void); - -int -cpu8051_OP_70(void); - -int -cpu8051_OP_71(void); - -int -cpu8051_OP_72(void); - -int -cpu8051_OP_73(void); - -int -cpu8051_OP_74(void); - -int -cpu8051_OP_75(void); - -int -cpu8051_OP_76(void); - -int -cpu8051_OP_77(void); - -int -cpu8051_OP_78(void); - -int -cpu8051_OP_79(void); - -int -cpu8051_OP_7A(void); - -int -cpu8051_OP_7B(void); - -int -cpu8051_OP_7C(void); - -int -cpu8051_OP_7D(void); - -int -cpu8051_OP_7E(void); - -int -cpu8051_OP_7F(void); - -int -cpu8051_OP_80(void); - -int -cpu8051_OP_81(void); - -int -cpu8051_OP_82(void); - -int -cpu8051_OP_83(void); - -int -cpu8051_OP_84(void); - -int -cpu8051_OP_85(void); - -int -cpu8051_OP_86(void); - -int -cpu8051_OP_87(void); - -int -cpu8051_OP_88(void); - -int -cpu8051_OP_89(void); - -int -cpu8051_OP_8A(void); - -int -cpu8051_OP_8B(void); - -int -cpu8051_OP_8C(void); - -int -cpu8051_OP_8D(void); - -int -cpu8051_OP_8E(void); - -int -cpu8051_OP_8F(void); - -int -cpu8051_OP_90(void); - -int -cpu8051_OP_91(void); - -int -cpu8051_OP_92(void); - -int -cpu8051_OP_93(void); - -int -cpu8051_OP_94(void); - -int -cpu8051_OP_95(void); - -int -cpu8051_OP_96(void); - -int -cpu8051_OP_97(void); - -int -cpu8051_OP_98(void); - -int -cpu8051_OP_99(void); - -int -cpu8051_OP_9A(void); - -int -cpu8051_OP_9B(void); - -int -cpu8051_OP_9C(void); - -int -cpu8051_OP_9D(void); - -int -cpu8051_OP_9E(void); - -int -cpu8051_OP_9F(void); - -int -cpu8051_OP_A0(void); - -int -cpu8051_OP_A1(void); - -int -cpu8051_OP_A2(void); - -int -cpu8051_OP_A3(void); - -int -cpu8051_OP_A4(void); - -int -cpu8051_OP_A5(void); - -int -cpu8051_OP_A6(void); - -int -cpu8051_OP_A7(void); - -int -cpu8051_OP_A8(void); - -int -cpu8051_OP_A9(void); - -int -cpu8051_OP_AA(void); - -int -cpu8051_OP_AB(void); - -int -cpu8051_OP_AC(void); - -int -cpu8051_OP_AD(void); - -int -cpu8051_OP_AE(void); - -int -cpu8051_OP_AF(void); - -int -cpu8051_OP_B0(void); - -int -cpu8051_OP_B1(void); - -int -cpu8051_OP_B2(void); - -int -cpu8051_OP_B3(void); - -int -cpu8051_OP_B4(void); - -int -cpu8051_OP_B5(void); - -int -cpu8051_OP_B6(void); - -int -cpu8051_OP_B7(void); - -int -cpu8051_OP_B8(void); - -int -cpu8051_OP_B9(void); - -int -cpu8051_OP_BA(void); - -int -cpu8051_OP_BB(void); - -int -cpu8051_OP_BC(void); - -int -cpu8051_OP_BD(void); - -int -cpu8051_OP_BE(void); - -int -cpu8051_OP_BF(void); - -int -cpu8051_OP_C0(void); - -int -cpu8051_OP_C1(void); - -int -cpu8051_OP_C2(void); - -int -cpu8051_OP_C3(void); - -int -cpu8051_OP_C4(void); - -int -cpu8051_OP_C5(void); - -int -cpu8051_OP_C6(void); - -int -cpu8051_OP_C7(void); - -int -cpu8051_OP_C8(void); - -int -cpu8051_OP_C9(void); - -int -cpu8051_OP_CA(void); - -int -cpu8051_OP_CB(void); - -int -cpu8051_OP_CC(void); - -int -cpu8051_OP_CD(void); - -int -cpu8051_OP_CE(void); - -int -cpu8051_OP_CF(void); - -int -cpu8051_OP_D0(void); - -int -cpu8051_OP_D1(void); - -int -cpu8051_OP_D2(void); - -int -cpu8051_OP_D3(void); - -int -cpu8051_OP_D4(void); - -int -cpu8051_OP_D5(void); - -int -cpu8051_OP_D6(void); - -int -cpu8051_OP_D7(void); - -int -cpu8051_OP_D8(void); - -int -cpu8051_OP_D9(void); - -int -cpu8051_OP_DA(void); - -int -cpu8051_OP_DB(void); - -int -cpu8051_OP_DC(void); - -int -cpu8051_OP_DD(void); - -int -cpu8051_OP_DE(void); - -int -cpu8051_OP_DF(void); - -int -cpu8051_OP_E0(void); - -int -cpu8051_OP_E1(void); - -int -cpu8051_OP_E2(void); - -int -cpu8051_OP_E3(void); - -int -cpu8051_OP_E4(void); - -int -cpu8051_OP_E5(void); - -int -cpu8051_OP_E6(void); - -int -cpu8051_OP_E7(void); - -int -cpu8051_OP_E8(void); - -int -cpu8051_OP_E9(void); - -int -cpu8051_OP_EA(void); - -int -cpu8051_OP_EB(void); - -int -cpu8051_OP_EC(void); - -int -cpu8051_OP_ED(void); - -int -cpu8051_OP_EE(void); - -int -cpu8051_OP_EF(void); - -int -cpu8051_OP_F0(void); - -int -cpu8051_OP_F1(void); - -int -cpu8051_OP_F2(void); - -int -cpu8051_OP_F3(void); - -int -cpu8051_OP_F4(void); - -int -cpu8051_OP_F5(void); - -int -cpu8051_OP_F6(void); - -int -cpu8051_OP_F7(void); - -int -cpu8051_OP_F8(void); - -int -cpu8051_OP_F9(void); - -int -cpu8051_OP_FA(void); - -int -cpu8051_OP_FB(void); - -int -cpu8051_OP_FC(void); - -int -cpu8051_OP_FD(void); - -int -cpu8051_OP_FE(void); - -int -cpu8051_OP_FF(void); - - -/* Exported variables. */ -#ifdef INSTRUCTIONS_8051_M -OPCODE_FP opcode_table[256] = { - cpu8051_OP_00, - cpu8051_OP_01, - cpu8051_OP_02, - cpu8051_OP_03, - cpu8051_OP_04, - cpu8051_OP_05, - cpu8051_OP_06, - cpu8051_OP_07, - cpu8051_OP_08, - cpu8051_OP_09, - cpu8051_OP_0A, - cpu8051_OP_0B, - cpu8051_OP_0C, - cpu8051_OP_0D, - cpu8051_OP_0E, - cpu8051_OP_0F, - cpu8051_OP_10, - cpu8051_OP_11, - cpu8051_OP_12, - cpu8051_OP_13, - cpu8051_OP_14, - cpu8051_OP_15, - cpu8051_OP_16, - cpu8051_OP_17, - cpu8051_OP_18, - cpu8051_OP_19, - cpu8051_OP_1A, - cpu8051_OP_1B, - cpu8051_OP_1C, - cpu8051_OP_1D, - cpu8051_OP_1E, - cpu8051_OP_1F, - cpu8051_OP_20, - cpu8051_OP_21, - cpu8051_OP_22, - cpu8051_OP_23, - cpu8051_OP_24, - cpu8051_OP_25, - cpu8051_OP_26, - cpu8051_OP_27, - cpu8051_OP_28, - cpu8051_OP_29, - cpu8051_OP_2A, - cpu8051_OP_2B, - cpu8051_OP_2C, - cpu8051_OP_2D, - cpu8051_OP_2E, - cpu8051_OP_2F, - cpu8051_OP_30, - cpu8051_OP_31, - cpu8051_OP_32, - cpu8051_OP_33, - cpu8051_OP_34, - cpu8051_OP_35, - cpu8051_OP_36, - cpu8051_OP_37, - cpu8051_OP_38, - cpu8051_OP_39, - cpu8051_OP_3A, - cpu8051_OP_3B, - cpu8051_OP_3C, - cpu8051_OP_3D, - cpu8051_OP_3E, - cpu8051_OP_3F, - cpu8051_OP_40, - cpu8051_OP_41, - cpu8051_OP_42, - cpu8051_OP_43, - cpu8051_OP_44, - cpu8051_OP_45, - cpu8051_OP_46, - cpu8051_OP_47, - cpu8051_OP_48, - cpu8051_OP_49, - cpu8051_OP_4A, - cpu8051_OP_4B, - cpu8051_OP_4C, - cpu8051_OP_4D, - cpu8051_OP_4E, - cpu8051_OP_4F, - cpu8051_OP_50, - cpu8051_OP_51, - cpu8051_OP_52, - cpu8051_OP_53, - cpu8051_OP_54, - cpu8051_OP_55, - cpu8051_OP_56, - cpu8051_OP_57, - cpu8051_OP_58, - cpu8051_OP_59, - cpu8051_OP_5A, - cpu8051_OP_5B, - cpu8051_OP_5C, - cpu8051_OP_5D, - cpu8051_OP_5E, - cpu8051_OP_5F, - cpu8051_OP_60, - cpu8051_OP_61, - cpu8051_OP_62, - cpu8051_OP_63, - cpu8051_OP_64, - cpu8051_OP_65, - cpu8051_OP_66, - cpu8051_OP_67, - cpu8051_OP_68, - cpu8051_OP_69, - cpu8051_OP_6A, - cpu8051_OP_6B, - cpu8051_OP_6C, - cpu8051_OP_6D, - cpu8051_OP_6E, - cpu8051_OP_6F, - cpu8051_OP_70, - cpu8051_OP_71, - cpu8051_OP_72, - cpu8051_OP_73, - cpu8051_OP_74, - cpu8051_OP_75, - cpu8051_OP_76, - cpu8051_OP_77, - cpu8051_OP_78, - cpu8051_OP_79, - cpu8051_OP_7A, - cpu8051_OP_7B, - cpu8051_OP_7C, - cpu8051_OP_7D, - cpu8051_OP_7E, - cpu8051_OP_7F, - cpu8051_OP_80, - cpu8051_OP_81, - cpu8051_OP_82, - cpu8051_OP_83, - cpu8051_OP_84, - cpu8051_OP_85, - cpu8051_OP_86, - cpu8051_OP_87, - cpu8051_OP_88, - cpu8051_OP_89, - cpu8051_OP_8A, - cpu8051_OP_8B, - cpu8051_OP_8C, - cpu8051_OP_8D, - cpu8051_OP_8E, - cpu8051_OP_8F, - cpu8051_OP_90, - cpu8051_OP_91, - cpu8051_OP_92, - cpu8051_OP_93, - cpu8051_OP_94, - cpu8051_OP_95, - cpu8051_OP_96, - cpu8051_OP_97, - cpu8051_OP_98, - cpu8051_OP_99, - cpu8051_OP_9A, - cpu8051_OP_9B, - cpu8051_OP_9C, - cpu8051_OP_9D, - cpu8051_OP_9E, - cpu8051_OP_9F, - cpu8051_OP_A0, - cpu8051_OP_A1, - cpu8051_OP_A2, - cpu8051_OP_A3, - cpu8051_OP_A4, - cpu8051_OP_A5, - cpu8051_OP_A6, - cpu8051_OP_A7, - cpu8051_OP_A8, - cpu8051_OP_A9, - cpu8051_OP_AA, - cpu8051_OP_AB, - cpu8051_OP_AC, - cpu8051_OP_AD, - cpu8051_OP_AE, - cpu8051_OP_AF, - cpu8051_OP_B0, - cpu8051_OP_B1, - cpu8051_OP_B2, - cpu8051_OP_B3, - cpu8051_OP_B4, - cpu8051_OP_B5, - cpu8051_OP_B6, - cpu8051_OP_B7, - cpu8051_OP_B8, - cpu8051_OP_B9, - cpu8051_OP_BA, - cpu8051_OP_BB, - cpu8051_OP_BC, - cpu8051_OP_BD, - cpu8051_OP_BE, - cpu8051_OP_BF, - cpu8051_OP_C0, - cpu8051_OP_C1, - cpu8051_OP_C2, - cpu8051_OP_C3, - cpu8051_OP_C4, - cpu8051_OP_C5, - cpu8051_OP_C6, - cpu8051_OP_C7, - cpu8051_OP_C8, - cpu8051_OP_C9, - cpu8051_OP_CA, - cpu8051_OP_CB, - cpu8051_OP_CC, - cpu8051_OP_CD, - cpu8051_OP_CE, - cpu8051_OP_CF, - cpu8051_OP_D0, - cpu8051_OP_D1, - cpu8051_OP_D2, - cpu8051_OP_D3, - cpu8051_OP_D4, - cpu8051_OP_D5, - cpu8051_OP_D6, - cpu8051_OP_D7, - cpu8051_OP_D8, - cpu8051_OP_D9, - cpu8051_OP_DA, - cpu8051_OP_DB, - cpu8051_OP_DC, - cpu8051_OP_DD, - cpu8051_OP_DE, - cpu8051_OP_DF, - cpu8051_OP_E0, - cpu8051_OP_E1, - cpu8051_OP_E2, - cpu8051_OP_E3, - cpu8051_OP_E4, - cpu8051_OP_E5, - cpu8051_OP_E6, - cpu8051_OP_E7, - cpu8051_OP_E8, - cpu8051_OP_E9, - cpu8051_OP_EA, - cpu8051_OP_EB, - cpu8051_OP_EC, - cpu8051_OP_ED, - cpu8051_OP_EE, - cpu8051_OP_EF, - cpu8051_OP_F0, - cpu8051_OP_F1, - cpu8051_OP_F2, - cpu8051_OP_F3, - cpu8051_OP_F4, - cpu8051_OP_F5, - cpu8051_OP_F6, - cpu8051_OP_F7, - cpu8051_OP_F8, - cpu8051_OP_F9, - cpu8051_OP_FA, - cpu8051_OP_FB, - cpu8051_OP_FC, - cpu8051_OP_FD, - cpu8051_OP_FE, - cpu8051_OP_FF -}; -#else -OPCODE_FP opcode_table[256]; -#endif - - -#endif /* INSTRUCTIONS_8051_H */ diff -Nru emu8051-1.1.1/src/keyboard.c emu8051-2.0.1/src/keyboard.c --- emu8051-1.1.1/src/keyboard.c 2011-10-29 21:06:32.000000000 +0000 +++ emu8051-2.0.1/src/keyboard.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,77 +0,0 @@ -/* - * keyboard.c - * - * Copyright (C) 1999 Jonathan St-André - * Copyright (C) 1999 Hugo Villeneuve - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include -#include - -static struct termios orig, newtio; -static int peek = -1; - -int -kbhit(void) -{ - char ch; - int nread; - if (peek != -1) - return 1; - newtio.c_cc[VMIN] = 0; - tcsetattr(0, TCSANOW, &newtio); - nread = read(0, &ch, 1); - newtio.c_cc[VMIN] = 1; - tcsetattr(0, TCSANOW, &newtio); - if (nread == 1) { - peek = ch; - return 1; - } - return 0; -} - -int -getch(void) -{ - char ch; - if (peek != -1) { - ch = peek; - peek = -1; - return ch; - } - read(0, &ch, 1); - return ch; -} - -void -InitUnixKB(void) -{ - tcgetattr(0, &orig); - newtio = orig; - newtio.c_lflag &= ~ICANON; - newtio.c_lflag &= ~ECHO; - newtio.c_lflag &= ~ISIG; - newtio.c_cc[VMIN] = 1; - newtio.c_cc[VTIME] = 0; - tcsetattr(0, TCSANOW, &newtio); -} - -void -ResetUnixKB(void) -{ - tcsetattr(0, TCSANOW, &orig); -} diff -Nru emu8051-1.1.1/src/keyboard.h emu8051-2.0.1/src/keyboard.h --- emu8051-1.1.1/src/keyboard.h 2011-10-29 21:06:32.000000000 +0000 +++ emu8051-2.0.1/src/keyboard.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,37 +0,0 @@ -/* - * keyboard.h - * - * Copyright (C) 1999 Jonathan St-André - * Copyright (C) 1999 Hugo Villeneuve - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef _KEYBOARD_H_ -#define _KEYBOARD_H_ - -int -kbhit(void); - -int -getch(void); - -void -InitUnixKB(void); - -void -ResetUnixKB(void); - -#endif /* _KEYBOARD_H_ */ diff -Nru emu8051-1.1.1/src/Makefile.am emu8051-2.0.1/src/Makefile.am --- emu8051-1.1.1/src/Makefile.am 2011-11-20 21:34:08.000000000 +0000 +++ emu8051-2.0.1/src/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,75 +0,0 @@ -# This file is processed by GNU automake to generate Makefile.in - -INCLUDES = \ - -I$(top_srcdir) \ - -I$(top_srcdir)/pixmaps \ - $(GTK_CFLAGS) - -bin_PROGRAMS = emu8051-cli - -# instructions_8051.c must be first, because it and other files -# (instructions_8051.h and disasm.h) are automatically generated by a perl -# script, and other source files include them (the .h). -common_SOURCES = \ - instructions_8051.c \ - options.c \ - options.h \ - hexfile.c \ - hexfile.h \ - cpu8051.c \ - cpu8051.h \ - memory.c \ - memory.h \ - common.h \ - reg8051.h - -if USE_GTK - bin_PROGRAMS += emu8051-gtk - - emu8051_gtk_SOURCES = \ - $(common_SOURCES) \ - emugtk.c \ - emugtk.h \ - memwin.c \ - memwin.h \ - pgmwin.c \ - pgmwin.h \ - regwin.c \ - regwin.h \ - filemenu.c \ - filemenu.h \ - viewmenu.c \ - viewmenu.h \ - helpmenu.c \ - helpmenu.h \ - messagebox.c \ - messagebox.h \ - gtksizes.h - emu8051_gtk_LDADD = $(GTK_LIBS) -endif - -emu8051_cli_SOURCES = \ - $(common_SOURCES) \ - emuconsole.c \ - keyboard.c \ - keyboard.h - -# These files are generated automatically by a perl script. -instructions_8051.c instructions_8051.h disasm.h : opcode2c.pl opcodes.lst - ./opcode2c.pl - -CLEANFILES = *~ - -DISTCLEANFILES = .deps/*.P - -MAINTAINERCLEANFILES = \ - Makefile.in \ - instructions_8051.c \ - instructions_8051.h \ - disasm.h - -EXTRA_DIST = \ - opcode2c.pl \ - opcodes.lst \ - instructions_8051.h \ - disasm.h diff -Nru emu8051-1.1.1/src/Makefile.in emu8051-2.0.1/src/Makefile.in --- emu8051-1.1.1/src/Makefile.in 2011-12-12 04:55:41.000000000 +0000 +++ emu8051-2.0.1/src/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,576 +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@ - -# This file is processed by GNU automake to generate Makefile.in - -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 = : -bin_PROGRAMS = emu8051-cli$(EXEEXT) $(am__EXEEXT_1) -@USE_GTK_TRUE@am__append_1 = emu8051-gtk -subdir = src -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/config/debug.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -@USE_GTK_TRUE@am__EXEEXT_1 = emu8051-gtk$(EXEEXT) -am__installdirs = "$(DESTDIR)$(bindir)" -PROGRAMS = $(bin_PROGRAMS) -am__objects_1 = instructions_8051.$(OBJEXT) options.$(OBJEXT) \ - hexfile.$(OBJEXT) cpu8051.$(OBJEXT) memory.$(OBJEXT) -am_emu8051_cli_OBJECTS = $(am__objects_1) emuconsole.$(OBJEXT) \ - keyboard.$(OBJEXT) -emu8051_cli_OBJECTS = $(am_emu8051_cli_OBJECTS) -emu8051_cli_LDADD = $(LDADD) -am__emu8051_gtk_SOURCES_DIST = instructions_8051.c options.c options.h \ - hexfile.c hexfile.h cpu8051.c cpu8051.h memory.c memory.h \ - common.h reg8051.h emugtk.c emugtk.h memwin.c memwin.h \ - pgmwin.c pgmwin.h regwin.c regwin.h filemenu.c filemenu.h \ - viewmenu.c viewmenu.h helpmenu.c helpmenu.h messagebox.c \ - messagebox.h gtksizes.h -@USE_GTK_TRUE@am_emu8051_gtk_OBJECTS = $(am__objects_1) \ -@USE_GTK_TRUE@ emugtk.$(OBJEXT) memwin.$(OBJEXT) \ -@USE_GTK_TRUE@ pgmwin.$(OBJEXT) regwin.$(OBJEXT) \ -@USE_GTK_TRUE@ filemenu.$(OBJEXT) viewmenu.$(OBJEXT) \ -@USE_GTK_TRUE@ helpmenu.$(OBJEXT) messagebox.$(OBJEXT) -emu8051_gtk_OBJECTS = $(am_emu8051_gtk_OBJECTS) -am__DEPENDENCIES_1 = -@USE_GTK_TRUE@emu8051_gtk_DEPENDENCIES = $(am__DEPENDENCIES_1) -DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/config/depcomp -am__depfiles_maybe = depfiles -am__mv = mv -f -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -AM_V_CC = $(am__v_CC_$(V)) -am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) -am__v_CC_0 = @echo " CC " $@; -AM_V_at = $(am__v_at_$(V)) -am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) -am__v_at_0 = @ -CCLD = $(CC) -LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CCLD = $(am__v_CCLD_$(V)) -am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) -am__v_CCLD_0 = @echo " CCLD " $@; -AM_V_GEN = $(am__v_GEN_$(V)) -am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) -am__v_GEN_0 = @echo " GEN " $@; -SOURCES = $(emu8051_cli_SOURCES) $(emu8051_gtk_SOURCES) -DIST_SOURCES = $(emu8051_cli_SOURCES) $(am__emu8051_gtk_SOURCES_DIST) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -GREP = @GREP@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -OBJEXT = @OBJEXT@ -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@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_aux_dir = @ac_aux_dir@ -ac_ct_CC = @ac_ct_CC@ -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_alias = @build_alias@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host_alias = @host_alias@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -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_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -INCLUDES = \ - -I$(top_srcdir) \ - -I$(top_srcdir)/pixmaps \ - $(GTK_CFLAGS) - - -# instructions_8051.c must be first, because it and other files -# (instructions_8051.h and disasm.h) are automatically generated by a perl -# script, and other source files include them (the .h). -common_SOURCES = \ - instructions_8051.c \ - options.c \ - options.h \ - hexfile.c \ - hexfile.h \ - cpu8051.c \ - cpu8051.h \ - memory.c \ - memory.h \ - common.h \ - reg8051.h - -@USE_GTK_TRUE@emu8051_gtk_SOURCES = \ -@USE_GTK_TRUE@ $(common_SOURCES) \ -@USE_GTK_TRUE@ emugtk.c \ -@USE_GTK_TRUE@ emugtk.h \ -@USE_GTK_TRUE@ memwin.c \ -@USE_GTK_TRUE@ memwin.h \ -@USE_GTK_TRUE@ pgmwin.c \ -@USE_GTK_TRUE@ pgmwin.h \ -@USE_GTK_TRUE@ regwin.c \ -@USE_GTK_TRUE@ regwin.h \ -@USE_GTK_TRUE@ filemenu.c \ -@USE_GTK_TRUE@ filemenu.h \ -@USE_GTK_TRUE@ viewmenu.c \ -@USE_GTK_TRUE@ viewmenu.h \ -@USE_GTK_TRUE@ helpmenu.c \ -@USE_GTK_TRUE@ helpmenu.h \ -@USE_GTK_TRUE@ messagebox.c \ -@USE_GTK_TRUE@ messagebox.h \ -@USE_GTK_TRUE@ gtksizes.h - -@USE_GTK_TRUE@emu8051_gtk_LDADD = $(GTK_LIBS) -emu8051_cli_SOURCES = \ - $(common_SOURCES) \ - emuconsole.c \ - keyboard.c \ - keyboard.h - -CLEANFILES = *~ -DISTCLEANFILES = .deps/*.P -MAINTAINERCLEANFILES = \ - Makefile.in \ - instructions_8051.c \ - instructions_8051.h \ - disasm.h - -EXTRA_DIST = \ - opcode2c.pl \ - opcodes.lst \ - instructions_8051.h \ - disasm.h - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .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/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/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): -install-binPROGRAMS: $(bin_PROGRAMS) - @$(NORMAL_INSTALL) - test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" - @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ - for p in $$list; do echo "$$p $$p"; done | \ - sed 's/$(EXEEXT)$$//' | \ - while read p p1; do if test -f $$p; \ - then echo "$$p"; echo "$$p"; else :; fi; \ - done | \ - sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ - -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ - sed 'N;N;N;s,\n, ,g' | \ - $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ - { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ - if ($$2 == $$4) files[d] = files[d] " " $$1; \ - else { print "f", $$3 "/" $$4, $$1; } } \ - END { for (d in files) print "f", d, files[d] }' | \ - while read type dir files; do \ - if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ - test -z "$$files" || { \ - echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ - $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ - } \ - ; done - -uninstall-binPROGRAMS: - @$(NORMAL_UNINSTALL) - @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ - files=`for p in $$list; do echo "$$p"; done | \ - sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ - -e 's/$$/$(EXEEXT)/' `; \ - test -n "$$list" || exit 0; \ - echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(bindir)" && rm -f $$files - -clean-binPROGRAMS: - -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) -emu8051-cli$(EXEEXT): $(emu8051_cli_OBJECTS) $(emu8051_cli_DEPENDENCIES) - @rm -f emu8051-cli$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(emu8051_cli_OBJECTS) $(emu8051_cli_LDADD) $(LIBS) -emu8051-gtk$(EXEEXT): $(emu8051_gtk_OBJECTS) $(emu8051_gtk_DEPENDENCIES) - @rm -f emu8051-gtk$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(emu8051_gtk_OBJECTS) $(emu8051_gtk_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu8051.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/emuconsole.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/emugtk.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filemenu.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/helpmenu.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hexfile.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/instructions_8051.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/keyboard.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memory.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memwin.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/messagebox.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/options.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pgmwin.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/regwin.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/viewmenu.Po@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -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 $(PROGRAMS) -installdirs: - for dir in "$(DESTDIR)$(bindir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -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: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) - -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) - -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." - -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) -clean: clean-am - -clean-am: clean-binPROGRAMS clean-generic 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-binPROGRAMS - -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 - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-binPROGRAMS - -.MAKE: install-am install-strip - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ - clean-generic ctags distclean distclean-compile \ - distclean-generic distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-binPROGRAMS \ - 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 pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-binPROGRAMS - - -# These files are generated automatically by a perl script. -instructions_8051.c instructions_8051.h disasm.h : opcode2c.pl opcodes.lst - ./opcode2c.pl - -# 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 -Nru emu8051-1.1.1/src/memory.c emu8051-2.0.1/src/memory.c --- emu8051-1.1.1/src/memory.c 2011-11-20 21:12:20.000000000 +0000 +++ emu8051-2.0.1/src/memory.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,156 +0,0 @@ -/* - * memory.c - * - * Copyright (C) 1999 Jonathan St-André - * Copyright (C) 1999 Hugo Villeneuve - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include -#include - -#include "common.h" -#include "cpu8051.h" -#include "hexfile.h" -#include "memory.h" - -#define PGM_MEM_SIZE 65536 -#define INT_MEM_SIZE 256 /* IRAM = Direct addresses $00 to $7F - * SFR = Direct addresses $80 to $FF */ -#define EXT_MEM_SIZE 65536 - -static u_int8_t pgm_mem[PGM_MEM_SIZE]; -static u_int8_t int_mem[INT_MEM_SIZE]; -static u_int8_t ext_mem[EXT_MEM_SIZE]; - -void -memory_write8(int memory_id, unsigned long address, u_int8_t value) -{ - switch (memory_id) { - case PGM_MEM_ID: - if (address >= PGM_MEM_SIZE) { - printf("Address (%lu) is greater than PGM_MEM_SIZE\n", - address); - return; - } else - pgm_mem[address] = value; - break; - case INT_MEM_ID: - if (address >= INT_MEM_SIZE) { - printf("Address (%lu) is greater than INT_MEM_SIZE\n", - address); - return; - } else - int_mem[address] = value; - break; - case EXT_MEM_ID: - if (address >= EXT_MEM_SIZE) { - printf("Address (%lu) is greater than EXT_MEM_SIZE\n", - address); - return; - } else - ext_mem[address] = value; - break; - default: - /* Error. */ - break; - } -} - -u_int8_t -memory_read8(int memory_id, unsigned long address) -{ - switch (memory_id) { - case PGM_MEM_ID: - if (address < PGM_MEM_SIZE) - return pgm_mem[address]; - else { - printf("Address (%lu) is greater than PGM_MEM_SIZE\n", - address); - return 0; - } - break; - case INT_MEM_ID: - if (address < INT_MEM_SIZE) - return int_mem[address]; - else { - printf("Address (%lu) is greater than INT_MEM_SIZE\n", - address); - return 0; - } - break; - case EXT_MEM_ID: - if (address < EXT_MEM_SIZE) - return ext_mem[address]; - else { - printf("Address (%lu) is greater than EXT_MEM_SIZE\n", - address); - return 0; - } - break; - default: - /* Error. */ - return 0; - break; - } -} - -/* Dump memory */ -void -DumpMem(char *Address, char *Asize, int memory_id) -{ - unsigned int MemAddress; - int size; - int Offset, Column; - - if (strlen(Address) != 0) { - if (STREQ(Address, "PC")) - MemAddress = cpu8051.pc; - else - MemAddress = Ascii2Hex(Address, strlen(Address)); - } else { - MemAddress = 0; - } - - if (strlen(Asize) != 0) { - size = Ascii2Hex(Asize, strlen(Asize)); - } else { - size = 256; /* Default size if not specified. */ - } - - for (Offset = 0; Offset < size; Offset += 16) { - unsigned char data[16]; - - printf("%.4X ", MemAddress + Offset); - - for (Column = 0; Column < 16; Column++) { - data[Column] = memory_read8(memory_id, MemAddress + - Offset + Column); - printf(" %.2X", (int) data[Column]); - } - printf(" "); - - /* Display any ASCII characters */ - for (Column = 0; Column < 16; Column++) { - if ((int) data[Column] >= 32 && - (int) data[Column] <= 126) { - printf("%c", data[Column]); - } else - printf("."); - } - printf("\n"); - } -} diff -Nru emu8051-1.1.1/src/memory.h emu8051-2.0.1/src/memory.h --- emu8051-1.1.1/src/memory.h 2011-11-20 21:09:15.000000000 +0000 +++ emu8051-2.0.1/src/memory.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,42 +0,0 @@ -/* - * memory.h - * - * Copyright (C) 1999 Jonathan St-André - * Copyright (C) 1999 Hugo Villeneuve - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef MEMORY_H -#define MEMORY_H 1 - -#include - -enum { - PGM_MEM_ID, - INT_MEM_ID, - EXT_MEM_ID -}; - -void -memory_write8(int memory_id, unsigned long address, u_int8_t value); - -u_int8_t -memory_read8(int memory_id, unsigned long address); - -void -DumpMem(char *Address, char *Asize, int memory_id); - -#endif /* MEMORY_H */ diff -Nru emu8051-1.1.1/src/memwin.c emu8051-2.0.1/src/memwin.c --- emu8051-1.1.1/src/memwin.c 2011-10-29 21:06:32.000000000 +0000 +++ emu8051-2.0.1/src/memwin.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,129 +0,0 @@ -/* - * memwin.c - * - * Copyright (C) 1999 Jonathan St-André - * Copyright (C) 1999 Hugo Villeneuve - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#if HAVE_CONFIG_H -# include "config.h" -#endif - -#include - -#include "common.h" -#include "memory.h" -#include "hexfile.h" -#include "cpu8051.h" -#include "gtksizes.h" -#include "memwin.h" - -static GtkWidget *memclist; - -GtkWidget * -memwin_init(int width, int height) -{ - int i; - GtkWidget *fixed_frame; - PangoFontDescription *pango_font; - char *memdummy[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - - fixed_frame = gtk_frame_new(0); - gtk_frame_set_shadow_type(GTK_FRAME(fixed_frame), - GTK_SHADOW_ETCHED_OUT); - gtk_widget_set_usize(GTK_WIDGET(fixed_frame), width, height); - - memclist = gtk_clist_new(18); - gtk_clist_set_selection_mode(GTK_CLIST(memclist), GTK_SELECTION_SINGLE); - gtk_widget_set_usize(GTK_WIDGET(memclist), 620, 250); - - for (i = 0; i < 18; i++) { - gtk_clist_set_column_justification( - GTK_CLIST(memclist), i, GTK_JUSTIFY_LEFT); - } - - gtk_clist_set_column_width(GTK_CLIST(memclist), 0, - 5 * FIXED_FONT_SYMBOL_WIDTH); - - for (i = 1; i < 17; i++) - gtk_clist_set_column_width(GTK_CLIST(memclist), i, - 2 * FIXED_FONT_SYMBOL_WIDTH); - - gtk_clist_set_column_width(GTK_CLIST(memclist), 17, - 16 * FIXED_FONT_SYMBOL_WIDTH); - - pango_font = pango_font_description_from_string(FIXED_FONT); - gtk_widget_modify_font(memclist, pango_font); - - for (i = 0; i < 16; i++) - gtk_clist_append(GTK_CLIST(memclist), memdummy); - - gtk_container_add(GTK_CONTAINER(fixed_frame), memclist); - - return fixed_frame; -} - -/* Dump 16 rows of 16 bytes from Address in Memory (direct addressing) */ -void -memwin_DumpD(char *MemAddress) -{ - char TextTmp[1024]; - int row, column, TextLength; - unsigned int Address; - - if (strlen(MemAddress) != 0) { - if (STREQ(MemAddress, "PC")) - Address = cpu8051.pc; - else - Address = Ascii2Hex(MemAddress, strlen(MemAddress)); - } else { - Address = 0; - } - - gtk_clist_freeze(GTK_CLIST(memclist)); - - for (row = 0; row < 16; row++) { - sprintf(TextTmp, "%.4X", Address); - gtk_clist_set_text(GTK_CLIST(memclist), row, 0, TextTmp); - - for (column = 0; column < 16; column++) { - sprintf(TextTmp, "%.2X", - (int) cpu8051_ReadD(Address + column)); - gtk_clist_set_text(GTK_CLIST(memclist), row, - column + 1, TextTmp); - } - - TextLength = 0; - for (column = 0; column < 16; column++) { - if (((int) cpu8051_ReadD(Address + column) >= 32) && - ((int) cpu8051_ReadD(Address + column) <= 126)) - TextLength += sprintf( - &TextTmp[TextLength], - "%c", cpu8051_ReadD(Address + column)); - else - TextLength += - sprintf(&TextTmp[TextLength], "."); - } - gtk_clist_set_text(GTK_CLIST(memclist), row, 17, TextTmp); - - Address += 16; - } - - gtk_clist_select_row(GTK_CLIST(memclist), 0, 0); - gtk_clist_thaw(GTK_CLIST(memclist)); -} diff -Nru emu8051-1.1.1/src/memwin.h emu8051-2.0.1/src/memwin.h --- emu8051-1.1.1/src/memwin.h 2011-10-29 21:06:32.000000000 +0000 +++ emu8051-2.0.1/src/memwin.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,33 +0,0 @@ -/* - * memwin.h - * - * Copyright (C) 1999 Jonathan St-André - * Copyright (C) 1999 Hugo Villeneuve - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef MEMWIN_H -#define MEMWIN_H 1 - -#include - -GtkWidget * -memwin_init(int width, int height); - -void -memwin_DumpD(char *Address); - -#endif /* MEMWIN_H */ diff -Nru emu8051-1.1.1/src/messagebox.c emu8051-2.0.1/src/messagebox.c --- emu8051-1.1.1/src/messagebox.c 2011-10-29 21:06:32.000000000 +0000 +++ emu8051-2.0.1/src/messagebox.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,163 +0,0 @@ -/* - * messagebox.c - * - * Copyright (C) 1999 Jonathan St-André - * Copyright (C) 1999 Hugo Villeneuve - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#if HAVE_CONFIG_H -# include "config.h" -#endif - -#include - -#include "common.h" -#include "messagebox.h" - -#define MESSAGE_DIALOG_BORDER 25 - -#define BUTTON_TEXT_BORDER 3 - -/* This function is used to adjust the border around the text in a button. */ -static GtkWidget * -AddTextButton(gchar *button_text) -{ - GtkWidget *button; - GtkWidget *label; - GtkWidget *label_window; - - /* - * The GtkLabel widget is one of a few GTK+ widgets that don't create - * their own window to render themselves into. Instead, they draw - * themselves directly onto their parents window. This means that in - * order to set a property for a GtkLabel widget, you need to change the - * property of its parent, i.e. the object that you pack it into. - * Another solution (short term workaround) is to put the label widget - * inside another widget that does get its own window, like the - * 'ViewPort' or 'EventBox' widget. - */ - - /* - * Using workaround described above to set the border width of 'label' - * widget. - */ - label_window = gtk_event_box_new(); - - /* Creating our label. */ - label = gtk_label_new(button_text); - - /* Adding label widget to label_window widget. */ - gtk_container_add(GTK_CONTAINER(label_window), label); - - /* - * Changing border width of the label widget by way of label_window - * widget. - */ - gtk_container_set_border_width(GTK_CONTAINER(label_window), - BUTTON_TEXT_BORDER); - - /* Create the button. */ - button = gtk_button_new(); - - /* Adding label to button. */ - gtk_container_add(GTK_CONTAINER(button), label_window); - - return button; -} - -void -ShowMessage(gchar *title, gchar *message, int justification, int font_style) -{ - GtkWidget *dialog; - GtkWidget *label; - GtkWidget *okay_button; - GtkWidget *label_window; - GtkWidget *center; - - /* Set-up a dialog window, centered on the screen. */ - dialog = gtk_dialog_new(); - gtk_window_set_title(GTK_WINDOW(dialog), title); - gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER); - - /* - * To have the main window of our application being unusable while using - * the dialog. - */ - gtk_window_set_modal(GTK_WINDOW(dialog), TRUE); - - /* - * The GtkLabel widget is one of a few GTK+ widgets that don't create - * their own window to render themselves into. Instead, they draw - * themselves directly onto their parents window. This means that in - * order to set a property for a GtkLabel widget, you need to change the - * property of its parent, i.e. the object that you pack it into. - * Another solution (short term workaround) is to put the label widget - * inside another widget that does get its own window, like the - * 'ViewPort' or 'EventBox' widget. - */ - - /* - * Using workaround described above to set the border width of 'label' - * widget. - */ - label_window = gtk_event_box_new(); - - /* Creating our label. */ - label = gtk_label_new(message); - gtk_label_set_justify(GTK_LABEL(label), justification); - - if (font_style == MESSAGE_DIALOG_FIXED_FONT) { - PangoFontDescription *pango_font; - - pango_font = pango_font_description_from_string(FIXED_FONT); - gtk_widget_modify_font(label, pango_font); - } - - /* Adding label widget to label_window widget. */ - gtk_container_add(GTK_CONTAINER(label_window), label); - - /* - * Changing border width of the label widget by way of label_window - * widget. - */ - gtk_container_set_border_width(GTK_CONTAINER(label_window), - MESSAGE_DIALOG_BORDER); - - /* xalign, yalign, xscale, yscale */ - center = gtk_alignment_new(0.5, 0.5, 0.0, 0.0); - - /* Create the OK button. */ - okay_button = AddTextButton("OK"); - - /* Ensure that the dialog box is destroyed when the user clicks ok. */ - gtk_signal_connect_object(GTK_OBJECT(okay_button), "clicked", - GTK_SIGNAL_FUNC(gtk_widget_destroy), - (gpointer) dialog); - - /* Add the OK button to the alignment widget. */ - gtk_container_add(GTK_CONTAINER(center), okay_button); - /* Add the alignment widget to the dialog window. */ - gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->action_area), - center); - - /* Add the label_window to the dialog window. */ - gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), - label_window); - - /* Show everything we've added to the dialog. */ - gtk_widget_show_all(dialog); -} diff -Nru emu8051-1.1.1/src/messagebox.h emu8051-2.0.1/src/messagebox.h --- emu8051-1.1.1/src/messagebox.h 2011-10-29 21:06:32.000000000 +0000 +++ emu8051-2.0.1/src/messagebox.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,33 +0,0 @@ -/* - * messagebox.h - * - * Copyright (C) 1999 Jonathan St-André - * Copyright (C) 1999 Hugo Villeneuve - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef MESSAGEBOX_H -#define MESSAGEBOX_H 1 - -#include - -#define MESSAGE_DIALOG_NORMAL_FONT 0 -#define MESSAGE_DIALOG_FIXED_FONT 1 - -void -ShowMessage(gchar *title, gchar *message, int justification, int font_style); - -#endif /* MESSAGEBOX_H */ diff -Nru emu8051-1.1.1/src/opcode2c.pl emu8051-2.0.1/src/opcode2c.pl --- emu8051-1.1.1/src/opcode2c.pl 2011-10-29 21:06:32.000000000 +0000 +++ emu8051-2.0.1/src/opcode2c.pl 1970-01-01 00:00:00.000000000 +0000 @@ -1,883 +0,0 @@ -#!/usr/bin/perl -# -# Copyright (C) 1999 Jonathan St-André -# Copyright (C) 1999 Hugo Villeneuve -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - -open INST_DEF, ">instructions_8051.h" or die "Error creating : $!\n"; -open INST_IMP, ">instructions_8051.c" or die "Error creating : $!\n"; -open OPCODELST, "opcodes.lst" or die "Error opening : $!\n"; -open DISASM_H, ">disasm.h" or die "Error creating : $!\n"; - -# Header for instructions_8051.c -print INST_IMP "/*\n"; -print INST_IMP " * instructions_8051.c\n"; -print INST_IMP " *\n"; -print INST_IMP " * Do not modify this file directly, as it was created by opcode2c.pl\n"; -print INST_IMP " * Any modifications made directly to this file will be lost.\n"; -print INST_IMP " *\n"; -print INST_IMP " * Copyright (C) 1999 Jonathan St-André\n"; -print INST_IMP " * Copyright (C) 1999 Hugo Villeneuve \n"; -print INST_IMP " *\n"; -print INST_IMP " * This program is free software; you can redistribute it and/or modify\n"; -print INST_IMP " * it under the terms of the GNU General Public License as published by\n"; -print INST_IMP " * the Free Software Foundation; either version 2 of the License, or\n"; -print INST_IMP " * (at your option) any later version.\n"; -print INST_IMP " *\n"; -print INST_IMP " * This program is distributed in the hope that it will be useful,\n"; -print INST_IMP " * but WITHOUT ANY WARRANTY; without even the implied warranty of\n"; -print INST_IMP " * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"; -print INST_IMP " * GNU General Public License for more details.\n"; -print INST_IMP " *\n"; -print INST_IMP " * You should have received a copy of the GNU General Public License\n"; -print INST_IMP " * along with this program; if not, write to the Free Software\n"; -print INST_IMP " * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.\n"; -print INST_IMP "*/\n\n"; -print INST_IMP "/* Define only here, for not having extern scope on local variables. */\n"; -print INST_IMP "#define INSTRUCTIONS_8051_M 1\n\n\n"; -print INST_IMP "#include \"reg8051.h\"\n"; -print INST_IMP "#include \"cpu8051.h\"\n"; -print INST_IMP "#include \"memory.h\"\n"; -print INST_IMP "#include \"instructions_8051.h\"\n\n\n"; - -# Header for disasm.h -print DISASM_H "/*\n"; -print DISASM_H " * disasm.h\n"; -print DISASM_H " *\n"; -print DISASM_H " * Do not modify this file directly, as it was created by opcode2c.pl\n"; -print DISASM_H " * Any modifications made directly to this file will be lost.\n"; -print DISASM_H " *\n"; -print DISASM_H " * Copyright (C) 1999 Jonathan St-André\n"; -print DISASM_H " * Copyright (C) 1999 Hugo Villeneuve \n"; -print DISASM_H " *\n"; -print DISASM_H " * This program is free software; you can redistribute it and/or modify\n"; -print DISASM_H " * it under the terms of the GNU General Public License as published by\n"; -print DISASM_H " * the Free Software Foundation; either version 2 of the License, or\n"; -print DISASM_H " * (at your option) any later version.\n"; -print DISASM_H " *\n"; -print DISASM_H " * This program is distributed in the hope that it will be useful,\n"; -print DISASM_H " * but WITHOUT ANY WARRANTY; without even the implied warranty of\n"; -print DISASM_H " * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"; -print DISASM_H " * GNU General Public License for more details.\n"; -print DISASM_H " *\n"; -print DISASM_H " * You should have received a copy of the GNU General Public License\n"; -print DISASM_H " * along with this program; if not, write to the Free Software\n"; -print DISASM_H " * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.\n"; -print DISASM_H "*/\n\n"; -print DISASM_H "#ifndef DISASM_H\n"; -print DISASM_H "#define DISASM_H 1\n\n"; - -$nbinst=0; -$nbaddr=0; -$nbargs=0; -$instnumb=0; - -$ligne=; -$ligne=; -while($ligne=) { - chop $ligne; - if (length $ligne < 2) {next;} - @wordlist=split ' ',$ligne; - $nbword=@wordlist; - $instruction=$wordlist[2]; - for($i=3;$i<($nbword-2);$i++) {$instruction="$instruction $wordlist[$i]";} - - $a_instruction[$instnumb]=$instruction; - $a_bytes[$instnumb]=$wordlist[$nbword-2]; - $a_cycles[$instnumb]=$wordlist[$nbword-1]; - $a_opcodehex[$instnumb]=$wordlist[1]; - $a_opcodebin[$instnumb]=$wordlist[0]; - - $instfunction[$instnumb]="CPU8051::OP_$wordlist[1]"; - - $instargs[$instnumb << 2]=$instargs[($instnumb << 2) + 1]=$instargs[($instnumb << 2) + 2]=$instargs[($instnumb << 2) + 3]=0; - if ($nbword > 5) { - @argslist=split /\,/,$wordlist[3]; - $argslistsize=@argslist; - $instargs[$instnumb << 2]=$argslistsize; - for ($i=0;$i<$argslistsize;$i++) { - if (not exists $argstypes{$argslist[$i]}) { - $argstypes[$nbargs]=$argslist[$i]; - $argstypes{$argslist[$i]}=$nbargs++; - } - $instargs[($instnumb << 2) + $i + 1]=$argstypes{$argslist[$i]}; - } - } - - if (not exists $insttext{$wordlist[2]}) { - $insttext[$nbinst]=$wordlist[2]; - $insttext{$wordlist[2]}=$nbinst++; - } - - $insttype[$instnumb]=$insttext{$wordlist[2]}; - - if ( not exists $addrmode{$wordlist[3]}) { - $addrmode[$nbaddr]=$wordlist[3]; - $addrmode{$wordlist[3]}=$nbaddr++; - } - - $nbbytes[$instnumb]=$wordlist[$nbword-2]; - - $instaddr[$instnumb]=$addrmode{$wordlist[3]}; - - $instnumb++; -} -# ------------------------------------------------------------------------------ -print DISASM_H "/*\n"; -print DISASM_H " * For all 256 opcodes, the value in this table gives the instruction type\n"; -print DISASM_H " * ex.: MOV, INC, CLR, CPL,...\n"; -print DISASM_H " * To know what is the instruction type, use\n"; -print DISASM_H " * the number as an offset in the InstTextTbl[]\n"; -print DISASM_H " */\n"; -print DISASM_H "static int InstTypesTbl[] = {\n"; -for($i=0;$i<256;$i++) { - print DISASM_H " $insttype[$i]"; - ($i != 255) and print DISASM_H ","; - if (($i+1) % 16 == 0) { print DISASM_H "\n"; } -} -print DISASM_H "};\n"; -print DISASM_H "\n"; -# ------------------------------------------------------------------------------ -print DISASM_H "/* Size(in bytes) of each instruction (offset in table is instruction opcode) */\n"; -print DISASM_H "static int InstSizesTbl[] = {\n"; -for($i=0;$i<256;$i++) { - print DISASM_H " $nbbytes[$i]"; - ($i != 255) and print DISASM_H ","; - if (($i+1) % 16 == 0) { print DISASM_H "\n"; } -} -print DISASM_H "};\n"; -print DISASM_H "\n"; -# ------------------------------------------------------------------------------ -print DISASM_H "/* List of instructions types referenced by InstTypesTbl[] */\n"; -$nbelement=@insttext; -print DISASM_H "\#define InstTextTblLength $nbelement\n"; -$elementnb=0; -print DISASM_H "static char *InstTextTbl[] = {\n"; -foreach $instruc (@insttext) { - print DISASM_H " \"$instruc\""; - ($elementnb++ < $nbelement-1) and print DISASM_H ","; - print DISASM_H "\n"; -} -print DISASM_H "};\n"; -print DISASM_H "\n"; -# ------------------------------------------------------------------------------ -print DISASM_H "/*\n"; -print DISASM_H " * Table describing all arguments types of an instruction\n"; -print DISASM_H " * The table is indexed InstArgTbl[ opcode * 4]\n"; -print DISASM_H " * InstArgTbl[opcode*4 + 1] gives the number of arguments the instruction has\n"; -print DISASM_H " * InstArgTbl[opcode*4 + i] for i=1,2 and 3 give the type of each argument\n"; -print DISASM_H " * for most instructions, the 3rd argument isn't used\n"; -print DISASM_H " * the argument type is referecing to ArgsTextTbl[]\n"; -print DISASM_H " */\n"; -print DISASM_H "\#define InstArgTblLength 256\n"; -print DISASM_H "static int InstArgTbl[] = {\n"; -for($i=0;$i<1024;$i++) { - print DISASM_H " $instargs[$i]"; - ($i != 1023) and print DISASM_H ","; - if (($i+1) % 16 == 0) { print DISASM_H "\n"; } -} -print DISASM_H "};\n"; -print DISASM_H "\n"; -# ------------------------------------------------------------------------------ -print DISASM_H "/*\n"; -print DISASM_H " * List all types of arguments available to instructions\n"; -print DISASM_H " * Referenced by InstArgsTbl[]\n"; -print DISASM_H " */\n"; -$nbelement=@argstypes; -print DISASM_H "\#define ArgsTextTblLength $nbelement\n"; -$elementnb=0; -print DISASM_H "static char *ArgsTextTbl[] = {\n"; -foreach $args (@argstypes) { - print DISASM_H " \"$args\""; - ($elementnb++ < $nbelement-1) and print DISASM_H ","; - print DISASM_H "\n"; -} -print DISASM_H "};\n"; -print DISASM_H "\n"; - -# ------------------------------------------------------------------------------ -for ($i=0 ; $i< 256; $i++) { - print INST_IMP "/*","*"x76,"\n"; - print INST_IMP " * Instruction \"$a_instruction[$i]\" takes $a_cycles[$i] cycle(s) and $a_bytes[$i] byte(s).\n"; - print INST_IMP " ","*"x76,"/\n"; - print INST_IMP "int\n"; - print INST_IMP "cpu8051_OP_$a_opcodehex[$i](void)\n"; -# TEST hugo new... -# print INST_DEF "int OP_$a_opcodehex[$i]( );\n"; - print INST_IMP "{\n"; - - if( $i == 0x85 ) { - # Cas particulier pour MOV direct,direct -> src et dest sont inverses dans la memoire - print INST_IMP " unsigned char srcaddr = memory_read8( PGM_MEM_ID, cpu8051.pc++ );\n"; - print INST_IMP " unsigned char source = cpu8051_ReadD( srcaddr );\n"; - print INST_IMP " unsigned char destaddr = memory_read8( PGM_MEM_ID, cpu8051.pc++ );\n"; - print INST_IMP " unsigned char destination = cpu8051_ReadD( destaddr );\n"; - print INST_IMP " destination = source;\n"; - print INST_IMP " cpu8051_WriteD( destaddr, destination );\n"; - } - else { - if ($instargs[$i*4] > 0) { - $op_destination=$instargs[$i*4+1]; - if ($op_destination == 0) { # addr11 - print INST_IMP " unsigned int addr11 = ( ( memory_read8( PGM_MEM_ID, cpu8051.pc - 1 ) << 3 ) & 0xF00 ) + memory_read8( PGM_MEM_ID, cpu8051.pc++ );\n"; - } - if ($op_destination == 1) { # addr16 - print INST_IMP "unsigned int addr16 = ( memory_read8( PGM_MEM_ID, cpu8051.pc++ ) << 8 );\n"; - print INST_IMP "addr16 += memory_read8( PGM_MEM_ID, cpu8051.pc++ );\n"; - } - if ($op_destination == 2) { # A - print INST_IMP "unsigned char destination = cpu8051_ReadD( _ACC_ );\n"; - } - if ($op_destination == 3) { # direct - print INST_IMP "unsigned char destaddr = memory_read8( PGM_MEM_ID, cpu8051.pc++ );\n"; - print INST_IMP "unsigned char destination = cpu8051_ReadD( destaddr );\n"; - } - if ($op_destination == 4) { # @R0 - print INST_IMP "unsigned char destination = cpu8051_ReadI ( cpu8051_ReadD( BANKPSW + _R0_ ) );\n"; - } - if ($op_destination == 5) { # @R1 - print INST_IMP "unsigned char destination = cpu8051_ReadI ( cpu8051_ReadD( BANKPSW + _R1_ ) );\n"; - } - - if ($op_destination == 6) { # R0 - print INST_IMP "unsigned char destination = cpu8051_ReadD( BANKPSW + _R0_ );\n"; - } - if ($op_destination == 7) { # R1 - print INST_IMP "unsigned char destination = cpu8051_ReadD( BANKPSW + _R1_ );\n"; - } - if ($op_destination == 8) { # R2 - print INST_IMP "unsigned char destination = cpu8051_ReadD( BANKPSW + _R2_ );\n"; - } - if ($op_destination == 9) { # R3 - print INST_IMP "unsigned char destination = cpu8051_ReadD( BANKPSW + _R3_ );\n"; - } - if ($op_destination == 10) { # R4 - print INST_IMP "unsigned char destination = cpu8051_ReadD( BANKPSW + _R4_ );\n"; - } - if ($op_destination == 11) { # R5 - print INST_IMP "unsigned char destination = cpu8051_ReadD( BANKPSW + _R5_ );\n"; - } - if ($op_destination == 12) { # R6 - print INST_IMP "unsigned char destination = cpu8051_ReadD( BANKPSW + _R6_ );\n"; - } - if ($op_destination == 13) { # R7 - print INST_IMP "unsigned char destination = cpu8051_ReadD( BANKPSW + _R7_ );\n"; - } - if ($op_destination == 14) { # bitaddr - print INST_IMP "unsigned char destination, dstbitaddr = memory_read8( PGM_MEM_ID, cpu8051.pc++ );\n"; - print INST_IMP "destination = cpu8051_ReadB( dstbitaddr );\n"; - } - if ($op_destination == 15) { # reladdr - print INST_IMP "cpu8051.pc++;\n"; - print INST_IMP "unsigned int destination = ((char) memory_read8(PGM_MEM_ID, cpu8051.pc - 1)) + cpu8051.pc;\n"; - } - if ($op_destination == 16) { # #data - print INST_IMP "unsigned char destination = memory_read8( PGM_MEM_ID, cpu8051.pc++ );\n"; - } - if ($op_destination == 17) { # C - print INST_IMP "unsigned char destination = ( cpu8051_ReadD( _PSW_ ) >> 7 );\n"; - } - if ($op_destination == 18) { # @A+DPTR - print INST_IMP "unsigned int destination = cpu8051_ReadI( cpu8051_ReadD( _ACC_ ) + cpu8051_ReadD( _DPTRLOW_ ) + ( cpu8051_ReadD( _DPTRHIGH_ ) << 8 ) );\n"; - } -# Mis en commentaire car donnait un warning (destination et source unused variables...) -# if ($op_destination == 20) { # AB -# print INST_IMP "unsigned char destination = cpu8051_ReadD( _ACC_ );\n"; -# print INST_IMP "unsigned char source = cpu8051_ReadD( _B_ );\n"; -# } - if ($op_destination == 21) { # DPTR - print INST_IMP "unsigned int destination = ( cpu8051_ReadD( _DPTRHIGH_ ) << 8 ) + cpu8051_ReadD( _DPTRLOW_ );\n"; - } - if ($op_destination == 22) { # #data16 - print INST_IMP "unsigned char destination = ( memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ) << 8 );\n"; - print INST_IMP "destination += memory_read8( PGM_MEM_ID, (cpu8051.pc)++ );\n"; - } - if ($op_destination == 23) { # /bitaddr - print INST_IMP "unsigned char destination, dstbitaddr = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ );\n"; - print INST_IMP "destination = ( cpu8051_ReadB( dstbitaddr ) ^ 1 );\n"; - } - if ($op_destination == 24) { # @DPTR - print INST_IMP "unsigned char destination = cpu8051_ReadI( ( cpu8051_ReadD( _DPTRHIGH_ ) << 8 ) + cpu8051_ReadD( _DPTRLOW_) );\n"; - } - } - - if ($instargs[$i*4] > 1) { - $op_source=$instargs[$i*4+2]; - if ($op_source == 0) { # addr11 - print INST_IMP "unsigned int addr11 = ( ( memory_read8( PGM_MEM_ID, cpu8051.pc - 1 ) << 3 ) & 0xF00 ) + memory_read8( PGM_MEM_ID, (cpu8051.pc)++ );\n"; - } - if ($op_source == 1) { # addr16 - print INST_IMP "unsigned int addr16 = ( memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ) << 8 );\n"; - print INST_IMP "addr16 += memory_read8( PGM_MEM_ID, (cpu8051.pc)++ );\n"; - } - if ($op_source == 2) { # A - print INST_IMP "unsigned char source = cpu8051_ReadD( _ACC_ );\n"; - } - if ($op_source == 3) { # direct - print INST_IMP "unsigned char srcaddr = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ );\n"; - print INST_IMP "unsigned char source = cpu8051_ReadD( srcaddr );\n"; - } - if ($op_source == 4) { # @R0 - print INST_IMP "unsigned char source = cpu8051_ReadI ( cpu8051_ReadD( BANKPSW + _R0_ ) );\n"; - } - if ($op_source == 5) { # @R1 - print INST_IMP "unsigned char source = cpu8051_ReadI ( cpu8051_ReadD( BANKPSW + _R1_ ) );\n"; - } - if ($op_source == 6) { # R0 - print INST_IMP "unsigned char source = cpu8051_ReadD( BANKPSW + _R0_ );\n"; - } - if ($op_source == 7) { # R1 - print INST_IMP "unsigned char source = cpu8051_ReadD( BANKPSW + _R1_ );\n"; - } - if ($op_source == 8) { # R2 - print INST_IMP "unsigned char source = cpu8051_ReadD( BANKPSW + _R2_ );\n"; - } - if ($op_source == 9) { # R3 - print INST_IMP "unsigned char source = cpu8051_ReadD( BANKPSW + _R3_ );\n"; - } - if ($op_source == 10) { # R4 - print INST_IMP "unsigned char source = cpu8051_ReadD( BANKPSW + _R4_ );\n"; - } - if ($op_source == 11) { # R5 - print INST_IMP "unsigned char source = cpu8051_ReadD( BANKPSW + _R5_ );\n"; - } - if ($op_source == 12) { # R6 - print INST_IMP "unsigned char source = cpu8051_ReadD( BANKPSW + _R6_ );\n"; - } - if ($op_source == 13) { # R7 - print INST_IMP "unsigned char source = cpu8051_ReadD( BANKPSW + _R7_ );\n"; - } - - if ($op_source == 14) { # bitaddr - print INST_IMP "unsigned char source, srcbitaddr = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ );\n"; - print INST_IMP "source = cpu8051_ReadB( srcbitaddr );\n"; - } - if ($op_source == 15) { # reladdr - print INST_IMP "(cpu8051.pc)++;\n"; - print INST_IMP "unsigned int source = ((char) memory_read8(PGM_MEM_ID, cpu8051.pc - 1)) + cpu8051.pc;\n"; - } - if ($op_source == 16) { # #data - print INST_IMP "unsigned char source = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ );\n"; - } - if ($op_source == 17) { # C - print INST_IMP "unsigned char source = ( cpu8051_ReadD( _PSW_ ) >> 7 );\n"; - } - if ($op_source == 18) { # @A+DPTR - print INST_IMP "unsigned char source = memory_read8( PGM_MEM_ID, cpu8051_ReadD( _ACC_ ) + cpu8051_ReadD( _DPTRLOW_ ) + ( cpu8051_ReadD( _DPTRHIGH_ ) << 8 ) );\n"; - } - if ($op_source == 19) { # @A+PC - print INST_IMP "unsigned char source = memory_read8( PGM_MEM_ID, cpu8051_ReadD( _ACC_ ) + ( ++cpu8051.pc ) );\n"; - } - if ($op_source == 21) { # DPTR - print INST_IMP "unsigned int source = ( cpu8051_ReadD( _DPTRHIGH_ ) << 8 ) + cpu8051_ReadD( _DPTRLOW_ );\n"; - } - if ($op_source == 22) { # #data16 - print INST_IMP "unsigned char source = ( memory_read8( PGM_MEM_ID, (cpu8051.pc)++ ) << 8 );\n"; - print INST_IMP "source += memory_read8( PGM_MEM_ID, (cpu8051.pc)++ );\n"; - } - if ($op_source == 23) { # /bitaddr - print INST_IMP "unsigned char source, srcbitaddr = memory_read8( PGM_MEM_ID, (cpu8051.pc)++ );\n"; - print INST_IMP "source = ( cpu8051_ReadB( srcbitaddr ) ^ 1 );\n"; - } - if ($op_source == 24) { # @DPTR - print INST_IMP "unsigned char source = cpu8051_ReadI( ( cpu8051_ReadD( _DPTRHIGH_ ) << 8 ) + cpu8051_ReadD( _DPTRLOW_) );\n"; - } - } - -############################################################################## - $modifysrc=0; -# print INST_IMP "\n// Inserer le code ici\n\n"; - - # RR - if ($insttype[$i] == 3) { - print INST_IMP "destination = ( destination >> 1 ) | ( destination << 7 );\n"; - } - - # INC - if ($insttype[$i] == 4) { - print INST_IMP "destination++;\n"; - } - - # JBC - if ($insttype[$i] == 5) { - print INST_IMP "if ( destination == 1 ) { cpu8051.pc = source; destination = 0; }\n"; - } - - # ACALL - if ($insttype[$i] == 6) { - print INST_IMP "unsigned char SP = cpu8051_ReadD( _SP_ );\n"; - print INST_IMP "cpu8051_WriteI( ++SP, ( cpu8051.pc & 0x00FF ) );\n"; - print INST_IMP "cpu8051_WriteI( ++SP, ( cpu8051.pc >> 8 ) );\n"; - print INST_IMP "cpu8051_WriteD( _SP_, SP );\n"; - } - - # LCALL - if ($insttype[$i] == 7) { - print INST_IMP "unsigned char SP = cpu8051_ReadD( _SP_ );\n"; - print INST_IMP "cpu8051_WriteI( ++SP, ( cpu8051.pc & 0x00FF ) );\n"; - print INST_IMP "cpu8051_WriteI( ++SP, ( cpu8051.pc >> 8 ) );\n"; - print INST_IMP "cpu8051_WriteD( _SP_, SP );\n"; - } - - # RRC - if ($insttype[$i] == 8) { - print INST_IMP "unsigned char tmpval = destination;\n"; - print INST_IMP "destination = ( destination >> 1 ) | ( cpu8051_ReadD( _PSW_ ) & 0x80 );\n"; - print INST_IMP "cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x7F ) | ( tmpval << 7 ) );\n"; - } - - # DEC - if ($insttype[$i] == 9) { - print INST_IMP "destination--;\n"; - } - - # JB - if ($insttype[$i] == 10) { - print INST_IMP "if ( destination == 1 ) { cpu8051.pc = source; }\n"; - } - - # RET - if ($insttype[$i] == 11) { - print INST_IMP "unsigned char SP = cpu8051_ReadD( _SP_ );\n"; - print INST_IMP "cpu8051.pc = ( cpu8051_ReadI( SP-- ) << 8 );\n"; - print INST_IMP "cpu8051.pc += cpu8051_ReadI ( SP-- );\n"; - print INST_IMP "cpu8051_WriteD( _SP_, SP );\n"; - } - - # RL - if ($insttype[$i] == 12) { - print INST_IMP "destination = ( destination << 1 ) | ( destination >> 7 );\n"; - } - - # ADD - if ($insttype[$i] == 13) { - print INST_IMP "cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x3B ) );\n"; - print INST_IMP "if ( destination + source > 0xFF ) {\n"; - print INST_IMP " cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) );\n"; - print INST_IMP " if ( ( destination & 0x7F ) + ( source & 0x7F ) < 0x80 ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) );\n"; - print INST_IMP "} else if ( ( destination & 0x7F ) + ( source & 0x7F ) > 0x7F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) );\n"; - print INST_IMP "if ( ( destination & 0x0F ) + ( source & 0x0F ) > 0x0F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) );\n"; - print INST_IMP "destination += source;\n"; - } - - # JNB - if ($insttype[$i] == 14) { - print INST_IMP "if ( destination == 0 ) { cpu8051.pc = source; }\n"; - } - - # RETI - if ($insttype[$i] == 15) { - print INST_IMP "cpu8051.active_priority = -1;\n"; - print INST_IMP "unsigned char SP = cpu8051_ReadD( _SP_ );\n"; - print INST_IMP "cpu8051.pc = ( cpu8051_ReadI( SP-- ) << 8 );\n"; - print INST_IMP "cpu8051.pc += cpu8051_ReadI( SP-- );\n"; - } - - # RLC - if ($insttype[$i] == 16) { - print INST_IMP "unsigned char tmpval = destination;\n"; - print INST_IMP "destination = ( destination << 1 ) | ( ( cpu8051_ReadD( _PSW_ ) & 0x80 ) >> 7 );\n"; - print INST_IMP "cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x7F ) | ( tmpval & 0x80 ) );\n"; - } - - # ADDC - if ($insttype[$i] == 17) { - print INST_IMP "unsigned char carryflag = ( cpu8051_ReadD( _PSW_ ) >> 7 );\n"; - print INST_IMP "cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x3B ) );\n"; - print INST_IMP "if ( destination + source + carryflag > 0xFF ) {\n"; - print INST_IMP " cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) );\n"; - print INST_IMP " if ( ( destination & 0x7F ) + ( source & 0x7F ) + carryflag < 0x80 ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) );\n"; - print INST_IMP "} else if ( ( destination & 0x7F ) + ( source & 0x7F ) + carryflag > 0x7F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) );\n"; - print INST_IMP "if ( ( destination & 0x0F ) + ( source & 0x0F ) + carryflag > 0x0F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x40 ) );\n"; - print INST_IMP "destination += source;\n"; - } - - # JC - if ($insttype[$i] == 18) { - print INST_IMP "if ( cpu8051_ReadD( _PSW_ ) > 0x7F) { cpu8051.pc = destination; }\n"; - } - - # ORL - if ($insttype[$i] == 19) { - if ($instargs[$i*4+1] == 17) { - # sur des bits - print INST_IMP "cpu8051_WriteD( _PSW_ , ( ( destination | source ) << 7 ) );\n"; - } else { - # sur des bytes - print INST_IMP "destination |= source;\n"; - } - } - - # JNC - if ($insttype[$i] == 20) { - print INST_IMP "if ( cpu8051_ReadD( _PSW_ ) < 0x80 ) { cpu8051.pc = destination; }\n"; - } - - # ANL - if ($insttype[$i] == 21) { - if ($instargs[$i*4+1] == 17) { - # sur des bits - print INST_IMP "cpu8051_WriteD( _PSW_, ( ( destination & source) << 7 ) );\n"; - } else { - # sur des bytes - print INST_IMP "destination &= source;\n"; - } - } - - # JZ - if ($insttype[$i] == 22) { - print INST_IMP "if ( cpu8051_ReadD( _ACC_ ) == 0 ) { cpu8051.pc = destination; }\n"; - } - - # XRL - if ($insttype[$i] == 23) { - print INST_IMP "destination ^= source;\n"; - } - - # JNZ - if ($insttype[$i] == 24) { - print INST_IMP "if ( cpu8051_ReadD( _ACC_ ) != 0 ) { cpu8051.pc = destination; }\n"; - } - - # JMP - if ($insttype[$i] == 25) { - print INST_IMP "cpu8051.pc = destination;\n"; - } - - # MOV - if ($insttype[$i] == 26) { - print INST_IMP "destination = source;\n"; - } - - # SJMP - if ($insttype[$i] == 27) { - print INST_IMP "cpu8051.pc = destination;\n"; - } - - # MOVC - if ($insttype[$i] == 28) { - print INST_IMP "destination = source;\n"; - } - - # DIV - if ($insttype[$i] == 29) { - print INST_IMP "unsigned char A = cpu8051_ReadD( _ACC_ ), B = cpu8051_ReadD( _B_ );\n"; - print INST_IMP "cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x7B ) );\n"; - print INST_IMP "if ( B != 0 ) {\n"; - print INST_IMP "cpu8051_WriteD( _ACC_, A/B ); cpu8051_WriteD( _B_, A%B );\n"; - print INST_IMP "} else cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) );\n"; - } - - # SUBB - if ($insttype[$i] == 30) { - print INST_IMP "unsigned char carryflag = cpu8051_ReadD( _PSW_ ) >> 7;\n"; - print INST_IMP "cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x3B ) );\n"; - print INST_IMP "if ( destination < ( source + carryflag ) ) {\n"; - print INST_IMP " cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) );\n"; - print INST_IMP " if ( ( destination & 0x7F ) > ( ( source + carryflag ) & 0x7F ) ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) );\n"; - print INST_IMP "} else if ( ( destination & 0x7F ) < ( ( source + carryflag ) & 0x7F ) ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) );\n"; - print INST_IMP "if ( ( destination & 0x0F ) < ( ( source + carryflag ) & 0x0F ) ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x40 ) );\n"; - print INST_IMP "destination -= source + carryflag;\n"; - } - - # MUL - if ($insttype[$i] == 31) { - print INST_IMP "unsigned char A = cpu8051_ReadD( _ACC_ ), B = cpu8051_ReadD( _B_ );\n"; - print INST_IMP "cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x7B ) );\n"; - print INST_IMP "cpu8051_WriteD( _ACC_ , ( ( A * B ) & 0x00FF ) ); cpu8051_WriteD( _B_, ( A * B ) / 0x100 );\n"; - print INST_IMP "if ( cpu8051_ReadD( _B_ ) > 0) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) );\n"; - } - - # CPL - if ($insttype[$i] == 33) { - if ($instargs[$i*4+1] == 2) { print INST_IMP "destination ^= 0xFF;\n"; } - else { print INST_IMP "destination ^= 0x01;\n"; } - } - - # CJNE - if ($insttype[$i] == 34) { - print INST_IMP "unsigned int reladdr = ((char) memory_read8(PGM_MEM_ID, cpu8051.pc)) + (cpu8051.pc + 1);\n"; - print INST_IMP "cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) & 0x7F ) );\n"; - print INST_IMP "if ( destination < source ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) );\n"; - print INST_IMP "if ( destination != source ) cpu8051.pc = reladdr;\n"; - } - - # PUSH - if ($insttype[$i] == 35) { - print INST_IMP "unsigned char SP = cpu8051_ReadD( _SP_ );\n"; - print INST_IMP "cpu8051_WriteI( ++SP, destination );\n"; - print INST_IMP "cpu8051_WriteD( _SP_, SP );\n"; - } - - # CLR - if ($insttype[$i] == 36) { - print INST_IMP "destination = 0;\n"; - } - - # SWAP - if ($insttype[$i] == 37) { - print INST_IMP "destination = ( destination << 4 ) + ( destination >> 4 );\n"; - } - - # XCH - if ($insttype[$i] == 38) { - print INST_IMP "unsigned char tmpval = destination;\n"; - print INST_IMP "destination = source; source = tmpval;\n"; - $modifysrc=1; - } - - # POP - if ($insttype[$i] == 39) { - print INST_IMP "unsigned char SP = cpu8051_ReadD( _SP_ );\n"; - print INST_IMP "destination = cpu8051_ReadI( SP-- );\n"; - print INST_IMP "cpu8051_WriteD( _SP_, SP );\n"; - } - - # SETB - if ($insttype[$i] == 40) { - print INST_IMP "destination = 1;\n"; - } - - # DA - if ($insttype[$i] == 41) { - print INST_IMP "if ( ( ( destination & 0x0F ) > 9) || ( cpu8051_ReadD( _PSW_ ) | 0x40)) {\n"; - print INST_IMP " if ( ( destination + 6 ) > 0xFF) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) );\n"; - print INST_IMP " destination += 6;\n"; - print INST_IMP "}\n"; - print INST_IMP "if ( ( cpu8051_ReadD( _PSW_ ) & 0x80) || ( ( destination & 0xF0 ) > 0x90 ) ) {\n"; - print INST_IMP " if ( ( destination + 0x60 ) > 0xFF ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) );\n"; - print INST_IMP " destination += 0x60;\n"; - print INST_IMP "}\n"; - } - - # DJNZ - if ($insttype[$i] == 42) { - print INST_IMP "destination--;\n"; - print INST_IMP "if ( destination != 0 ) cpu8051.pc = source;\n"; - } - - # XCHD - if ($insttype[$i] == 43) { - print INST_IMP "unsigned char tmpval = ( destination & 0x0F );\n"; - print INST_IMP "destination = ( destination & 0xF0 ) + ( source & 0x0F );\n"; - print INST_IMP "source = ( source & 0xF0 ) + tmpval;\n"; - $modifysrc=1; - } - - # MOVX - if ($insttype[$i] == 44) { - print INST_IMP "destination = source;\n"; - } - - - -############################################################################## - - - if ($instargs[$i*4] > 0) { - $op_destination=$instargs[$i*4+1]; - if ($op_destination == 0) { # addr11 - print INST_IMP "cpu8051.pc = ( cpu8051.pc & 0xF800 ) | addr11;\n"; - } - if ($op_destination == 1) { # addr16 - print INST_IMP "cpu8051.pc = addr16;\n"; - } - if ($op_destination == 2) { # A - print INST_IMP "cpu8051_WriteD( _ACC_, destination );\n"; - } - if ($op_destination == 3) { # direct - print INST_IMP "cpu8051_WriteD( destaddr, destination );\n"; - } - if ($op_destination == 4) { # @R0 - print INST_IMP "cpu8051_WriteI( cpu8051_ReadD( BANKPSW + _R0_ ), destination );\n"; - } - if ($op_destination == 5) { # @R1 - print INST_IMP "cpu8051_WriteI( cpu8051_ReadD( BANKPSW + _R1_ ), destination );\n"; - } - if ($op_destination == 6) { # R0 - print INST_IMP "cpu8051_WriteD( BANKPSW + _R0_, destination );\n"; - } - if ($op_destination == 7) { # R1 - print INST_IMP "cpu8051_WriteD( BANKPSW + _R1_, destination );\n"; - } - if ($op_destination == 8) { # R2 - print INST_IMP "cpu8051_WriteD( BANKPSW + _R2_, destination );\n"; - } - if ($op_destination == 9) { # R3 - print INST_IMP "cpu8051_WriteD( BANKPSW + _R3_, destination );\n"; - } - if ($op_destination == 10) { # R4 - print INST_IMP "cpu8051_WriteD( BANKPSW + _R4_, destination );\n"; - } - if ($op_destination == 11) { # R5 - print INST_IMP "cpu8051_WriteD( BANKPSW + _R5_, destination );\n"; - } - if ($op_destination == 12) { # R6 - print INST_IMP "cpu8051_WriteD( BANKPSW + _R6_, destination );\n"; - } - if ($op_destination == 13) { # R7 - print INST_IMP "cpu8051_WriteD( BANKPSW + _R7_, destination );\n"; - } - - if ($op_destination == 14) { # bitaddr - print INST_IMP "cpu8051_WriteB( dstbitaddr, destination );\n"; - } - if ($op_destination == 17) { # C - print INST_IMP "cpu8051_WriteD( _PSW_, ( ( cpu8051_ReadD( _PSW_ ) & 0x7F) | ( destination << 7 ) ) );\n"; - } - if ($op_destination == 21) { # DPTR - print INST_IMP "cpu8051_WriteD( _DPTRHIGH_, ( destination >> 8 ) );\n"; - print INST_IMP "cpu8051_WriteD( _DPTRLOW_, ( destination & 0xFF ) );\n"; - } - if ($op_destination == 23) { # /bitaddr - print INST_IMP "cpu8051_WriteB( dstbitaddr, destination );\n"; - } - if ($op_destination == 24) { # @DPTR - print INST_IMP "cpu8051_WriteI( ( cpu8051_ReadD( _DPTRHIGH_ ) << 8 ) + cpu8051_ReadD( _DPTRLOW_ ), destination );\n"; - } - } - - if ($modifysrc == 1) { - if ($instargs[$i*4] > 1) { - $op_source=$instargs[$i*4+2]; - if ($op_source == 0) { # addr11 - print INST_IMP "cpu8051.pc = ( cpu8051.pc & 0xF800 ) | addr11;\n"; - } - if ($op_source == 1) { # addr16 - print INST_IMP "cpu8051.pc = addr16;\n"; - } - if ($op_source == 2) { # A - print INST_IMP "cpu8051_WriteD( _ACC_, source );\n"; - } - if ($op_source == 3) { # direct - print INST_IMP "cpu8051_WriteD( srcaddr, source );\n"; - } - if ($op_source == 4) { # @R0 - print INST_IMP "cpu8051_WriteI( cpu8051_ReadD( BANKPSW + _R0_ ), source );\n"; - } - if ($op_source == 5) { # @R1 - print INST_IMP "cpu8051_WriteI( cpu8051_ReadD( BANKPSW + _R1_ ), source );\n"; - } - if ($op_source == 6) { # R0 - print INST_IMP "cpu8051_WriteD( BANKPSW + _R0_, source );\n"; - } - if ($op_source == 7) { # R1 - print INST_IMP "cpu8051_WriteD( BANKPSW + _R1_, source );\n"; - } - if ($op_source == 8) { # R2 - print INST_IMP "cpu8051_WriteD( BANKPSW + _R2_, source );\n"; - } - if ($op_source == 9) { # R3 - print INST_IMP "cpu8051_WriteD( BANKPSW + _R3_, source );\n"; - } - if ($op_source == 10) { # R4 - print INST_IMP "cpu8051_WriteD( BANKPSW + _R4_, source );\n"; - } - if ($op_source == 11) { # R5 - print INST_IMP "cpu8051_WriteD( BANKPSW + _R5_, source );\n"; - } - if ($op_source == 12) { # R6 - print INST_IMP "cpu8051_WriteD( BANKPSW + _R6_, source );\n"; - } - if ($op_source == 13) { # R7 - print INST_IMP "cpu8051_WriteD( BANKPSW + _R7_, source );\n"; - } - if ($op_source == 14) { # bitaddr - print INST_IMP "cpu8051_WriteB( srcbitaddr, source );\n"; - } - if ($op_source == 17) { # C - print INST_IMP "cpu8051_WriteD( _PSW_, ( ( cpu8051_ReadD( _PSW_ ) & 0x7F) | ( source << 7 ) ) );\n"; - } - if ($op_source == 21) { # DPTR - print INST_IMP "cpu8051_WriteD( _DPTRHIGH_, ( source >> 8 ) );\n"; - print INST_IMP "cpu8051_WriteD( _DPTRLOW_, ( source & 0xFF ) );\n"; - } - if ($op_source == 23) { # /bitaddr - print INST_IMP "cpu8051_WriteB( srcbitaddr, source );\n"; - } - if ($op_source == 24) { # @DPTR - print INST_IMP "cpu8051_WriteI( ( cpu8051_ReadD( _DPTRHIGH_ ) << 8 ) + cpu8051_ReadD( _DPTRLOW_ ), source );\n"; - } - } - } - } - print INST_IMP "return $a_cycles[$i];\n"; - print INST_IMP "}\n"; - print INST_IMP "\n\n"; -} -# ------------------------------------------------------------------------------ - - -# Header for instructions_8051.h -print INST_DEF "/*\n"; -print INST_DEF " * instructions_8051.h\n"; -print INST_DEF " *\n"; -print INST_DEF " * Do not modify this file directly, as it was created by opcode2c.pl\n"; -print INST_DEF " * Any modifications made directly to this file will be lost.\n"; -print INST_DEF " *\n"; -print INST_DEF " * Copyright (C) 1999 Jonathan St-André\n"; -print INST_DEF " * Copyright (C) 1999 Hugo Villeneuve \n"; -print INST_DEF " *\n"; -print INST_DEF " * This program is free software; you can redistribute it and/or modify\n"; -print INST_DEF " * it under the terms of the GNU General Public License as published by\n"; -print INST_DEF " * the Free Software Foundation; either version 2 of the License, or\n"; -print INST_DEF " * (at your option) any later version.\n"; -print INST_DEF " *\n"; -print INST_DEF " * This program is distributed in the hope that it will be useful,\n"; -print INST_DEF " * but WITHOUT ANY WARRANTY; without even the implied warranty of\n"; -print INST_DEF " * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"; -print INST_DEF " * GNU General Public License for more details.\n"; -print INST_DEF " *\n"; -print INST_DEF " * You should have received a copy of the GNU General Public License\n"; -print INST_DEF " * along with this program; if not, write to the Free Software\n"; -print INST_DEF " * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.\n"; -print INST_DEF "*/\n\n"; - -print INST_DEF "#ifndef INSTRUCTIONS_8051_H\n"; -print INST_DEF "#define INSTRUCTIONS_8051_H 1\n\n\n"; -print INST_DEF "#define BANKPSW (cpu8051_ReadD(_PSW_) & 0x18)\n\n"; -print INST_DEF "typedef int (*OPCODE_FP)(void);\n\n\n"; -for( $i=0; $i<256; $i++ ) { - print INST_DEF "int\n"; - print INST_DEF "cpu8051_OP_$a_opcodehex[$i](void);\n\n"; -} -print INST_DEF "\n"; -print INST_DEF "/* Exported variables. */\n"; -print INST_DEF "#ifdef INSTRUCTIONS_8051_M\n"; -print INST_DEF "OPCODE_FP opcode_table[256] = {\n"; -for( $i=0; $i<256; $i++ ) { - $ifunc=substr($instfunction[$i], 9); - if( $i < 255 ) { - print INST_DEF " cpu8051_$ifunc,\n"; - } - else { - print INST_DEF " cpu8051_$ifunc\n"; - print INST_DEF "};\n"; - } -} - -print INST_DEF "#else\n"; -print INST_DEF "OPCODE_FP opcode_table[256];\n"; -print INST_DEF "#endif\n\n\n"; - -print INST_DEF "#endif /* INSTRUCTIONS_8051_H */\n"; - -print DISASM_H "#endif /* DISASM_H */\n"; - -close DISASM_H; -close OPCODELST; -close INST_DEF; -close INST_IMP; diff -Nru emu8051-1.1.1/src/opcodes.lst emu8051-2.0.1/src/opcodes.lst --- emu8051-1.1.1/src/opcodes.lst 2011-10-29 21:06:32.000000000 +0000 +++ emu8051-2.0.1/src/opcodes.lst 1970-01-01 00:00:00.000000000 +0000 @@ -1,258 +0,0 @@ -Opcode(bin) Opcode Instruction Bytes Cycles --------------------------------------------------------------- -00000000 00 NOP 1 1 -00000001 01 AJMP addr11 2 2 -00000010 02 LJMP addr16 3 2 -00000011 03 RR A 1 1 -00000100 04 INC A 1 1 -00000101 05 INC direct 2 1 -00000110 06 INC @R0 1 1 -00000111 07 INC @R1 1 1 -00001000 08 INC R0 1 1 -00001001 09 INC R1 1 1 -00001010 0A INC R2 1 1 -00001011 0B INC R3 1 1 -00001100 0C INC R4 1 1 -00001101 0D INC R5 1 1 -00001110 0E INC R6 1 1 -00001111 0F INC R7 1 1 -00010000 10 JBC bitaddr,reladdr 3 2 -00010001 11 ACALL addr11 2 2 -00010010 12 LCALL addr16 3 2 -00010011 13 RRC A 1 1 -00010100 14 DEC A 1 1 -00010101 15 DEC direct 2 1 -00010110 16 DEC @R0 1 1 -00010111 17 DEC @R1 1 1 -00011000 18 DEC R0 1 1 -00011001 19 DEC R1 1 1 -00011010 1A DEC R2 1 1 -00011011 1B DEC R3 1 1 -00011100 1C DEC R4 1 1 -00011101 1D DEC R5 1 1 -00011110 1E DEC R6 1 1 -00011111 1F DEC R7 1 1 -00100000 20 JB bitaddr,reladdr 3 2 -00100001 21 AJMP addr11 2 2 -00100010 22 RET 1 2 -00100011 23 RL A 1 1 -00100100 24 ADD A,#data 2 1 -00100101 25 ADD A,direct 2 1 -00100110 26 ADD A,@R0 1 1 -00100111 27 ADD A,@R1 1 1 -00101000 28 ADD A,R0 1 1 -00101001 29 ADD A,R1 1 1 -00101010 2A ADD A,R2 1 1 -00101011 2B ADD A,R3 1 1 -00101100 2C ADD A,R4 1 1 -00101101 2D ADD A,R5 1 1 -00101110 2E ADD A,R6 1 1 -00101111 2F ADD A,R7 1 1 -00110000 30 JNB bitaddr,reladdr 3 2 -00110001 31 ACALL addr11 2 2 -00110010 32 RETI 1 2 -00110011 33 RLC A 1 1 -00110100 34 ADDC A,#data 2 1 -00110101 35 ADDC A,direct 2 1 -00110110 36 ADDC A,@R0 1 1 -00110111 37 ADDC A,@R1 1 1 -00111000 38 ADDC A,R0 1 1 -00111001 39 ADDC A,R1 1 1 -00111010 3A ADDC A,R2 1 1 -00111011 3B ADDC A,R3 1 1 -00111100 3C ADDC A,R4 1 1 -00111101 3D ADDC A,R5 1 1 -00111110 3E ADDC A,R6 1 1 -00111111 3F ADDC A,R7 1 1 -01000000 40 JC reladdr 2 2 -01000001 41 AJMP addr11 2 2 -01000010 42 ORL direct,A 2 1 -01000011 43 ORL direct,#data 3 2 -01000100 44 ORL A,#data 2 1 -01000101 45 ORL A,direct 2 1 -01000110 46 ORL A,@R0 1 1 -01000111 47 ORL A,@R1 1 1 -01001000 48 ORL A,R0 1 1 -01001001 49 ORL A,R1 1 1 -01001010 4A ORL A,R2 1 1 -01001011 4B ORL A,R3 1 1 -01001100 4C ORL A,R4 1 1 -01001101 4D ORL A,R5 1 1 -01001110 4E ORL A,R6 1 1 -01001111 4F ORL A,R7 1 1 -01010000 50 JNC reladdr 2 2 -01010001 51 ACALL addr11 2 2 -01010010 52 ANL direct,A 2 1 -01010011 53 ANL direct,#data 3 2 -01010100 54 ANL A,#data 2 1 -01010101 55 ANL A,direct 2 1 -01010110 56 ANL A,@R0 1 1 -01010111 57 ANL A,@R1 1 1 -01011000 58 ANL A,R0 1 1 -01011001 59 ANL A,R1 1 1 -01011010 5A ANL A,R2 1 1 -01011011 5B ANL A,R3 1 1 -01011100 5C ANL A,R4 1 1 -01011101 5D ANL A,R5 1 1 -01011110 5E ANL A,R6 1 1 -01011111 5F ANL A,R7 1 1 -01100000 60 JZ reladdr 2 2 -01100001 61 AJMP addr11 2 2 -01100010 62 XRL direct,A 2 1 -01100011 63 XRL direct,#data 3 2 -01100100 64 XRL A,#data 2 1 -01100101 65 XRL A,direct 2 1 -01100110 66 XRL A,@R0 1 1 -01100111 67 XRL A,@R1 1 1 -01101000 68 XRL A,R0 1 1 -01101001 69 XRL A,R1 1 1 -01101010 6A XRL A,R2 1 1 -01101011 6B XRL A,R3 1 1 -01101100 6C XRL A,R4 1 1 -01101101 6D XRL A,R5 1 1 -01101110 6E XRL A,R6 1 1 -01101111 6F XRL A,R7 1 1 -01110000 70 JNZ reladdr 2 2 -01110001 71 ACALL addr11 2 2 -01110010 72 ORL C,bitaddr 2 2 -01110011 73 JMP @A+DPTR 1 2 -01110100 74 MOV A,#data 2 1 -01110101 75 MOV direct,#data 3 2 -01110110 76 MOV @R0,#data 2 1 -01110111 77 MOV @R1,#data 2 1 -01111000 78 MOV R0,#data 2 1 -01111001 79 MOV R1,#data 2 1 -01111010 7A MOV R2,#data 2 1 -01111011 7B MOV R3,#data 2 1 -01111100 7C MOV R4,#data 2 1 -01111101 7D MOV R5,#data 2 1 -01111110 7E MOV R6,#data 2 1 -01111111 7F MOV R7,#data 2 1 -10000000 80 SJMP reladdr 2 2 -10000001 81 AJMP addr11 2 2 -10000010 82 ANL C,bitaddr 2 1 -10000011 83 MOVC A,@A+PC 1 1 -10000100 84 DIV AB 1 4 -10000101 85 MOV direct,direct 3 1 -10000110 86 MOV direct,@R0 2 2 -10000111 87 MOV direct,@R1 2 2 -10001000 88 MOV direct,R0 2 2 -10001001 89 MOV direct,R1 2 2 -10001010 8A MOV direct,R2 2 2 -10001011 8B MOV direct,R3 2 2 -10001100 8C MOV direct,R4 2 2 -10001101 8D MOV direct,R5 2 2 -10001110 8E MOV direct,R6 2 2 -10001111 8F MOV direct,R7 2 2 -10010000 90 MOV DPTR,#data16 3 2 -10010001 91 ACALL addr11 2 2 -10010010 92 MOV bitaddr,C 2 2 -10010011 93 MOVC A,@A+DPTR 1 2 -10010100 94 SUBB A,#data 2 1 -10010101 95 SUBB A,direct 2 1 -10010110 96 SUBB A,@R0 1 1 -10010111 97 SUBB A,@R1 1 1 -10011000 98 SUBB A,R0 1 1 -10011001 99 SUBB A,R1 1 1 -10011010 9A SUBB A,R2 1 1 -10011011 9B SUBB A,R3 1 1 -10011100 9C SUBB A,R4 1 1 -10011101 9D SUBB A,R5 1 1 -10011110 9E SUBB A,R6 1 1 -10011111 9F SUBB A,R7 1 1 -10100000 A0 ORL C,/bitaddr 2 1 -10100001 A1 AJMP addr11 2 2 -10100010 A2 MOV C,bitaddr 2 1 -10100011 A3 INC DPTR 1 2 -10100100 A4 MUL AB 1 4 -10100101 A5 INVALID 1 1 -10100110 A6 MOV @R0,direct 2 2 -10100111 A7 MOV @R1,direct 2 2 -10101000 A8 MOV R0,direct 2 2 -10101001 A9 MOV R1,direct 2 2 -10101010 AA MOV R2,direct 2 2 -10101011 AB MOV R3,direct 2 2 -10101100 AC MOV R4,direct 2 2 -10101101 AD MOV R5,direct 2 2 -10101110 AE MOV R6,direct 2 2 -10101111 AF MOV R7,direct 2 2 -10110000 B0 ANL C,/bitaddr 2 1 -10110001 B1 ACALL addr11 2 2 -10110010 B2 CPL bitaddr 2 1 -10110011 B3 CPL C 1 1 -10110100 B4 CJNE A,#data,reladdr 3 2 -10110101 B5 CJNE A,direct,reladdr 3 2 -10110110 B6 CJNE @R0,#data,reladdr 3 2 -10110111 B7 CJNE @R1,#data,reladdr 3 2 -10111000 B8 CJNE R0,#data,reladdr 3 2 -10111001 B9 CJNE R1,#data,reladdr 3 2 -10111010 BA CJNE R2,#data,reladdr 3 2 -10111011 BB CJNE R3,#data,reladdr 3 2 -10111100 BC CJNE R4,#data,reladdr 3 2 -10111101 BD CJNE R5,#data,reladdr 3 2 -10111110 BE CJNE R6,#data,reladdr 3 2 -10111111 BF CJNE R7,#data,reladdr 3 2 -11000000 C0 PUSH direct 2 2 -11000001 C1 AJMP addr11 2 2 -11000010 C2 CLR bitaddr 2 1 -11000011 C3 CLR C 1 1 -11000100 C4 SWAP A 1 1 -11000101 C5 XCH A,direct 2 1 -11000110 C6 XCH A,@R0 1 1 -11000111 C7 XCH A,@R1 1 1 -11001000 C8 XCH A,R0 1 1 -11001001 C9 XCH A,R1 1 1 -11001010 CA XCH A,R2 1 1 -11001011 CB XCH A,R3 1 1 -11001100 CC XCH A,R4 1 1 -11001101 CD XCH A,R5 1 1 -11001110 CE XCH A,R6 1 1 -11001111 CF XCH A,R7 1 1 -11010000 D0 POP direct 2 2 -11010001 D1 ACALL addr11 2 2 -11010010 D2 SETB bitaddr 2 1 -11010011 D3 SETB C 1 1 -11010100 D4 DA A 1 1 -11010101 D5 DJNZ direct,reladdr 3 2 -11010110 D6 XCHD A,@R0 1 1 -11010111 D7 XCHD A,@R1 1 1 -11011000 D8 DJNZ R0,reladdr 2 2 -11011001 D9 DJNZ R1,reladdr 2 2 -11011010 DA DJNZ R2,reladdr 2 2 -11011011 DB DJNZ R3,reladdr 2 2 -11011100 DC DJNZ R4,reladdr 2 2 -11011101 DD DJNZ R5,reladdr 2 2 -11011110 DE DJNZ R6,reladdr 2 2 -11011111 DF DJNZ R7,reladdr 2 2 -11100000 E0 MOVX A,@DPTR 1 2 -11100001 E1 AJMP addr11 2 2 -11100010 E2 MOVX A,@R0 1 2 -11100011 E3 MOVX A,@R1 1 2 -11100100 E4 CLR A 1 1 -11100101 E5 MOV A,direct 2 1 -11100110 E6 MOV A,@R0 1 1 -11100111 E7 MOV A,@R1 1 1 -11101000 E8 MOV A,R0 1 1 -11101001 E9 MOV A,R1 1 1 -11101010 EA MOV A,R2 1 1 -11101011 EB MOV A,R3 1 1 -11101100 EC MOV A,R4 1 1 -11101101 ED MOV A,R5 1 1 -11101110 EE MOV A,R6 1 1 -11101111 EF MOV A,R7 1 1 -11110000 F0 MOVX @DPTR,A 1 2 -11110001 F1 ACALL addr11 2 2 -11110010 F2 MOVX @R0,A 1 2 -11110011 F3 MOVX @R1,A 1 2 -11110100 F4 CPL A 1 1 -11110101 F5 MOV direct,A 2 1 -11110110 F6 MOV @R0,A 1 1 -11110111 F7 MOV @R1,A 1 1 -11111000 F8 MOV R0,A 1 1 -11111001 F9 MOV R1,A 1 1 -11111010 FA MOV R2,A 1 1 -11111011 FB MOV R3,A 1 1 -11111100 FC MOV R4,A 1 1 -11111101 FD MOV R5,A 1 1 -11111110 FE MOV R6,A 1 1 -11111111 FF MOV R7,A 1 1 diff -Nru emu8051-1.1.1/src/options.c emu8051-2.0.1/src/options.c --- emu8051-1.1.1/src/options.c 2011-10-29 21:06:32.000000000 +0000 +++ emu8051-2.0.1/src/options.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,125 +0,0 @@ -/* - * Processing command-line options and arguments. - * - * Copyright (C) 1999 Hugo Villeneuve - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#if HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include -#include - -#if STDC_HEADERS -# include -#elif HAVE_STRINGS_H -# include -#endif - -#include "common.h" -#include "options.h" - -static char *hex_file; - -/* - * Return the hex file name - */ -char * -get_hex_filename(void) -{ - return hex_file; -} - -/******************************************************************************* - * Display the help message and exit - ******************************************************************************/ -static void -DisplayUsage(void) -{ - printf(COMMAND_LINE_OPTIONS); -} - -/******************************************************************************* - * Display version information and exit - ******************************************************************************/ -static void -DisplayVersion(void) -{ - printf("\n"); - printf(" %s, version %s\n", PACKAGE, VERSION); - printf(" Written by Jonathan St-André, Pascal Fecteau" - "and Hugo Villeneuve\n\n"); -} - -static void -InvalidOption(const char *message, /*@null@*/ const char *string) -{ - if (string == NULL) - fprintf(stderr, "%s: %s\n", PACKAGE, message); - else - fprintf(stderr, "%s: %s %s\n", PACKAGE, message, string); - - fprintf(stderr, "Try `%s -h' for more information.\n", PACKAGE); - - exit(EXIT_FAILURE); -} - - -/******************************************************************************* - * Initializes the different options passed as arguments on the command line. - ******************************************************************************/ -void -ParseCommandLineOptions(int argc, char *argv[]) -{ - int i; - char *token; - - for (i = 1; i < argc; i++) { - token = argv[i]; - switch (token[0]) { - case '-': - /* Processing options names */ - switch (token[1]) { - case 'h': - if (strlen(&token[1]) == 1) { - DisplayUsage(); - exit(EXIT_SUCCESS); - } - InvalidOption("invalid option", token); - break; - case 'v': - if (STREQ("version", &token[1])) { - DisplayVersion(); - exit(EXIT_SUCCESS); - } else - InvalidOption("invalid option", token); - break; - default: - InvalidOption("invalid option", token); - break; - } /* end switch(token[1]) */ - break; - default: - /* Processing options arguments */ - /* Must be the filename... */ - hex_file = token; - break; - } /* end switch(token[0]) */ - } /* end for */ -} diff -Nru emu8051-1.1.1/src/options.h emu8051-2.0.1/src/options.h --- emu8051-1.1.1/src/options.h 2011-10-29 21:06:32.000000000 +0000 +++ emu8051-2.0.1/src/options.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,45 +0,0 @@ -/* - * options.h - * - * Copyright (C) 1999 Hugo Villeneuve - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef OPTIONS_H -#define OPTIONS_H 1 - -#define COMMAND_LINE_OPTIONS \ - "Usage: " PACKAGE " [OPTION]... [FILENAME]\n" \ - "Simulator/emulator for 8051 family microcontrollers.\n\n" \ - " -h display this help and exit\n" \ - " -version display version information and exit\n" - -#define VERSION_STRING \ - PACKAGE "\n" \ - "Version " VERSION "\n" \ - "\n" \ - "Written by\n" \ - "Hugo Villeneuve\n" \ - "Jonathan St-André\n" \ - "Pascal Fecteau" - -void -ParseCommandLineOptions(int argc, char *argv[]); - -char * -get_hex_filename(void); - -#endif /* OPTIONS_H */ diff -Nru emu8051-1.1.1/src/pgmwin.c emu8051-2.0.1/src/pgmwin.c --- emu8051-1.1.1/src/pgmwin.c 2011-10-29 21:06:32.000000000 +0000 +++ emu8051-2.0.1/src/pgmwin.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,114 +0,0 @@ -/* - * pgmwin.c - * - * Copyright (C) 1999 Jonathan St-André - * Copyright (C) 1999 Hugo Villeneuve - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#if HAVE_CONFIG_H -# include "config.h" -#endif - -#include - -#include "common.h" -#include "cpu8051.h" -#include "pgmwin.h" - -static GtkWidget *pgmclist; -static unsigned int DisasmAddresses[24]; - -/* Disasm 24 lines from CPU */ -void -pgmwin_Disasm(void) -{ - char TextTmp[255]; - int row; - int InstSize; - unsigned int Address; - - Address = cpu8051.pc; - - gtk_clist_freeze(GTK_CLIST(pgmclist)); - for (row = 0; row < 24; row++) { - InstSize = cpu8051_Disasm(Address, TextTmp); - if (IsBreakpoint(Address)) - TextTmp[0] = '*'; - gtk_clist_set_text(GTK_CLIST(pgmclist), row, 0, TextTmp); - DisasmAddresses[row] = Address; - Address += InstSize; - } - gtk_clist_select_row(GTK_CLIST(pgmclist), 0, 0); - gtk_clist_thaw(GTK_CLIST(pgmclist)); -} - -/* Mouse button pressed in the window. */ -static gint -pgmwin_ButtonPressEvent(GtkWidget *widget, GdkEvent *event, gpointer data) -{ - gint row, column; - char TextTmp[255]; - - gtk_clist_get_selection_info(GTK_CLIST(pgmclist), - (int) event->button.x, - (int) event->button.y, &row, &column); - if (row >= 24 || row < 0) - return TRUE; - if (column >= 1 || column < 0) - return TRUE; - sprintf(TextTmp, "pgmwin_ButtonPressEvent() at %d,%d\n", column, row); - g_print(TextTmp); - ToggleBreakpoint(DisasmAddresses[row]); - pgmwin_Disasm(); - - return FALSE; -} - - -GtkWidget * -pgmwin_init(int width, int height) -{ - int i; - GtkWidget *fixed_frame; - - fixed_frame = gtk_frame_new(0); - gtk_frame_set_shadow_type(GTK_FRAME(fixed_frame), - GTK_SHADOW_ETCHED_OUT); - gtk_widget_set_usize(GTK_WIDGET(fixed_frame), width, height); - - pgmclist = gtk_clist_new(1); - gtk_clist_set_selection_mode(GTK_CLIST(pgmclist), GTK_SELECTION_SINGLE); - gtk_widget_set_usize(GTK_WIDGET(pgmclist), width, height); - gtk_clist_set_column_justification(GTK_CLIST(pgmclist), 0, - GTK_JUSTIFY_LEFT); - gtk_clist_set_column_width(GTK_CLIST(pgmclist), 0, width-10); - - PangoFontDescription *pango_font; - pango_font = pango_font_description_from_string(FIXED_FONT); - gtk_widget_modify_font(pgmclist, pango_font); - - char *pgmdummy[] = { 0 }; - for (i = 0; i < 24; i++) - gtk_clist_append(GTK_CLIST(pgmclist), pgmdummy); - - gtk_container_add(GTK_CONTAINER(fixed_frame), pgmclist); - - gtk_signal_connect(GTK_OBJECT(pgmclist), "button-press-event", - GTK_SIGNAL_FUNC(pgmwin_ButtonPressEvent), NULL); - - return fixed_frame; -} diff -Nru emu8051-1.1.1/src/pgmwin.h emu8051-2.0.1/src/pgmwin.h --- emu8051-1.1.1/src/pgmwin.h 2011-10-29 21:06:32.000000000 +0000 +++ emu8051-2.0.1/src/pgmwin.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,37 +0,0 @@ -/* - * pgmwin.h - * - * Copyright (C) 1999 Jonathan St-André - * Copyright (C) 1999 Hugo Villeneuve - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef PGMWIN_H -#define PGMWIN_H 1 - -#include -#include "gtksizes.h" - -GtkWidget * -pgmwin_init(int width, int height); - -void -pgmwin_Disasm(void); - -int -pgmwin_IsBreakpoint(unsigned int address); - -#endif /* PGMWIN_H */ diff -Nru emu8051-1.1.1/src/reg8051.h emu8051-2.0.1/src/reg8051.h --- emu8051-1.1.1/src/reg8051.h 2011-10-29 21:06:32.000000000 +0000 +++ emu8051-2.0.1/src/reg8051.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,65 +0,0 @@ -/* - * reg8051.h - * - * Copyright (C) 1999 Jonathan St-André - * Copyright (C) 1999 Hugo Villeneuve - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef REG8051_H -#define REG8051_H 1 - -/* SFR Registers ( $80 - $FF ) */ -#define _ACC_ 0xE0 -#define _B_ 0xF0 -#define _PSW_ 0xD0 -#define _SP_ 0x81 -#define _DPTRLOW_ _DPL_ -#define _DPTRHIGH_ _DPH_ -#define _DPL_ 0x82 -#define _DPH_ 0x83 -#define _P0_ 0x80 -#define _P1_ 0x90 -#define _P2_ 0xA0 -#define _P3_ 0xB0 -#define _IP_ 0xB8 -#define _IE_ 0xA8 -#define _TMOD_ 0x89 -#define _TCON_ 0x88 -#define _TH0_ 0x8C -#define _TL0_ 0x8A -#define _TH1_ 0x8D -#define _TL1_ 0x8B -#define _SCON_ 0x98 -#define _SBUF_ 0x99 -#define _PCON_ 0x87 -#define _T2CON_ 0xC8 - -#define _R0_ 0x00 -#define _R1_ 0x01 -#define _R2_ 0x02 -#define _R3_ 0x03 -#define _R4_ 0x04 -#define _R5_ 0x05 -#define _R6_ 0x06 -#define _R7_ 0x07 - -#define _BANK0_ 0x00 -#define _BANK1_ 0x08 -#define _BANK2_ 0x10 -#define _BANK3_ 0x18 - -#endif /* REG8051_H */ diff -Nru emu8051-1.1.1/src/regwin.c emu8051-2.0.1/src/regwin.c --- emu8051-1.1.1/src/regwin.c 2011-10-29 21:06:32.000000000 +0000 +++ emu8051-2.0.1/src/regwin.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,141 +0,0 @@ -/* - * regwin.cpp - * - * Copyright (C) 1999 Jonathan St-André - * Copyright (C) 1999 Hugo Villeneuve - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#if HAVE_CONFIG_H -# include "config.h" -#endif - -#include - -#include "common.h" -#include "reg8051.h" -#include "cpu8051.h" -#include "regwin.h" - -static GtkWidget *regclist; - -GtkWidget * -regwin_init(int width, int height) -{ - int i; - GtkWidget *fixed_frame; - PangoFontDescription *pango_font; - char *regdummy[] = { 0 }; - - fixed_frame = gtk_frame_new(0); - gtk_frame_set_shadow_type(GTK_FRAME(fixed_frame), - GTK_SHADOW_ETCHED_OUT); - gtk_widget_set_usize(GTK_WIDGET(fixed_frame), width, height); - - regclist = gtk_clist_new(1); - gtk_clist_set_selection_mode(GTK_CLIST(regclist), GTK_SELECTION_SINGLE); - gtk_widget_set_usize(GTK_WIDGET(regclist), width, height); - gtk_clist_set_column_justification(GTK_CLIST(regclist), 0, - GTK_JUSTIFY_LEFT); - gtk_clist_set_column_width(GTK_CLIST(regclist), 0, width); - - - pango_font = pango_font_description_from_string(FIXED_FONT); - gtk_widget_modify_font(regclist, pango_font); - - for (i = 0; i < 24; i++) - gtk_clist_append(GTK_CLIST(regclist), regdummy); - - gtk_container_add(GTK_CONTAINER(fixed_frame), regclist); - - return fixed_frame; -} - - -/* Show registers. */ -void -regwin_Show(void) -{ - char TextTmp[255]; - int row = 0; - unsigned char PSW = cpu8051_ReadD(_PSW_); - unsigned char Rbank; - - gtk_clist_freeze(GTK_CLIST(regclist)); - - /* Main registers */ - sprintf(TextTmp , "PC = %.4X", cpu8051.pc); - gtk_clist_set_text(GTK_CLIST(regclist), row++, 0, TextTmp); - sprintf(TextTmp , "SP = %.2X", cpu8051_ReadD(_SP_)); - gtk_clist_set_text(GTK_CLIST(regclist), row++, 0, TextTmp); - sprintf(TextTmp , "A = %.2X", cpu8051_ReadD(_ACC_)); - gtk_clist_set_text(GTK_CLIST(regclist), row++, 0, TextTmp); - sprintf(TextTmp , "B = %.2X", cpu8051_ReadD(_B_)); - gtk_clist_set_text(GTK_CLIST(regclist), row++, 0, TextTmp); - sprintf(TextTmp , "DPTR = %.4X", (cpu8051_ReadD(_DPTRHIGH_) << 8) + - cpu8051_ReadD(_DPTRLOW_)); - gtk_clist_set_text(GTK_CLIST(regclist), row++, 0, TextTmp); - - /* Program Status Word */ - sprintf(TextTmp, "PSW = %.2X", PSW); - gtk_clist_set_text(GTK_CLIST(regclist), row++, 0, TextTmp); - - /* Ports registers */ - sprintf(TextTmp , "P0 = %.2X", cpu8051_ReadD(_P0_)); - gtk_clist_set_text(GTK_CLIST(regclist), row++, 0, TextTmp); - sprintf(TextTmp , "P1 = %.2X", cpu8051_ReadD(_P1_)); - gtk_clist_set_text(GTK_CLIST(regclist), row++, 0, TextTmp); - sprintf(TextTmp , "P2 = %.2X", cpu8051_ReadD(_P2_)); - gtk_clist_set_text(GTK_CLIST(regclist), row++, 0, TextTmp); - sprintf(TextTmp , "P3 = %.2X", cpu8051_ReadD(_P3_)); - gtk_clist_set_text(GTK_CLIST(regclist), row++, 0, TextTmp); - - /* Misc Registers */ - sprintf(TextTmp , "TCON = %.2X", cpu8051_ReadD(_TCON_)); - gtk_clist_set_text(GTK_CLIST(regclist), row++, 0, TextTmp); - sprintf(TextTmp , "TMOD = %.2X", cpu8051_ReadD(_TMOD_)); - gtk_clist_set_text(GTK_CLIST(regclist), row++, 0, TextTmp); - sprintf(TextTmp , "SCON = %.2X", cpu8051_ReadD(_SCON_)); - gtk_clist_set_text(GTK_CLIST(regclist), row++, 0, TextTmp); - sprintf(TextTmp , "IE = %.2X", cpu8051_ReadD(_IE_)); - gtk_clist_set_text(GTK_CLIST(regclist), row++, 0, TextTmp); - sprintf(TextTmp , "IP = %.2X", cpu8051_ReadD(_IP_)); - gtk_clist_set_text(GTK_CLIST(regclist), row++, 0, TextTmp); - - /* R0-R7 Registers in current Bank */ - Rbank = cpu8051_ReadD(_PSW_) & 0x18; - sprintf(TextTmp , "Bank = %.2X", Rbank); - gtk_clist_set_text(GTK_CLIST(regclist), row++, 0, TextTmp); - sprintf(TextTmp , "R0 = %.2X", cpu8051_ReadD(_R0_ + Rbank)); - gtk_clist_set_text(GTK_CLIST(regclist), row++, 0, TextTmp); - sprintf(TextTmp , "R1 = %.2X", cpu8051_ReadD(_R1_ + Rbank)); - gtk_clist_set_text(GTK_CLIST(regclist), row++, 0, TextTmp); - sprintf(TextTmp , "R2 = %.2X", cpu8051_ReadD(_R2_ + Rbank)); - gtk_clist_set_text(GTK_CLIST(regclist), row++, 0, TextTmp); - sprintf(TextTmp , "R3 = %.2X", cpu8051_ReadD(_R3_ + Rbank)); - gtk_clist_set_text(GTK_CLIST(regclist), row++, 0, TextTmp); - sprintf(TextTmp , "R4 = %.2X", cpu8051_ReadD(_R4_ + Rbank)); - gtk_clist_set_text(GTK_CLIST(regclist), row++, 0, TextTmp); - sprintf(TextTmp , "R5 = %.2X", cpu8051_ReadD(_R5_ + Rbank)); - gtk_clist_set_text(GTK_CLIST(regclist), row++, 0, TextTmp); - sprintf(TextTmp , "R6 = %.2X", cpu8051_ReadD(_R6_ + Rbank)); - gtk_clist_set_text(GTK_CLIST(regclist), row++, 0, TextTmp); - sprintf(TextTmp , "R7 = %.2X", cpu8051_ReadD(_R7_ + Rbank)); - gtk_clist_set_text(GTK_CLIST(regclist), row++, 0, TextTmp); - - gtk_clist_select_row(GTK_CLIST(regclist), 0, 0); - gtk_clist_thaw(GTK_CLIST(regclist)); -} diff -Nru emu8051-1.1.1/src/regwin.h emu8051-2.0.1/src/regwin.h --- emu8051-1.1.1/src/regwin.h 2011-10-29 21:06:32.000000000 +0000 +++ emu8051-2.0.1/src/regwin.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,34 +0,0 @@ -/* - * regwin.h - * - * Copyright (C) 1999 Jonathan St-André - * Copyright (C) 1999 Hugo Villeneuve - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef REGWIN_H -#define REGWIN_H 1 - -#include -#include "gtksizes.h" - -GtkWidget * -regwin_init(int width, int height); - -void -regwin_Show(void); - -#endif /* REGWIN_H */ diff -Nru emu8051-1.1.1/src/viewmenu.c emu8051-2.0.1/src/viewmenu.c --- emu8051-1.1.1/src/viewmenu.c 2011-10-29 21:06:32.000000000 +0000 +++ emu8051-2.0.1/src/viewmenu.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,77 +0,0 @@ -/* - * viewmenu.c - * - * Copyright (C) 1999 Jonathan St-André - * Copyright (C) 1999 Hugo Villeneuve - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#if HAVE_CONFIG_H -# include "config.h" -#endif - -#include - -#include "common.h" -#include "emugtk.h" /* For AddMenuSeparator() function. */ -#include "messagebox.h" -#include "viewmenu.h" - -static void -ViewMenuExternalDump(gchar *string) -{ - ShowMessage("External Memory Dump", "Not implemented yet!", - GTK_JUSTIFY_CENTER, MESSAGE_DIALOG_NORMAL_FONT); -} - -static void -ViewMenuInternalDump(gchar *string) -{ - ShowMessage("Internal Memory Dump", "Not implemented yet!", - GTK_JUSTIFY_CENTER, MESSAGE_DIALOG_NORMAL_FONT); -} - -void -ViewAddMenu(GtkWidget *menu_bar) -{ - GtkWidget *item; - GtkWidget *menu; - - menu = gtk_menu_new(); - - /* Create the 'Viewmenu External Memory Dump' item. */ - item = gtk_menu_item_new_with_label("External Memory Dump"); - gtk_menu_append(GTK_MENU(menu), item); - /* Attach the callback functions to the activate signal. */ - gtk_signal_connect_object(GTK_OBJECT(item), "activate", - GTK_SIGNAL_FUNC(ViewMenuExternalDump), - NULL); - - AddMenuSeparator(menu); - - /* Create the 'Viewmenu Internal Memory Dump' item. */ - item = gtk_menu_item_new_with_label("Internal Memory Dump"); - gtk_menu_append(GTK_MENU(menu), item); - /* Attach the callback functions to the activate signal. */ - gtk_signal_connect_object(GTK_OBJECT(item), "activate", - GTK_SIGNAL_FUNC(ViewMenuInternalDump), - NULL); - - /* Adding submenu title. */ - item = gtk_menu_item_new_with_label("View"); - gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), menu); - gtk_menu_bar_append(GTK_MENU_BAR(menu_bar), item); -} diff -Nru emu8051-1.1.1/src/viewmenu.h emu8051-2.0.1/src/viewmenu.h --- emu8051-1.1.1/src/viewmenu.h 2011-10-29 21:06:32.000000000 +0000 +++ emu8051-2.0.1/src/viewmenu.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ -/* - * viewmenu.h - * - * Copyright (C) 1999 Jonathan St-André - * Copyright (C) 1999 Hugo Villeneuve - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef VIEWMENU_H -#define VIEWMENU_H 1 - -#include - -void -ViewAddMenu(GtkWidget *menu_bar); - -#endif /* VIEWMENU_H */ diff -Nru emu8051-1.1.1/test-files/siae1.hex emu8051-2.0.1/test-files/siae1.hex --- emu8051-1.1.1/test-files/siae1.hex 2011-10-29 21:06:32.000000000 +0000 +++ emu8051-2.0.1/test-files/siae1.hex 1970-01-01 00:00:00.000000000 +0000 @@ -1,115 +0,0 @@ -:0600000002003302003390 -:03000B00020033BD -:03001300020033B5 -:03001B00020033AD -:03002300020033A5 -:03002B000200339D -:100033007581801202D312024375540075550085F1 -:100043004356854457755BC61204C8120493740360 -:100053002557F543855A56855B57755B0A1204C8C5 -:10006300120493E5574430F55E75F000E543120240 -:10007300DC85514F85525085535175522E855E5301 -:1000830074501203067404120306E54F120306E5C7 -:1000930050120306E551120306E552120306E55317 -:1000A300120306745A12030675300075315D7532FA -:1000B300C01204E78534F0E5351202DC74501203F4 -:1000C300067401120306E54F120306E550120306F8 -:1000D300E551120306E552120306E55312030674B3 -:1000E3005A12030675F000E5361202DC745012034F -:1000F300067405120306E551120306E552120306C0 -:10010300E553120306745A12030675F000E537121D -:1001130002DC74501203067406120306E55112033F -:1001230006E552120306E553120306745A12030638 -:10013300E53875F00584C5F0C3334430F55FC5F089 -:1001430075F0001202DC85525085535175522E858D -:100153005F5374501203067408120306E55012032A -:1001630006E551120306E552120306E55312030690 -:10017300745A12030675540075550085415685421D -:1001830057755B641204C87554001204938556F0C6 -:10019300E5571202DC74501203067402120306E5DB -:1001A30051120306E552120306E553120306745A6D -:1001B300120306755400755500853B56853C5775EB -:1001C3005B0F1204C812049385575C855A56855BEE -:1001D30057755B641204C81204938556F0E55712F1 -:1001E30002DC85525D85535E75F000E55C1202DC2E -:1001F30085524F85535075512E855D52855E5374DC -:10020300501203067407120306E54F120306E55066 -:10021300120306E551120306E552120306E55312D3 -:100223000306745A12030674201203060139756219 -:1002330016740075F000D5F0FDD5E0F7D562F22213 -:10024300783B7900E9120255A64E08A64D0809B974 -:1002530008F2D2B3C2B1C2B300D2B3C2B6C2B300C2 -:10026300D2B3F580C2B300D2B3D2B6C2B300D2B315 -:10027300D2B1C2B31202CA7580FFD2B3C2B1C2B344 -:1002830000D2B3C2B7C2B30085804DD2B3D2B7C2D6 -:10029300B300D2B3D2B1C2B300D2B3D2B2C2B300AD -:1002A300D2B3C2B1C2B300D2B3C2B7C2B300858066 -:1002B3004E00D2B3D2B7C2B300D2B3D2B1C2B300ED -:1002C300D2B3C2B2C2B322D2B300C2B330B0F822A7 -:1002D30075D54475B0F3513122C00078537554007D -:1002E30075550085F056F557755800755900755AC0 -:1002F30000755B0A120314E55B4430F618B84EE848 -:10030300D00022F586B290E5AA53E08060F9E58635 -:1003130022C004C003C002C001C0007504207503DD -:100323000075020075010075000012038F1203A50A -:100333004022C3E5039558403A7019C3E502955925 -:1003430040317010C3E501955A40287007C3E5009A -:10035300955B401FC3E500955BF500E501955AF5F4 -:1003630001E5029559F502E5039558F503E557D2E2 -:10037300E0F557DCB585035885025985015A850098 -:100383005BD000D001D002D003D00422C3E55733A1 -:10039300F557E55633F556E55533F555E55433F53D -:1003A3005422E50033F500E50133F501E50233F5A9 -:1003B30002E50333F50322C002C001C00075021B2E -:1003C30075010075000012040312041D4010C3E5FB -:1003D30001955A401C7007C3E500955B4013C3E5C4 -:1003E30000955BF500E501955AF501E557D2E0F577 -:1003F30057DAD385015A85005BD000D001D00222A1 -:10040300C3E55733F557E55633F556E55533F555FB -:10041300E5543392E35407F55422E50033F500E540 -:100423000133F50122C002C001C000750216750137 -:10043300007500001204711204844010C3E5019595 -:100443005A401C7007C3E500955B4013C3E5009554 -:100453005BF500E501955AF501E557D2E0F557DA6A -:10046300D385015A85005BD000D001D00222C3E5B9 -:100473005733F557E55633F556E55533F55592E6BB -:1004830022E50033F500E5013392E6543FF50122FE -:1004930085575B85565A535A0F1204B81204B81283 -:1004A30004B81204B853540F8556578555568554CE -:1004B3005575540022E55413F554E55513F555E5E8 -:1004C3005613F55622E556855BF0A4F55685F0558F -:1004D300E557855BF0A4F557C5F02556F556E43589 -:1004E30055F555221205751205981205B5E53654D2 -:1004F300F0C4C5F0E53754F025F0F5F01205DAF84D -:10050300E5F0240130D605E8F90205131205DAF9FE -:10051300E5F024105007E8FAE9FB020536F5F0127E -:1005230005DAFAE5F0240130D605EAFB02053612B6 -:1005330005DAFB88F0E9AC36120553F88AF0EBAC28 -:1005430036120553FA88F0EAAC37120553F5382210 -:10055300C0F0C223C395F05005F42401D223F5F073 -:10056300EC540FA454F0C4302303F42401D0F02539 -:10057300F02275540775552775560E755700E530EB -:10058300B4000B85315A85325B71BA0205918556E9 -:100593003485573522C3E5359490F556E5349401F7 -:1005A300F555755700C3755A25755B809128855796 -:1005B3003622755400755500C3E54394285001E471 -:1005C300F556755700755800755900755A00755BD7 -:1005D300A071148557372224E8F58274053400F599 -:1005E3008374009322111123465F5F666666666615 -:1005F3006666585858111123465F5F6666666666DD -:100603006666585858111123465F5F6666666666CC -:100613006666585858111123465F5F6666666666BC -:100623006666585858111123465F5F6666666666AC -:100633006666585858111123465F5F66666666669C -:100643006666585858111123465F5F66666666668C -:100653006666585858111123465B5B626262626298 -:1006630062625454541111234651515858585858E2 -:100673005858585858111123464A4A51515151510B -:10068300515151515111111C3846464A4A4A4A4A5E -:100693004A4A4A4A4A11111C343F3F4343434343A6 -:1006A300434343434311111C3438383C3C3C3C3CEA -:1006B3003C3C3C3C3C11111C2A2D2D313131313154 -:1006C300313131313111111C3438383C3C3C3C3C24 -:1006D3003C3C3C3C3C11111C2A2D2D313131313134 -:0506E30031313131311D -:00000001FF diff -Nru emu8051-1.1.1/test-files/.svn/all-wcprops emu8051-2.0.1/test-files/.svn/all-wcprops --- emu8051-1.1.1/test-files/.svn/all-wcprops 2011-10-29 21:06:32.000000000 +0000 +++ emu8051-2.0.1/test-files/.svn/all-wcprops 1970-01-01 00:00:00.000000000 +0000 @@ -1,29 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 32 -/svn/!svn/ver/5/trunk/test-files -END -timer.asm -K 25 -svn:wc:ra_dav:version-url -V 42 -/svn/!svn/ver/5/trunk/test-files/timer.asm -END -test.hex -K 25 -svn:wc:ra_dav:version-url -V 41 -/svn/!svn/ver/5/trunk/test-files/test.hex -END -timer.hex -K 25 -svn:wc:ra_dav:version-url -V 42 -/svn/!svn/ver/5/trunk/test-files/timer.hex -END -siae1.hex -K 25 -svn:wc:ra_dav:version-url -V 42 -/svn/!svn/ver/5/trunk/test-files/siae1.hex -END diff -Nru emu8051-1.1.1/test-files/.svn/entries emu8051-2.0.1/test-files/.svn/entries --- emu8051-1.1.1/test-files/.svn/entries 2011-10-29 21:06:32.000000000 +0000 +++ emu8051-2.0.1/test-files/.svn/entries 1970-01-01 00:00:00.000000000 +0000 @@ -1,164 +0,0 @@ -10 - -dir -21 -https://emu8051.googlecode.com/svn/trunk/test-files -https://emu8051.googlecode.com/svn - - - -2004-05-12T03:38:19.550060Z -5 - - - - - - - - - - - - - - - -b16f683b-584c-df02-229f-e7a19a03f390 - -timer.asm -file - - - - -2011-10-29T21:06:32.000000Z -010b03b818d0d20112337c0c6d95ce00 -2004-05-08T02:56:47.789250Z -1 - - - - - - - - - - - - - - - - - - - - - - -7212 - -test.hex -file - - - - -2011-10-29T21:06:32.000000Z -6d50a74896d3ef9614261330e1b36fd5 -2004-05-08T02:56:47.789250Z -1 - - - - - - - - - - - - - - - - - - - - - - -504 - -timer.hex -file - - - - -2011-10-29T21:06:32.000000Z -1f1d91bdc38628e2aa0885e24613fa68 -2004-05-08T02:56:47.789250Z -1 - - - - - - - - - - - - - - - - - - - - - - -258 - -siae1.hex -file - - - - -2011-10-29T21:06:32.000000Z -242e51929fd4fd2f7af8208644191b65 -2004-05-08T02:56:47.789250Z -1 - - - - - - - - - - - - - - - - - - - - - - -4856 - diff -Nru emu8051-1.1.1/test-files/.svn/text-base/siae1.hex.svn-base emu8051-2.0.1/test-files/.svn/text-base/siae1.hex.svn-base --- emu8051-1.1.1/test-files/.svn/text-base/siae1.hex.svn-base 2011-10-29 21:06:32.000000000 +0000 +++ emu8051-2.0.1/test-files/.svn/text-base/siae1.hex.svn-base 1970-01-01 00:00:00.000000000 +0000 @@ -1,115 +0,0 @@ -:0600000002003302003390 -:03000B00020033BD -:03001300020033B5 -:03001B00020033AD -:03002300020033A5 -:03002B000200339D -:100033007581801202D312024375540075550085F1 -:100043004356854457755BC61204C8120493740360 -:100053002557F543855A56855B57755B0A1204C8C5 -:10006300120493E5574430F55E75F000E543120240 -:10007300DC85514F85525085535175522E855E5301 -:1000830074501203067404120306E54F120306E5C7 -:1000930050120306E551120306E552120306E55317 -:1000A300120306745A12030675300075315D7532FA -:1000B300C01204E78534F0E5351202DC74501203F4 -:1000C300067401120306E54F120306E550120306F8 -:1000D300E551120306E552120306E55312030674B3 -:1000E3005A12030675F000E5361202DC745012034F -:1000F300067405120306E551120306E552120306C0 -:10010300E553120306745A12030675F000E537121D -:1001130002DC74501203067406120306E55112033F -:1001230006E552120306E553120306745A12030638 -:10013300E53875F00584C5F0C3334430F55FC5F089 -:1001430075F0001202DC85525085535175522E858D -:100153005F5374501203067408120306E55012032A -:1001630006E551120306E552120306E55312030690 -:10017300745A12030675540075550085415685421D -:1001830057755B641204C87554001204938556F0C6 -:10019300E5571202DC74501203067402120306E5DB -:1001A30051120306E552120306E553120306745A6D -:1001B300120306755400755500853B56853C5775EB -:1001C3005B0F1204C812049385575C855A56855BEE -:1001D30057755B641204C81204938556F0E55712F1 -:1001E30002DC85525D85535E75F000E55C1202DC2E -:1001F30085524F85535075512E855D52855E5374DC -:10020300501203067407120306E54F120306E55066 -:10021300120306E551120306E552120306E55312D3 -:100223000306745A12030674201203060139756219 -:1002330016740075F000D5F0FDD5E0F7D562F22213 -:10024300783B7900E9120255A64E08A64D0809B974 -:1002530008F2D2B3C2B1C2B300D2B3C2B6C2B300C2 -:10026300D2B3F580C2B300D2B3D2B6C2B300D2B315 -:10027300D2B1C2B31202CA7580FFD2B3C2B1C2B344 -:1002830000D2B3C2B7C2B30085804DD2B3D2B7C2D6 -:10029300B300D2B3D2B1C2B300D2B3D2B2C2B300AD -:1002A300D2B3C2B1C2B300D2B3C2B7C2B300858066 -:1002B3004E00D2B3D2B7C2B300D2B3D2B1C2B300ED -:1002C300D2B3C2B2C2B322D2B300C2B330B0F822A7 -:1002D30075D54475B0F3513122C00078537554007D -:1002E30075550085F056F557755800755900755AC0 -:1002F30000755B0A120314E55B4430F618B84EE848 -:10030300D00022F586B290E5AA53E08060F9E58635 -:1003130022C004C003C002C001C0007504207503DD -:100323000075020075010075000012038F1203A50A -:100333004022C3E5039558403A7019C3E502955925 -:1003430040317010C3E501955A40287007C3E5009A -:10035300955B401FC3E500955BF500E501955AF5F4 -:1003630001E5029559F502E5039558F503E557D2E2 -:10037300E0F557DCB585035885025985015A850098 -:100383005BD000D001D002D003D00422C3E55733A1 -:10039300F557E55633F556E55533F555E55433F53D -:1003A3005422E50033F500E50133F501E50233F5A9 -:1003B30002E50333F50322C002C001C00075021B2E -:1003C30075010075000012040312041D4010C3E5FB -:1003D30001955A401C7007C3E500955B4013C3E5C4 -:1003E30000955BF500E501955AF501E557D2E0F577 -:1003F30057DAD385015A85005BD000D001D00222A1 -:10040300C3E55733F557E55633F556E55533F555FB -:10041300E5543392E35407F55422E50033F500E540 -:100423000133F50122C002C001C000750216750137 -:10043300007500001204711204844010C3E5019595 -:100443005A401C7007C3E500955B4013C3E5009554 -:100453005BF500E501955AF501E557D2E0F557DA6A -:10046300D385015A85005BD000D001D00222C3E5B9 -:100473005733F557E55633F556E55533F55592E6BB -:1004830022E50033F500E5013392E6543FF50122FE -:1004930085575B85565A535A0F1204B81204B81283 -:1004A30004B81204B853540F8556578555568554CE -:1004B3005575540022E55413F554E55513F555E5E8 -:1004C3005613F55622E556855BF0A4F55685F0558F -:1004D300E557855BF0A4F557C5F02556F556E43589 -:1004E30055F555221205751205981205B5E53654D2 -:1004F300F0C4C5F0E53754F025F0F5F01205DAF84D -:10050300E5F0240130D605E8F90205131205DAF9FE -:10051300E5F024105007E8FAE9FB020536F5F0127E -:1005230005DAFAE5F0240130D605EAFB02053612B6 -:1005330005DAFB88F0E9AC36120553F88AF0EBAC28 -:1005430036120553FA88F0EAAC37120553F5382210 -:10055300C0F0C223C395F05005F42401D223F5F073 -:10056300EC540FA454F0C4302303F42401D0F02539 -:10057300F02275540775552775560E755700E530EB -:10058300B4000B85315A85325B71BA0205918556E9 -:100593003485573522C3E5359490F556E5349401F7 -:1005A300F555755700C3755A25755B809128855796 -:1005B3003622755400755500C3E54394285001E471 -:1005C300F556755700755800755900755A00755BD7 -:1005D300A071148557372224E8F58274053400F599 -:1005E3008374009322111123465F5F666666666615 -:1005F3006666585858111123465F5F6666666666DD -:100603006666585858111123465F5F6666666666CC -:100613006666585858111123465F5F6666666666BC -:100623006666585858111123465F5F6666666666AC -:100633006666585858111123465F5F66666666669C -:100643006666585858111123465F5F66666666668C -:100653006666585858111123465B5B626262626298 -:1006630062625454541111234651515858585858E2 -:100673005858585858111123464A4A51515151510B -:10068300515151515111111C3846464A4A4A4A4A5E -:100693004A4A4A4A4A11111C343F3F4343434343A6 -:1006A300434343434311111C3438383C3C3C3C3CEA -:1006B3003C3C3C3C3C11111C2A2D2D313131313154 -:1006C300313131313111111C3438383C3C3C3C3C24 -:1006D3003C3C3C3C3C11111C2A2D2D313131313134 -:0506E30031313131311D -:00000001FF diff -Nru emu8051-1.1.1/test-files/.svn/text-base/test.hex.svn-base emu8051-2.0.1/test-files/.svn/text-base/test.hex.svn-base --- emu8051-1.1.1/test-files/.svn/text-base/test.hex.svn-base 2011-10-29 21:06:32.000000000 +0000 +++ emu8051-2.0.1/test-files/.svn/text-base/test.hex.svn-base 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ -:03000000020033C8 -:1000330075818075D54475A000C290E4F500E50094 -:1000430012007DF586D29005A07400D5E0FDC29024 -:10005300E5AA53E08060F9E5861200690500C3E56F -:1000630000945040D92222752005740075F000D504 -:10007300F0FDD5E0F7D520F20022248BF582740041 -:100083003400F5837400932252504D3A31303234A8 -:1000930035204D41503A313033204D41543A3131BE -:1000A30030204241543A31322E3420202020202067 -:1000B3000D0A0A45474F3A31342E36202054505307 -:1000C3003A31303020414E473A33302020434C54AC -:0B00D3003A313038202020202020206F -:00000001FF diff -Nru emu8051-1.1.1/test-files/.svn/text-base/timer.asm.svn-base emu8051-2.0.1/test-files/.svn/text-base/timer.asm.svn-base --- emu8051-1.1.1/test-files/.svn/text-base/timer.asm.svn-base 2011-10-29 21:06:32.000000000 +0000 +++ emu8051-2.0.1/test-files/.svn/text-base/timer.asm.svn-base 1970-01-01 00:00:00.000000000 +0000 @@ -1,179 +0,0 @@ -;******************************************************************************* -;* Système d'Injection et d'Allumage Électronique * -;* Version : 01 * -;* Auteur : Hugo Villeneuve * -;* * -;* 10 mars 1999 * -;******************************************************************************* - - $MOD52 ; Micro-contrôleur Atmel AT89S8252 - - -;******************************************************************************* -;* Définition des constantes * -;******************************************************************************* - -TOS EQU 60h ; Adresse du dessus de la pile. -CR EQU 0Dh ; Code ASCII pour un retour de chariot. -LF EQU 0Ah ; Code ASCII pour un changement de ligne - - -;******************************************************************************* -;* Définition des variables * -;******************************************************************************* - BSEG - ORG 20h -C_FLAG: DBIT 1 -Z_FLAG: DBIT 2 -N_FLAG: DBIT 3 ; Utilisé par la sous-routine MULT8_16 -SIGNE: DBIT 4 ; Utilisé pour l'interpolation. - - DSEG - ORG 30h -PERIODE2: DS 1 ; Période pour une rotation du vilebrequin, sur 24 bits. -PERIODE1: DS 1 -PERIODE0: DS 1 -POSITION_VILB: DS 1 ; Renseignement sur la position actuelle du vilebrequin (zones 0,1 ou 2). -VITESSE_RPM: DS 2 ; Vitesse de rotation du moteur en RPM. -INDEX_RPM: DS 1 ; Index de 8 bits pour l'adressage des colonnes de la table d'allumage. -INDEX_MAP: DS 1 ; Index de 8 bits pour l'adressage des lignes de la table d'allumage. -ANGLE: DS 1 ; Angle d'allumage calculé à partir de la table. -BAT: DS 2 ; Voltage de la batterie. -MAT: DS 2 ; Manifold Air Temperature. -CLT: DS 2 ; Coolant Temperature. -TPS: DS 2 ; Throttle Position Sensor. -MAP: DS 2 ; Manifold Absolute Pressure. -EGO: DS 2 ; Exhaust Gas-Oxygen Sensor. -CAN6: DS 2 ; Canal #6 du convertisseur AN. -CAN7: DS 2 ; Canal #7 du convertisseur AN. -GAMMA: DS 2 ; Rapport Air/Carburant. -LSB_CAN: DS 1 ; Octet de poids faible de la conversion Analogique-Numérique. -MSB_CAN: DS 1 ; Octet de poids fort de la conversion Analogique-Numérique. -NOMBRE4: DS 1 ; Stockage des codes ASCII pour les conversions. -NOMBRE3: DS 1 -NOMBRE2: DS 1 -NOMBRE1: DS 1 -NOMBRE0: DS 1 -C3: DS 1 ; Accumulateur C de 32 bits pour les calculs mathématiques. -C2: DS 1 -C1: DS 1 -C0: DS 1 -D3: DS 1 ; Accumulateur D de 32 bits pour les calculs mathématiques. -D2: DS 1 -D1: DS 1 -D0: DS 1 -TMP6: DS 1 ; Variables temporaires utilisées pour les calculs mathématiques. -TMP5: DS 1 ; FAIRE LE MÉNAGE VARIABLES NON UTILISEES!!! -TMP4: DS 1 -TMP3: DS 1 -TMP2: DS 1 -TMP1: DS 1 -TMP0: DS 1 -VAR0: DS 1 -VAR1: DS 1 -VAR2: DS 1 - - -;******************************************************************************* -;* Définition des régistres spécifiques au AT89S8252 * -;******************************************************************************* -SPCR DATA 0D5h ; SPCR - SPI Control Register -SPSR DATA 0AAh ; SPSR - SPI Status Register -SPIF EQU 10000000b ; Masque pour le drapeau SPI. -WCOL EQU 01000000b ; Masque pour le drapeau Write Collision. -SPDR DATA 086h ; SPDR - SPI Data Register - - -;******************************************************************************* -;* Vecteurs d'interruptions * -;******************************************************************************* - CSEG - - ORG 0000h ; Vecteur d'interruption du RESET. - JMP DEBUT - - ORG 0003h ; Vecteur pour l'interruption EXTERNE 0. - JMP VILEBREQUIN - - ORG 000Bh ; Vecteur pour l'interruption du TIMER 0. - JMP DEBUT - - ORG 0013h ; Vecteur pour l'interruption EXTERNE 1. - JMP DEBUT - - ORG 001Bh ; Vecteur pour l'interruption du TIMER 1. - JMP DEBUT - - ORG 0023h ; Vecteur pour l'interruption du Port série. - JMP DEBUT - - ORG 002Bh ; Vecteur pour l'interruption du TIMER 2. - JMP DEBUT - - -;******************************************************************************* -;* Début du programme principal * -;******************************************************************************* - ORG 0033h - -DEBUT: - MOV SP,#TOS ; Initialisation de la pile. - CALL INITIALISATION - ; il ne faut pas modifier la valeur de P1.0!!! - -ICI: - NOP - NOP - NOP - NOP - - JMP ICI - - -;******************************************************************************* -;* Délai * -;******************************************************************************* -DELAI: MOV TMP0,#016h ; Délai de 1/2 seconde. -B3: MOV A,#0 -B2: MOV B,#0 -B1: DJNZ B,B1 - DJNZ ACC,B2 - DJNZ TMP0,B3 - RET - - - -;******************************************************************************* -;* INTERRUPTION * -;******************************************************************************* -VILEBREQUIN: - RETI - - -;******************************************************************************* -;* Initialisation * -;******************************************************************************* -INITIALISATION: MOV SPCR,#01000100b ; Interruption SPI désactivée; - ; Activation du port SPI; - ; Ordre des transferts : MSB en premier; - ; Opération en mode escalve (SLAVE); - ; Polarité de l'horloge : niveau bas si inactif. - ; Phase de l'horloge : transfert sur front montant. - MOV TH0,#2 - MOV TL0,#55h - SETB TCON.4 ; Timer 0 ON. - SETB TCON.6 ; Timer 1 ON. - MOV TMOD,#00010001B ; Initialisation des timers 0 et 1 en timers de - ; 16 bits, incrémentés par l'horloge interne - ; Chaque timer est incrémenté tant que le bit correspondant de - ; TCON est à 1 (TCON.4 et TCON.6). - RET - - - - END - - - - - diff -Nru emu8051-1.1.1/test-files/.svn/text-base/timer.hex.svn-base emu8051-2.0.1/test-files/.svn/text-base/timer.hex.svn-base --- emu8051-1.1.1/test-files/.svn/text-base/timer.hex.svn-base 2011-10-29 21:06:32.000000000 +0000 +++ emu8051-2.0.1/test-files/.svn/text-base/timer.hex.svn-base 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ -:0600000002003302005172 -:03000B00020033BD -:03001300020033B5 -:03001B00020033AD -:03002300020033A5 -:03002B000200339D -:100033007581601200520000000080FA756016742A -:100043000075F000D5F0FDD5E0F7D560F2223275EA -:10005300D544758C02758A55D28CD28E758911223E -:00000001FF diff -Nru emu8051-1.1.1/test-files/test.hex emu8051-2.0.1/test-files/test.hex --- emu8051-1.1.1/test-files/test.hex 2011-10-29 21:06:32.000000000 +0000 +++ emu8051-2.0.1/test-files/test.hex 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ -:03000000020033C8 -:1000330075818075D54475A000C290E4F500E50094 -:1000430012007DF586D29005A07400D5E0FDC29024 -:10005300E5AA53E08060F9E5861200690500C3E56F -:1000630000945040D92222752005740075F000D504 -:10007300F0FDD5E0F7D520F20022248BF582740041 -:100083003400F5837400932252504D3A31303234A8 -:1000930035204D41503A313033204D41543A3131BE -:1000A30030204241543A31322E3420202020202067 -:1000B3000D0A0A45474F3A31342E36202054505307 -:1000C3003A31303020414E473A33302020434C54AC -:0B00D3003A313038202020202020206F -:00000001FF diff -Nru emu8051-1.1.1/test-files/timer.asm emu8051-2.0.1/test-files/timer.asm --- emu8051-1.1.1/test-files/timer.asm 2011-10-29 21:06:32.000000000 +0000 +++ emu8051-2.0.1/test-files/timer.asm 1970-01-01 00:00:00.000000000 +0000 @@ -1,179 +0,0 @@ -;******************************************************************************* -;* Système d'Injection et d'Allumage Électronique * -;* Version : 01 * -;* Auteur : Hugo Villeneuve * -;* * -;* 10 mars 1999 * -;******************************************************************************* - - $MOD52 ; Micro-contrôleur Atmel AT89S8252 - - -;******************************************************************************* -;* Définition des constantes * -;******************************************************************************* - -TOS EQU 60h ; Adresse du dessus de la pile. -CR EQU 0Dh ; Code ASCII pour un retour de chariot. -LF EQU 0Ah ; Code ASCII pour un changement de ligne - - -;******************************************************************************* -;* Définition des variables * -;******************************************************************************* - BSEG - ORG 20h -C_FLAG: DBIT 1 -Z_FLAG: DBIT 2 -N_FLAG: DBIT 3 ; Utilisé par la sous-routine MULT8_16 -SIGNE: DBIT 4 ; Utilisé pour l'interpolation. - - DSEG - ORG 30h -PERIODE2: DS 1 ; Période pour une rotation du vilebrequin, sur 24 bits. -PERIODE1: DS 1 -PERIODE0: DS 1 -POSITION_VILB: DS 1 ; Renseignement sur la position actuelle du vilebrequin (zones 0,1 ou 2). -VITESSE_RPM: DS 2 ; Vitesse de rotation du moteur en RPM. -INDEX_RPM: DS 1 ; Index de 8 bits pour l'adressage des colonnes de la table d'allumage. -INDEX_MAP: DS 1 ; Index de 8 bits pour l'adressage des lignes de la table d'allumage. -ANGLE: DS 1 ; Angle d'allumage calculé à partir de la table. -BAT: DS 2 ; Voltage de la batterie. -MAT: DS 2 ; Manifold Air Temperature. -CLT: DS 2 ; Coolant Temperature. -TPS: DS 2 ; Throttle Position Sensor. -MAP: DS 2 ; Manifold Absolute Pressure. -EGO: DS 2 ; Exhaust Gas-Oxygen Sensor. -CAN6: DS 2 ; Canal #6 du convertisseur AN. -CAN7: DS 2 ; Canal #7 du convertisseur AN. -GAMMA: DS 2 ; Rapport Air/Carburant. -LSB_CAN: DS 1 ; Octet de poids faible de la conversion Analogique-Numérique. -MSB_CAN: DS 1 ; Octet de poids fort de la conversion Analogique-Numérique. -NOMBRE4: DS 1 ; Stockage des codes ASCII pour les conversions. -NOMBRE3: DS 1 -NOMBRE2: DS 1 -NOMBRE1: DS 1 -NOMBRE0: DS 1 -C3: DS 1 ; Accumulateur C de 32 bits pour les calculs mathématiques. -C2: DS 1 -C1: DS 1 -C0: DS 1 -D3: DS 1 ; Accumulateur D de 32 bits pour les calculs mathématiques. -D2: DS 1 -D1: DS 1 -D0: DS 1 -TMP6: DS 1 ; Variables temporaires utilisées pour les calculs mathématiques. -TMP5: DS 1 ; FAIRE LE MÉNAGE VARIABLES NON UTILISEES!!! -TMP4: DS 1 -TMP3: DS 1 -TMP2: DS 1 -TMP1: DS 1 -TMP0: DS 1 -VAR0: DS 1 -VAR1: DS 1 -VAR2: DS 1 - - -;******************************************************************************* -;* Définition des régistres spécifiques au AT89S8252 * -;******************************************************************************* -SPCR DATA 0D5h ; SPCR - SPI Control Register -SPSR DATA 0AAh ; SPSR - SPI Status Register -SPIF EQU 10000000b ; Masque pour le drapeau SPI. -WCOL EQU 01000000b ; Masque pour le drapeau Write Collision. -SPDR DATA 086h ; SPDR - SPI Data Register - - -;******************************************************************************* -;* Vecteurs d'interruptions * -;******************************************************************************* - CSEG - - ORG 0000h ; Vecteur d'interruption du RESET. - JMP DEBUT - - ORG 0003h ; Vecteur pour l'interruption EXTERNE 0. - JMP VILEBREQUIN - - ORG 000Bh ; Vecteur pour l'interruption du TIMER 0. - JMP DEBUT - - ORG 0013h ; Vecteur pour l'interruption EXTERNE 1. - JMP DEBUT - - ORG 001Bh ; Vecteur pour l'interruption du TIMER 1. - JMP DEBUT - - ORG 0023h ; Vecteur pour l'interruption du Port série. - JMP DEBUT - - ORG 002Bh ; Vecteur pour l'interruption du TIMER 2. - JMP DEBUT - - -;******************************************************************************* -;* Début du programme principal * -;******************************************************************************* - ORG 0033h - -DEBUT: - MOV SP,#TOS ; Initialisation de la pile. - CALL INITIALISATION - ; il ne faut pas modifier la valeur de P1.0!!! - -ICI: - NOP - NOP - NOP - NOP - - JMP ICI - - -;******************************************************************************* -;* Délai * -;******************************************************************************* -DELAI: MOV TMP0,#016h ; Délai de 1/2 seconde. -B3: MOV A,#0 -B2: MOV B,#0 -B1: DJNZ B,B1 - DJNZ ACC,B2 - DJNZ TMP0,B3 - RET - - - -;******************************************************************************* -;* INTERRUPTION * -;******************************************************************************* -VILEBREQUIN: - RETI - - -;******************************************************************************* -;* Initialisation * -;******************************************************************************* -INITIALISATION: MOV SPCR,#01000100b ; Interruption SPI désactivée; - ; Activation du port SPI; - ; Ordre des transferts : MSB en premier; - ; Opération en mode escalve (SLAVE); - ; Polarité de l'horloge : niveau bas si inactif. - ; Phase de l'horloge : transfert sur front montant. - MOV TH0,#2 - MOV TL0,#55h - SETB TCON.4 ; Timer 0 ON. - SETB TCON.6 ; Timer 1 ON. - MOV TMOD,#00010001B ; Initialisation des timers 0 et 1 en timers de - ; 16 bits, incrémentés par l'horloge interne - ; Chaque timer est incrémenté tant que le bit correspondant de - ; TCON est à 1 (TCON.4 et TCON.6). - RET - - - - END - - - - - diff -Nru emu8051-1.1.1/test-files/timer.hex emu8051-2.0.1/test-files/timer.hex --- emu8051-1.1.1/test-files/timer.hex 2011-10-29 21:06:32.000000000 +0000 +++ emu8051-2.0.1/test-files/timer.hex 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ -:0600000002003302005172 -:03000B00020033BD -:03001300020033B5 -:03001B00020033AD -:03002300020033A5 -:03002B000200339D -:100033007581601200520000000080FA756016742A -:100043000075F000D5F0FDD5E0F7D560F2223275EA -:10005300D544758C02758A55D28CD28E758911223E -:00000001FF diff -Nru emu8051-1.1.1/tests/add.asm emu8051-2.0.1/tests/add.asm --- emu8051-1.1.1/tests/add.asm 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/tests/add.asm 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,44 @@ +; Test program to verify correct emu8051 operation +; +; Test desc: ADD +; Test output: PC = $FFF0 +; Test output: SP = $07 +; Test output: A = $20 +; Test output: B = $00 +; Test output: PSW = $01 +; Test output: R0 = $0F +; Test output: R1 = $11 +; Test output: R2 = $10 +; Test output: R3 = $1F +; Test output: R4 = $20 + + ORG 0000h ; Reset vector + + ;; ADDC + + CLR C + MOV A, #0FFh + ADDC A, #10h ; CY=1, A=$0F + MOV R0, A + + MOV A, #00h + ADDC A, #10h ; CY=0, A=$11 + MOV R1, A + + SETB C + MOV A, #0FFh + ADDC A, #10h ; CY=1, A=$10 + MOV R2, A + + ;; ADD + + MOV A, #0FFh + ADD A, #20h ; CY=1, A=$1F + MOV R3, A + + MOV A, #00h + ADD A, #20h ; CY=0, A=$20 + MOV R4, A + + LJMP 0FFF0h + END diff -Nru emu8051-1.1.1/tests/anl.asm emu8051-2.0.1/tests/anl.asm --- emu8051-1.1.1/tests/anl.asm 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/tests/anl.asm 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,27 @@ +; Test program to verify correct emu8051 operation +; +; Test desc: ANL +; Test output: PC = $FFF0 +; Test output: SP = $07 +; Test output: A = $60 +; Test output: B = $60 +; Test output: PSW = $E0 +; Test output: TCON = $01 + + ORG 0000h ; Reset vector + + MOV PSW, #0E0h + CLR TCON.0 + CLR C + ANL C, TCON.0 ; CY Should be 0 + MOV A, PSW + + SETB TCON.0 + ANL C, TCON.0 ; CY Should be 0 + MOV B, PSW + + SETB C + ANL C, TCON.0 ; CY Should be 1 + + LJMP 0FFF0h + END diff -Nru emu8051-1.1.1/tests/cmd_de.sh emu8051-2.0.1/tests/cmd_de.sh --- emu8051-1.1.1/tests/cmd_de.sh 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/tests/cmd_de.sh 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,7 @@ +#!/bin/sh + +CMD_NAME="de" +CMD=$'de 0x00 16\x0a' +TEST_OUTPUT="0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................" + +. $srcdir/cmd.sh diff -Nru emu8051-1.1.1/tests/cmd_di.sh emu8051-2.0.1/tests/cmd_di.sh --- emu8051-1.1.1/tests/cmd_di.sh 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/tests/cmd_di.sh 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,7 @@ +#!/bin/sh + +CMD_NAME="di" +CMD=$'di 0x80 16\x0a' +TEST_OUTPUT="0080 FF 07 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................" + +. $srcdir/cmd.sh diff -Nru emu8051-1.1.1/tests/cmd_dp.sh emu8051-2.0.1/tests/cmd_dp.sh --- emu8051-1.1.1/tests/cmd_dp.sh 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/tests/cmd_dp.sh 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,7 @@ +#!/bin/sh + +CMD_NAME="dp" +CMD=$'dp 0x00 16\x0a' +TEST_OUTPUT="0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................" + +. $srcdir/cmd.sh diff -Nru emu8051-1.1.1/tests/cmd_dr.sh emu8051-2.0.1/tests/cmd_dr.sh --- emu8051-1.1.1/tests/cmd_dr.sh 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/tests/cmd_dr.sh 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,7 @@ +#!/bin/sh + +CMD_NAME="dr" +CMD=$'dr\x0a' +TEST_OUTPUT="| 0000 | 07 |" + +. $srcdir/cmd.sh diff -Nru emu8051-1.1.1/tests/cmd.sh emu8051-2.0.1/tests/cmd.sh --- emu8051-1.1.1/tests/cmd.sh 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/tests/cmd.sh 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,29 @@ +#!/bin/sh + +# Get the symlink name (how we were called): +test_name=`basename $0` + +lf=${test_name}.log + +name=$(basename ${test_name} .sh) + +echo "Testing command ${CMD_NAME}" > ${lf} + +echo "${CMD}" | ../src/cli/emu8051-cli -d 2 >> ${lf} +if test $? -ne 0 ; then + return 1 +fi + +# Verify syntax errors +if grep -q "syntax" ${lf}; then + echo "Failed test: ${CMD_NAME} (syntax error)" >> ${lf} + exit 1 +fi + +# Verify for valid test values +if ! grep -q "${TEST_OUTPUT}" ${lf}; then + echo "Failed test: ${CMD_NAME} (values not found)" >> ${lf} + exit 1 +fi + +exit 0 diff -Nru emu8051-1.1.1/tests/cmd_we.sh emu8051-2.0.1/tests/cmd_we.sh --- emu8051-1.1.1/tests/cmd_we.sh 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/tests/cmd_we.sh 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,7 @@ +#!/bin/sh + +CMD_NAME="we" +CMD=$'we 0x80 0x30\x0a we 0x81 0x31\x0a we 0x82 0x32\x0a de 0x80 16' +TEST_OUTPUT="0080 30 31 32 00 00 00 00 00 00 00 00 00 00 00 00 00 012............." + +. $srcdir/cmd.sh diff -Nru emu8051-1.1.1/tests/cmd_wi.sh emu8051-2.0.1/tests/cmd_wi.sh --- emu8051-1.1.1/tests/cmd_wi.sh 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/tests/cmd_wi.sh 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,7 @@ +#!/bin/sh + +CMD_NAME="wi" +CMD=$'wi 0x40 0x30\x0a wi 0x41 0x31\x0a wi 0x42 0x32\x0a di 0x40 16' +TEST_OUTPUT="0040 30 31 32 00 00 00 00 00 00 00 00 00 00 00 00 00 012............." + +. $srcdir/cmd.sh diff -Nru emu8051-1.1.1/tests/cmd_wp.sh emu8051-2.0.1/tests/cmd_wp.sh --- emu8051-1.1.1/tests/cmd_wp.sh 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/tests/cmd_wp.sh 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,7 @@ +#!/bin/sh + +CMD_NAME="wp" +CMD=$'wp 0x1000 0x41\x0a wp 0x1001 0x42\x0a wp 0x1002 0x43\x0a dp 0x1000 16' +TEST_OUTPUT="1000 41 42 43 00 00 00 00 00 00 00 00 00 00 00 00 00 ABC............." + +. $srcdir/cmd.sh diff -Nru emu8051-1.1.1/tests/cmd_wr.sh emu8051-2.0.1/tests/cmd_wr.sh --- emu8051-1.1.1/tests/cmd_wr.sh 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/tests/cmd_wr.sh 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,7 @@ +#!/bin/sh + +CMD_NAME="wr" +CMD=$'wr pc 0x5555 \x0a dr \x0a' +TEST_OUTPUT="| 5555 | 07 |" + +. $srcdir/cmd.sh diff -Nru emu8051-1.1.1/tests/div32u.asm emu8051-2.0.1/tests/div32u.asm --- emu8051-1.1.1/tests/div32u.asm 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/tests/div32u.asm 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,250 @@ +; Test program to verify correct emu8051 operation +; Taken from http://www.vzsite.us/8051/ +; +; Test desc: 32-bit division +; Test output: PC = $FFF0 +; Test output: SP = $60 +; Test output: R0 = $E6 +; Test output: R1 = $55 +; Test output: R2 = $00 +; Test output: R3 = $00 +; Test output: R4 = $20 +; Test output: R5 = $1B +; Test output: PSW = $05 + +;26 Oct 00 added code to zero remainder when dividend is zero +;19 Dec 99 corrected comments, removed unnecessary instruction +;16 May 99 8051 source code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; +;DIV32U is called to divide (unsigned) a 32-bit dividend using a +; 16-bit divisor. +; +;DIV32U solves for quotient and remainder the equation: +; +; dividend = divisor*quotient + remainder +; +;Call: +; r7,r6,r5,r4 = dividend +; r1,r0 = divisor +; lcall DIV32U +; +;Return: +; r5,r4 = quotient +; r7,r6 = remainder +; c flag set to 1 if overflow occured +; All registers, acc, b and two caller-assigned direct memory bytes +; (q0 and q1)have been changed. +; Data pointer has not been disturbed +; +;Note: +; (1)Overflow is a divide by zero or any value that will cause +; the quotient to be greater than 16 bits. +; (2)Most significant (ms) register always listed first when comma separates +; two in a comment. Example: r3,r2 (r3 contains the ms bits) +; (3) The algorithm used in this code borrows heavily from work posted +; by John C. Wren who said he got it from a C complier. +; +;Original author: John Veazey, Ridgecrest, CA, 18 APR 99 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; +q0 EQU 70h +q1 EQU 71h +TOS EQU 60h ; Adresse du dessus de la pile. + + ORG 0000h ; Reset vector + MOV SP,#TOS ; Init stack pointer + + ;; Set dividend + MOV R7,#012h + MOV R6,#034h + MOV R5,#056h + MOV R4,#078h + + ;; Set divisor + MOV R1,#0ABh + MOV R0,#0CDh + + LCALL DIV32U + LJMP 0FFF0h + +DIV32U: +; +;Clear the working quotient +; + clr a + mov q1,a + mov q0,a +; +;Clear the msb's of a 32-bit working divisor (r3,r2,r1,r0) +; + mov r3,a + mov r2,a +; +;b counts the number of places+1 the divisor was initially +; shifted left to align its ms bit set with the ms bit set +; in the dividend +; + mov b,#1 +; +;Make an error return if trying to divide by zero +; + mov a,r1 + orl a,r0 + jnz du100 + ljmp du920 ;Make the error return +; +;Just return with quotient and remainder zero if dividend is zero +; +du100: + mov a,r7 + orl a,r6 + orl a,r5 + orl a,r4 + jnz du200 + mov r7,a + mov r6,a + ljmp du910 ;Make a normal return +; +;Align the msb set in the demoninator with the msb set in the +; numerator. Increment the shift count in b each time a shift left +; is performed. +; +du200: + mov a,r3 ;Stop if msb set + clr c + rlc a + jc du600 + subb a,r7 ;Compare r3 & r7, (c clear) + jz du210 ; jump if r3=r7 + jnc du600 ; jump if r3>r7 + sjmp du240 ; r3r6 + jnz du240 ; jump if r2r5 + jnz du240 ; jump if r1r4 +du240: + clr c ;Now shift the denominator + mov a,r0 ; left 1 bit position + rlc a + mov r0,a + mov a,r1 + rlc a + mov r1,a + mov a,r2 + rlc a + mov r2,a + mov a,r3 + rlc a + mov r3,a + inc b ;Increment b counter and + sjmp du200 ; continue +; +;Compare the shifted divisor with the remainder (what's +; left of the dividend) +; +du600: + mov a,r7 + clr c + subb a,r3 + jc du720 ;jump if r3>r7 + jnz du700 ;jump if r3r6 + jnz du700 ;jump if r2r5 + jnz du700 ;jump if r1r4 +; +;Divisor is equal or smaller, so subtract it off and +; get a 1 for the quotient +; +du700: + mov a,r4 + clr c + subb a,r0 + mov r4,a + mov a,r5 + subb a,r1 + mov r5,a + mov a,r6 + subb a,r2 + mov r6,a + mov a,r7 + subb a,r3 + mov r7,a + clr c + cpl c ;Get a 1 for the quotient + sjmp du730 +; +;Divisor is greater, get a 0 for the quotient +; +du720: + clr c +; +;Shift 0 or 1 into quotient +; +du730: + mov a,q0 + rlc a + mov q0,a + mov a,q1 + rlc a + mov q1,a + jc du920 ;overflow - make the error return +; +;Now shift the denominator right 1, decrement the counter +; in b until b = 0 +; +du740: + clr c + mov a,r3 + rrc a + mov r3,a + mov a,r2 + rrc a + mov r2,a + mov a,r1 + rrc a + mov r1,a + mov a,r0 + rrc a + mov r0,a + djnz b,du600 +; +;Move quotient and remainder +; + mov a,r5 + mov r7,a + mov a,r4 + mov r6,a + mov a,q1 + mov r5,a + mov a,q0 + mov r4,a +; +;Make the normal return +; +du910: + clr c + ret +; +;Make the error return +; +du920: + clr c + cpl c + ret diff -Nru emu8051-1.1.1/tests/div.asm emu8051-2.0.1/tests/div.asm --- emu8051-1.1.1/tests/div.asm 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/tests/div.asm 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,22 @@ +; Test program to verify correct emu8051 operation +; +; Test desc: DIV AB +; Test output: PC = $FFF0 +; Test output: SP = $07 +; Test output: A = $3C +; Test output: B = $00 +; Test output: PSW = $00 + + ORG 0000h ; Reset vector + + MOV A, #0FFh + MOV B, #00h + DIV AB ; CY should be cleared, OV should be set + ; PSW = $04 + + MOV A, #240 ; 240d + MOV B, PSW ; 4d + DIV AB ; CY should be cleared, OV should be cleared, result = 10 + + LJMP 0FFF0h + END diff -Nru emu8051-1.1.1/tests/Makefile.am emu8051-2.0.1/tests/Makefile.am --- emu8051-1.1.1/tests/Makefile.am 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/tests/Makefile.am 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,79 @@ +# Regression tests for emu8051 + +AS504 = as504 +AS51 = asem + +SUFFIXES = .hex .asm .sh + +# Do not remove intermediate .hex files +.SECONDARY: + +ASM_SRC = \ + add.asm \ + mul1.asm mul2.asm \ + div.asm div32u.asm \ + orl.asm anl.asm \ + mov.asm \ + sqroot.asm \ + timer0.asm timer1.asm timer2.asm + +if RUN_TESTS + +TESTS_ASM = \ + add.sh \ + mul1.sh mul2.sh \ + div.sh div32u.sh \ + orl.sh anl.sh \ + mov.sh \ + sqroot.sh \ + timer0.sh timer1.sh timer2.sh + +TESTS_CMD = \ + cmd_dr.sh \ + cmd_de.sh \ + cmd_di.sh \ + cmd_dp.sh \ + cmd_we.sh \ + cmd_wi.sh \ + cmd_wp.sh \ + cmd_wr.sh + +TESTS = \ + $(TESTS_CMD) \ + $(TESTS_ASM) + +# If you do not want an implicit rule to be used for a target that has no +# commands, you can give that target empty commands by writing a semicolon. +cli.sh: ; + +# Tell make how to generate a .sh file after a .hex file is generated: +.hex.sh: + @ln -sf $(srcdir)/opcodes.sh $@ + +# Tell make how to generate a .hex file from a .asm source file. +# Warning: make distcheck will fail because asem nor as504 have option to +# specify output filename (and path), except patched version of as504: +.asm.hex: +if USE_AS504HV + $(AS504) -Fhex -O$@ $< +else +if USE_AS504 + $(AS504) -Fhex $< +else +if USE_AS51 + $(AS51) $< +else + echo error +endif +endif +endif + +else +TESTS = +endif + +EXTRA_DIST = $(TESTS_CMD) cmd.sh opcodes.sh $(ASM_SRC) + +CLEANFILES = *~ *.lst *.hex $(TESTS_ASM) + +MAINTAINERCLEANFILES = Makefile.in diff -Nru emu8051-1.1.1/tests/Makefile.in emu8051-2.0.1/tests/Makefile.in --- emu8051-1.1.1/tests/Makefile.in 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/tests/Makefile.in 2014-03-22 18:26:17.000000000 +0000 @@ -0,0 +1,970 @@ +# Makefile.in generated by automake 1.14 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 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@ + +# Regression tests for emu8051 +VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +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 = : +@RUN_TESTS_TRUE@TESTS = $(TESTS_CMD) $(TESTS_ASM) +subdir = tests +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(top_srcdir)/build-aux/test-driver +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +am__tty_colors_dummy = \ + mgn= red= grn= lgn= blu= brg= std=; \ + am__color_tests=no +am__tty_colors = { \ + $(am__tty_colors_dummy); \ + if test "X$(AM_COLOR_TESTS)" = Xno; then \ + am__color_tests=no; \ + elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ + am__color_tests=yes; \ + elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ + am__color_tests=yes; \ + fi; \ + if test $$am__color_tests = yes; then \ + red=''; \ + grn=''; \ + lgn=''; \ + blu=''; \ + mgn=''; \ + brg=''; \ + std=''; \ + fi; \ +} +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__recheck_rx = ^[ ]*:recheck:[ ]* +am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* +am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* +# A command that, given a newline-separated list of test names on the +# standard input, print the name of the tests that are to be re-run +# upon "make recheck". +am__list_recheck_tests = $(AWK) '{ \ + recheck = 1; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + { \ + if ((getline line2 < ($$0 ".log")) < 0) \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ + { \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ + { \ + break; \ + } \ + }; \ + if (recheck) \ + print $$0; \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' +# A command that, given a newline-separated list of test names on the +# standard input, create the global log from their .trs and .log files. +am__create_global_log = $(AWK) ' \ +function fatal(msg) \ +{ \ + print "fatal: making $@: " msg | "cat >&2"; \ + exit 1; \ +} \ +function rst_section(header) \ +{ \ + print header; \ + len = length(header); \ + for (i = 1; i <= len; i = i + 1) \ + printf "="; \ + printf "\n\n"; \ +} \ +{ \ + copy_in_global_log = 1; \ + global_test_result = "RUN"; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + fatal("failed to read from " $$0 ".trs"); \ + if (line ~ /$(am__global_test_result_rx)/) \ + { \ + sub("$(am__global_test_result_rx)", "", line); \ + sub("[ ]*$$", "", line); \ + global_test_result = line; \ + } \ + else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ + copy_in_global_log = 0; \ + }; \ + if (copy_in_global_log) \ + { \ + rst_section(global_test_result ": " $$0); \ + while ((rc = (getline line < ($$0 ".log"))) != 0) \ + { \ + if (rc < 0) \ + fatal("failed to read from " $$0 ".log"); \ + print line; \ + }; \ + printf "\n"; \ + }; \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' +# Restructured Text title. +am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } +# Solaris 10 'make', and several other traditional 'make' implementations, +# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it +# by disabling -e (using the XSI extension "set +e") if it's set. +am__sh_e_setup = case $$- in *e*) set +e;; esac +# Default flags passed to test drivers. +am__common_driver_flags = \ + --color-tests "$$am__color_tests" \ + --enable-hard-errors "$$am__enable_hard_errors" \ + --expect-failure "$$am__expect_failure" +# To be inserted before the command running the test. Creates the +# directory for the log if needed. Stores in $dir the directory +# containing $f, in $tst the test, in $log the log. Executes the +# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and +# passes TESTS_ENVIRONMENT. Set up options for the wrapper that +# will run the test scripts (or their associated LOG_COMPILER, if +# thy have one). +am__check_pre = \ +$(am__sh_e_setup); \ +$(am__vpath_adj_setup) $(am__vpath_adj) \ +$(am__tty_colors); \ +srcdir=$(srcdir); export srcdir; \ +case "$@" in \ + */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ + *) am__odir=.;; \ +esac; \ +test "x$$am__odir" = x"." || test -d "$$am__odir" \ + || $(MKDIR_P) "$$am__odir" || exit $$?; \ +if test -f "./$$f"; then dir=./; \ +elif test -f "$$f"; then dir=; \ +else dir="$(srcdir)/"; fi; \ +tst=$$dir$$f; log='$@'; \ +if test -n '$(DISABLE_HARD_ERRORS)'; then \ + am__enable_hard_errors=no; \ +else \ + am__enable_hard_errors=yes; \ +fi; \ +case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ + am__expect_failure=yes;; \ + *) \ + am__expect_failure=no;; \ +esac; \ +$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) +# A shell command to get the names of the tests scripts with any registered +# extension removed (i.e., equivalently, the names of the test logs, with +# the '.log' extension removed). The result is saved in the shell variable +# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, +# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", +# since that might cause problem with VPATH rewrites for suffix-less tests. +# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. +am__set_TESTS_bases = \ + bases='$(TEST_LOGS)'; \ + bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ + bases=`echo $$bases` +RECHECK_LOGS = $(TEST_LOGS) +AM_RECURSIVE_TARGETS = check recheck +TEST_SUITE_LOG = test-suite.log +TEST_EXTENSIONS = @EXEEXT@ .test +LOG_DRIVER = $(SHELL) $(top_srcdir)/build-aux/test-driver +LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) +am__set_b = \ + case '$@' in \ + */*) \ + case '$*' in \ + */*) b='$*';; \ + *) b=`echo '$@' | sed 's/\.log$$//'`; \ + esac;; \ + *) \ + b='$*';; \ + esac +am__test_logs1 = $(TESTS:=.log) +am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) +TEST_LOGS = $(am__test_logs2:.test.log=.log) +TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/build-aux/test-driver +TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ + $(TEST_LOG_FLAGS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS504_CHECK = @AS504_CHECK@ +ASEM51_CHECK = @ASEM51_CHECK@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GREP = @GREP@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_LIBS = @GTK_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBOBJS = @LIBOBJS@ +LIBREADLINE = @LIBREADLINE@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +OBJEXT = @OBJEXT@ +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@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +WARNINGCFLAGS = @WARNINGCFLAGS@ +YACC = @YACC@ +YFLAGS = @YFLAGS@ +ZLIB_LIBS = @ZLIB_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_aux_dir = @ac_aux_dir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +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_alias = @build_alias@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host_alias = @host_alias@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +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_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +zlib_CFLAGS = @zlib_CFLAGS@ +zlib_LIBS = @zlib_LIBS@ +AS504 = as504 +AS51 = asem +SUFFIXES = .hex .asm .sh +ASM_SRC = \ + add.asm \ + mul1.asm mul2.asm \ + div.asm div32u.asm \ + orl.asm anl.asm \ + mov.asm \ + sqroot.asm \ + timer0.asm timer1.asm timer2.asm + +@RUN_TESTS_TRUE@TESTS_ASM = \ +@RUN_TESTS_TRUE@ add.sh \ +@RUN_TESTS_TRUE@ mul1.sh mul2.sh \ +@RUN_TESTS_TRUE@ div.sh div32u.sh \ +@RUN_TESTS_TRUE@ orl.sh anl.sh \ +@RUN_TESTS_TRUE@ mov.sh \ +@RUN_TESTS_TRUE@ sqroot.sh \ +@RUN_TESTS_TRUE@ timer0.sh timer1.sh timer2.sh + +@RUN_TESTS_TRUE@TESTS_CMD = \ +@RUN_TESTS_TRUE@ cmd_dr.sh \ +@RUN_TESTS_TRUE@ cmd_de.sh \ +@RUN_TESTS_TRUE@ cmd_di.sh \ +@RUN_TESTS_TRUE@ cmd_dp.sh \ +@RUN_TESTS_TRUE@ cmd_we.sh \ +@RUN_TESTS_TRUE@ cmd_wi.sh \ +@RUN_TESTS_TRUE@ cmd_wp.sh \ +@RUN_TESTS_TRUE@ cmd_wr.sh + +EXTRA_DIST = $(TESTS_CMD) cmd.sh opcodes.sh $(ASM_SRC) +CLEANFILES = *~ *.lst *.hex $(TESTS_ASM) +MAINTAINERCLEANFILES = Makefile.in +all: all-am + +.SUFFIXES: +.SUFFIXES: .hex .asm .sh .log .test .test$(EXEEXT) .trs +$(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 tests/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu tests/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): +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + + +# Recover from deleted '.trs' file; this should ensure that +# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create +# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells +# to avoid problems with "make -n". +.log.trs: + rm -f $< $@ + $(MAKE) $(AM_MAKEFLAGS) $< + +# Leading 'am--fnord' is there to ensure the list of targets does not +# expand to empty, as could happen e.g. with make check TESTS=''. +am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) +am--force-recheck: + @: + +$(TEST_SUITE_LOG): $(TEST_LOGS) + @$(am__set_TESTS_bases); \ + am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ + redo_bases=`for i in $$bases; do \ + am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ + done`; \ + if test -n "$$redo_bases"; then \ + redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ + redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ + if $(am__make_dryrun); then :; else \ + rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ + fi; \ + fi; \ + if test -n "$$am__remaking_logs"; then \ + echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ + "recursion detected" >&2; \ + else \ + am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ + fi; \ + if $(am__make_dryrun); then :; else \ + st=0; \ + errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ + for i in $$redo_bases; do \ + test -f $$i.trs && test -r $$i.trs \ + || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ + test -f $$i.log && test -r $$i.log \ + || { echo "$$errmsg $$i.log" >&2; st=1; }; \ + done; \ + test $$st -eq 0 || exit 1; \ + fi + @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ + ws='[ ]'; \ + results=`for b in $$bases; do echo $$b.trs; done`; \ + test -n "$$results" || results=/dev/null; \ + all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ + pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ + fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ + skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ + xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ + xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ + error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ + if test `expr $$fail + $$xpass + $$error` -eq 0; then \ + success=true; \ + else \ + success=false; \ + fi; \ + br='==================='; br=$$br$$br$$br$$br; \ + result_count () \ + { \ + if test x"$$1" = x"--maybe-color"; then \ + maybe_colorize=yes; \ + elif test x"$$1" = x"--no-color"; then \ + maybe_colorize=no; \ + else \ + echo "$@: invalid 'result_count' usage" >&2; exit 4; \ + fi; \ + shift; \ + desc=$$1 count=$$2; \ + if test $$maybe_colorize = yes && test $$count -gt 0; then \ + color_start=$$3 color_end=$$std; \ + else \ + color_start= color_end=; \ + fi; \ + echo "$${color_start}# $$desc $$count$${color_end}"; \ + }; \ + create_testsuite_report () \ + { \ + result_count $$1 "TOTAL:" $$all "$$brg"; \ + result_count $$1 "PASS: " $$pass "$$grn"; \ + result_count $$1 "SKIP: " $$skip "$$blu"; \ + result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ + result_count $$1 "FAIL: " $$fail "$$red"; \ + result_count $$1 "XPASS:" $$xpass "$$red"; \ + result_count $$1 "ERROR:" $$error "$$mgn"; \ + }; \ + { \ + echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ + $(am__rst_title); \ + create_testsuite_report --no-color; \ + echo; \ + echo ".. contents:: :depth: 2"; \ + echo; \ + for b in $$bases; do echo $$b; done \ + | $(am__create_global_log); \ + } >$(TEST_SUITE_LOG).tmp || exit 1; \ + mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ + if $$success; then \ + col="$$grn"; \ + else \ + col="$$red"; \ + test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ + fi; \ + echo "$${col}$$br$${std}"; \ + echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ + echo "$${col}$$br$${std}"; \ + create_testsuite_report --maybe-color; \ + echo "$$col$$br$$std"; \ + if $$success; then :; else \ + echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ + if test -n "$(PACKAGE_BUGREPORT)"; then \ + echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ + fi; \ + echo "$$col$$br$$std"; \ + fi; \ + $$success || exit 1 + +check-TESTS: + @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list + @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @set +e; $(am__set_TESTS_bases); \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + trs_list=`for i in $$bases; do echo $$i.trs; done`; \ + log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ + exit $$?; +recheck: all + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @set +e; $(am__set_TESTS_bases); \ + bases=`for i in $$bases; do echo $$i; done \ + | $(am__list_recheck_tests)` || exit 1; \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + log_list=`echo $$log_list`; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ + am__force_recheck=am--force-recheck \ + TEST_LOGS="$$log_list"; \ + exit $$? +cmd_dr.sh.log: cmd_dr.sh + @p='cmd_dr.sh'; \ + b='cmd_dr.sh'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +cmd_de.sh.log: cmd_de.sh + @p='cmd_de.sh'; \ + b='cmd_de.sh'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +cmd_di.sh.log: cmd_di.sh + @p='cmd_di.sh'; \ + b='cmd_di.sh'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +cmd_dp.sh.log: cmd_dp.sh + @p='cmd_dp.sh'; \ + b='cmd_dp.sh'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +cmd_we.sh.log: cmd_we.sh + @p='cmd_we.sh'; \ + b='cmd_we.sh'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +cmd_wi.sh.log: cmd_wi.sh + @p='cmd_wi.sh'; \ + b='cmd_wi.sh'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +cmd_wp.sh.log: cmd_wp.sh + @p='cmd_wp.sh'; \ + b='cmd_wp.sh'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +cmd_wr.sh.log: cmd_wr.sh + @p='cmd_wr.sh'; \ + b='cmd_wr.sh'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +add.sh.log: add.sh + @p='add.sh'; \ + b='add.sh'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +mul1.sh.log: mul1.sh + @p='mul1.sh'; \ + b='mul1.sh'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +mul2.sh.log: mul2.sh + @p='mul2.sh'; \ + b='mul2.sh'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +div.sh.log: div.sh + @p='div.sh'; \ + b='div.sh'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +div32u.sh.log: div32u.sh + @p='div32u.sh'; \ + b='div32u.sh'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +orl.sh.log: orl.sh + @p='orl.sh'; \ + b='orl.sh'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +anl.sh.log: anl.sh + @p='anl.sh'; \ + b='anl.sh'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +mov.sh.log: mov.sh + @p='mov.sh'; \ + b='mov.sh'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +sqroot.sh.log: sqroot.sh + @p='sqroot.sh'; \ + b='sqroot.sh'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +timer0.sh.log: timer0.sh + @p='timer0.sh'; \ + b='timer0.sh'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +timer1.sh.log: timer1.sh + @p='timer1.sh'; \ + b='timer1.sh'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +timer2.sh.log: timer2.sh + @p='timer2.sh'; \ + b='timer2.sh'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +.test.log: + @p='$<'; \ + $(am__set_b); \ + $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +@am__EXEEXT_TRUE@.test$(EXEEXT).log: +@am__EXEEXT_TRUE@ @p='$<'; \ +@am__EXEEXT_TRUE@ $(am__set_b); \ +@am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ +@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ +@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ +@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) + +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 + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-am +all-am: Makefile +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: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) + -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) + -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +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." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +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 -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: check-am install-am install-strip + +.PHONY: all all-am check check-TESTS check-am clean clean-generic \ + cscopelist-am ctags-am distclean distclean-generic 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-generic pdf \ + pdf-am ps ps-am recheck tags-am uninstall uninstall-am + + +# Do not remove intermediate .hex files +.SECONDARY: + +# If you do not want an implicit rule to be used for a target that has no +# commands, you can give that target empty commands by writing a semicolon. +@RUN_TESTS_TRUE@cli.sh: ; + +# Tell make how to generate a .sh file after a .hex file is generated: +@RUN_TESTS_TRUE@.hex.sh: +@RUN_TESTS_TRUE@ @ln -sf $(srcdir)/opcodes.sh $@ + +# Tell make how to generate a .hex file from a .asm source file. +# Warning: make distcheck will fail because asem nor as504 have option to +# specify output filename (and path), except patched version of as504: +@RUN_TESTS_TRUE@.asm.hex: +@RUN_TESTS_TRUE@@USE_AS504HV_TRUE@ $(AS504) -Fhex -O$@ $< +@RUN_TESTS_TRUE@@USE_AS504HV_FALSE@@USE_AS504_TRUE@ $(AS504) -Fhex $< +@RUN_TESTS_TRUE@@USE_AS504HV_FALSE@@USE_AS504_FALSE@@USE_AS51_TRUE@ $(AS51) $< +@RUN_TESTS_TRUE@@USE_AS504HV_FALSE@@USE_AS504_FALSE@@USE_AS51_FALSE@ echo error + +# 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 -Nru emu8051-1.1.1/tests/mov.asm emu8051-2.0.1/tests/mov.asm --- emu8051-1.1.1/tests/mov.asm 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/tests/mov.asm 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,22 @@ +; Test program to verify correct emu8051 operation +; +; Test desc: MOV +; Test output: PC = $FFF0 +; Test output: SP = $07 +; Test output: A = $66 +; Test output: B = $98 +; Test output: PSW = $00 +; Test output: DPTR = $9876 +; Test output: R0 = $66 + + ORG 0000h ; Reset vector + + MOV A, #099h + MOV B, A + DEC B + MOV R0, #066h + MOV A, R0 + MOV DPTR,#9876h + + LJMP 0FFF0h + END diff -Nru emu8051-1.1.1/tests/mul1.asm emu8051-2.0.1/tests/mul1.asm --- emu8051-1.1.1/tests/mul1.asm 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/tests/mul1.asm 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,17 @@ +; Test program to verify correct emu8051 operation +; +; Test desc: MUL AB (no overflow) +; Test output: PC = $FFF0 +; Test output: SP = $07 +; Test output: A = $C2 +; Test output: B = $00 +; Test output: PSW = $01 + + ORG 0000h ; Reset vector + + MOV A, #061h + MOV B, #002h + MUL AB ; CY should be cleared, OV should be cleared + + LJMP 0FFF0h + END diff -Nru emu8051-1.1.1/tests/mul2.asm emu8051-2.0.1/tests/mul2.asm --- emu8051-1.1.1/tests/mul2.asm 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/tests/mul2.asm 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,17 @@ +; Test program to verify correct emu8051 operation +; +; Test desc: MUL AB (overflow) +; Test output: PC = $FFF0 +; Test output: SP = $07 +; Test output: A = $5B +; Test output: B = $0B +; Test output: PSW = $05 + + ORG 0000h ; Reset vector + + MOV A, #099h + MOV B, #013h + MUL AB ; CY should be cleared, OV should be cleared + + LJMP 0FFF0h + END diff -Nru emu8051-1.1.1/tests/opcodes.sh emu8051-2.0.1/tests/opcodes.sh --- emu8051-1.1.1/tests/opcodes.sh 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/tests/opcodes.sh 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,41 @@ +#!/bin/sh + +# Get the symlink name (how we were called): +test_name=`basename $0` + +lf=${test_name}.log + +STOP_ADDRESS="0xFFF0" +XRAM_SIZE="256" + +name=$(basename ${test_name} .sh) +hexfile=${name}.hex + +echo "Testing ${name}.hex" > ${lf} + +../src/cli/emu8051-cli -d 2 --xram=${XRAM_SIZE} -s ${STOP_ADDRESS} ${hexfile} >> ${lf} +if test $? -ne 0 ; then + return 1 +fi + +test_output_found=0 + +while read line; do + if echo ${line} | grep -q "; Test output"; then + test_output_found=1 + + test_str=$(echo ${line} | sed "s/^; Test output: //") + + if ! grep -q "${test_str}" ${lf}; then + echo "Failed test: ${test_str}" >> ${lf} + exit 1 + fi + fi +done < $srcdir/${name}.asm + +if [ x"${test_output_found}" == x0 ]; then + # Need at least one test output condition to verify correct operation + exit 1 +fi + +exit 0 diff -Nru emu8051-1.1.1/tests/orl.asm emu8051-2.0.1/tests/orl.asm --- emu8051-1.1.1/tests/orl.asm 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/tests/orl.asm 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,22 @@ +; Test program to verify correct emu8051 operation +; +; Test desc: ORL +; Test output: PC = $FFF0 +; Test output: SP = $07 +; Test output: A = $60 +; Test output: PSW = $E0 +; Test output: TCON = $01 + + ORG 0000h ; Reset vector + + MOV PSW, #0E0h + CLR TCON.0 + CLR C + ORL C, TCON.0 ; CY Should be 0 + MOV A, PSW + + SETB TCON.0 + ORL C, TCON.0 ; CY Should be 1 + + LJMP 0FFF0h + END diff -Nru emu8051-1.1.1/tests/sqroot.asm emu8051-2.0.1/tests/sqroot.asm --- emu8051-1.1.1/tests/sqroot.asm 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/tests/sqroot.asm 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,374 @@ +; Test program to verify correct emu8051 operation +; Taken from http://www.vzsite.us/8051/ +; +; Test desc: 32-bit division +; Test output: PC = $FFF0 +; Test output: SP = $30 +; Test output: PSW = $04 +; Test output: A = $44 +; Test output: B = $44 + +;17 Jan 00 re-written for consistency with assembler/compiler byte order +;21 May 99 8051 source code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; +;SQROOT1 is called to calculate the square root of a 32-bit number. +; +;Call: +; +; r0 => MSB of 32-bit input +; lcall SQROOT1 +; +;Return: +; +; computed square root is in acc(LSB's) and b(MSB's) +; (root is also in est(MSB's) and est+1(LSB's)) +; +;SQROOT1 uses the formula +; +; estimate = (last_estimate + input/last_estimate)/2 +; +;Method is described as Newton's, Newton-Raphson, and Babylonian method. +;DIV32U is called to do the 32/16-bit division. +;SQROOT1 perfoms a fixed number of iterations to converge to the root. +; +;SQROOT1 will destroy all registers except r0, dptr. +; +;Original Author: John Veazey, Ridgecrest, CA, 18 Apr 99 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +q0 EQU 70h +q1 EQU 71h +est EQU 72h ; 2 bytes: The estimated value being developed +sqrcnt EQU 74h ; Counts iterations +square EQU 75h +TOS EQU 30h ; Adresse du dessus de la pile. + + ORG 0000h ; Reset vector + MOV SP,#TOS ; Init stack pointer + + ;; Set 32-bit input value + MOV square+0,#012h + MOV square+1,#034h + MOV square+2,#032h + MOV square+3,#010h + + ;; Set pointer to square + mov r0,#square + + LCALL SQROOT + LJMP 0FFF0h + +SQROOT: +; +;Save r0 on the stack +; + mov a,r0 + push acc +; +;Initialize the iteration counter +; + mov sqrcnt,#7 ;There will be seven calculations +; +;Find the MSB set in input, call it n as in 2**n. Calculate +; r = ceiling(n+1)/2, then set up the first estimate to +; be (2**r)-1. +; + mov a,@r0 ;Is MS byte of input not-zero? + jz sqr112 + mov r1,#33 ; Yes, set r1 to the bit number+2 + sjmp sqr140 +sqr112: + inc r0 ; No, + mov a,@r0 ;Is 2nd MS byte of input not-zero? + jz sqr114 + mov r1,#25 ; Yes + sjmp sqr140 +sqr114: + inc r0 + mov a,@r0 ;Is 3rd MS byte of input not-zero? + jz sqr116 + mov r1,#17 ; Yes + sjmp sqr140 +sqr116: + inc r0 + mov est,#0 + mov a,@r0 ;Is LS byte of input zero? + jnz sqr122 + mov est+1,#0 ; Yes, return with a zero + ljmp sqr900 ; because input is zero +sqr122: + mov est+1,#1 + dec a ;Is LS byte of input = 1? + jz sqr900 ; Yes, return with a one + inc a ; No + mov r1,#9 +sqr140: + dec r1 + rlc a + jnc sqr140 + mov a,r1 ;Form ceiling[(n+1)/2] + clr c + rrc a ; (divide by 2, add remainder) + jnc sqr142 + inc a +sqr142: + mov r1,a + clr a + mov est,a +sqr144: + setb c ;Get the 1 to shift in + rlc a + mov b,a + mov a,est + rlc a + mov est,a + mov a,b + dec r1 + cjne r1,#0,sqr144 + mov est+1,a +; +;Load input into DIV32U dividend register +; +sqr200: + pop acc + push acc + mov r0,a + mov a,@r0 ;Set MSB's + mov r7,a + inc r0 + mov a,@r0 + mov r6,a + inc r0 + mov a,@r0 + mov r5,a + inc r0 + mov a,@r0 + mov r4,a +; +;Load last estimate into DIV32U divisor registers +; + mov a,est+1 ;Set LSB's + mov r0,a + mov a,est ;Set MSB's + mov r1,a +; +;Call DIV32U to do the 32/16-bit division (input/est) +; + lcall DIV32U ;(r7,r6,r5,r4)/(r1,r0) = (r5,r4) + jnc sqr310 ;If overflow, set to maximum number + mov r4,#-1 + mov r5,#-1 +; +;Add the last estimate to the quotient +; +sqr310: + mov a,r4 + add a,est+1 ;sets c + mov est+1,a + mov a,est + addc a,r5 ;sets c +; +;Divide sum by 2 and save as new estimate +; + rrc a ;sets c + mov est,a + mov a,est+1 + rrc a ;c discarded + mov est+1,a +; +;Decrement the iteration counter and repeat if not zero +; + djnz sqrcnt,sqr200 +; +;Make the normal return +; +sqr900: + pop acc ;Restore caller's pointer + mov r0,a + mov b,est ;Get answer in (b,a) + mov a,est+1 + ret + + +DIV32U: +; +;Clear the working quotient +; + clr a + mov q1,a + mov q0,a +; +;Clear the msb's of a 32-bit working divisor (r3,r2,r1,r0) +; + mov r3,a + mov r2,a +; +;b counts the number of places+1 the divisor was initially +; shifted left to align its ms bit set with the ms bit set +; in the dividend +; + mov b,#1 +; +;Make an error return if trying to divide by zero +; + mov a,r1 + orl a,r0 + jnz du100 + ljmp du920 ;Make the error return +; +;Just return with quotient and remainder zero if dividend is zero +; +du100: + mov a,r7 + orl a,r6 + orl a,r5 + orl a,r4 + jnz du200 + mov r7,a + mov r6,a + ljmp du910 ;Make a normal return +; +;Align the msb set in the demoninator with the msb set in the +; numerator. Increment the shift count in b each time a shift left +; is performed. +; +du200: + mov a,r3 ;Stop if msb set + clr c + rlc a + jc du600 + subb a,r7 ;Compare r3 & r7, (c clear) + jz du210 ; jump if r3=r7 + jnc du600 ; jump if r3>r7 + sjmp du240 ; r3r6 + jnz du240 ; jump if r2r5 + jnz du240 ; jump if r1r4 +du240: + clr c ;Now shift the denominator + mov a,r0 ; left 1 bit position + rlc a + mov r0,a + mov a,r1 + rlc a + mov r1,a + mov a,r2 + rlc a + mov r2,a + mov a,r3 + rlc a + mov r3,a + inc b ;Increment b counter and + sjmp du200 ; continue +; +;Compare the shifted divisor with the remainder (what's +; left of the dividend) +; +du600: + mov a,r7 + clr c + subb a,r3 + jc du720 ;jump if r3>r7 + jnz du700 ;jump if r3r6 + jnz du700 ;jump if r2r5 + jnz du700 ;jump if r1r4 +; +;Divisor is equal or smaller, so subtract it off and +; get a 1 for the quotient +; +du700: + mov a,r4 + clr c + subb a,r0 + mov r4,a + mov a,r5 + subb a,r1 + mov r5,a + mov a,r6 + subb a,r2 + mov r6,a + mov a,r7 + subb a,r3 + mov r7,a + clr c + cpl c ;Get a 1 for the quotient + sjmp du730 +; +;Divisor is greater, get a 0 for the quotient +; +du720: + clr c +; +;Shift 0 or 1 into quotient +; +du730: + mov a,q0 + rlc a + mov q0,a + mov a,q1 + rlc a + mov q1,a + jc du920 ;overflow - make the error return +; +;Now shift the denominator right 1, decrement the counter +; in b until b = 0 +; +du740: + clr c + mov a,r3 + rrc a + mov r3,a + mov a,r2 + rrc a + mov r2,a + mov a,r1 + rrc a + mov r1,a + mov a,r0 + rrc a + mov r0,a + djnz b,du600 +; +;Move quotient and remainder +; + mov a,r5 + mov r7,a + mov a,r4 + mov r6,a + mov a,q1 + mov r5,a + mov a,q0 + mov r4,a +; +;Make the normal return +; +du910: + clr c + ret +; +;Make the error return +; +du920: + clr c + cpl c + ret + diff -Nru emu8051-1.1.1/tests/timer0.asm emu8051-2.0.1/tests/timer0.asm --- emu8051-1.1.1/tests/timer0.asm 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/tests/timer0.asm 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,57 @@ +; Test program to verify correct emu8051 operation +; +; Test desc: timers +; Test output: PC = $FFF0 +; Test output: SP = $60 +; Test output: R0 = $83 +; Test output: R1 = $17 +; Test output: R2 = $81 +; Test output: R3 = $02 +; Test output: TIMER0 = $7103 +; Test output: TIMER1 = $8005 +; Test output: TCON = $A0 +; Test output: TMOD = $00 +; Test output: PSW = $00 + +TOS EQU 60h ; Adresse du dessus de la pile. + + ORG 0000h ; Reset vector + MOV SP,#TOS ; Init stack pointer + + MOV TMOD,#00h ; Init timers 0 and 1 as: + ; 8-bit timer "TH" with "TL" as 5-bit prescaler + ; incremented by the internal clock + + ;; First test: no overflow + MOV TH0,#2 + MOV TL0,#55h ; Set initial value of timer0 to $0255 + LCALL DELAY + + MOV 00h, TH0 ; Save value of timer 0 + MOV 01h, TL0 + MOV 02h, TH1 ; Save value of timer 1 + MOV 03h, TL1 + MOV 04h, TCON + + ;; Second test: overflow + MOV TH0,#0F0h + MOV TL0,#01h ; Set initial value of timer0 to $F001 + MOV Th1,#0FFh + MOV TL1,#03h ; Set initial value of timer1 to $FF03 + LCALL DELAY + + LJMP 0FFF0h + + ;; Loop of $1020 cycles +DELAY: + MOV A,#08h + ORL TCON,#50h ; Timer 0 and timer 1 ON. +B2: + MOV B,#0 +B1: + DJNZ B,B1 + DJNZ ACC,B2 + ANL TCON,#0AFh ; Stop both timers + RET + + END diff -Nru emu8051-1.1.1/tests/timer1.asm emu8051-2.0.1/tests/timer1.asm --- emu8051-1.1.1/tests/timer1.asm 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/tests/timer1.asm 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,56 @@ +; Test program to verify correct emu8051 operation +; +; Test desc: timers +; Test output: PC = $FFF0 +; Test output: SP = $60 +; Test output: R0 = $22 +; Test output: R1 = $97 +; Test output: R2 = $20 +; Test output: R3 = $42 +; Test output: TIMER0 = $10DA +; Test output: TIMER1 = $1F42 +; Test output: TCON = $A0 +; Test output: TMOD = $11 +; Test output: PSW = $00 + +TOS EQU 60h ; Adresse du dessus de la pile. + + ORG 0000h ; Reset vector + MOV SP,#TOS ; Init stack pointer + + MOV TMOD,#00010001B ; Init timers 0 and 1 as 16-bit timers, + ; incremented by the internal clock + + ;; First test: no overflow + MOV TH0,#2 + MOV TL0,#55h ; Set initial value of timer0 to $0255 + LCALL DELAY + + MOV 00h, TH0 ; Save value of timer 0 + MOV 01h, TL0 + MOV 02h, TH1 ; Save value of timer 1 + MOV 03h, TL1 + MOV 04h, TCON + + ;; Second test: overflow + MOV TH0,#0F0h + MOV TL0,#98h ; Set initial value of timer0 to $F098 + MOV Th1,#0FFh + MOV TL1,#00h ; Set initial value of timer1 to $FF00 + LCALL DELAY + + LJMP 0FFF0h + + ;; Loop of $2040 cycles +DELAY: + MOV A,#10h + ORL TCON,#50h ; Timer 0 and timer 1 ON. +B2: + MOV B,#0 +B1: + DJNZ B,B1 + DJNZ ACC,B2 + ANL TCON,#0AFh ; Stop both timers + RET + + END diff -Nru emu8051-1.1.1/tests/timer2.asm emu8051-2.0.1/tests/timer2.asm --- emu8051-1.1.1/tests/timer2.asm 1970-01-01 00:00:00.000000000 +0000 +++ emu8051-2.0.1/tests/timer2.asm 2014-03-22 18:25:51.000000000 +0000 @@ -0,0 +1,53 @@ +; Test program to verify correct emu8051 operation +; +; Test desc: timers +; Test output: PC = $FFF0 +; Test output: SP = $60 +; Test output: R0 = $80 +; Test output: R1 = $16 +; Test output: R2 = $F4 +; Test output: R3 = $3E +; Test output: TIMER0 = $8086 +; Test output: TIMER1 = $F4F9 +; Test output: TCON = $A0 +; Test output: TMOD = $22 +; Test output: PSW = $00 + +TOS EQU 60h ; Adresse du dessus de la pile. + + ORG 0000h ; Reset vector + MOV SP,#TOS ; Init stack pointer + + MOV TMOD,#00100010B ; Init timers 0 and 1 as 8-bit timers (TL), + ; reloaded with TH when overflow occurs. + + ;; First test: no overflow + MOV TH0,#080h ; Reload value + MOV TH1,#0F4h ; Reload value + MOV TL0,#00h ; Set initial value of timer0 + MOV TL1,#28h ; Set initial value of timer1 + LCALL DELAY + + MOV 00h, TH0 ; Save value of timer 0 + MOV 01h, TL0 + MOV 02h, TH1 ; Save value of timer 1 + MOV 03h, TL1 + MOV 04h, TCON + + ;; Second test: overflow + MOV TL0,#0F0h ; Set initial value of timer0 + MOV TL1,#0EFh ; Set initial value of timer1 + LCALL DELAY + + LJMP 0FFF0h + + ;; Loop of ~25 cycles +DELAY: + MOV B,#10 + ORL TCON,#50h ; Timer 0 and timer 1 ON. +B1: + DJNZ B,B1 + ANL TCON,#0AFh ; Stop both timers + RET + + END diff -Nru emu8051-1.1.1/TODO emu8051-2.0.1/TODO --- emu8051-1.1.1/TODO 2011-10-29 21:06:32.000000000 +0000 +++ emu8051-2.0.1/TODO 2014-03-22 18:25:51.000000000 +0000 @@ -1,15 +1,16 @@ - THINGS TO DO - ------------ + TODO + ---- --Compile only one program for both graphical and console modes, or - support only the graphical mode. -- Some fine tuning around the classes -- Make MemWin, RegWin be able to make a standalone - window if parentwin=0. -- Connect File->Open, View->... and Help->License menus. -- Make the RegWin and MemWin react when mouse clicked. (modify register or - memory) -- Enlever les fonctions ReadI, WriteI, dumpI etc... et plutot utiliser les - fonctions ReadInt, WriteInt, DumpInt, DumpExt, etc. -- Lors d'un DumpInt, verifier a ne pas afficher plus haut que la taille - reelle de la memoire interne. (Detail) +-Add visual indication when emulated program is running + +-Gtk tree view: Switch from G_TYPE_STRING to G_TYPE_UINT for numbers, and + create custom renderer to display as hex numbers. + +-Compile only one program for both graphical and console modes. + +-Add new breakpoint menu: + ->show breakpoints + ->remove all breakpoints + +-Create config menu: + -> Do not reset emulator on hex file load enable/disable