pasmo-0.5.3/0000777000175000017500000000000010552443664007654 500000000000000pasmo-0.5.3/README0000644000175000017500000001465510552443456010462 00000000000000 See english version below. ESPAÑOL. Pasmo, ensablador Z80 cruzado multiplataforma. (C) 2004-2007 Julián Albo Utilización y distribución permitida bajo la licencia GPL. Para descargar actualizaciones o obtener más información: http://www.arrakis.es/~ninsesabe/pasmo/ Para compilar: ./configure make Para instalar: make install Para compilar con otras opciones: ./configure --help Documentación: Disponible solamente en inglés, en el fichero pasmodoc.html incluido en este paquete o en el sitio web de Pasmo. Ver también los ficheros .asm de ejemplo incluidos en el paquete de los fuentes. Para ensamblar: pasmo [ opciones ] fichero.asm fichero.bin [ fichero.simbolos [fichero.publicos] ] Opciones: -d --> Mostrar información de depuración durante el ensamblado. -1 --> Mostrar información de depuración durante el ensamblado, también en el primer paso. -v --> Verboso. Muestra información de progreso del ensamblado. -I --> Añadir directorio a la lista de directorios en los que se buscarán ficheros para INCLUDE e INCBIN. --bin --> Generar el fichero objeto en binario puro sin cabecera. --hex --> Generar el fichero objeto en formato Intel HEX. --prl --> Generar el fichero objeto en formato PRL. Adecuado para RSX de CP/M Plus. --cmd --> Generar el fichero objeto en formato CMD de CP/M 86. --plus3dos --> Generar el fichero objeto con cabecera PLUS3DOS (Spectrum disco). --tap --> Generar un fichero .tap para emuladores de Spectrum (imagen de cinta). --tzx --> Generar un fichero .tzx para emuladores de Spectrum (imagen de cinta). --cdt --> Generar un fichero .cdt para emuladores de Amstrad CPC (imagen de cinta). --tapbas --> Igual que que la opción --tap pero añadiendo un cargador Basic. --tzxbas --> Igual que que la opción --tzx pero añadiendo un cargador Basic. --cdtbas --> Igual que que la opción --cdt pero añadiendo un cargador Basic. --amsdos --> Generar el fichero objeto con cabecera Amsdos (Amstrad CPC disco). --msx --> Generar el fichero objeto con cabecera para usarse con BLOAD en MSX Basic. --public --> El listado de símbolos incluirá sólo los declarados PUBLIC. --name --> Nombre para la cabecera en los formatos que lo usan (si no se especifica se usa el nombre del fichero objeto). --err --> Dirige los mensajes de error a la salida estándar en vez de a la salida de error (excepto los errores en las opciones). --nocase --> Hace que los identificadores no distingan mayúsculas de minúsculas. --alocal --> Modo autolocal: las etiquetas que comienzan por un '_' son locales y su ámbito termina en la sigiente etiqueta no local o en la siguiente directiva PROC, LOCAL o MACRO. -B --bracket --> Modo sólo corchetes: los paréntesis quedan reservados para expresiones. -E --equ --> Predefine una etiqueta. -8 --w8080 --> Mostrar warning cuando se usan instrucciones del z80 que no exsiten en el 8080. --86 --> Generar código 8086. - --> Fin de opciones, todo lo que siga se consideran nombres de fichero aunque comience por -. Si no hay ninguna opción de formato de objeto se asume --bin. La información de depuración va a la salida estándar, los errores a la salida de error. Comentarios y críticas a: julian.notfound@gmail.com * * * ENGLISH. Pasmo, multiplatform Z80 cross-assembler. (C) 2004-2007 Julián Albo Use and distribution allowed under the terms of the GPL license. To download updates or obtain more information: http://www.arrakis.es/~ninsesabe/pasmo/ To compile: ./configure make To install: make install To compile with other options: ./configure --help Documentation: See the file pasmodoc.html, included in this package or in the Pasmo web site. See also the .asm sample files included with the souce package. To assemble: pasmo [ options ] file.asm file.bin [ file.symbol [ file.publics ] ] Options: -d --> Show debug info during assembly. -1 --> Show debug info during assembly, also in first pass. -v --> Verbose. Show progress information during assembly. -I --> Add directory to the list for searching files in INCLUDE and INCBIN. --bin --> Generate the object file in pure binary format without headers. --hex --> Generate the object file in Intel HEX format. --prl --> Generate the object file in the PRL format. Useful for CP/M Plus RSX. --cmd --> Generate the object file in CP/M 86 CMD format. --plus3dos --> Generate the object file with PLUS3DOS header (Spectrum disk). --tap --> Generate a .tap file for Spectrum emulators (tape image). --tzx --> Generate a .tzx file for Spectrum emulators (tape image). --cdt --> Generate a .cdt file for Spectrum emulators (tape image). --tapbas --> Same as --tap option but adding a Basic loader. --tzxbas --> Same as --tzx option but adding a Basic loader. --cdtbas --> Same as --cdt option but adding a Basic loader. --amsdos --> Generate the object file with Amsdos header (Amstrad CPC disk). --msx --> Generate the object file with header for use with BLOAD in MSX Basic. --public --> The symbol table listing will include only symbols declared as PUBLIC. --name --> Name for the header in the formats that use it. If unspecified the object file name will be used. --err --> Direct error messages to standard ouptut instead of error output (except for errors in options). --nocase --> Make identifiers case insensitive. --alocal --> Autolocal mode: the labels than begins with a '_' are locals, and his ambit finishes in the next no local label or in the next PROC, LOCAL or MACRO directive. -B --bracket --> Bracket only mode: parenthesis are reserved for expressions. -E --equ --> Predefine a label. -8 -w8080 --> Show warnings when using Z80 instructions that does not exist in 8080. --86 --> Generate 8086 code. If no code generation options are specified --bin is assumed. Debug info goes to standard output, error messages to error output. Comments and criticisms to: julian.notfound@gmail.com pasmo-0.5.3/configure.ac0000644000175000017500000000046410552443124012051 00000000000000# configure.ac for Pasmo # Process this file with autoconf to produce a configure script. AC_PREREQ(2.57) AC_INIT(pasmo, 0.5.3, julian.notfound@gmail.com) AM_INIT_AUTOMAKE # Check for programs. AC_PROG_CXX # Generate files AC_CONFIG_FILES([Makefile]) AC_OUTPUT # End of configure.ac for Pasmo pasmo-0.5.3/aclocal.m40000644000175000017500000007462010552443132011427 00000000000000# generated automatically by aclocal 1.9.6 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 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. # 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. # Copyright (C) 2002, 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. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"]) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION so it can be traced. # This function is AC_REQUIREd by AC_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.9.6])]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 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. # 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/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # 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 # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997, 2000, 2001, 2003, 2004, 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 7 # 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_SUBST([$1_TRUE]) AC_SUBST([$1_FALSE]) if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 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 # 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 # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "GCJ", or "OBJC". # 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 # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl 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], 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], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # 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'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > 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 done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # 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 ;; none) break ;; esac # 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. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # 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 ]) # 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]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH]) ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 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 3 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [for mf in $CONFIG_FILES; do # 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 # 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. # So let's grep whole file. if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # 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 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 # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # 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 # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 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 12 # 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. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # 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.58])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 AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl # test to see if srcdir already configured if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # 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_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])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 # 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_PROG_INSTALL_SH AM_PROG_INSTALL_STRIP AC_REQUIRE([AM_PROG_MKDIR_P])dnl # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_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 AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl ]) ]) # 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. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $1 | $1:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 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. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl install_sh=${install_sh-"$am_aux_dir/install-sh"} AC_SUBST(install_sh)]) # Copyright (C) 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 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], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001, 2002, 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 3 # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo done .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote="\"" _am_result=BSD fi fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997, 1999, 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 4 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $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. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) # Copyright (C) 2003, 2004, 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. # AM_PROG_MKDIR_P # --------------- # Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise. # # Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories # created by `make install' are always world readable, even if the # installer happens to have an overly restrictive umask (e.g. 077). # This was a mistake. There are at least two reasons why we must not # use `-m 0755': # - it causes special bits like SGID to be ignored, # - it may be too restrictive (some setups expect 775 directories). # # Do not use -m 0755 and let people choose whatever they expect by # setting umask. # # We cannot accept any implementation of `mkdir' that recognizes `-p'. # Some implementations (such as Solaris 8's) are not thread-safe: if a # parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c' # concurrently, both version can detect that a/ is missing, but only # one can create it and the other will error out. Consequently we # restrict ourselves to GNU make (using the --version option ensures # this.) AC_DEFUN([AM_PROG_MKDIR_P], [if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then # We used to keeping the `.' as first argument, in order to # allow $(mkdir_p) to be used without argument. As in # $(mkdir_p) $(somedir) # where $(somedir) is conditionally defined. However this is wrong # for two reasons: # 1. if the package is installed by a user who cannot write `.' # make install will fail, # 2. the above comment should most certainly read # $(mkdir_p) $(DESTDIR)$(somedir) # so it does not work when $(somedir) is undefined and # $(DESTDIR) is not. # To support the latter case, we have to write # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), # so the `.' trick is pointless. mkdir_p='mkdir -p --' else # On NextStep and OpenStep, the `mkdir' command does not # recognize any option. It will interpret all options as # directories to create, and then abort because `.' already # exists. for d in ./-p ./--version; do test -d $d && rmdir $d done # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. if test -f "$ac_aux_dir/mkinstalldirs"; then mkdir_p='$(mkinstalldirs)' else mkdir_p='$(install_sh) -d' fi fi AC_SUBST([mkdir_p])]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001, 2002, 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 3 # _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)]) # _AM_SET_OPTIONS(OPTIONS) # ---------------------------------- # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. 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) 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 4 # 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 # 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 test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # Copyright (C) 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. # AM_PROG_INSTALL_STRIP # --------------------- # 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 # 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 # 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'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004, 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 2 # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # 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 # $tardir. # tardir=directory && $(am__tar) > result.tar # # 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. _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 # 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 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 pasmo-0.5.3/Makefile.am0000644000175000017500000000171110231251350011603 00000000000000# Makefile.am for Pasmo bin_PROGRAMS = pasmo pasmo_SOURCES = \ asm.h \ asm.cpp \ asmfile.h \ asmfile.cpp \ cpc.h \ cpc.cpp \ pasmo.cpp \ pasmotypes.h \ pasmotypes.cpp \ spectrum.h \ spectrum.cpp \ tap.h \ tap.cpp \ token.h \ token.cpp \ tzx.h \ tzx.cpp tgz: dist cp $(distdir).tar.gz $(distdir).tgz rpm: dist rpm -ta $(distdir).tar.gz EXAMPLE_ASM = \ align.asm \ all.asm \ allb.asm \ alocal.asm \ bad.asm \ black.asm \ callvers.asm \ defb.asm \ echovers.asm \ fill8k.asm \ hellocpc.asm \ hellocpm.asm \ hellospec.asm \ hilo.asm \ hola.asm \ if.asm \ include.asm \ indent.asm \ jumptable.asm \ lee.asm \ limit64.asm \ local.asm \ macro.asm \ mas.asm \ protector.asm \ rept.asm \ reserv.asm \ showfcb.asm \ showkeys.asm \ showline.asm \ t86.asm \ test.asm \ tmacro.asm \ undoc.asm EXTRA_DIST = \ bootstrap autogen.sh \ pasmodoc.html \ $(EXAMPLE_ASM) ACLOCAL_AMFLAGS = -I . # End of Makefile.am for Pasmo pasmo-0.5.3/Makefile.in0000644000175000017500000004424410552443133011634 00000000000000# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 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@ # Makefile.am for Pasmo srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = . am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : bin_PROGRAMS = pasmo$(EXEEXT) subdir = . DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(top_srcdir)/configure AUTHORS COPYING \ ChangeLog INSTALL NEWS depcomp install-sh missing \ mkinstalldirs 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) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno configure.status.lineno mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_CLEAN_FILES = am__installdirs = "$(DESTDIR)$(bindir)" binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(bin_PROGRAMS) am_pasmo_OBJECTS = asm.$(OBJEXT) asmfile.$(OBJEXT) cpc.$(OBJEXT) \ pasmo.$(OBJEXT) pasmotypes.$(OBJEXT) spectrum.$(OBJEXT) \ tap.$(OBJEXT) token.$(OBJEXT) tzx.$(OBJEXT) pasmo_OBJECTS = $(am_pasmo_OBJECTS) pasmo_LDADD = $(LDADD) DEFAULT_INCLUDES = -I. -I$(srcdir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(pasmo_SOURCES) DIST_SOURCES = $(pasmo_SOURCES) ETAGS = etags CTAGS = ctags 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); }; } DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EXEEXT = @EXEEXT@ 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@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ ac_ct_CXX = @ac_ct_CXX@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ 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@ 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@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ pasmo_SOURCES = \ asm.h \ asm.cpp \ asmfile.h \ asmfile.cpp \ cpc.h \ cpc.cpp \ pasmo.cpp \ pasmotypes.h \ pasmotypes.cpp \ spectrum.h \ spectrum.cpp \ tap.h \ tap.cpp \ token.h \ token.cpp \ tzx.h \ tzx.cpp EXAMPLE_ASM = \ align.asm \ all.asm \ allb.asm \ alocal.asm \ bad.asm \ black.asm \ callvers.asm \ defb.asm \ echovers.asm \ fill8k.asm \ hellocpc.asm \ hellocpm.asm \ hellospec.asm \ hilo.asm \ hola.asm \ if.asm \ include.asm \ indent.asm \ jumptable.asm \ lee.asm \ limit64.asm \ local.asm \ macro.asm \ mas.asm \ protector.asm \ rept.asm \ reserv.asm \ showfcb.asm \ showkeys.asm \ showline.asm \ t86.asm \ test.asm \ tmacro.asm \ undoc.asm EXTRA_DIST = \ bootstrap autogen.sh \ pasmodoc.html \ $(EXAMPLE_ASM) ACLOCAL_AMFLAGS = -I . all: all-am .SUFFIXES: .SUFFIXES: .cpp .o .obj am--refresh: @: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \ cd $(srcdir) && $(AUTOMAKE) --gnu \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: $(am__configure_deps) cd $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; for p in $$list; do \ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ if test -f $$p \ ; then \ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ else :; fi; \ done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; for p in $$list; do \ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ rm -f "$(DESTDIR)$(bindir)/$$f"; \ done clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) pasmo$(EXEEXT): $(pasmo_OBJECTS) $(pasmo_DEPENDENCIES) @rm -f pasmo$(EXEEXT) $(CXXLINK) $(pasmo_LDFLAGS) $(pasmo_OBJECTS) $(pasmo_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asm.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asmfile.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pasmo.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pasmotypes.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/spectrum.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tap.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/token.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tzx.Po@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cpp.obj: @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` uninstall-info-am: ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) $(am__remove_distdir) mkdir $(distdir) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r $(distdir) dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__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 # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && cd $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}' distuninstallcheck: @cd $(distuninstallcheck_dir) \ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 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: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-generic mostlyclean-am distclean: distclean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-exec-am: install-binPROGRAMS install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -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 uninstall-info-am .PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \ clean-binPROGRAMS clean-generic ctags dist dist-all dist-bzip2 \ dist-gzip dist-shar dist-tarZ dist-zip distcheck distclean \ distclean-compile distclean-generic distclean-tags \ distcleancheck distdir distuninstallcheck dvi dvi-am html \ html-am info info-am install install-am install-binPROGRAMS \ install-data install-data-am install-exec install-exec-am \ install-info install-info-am install-man install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ uninstall-am uninstall-binPROGRAMS uninstall-info-am tgz: dist cp $(distdir).tar.gz $(distdir).tgz rpm: dist rpm -ta $(distdir).tar.gz # End of Makefile.am for Pasmo # 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: pasmo-0.5.3/configure0000755000175000017500000035271210552443133011500 00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.60 for pasmo 0.5.3. # # Report bugs to . # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) as_nl=' ' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH if test "x$CONFIG_SHELL" = x; then if (eval ":") 2>/dev/null; then as_have_required=yes else as_have_required=no fi if test $as_have_required = yes && (eval ": (as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=\$LINENO as_lineno_2=\$LINENO test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } ") 2> /dev/null; then : else as_candidate_shells= as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /usr/bin/posix$PATH_SEPARATOR/bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. case $as_dir in /*) for as_base in sh bash ksh sh5; do as_candidate_shells="$as_candidate_shells $as_dir/$as_base" done;; esac done IFS=$as_save_IFS for as_shell in $as_candidate_shells $SHELL; do # Try only shells that exist, to save several forks. if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { ("$as_shell") 2> /dev/null <<\_ASEOF # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh : _ASEOF }; then CONFIG_SHELL=$as_shell as_have_required=yes if { "$as_shell" 2> /dev/null <<\_ASEOF # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh : (as_func_return () { (exit $1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = "$1" ); then : else exitcode=1 echo positional parameters were not saved. fi test $exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } _ASEOF }; then break fi fi done if test "x$CONFIG_SHELL" != x; then for as_var in BASH_ENV ENV do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done export CONFIG_SHELL exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test $as_have_required = no; then echo This script requires a shell more modern than all the echo shells that I found on your system. Please install a echo modern shell, or manually run the script under such a echo shell if you do have one. { (exit 1); exit 1; } fi fi fi (eval "as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0") || { echo No shell found that supports shell functions. echo Please tell autoconf@gnu.org about your system, echo including any error possibly output before this echo message } as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # 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). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... 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'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # Find out whether ``test -x'' works. Don't use a zero-byte file, as # systems may use methods other than mode bits to determine executability. cat >conf$$.file <<_ASEOF #! /bin/sh exit 0 _ASEOF chmod +x conf$$.file if test -x conf$$.file >/dev/null 2>&1; then as_executable_p="test -x" else as_executable_p=: fi rm -f conf$$.file # 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'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='pasmo' PACKAGE_TARNAME='pasmo' PACKAGE_VERSION='0.5.3' PACKAGE_STRING='pasmo 0.5.3' PACKAGE_BUGREPORT='julian.notfound@gmail.com' ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datarootdir datadir sysconfdir sharedstatedir localstatedir includedir oldincludedir docdir infodir htmldir dvidir pdfdir psdir libdir localedir mandir DEFS ECHO_C ECHO_N ECHO_T LIBS build_alias host_alias target_alias INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE LIBOBJS LTLIBOBJS' ac_subst_files='' ac_precious_vars='build_alias host_alias target_alias CXX CXXFLAGS LDFLAGS CPPFLAGS CCC' # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` eval enable_$ac_feature=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` eval enable_$ac_feature=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` eval with_$ac_package=\$ac_optarg ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/-/_/g'` eval with_$ac_package=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute directory names. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; } done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe 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 fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || { echo "$as_me: error: Working directory cannot be determined" >&2 { (exit 1); exit 1; }; } test "X$ac_ls_di" = "X$ac_pwd_ls_di" || { echo "$as_me: error: pwd does not report name of working directory" >&2 { (exit 1); exit 1; }; } # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$0" || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 { (exit 1); exit 1; }; } pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # 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 pasmo 0.5.3 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/pasmo] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of pasmo 0.5.3:";; esac cat <<\_ACEOF Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors Some influential environment variables: CXX C++ compiler command CXXFLAGS C++ compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if you have headers in a nonstandard directory 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 . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF pasmo configure 0.5.3 generated by GNU Autoconf 2.60 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by pasmo $as_me 0.5.3, which was generated by GNU Autoconf 2.60. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------------- ## ## File substitutions. ## ## ------------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo cat confdefs.h echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -n "$CONFIG_SITE"; then set x "$CONFIG_SITE" elif test "x$prefix" != xNONE; then set x "$prefix/share/config.site" "$prefix/etc/config.site" else set x "$ac_default_prefix/share/config.site" \ "$ac_default_prefix/etc/config.site" fi shift for ac_site_file do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } 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 am__api_version="1.9" ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} { (exit 1); exit 1; }; } fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. { echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; } if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # 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_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. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done IFS=$as_save_IFS fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { echo "$as_me:$LINENO: checking whether build environment is sane" >&5 echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6; } # Just in case sleep 1 echo timestamp > conftest.file # 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". { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&5 echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&2;} { (exit 1); exit 1; }; } fi test "$2" = conftest.file ) then # Ok. : else { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! Check your system clock" >&5 echo "$as_me: error: newly created file is older than distributed files! Check your system clock" >&2;} { (exit 1); exit 1; }; } fi { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. echo might interpret backslashes. # By default was `s,x,x', remove it if useless. cat <<\_ACEOF >conftest.sed s/[\\$]/&&/g;s/;s,x,x,$// _ACEOF program_transform_name=`echo $program_transform_name | sed -f conftest.sed` rm -f conftest.sed # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then # We used to keeping the `.' as first argument, in order to # allow $(mkdir_p) to be used without argument. As in # $(mkdir_p) $(somedir) # where $(somedir) is conditionally defined. However this is wrong # for two reasons: # 1. if the package is installed by a user who cannot write `.' # make install will fail, # 2. the above comment should most certainly read # $(mkdir_p) $(DESTDIR)$(somedir) # so it does not work when $(somedir) is undefined and # $(DESTDIR) is not. # To support the latter case, we have to write # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), # so the `.' trick is pointless. mkdir_p='mkdir -p --' else # On NextStep and OpenStep, the `mkdir' command does not # recognize any option. It will interpret all options as # directories to create, and then abort because `.' already # exists. for d in ./-p ./--version; do test -d $d && rmdir $d done # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. if test -f "$ac_aux_dir/mkinstalldirs"; then mkdir_p='$(mkinstalldirs)' else mkdir_p='$(install_sh) -d' fi fi 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. set dummy $ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_AWK+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { echo "$as_me:$LINENO: result: $AWK" >&5 echo "${ECHO_T}$AWK" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$AWK" && break done { echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; } set x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } SET_MAKE= else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null # test to see if srcdir already configured if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} { (exit 1); exit 1; }; } fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='pasmo' VERSION='0.5.3' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} install_sh=${install_sh-"$am_aux_dir/install-sh"} # 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. 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. set dummy ${ac_tool_prefix}strip; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { echo "$as_me:$LINENO: result: $STRIP" >&5 echo "${ECHO_T}$STRIP" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 echo "${ECHO_T}$ac_ct_STRIP" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. AMTAR=${AMTAR-"${am_missing_run}tar"} am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' # Check for programs. ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -z "$CXX"; then if test -n "$CCC"; then CXX=$CCC else if test -n "$ac_tool_prefix"; then for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC 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 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then { echo "$as_me:$LINENO: result: $CXX" >&5 echo "${ECHO_T}$CXX" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CXX="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then { echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 echo "${ECHO_T}$ac_ct_CXX" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$ac_ct_CXX" && break done if test "x$ac_ct_CXX" = x; then CXX="g++" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CXX=$ac_ct_CXX fi fi fi fi # Provide some information about the compiler. echo "$as_me:$LINENO: checking for C++ compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { echo "$as_me:$LINENO: checking for C++ compiler default output file name" >&5 echo $ECHO_N "checking for C++ compiler default output file name... $ECHO_C" >&6; } ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # # List of possible output files, starting from the most likely. # The algorithm is not robust to junk in `.', hence go to wildcards (a.*) # only as a last resort. b.out is created by i960 compilers. ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' # # The IRIX 6 linker writes into existing files which may not be # executable, retaining their permissions. Remove them first so a # subsequent execution test works. ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { (ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link_default") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C++ compiler cannot create executables See \`config.log' for more details." >&5 echo "$as_me: error: C++ compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext { echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6; } # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { echo "$as_me:$LINENO: checking whether the C++ compiler works" >&5 echo $ECHO_N "checking whether the C++ compiler works... $ECHO_C" >&6; } # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C++ compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C++ compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; } { echo "$as_me:$LINENO: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6; } { echo "$as_me:$LINENO: checking for suffix of executables" >&5 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; } if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext { echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT { echo "$as_me:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; } if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6; } if test "${ac_cv_cxx_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi { echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6; } GXX=`test $ac_compiler_gnu = yes && echo yes` ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS { echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6; } if test "${ac_cv_prog_cxx_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no CXXFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cxx_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CXXFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cxx_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi { echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6; } if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fi 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 DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo done .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote="\"" _am_result=BSD fi fi { echo "$as_me:$LINENO: result: $_am_result" >&5 echo "${ECHO_T}$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CXX" am_compiler_list= { echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; } if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # 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'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CXX_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > 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 done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # 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 ;; none) break ;; esac # 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. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CXX_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CXX_dependencies_compiler_type=none fi fi { echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5 echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6; } CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then am__fastdepCXX_TRUE= am__fastdepCXX_FALSE='#' else am__fastdepCXX_TRUE='#' am__fastdepCXX_FALSE= fi # Generate files ac_config_files="$ac_config_files Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then test "x$cache_file" != "x/dev/null" && { echo "$as_me:$LINENO: updating cache $cache_file" >&5 echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that # take arguments), then branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. ac_script=' t clear :clear s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g t quote s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g t quote b any :quote s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g s/\[/\\&/g s/\]/\\&/g s/\$/$$/g H :any ${ g s/^\n// s/\n/ /g p } ' DEFS=`sed -n "$ac_script" confdefs.h` ac_libobjs= ac_ltlibobjs= 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$//' ac_i=`echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) as_nl=' ' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # 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). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... 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'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # Find out whether ``test -x'' works. Don't use a zero-byte file, as # systems may use methods other than mode bits to determine executability. cat >conf$$.file <<_ASEOF #! /bin/sh exit 0 _ASEOF chmod +x conf$$.file if test -x conf$$.file >/dev/null 2>&1; then as_executable_p="test -x" else as_executable_p=: fi rm -f conf$$.file # 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'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 # Save the log message, to keep $[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by pasmo $as_me 0.5.3, which was generated by GNU Autoconf 2.60. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # Files that config.status was made for. config_files="$ac_config_files" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE Configuration files: $config_files Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ pasmo config.status 0.5.3 configured by $0, generated by GNU Autoconf 2.60, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2006 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) echo "$ac_cs_version"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --he | --h | --help | --hel | -h ) echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 CONFIG_SHELL=$SHELL export CONFIG_SHELL exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= trap 'exit_status=$? { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } # # Set up the sed scripts for CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h if test -n "$CONFIG_FILES"; then _ACEOF ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF SHELL!$SHELL$ac_delim PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim PACKAGE_NAME!$PACKAGE_NAME$ac_delim PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim PACKAGE_STRING!$PACKAGE_STRING$ac_delim PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim exec_prefix!$exec_prefix$ac_delim prefix!$prefix$ac_delim program_transform_name!$program_transform_name$ac_delim bindir!$bindir$ac_delim sbindir!$sbindir$ac_delim libexecdir!$libexecdir$ac_delim datarootdir!$datarootdir$ac_delim datadir!$datadir$ac_delim sysconfdir!$sysconfdir$ac_delim sharedstatedir!$sharedstatedir$ac_delim localstatedir!$localstatedir$ac_delim includedir!$includedir$ac_delim oldincludedir!$oldincludedir$ac_delim docdir!$docdir$ac_delim infodir!$infodir$ac_delim htmldir!$htmldir$ac_delim dvidir!$dvidir$ac_delim pdfdir!$pdfdir$ac_delim psdir!$psdir$ac_delim libdir!$libdir$ac_delim localedir!$localedir$ac_delim mandir!$mandir$ac_delim DEFS!$DEFS$ac_delim ECHO_C!$ECHO_C$ac_delim ECHO_N!$ECHO_N$ac_delim ECHO_T!$ECHO_T$ac_delim LIBS!$LIBS$ac_delim build_alias!$build_alias$ac_delim host_alias!$host_alias$ac_delim target_alias!$target_alias$ac_delim INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim INSTALL_DATA!$INSTALL_DATA$ac_delim CYGPATH_W!$CYGPATH_W$ac_delim PACKAGE!$PACKAGE$ac_delim VERSION!$VERSION$ac_delim ACLOCAL!$ACLOCAL$ac_delim AUTOCONF!$AUTOCONF$ac_delim AUTOMAKE!$AUTOMAKE$ac_delim AUTOHEADER!$AUTOHEADER$ac_delim MAKEINFO!$MAKEINFO$ac_delim install_sh!$install_sh$ac_delim STRIP!$STRIP$ac_delim INSTALL_STRIP_PROGRAM!$INSTALL_STRIP_PROGRAM$ac_delim mkdir_p!$mkdir_p$ac_delim AWK!$AWK$ac_delim SET_MAKE!$SET_MAKE$ac_delim am__leading_dot!$am__leading_dot$ac_delim AMTAR!$AMTAR$ac_delim am__tar!$am__tar$ac_delim am__untar!$am__untar$ac_delim CXX!$CXX$ac_delim CXXFLAGS!$CXXFLAGS$ac_delim LDFLAGS!$LDFLAGS$ac_delim CPPFLAGS!$CPPFLAGS$ac_delim ac_ct_CXX!$ac_ct_CXX$ac_delim EXEEXT!$EXEEXT$ac_delim OBJEXT!$OBJEXT$ac_delim DEPDIR!$DEPDIR$ac_delim am__include!$am__include$ac_delim am__quote!$am__quote$ac_delim AMDEP_TRUE!$AMDEP_TRUE$ac_delim AMDEP_FALSE!$AMDEP_FALSE$ac_delim AMDEPBACKSLASH!$AMDEPBACKSLASH$ac_delim CXXDEPMODE!$CXXDEPMODE$ac_delim am__fastdepCXX_TRUE!$am__fastdepCXX_TRUE$ac_delim am__fastdepCXX_FALSE!$am__fastdepCXX_FALSE$ac_delim LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 76; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` if test -n "$ac_eof"; then ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` ac_eof=`expr $ac_eof + 1` fi cat >>$CONFIG_STATUS <<_ACEOF cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof /@[a-zA-Z_][a-zA-Z_0-9]*@/!b end _ACEOF sed ' s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g s/^/s,@/; s/!/@,|#_!!_#|/ :n t n s/'"$ac_delim"'$/,g/; t s/$/\\/; p N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n ' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF :end s/|#_!!_#|//g CEOF$ac_eof _ACEOF # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/ s/:*\${srcdir}:*/:/ s/:*@srcdir@:*/:/ s/^\([^=]*=[ ]*\):*/\1/ s/:*$// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF fi # test -n "$CONFIG_FILES" for ac_tag in :F $CONFIG_FILES :C $CONFIG_COMMANDS do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 echo "$as_me: error: Invalid tag $ac_tag." >&2;} { (exit 1); exit 1; }; };; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 echo "$as_me: error: cannot find input file: $ac_f" >&2;} { (exit 1); exit 1; }; };; esac ac_file_inputs="$ac_file_inputs $ac_f" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input="Generated from "`IFS=: echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} fi case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin";; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` { as_dir="$ac_dir" case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= case `sed -n '/datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p ' $ac_file_inputs` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s&@configure_input@&$configure_input&;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t $ac_datarootdir_hack " $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&5 echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&2;} rm -f "$tmp/stdin" case $ac_file in -) cat "$tmp/out"; rm -f "$tmp/out";; *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; esac ;; :C) { echo "$as_me:$LINENO: executing $ac_file commands" >&5 echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do # 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 # 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. # So let's grep whole file. if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # 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 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 # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` { as_dir=$dirpart/$fdir case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ;; esac done # for ac_tag { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi # End of configure.ac for Pasmo pasmo-0.5.3/AUTHORS0000644000175000017500000000007210227032373010625 00000000000000Author: Julián Albo, "NotFound" julian.notfound@gmail.com pasmo-0.5.3/COPYING0000644000175000017500000004311010227032232010602 00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. pasmo-0.5.3/ChangeLog0000644000175000017500000000003710231245173011327 00000000000000See the NEWS file for changes. pasmo-0.5.3/INSTALL0000644000175000017500000002230610227032232010604 00000000000000Copyright 1994, 1995, 1996, 1999, 2000, 2001 Free Software Foundation, Inc. This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Basic Installation ================== These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. (Caching is disabled by default to prevent problems with accidental use of stale cache files.) If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You only need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes awhile. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for variables by setting them in the environment. You can do that on the command line like this: ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. If you have to use a `make' that does not support the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' will install the package's files in `/usr/local/bin', `/usr/local/man', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PATH'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you give `configure' the option `--exec-prefix=PATH', the package will use PATH as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=PATH' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of host the package will run on. Usually `configure' can figure that out, but if it prints a message saying it cannot guess the host type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the host type. If you are _building_ compiler tools for cross-compiling, you should use the `--target=TYPE' option to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the host platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. In this case, you should also specify the build platform with `--build=TYPE', because, in this case, it may not be possible to guess the build platform (it sometimes involves compiling and running simple test programs, and this can't be done if the compiler is a cross compiler). Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc will cause the specified gcc to be used as the C compiler (unless it is overridden in the site shell script). `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of the options to `configure', and exit. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. pasmo-0.5.3/NEWS0000644000175000017500000000743410552443627010276 00000000000000 Version 0.5.3 Fixed bug: several errors give exit status 0. Version 0.5.2 Added warning when 64KB limit is crossed. Now all warnings show line information. Version 0.5.1 Enhanced syntax for REPT allowing a control variable, initial value and increment. Macro parameters now are expanded inside REPT and IRP. New ## operator for use inside MACRO definitions. New .SHIFT directive for use inside MACRO definitions. New --bin command line option to explicitly select raw binary mode. Now the public symbol listing can be generated together with the complete listing. Version 0.5.0 New directives .ERROR and .WARNING. New operators HIGH, LOW, !, &&, || and conditional expression. New synonims for existent operators: &, |, =, ~, !=, <, >, <=. >=, << and >>. Brackets can now be used in addition to parenthesis to express indirection, and the new bracket only mode allows only the brackets to do it. Now all number formats allow embedded '$'. Now '$' in identifiers are stripped after checking reserved words. Warnings on some instructions that looks like errors. New option to warn when instructions not valid for 8080 are used. New option to generate 8086 code from z80 sources. Now can create .tzx and .cdt tape images, with or without basic loader, and cp/m 86 cmd files. The interaction between macros and ifs is better handled, for example MACRO, REPT and IRP directives can be used inside IF blocks. REPT argument now can be 0. Warnings when expressions that looks like inexistent instructions are used. Debug ouput much more clean and complete. Source files now are not readed several times. Version 0.4.0 Debug messages for autolocal blocks where showed even when no using debug options, fixed. PROC and LOCAL now can be used in autolocal mode. -v, -E and --equ command line options. DEFINED operator. Corrected bug in ENDIF inside nested IF. Version 0.3.7 Added --alocal option for autolocal mode. Version 0.3.6 Added -I option. Bug in tap checksum code fixed. Added --nocase option. Version 0.3.5 Command line option -err to send error messages to standard output. Version 0.3.4 Undocumented instructions SLL. Version 0.3.3 Some undocumented Z80 instructions are now accepted. See undoc.asm. Version 0.3.2 Some error messages are now more clear. Bug $ evaluated to the current item position and not the beginning of the current instruction or directive, corrected. The '%' is now an operator (same as MOD keyword). Now an expression that begins with parenthesis is accepeted in some situations where a "(register)" specification is possible that gives error in previous versions. Version 0.3.1 New output format --tapbas The '*' and '/' tokens were not processed, fixed. Version 0.3.0 Dependencies corrected. Numbers with & prefix. Corrected bug in LD A and LD simple. DEFL, MACRO, REPT, IRP, ENDM and EXITM directives. Error "Unbalanced PROC" now show the line of the PROC not closed. NUL operator. C style strings more complete. Version 0.2.4 LOCAL, PROC and ENDP directives. See local.asm for sample. Version 0.2.3 Added output format MSX. Line number at the beginning of line is now admitted. Operators EQ, LT, LE, GT, GE and NE. '@' and '.' now can be used in identifiers. Version 0.2.2 Debug output control. Version 0.2.1 Line number of error was incorrectly showed, corrected. INCBIN directive. Decimal numeric literals greater than 65535 now are truncated instead of rejected. Binary numbers prefixed with %. File names now can be quoted with single or double quotes. Version 0.2.0 Added the object format .tap and the --name option. Version 0.1.1 The offset in instructions on (ix + offset) or (iy + offset) now can also be (ix - offset) or (iy - offset). Version 0.1.0 Added code generation in PRL format for use in CP/M Plus RSX. pasmo-0.5.3/depcomp0000755000175000017500000003034510227032232011132 00000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects # Copyright 1999, 2000 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, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # 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 . 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 # `libtool' can also be set to `yes' or `no'. if test -z "$depfile"; then base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'` dir=`echo "$object" | sed 's,/.*$,/,'` if test "$dir" = "$object"; then dir= fi # FIXME: should be _deps on DOS. depfile="$dir.deps/$base" fi 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 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. "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" 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. 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. stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'` tmpdepfile="$stripped.u" outname="$stripped.o" if test "$libtool" = yes; then "$@" -Wc,-M else "$@" -M fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi 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,^$outname:,$object :," < "$tmpdepfile" > "$depfile" sed -e "s,^$outname: \(.*\)$,\1:," < "$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" ;; tru64) # The Tru64 AIX 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. base=`echo "$object" | sed -e 's/\.o$/.d/' -e 's/\.lo$/.d/'` tmpdepfile1="$base.o.d" tmpdepfile2="$base.d" if test "$libtool" = yes; then "$@" -Wc,-MD else "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi if test -f "$tmpdepfile1"; then tmpdepfile="$tmpdepfile1" else tmpdepfile="$tmpdepfile2" fi if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a space and a tab 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 proprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. test -z "$dashmflag" && dashmflag=-M ( IFS=" " case " $* " in *" --mode=compile "*) # this is libtool, let us make it quiet for arg do # cycle over the arguments case "$arg" in "--mode=compile") # insert --quiet before "--mode=compile" set fnord "$@" --quiet shift # fnord ;; esac set fnord "$@" "$arg" shift # fnord shift # "$arg" done ;; esac "$@" $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" ) & proc=$! "$@" stat=$? wait "$proc" if test "$stat" != 0; then exit $stat; fi 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) # X makedepend ( shift cleared=no for arg in "$@"; do case $cleared in no) set ""; shift cleared=yes esac case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift;; -*) ;; *) set fnord "$@" "$arg"; shift;; esac done obj_suffix="`echo $object | sed 's/^.*\././'`" touch "$tmpdepfile" ${MAKEDEPEND-makedepend} 2>/dev/null -o"$obj_suffix" -f"$tmpdepfile" "$@" ) & proc=$! "$@" stat=$? wait "$proc" if test "$stat" != 0; then exit $stat; fi 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 proprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. ( IFS=" " case " $* " in *" --mode=compile "*) for arg do # cycle over the arguments case $arg in "--mode=compile") # insert --quiet before "--mode=compile" set fnord "$@" --quiet shift # fnord ;; esac set fnord "$@" "$arg" shift # fnord shift # "$arg" done ;; esac "$@" -E | sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" ) & proc=$! "$@" stat=$? wait "$proc" if test "$stat" != 0; then exit $stat; fi 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 proprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. ( IFS=" " case " $* " in *" --mode=compile "*) for arg do # cycle over the arguments case $arg in "--mode=compile") # insert --quiet before "--mode=compile" set fnord "$@" --quiet shift # fnord ;; esac set fnord "$@" "$arg" shift # fnord shift # "$arg" done ;; esac for arg do case "$arg" in "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" ) & proc=$! "$@" stat=$? wait "$proc" if test "$stat" != 0; then exit $stat; fi rm -f "$depfile" echo "$object : \\" > "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 pasmo-0.5.3/install-sh0000755000175000017500000001267110227032232011563 00000000000000#!/bin/sh # # install - install a program, script, or datafile # This comes from X11R5 (mit/util/scripts/install.sh). # # Copyright 1991 by the Massachusetts Institute of Technology # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of M.I.T. not be used in advertising or # publicity pertaining to distribution of the software without specific, # written prior permission. M.I.T. makes no representations about the # suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # # 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. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" transformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" dir_arg="" while [ x"$1" != x ]; do case $1 in -c) instcmd="$cpprog" shift continue;; -d) dir_arg=true shift continue;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; -s) stripcmd="$stripprog" shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; *) if [ x"$src" = x ] then src=$1 else # this colon is to work around a 386BSD /bin/sh bug : dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "install: no input file specified" exit 1 else : fi if [ x"$dir_arg" != x ]; then dst=$src src="" if [ -d $dst ]; then instcmd=: chmodcmd="" else instcmd=$mkdirprog fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f $src -o -d $src ] then : else echo "install: $src does not exist" exit 1 fi if [ x"$dst" = x ] then echo "install: no destination specified" exit 1 else : fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic if [ -d $dst ] then dst="$dst"/`basename $src` else : fi fi ## this sed command emulates the dirname command dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then defaultIFS=' ' IFS="${IFS-${defaultIFS}}" oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` IFS="${oIFS}" pathcomp='' while [ $# -ne 0 ] ; do pathcomp="${pathcomp}${1}" shift if [ ! -d "${pathcomp}" ] ; then $mkdirprog "${pathcomp}" else : fi pathcomp="${pathcomp}/" done fi if [ x"$dir_arg" != x ] then $doit $instcmd $dst && if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else : ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else : ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else : ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else : ; fi else # If we're going to rename the final executable, determine the name now. if [ x"$transformarg" = x ] then dstfile=`basename $dst` else dstfile=`basename $dst $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename if [ x"$dstfile" = x ] then dstfile=`basename $dst` else : fi # Make a temp file name in the proper directory. dsttmp=$dstdir/#inst.$$# # Move or copy the file name to the temp name $doit $instcmd $src $dsttmp && trap "rm -f ${dsttmp}" 0 && # 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 $instcmd $src $dsttmp" command. if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else :;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else :;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else :;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else :;fi && # Now rename the file to the real destination. $doit $rmcmd -f $dstdir/$dstfile && $doit $mvcmd $dsttmp $dstdir/$dstfile fi && exit 0 pasmo-0.5.3/missing0000755000175000017500000002405010227032232011150 00000000000000#! /bin/sh # Common stub for a few missing GNU programs while installing. # Copyright 1996, 1997, 1999, 2000 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, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # 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=: # 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 case "$1" in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case "$1" in -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' 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]" ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing 0.4 - GNU automake" ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; aclocal*) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is missing on your system. 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) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is missing on your system. 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) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is missing on your system. 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*) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is missing on your system. 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) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is needed, and you do not seem to have it handy on your system. You might have modified some files without having the proper tools for further handling them. You can get \`$1Help2man' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` 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' is missing on your system. 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 [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.h fi ;; esac fi if [ ! -f y.tab.h ]; then echo >y.tab.h fi if [ ! -f y.tab.c ]; then echo 'main() { return 0; }' >y.tab.c fi ;; lex|flex) echo 1>&2 "\ WARNING: \`$1' is missing on your system. 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 [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if [ ! -f lex.yy.c ]; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is missing on your system. 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 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` fi if [ -f "$file" ]; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit 1 fi ;; makeinfo) if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then # We have makeinfo, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is missing on your system. 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." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` fi touch $file ;; tar) shift if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 fi # 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 ${1+"$@"} && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar ${1+"$@"} && exit 0 fi firstarg="$1" if shift; then case "$firstarg" in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" ${1+"$@"} && exit 0 ;; esac case "$firstarg" in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" ${1+"$@"} && 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 you do not seem to have it handy on your system. 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 prerequirements 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 pasmo-0.5.3/mkinstalldirs0000755000175000017500000000350410227032232012360 00000000000000#! /bin/sh # mkinstalldirs --- make directory hierarchy # Author: Noah Friedman # Created: 1993-05-16 # Public domain # $Id: mkinstalldirs,v 1.13 1999/01/05 03:18:55 bje Exp $ errstatus=0 dirmode="" usage="\ Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..." # process command line arguments while test $# -gt 0 ; do case "${1}" in -h | --help | --h* ) # -h for help echo "${usage}" 1>&2; exit 0 ;; -m ) # -m PERM arg shift test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } dirmode="${1}" shift ;; -- ) shift; break ;; # stop option processing -* ) echo "${usage}" 1>&2; exit 1 ;; # unknown option * ) break ;; # first non-opt arg esac done for file do if test -d "$file"; then shift else break fi done case $# in 0) exit 0 ;; esac case $dirmode in '') if mkdir -p -- . 2>/dev/null; then echo "mkdir -p -- $*" exec mkdir -p -- "$@" fi ;; *) if mkdir -m "$dirmode" -p -- . 2>/dev/null; then echo "mkdir -m $dirmode -p -- $*" exec mkdir -m "$dirmode" -p -- "$@" fi ;; esac for file do set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` shift pathcomp= for d do pathcomp="$pathcomp$d" case "$pathcomp" in -* ) pathcomp=./$pathcomp ;; esac if test ! -d "$pathcomp"; then echo "mkdir $pathcomp" mkdir "$pathcomp" || lasterr=$? if test ! -d "$pathcomp"; then errstatus=$lasterr else if test ! -z "$dirmode"; then echo "chmod $dirmode $pathcomp" lasterr="" chmod "$dirmode" "$pathcomp" || lasterr=$? if test ! -z "$lasterr"; then errstatus=$lasterr fi fi fi fi pathcomp="$pathcomp/" done done exit $errstatus # Local Variables: # mode: shell-script # sh-indentation: 3 # End: # mkinstalldirs ends here pasmo-0.5.3/asm.h0000644000175000017500000000310710162017736010514 00000000000000// asm.h // Revision 21-dec-2004 #include #include #include #include #include #include class Asm { public: Asm (); // This is not a copy constructor, it creates a new // instance copying only the options. //explicit Asm (const Asm & a); ~Asm (); void verbose (); enum DebugType { NoDebug, DebugSecondPass, DebugAll }; DebugType debugtype; void setdebugtype (DebugType type); void errtostdout (); void setbase (unsigned int addr); void caseinsensitive (); void autolocal (); void bracketonly (); void warn8080 (); void set86 (); void addincludedir (const std::string & dirname); void addpredef (const std::string & predef); void setheadername (const std::string & headername_n); void loadfile (const std::string & filename); void processfile (); void emitobject (std::ostream & out); void emitplus3dos (std::ostream & out); void emittap (std::ostream & out); void emittzx (std::ostream & out); void emitcdt (std::ostream & out); void emittapbas (std::ostream & out); void emittzxbas (std::ostream & out); void emitcdtbas (std::ostream & out); void emithex (std::ostream & out); void emitamsdos (std::ostream & out); void emitprl (std::ostream & out); void emitcmd (std::ostream & out); void emitmsx (std::ostream & out); void dumppublic (std::ostream & out); void dumpsymbol (std::ostream & out); private: Asm (const Asm & a); // Forbidden void operator = (const Asm &); // Forbidden public: // Make it public to simplify implementation. class In; friend class In; private: In * pin; }; // End of asm.h pasmo-0.5.3/asm.cpp0000644000175000017500000036707010230766663011071 00000000000000// asm.cpp // Revision 18-apr-2005 #include "asm.h" #include "token.h" #include "asmfile.h" #include "cpc.h" #include "tap.h" #include "tzx.h" #include "spectrum.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #define ASSERT assert using std::cout; using std::cerr; using std::endl; using std::ostringstream; using std::make_pair; using std::runtime_error; using std::logic_error; using std::for_each; using std::fill; namespace { //********************************************************* // Exceptions. //********************************************************* // Errors that must never happen, they are handled for diagnose // Pasmo bugs. logic_error UnexpectedError ("Unexpected error"); logic_error UnexistentMode ("Mode of code generation invalid"); logic_error UnexpectedPrefix ("Unexpected prefix"); logic_error UnexpectedRegisterCode ("Unexpected register code"); logic_error InvalidFlagConvert ("Inalid flag specified for conversion"); logic_error InvalidPrefixUsed ("Invalid use of prefix"); logic_error InvalidRegisterUsed ("Invalid register used"); logic_error InvalidInstructionType ("Invalid instruction type"); logic_error LocalNotExist ("Trying to use a non existent local level"); logic_error LocalNotExpected ("Unexpected local block encountered"); logic_error AutoLocalNotExpected ("Unexpected autolocal block encountered"); logic_error InvalidPassValue ("Invalid value of pass"); logic_error UnexpectedORG ("Unexpected ORG found"); logic_error UnexpectedMACRO ("Unexpected MACRO found"); logic_error MACROLostENDM ("Unexpected MACRO without ENDM"); // Errors in the code being assembled. runtime_error ErrorReadingINCBIN ("Error reading INCBIN file"); runtime_error ErrorOutput ("Error writing object file"); runtime_error InvalidPredefine ("Can't predefine invalid identifier"); runtime_error InvalidPredefineValue ("Invalid value for predefined symbol"); runtime_error InvalidPredefineSyntax ("Syntax error in predefined symbol"); runtime_error RedefinedDEFL ("Invalid definition, previously defined as DEFL"); runtime_error RedefinedEQU ("Invalid definition, previously defined as EQU or label"); runtime_error InvalidInAutolocal ("Invalid use of name in autolocal mode"); runtime_error InvalidSharpSharp ("Invalid use of ##"); runtime_error EQUwithoutlabel ("EQU without label"); runtime_error DEFLwithoutlabel ("DEFL without label"); runtime_error Lenght1Required ("Invalid literal, length 1 required"); runtime_error DivisionByZero ("Division by zero"); runtime_error IFwithoutENDIF ("IF without ENDIF"); runtime_error ELSEwithoutIF ("ELSE without IF"); runtime_error ELSEwithoutENDIF ("ELSE without ENDIF"); runtime_error ENDIFwithoutIF ("ENDIF without IF"); runtime_error UnbalancedPROC ("Unbalanced PROC"); runtime_error UnbalancedENDP ("Unbalanced ENDP"); runtime_error MACROwithoutENDM ("MACRO without ENDM"); runtime_error REPTwithoutENDM ("REPT without ENDM"); runtime_error IRPWithoutParameters ("IRP without parameters"); runtime_error IRPwithoutENDM ("IRP without ENDM"); runtime_error ENDMOutOfMacro ("ENDM outside of macro"); runtime_error ShiftOutsideMacro (".SHIFT outside MACRO"); runtime_error InvalidBaseValue ("Invalid base value"); runtime_error ParenInsteadOfBracket ("Expected ] but ) found"); runtime_error BracketInsteadOfParen ("Expected ) but ] found"); runtime_error OffsetOutOfRange ("Offset out of range"); runtime_error RelativeOutOfRange ("Relative jump out of range"); runtime_error BitOutOfRange ("Bit position out of range"); runtime_error InvalidInstruction ("Invalid instruction"); runtime_error InvalidOperand ("Invalid operand"); runtime_error InvalidFlagJR ("Invalid flag for JR"); runtime_error InvalidValueRST ("Invalid RST value"); runtime_error InvalidValueIM ("Invalid IM value"); runtime_error NotValid86 ("Instruction not valid in 86 mode"); runtime_error IsPredefined ("Can't redefine, is predefined"); runtime_error OutOfSyncPRL ("PRL genration failed: out of sync"); class NoInstruction : public runtime_error { public: NoInstruction (const Token & tok) : runtime_error ("Unexpected '" + tok.str () + "' used as instruction") { } }; class UndefinedVar : public runtime_error { public: UndefinedVar (const std::string & varname) : runtime_error ("Symbol '" + varname + "' is undefined") { } }; class EndLineExpected : public runtime_error { public: EndLineExpected (const Token & tok) : runtime_error ("End line expected but '" + tok.str () + "'found") { } }; class IdentifierExpected : public runtime_error { public: IdentifierExpected (const Token & tok) : runtime_error ("Identifier expected but '" + tok.str () + "'found") { } }; class MacroExpected : public runtime_error { public: MacroExpected (const std::string & name) : runtime_error ("Macro name expected but '" + name + "'found") { } }; class ValueExpected : public runtime_error { public: ValueExpected (const Token & tok) : runtime_error ("Value expected but '" + tok.str () + "'found") { } }; class SomeOpenExpected : public runtime_error { public: SomeOpenExpected (const Token & tok) : runtime_error ("Expected ( or [ but '" + tok.str () + "' found") { } }; class TokenExpected : public runtime_error { public: TokenExpected (TypeToken ttexpect, const Token & tokfound) : runtime_error ("Expected '" + gettokenname (ttexpect) + "' but '" + tokfound.str () + "' found") { } }; class OffsetExpected : public runtime_error { public: OffsetExpected (const Token & tok) : runtime_error ("Offset expression expected but '" + tok.str () + "' found") { } }; class ErrorDirective : public runtime_error { public: ErrorDirective (const Token & tok) : runtime_error (".ERROR directive: " + tok.str () ) { } }; class UndefinedInPass1 : public runtime_error { public: UndefinedInPass1 (const std::string & name) : runtime_error ("The symbol '" + name + "' must be defined in pass 1") { } }; void checktoken (TypeToken ttexpected, const Token & tok) { if (tok.type () != ttexpected) throw TokenExpected (ttexpected, tok); } //********************************************************* // Auxiliary functions and constants. //********************************************************* const std::string emptystr; enum GenCodeMode { gen80, gen86 }; const address addrTRUE= 0xFFFF; const address addrFALSE= 0; // Register codes used in some instructions. enum regwCode { regBC= 0, regDE= 1, regHL= 2, regAF= 3, regSP= 3 }; // 8086 equivalents: // CX DX BX enum regbCode { regB= 0, regC= 1, regD= 2, regE= 3, regH= 4, regL= 5, reg_HL_= 6, regA= 7, reg86AL= 0, reg86CH= 5, reg86CL= 1, reg86DH= 6, reg86DL= 2, reg86BH= 7, reg86BL= 3, regbInvalid= 8 }; byte getregb86 (regbCode rb) { switch (rb) { case regA: return reg86AL; case regB: return reg86CH; case regC: return reg86CL; case regD: return reg86DH; case regE: return reg86DL; case regH: return reg86BH; case regL: return reg86BL; default: ASSERT (false); throw UnexpectedRegisterCode; } } regbCode getregb (TypeToken tt) { switch (tt) { case TypeA: return regA; case TypeB: return regB; case TypeC: return regC; case TypeD: return regD; case TypeE: return regE; case TypeH: return regH; case TypeL: return regL; default: return regbInvalid; } } enum flagCode { flagNZ= 0, flagZ= 1, flagNC= 2, flagC= 3, flagPO= 4, flagPE= 5, flagP= 6, flagM= 7, flag86NZ= 0x05, flag86Z= 0x04, flag86NC= 0x03, flag86C= 0x02, flag86NP= 0x0B, flag86P= 0x0A, flag86NS= 0x09, flag86S= 0x08, flagInvalid= 8 }; flagCode getflag86 (flagCode fcode) { switch (fcode) { case flagNZ: return flag86NZ; case flagZ: return flag86Z; case flagNC: return flag86NC; case flagC: return flag86C; case flagPO: return flag86NP; case flagPE: return flag86P; case flagP: return flag86NS; case flagM: return flag86S; default: throw InvalidFlagConvert; } } flagCode invertflag86 (flagCode fcode) { return static_cast ( (fcode & 1) ? fcode & ~ 1 : fcode | 1); } flagCode getflag (TypeToken tt) { switch (tt) { case TypeNZ: return flagNZ; case TypeZ: return flagZ; case TypeNC: return flagNC; case TypeC: return flagC; case TypePO: return flagPO; case TypePE: return flagPE; case TypeP: return flagP; case TypeM: return flagM; default: return flagInvalid; } } // Common prefixes and base codes for some operands. const byte prefixIX= 0xDD; const byte prefixIY= 0xFD; const byte NoPrefix= 0; std::string nameHLpref (byte prefix) { switch (prefix) { case NoPrefix: return "HL"; case prefixIX: return "IX"; case prefixIY: return "IY"; default: throw InvalidPrefixUsed; } } const bool nameSP= true; const bool nameAF= false; std::string regwName (regwCode code, bool useSP, byte prefix) { ASSERT (code == regHL || prefix == NoPrefix); switch (code) { case regBC: return "BC"; case regDE: return "DE"; case regHL: return nameHLpref (prefix); case regAF: return useSP ? "SP" : "AF"; default: throw InvalidRegisterUsed; } } const byte codeADDHL= 0x09; const byte codeADCHL= 0x4A; const byte codeSBCHL= 0x42; const byte codeLDIA= 0x47; const byte codeLDRA= 0x4F; const byte codeRST00= 0xC7; const byte codeDJNZ= 0x10; enum TypeByteInst { tiADDA= 0, tiADCA= 1, tiSUB= 2, tiSBCA= 3, tiAND= 4, tiXOR= 5, tiOR= 6, tiCP= 7 }; std::string byteinstName (TypeByteInst ti) { switch (ti) { case tiADDA: return "ADD A,"; case tiADCA: return "ADC A,"; case tiSUB: return "SUB"; case tiSBCA: return "SBC A,"; case tiAND: return "AND"; case tiXOR: return "XOR"; case tiOR: return "OR"; case tiCP: return "CP"; default: throw InvalidInstructionType; } } byte getbaseByteInst (TypeByteInst ti, GenCodeMode genmode) { static byte byte86 []= { 0x00, 0x10, 0x28, 0x18, 0x20, 0x30, 0x08, 0x38 }; switch (genmode) { case gen80: return 0x80 | (ti << 3); case gen86: return byte86 [ti]; default: ASSERT (false); throw UnexistentMode; } } byte getByteInstInmediate (TypeByteInst ti, GenCodeMode genmode) { static byte byte86 []= { 0x04, 0x14, 0x2C, 0x1C, 0x24, 0x34, 0x0C, 0x3C }; switch (genmode) { case gen80: return 0xC6 | (ti << 3); case gen86: return byte86 [ti]; default: ASSERT (false); throw UnexistentMode; } } std::string nameIdesp (byte prefix, bool hasdesp, byte desp) { std::string r (1, '('); r+= nameHLpref (prefix); if (hasdesp) { r+= '+'; r+= hex2str (desp); } r+= ')'; return r; } std::string getregbname (regbCode rb, byte prefix= NoPrefix, bool hasdesp= false, byte desp= 0) { ASSERT (! hasdesp || (rb == reg_HL_ && prefix != NoPrefix) ); switch (rb) { case regA: return "A"; case regB: return "B"; case regC: return "C"; case regD: return "D"; case regE: return "E"; case regH: switch (prefix) { case NoPrefix: return "H"; case prefixIX: return "IXH"; case prefixIY: return "IYH"; default: throw UnexpectedPrefix; } case regL: switch (prefix) { case NoPrefix: return "L"; case prefixIX: return "IXL"; case prefixIY: return "IYL"; default: throw UnexpectedPrefix; } case reg_HL_: return nameIdesp (prefix, hasdesp, desp); default: ASSERT (false); throw UnexpectedRegisterCode; } } std::string tablabel (std::string str) { const std::string::size_type l= str.size (); if (l < 8) str+= "\t\t"; else if (l < 16) str+= '\t'; else str+= ' '; return str; } //********************************************************* // Null ostream class. //********************************************************* class Nullbuff : public std::streambuf { public: Nullbuff (); protected: int overflow (int); int sync (); }; Nullbuff::Nullbuff () { setbuf (0, 0); } int Nullbuff::overflow (int) { setp (pbase (), epptr () ); return 0; } int Nullbuff::sync () { return 0; } class Nullostream : public std::ostream { public: Nullostream (); private: Nullbuff buff; }; Nullostream::Nullostream () : std::ostream (& buff) { } //*********************************************** // Auxiliary tables //*********************************************** struct SimpleInst { byte code; bool edprefix; bool valid8080; address code86; SimpleInst (byte coden= 0, bool edprefixn= false, bool valid8080n= false, address code86n= 0) : code (coden), edprefix (edprefixn), valid8080 (valid8080n), code86 (code86n) { } }; typedef std::map simpleinst_t; simpleinst_t simpleinst; class InitSimple { InitSimple (); static InitSimple instance; }; InitSimple InitSimple::instance; InitSimple::InitSimple () { simpleinst [TypeCCF]= SimpleInst (0x3F, false, true, 0x00F5); simpleinst [TypeCPD]= SimpleInst (0xA9, true); simpleinst [TypeCPDR]= SimpleInst (0xB9, true); simpleinst [TypeCPI]= SimpleInst (0xA1, true); simpleinst [TypeCPIR]= SimpleInst (0xB1, true); simpleinst [TypeCPL]= SimpleInst (0x2F, false, true, 0xF6D0); simpleinst [TypeDAA]= SimpleInst (0x27, false, true, 0x0027); simpleinst [TypeDI]= SimpleInst (0xF3, false, true, 0x00FA); simpleinst [TypeEI]= SimpleInst (0xFB, false, true, 0x00FB); simpleinst [TypeEXX]= SimpleInst (0xD9); simpleinst [TypeHALT]= SimpleInst (0x76, false, true, 0x00F4); simpleinst [TypeIND]= SimpleInst (0xAA, true); simpleinst [TypeINDR]= SimpleInst (0xBA, true); simpleinst [TypeINI]= SimpleInst (0xA2, true); simpleinst [TypeINIR]= SimpleInst (0xB2, true); simpleinst [TypeLDD]= SimpleInst (0xA8, true); simpleinst [TypeLDDR]= SimpleInst (0xB8, true); simpleinst [TypeLDI]= SimpleInst (0xA0, true); simpleinst [TypeLDIR]= SimpleInst (0xB0, true); simpleinst [TypeNEG]= SimpleInst (0x44, true); simpleinst [TypeNOP]= SimpleInst (0x00, false, true, 0x0090); simpleinst [TypeOTDR]= SimpleInst (0xBB, true); simpleinst [TypeOTIR]= SimpleInst (0xB3, true); simpleinst [TypeOUTD]= SimpleInst (0xAB, true); simpleinst [TypeOUTI]= SimpleInst (0xA3, true); simpleinst [TypeSCF]= SimpleInst (0x37, false, true, 0x00F9); simpleinst [TypeRETI]= SimpleInst (0x4D, true); simpleinst [TypeRETN]= SimpleInst (0x45, true); simpleinst [TypeRLA]= SimpleInst (0x17, false, true, 0xD0D0); simpleinst [TypeRLCA]= SimpleInst (0x07, false, true, 0xD0C0); simpleinst [TypeRLD]= SimpleInst (0x6F, true); simpleinst [TypeRRA]= SimpleInst (0x1F, false, true, 0xD0D8); simpleinst [TypeRRCA]= SimpleInst (0x0F, false, true, 0xD0C8); simpleinst [TypeRRD]= SimpleInst (0x67, true); } } // namespace //********************************************************* // Macro class //********************************************************* namespace pasmo_impl { class MacroBase { protected: MacroBase () { } explicit MacroBase (std::vector & param) : param (param) { } explicit MacroBase (const std::string & sparam) : param (1) { param [0]= sparam; } public: size_t getparam (const std::string & name) const; std::string getparam (size_t n) const; static const size_t noparam= size_t (-1); private: std::vector param; }; size_t MacroBase::getparam (const std::string & name) const { for (size_t i= 0; i < param.size (); ++i) if (name == param [i]) return i; return noparam; } std::string MacroBase::getparam (size_t n) const { if (n >= param.size () ) return "(none)"; return param [n]; } class Macro : public MacroBase { public: Macro (std::vector & param, size_t linen, size_t endlinen) : MacroBase (param), line (linen), endline (endlinen) { } size_t getline () const { return line; } size_t getendline () const { return endline; } private: const size_t line; const size_t endline; }; class MacroIrp : public MacroBase { public: MacroIrp (const std::string & sparam) : MacroBase (sparam) { } }; class MacroRept : public MacroBase { public: MacroRept () : MacroBase () { } }; //********************************************************* // Local classes declarations. //********************************************************* enum Defined { NoDefined, DefinedDEFL, PreDefined, DefinedPass1, DefinedPass2 }; class VarData { public: VarData (bool makelocal= false) : value (0), defined (NoDefined), local (makelocal) { } VarData (address valuen, Defined definedn) : value (valuen), defined (definedn), local (false) { } void set (address valuen, Defined definedn) { value= valuen; defined= definedn; } void clear () { value= 0; defined= NoDefined; } address getvalue () const { return value; } Defined def () const { return defined; } bool islocal () const { return local; } private: address value; Defined defined; bool local; }; typedef std::map mapvar_t; class LocalLevel { public: LocalLevel (Asm::In & asmin_n); virtual ~LocalLevel (); virtual bool is_auto () const; void add (const std::string & var); private: Asm::In & asmin; mapvar_t saved; std::map globalized; }; class AutoLevel : public LocalLevel { public: AutoLevel (Asm::In & asmin_n); bool is_auto () const; }; class ProcLevel : public LocalLevel { public: ProcLevel (Asm::In & asmin_n, size_t line); size_t getline () const; private: size_t line; }; class MacroLevel : public LocalLevel { public: MacroLevel (Asm::In & asmin_n); }; class LocalStack { public: ~LocalStack (); bool empty () const; void push (LocalLevel * level); LocalLevel * top (); void pop (); private: typedef std::stack st_t; st_t st; }; class MacroFrameBase; } // namespace pasmo_impl using pasmo_impl::Macro; using pasmo_impl::MacroIrp; using pasmo_impl::MacroRept; using pasmo_impl::Defined; using pasmo_impl::NoDefined; using pasmo_impl::DefinedDEFL; using pasmo_impl::PreDefined; using pasmo_impl::DefinedPass1; using pasmo_impl::DefinedPass2; using pasmo_impl::VarData; using pasmo_impl::LocalLevel; using pasmo_impl::AutoLevel; using pasmo_impl::ProcLevel; using pasmo_impl::LocalStack; //********************************************************* // class Asm::In declaration //********************************************************* class Asm::In : public AsmFile { public: In (); // This is not a copy constructor, it creates a new // instance copying the options and the AsmFile. explicit In (const Asm::In & in); ~In (); void verbose (); void setdebugtype (DebugType type); void errtostdout (); void setbase (unsigned int addr); void caseinsensitive (); void autolocal (); void bracketonly (); void warn8080 (); void set86 (); void addpredef (const std::string & predef); void setheadername (const std::string & headername_n); void loadfile (const std::string & filename); void processfile (); int currentpass () const; // Object file generation. address getcodesize () const; void message_emit (const std::string & type); void writebincode (std::ostream & out); void emitobject (std::ostream & out); void emitplus3dos (std::ostream & out); void emittap (std::ostream & out); void writetzxcode (std::ostream & out); void emittzx (std::ostream & out); void writecdtcode (std::ostream & out); void emitcdt (std::ostream & out); std::string cpcbasicloader (); void emitcdtbas (std::ostream & out); std::string spectrumbasicloader (); void emittapbas (std::ostream & out); void emittzxbas (std::ostream & out); void emithex (std::ostream & out); void emitamsdos (std::ostream & out); void emitprl (std::ostream & out); void emitcmd (std::ostream & out); void emitmsx (std::ostream & out); void dumppublic (std::ostream & out); void dumpsymbol (std::ostream & out); private: void operator = (const Asm::In &); // Forbidden. void setentrypoint (address addr); void checkendline (Tokenizer & tz); void gendata (byte data); void gendataword (address dataword); void showcode (const std::string & instruction); void gencode (byte code); void gencode (byte code1, byte code2); void gencode (byte code1, byte code2, byte code3); void gencode (byte code1, byte code2, byte code3, byte code4); void gencodeED (byte code); void gencodeword (address value); bool setvar (const std::string & varname, address value, Defined defined); address getvalue (const std::string & var, bool required, bool ignored); // Expression evaluation. bool isdefined (const std::string & varname); void parsevalue (Tokenizer & tz, address & result, bool required, bool ignored); void expectclose (Tokenizer & tz); void parseopen (Tokenizer & tz, address & result, bool required, bool ignored); void parsemuldiv (Tokenizer & tz, address & result, bool required, bool ignored); void parseplusmin (Tokenizer & tz, address & result, bool required, bool ignored); void parserelops (Tokenizer & tz, address & result, bool required, bool ignored); void parsenot (Tokenizer & tz, address & result, bool required, bool ignored); void parseand (Tokenizer & tz, address & result, bool required, bool ignored); void parseorxor (Tokenizer & tz, address & result, bool required, bool ignored); void parsebooland (Tokenizer & tz, address & result, bool required, bool ignored); void parseboolor (Tokenizer & tz, address & result, bool required, bool ignored); void parsehighlow (Tokenizer & tz, address & result, bool required, bool ignored); void parsecond (Tokenizer & tz, address & result, bool required, bool ignored); void parsebase (Tokenizer & tz, address & result, bool required, bool ignored); address parseexpr (bool required, const Token & tok, Tokenizer & tz); // Check required tokens. void expectcomma (Tokenizer & tz); void expectcloseindir (Tokenizer & tz, bool bracket); bool parseopenindir (Tokenizer & tz); void expectA (Tokenizer & tz); void expectC (Tokenizer & tz); void parseIF (Tokenizer & tz); void parseELSE (Tokenizer & tz); void parseENDIF (Tokenizer & tz); void parseline (Tokenizer & tz); void dopass (); bool parsesimple (Tokenizer & tz, Token tok); void parsegeneric (Tokenizer & tz, Token tok); void parseINCLUDE (Tokenizer & tz); void parseEndOfInclude (Tokenizer & tz); void parseORG (Tokenizer & tz, const std::string & label= std::string () ); void parseEQU (Tokenizer & tz, const std::string & label); void parseDEFL (Tokenizer & tz, const std::string & label); bool setequorlabel (const std::string & name, address value); bool setdefl (const std::string & name, address value); void setlabel (const std::string & name); void parselabel (Tokenizer & tz, const std::string & name); void parseMACRO (Tokenizer & tz, const std::string & name, bool needcomma); byte parsedesp (Tokenizer & tz, bool bracket); // Aux error and warning functions. void emitwarning (const std::string & text); void no8080 (); void no86 (); // Z80 instructions. bool parsebyteparam (Tokenizer & tz, TypeToken tt, regbCode & regcode, byte & prefix, bool & hasdesp, byte & desp, byte prevprefix= NoPrefix); void dobyteinmediate (Tokenizer & tz, byte code, const std::string & instrname, byte prefix= NoPrefix); void dobyteparam (Tokenizer & tz, TypeByteInst ti); void dobyteparamCB (Tokenizer & tz, byte codereg, const std::string & instrname); void parseIM (Tokenizer & tz); void parseRST (Tokenizer & tz); void parseLDA_nn_ (Tokenizer & tz, bool bracket); void parseLDA_IrPlus_ (Tokenizer & tz, bool bracket, byte prefix); void parseLDA_ (Tokenizer & tz, bool bracket); void parseLDAr (regbCode rb); void parseLDA (Tokenizer & tz); void parseLDsimplen (Tokenizer & tz, regbCode regcode, byte prevprefix= NoPrefix); void parseLDsimple (Tokenizer & tz, regbCode regcode, byte prevprefix= NoPrefix); void parseLDdouble_nn_ (Tokenizer & tz, regwCode regcode, bool bracket, byte prefix= NoPrefix); void parseLDdoublenn (Tokenizer & tz, regwCode regcode, byte prefix= NoPrefix); void parseLDdouble (Tokenizer & tz, regwCode regcode, byte prefix= NoPrefix); void parseLDSP (Tokenizer & tz); void parseLD_IrPlus (Tokenizer & tz, bool bracket, byte prefix); void parseLD_nn_ (Tokenizer & tz, bool bracket); void parseLD_ (Tokenizer & tz, bool bracket); void parseLDIorR (Tokenizer & tz, byte code); void parseLD (Tokenizer & tz); void parseCP (Tokenizer & tz); void parseAND (Tokenizer & tz); void parseOR (Tokenizer & tz); void parseXOR (Tokenizer & tz); void parseRL (Tokenizer & tz); void parseRLC (Tokenizer & tz); void parseRR (Tokenizer & tz); void parseRRC (Tokenizer & tz); void parseSLA (Tokenizer & tz); void parseSRA (Tokenizer & tz); void parseSLL (Tokenizer & tz); void parseSRL (Tokenizer & tz); void parseSUB (Tokenizer & tz); void parseADDADCSBCHL (Tokenizer & tz, byte prefix, byte basecode); void parseADD (Tokenizer & tz); void parseADC (Tokenizer & tz); void parseSBC (Tokenizer & tz); void parsePUSHPOP (Tokenizer & tz, bool isPUSH); void parsePUSH (Tokenizer & tz); void parsePOP (Tokenizer & tz); void parseCALL (Tokenizer & tz); void parseRET (Tokenizer & tz); void parseJP_ (Tokenizer & tz, bool bracket); void parseJP (Tokenizer & tz); void parserelative (Tokenizer & tz, Token tok, byte code, const std::string instrname); void parseJR (Tokenizer & tz); void parseDJNZ (Tokenizer & tz); void parseINCDECdouble (Tokenizer & tz, bool isINC, regwCode reg, byte prefix= NoPrefix); void parseINCDECsimple (Tokenizer & tz, bool isINC, regbCode reg, byte prefix= NoPrefix, bool hasdesp= false, byte desp= 0); void parseINCDEC (Tokenizer & tz, bool isINC); void parseINC (Tokenizer & tz); void parseDEC (Tokenizer & tz); void parseEX (Tokenizer & tz); void parseIN (Tokenizer & tz); void parseOUT (Tokenizer & tz); void dobit (Tokenizer & tz, byte basecode, std::string instrname); void parseBIT (Tokenizer & tz); void parseRES (Tokenizer & tz); void parseSET (Tokenizer & tz); void parseDEFB (Tokenizer & tz); void parseDEFW (Tokenizer & tz); void parseDEFS (Tokenizer & tz); void parseINCBIN (Tokenizer & tz); void parsePUBLIC (Tokenizer & tz); void parseEND (Tokenizer & tz); void parseLOCAL (Tokenizer & tz); void parsePROC (Tokenizer & tz); void parseENDP (Tokenizer & tz); void parse_ERROR (Tokenizer & tz); void parse_WARNING (Tokenizer & tz); // Variables. std::string headername; bool nocase; bool autolocalmode; bool bracketonlymode; bool warn8080mode; GenCodeMode genmode; bool mode86; DebugType debugtype; byte mem [65536]; address base; address current; address currentinstruction; address minused; address maxused; address entrypoint; bool hasentrypoint; int pass; size_t iflevel; // ********** Symbol tables ************ typedef pasmo_impl::mapvar_t mapvar_t; mapvar_t mapvar; typedef std::set setpublic_t; setpublic_t setpublic; // ********* Information streams ******** Nullostream nullout; std::ostream * pout; std::ostream * perr; std::ostream * pverb; std::ostream * pwarn; // ********* Local ********** friend class pasmo_impl::LocalLevel; size_t localcount; void initlocal (); std::string genlocalname (); LocalStack localstack; bool isautolocalname (const std::string & name); AutoLevel * enterautolocal (); void finishautolocal (); void checkautolocal (const std::string & varname); // ********* Macro ********** typedef std::map mapmacro_t; mapmacro_t mapmacro; Macro * getmacro (const std::string & name) { mapmacro_t::iterator it= mapmacro.find (name); if (it == mapmacro.end () ) return NULL; else return & it->second; } bool gotoENDM (); void expandMACRO (const std::string & name, Macro macro, Tokenizer & tz); void parseREPT (Tokenizer & tz); void parseIRP (Tokenizer & tz); friend class pasmo_impl::MacroFrameBase; pasmo_impl::MacroFrameBase * pcurrentmframe; pasmo_impl::MacroFrameBase * getmframe () const { return pcurrentmframe; } void setmframe (pasmo_impl::MacroFrameBase * pnew) { pcurrentmframe= pnew; } // gencode control. bool firstcode; }; //********************************************************* // Local classes definitions. //********************************************************* namespace pasmo_impl { LocalLevel::LocalLevel (Asm::In & asmin_n) : asmin (asmin_n) { } LocalLevel::~LocalLevel () { for (mapvar_t::iterator it= saved.begin (); it != saved.end (); ++it) { const std::string locname= it->first; const std::string & globname= globalized [locname]; asmin.mapvar [globname]= asmin.mapvar [locname]; asmin.mapvar [locname]= it->second; } } bool LocalLevel::is_auto () const { return false; } void LocalLevel::add (const std::string & var) { // Ignore redeclarations as LOCAL // of the same identifier. if (saved.find (var) != saved.end () ) return; saved [var]= asmin.mapvar [var]; const std::string globname= asmin.genlocalname (); globalized [var]= globname; if (asmin.currentpass () == 1) { asmin.mapvar [var]= VarData (true); } else { asmin.mapvar [var]= asmin.mapvar [globname]; } } AutoLevel::AutoLevel (Asm::In & asmin_n) : LocalLevel (asmin_n) { } bool AutoLevel::is_auto () const { return true; } ProcLevel::ProcLevel (Asm::In & asmin_n, size_t line) : LocalLevel (asmin_n), line (line) { } size_t ProcLevel::getline () const { return line; } MacroLevel::MacroLevel (Asm::In & asmin_n) : LocalLevel (asmin_n) { } LocalStack::~LocalStack () { while (! st.empty () ) pop (); } bool LocalStack::empty () const { return st.empty (); } void LocalStack::push (LocalLevel * level) { st.push (level); } LocalLevel * LocalStack::top () { if (st.empty () ) throw LocalNotExist; return st.top (); } void LocalStack::pop () { if (st.empty () ) throw LocalNotExist; delete st.top (); st.pop (); } } // namespace pasmo_impl //********************************************************* // class Asm::In definitions //********************************************************* Asm::In::In () : AsmFile (), nocase (false), autolocalmode (false), bracketonlymode (false), warn8080mode (false), genmode (gen80), mode86 (false), debugtype (NoDebug), base (0), current (0), currentinstruction (0), minused (65535), maxused (0), hasentrypoint (false), pass (0), pout (& cout), perr (& cerr), pverb (& nullout), pwarn (& cerr), localcount (0), pcurrentmframe (0) { } Asm::In::In (const Asm::In & in) : AsmFile (in), headername (in.headername), nocase (in.nocase), autolocalmode (in.autolocalmode), bracketonlymode (in.bracketonlymode), warn8080mode (in.warn8080mode), genmode (in.genmode), mode86 (in.mode86), debugtype (in.debugtype), base (0), current (0), currentinstruction (0), minused (65535), maxused (0), hasentrypoint (false), pout (& cout), perr (in.perr), pverb (in.pverb), pwarn (in.pwarn), localcount (0), pcurrentmframe (0) { } Asm::In::~In () { } void Asm::In::setheadername (const std::string & headername_n) { headername= headername_n; } void Asm::In::verbose () { pverb= & cerr; } void Asm::In::setdebugtype (DebugType type) { debugtype= type; } void Asm::In::errtostdout () { perr= & cout; } void Asm::In::setbase (unsigned int addr) { if (addr > 65535) throw InvalidBaseValue; base= static_cast
(addr); current= base; currentinstruction= base; } void Asm::In::caseinsensitive () { nocase= true; } void Asm::In::autolocal () { autolocalmode= true; } void Asm::In::bracketonly () { bracketonlymode= true; } void Asm::In::warn8080 () { warn8080mode= true; } void Asm::In::set86 () { genmode= gen86; mode86= true; } void Asm::In::addpredef (const std::string & predef) { // Default value. address value= 0xFFFF; // Prepare the parsing of the argument. Tokenizer trdef (predef, nocase); // Get symbol name. Token tr (trdef.gettoken () ); if (tr.type () != TypeIdentifier) throw InvalidPredefine; std::string varname= tr.str (); // Get the value, if any. tr= trdef.gettoken (); switch (tr.type () ) { case TypeEqOp: tr= trdef.gettoken (); if (tr.type () != TypeNumber) throw InvalidPredefineValue; value= tr.num (); tr= trdef.gettoken (); if (tr.type () != TypeEndLine) throw InvalidPredefineValue; break; case TypeEndLine: break; default: throw InvalidPredefineSyntax; } * pverb << "Predefining: " << varname << "= " << value << endl; setequorlabel (varname, value); } void Asm::In::setentrypoint (address addr) { if (pass < 2) return; if (hasentrypoint) { //* pwarn << "WARNING: Entry point redefined" << endl; emitwarning ("Entry point redefined"); } hasentrypoint= true; entrypoint= addr; } void Asm::In::checkendline (Tokenizer & tz) { Token tok= tz.gettoken (); if (tok.type () != TypeEndLine) throw EndLineExpected (tok); } void Asm::In::gendata (byte data) { if (current < minused) minused= current; if (current > maxused) maxused= current; mem [current]= data; ++current; } void Asm::In::gendataword (address dataword) { gendata (lobyte (dataword) ); gendata (hibyte (dataword) ); } void Asm::In::showcode (const std::string & instruction) { const address bytesperline= 4; address pos= currentinstruction; const address posend= current; bool instshowed= false; for (address i= 0; pos != posend; ++i, ++pos) { if ( (i % bytesperline) == 0) { if (i != 0) { if (! instshowed) { * pout << '\t' << instruction; instshowed= true; } * pout << '\n'; } * pout << hex4 (pos) << ':'; } * pout << hex2 (mem [pos] ); } if (! instshowed) { if (posend == currentinstruction + 1) * pout << '\t'; * pout << '\t' << instruction; } * pout << endl; // Check that the 64KB limit has not been exceeded in the // middle of an instruction. if (posend != 0 && posend < currentinstruction) { //* pwarn << "WARNING: 64KB limit passed inside instruction" << // endl; emitwarning ("64KB limit passed inside instruction"); } } void Asm::In::gencode (byte code) { gendata (code); } void Asm::In::gencode (byte code1, byte code2) { gencode (code1); gencode (code2); } void Asm::In::gencode (byte code1, byte code2, byte code3) { gencode (code1); gencode (code2); gencode (code3); } void Asm::In::gencode (byte code1, byte code2, byte code3, byte code4) { gencode (code1); gencode (code2); gencode (code3); gencode (code4); } void Asm::In::gencodeED (byte code) { gencode (0xED); gencode (code); } void Asm::In::gencodeword (address value) { gencode (lobyte (value) ); gencode (hibyte (value) ); } bool Asm::In::setvar (const std::string & varname, address value, Defined defined) { checkautolocal (varname); mapvar_t::iterator it= mapvar.find (varname); if (it != mapvar.end () ) { it->second.set (value, defined); return it->second.islocal (); } else { mapvar.insert (make_pair (varname, VarData (value, defined) ) ); return false; } } address Asm::In::getvalue (const std::string & var, bool required, bool ignored) { checkautolocal (var); VarData & vd= mapvar [var]; if (vd.def () == NoDefined) { if ( (pass > 1 || required) && ! ignored) throw UndefinedVar (var); else return 0; } else return vd.getvalue (); } bool Asm::In::isdefined (const std::string & varname) { bool result; checkautolocal (varname); Defined def= mapvar [varname].def (); if (def == NoDefined || (pass > 1 && def == DefinedPass1) ) result= false; else result= true; return result; } void Asm::In::parsevalue (Tokenizer & tz, address & result, bool required, bool ignored) { Token tok= tz.gettoken (); switch (tok.type () ) { case TypeNumber: result= tok.num (); break; case TypeIdentifier: result= getvalue (tok.str (), required, ignored); break; case TypeDollar: result= currentinstruction; break; case TypeLiteral: if (tok.str ().size () != 1) throw Lenght1Required; result= tok.str () [0]; break; case TypeNUL: tok= tz.gettoken (); if (tok.type () == TypeEndLine) result= addrTRUE; else { // Absorv the rest of the line. result= addrFALSE; do { tok= tz.gettoken (); } while (tok.type () != TypeEndLine); } break; case TypeDEFINED: tok= tz.gettoken (); if (tok.type () != TypeIdentifier) throw IdentifierExpected (tok); result= isdefined (tok.str () ) ? addrTRUE : addrFALSE; break; default: throw ValueExpected (tok); } } void Asm::In::expectclose (Tokenizer & tz) { Token tok= tz.gettoken (); checktoken (TypeClose, tok); } void Asm::In::parseopen (Tokenizer & tz, address & result, bool required, bool ignored) { Token tok= tz.gettoken (); if (tok.type () == TypeOpen) { parsebase (tz, result, required, ignored); expectclose (tz); } else { tz.ungettoken (); parsevalue (tz, result, required, ignored); } } void Asm::In::parsemuldiv (Tokenizer & tz, address & result, bool required, bool ignored) { parseopen (tz, result, required, ignored); Token tok= tz.gettoken (); TypeToken tt= tok.type (); while ( tt == TypeMult || tt == TypeDiv || tt == TypeMOD || tt == TypeMod || tt == TypeSHL || tt == TypeShlOp || tt == TypeSHR || tt == TypeShrOp ) { address guard; parseopen (tz, guard, required, ignored); switch (tt) { case TypeMult: result*= guard; break; case TypeDiv: if (guard == 0) { if ( (required || pass >= 2) && ! ignored) throw DivisionByZero; else result= 0; } else result/= guard; break; case TypeMOD: case TypeMod: if (guard == 0) { if ( (required || pass >= 2) && ! ignored) throw DivisionByZero; else result= 0; } else result%= guard; break; case TypeSHL: case TypeShlOp: result<<= guard; break; case TypeSHR: case TypeShrOp: result>>= guard; break; default: ASSERT (false); throw UnexpectedError; } tok= tz.gettoken (); tt= tok.type (); } tz.ungettoken (); } void Asm::In::parseplusmin (Tokenizer & tz, address & result, bool required, bool ignored) { parsemuldiv (tz, result, required, ignored); Token tok= tz.gettoken (); TypeToken tt= tok.type (); while (tt == TypePlus || tt == TypeMinus) { address guard; parsemuldiv (tz, guard, required, ignored); switch (tt) { case TypePlus: result+= guard; break; case TypeMinus: result-= guard; break; default: ASSERT (false); throw UnexpectedError; } tok= tz.gettoken (); tt= tok.type (); } tz.ungettoken (); } void Asm::In::parserelops (Tokenizer & tz, address & result, bool required, bool ignored) { parseplusmin (tz, result, required, ignored); Token tok= tz.gettoken (); TypeToken tt= tok.type (); while ( tt == TypeEQ || tt == TypeEqOp || tt == TypeLT || tt == TypeLtOp || tt == TypeLE || tt == TypeLeOp || tt == TypeGT || tt == TypeGtOp || tt == TypeGE || tt == TypeGeOp || tt == TypeNE || tt == TypeNeOp ) { address guard; parseplusmin (tz, guard, required, ignored); switch (tt) { case TypeEQ: case TypeEqOp: result= (result == guard) ? addrTRUE : addrFALSE; break; case TypeLT: case TypeLtOp: result= (result < guard) ? addrTRUE : addrFALSE; break; case TypeLE: case TypeLeOp: result= (result <= guard) ? addrTRUE : addrFALSE; break; case TypeGT: case TypeGtOp: result= (result > guard) ? addrTRUE : addrFALSE; break; case TypeGE: case TypeGeOp: result= (result >= guard) ? addrTRUE : addrFALSE; break; case TypeNE: case TypeNeOp: result= (result != guard) ? addrTRUE : addrFALSE; break; default: ASSERT (false); throw UnexpectedError; } tok= tz.gettoken (); tt= tok.type (); } tz.ungettoken (); } void Asm::In::parsenot (Tokenizer & tz, address & result, bool required, bool ignored) { Token tok= tz.gettoken (); TypeToken tt= tok.type (); // NOT and unary + and -. if ( tt == TypeNOT || tt == TypeBitNotOp || tt == TypeBoolNotOp || tt == TypePlus || tt == TypeMinus ) { parsenot (tz, result, required, ignored); switch (tt) { case TypeNOT: case TypeBitNotOp: result= ~ result; break; case TypeBoolNotOp: result= (result == 0) ? addrTRUE : addrFALSE; break; case TypePlus: break; case TypeMinus: result= - result; break; default: ASSERT (false); throw UnexpectedError; } } else { tz.ungettoken (); parserelops (tz, result, required, ignored); } } void Asm::In::parseand (Tokenizer & tz, address & result, bool required, bool ignored) { parsenot (tz, result, required, ignored); Token tok= tz.gettoken (); TypeToken tt= tok.type (); while (tt == TypeAND || tt == TypeBitAnd) { address guard; parsenot (tz, guard, required, ignored); result&= guard; tok= tz.gettoken (); tt= tok.type (); } tz.ungettoken (); } void Asm::In::parseorxor (Tokenizer & tz, address & result, bool required, bool ignored) { parseand (tz, result, required, ignored); Token tok= tz.gettoken (); TypeToken tt= tok.type (); while (tt == TypeOR || tt == TypeBitOr || tt == TypeXOR) { address guard; parseand (tz, guard, required, ignored); switch (tt) { case TypeOR: case TypeBitOr: result|= guard; break; case TypeXOR: result^= guard; break; default: ASSERT (false); throw UnexpectedError; } tok= tz.gettoken (); tt= tok.type (); } tz.ungettoken (); } void Asm::In::parsebooland (Tokenizer & tz, address & result, bool required, bool ignored) { // Short-circuit evaluated boolean and operator. parseorxor (tz, result, required, ignored); Token tok= tz.gettoken (); if (tok.type () == TypeBoolAnd) { bool boolresult= result != 0; do { address guard; parseorxor (tz, guard, required, ignored || ! boolresult); boolresult&= guard != 0; tok= tz.gettoken (); } while (tok.type () == TypeBoolAnd); result= boolresult ? addrTRUE : addrFALSE; } tz.ungettoken (); } void Asm::In::parseboolor (Tokenizer & tz, address & result, bool required, bool ignored) { // Short-circuit evaluated boolean or operator. parsebooland (tz, result, required, ignored); Token tok= tz.gettoken (); if (tok.type () == TypeBoolOr) { bool boolresult= result != 0; do { address guard; parsebooland (tz, guard, required, ignored || boolresult); boolresult|= guard != 0; tok= tz.gettoken (); } while (tok.type () == TypeBoolOr); result= boolresult ? addrTRUE : addrFALSE; } tz.ungettoken (); } void Asm::In::parsehighlow (Tokenizer & tz, address & result, bool required, bool ignored) { Token tok= tz.gettoken (); switch (tok.type () ) { case TypeHIGH: parsehighlow (tz, result, required, ignored); result= hibyte (result); break; case TypeLOW: parsehighlow (tz, result, required, ignored); result= lobyte (result); break; default: tz.ungettoken (); parseboolor (tz, result, required, ignored); } } void Asm::In::parsecond (Tokenizer & tz, address & result, bool required, bool ignored) { parsehighlow (tz, result, required, ignored); Token tok= tz.gettoken (); if (tok.type () != TypeQuestion) tz.ungettoken (); else { bool usefirst= (result != 0); parsebase (tz, result, required, ignored || ! usefirst); tok= tz.gettoken (); checktoken (TypeColon, tok); address second; parsebase (tz, second, required, ignored || usefirst); if (! usefirst) result= second; } } void Asm::In::parsebase (Tokenizer & tz, address & result, bool required, bool ignored) { // This funtions is just an auxiliar to minimize changes // when adding or modifying operators. parsecond (tz, result, required, ignored); } address Asm::In::parseexpr (bool required, const Token & /* tok */, Tokenizer & tz) { tz.ungettoken (); address result; parsebase (tz, result, required, false); return result; } void Asm::In::expectcomma (Tokenizer & tz) { Token tok= tz.gettoken (); checktoken (TypeComma, tok); } void Asm::In::expectcloseindir (Tokenizer & tz, bool bracket) { Token tok= tz.gettoken (); if (bracket) checktoken (TypeCloseBracket, tok); else checktoken (TypeClose, tok); } bool Asm::In::parseopenindir (Tokenizer & tz) { Token tok= tz.gettoken (); bool isbracket; if (bracketonlymode) { checktoken (TypeOpenBracket, tok); isbracket= true; } else { switch (tok.type () ) { case TypeOpen: isbracket= false; break; case TypeOpenBracket: isbracket= true; break; default: throw SomeOpenExpected (tok); } } return isbracket; } void Asm::In::expectA (Tokenizer & tz) { Token tok= tz.gettoken (); checktoken (TypeA, tok); } void Asm::In::expectC (Tokenizer & tz) { Token tok= tz.gettoken (); checktoken (TypeC, tok); } void Asm::In::parseIF (Tokenizer & tz) { address v; Token tok= tz.gettoken (); v= parseexpr (true, tok, tz); checkendline (tz); if (v != 0) { ++iflevel; * pout << "\t\tIF (true)" << endl; } else { * pout << "\t\tIF (false)" << endl; size_t ifline= getline (); int level= 1; while (nextline () ) { Tokenizer & tz (getcurrentline () ); tok= tz.gettoken (); TypeToken tt= tok.type (); if (tt == TypeIdentifier) { tok= tz.gettoken (); tt= tok.type (); } switch (tt) { case TypeIF: ++level; break; case TypeELSE: if (level == 1) { ++iflevel; --level; * pout << "\t\tELSE (true)" << endl; } break; case TypeENDIF: --level; if (level == 0) * pout << "\t\tENDIF" << endl; break; case TypeENDM: // Let the current line be reexamined // for ending expandMACRO or emit an // error. prevline (); level= 0; break; case TypeMACRO: case TypeREPT: case TypeIRP: nextline (); gotoENDM (); break; default: * pout << "- " << getcurrenttext () << endl; break; } if (level == 0) break; } if (passeof () ) { setline (ifline); throw IFwithoutENDIF; } } } void Asm::In::parseELSE (Tokenizer & tz) { checkendline (tz); if (iflevel == 0) throw ELSEwithoutIF; * pout << "\t\tELSE (false)" << endl; size_t elseline= getline (); int level= 1; while (nextline () ) { Tokenizer & tz (getcurrentline () ); Token tok= tz.gettoken (); TypeToken tt= tok.type (); if (tt == TypeIdentifier) { tok= tz.gettoken (); tt= tok.type (); } switch (tt) { case TypeIF: ++level; break; case TypeENDIF: --level; if (level == 0) * pout << "\t\tENDIF" << endl; break; case TypeENDM: // Let the current line be reexamined // for ending expandMACRO or emit an // error. prevline (); level= 0; break; case TypeMACRO: case TypeREPT: case TypeIRP: nextline (); gotoENDM (); break; default: * pout << "- " << getcurrenttext () << endl; break; } if (level == 0) break; } if (passeof () ) { setline (elseline); throw ELSEwithoutENDIF; } --iflevel; } void Asm::In::parseENDIF (Tokenizer & tz) { checkendline (tz); if (iflevel == 0) throw ENDIFwithoutIF; --iflevel; * pout << "\t\tENDIF" << endl; } void Asm::In::parseline (Tokenizer & tz) { Token tok= tz.gettoken (); currentinstruction= current; switch (tok.type () ) { case TypeINCLUDE: parseINCLUDE (tz); break; case TypeEndOfInclude: parseEndOfInclude (tz); break; case TypeORG: parseORG (tz); break; case TypeEQU: throw EQUwithoutlabel; case TypeDEFL: throw DEFLwithoutlabel; case TypeIdentifier: parselabel (tz, tok.str () ); break; case TypeIF: parseIF (tz); break; case TypeELSE: parseELSE (tz); break; case TypeENDIF: parseENDIF (tz); break; case TypePUBLIC: parsePUBLIC (tz); break; case TypeMACRO: // Style: MACRO identifier, params tok= tz.gettoken (); if (tok.type () != TypeIdentifier) throw IdentifierExpected (tok); { const std::string & name= tok.str (); parseMACRO (tz, name, true); } break; default: parsegeneric (tz, tok); } } void Asm::In::initlocal () { localcount= 0; } std::string Asm::In::genlocalname () { return hex8str (localcount++); } bool Asm::In::isautolocalname (const std::string & name) { static const char AutoLocalPrefix= '_'; ASSERT (! name.empty () ); if (! autolocalmode) return false; return name [0] == AutoLocalPrefix; } AutoLevel * Asm::In::enterautolocal () { AutoLevel * pav; if (localstack.empty () || ! localstack.top ()->is_auto () ) { * pout << "Enter autolocal level" << endl; pav= new AutoLevel (* this); localstack.push (pav); } else { pav= dynamic_cast (localstack.top () ); ASSERT (pav); } return pav; } void Asm::In::finishautolocal () { if (! localstack.empty () ) { LocalLevel * plevel= localstack.top (); if (plevel->is_auto () ) { if (autolocalmode) { * pout << "Exit autolocal level" << endl; localstack.pop (); } else throw AutoLocalNotExpected; } } } void Asm::In::checkautolocal (const std::string & varname) { if (isautolocalname (varname) ) { AutoLevel *pav= enterautolocal (); pav->add (varname); } } namespace pasmo_impl { class ClearDefl { public: void operator () (mapvar_t::value_type & vardef) { VarData & vd= vardef.second; if (vd.def () == DefinedDEFL) vd.clear (); } }; } // namespace pasmo_impl void Asm::In::dopass () { * pverb << "Entering pass " << pass << endl; // Pass initializition. initlocal (); mapmacro.clear (); // Clear DEFL. std::for_each (mapvar.begin (), mapvar.end (), pasmo_impl::ClearDefl () ); current= base; iflevel= 0; // Main loop. for (beginline (); nextline (); ) { Tokenizer & tz (getcurrentline () ); parseline (tz); } // Pass finalization. if (iflevel > 0) throw IFwithoutENDIF; finishautolocal (); if (! localstack.empty () ) { ProcLevel * proc= dynamic_cast (localstack.top () ); if (proc == NULL) throw LocalNotExpected; setline (proc->getline () ); throw UnbalancedPROC; } * pverb << "Pass " << pass << " finished" << endl; } void Asm::In::loadfile (const std::string & filename) { AsmFile::loadfile (filename, nocase, * pverb, * perr); } void Asm::In::processfile () { try { pass= 1; if (debugtype == DebugAll) pout= & cout; else pout= & nullout; dopass (); pass= 2; if (debugtype != NoDebug) pout= & cout; else pout= & nullout; dopass (); // Keep pout pointing to something valid. pout= & cout; } catch (...) { * perr << "ERROR"; showcurrentlineinfo (* perr); * perr << endl; throw; } } int Asm::In::currentpass () const { return pass; } bool Asm::In::parsesimple (Tokenizer & tz, Token tok) { simpleinst_t::iterator it= simpleinst.find (tok.type () ); if (it == simpleinst.end () ) return false; checkendline (tz); const SimpleInst & si= it->second; if (mode86) { address code86= si.code86; if (code86 == 0) no86 (); byte code1= hibyte (code86); if (code1 != 0) gencode (code1); byte code2= lobyte (code86); gencode (code2); } else { if (si.edprefix) gencodeED (si.code); else gencode (si.code); } showcode (tok.str () ); if (! si.valid8080) no8080 (); return true; } void Asm::In::parsegeneric (Tokenizer & tz, Token tok) { firstcode= true; if (parsesimple (tz, tok) ) return; TypeToken tt= tok.type (); switch (tt) { case TypeEndLine: // Do nothing. break; case TypeIdentifier: // Only come here legally when a line invoking // a macro contains a label. { std::string macroname= tok.str (); Macro * pmacro= getmacro (macroname); if (pmacro != NULL) expandMACRO (macroname, * pmacro, tz); else throw MacroExpected (macroname); } break; case TypeORG: ASSERT (false); throw UnexpectedORG; case TypeDEFB: case TypeDB: case TypeDEFM: parseDEFB (tz); break; case TypeDEFW: case TypeDW: parseDEFW (tz); break; case TypeDEFS: case TypeDS: parseDEFS (tz); break; case TypeINCBIN: parseINCBIN (tz); break; case TypeEND: parseEND (tz); break; case TypeLOCAL: parseLOCAL (tz); break; case TypePROC: parsePROC (tz); break; case TypeENDP: parseENDP (tz); break; case Type_ERROR: parse_ERROR (tz); break; case Type_WARNING: parse_WARNING (tz); break; case TypeMACRO: // Is processed previously. ASSERT (false); throw UnexpectedMACRO; case TypeREPT: parseREPT (tz); break; case TypeIRP: parseIRP (tz); break; case TypeENDM: throw ENDMOutOfMacro; case TypeIM: parseIM (tz); break; case TypeRST: parseRST (tz); break; case TypeLD: parseLD (tz); break; case TypeCP: parseCP (tz); break; case TypeAND: parseAND (tz); break; case TypeOR: parseOR (tz); break; case TypeXOR: parseXOR (tz); break; case TypeRL: parseRL (tz); break; case TypeRLC: parseRLC (tz); break; case TypeRR: parseRR (tz); break; case TypeRRC: parseRRC (tz); break; case TypeSLA: parseSLA (tz); break; case TypeSRA: parseSRA (tz); break; case TypeSRL: parseSRL (tz); break; case TypeSLL: parseSLL (tz); break; case TypeSUB: parseSUB (tz); break; case TypeADD: parseADD (tz); break; case TypeADC: parseADC (tz); break; case TypeSBC: parseSBC (tz); break; case TypePUSH: parsePUSH (tz); break; case TypePOP: parsePOP (tz); break; case TypeCALL: parseCALL (tz); break; case TypeRET: parseRET (tz); break; case TypeJP: parseJP (tz); break; case TypeJR: parseJR (tz); break; case TypeDJNZ: parseDJNZ (tz); break; case TypeDEC: parseDEC (tz); break; case TypeINC: parseINC (tz); break; case TypeEX: parseEX (tz); break; case TypeIN: parseIN (tz); break; case TypeOUT: parseOUT (tz); break; case TypeBIT: parseBIT (tz); break; case TypeRES: parseRES (tz); break; case TypeSET: parseSET (tz); break; case TypeEQU: throw EQUwithoutlabel; case TypeDEFL: throw DEFLwithoutlabel; case Type_SHIFT: throw ShiftOutsideMacro; default: throw NoInstruction (tok); } } void Asm::In::parseINCLUDE (Tokenizer & tz) { std::string filename= tz.gettoken ().str (); * pout << "\t\tINCLUDE " << filename << endl; } void Asm::In::parseEndOfInclude (Tokenizer & /*tz*/) { * pout << "\t\tEnd of INCLUDE" << endl; } void Asm::In::parseORG (Tokenizer & tz, const std::string & label) { Token tok= tz.gettoken (); address org= parseexpr (true, tok, tz); current= org; * pout << "\t\tORG " << hex4 (org) << endl; if (! label.empty () ) setlabel (label); } void Asm::In::parseEQU (Tokenizer & tz, const std::string & label) { Token tok= tz.gettoken (); address value= parseexpr (false, tok, tz); checkendline (tz); bool islocal= setequorlabel (label, value); * pout << tablabel (label) << "EQU "; if (islocal) * pout << "local "; * pout << hex4 (value) << endl; } void Asm::In::parseDEFL (Tokenizer & tz, const std::string & label) { Token tok= tz.gettoken (); address value= parseexpr (false, tok, tz); checkendline (tz); bool islocal= setdefl (label, value); * pout << label << "\t\tDEFL "; if (islocal) * pout << "local "; * pout << hex4 (value) << endl; } void Asm::In::parsePUBLIC (Tokenizer & tz) { std::vector varname; for (;;) { Token tok= tz.gettoken (); checktoken (TypeIdentifier, tok); std::string name= tok.str (); if (isautolocalname (name) ) throw InvalidInAutolocal; setpublic.insert (name); varname.push_back (name); tok= tz.gettoken (); if (tok.type () == TypeEndLine) break; checktoken (TypeComma, tok); } * pout << "\t\tPUBLIC "; for (size_t i= 0, l= varname.size (); i < l; ++i) { * pout << varname [i]; if (i < l - 1) * pout << ", "; } * pout << endl; } void Asm::In::parseEND (Tokenizer & tz) { Token tok= tz.gettoken (); if (tok.type () == TypeEndLine) * pout << hex4 (current) << ":\t\tEND" << endl; else { address end= parseexpr (false, tok, tz); checkendline (tz); * pout << hex4 (current) << ":\t\tEND " << hex4 (end) << endl; setentrypoint (end); } setendline (); } void Asm::In::parseLOCAL (Tokenizer & tz) { if (autolocalmode) finishautolocal (); LocalLevel * plocal= localstack.top (); std::vector varname; for (;;) { Token tok= tz.gettoken (); checktoken (TypeIdentifier, tok); std::string name= tok.str (); if (isautolocalname (name) ) throw InvalidInAutolocal; plocal->add (name); varname.push_back (name); tok= tz.gettoken (); TypeToken tt= tok.type (); if (tt == TypeEndLine) break; checktoken (TypeComma, tok); } * pout << "\t\tLOCAL "; for (size_t i= 0, l= varname.size (); i < l; ++i) { * pout << varname [i]; if (i < l - 1) * pout << ", "; } * pout << endl; } void Asm::In::parsePROC (Tokenizer & tz) { if (autolocalmode) finishautolocal (); checkendline (tz); ProcLevel * pproc= new ProcLevel (* this, getline () ); localstack.push (pproc); * pout << "\t\tPROC" << endl; } void Asm::In::parseENDP (Tokenizer & tz) { checkendline (tz); if (autolocalmode) finishautolocal (); if (localstack.empty () || dynamic_cast (localstack.top () ) == NULL) { throw UnbalancedENDP; } localstack.pop (); * pout << "\t\tENDP" << endl; } void Asm::In::parse_ERROR (Tokenizer & tz) { Token tok= tz.gettoken (); ASSERT (tok.type () == TypeLiteral); throw ErrorDirective (tok); } void Asm::In::parse_WARNING (Tokenizer & tz) { Token tok= tz.gettoken (); ASSERT (tok.type () == TypeLiteral); //* pwarn << "WARNING: " << tok.str () << endl; emitwarning (tok.str () ); } bool Asm::In::setequorlabel (const std::string & name, address value) { if (autolocalmode) { if (isautolocalname (name) ) { AutoLevel *pav= enterautolocal (); ASSERT (pav); pav->add (name); } else finishautolocal (); } switch (mapvar [name].def () ) { case NoDefined: if (pass > 1) throw UndefinedInPass1 (name); // Else nothing to do. break; case DefinedDEFL: throw RedefinedDEFL; case PreDefined: throw IsPredefined; case DefinedPass1: if (pass == 1) throw RedefinedEQU; // Else nothing to do (this may chnage). break; case DefinedPass2: ASSERT (pass > 1); throw RedefinedEQU; } Defined def; switch (pass) { case 0: def= PreDefined; break; case 1: def= DefinedPass1; break; case 2: def= DefinedPass2; break; default: throw InvalidPassValue; } return setvar (name, value, def); } bool Asm::In::setdefl (const std::string & name, address value) { if (autolocalmode) { if (isautolocalname (name) ) { AutoLevel *pav= enterautolocal (); ASSERT (pav); pav->add (name); } else finishautolocal (); } switch (mapvar [name].def () ) { case NoDefined: // Fine in this case. break; case DefinedDEFL: // Fine also. break; case PreDefined: case DefinedPass1: case DefinedPass2: throw RedefinedEQU; } return setvar (name, value, DefinedDEFL); } void Asm::In::setlabel (const std::string & name) { bool islocal= setequorlabel (name, current); * pout << hex4 (current) << ":\t\t"; if (islocal) * pout << "local "; * pout << "label " << name << endl; } void Asm::In::parselabel (Tokenizer & tz, const std::string & name) { Token tok= tz.gettoken (); TypeToken tt= tok.type (); bool colon= tt == TypeColon; if (colon) { tok= tz.gettoken (); tt= tok.type (); } // Check required here to allow redefinition of macro. if (tt == TypeMACRO) { // Style: identifier MACRO params parseMACRO (tz, name, false); return; } if (! colon) { Macro * pmacro= getmacro (name); if (pmacro != NULL) { tz.ungettoken (); expandMACRO (name, * pmacro, tz); return; } } switch (tt) { case TypeORG: parseORG (tz, name); break; case TypeEQU: parseEQU (tz, name); break; case TypeDEFL: parseDEFL (tz, name); break; case TypeMACRO: // Style identifier MACRO params //parseMACRO (tz, name); // Now can't come here. ASSERT (false); break; default: // In any other case, generic label. Assign the // current position to it and parse the rest // of the line. setlabel (name); parsegeneric (tz, tok); } } void Asm::In::parseMACRO (Tokenizer & tz, const std::string & name, bool needcomma) { * pout << "Defining MACRO " << name << endl; ASSERT (! name.empty () ); if (autolocalmode) { finishautolocal (); if (isautolocalname (name) ) throw InvalidInAutolocal; } // Get parameter list. std::vector param; Token tok= tz.gettoken (); TypeToken tt= tok.type (); if (tt != TypeEndLine) { if (needcomma) { checktoken (TypeComma, tok); tok= tz.gettoken (); tt= tok.type (); } for (;;) { checktoken (TypeIdentifier, tok); if (param.empty () ) * pout << "Params: "; else * pout << ", "; * pout << tok.str (); param.push_back (tok.str () ); tok= tz.gettoken (); tt= tok.type (); if (tt == TypeEndLine) break; tok= tz.gettoken (); tt= tok.type (); } * pout << endl; } else * pout << "No params." << endl; // Clear previous definition if exists. mapmacro_t::iterator it= mapmacro.find (name); if (it != mapmacro.end () ) mapmacro.erase (it); // Skip macro body. size_t level= 1; size_t macroline= getline (); while (nextline () ) { Tokenizer & tz (getcurrentline () ); Token tok= tz.gettoken (); TypeToken tt= tok.type (); if (tt == TypeENDM) { if (--level == 0) break; } if (tt == TypeIdentifier) { tok= tz.gettoken (); tt= tok.type (); } if (tt == TypeMACRO || tt == TypeREPT || tt == TypeIRP) ++level; } if (passeof () ) { setline (macroline); throw MACROwithoutENDM; } // Store the macro definition. mapmacro.insert (make_pair (name, Macro (param, macroline, getline () ) ) ); } byte Asm::In::parsedesp (Tokenizer & tz, bool bracket) { byte desp= 0; Token tok= tz.gettoken (); switch (tok.type () ) { case TypeClose: if (bracket) throw ParenInsteadOfBracket; break; case TypeCloseBracket: if (! bracket) throw BracketInsteadOfParen; break; case TypePlus: tok= tz.gettoken (); { address addr= parseexpr (false, tok, tz); // We allow positive greater than 127 just in // case someone uses hexadecimals such as 0FFh // as offsets. if (addr > 255) throw OffsetOutOfRange; desp= static_cast (addr); expectcloseindir (tz, bracket); } break; case TypeMinus: tok= tz.gettoken (); { address addr= parseexpr (false, tok, tz); if (addr > 128) throw OffsetOutOfRange; desp= static_cast (256 - addr); expectcloseindir (tz, bracket); } break; default: throw OffsetExpected (tok); } return desp; } void Asm::In::emitwarning (const std::string & text) { * pwarn << "WARNING: " << text; showcurrentlineinfo (* pwarn); * pwarn << endl; } void Asm::In::no8080 () { if (warn8080mode) { //* pwarn << "WARNING: not a 8080 instruction"; //showcurrentlineinfo (* pwarn); //* pwarn << endl; emitwarning ("not a 8080 instruction"); } } void Asm::In::no86 () { if (mode86) throw NotValid86; } bool Asm::In::parsebyteparam (Tokenizer & tz, TypeToken tt, regbCode & regcode, byte & prefix, bool & hasdesp, byte & desp, byte prevprefix) { // Used by dobyteparam, dobyteparamCB, parseLDsimple and // parseLD_IrPlus. ASSERT (prevprefix == NoPrefix || prevprefix == prefixIX || prevprefix == prefixIY); prefix= NoPrefix; hasdesp= false; desp= 0; Token tok; switch (tt) { case TypeA: regcode= regA; break; case TypeB: regcode= regB; break; case TypeC: regcode= regC; break; case TypeD: regcode= regD; break; case TypeE: regcode= regE; break; case TypeH: regcode= regH; break; case TypeL: regcode= regL; break; case TypeIXH: if (prevprefix == prefixIY) throw InvalidInstruction; if (prevprefix == NoPrefix) prefix= prefixIX; regcode= regH; break; case TypeIYH: if (prevprefix == prefixIX) throw InvalidInstruction; if (prevprefix == NoPrefix) prefix= prefixIY; regcode= regH; break; case TypeIXL: if (prevprefix == prefixIY) throw InvalidInstruction; if (prevprefix == NoPrefix) prefix= prefixIX; regcode= regL; break; case TypeIYL: if (prevprefix == prefixIX) throw InvalidInstruction; if (prevprefix == NoPrefix) prefix= prefixIY; regcode= regL; break; case TypeOpen: if (bracketonlymode) return false; case TypeOpenBracket: { bool bracket= tt == TypeOpenBracket; tok= tz.gettoken (); switch (tok.type () ) { case TypeHL: regcode= reg_HL_; expectcloseindir (tz, bracket); break; case TypeIX: regcode= reg_HL_; prefix= prefixIX; hasdesp= true; desp= parsedesp (tz, bracket); break; case TypeIY: regcode= reg_HL_; prefix= prefixIY; hasdesp= true; desp= parsedesp (tz, bracket); break; default: if (! bracket) { // Backtrack the parsing to the // beginning of the expression. tz.ungettoken (); return false; } else throw TokenExpected (TypeCloseBracket, tok); } } if (prevprefix != NoPrefix) throw InvalidInstruction; break; default: return false; } return true; } void Asm::In::dobyteinmediate (Tokenizer & tz, byte code, const std::string & instrname, byte prefix) { // Used by dobyteparam and parseLDsimple. tz.ungettoken (); Token tok= tz.gettoken (); // Check for attempts to use inexistent instructions. // Thanks to Horace for the suggestion. bool check= (! bracketonlymode) && pass >= 2 && tok.type () == TypeOpen; address value= parseexpr (false, tok, tz); checkendline (tz); if (check && tz.endswithparen () ) { //* pwarn << "WARNING: looks like a non existent instruction"; //showcurrentlineinfo (* pwarn); //* pwarn << endl; emitwarning ("looks like a non existent instruction"); } if (prefix != NoPrefix) { if (prefix == prefixIX || prefix == prefixIY) no86 (); gencode (prefix); } byte bvalue= lobyte (value); gencode (code, bvalue); showcode (instrname + ' ' + hex2str (bvalue) ); } void Asm::In::dobyteparam (Tokenizer & tz, TypeByteInst ti) { // Used by CP, AND, OR, XOR, SUB, ADD A, ADC A and SBC A. Token tok= tz.gettoken (); regbCode reg; byte prefix= NoPrefix; bool hasdesp; byte desp; if (parsebyteparam (tz, tok.type (), reg, prefix, hasdesp, desp) ) { checkendline (tz); if (prefix != NoPrefix) { no86 (); gencode (prefix); } if (mode86) { ASSERT (! hasdesp); byte basecode= getbaseByteInst (ti, gen86); byte code; if (reg == reg_HL_) { basecode+= 2; code= 7; } else code= 0xC0 | (getregb86 (reg) << 3); gencode (basecode, code); } else { byte code= getbaseByteInst (ti, gen80) | reg; gencode (code); } if (hasdesp) gencode (desp); showcode (byteinstName (ti) + ' ' + getregbname (reg, prefix, hasdesp, desp) ); } else { dobyteinmediate (tz, getByteInstInmediate (ti, genmode), byteinstName (ti) ); } if (prefix != NoPrefix) no8080 (); } void Asm::In::dobyteparamCB (Tokenizer & tz, byte codereg, const std::string & instrname) { // Used by RL, RLC, RR, RRC, SLA, SRA, SRL, SLL // and bit instructions. no86 (); Token tok= tz.gettoken (); regbCode reg; byte prefix; bool hasdesp; byte desp; if (parsebyteparam (tz, tok.type (), reg, prefix, hasdesp, desp) ) { checkendline (tz); if (prefix != NoPrefix) gencode (prefix); gencode (0xCB); if (hasdesp) gencode (desp); byte code= codereg + reg; gencode (code); showcode (instrname + ' ' + getregbname (reg, prefix, hasdesp, desp) ); } else throw InvalidOperand; no8080 (); } void Asm::In::parseIM (Tokenizer & tz) { Token tok= tz.gettoken (); address v= parseexpr (true, tok, tz); byte code; switch (v) { case 0: code= 0x46; break; case 1: code= 0x56; break; case 2: code= 0x5E; break; default: throw InvalidValueIM; } checkendline (tz); no86 (); gencodeED (code); showcode (std::string ("IM ") + static_cast ('0' + v) ); no8080 (); } void Asm::In::parseRST (Tokenizer & tz) { Token tok= tz.gettoken (); address addr= parseexpr (true, tok, tz); checkendline (tz); if (addr & ~ static_cast
(0x38) ) throw InvalidValueRST; no86 (); byte baddr= lobyte (addr); byte code= codeRST00 + baddr; gencode (code); showcode ("RST " + hex2str (baddr) ); } void Asm::In::parseLDA_nn_ (Tokenizer & tz, bool bracket) { Token tok; address addr= parseexpr (false, tok, tz); expectcloseindir (tz, bracket); byte code= mode86 ? 0xA0 : 0x3A; gencode (code); gencodeword (addr); showcode ("LD A, (" + hex4str (addr) + ')'); } void Asm::In::parseLDA_IrPlus_ (Tokenizer & tz, bool bracket, byte prefix) { ASSERT (prefix == prefixIX || prefix == prefixIY); no86 (); byte desp= parsedesp (tz, bracket); gencode (prefix, 0x7E, desp); showcode ("LD A, (" + nameHLpref (prefix) + '+' + hex2str (desp) + ')'); no8080 (); } void Asm::In::parseLDA_ (Tokenizer & tz, bool bracket) { Token tok= tz.gettoken (); switch (tok.type () ) { case TypeBC: expectcloseindir (tz, bracket); if (mode86) { // MOV SI,CX ; MOV AL,[SI] gencode (0x89, 0xCE, 0x8A, 0x04); } else gencode (0x0A); showcode ("LD A, (BC)"); break; case TypeDE: expectcloseindir (tz, bracket); if (mode86) { // MOV SI,DX ; MOV AL,[SI] gencode (0x89, 0xD6, 0x8A, 0x04); } else gencode (0x1A); showcode ("LD A, (DE)"); break; case TypeHL: expectcloseindir (tz, bracket); if (mode86) gencode (0x8A, 0x07); else gencode (0x7E); showcode ("LD A, (HL)"); break; case TypeIX: parseLDA_IrPlus_ (tz, bracket, prefixIX); break; case TypeIY: parseLDA_IrPlus_ (tz, bracket, prefixIY); break; default: parseLDA_nn_ (tz, bracket); } } void Asm::In::parseLDAr (regbCode rb) { if (mode86) { byte code= 0xC0 | (getregb86 (rb) << 3); gencode (0x88, code); } else { byte code= 0x78 + rb; gencode (code); } showcode ("LD A, " + getregbname (rb) ); } void Asm::In::parseLDA (Tokenizer & tz) { expectcomma (tz); Token tok= tz.gettoken (); TypeToken tt= tok.type (); regbCode rb= getregb (tt); if (rb != regbInvalid) { checkendline (tz); parseLDAr (rb); return; } bool valid8080= true; switch (tt) { case TypeI: no86 (); gencodeED (0x57); showcode ("LD A, I"); valid8080= false; break; case TypeR: no86 (); gencodeED (0x5F); showcode ("LD A, R"); valid8080= false; break; case TypeIXH: no86 (); gencode (prefixIX, 0x7C); showcode ("LD A, IXH"); valid8080= false; break; case TypeIXL: no86 (); gencode (prefixIX, 0x7D); showcode ("LD A, IXL"); valid8080= false; break; case TypeIYH: no86 (); gencode (prefixIY, 0x7C); showcode ("LD A, IYH"); valid8080= false; break; case TypeIYL: no86 (); gencode (prefixIY, 0x7D); showcode ("LD A, IYL"); valid8080= false; break; case TypeOpen: if (bracketonlymode) { parseLDsimplen (tz, regA); break; } case TypeOpenBracket: parseLDA_ (tz, tt == TypeOpenBracket); break; default: parseLDsimplen (tz, regA); } checkendline (tz); if (! valid8080) no8080 (); } void Asm::In::parseLDsimplen (Tokenizer & tz, regbCode regcode, byte prevprefix) { if (prevprefix != NoPrefix) no86 (); byte code; if (mode86) { switch (regcode) { case reg_HL_: prevprefix= 0xC6; code= 0x07; break; default: code= 0xB0 + getregb86 (regcode); } } else code= (regcode << 3) + 0x06; std::string instrname= "LD " + getregbname (regcode, mode86 ? NoPrefix : prevprefix) + ','; dobyteinmediate (tz, code, instrname, prevprefix); } void Asm::In::parseLDsimple (Tokenizer & tz, regbCode regcode, byte prevprefix) { ASSERT (prevprefix == NoPrefix || prevprefix == prefixIX || prevprefix == prefixIY); expectcomma (tz); Token tok= tz.gettoken (); regbCode reg2; byte prefix= NoPrefix; bool hasdesp; byte desp; if (parsebyteparam (tz, tok.type (), reg2, prefix, hasdesp, desp, prevprefix) ) { // LD r, (...) and LD r, r checkendline (tz); regbCode rr1= regcode; regbCode rr2= reg2; if (regcode == reg_HL_ && reg2 == reg_HL_) throw InvalidInstruction; if (prevprefix != NoPrefix && prefix != NoPrefix) throw InvalidInstruction; if (prefix) { no86 (); gencode (prefix); } if (prevprefix) { no86 (); gencode (prevprefix); } if (mode86) { ASSERT (! hasdesp); byte precode; byte code= 0xC0; if (reg2 == reg_HL_) { precode= 0x8A; code= 0x00; reg2= regH; } else if (regcode == reg_HL_) { precode= 0x88; code= 0x00; regcode= reg2; reg2= regH; } else precode= 0x8A; code+= (getregb86 (regcode) << 3) + getregb86 (reg2); gencode (precode, code); } else { byte code= 0x40 + (regcode << 3) + reg2; gencode (code); } if (hasdesp) gencode (desp); showcode ("LD " + getregbname (rr1, prevprefix) + ", " + getregbname (rr2, prefix, hasdesp, desp) ); } else { // LD r, n parseLDsimplen (tz, regcode, prevprefix); } if (prevprefix != NoPrefix || prefix != NoPrefix) no8080 (); } void Asm::In::parseLDdouble_nn_ (Tokenizer & tz, regwCode regcode, bool bracket, byte prefix) { Token tok= tz.gettoken (); address value= parseexpr (false, tok, tz); expectcloseindir (tz, bracket); checkendline (tz); bool valid8080= false; switch (regcode) { case regBC: if (mode86) gencode (0x8B, 0x0E); else gencodeED (0x4B); gencodeword (value); break; case regDE: if (mode86) gencode (0x8B, 0x16); else gencodeED (0x5B); gencodeword (value); break; case regHL: if (prefix == NoPrefix) valid8080= true; else { no86 (); gencode (prefix); } if (mode86) gencode (0x8B, 0x1E); else gencode (0x2A); gencodeword (value); break; case regSP: if (mode86) gencode (0x8B, 0x26); else gencodeED (0x7B); gencodeword (value); break; default: ASSERT (false); throw UnexpectedRegisterCode; } showcode ("LD " + regwName (regcode, nameSP, prefix) + ", (" + hex4str (value) + ')' ); if (! valid8080) no8080 (); } void Asm::In::parseLDdoublenn (Tokenizer & tz, regwCode regcode, byte prefix) { Token tok; address value= parseexpr (false, tok, tz); checkendline (tz); if (prefix != NoPrefix) { no86 (); gencode (prefix); } byte code; if (mode86) code= regcode + 0xB9; else code= regcode * 16 + 1; gencode (code); gencodeword (value); showcode ("LD " + regwName (regcode, nameSP, prefix) + ", " + hex4str (value) ); if (prefix != NoPrefix) no8080 (); } void Asm::In::parseLDdouble (Tokenizer & tz, regwCode regcode, byte prefix) { ASSERT (regcode == regBC || regcode == regDE || regcode == regHL); ASSERT (regcode == regHL || prefix == NoPrefix); ASSERT (prefix == NoPrefix || prefix == prefixIX || prefix == prefixIY); expectcomma (tz); Token tok= tz.gettoken (); TypeToken tt= tok.type (); if (tt == TypeOpenBracket || (tt == TypeOpen && ! bracketonlymode) ) { // LD rr,(nn) parseLDdouble_nn_ (tz, regcode, tt == TypeOpenBracket, prefix); } else { // LD rr,nn parseLDdoublenn (tz, regcode, prefix); } } void Asm::In::parseLDSP (Tokenizer & tz) { expectcomma (tz); Token tok= tz.gettoken (); TypeToken tt= tok.type (); switch (tt) { case TypeHL: if (mode86) gencode (0x89, 0xDC); else gencode (0xF9); showcode ("LD SP, HL"); break; case TypeIX: no86 (); gencode (prefixIX, 0xF9); showcode ("LD SP, IX"); no8080 (); break; case TypeIY: no86 (); gencode (prefixIY, 0xF9); showcode ("LD SP, IY"); no8080 (); break; case TypeOpen: if (bracketonlymode) { parseLDdoublenn (tz, regSP); break; } case TypeOpenBracket: parseLDdouble_nn_ (tz, regSP, tt == TypeOpenBracket); break; default: parseLDdoublenn (tz, regSP); } checkendline (tz); } void Asm::In::parseLD_IrPlus (Tokenizer & tz, bool bracket, byte prefix) { ASSERT (prefix == prefixIX || prefix == prefixIY); byte desp= parsedesp (tz, bracket); expectcomma (tz); Token tok= tz.gettoken (); regbCode reg; byte secondprefix= NoPrefix; bool hasdesp; byte despnotused; if (parsebyteparam (tz, tok.type (), reg, secondprefix, hasdesp, despnotused) ) { // LD (IX+des), r / LD (IY+des), r checkendline (tz); if (secondprefix != NoPrefix || hasdesp || reg == reg_HL_) throw InvalidOperand; no86 (); byte code= 0x70 + reg; gencode (prefix, code, desp); showcode ("LD " + nameIdesp (prefix, true, desp) + ", " + getregbname (reg) ); } else { // LD (IX+des), n / LD (IY+des), n address addr= parseexpr (false, tok, tz); checkendline (tz); no86 (); byte n= lobyte (addr); gencode (prefix, 0x36, desp, n); showcode ("LD " + nameIdesp (prefix, true, desp) + ", " + hex2str (n) ); } no8080 (); } void Asm::In::parseLD_nn_ (Tokenizer & tz, bool bracket) { Token tok; address addr= parseexpr (false, tok, tz); expectcloseindir (tz, bracket); expectcomma (tz); tok= tz.gettoken (); byte code; byte prefix= NoPrefix; bool valid8080= true; switch (tok.type () ) { case TypeA: code= mode86 ? 0xA2 : 0x32; break; case TypeBC: valid8080= false; if (mode86) { prefix= 0x89; code= 0x0E; } else { prefix= 0xED; code= 0x43; } break; case TypeDE: valid8080= false; if (mode86) { prefix= 0x89; code= 0x16; } else { prefix= 0xED; code= 0x53; } break; case TypeHL: if (mode86) { prefix= 0x89; code= 0x1E; } else code= 0x22; break; case TypeIX: no86 (); valid8080= false; prefix= prefixIX; code= 0x22; break; case TypeIY: no86 (); valid8080= false; prefix= prefixIY; code= 0x22; break; case TypeSP: valid8080= false; if (mode86) { prefix= 0x89; code= 0x26; } else { prefix= 0xED; code= 0x73; } break; default: throw InvalidOperand; } checkendline (tz); if (prefix != NoPrefix) gencode (prefix); gencode (code); gencodeword (addr); showcode ("LD (" + hex4str (addr) + "), " + tok.str () ); if (! valid8080) no8080 (); } void Asm::In::parseLD_ (Tokenizer & tz, bool bracket) { Token tok= tz.gettoken (); switch (tok.type () ) { case TypeBC: expectcloseindir (tz, bracket); expectcomma (tz); expectA (tz); checkendline (tz); if (mode86) { // MOV SI,CX ; MOV [SI],AL gencode (0x89, 0xCE, 0x88, 0x04); } else gencode (0x02); showcode ("LD (BC), A"); break; case TypeDE: expectcloseindir (tz, bracket); expectcomma (tz); expectA (tz); checkendline (tz); if (mode86) { // MOV SI,DX ; MOV [SI],AL gencode (0x89, 0xD6, 0x88, 0x04); } else gencode (0x12); showcode ("LD (DE), A"); break; case TypeHL: expectcloseindir (tz, bracket); parseLDsimple (tz, reg_HL_); break; case TypeIX: parseLD_IrPlus (tz, bracket, prefixIX); break; case TypeIY: parseLD_IrPlus (tz, bracket, prefixIY); break; default: // LD (nn), ... parseLD_nn_ (tz, bracket); } } void Asm::In::parseLDIorR (Tokenizer & tz, byte code) { ASSERT (code == codeLDIA || code == codeLDRA); expectcomma (tz); expectA (tz); checkendline (tz); no86 (); gencodeED (code); showcode (std::string ("LD ") + ( (code == codeLDIA) ? 'I' : 'R' ) + ", A"); no8080 (); } void Asm::In::parseLD (Tokenizer & tz) { Token tok= tz.gettoken (); TypeToken tt= tok.type (); switch (tt) { case TypeA: parseLDA (tz); break; case TypeB: parseLDsimple (tz, regB); break; case TypeC: parseLDsimple (tz, regC); break; case TypeD: parseLDsimple (tz, regD); break; case TypeE: parseLDsimple (tz, regE); break; case TypeH: parseLDsimple (tz, regH); break; case TypeL: parseLDsimple (tz, regL); break; case TypeIXH: parseLDsimple (tz, regH, prefixIX); break; case TypeIYH: parseLDsimple (tz, regH, prefixIY); break; case TypeIXL: parseLDsimple (tz, regL, prefixIX); break; case TypeIYL: parseLDsimple (tz, regL, prefixIY); break; case TypeI: parseLDIorR (tz, codeLDIA); break; case TypeR: parseLDIorR (tz, codeLDRA); break; case TypeBC: parseLDdouble (tz, regBC); break; case TypeDE: parseLDdouble (tz, regDE); break; case TypeHL: parseLDdouble (tz, regHL); break; case TypeIX: parseLDdouble (tz, regHL, prefixIX); break; case TypeIY: parseLDdouble (tz, regHL, prefixIY); break; case TypeSP: parseLDSP (tz); break; case TypeOpen: if (bracketonlymode) throw InvalidOperand; case TypeOpenBracket: parseLD_ (tz, tt == TypeOpenBracket); break; default: throw InvalidOperand; } } void Asm::In::parseCP (Tokenizer & tz) { dobyteparam (tz, tiCP); } void Asm::In::parseAND (Tokenizer & tz) { dobyteparam (tz, tiAND); } void Asm::In::parseOR (Tokenizer & tz) { dobyteparam (tz, tiOR); } void Asm::In::parseXOR (Tokenizer & tz) { dobyteparam (tz, tiXOR); } void Asm::In::parseRL (Tokenizer & tz) { dobyteparamCB (tz, 0x10, "RL"); } void Asm::In::parseRLC (Tokenizer & tz) { dobyteparamCB (tz, 0x00, "RLC"); } void Asm::In::parseRR (Tokenizer & tz) { dobyteparamCB (tz, 0x18, "RR"); } void Asm::In::parseRRC (Tokenizer & tz) { dobyteparamCB (tz, 0x08, "RRC"); } void Asm::In::parseSLA (Tokenizer & tz) { dobyteparamCB (tz, 0x20, "SLA"); } void Asm::In::parseSRA (Tokenizer & tz) { dobyteparamCB (tz, 0x28, "SRA"); } void Asm::In::parseSRL (Tokenizer & tz) { dobyteparamCB (tz, 0x38, "SRL"); } void Asm::In::parseSLL (Tokenizer & tz) { dobyteparamCB (tz, 0x30, "SLL"); } void Asm::In::parseSUB (Tokenizer & tz) { dobyteparam (tz, tiSUB); } void Asm::In::parseADDADCSBCHL (Tokenizer & tz, byte prefix, byte basecode) { ASSERT (basecode == codeADDHL || basecode == codeADCHL || basecode == codeSBCHL); ASSERT (basecode == codeADDHL || prefix == NoPrefix); ASSERT (prefix == NoPrefix || prefix == prefixIX || prefix == prefixIY); expectcomma (tz); Token tok= tz.gettoken (); regwCode reg; switch (tok.type () ) { case TypeBC: reg= regBC; break; case TypeDE: reg= regDE; break; case TypeHL: if (prefix != NoPrefix) throw InvalidOperand; reg= regHL; break; case TypeSP: reg= regSP; break; case TypeIX: if (prefix != prefixIX) throw InvalidOperand; reg= regHL; break; case TypeIY: if (prefix != prefixIY) throw InvalidOperand; reg= regHL; break; default: throw InvalidOperand; } checkendline (tz); if (prefix != NoPrefix) { no86 (); gencode (prefix); } if (mode86) { byte code; switch (basecode) { case codeADDHL: code= (reg << 3) + 0xCB; gencode (0x01, code); break; case codeADCHL: code= (reg << 3) + 0xCB; gencode (0x11, code); break; case codeSBCHL: code= (reg << 3) + 0xCB; gencode (0x19, code); break; default: ASSERT (false); throw UnexpectedRegisterCode; } } else { if (basecode == codeSBCHL || basecode == codeADCHL) gencode (0xED); byte code= (reg << 4) + basecode; gencode (code); } std::string aux; switch (basecode) { case codeADDHL: aux= "ADD"; break; case codeADCHL: aux= "ADC"; break; case codeSBCHL: aux= "SBC"; break; default: throw UnexpectedRegisterCode; } showcode (aux + ' ' + nameHLpref (prefix) + ", " + regwName (reg, nameSP, reg == regHL ? prefix : NoPrefix) ); if (basecode == codeADCHL || basecode == codeSBCHL || prefix != NoPrefix) { no8080 (); } } void Asm::In::parseADD (Tokenizer & tz) { Token tok= tz.gettoken (); switch (tok.type () ) { case TypeA: expectcomma (tz); dobyteparam (tz, tiADDA); break; case TypeHL: parseADDADCSBCHL (tz, NoPrefix, codeADDHL); return; case TypeIX: parseADDADCSBCHL (tz, prefixIX, codeADDHL); return; case TypeIY: parseADDADCSBCHL (tz, prefixIY, codeADDHL); return; default: throw InvalidOperand; } } void Asm::In::parseADC (Tokenizer & tz) { Token tok= tz.gettoken (); switch (tok.type () ) { case TypeA: expectcomma (tz); dobyteparam (tz, tiADCA); break; case TypeHL: parseADDADCSBCHL (tz, NoPrefix, codeADCHL); return; default: throw InvalidOperand; } } void Asm::In::parseSBC (Tokenizer & tz) { Token tok= tz.gettoken (); switch (tok.type () ) { case TypeA: expectcomma (tz); dobyteparam (tz, tiSBCA); break; case TypeHL: parseADDADCSBCHL (tz, NoPrefix, codeSBCHL); break; default: throw InvalidOperand; } } // Push and pop codes: // push bc -> C5 // push de -> D5 // push hl -> E5 // push af -> F5 // push ix -> DD E5 // push iy -> FD E5 // pop bc -> C1 // pop de -> D1 // pop hl -> E1 // pop af -> F1 // pop ix -> DD E1 // pop iy -> FD E1 void Asm::In::parsePUSHPOP (Tokenizer & tz, bool isPUSH) { Token tok= tz.gettoken (); byte code= 0; byte prefix= NoPrefix; switch (tok.type () ) { case TypeBC: code= regBC; break; case TypeDE: code= regDE; break; case TypeHL: code= regHL; break; case TypeAF: code= regAF; break; case TypeIX: code= regHL; prefix= prefixIX; break; case TypeIY: code= regHL; prefix= prefixIY; break; default: throw InvalidOperand; } checkendline (tz); if (prefix != NoPrefix) { no86 (); gencode (prefix); } if (mode86) code= (code + 1) % 4; else code<<= 4; code+= mode86 ? (isPUSH ? 0x50 : 0x58 ) : isPUSH ? 0xC5 : 0xC1; if (code == 0x50) // PUSH AX { ASSERT (mode86 && isPUSH); // LAHF ; XCHG AL,AH gencode (0x9F, 0x86, 0xC4); } gencode (code); if (code == 0x50) // PUSH AX { ASSERT (mode86 && isPUSH); // XCHG AL,AH gencode (0x86, 0xC4); } if (code == 0x58) // POP AX { ASSERT (mode86 && ! isPUSH); // XCHG AL, AH ; SAHF gencode (0x86, 0xC4, 0x9E); } showcode (std::string (isPUSH ? "PUSH" : "POP") + ' ' + tok.str () ); if (prefix != NoPrefix) no8080 (); } void Asm::In::parsePUSH (Tokenizer & tz) { parsePUSHPOP (tz, true); } void Asm::In::parsePOP (Tokenizer & tz) { parsePUSHPOP (tz, false); } // CALL codes // call NN -> CD // call nz, NN -> C4 // call z, NN -> CC // call nc, NN -> D4 // call c, NN -> DC // call po, NN -> E4 // call pe, NN -> EC // call p, NN -> F4 // call m, NN -> FC void Asm::In::parseCALL (Tokenizer & tz) { Token tok= tz.gettoken (); byte code; flagCode fcode= getflag (tok.type () ); std::string flagname; if (fcode == flagInvalid) { if (mode86) code= 0xE8; else code= 0xCD; } else { flagname= tok.str (); if (mode86) { fcode= invertflag86 (getflag86 (fcode) ); code= fcode | 0x70; } else { code= (fcode << 3) | 0xC4; } expectcomma (tz); tok= tz.gettoken (); } const address addr= parseexpr (false, tok, tz); checkendline (tz); if (mode86) { if (code == 0xE8) { address offset= addr - (currentinstruction + 3); gencode (0xE8); gencodeword (offset); } else { // Generate a conditional jump with the // opposite condition to the following // instruction, followed by a call to // the destination. address offset= addr - (currentinstruction + 5); gencode (code, 0x03, 0xE8); gencodeword (offset); } } else { gencode (code); gencodeword (addr); } showcode ("CALL " + (flagname.empty () ? emptystr : (flagname + ", ") ) + hex4str (addr) ); } void Asm::In::parseRET (Tokenizer & tz) { Token tok= tz.gettoken (); byte code; flagCode fcode= getflag (tok.type () ); std::string flagname; if (fcode == flagInvalid) { code= mode86 ? 0xC3 : 0xC9; } else { flagname= tok.str (); if (mode86) { fcode= invertflag86 (getflag86 (fcode) ); code= fcode | 0x70; } else { code= (fcode << 3) | 0xC0; } } checkendline (tz); if (mode86 && code != 0xC3) { // Generate a conditional jump with the opposite // condition to the following instruction, // followed by a RET. gencode (code, 0x01); code= 0xC3; } gencode (code); showcode ("RET" + (flagname.empty () ? emptystr : (" " + flagname) ) ); } // JP codes // jp NN -> C3 // jp (hl) -> E9 // jp nz, NN -> C2 // jp z, NN -> CA // jp nc, NN -> D2 // jp c, NN -> DA // jp po, NN -> E2 // jp pe, NN -> EA // jp p, NN -> F2 // jp m, NN -> FA void Asm::In::parseJP_ (Tokenizer & tz, bool bracket) { Token tok= tz.gettoken (); byte prefix= NoPrefix; switch (tok.type () ) { case TypeHL: break; case TypeIX: prefix= prefixIX; break; case TypeIY: prefix= prefixIY; break; default: throw InvalidOperand; } expectcloseindir (tz, bracket); checkendline (tz); if (prefix != NoPrefix) { no86 (); gencode (prefix); } if (mode86) { gencode (0xFF, 0xE3); showcode ("JP (HL)"); } else { gencode (0xE9); showcode ("JP (" + nameHLpref (prefix) + ')'); } if (prefix != NoPrefix) no8080 (); } void Asm::In::parseJP (Tokenizer & tz) { Token tok= tz.gettoken (); TypeToken tt= tok.type (); if (tt == TypeOpenBracket) { parseJP_ (tz, true); return; } if (tt == TypeOpen && ! bracketonlymode) { parseJP_ (tz, false); return; } flagCode fcode= getflag (tt); byte code; std::string flagname; if (fcode == flagInvalid) { if (mode86) code= 0xE9; else code= 0xC3; } else { flagname= tok.str (); if (mode86) { fcode= invertflag86 (getflag86 (fcode) ); code= fcode | 0x70; } else code= (fcode << 3) | 0xC2; expectcomma (tz); tok= tz.gettoken (); } const address addr= parseexpr (false, tok, tz); checkendline (tz); if (mode86) { if (code == 0xE9) { address offset= addr - (currentinstruction + 3); gencode (0xE9); gencodeword (offset); } else { // Generate a conditional jump with the // opposite condition to the following // instruction, followed by a jump to // the destination. // TODO: optimize this in cases that the // destination is known and is in range. address offset= addr - (currentinstruction + 5); gencode (code, 0x03, 0xE9); gencodeword (offset); } } else { gencode (code); gencodeword (addr); } showcode ("JP " + (flagname.empty () ? emptystr : flagname + ", ") + hex4str (addr) ); } void Asm::In::parserelative (Tokenizer & tz, Token tok, byte code, const std::string instrname) { // Use by JR and DJNZ. address addr= parseexpr (false, tok, tz); checkendline (tz); int dif= 0; if (pass >= 2) { dif= addr - (current + 2); if (dif > 127 || dif < -128) { * pout << "addr= " << addr << " current= " << current << " dif= " << dif << endl; throw RelativeOutOfRange; } } signed char reldesp = static_cast (dif); gencode (code, reldesp); showcode (instrname + ' ' + hex4str (addr) ); no8080 (); } void Asm::In::parseJR (Tokenizer & tz) { Token tok= tz.gettoken (); byte code= 0; std::string instrname ("JR"); flagCode fcode= getflag (tok.type () ); if (fcode == flagInvalid) { code= mode86 ? 0xEB : 0x18; } else { instrname+= ' '; instrname+= tok.str (); instrname+= ','; if (fcode > flagC) throw InvalidFlagJR; if (mode86) code= 0x70 | getflag86 (fcode); else code= 0x20 | (fcode << 3); expectcomma (tz); tok= tz.gettoken (); } parserelative (tz, tok, code, instrname); } void Asm::In::parseDJNZ (Tokenizer & tz) { Token tok= tz.gettoken (); if (! mode86) { parserelative (tz, tok, codeDJNZ, "DJNZ"); } else { address addr= parseexpr (false, tok, tz); checkendline (tz); int dif= 0; if (pass >= 2) { dif= addr - (current + 4); if (dif > 127 || dif < -128) { * pout << "addr= " << addr << " current= " << current << " dif= " << dif << endl; throw RelativeOutOfRange; } } signed char reldesp = static_cast (dif); // DEC CH ; JNZ ... gencode (0xFE, 0xCD, 0x75, reldesp); showcode ("DJNZ" + hex4str (addr) ); } } void Asm::In::parseINCDECsimple (Tokenizer & tz, bool isINC, regbCode reg, byte prefix, bool hasdesp, byte desp) { ASSERT (prefix == NoPrefix || prefix == prefixIX || prefix == prefixIY); byte code= mode86 ? (isINC ? 0xC0 : 0xC8) : isINC ? 04 : 05; if (mode86) { if (reg == reg_HL_) code= isINC ? 0x07 : 0x0F; else code+= getregb86 (reg); } else code+= reg << 3; checkendline (tz); if (prefix != NoPrefix) { no86 (); gencode (prefix); } if (mode86) gencode (0xFE); gencode (code); if (hasdesp) gencode (desp); showcode (std::string (isINC ? "INC" : "DEC") + ' ' + getregbname (reg, prefix, hasdesp, desp) ); if (prefix != NoPrefix) no8080 (); } void Asm::In::parseINCDECdouble (Tokenizer & tz, bool isINC, regwCode reg, byte prefix) { ASSERT (prefix == NoPrefix || prefix == prefixIX || prefix == prefixIY); byte code= mode86 ? (isINC ? 0x41 : 0x49) : isINC ? 0x03 : 0x0B; if (mode86) code+= reg; else code+= reg << 4; checkendline (tz); if (prefix != NoPrefix) { no86 (); gencode (prefix); } gencode (code); showcode (std::string (isINC ? "INC" : "DEC") + ' ' + regwName (reg, nameSP, prefix) ); if (prefix != NoPrefix) no8080 (); } void Asm::In::parseINCDEC (Tokenizer & tz, bool isINC) { Token tok= tz.gettoken (); TypeToken tt= tok.type (); switch (tt) { case TypeA: parseINCDECsimple (tz, isINC, regA); break; case TypeB: parseINCDECsimple (tz, isINC, regB); break; case TypeC: parseINCDECsimple (tz, isINC, regC); break; case TypeD: parseINCDECsimple (tz, isINC, regD); break; case TypeE: parseINCDECsimple (tz, isINC, regE); break; case TypeH: parseINCDECsimple (tz, isINC, regH); break; case TypeL: parseINCDECsimple (tz, isINC, regL); break; case TypeIXH: parseINCDECsimple (tz, isINC, regH, prefixIX); break; case TypeIXL: parseINCDECsimple (tz, isINC, regL, prefixIX); break; case TypeIYH: parseINCDECsimple (tz, isINC, regH, prefixIY); break; case TypeIYL: parseINCDECsimple (tz, isINC, regL, prefixIY); break; case TypeBC: parseINCDECdouble (tz, isINC, regBC); break; case TypeDE: parseINCDECdouble (tz, isINC, regDE); break; case TypeHL: parseINCDECdouble (tz, isINC, regHL); break; case TypeIX: parseINCDECdouble (tz, isINC, regHL, prefixIX); break; case TypeIY: parseINCDECdouble (tz, isINC, regHL, prefixIY); break; case TypeSP: parseINCDECdouble (tz, isINC, regSP); break; case TypeOpen: if (bracketonlymode) throw InvalidOperand; case TypeOpenBracket: { bool bracket= tt == TypeOpenBracket; tok= tz.gettoken (); byte desp= 0; switch (tok.type () ) { case TypeHL: expectcloseindir (tz, bracket); parseINCDECsimple (tz, isINC, reg_HL_); break; case TypeIX: desp= parsedesp (tz, bracket); parseINCDECsimple (tz, isINC, reg_HL_, prefixIX, true, desp); break; case TypeIY: desp= parsedesp (tz, bracket); parseINCDECsimple (tz, isINC, reg_HL_, prefixIY, true, desp); break; default: throw InvalidOperand; } } break; default: throw InvalidOperand; } } void Asm::In::parseINC (Tokenizer & tz) { parseINCDEC (tz, true); } void Asm::In::parseDEC (Tokenizer & tz) { parseINCDEC (tz, false); } void Asm::In::parseEX (Tokenizer & tz) { Token tok= tz.gettoken (); TypeToken tt= tok.type (); switch (tt) { case TypeAF: expectcomma (tz); tok= tz.gettoken (); if (tok.type () != TypeAFp) throw InvalidOperand; no86 (); gencode (0x08); showcode ("EX AF, AF'"); no8080 (); break; case TypeDE: expectcomma (tz); tok= tz.gettoken (); if (tok.type () != TypeHL) throw InvalidOperand; if (mode86) gencode (0x87, 0xD3); else gencode (0xEB); showcode ("EX DE, HL"); break; case TypeOpen: if (bracketonlymode) throw InvalidOperand; case TypeOpenBracket: { bool bracket= tt == TypeOpenBracket; tok= tz.gettoken (); if (tok.type () != TypeSP) throw InvalidOperand; expectcloseindir (tz, bracket); expectcomma (tz); tok= tz.gettoken (); switch (tok.type () ) { case TypeHL: // TODO: implement this for 8086 no86 (); gencode (0xE3); showcode ("EX (SP), HL"); break; case TypeIX: no86 (); gencode (prefixIX, 0xE3); showcode ("EX (SP), IX"); no8080 (); break; case TypeIY: no86 (); gencode (prefixIY, 0xE3); showcode ("EX (SP), IY"); no8080 (); break; default: throw InvalidOperand; } } break; default: throw InvalidOperand; } checkendline (tz); } void Asm::In::parseIN (Tokenizer & tz) { Token tok= tz.gettoken (); byte code; switch (tok.type () ) { case TypeB: code= 0x40; break; case TypeC: code= 0x48; break; case TypeD: code= 0x50; break; case TypeE: code= 0x58; break; case TypeH: code= 0x60; break; case TypeL: code= 0x68; break; case TypeA: expectcomma (tz); { bool bracket= parseopenindir (tz); tok= tz.gettoken (); if (tok.type () == TypeC) { no86 (); expectcloseindir (tz, bracket); gencodeED (0x78); showcode ("IN A, (C)"); no8080 (); } else { address addr= parseexpr (false, tok, tz); byte b= static_cast (addr); code= mode86 ? 0xE4 : 0xDB; gencode (code, b); showcode ("IN A, (" + hex2str (b) + ')'); expectcloseindir (tz, bracket); } } checkendline (tz); return; default: throw InvalidOperand; } std::string regname= tok.str (); expectcomma (tz); bool bracket= parseopenindir (tz); expectC (tz); expectcloseindir (tz, bracket); checkendline (tz); no86 (); gencodeED (code); showcode ("IN " + regname + ", (C)"); no8080 (); } void Asm::In::parseOUT (Tokenizer & tz) { bool bracket= parseopenindir (tz); Token tok= tz.gettoken (); if (tok.type () != TypeC) { address addr= parseexpr (false, tok, tz); byte b= static_cast (addr); expectcloseindir (tz, bracket); expectcomma (tz); expectA (tz); checkendline (tz); byte code= mode86 ? 0xE6 : 0xD3; gencode (code, b); showcode ("OUT (" + hex2str (b) + "), A"); no8080 (); return; } expectcloseindir (tz, bracket); expectcomma (tz); tok= tz.gettoken (); byte code; switch (tok.type () ) { case TypeA: code= 0x79; break; case TypeB: code= 0x41; break; case TypeC: code= 0x49; break; case TypeD: code= 0x51; break; case TypeE: code= 0x59; break; case TypeH: code= 0x61; break; case TypeL: code= 0x69; break; default: throw InvalidOperand; } std::string regname= tok.str (); checkendline (tz); no86 (); gencodeED (code); showcode ("OUT (C), " + regname); no8080 (); } void Asm::In::dobit (Tokenizer & tz, byte basecode, std::string instrname) { Token tok= tz.gettoken (); address addr= parseexpr (false, tok, tz); if (addr > 7) throw BitOutOfRange; expectcomma (tz); instrname+= ' '; instrname+= '0' + addr; instrname+= ','; dobyteparamCB (tz, basecode + (addr << 3), instrname); } void Asm::In::parseBIT (Tokenizer & tz) { dobit (tz, 0x40, "BIT"); } void Asm::In::parseRES (Tokenizer & tz) { dobit (tz, 0x80, "RES"); } void Asm::In::parseSET (Tokenizer & tz) { dobit (tz, 0xC0, "SET"); } void Asm::In::parseDEFB (Tokenizer & tz) { address count= 0; for (;;) { Token tok= tz.gettoken (); switch (tok.type () ) { case TypeLiteral: { const std::string & str= tok.str (); const std::string::size_type l= str.size (); if (l == 1) { // Admit expressions like 'E' + 80H gendata (parseexpr (false, tok, tz) ); ++count; break; } for (std::string::size_type i= 0; i < l; ++i) { gendata (str [i] ); } count= static_cast
(count + l); } break; default: gendata (parseexpr (false, tok, tz) ); ++count; } tok= tz.gettoken (); if (tok.type () == TypeEndLine) break; checktoken (TypeComma, tok); } ostringstream oss; oss << "DEFB of " << count << " bytes"; showcode (oss.str () ); } void Asm::In::parseDEFW (Tokenizer & tz) { address count= 0; for (;;) { Token tok= tz.gettoken (); gendataword (parseexpr (false, tok, tz) ); ++count; tok= tz.gettoken (); if (tok.type () == TypeEndLine) break; checktoken (TypeComma, tok); } ostringstream oss; oss << "DEFW of " << count << " words"; showcode (oss.str () ); } void Asm::In::parseDEFS (Tokenizer & tz) { Token tok= tz.gettoken (); address count= parseexpr (true, tok, tz); byte value= 0; tok= tz.gettoken (); if (tok.type () != TypeEndLine) { checktoken (TypeComma, tok); tok= tz.gettoken (); address calcvalue= parseexpr (false, tok, tz); checkendline (tz); value= static_cast (calcvalue); } for (address i= 0; i < count; ++i) gendata (value); ostringstream oss; oss << "DEFS of " << count << " bytes with value " << hex2 (value); showcode (oss.str () ); } void Asm::In::parseINCBIN (Tokenizer & tz) { std::string includefile= tz.getincludefile (); checkendline (tz); * pout << "\t\tINCBIN " << includefile << endl; std::ifstream f; openis (f, includefile, std::ios::in | std::ios::binary); char buffer [1024]; for (;;) { f.read (buffer, sizeof (buffer) ); for (std::streamsize i= 0, r= f.gcount (); i < r; ++i) gendata (static_cast (buffer [i] ) ); if (! f) { if (f.eof () ) break; else throw ErrorReadingINCBIN; } } } //********************************************************* // Macro expansions. //********************************************************* namespace pasmo_impl { typedef std::vector MacroParam; typedef std::vector MacroParamList; void getmacroparams (MacroParamList & params, Tokenizer & tz) { for (;;) { Token tok= tz.gettoken (); TypeToken tt= tok.type (); if (tt == TypeEndLine) break; MacroParam param; while (tt != TypeEndLine && tt != TypeComma) { param.push_back (tok); tok= tz.gettoken (); tt= tok.type (); } params.push_back (param); if (tt == TypeEndLine) break; } } void substparam (Tokenizer & tz, const MacroParam & param) { const size_t l= param.size (); for (size_t i= 0; i < l; ++i) tz.push_back (param [i] ); } Tokenizer substmacroparams (const MacroBase & macro, Tokenizer & tz, const MacroParamList & params) { Tokenizer r (tz.getnocase () ); for (;;) { Token tok= tz.gettoken (); TypeToken tt= tok.type (); if (tt == TypeEndLine) break; if (tt != TypeIdentifier) r.push_back (tok); else { const std::string & name= tok.str (); size_t n= macro.getparam (name); if (n == Macro::noparam) r.push_back (tok); else { // If there are no sufficient parameters // expand to nothing. if (n < params.size () ) substparam (r, params [n] ); } } } return r; } } // namespace pasmo_impl bool Asm::In::gotoENDM () { size_t level= 1; while (nextline () ) { Tokenizer & tz (getcurrentline () ); Token tok= tz.gettoken (); TypeToken tt= tok.type (); if (tt == TypeIdentifier) { tok= tz.gettoken (); tt= tok.type (); } if (tt == TypeENDM) { if (--level == 0) break; } if (tt == TypeMACRO || tt == TypeREPT || tt == TypeIRP) ++level; } return true; } namespace pasmo_impl { // Macro expansion control classes: create the MacroLevel, store some // state info and restore things on destruction and do parameter // substitutions. class MacroFrameBase { public: MacroFrameBase (Asm::In & asmin_n, const MacroBase & macro_n, MacroParamList & params_n); virtual ~MacroFrameBase (); size_t getexpline () const; virtual void shift ()= 0; virtual Tokenizer substparams (Tokenizer & tz); Tokenizer substparentparams (Tokenizer & tz); protected: Asm::In & asmin; void do_shift (); void parentshift (); private: const size_t expandline; const size_t previflevel; const MacroBase & macro; MacroParamList & params; MacroFrameBase * pprevmframe; }; MacroFrameBase::MacroFrameBase (Asm::In & asmin_n, const MacroBase & macro_n, MacroParamList & params_n) : asmin (asmin_n), expandline (asmin.getline () ), previflevel (asmin.iflevel), macro (macro_n), params (params_n), pprevmframe (asmin.getmframe () ) { MacroLevel * pproc= new MacroLevel (asmin); asmin.localstack.push (pproc); // Ensure that an IF opened before is not closed // inside the macro expansion. asmin.iflevel= 0; asmin.setmframe (this); } MacroFrameBase::~MacroFrameBase () { // Clear the local frame, including unclosed PROCs and autolocals. while (dynamic_cast (asmin.localstack.top () ) == NULL) asmin.localstack.pop (); asmin.localstack.pop (); // IF whitout ENDIF inside a macro are valid. asmin.iflevel= previflevel; asmin.setmframe (pprevmframe); } size_t MacroFrameBase::getexpline () const { return expandline; } void MacroFrameBase::do_shift () { params.erase (params.begin () ); } void MacroFrameBase::parentshift () { if (pprevmframe) pprevmframe->shift (); else throw ShiftOutsideMacro; } Tokenizer MacroFrameBase::substparams (Tokenizer & tz) { return substmacroparams (macro, tz, params); } Tokenizer MacroFrameBase::substparentparams (Tokenizer & tz) { if (pprevmframe) return pprevmframe->substparams (tz); else return tz; } class MacroFrameChild : public MacroFrameBase { public: MacroFrameChild (Asm::In & asmin_n, const MacroBase & macro_n, MacroParamList & params_n); void shift (); Tokenizer substparams (Tokenizer & tz); }; MacroFrameChild::MacroFrameChild (Asm::In & asmin_n, const MacroBase & macro_n, MacroParamList & params_n) : MacroFrameBase (asmin_n, macro_n, params_n) { } void MacroFrameChild::shift () { parentshift (); } Tokenizer MacroFrameChild::substparams (Tokenizer & tz) { //cerr << "Subst parent" << endl; Tokenizer tzaux (substparentparams (tz) ); //cerr << "Subst this" << endl; return MacroFrameBase::substparams (tzaux); } class MacroFrameMacro : public MacroFrameBase { public: MacroFrameMacro (Asm::In & asmin_n, const Macro & macro_n, MacroParamList & params_n); void shift (); Tokenizer substparams (Tokenizer & tz); }; MacroFrameMacro::MacroFrameMacro (Asm::In & asmin_n, const Macro & macro_n, MacroParamList & params_n) : MacroFrameBase (asmin_n, macro_n, params_n) { } void MacroFrameMacro::shift () { do_shift (); } Tokenizer MacroFrameMacro::substparams (Tokenizer & tz) { // First do the parameter substitution. Tokenizer tzaux (MacroFrameBase::substparams (tz) ); // Then look for ##. Tokenizer tzr; Token tok; TypeToken tt; Token last (TypeUndef); while ( (tt= (tok= tzaux.gettoken () ).type () ) != TypeEndLine) { if (tt == TypeSharpSharp) { if (last.type () == TypeUndef) throw InvalidSharpSharp; std::string str (last.str () ); tok= tzaux.gettoken (); if (tok.type () == TypeEndLine) throw InvalidSharpSharp; str+= tok.str (); last= Token (TypeIdentifier, str); } else { if (last.type () != TypeUndef) tzr.push_back (last); last= tok; } } if (last.type () != TypeUndef) tzr.push_back (last); return tzr; } } // namespace pasmo_impl using pasmo_impl::MacroParam; using pasmo_impl::MacroParamList; using pasmo_impl::getmacroparams; using pasmo_impl::MacroFrameChild; using pasmo_impl::MacroFrameMacro; void Asm::In::expandMACRO (const std::string & name, Macro macro, Tokenizer & tz) { * pout << "Expanding MACRO " << name << endl; // Get parameters. MacroParamList params; getmacroparams (params, tz); checkendline (tz); // Redundant, for debugging. for (size_t i= 0; i < params.size (); ++i) { * pout << macro.getparam (i) << "= "; const MacroParam & p= params [i]; std::copy (p.begin (), p.end (), std::ostream_iterator (* pout, " ") ); * pout << endl; } // Set the local frame. MacroFrameMacro mframe (* this, macro, params); // Do the expansion, try { bool noexit= true; for (setline (macro.getline () ); noexit && nextline (); ) { Tokenizer & tz (getcurrentline () ); * pout << tz << endl; Token tok= tz.gettoken (); TypeToken tt= tok.type (); switch (tt) { case TypeENDM: case TypeEXITM: noexit= false; * pout << "\t\t" << tok.str () << endl; break; case Type_SHIFT: checkendline (tz); mframe.shift (); break; default: tz.ungettoken (); Tokenizer tzsubst (mframe.substparams (tz) ); //* pout << tzsubst << endl; parseline (tzsubst); } } if (passeof () ) throw MACROLostENDM; } catch (...) { * perr << "ERROR expanding macro"; showlineinfo (* perr, mframe.getexpline () ); * perr << endl; throw; } setline (mframe.getexpline () ); * pout << "End of MACRO " << name << endl; } void Asm::In::parseREPT (Tokenizer & tz) { Token tok= tz.gettoken (); const address numrep= parseexpr (true, tok, tz); // Adding new option for counter variable. //checkendline (tz); std::string varcounter; address valuecounter= 0; address step= 1; tok= tz.gettoken (); if (tok.type () != TypeEndLine) { checktoken (TypeComma, tok); tok= tz.gettoken (); checktoken (TypeIdentifier, tok); varcounter= tok.str (); tok= tz.gettoken (); if (tok.type () != TypeEndLine) { checktoken (TypeComma, tok); tok= tz.gettoken (); valuecounter= parseexpr (true, tok, tz); tok= tz.gettoken (); if (tok.type () != TypeEndLine) { checktoken (TypeComma, tok); tok= tz.gettoken (); step= parseexpr (true, tok, tz); checkendline (tz); } } if (isautolocalname (varcounter) ) throw InvalidInAutolocal; } * pout << "\t\tREPT " << numrep << endl; if (numrep == 0) { if (! gotoENDM () ) throw REPTwithoutENDM; return; } // Set the local frame. MacroRept macro; MacroParamList params; MacroFrameChild mframe (* this, macro, params); // Create counter local var. if (! varcounter.empty () ) { localstack.top ()->add (varcounter); setdefl (varcounter, valuecounter); } const address lastrep= numrep - 1; bool endrep= false; for (address i= 0; i < numrep; ++i) { bool noendblock= true; for (setline (mframe.getexpline () ); noendblock && nextline (); ) { Tokenizer & tz (getcurrentline () ); tok= tz.gettoken (); TypeToken tt= tok.type (); switch (tt) { case TypeENDM: if (i == lastrep) { * pout << "\t\tENDM" << endl; endrep= true; } noendblock= false; break; case TypeEXITM: if (! gotoENDM () ) throw REPTwithoutENDM; * pout << "\t\tEXITM" << endl; noendblock= false; endrep= true; break; case Type_SHIFT: checkendline (tz); mframe.shift (); break; default: tz.ungettoken (); Tokenizer tzsubst (mframe.substparams (tz) ); //* pout << tzsubst << endl; parseline (tzsubst); } } if (passeof () ) { setline (mframe.getexpline () ); throw REPTwithoutENDM; } if (endrep) break; if (! varcounter.empty () ) { valuecounter+= step; setdefl (varcounter, valuecounter); } } } void Asm::In::parseIRP (Tokenizer & tz) { Token tok= tz.gettoken (); checktoken (TypeIdentifier, tok); const std::string arg= tok.str (); MacroIrp macroirp (arg); expectcomma (tz); MacroParamList params; getmacroparams (params, tz); checkendline (tz); // Redundant, for debugging. if (params.empty () ) throw IRPWithoutParameters; * pout << "\t\tIRP" << endl; // Set the local frame. MacroParamList actualparam (1); MacroFrameChild mframe (* this, macroirp, actualparam); const size_t irpnlast= params.size () - 1; bool endirp= false; for (size_t irpn= 0; irpn < params.size (); ++irpn) { bool noendblock= true; actualparam [0]= params [irpn]; for (setline (mframe.getexpline () ); noendblock && nextline (); ) { Tokenizer & tz (getcurrentline () ); tok= tz.gettoken (); TypeToken tt= tok.type (); switch (tt) { case TypeENDM: if (irpn == irpnlast) { * pout << "\t\tENDM" << endl; endirp= true; } noendblock= false; break; case TypeEXITM: if (! gotoENDM () ) throw IRPwithoutENDM; * pout << "\t\tEXITM" << endl; noendblock= false; endirp= true; break; case Type_SHIFT: checkendline (tz); mframe.shift (); break; default: tz.ungettoken (); Tokenizer tzsubst (mframe.substparams (tz) ); * pout << tzsubst << endl; parseline (tzsubst); } } if (passeof () ) { setline (mframe.getexpline () ); throw IRPwithoutENDM; } if (endirp) break; } } //********************************************************* // Object file generation. //********************************************************* void Asm::In::message_emit (const std::string & type) { if (debugtype != NoDebug) * pout << "Emiting " << type << " from " << hex4 (minused) << " to " << hex4 (maxused) << endl; } address Asm::In::getcodesize () const { return maxused - minused + 1; } void Asm::In::writebincode (std::ostream & out) { out.write (reinterpret_cast (mem + minused), getcodesize ()); } void Asm::In::emitobject (std::ostream & out) { message_emit ("raw binary"); for (int i= minused; i <= maxused; ++i) { out.put (mem [i] ); } } void Asm::In::emitplus3dos (std::ostream & out) { message_emit ("PLUS3DOS"); address codesize= getcodesize (); spectrum::Plus3Head head; head.setsize (codesize); head.setstart (minused); head.write (out); // Write code. writebincode (out); // Write rounding to 128 byte block. size_t round= 128 - (codesize % 128); if (round != 128) { char aux [128]= {}; out.write (aux, round); } if (! out) throw ErrorOutput; } void Asm::In::emittap (std::ostream & out) { message_emit ("TAP"); // Pepare data needed. address codesize= getcodesize (); tap::CodeHeader headcodeblock (minused, codesize, headername); tap::CodeBlock codeblock (codesize, mem + minused); // Write the file. headcodeblock.write (out); codeblock.write (out); if (! out) throw ErrorOutput; } void Asm::In::writetzxcode (std::ostream & out) { // Preapare data needed. address codesize= getcodesize (); tap::CodeHeader block1 (minused, codesize, headername); tap::CodeBlock block2 (codesize, mem + minused); // Write the data. tzx::writestandardblockhead (out); block1.write (out); tzx::writestandardblockhead (out); block2.write (out); if (! out) throw ErrorOutput; } void Asm::In::emittzx (std::ostream & out) { message_emit ("TZX"); tzx::writefilehead (out); writetzxcode (out); } void Asm::In::writecdtcode (std::ostream & out) { const address codesize= getcodesize (); const address entry= hasentrypoint ? entrypoint : 0; cpc::Header head (headername); head.settype (cpc::Header::Binary); head.firstblock (true); head.lastblock (false); head.setlength (codesize); head.setloadaddress (minused); head.setentry (entry); address pos= minused; address pending= codesize; const address maxblock= 2048; const address maxsubblock= 256; byte blocknum= 1; while (pending > 0) { const address block= pending < maxblock ? pending : maxblock; head.setblock (blocknum); if (blocknum > 1) head.firstblock (false); if (pending <= maxblock) head.lastblock (true); head.setblocklength (block); // Size of the tzx data block: type byte, code, checksums, // filling of last subblock and final bytes. size_t tzxdatalen= static_cast (block) + maxsubblock - 1; tzxdatalen/= maxsubblock; tzxdatalen*= maxsubblock + 2; tzxdatalen+= 5; // Write header. tzx::writeturboblockhead (out, 263); head.write (out); // Write code. tzx::writeturboblockhead (out, tzxdatalen); out.put (0x16); // Data block identifier. address subpos= pos; address blockpending= block; while (blockpending > 0) { address subblock= blockpending < maxsubblock ? blockpending : maxsubblock; out.write (reinterpret_cast (mem + subpos), subblock); for (size_t i= subblock; i < maxsubblock; ++i) out.put ('\0'); address crc= cpc::crc (mem + subpos, subblock); out.put (hibyte (crc) ); // CRC in hi-lo format. out.put (lobyte (crc) ); blockpending-= subblock; subpos+= subblock; } out.put (0xFF); out.put (0xFF); out.put (0xFF); out.put (0xFF); pos+= block; pending-= block; ++blocknum; } if (! out) throw ErrorOutput; } void Asm::In::emitcdt (std::ostream & out) { message_emit ("CDT"); tzx::writefilehead (out); writecdtcode (out); } std::string Asm::In::cpcbasicloader () { using namespace cpc; std::string basic; // Line: 10 MEMORY before_min_used std::string line= tokMEMORY + hexnumber (minused - 1); basic+= basicline (10, line); // Line: 20 LOAD "!", minused line= tokLOAD + "\"!\"," + hexnumber (minused); basic+= basicline (20, line); if (hasentrypoint) { // Line: 30 CALL entry_point line= tokCALL + hexnumber (minused); basic+= basicline (30, line); } // A line length of 0 marks the end of program. basic+= '\0'; basic+= '\0'; return basic; } void Asm::In::emitcdtbas (std::ostream & out) { message_emit ("CDT"); const std::string basic= cpcbasicloader (); const address basicsize= static_cast
(basic.size () ); cpc::Header head ("LOADER"); head.settype (cpc::Header::Basic); head.firstblock (true); head.lastblock (true); head.setlength (basicsize); head.setblock (1); head.setblocklength (basicsize); tzx::writefilehead (out); // Write header. tzx::writeturboblockhead (out, 263); head.write (out); // Write Basic. const address maxsubblock= 256; size_t tzxdatalen= static_cast (basicsize) + maxsubblock - 1; tzxdatalen/= maxsubblock; tzxdatalen*= maxsubblock + 2; tzxdatalen+= 5; tzx::writeturboblockhead (out, tzxdatalen); out.put (0x16); // Data block identifier. out.write (basic.data (), basicsize); for (address n= basicsize ; (n % maxsubblock) != 0; ++n) out.put ('\0'); address crc= cpc::crc (reinterpret_cast (basic.data () ), basicsize); out.put (hibyte (crc) ); // CRC in hi-lo format. out.put (lobyte (crc) ); out.put (0xFF); out.put (0xFF); out.put (0xFF); out.put (0xFF); writecdtcode (out); } std::string Asm::In::spectrumbasicloader () { using namespace spectrum; std::string basic; // Line: 10 CLEAR before_min_used std::string line= tokCLEAR + number (minused - 1); basic+= basicline (10, line); // Line: 20 POKE 23610, 255 // To avoid a error message when using +3 loader. line= tokPOKE + number (23610) + ',' + number (255); basic+= basicline (20, line); // Line: 30 LOAD "" CODE line= tokLOAD + "\"\"" + tokCODE; basic+= basicline (30, line); if (hasentrypoint) { // Line: 40 RANDOMIZE USR entry_point line= tokRANDOMIZE + tokUSR + number (entrypoint); basic+= basicline (40, line); } return basic; } void Asm::In::emittapbas (std::ostream & out) { if (debugtype != NoDebug) * pout << "Emiting TAP basic loader" << endl; // Prepare the data. std::string basic (spectrumbasicloader () ); tap::BasicHeader basicheadblock (basic); tap::BasicBlock basicblock (basic); // Write the file. basicheadblock.write (out); basicblock.write (out); emittap (out); } void Asm::In::emittzxbas (std::ostream & out) { if (debugtype != NoDebug) * pout << "Emiting TZX with basic loader" << endl; // Prepare the data. std::string basic (spectrumbasicloader () ); tap::BasicHeader basicheadblock (basic); tap::BasicBlock basicblock (basic); // Write the file. tzx::writefilehead (out); tzx::writestandardblockhead (out); basicheadblock.write (out); tzx::writestandardblockhead (out); basicblock.write (out); writetzxcode (out); } void Asm::In::emithex (std::ostream & out) { message_emit ("Intel HEX"); address end= maxused + 1; for (address i= minused; i < end; i+= 16) { address len= end - i; if (len > 16) len= 16; out << ':' << hex2 (lobyte (len) ) << hex4 (i) << "00"; byte sum= len + ( (i >> 8) & 0xFF) + i & 0xFF; for (address j= 0; j < len; ++j) { byte b= mem [i + j]; out << hex2 (b); sum+= b; } out << hex2 (lobyte (0x100 - sum) ); out << "\r\n"; } out << ":00000001FF\r\n"; if (! out) throw ErrorOutput; } void Asm::In::emitamsdos (std::ostream & out) { message_emit ("Amsdos"); address codesize= getcodesize (); cpc::AmsdosHeader head (headername); head.setlength (codesize); head.setloadaddress (minused); if (hasentrypoint) head.setentry (entrypoint); head.write (out); // Write code. writebincode (out); if (! out) throw ErrorOutput; } void Asm::In::emitmsx (std::ostream & out) { message_emit ("MSX"); // Header of an MSX BLOADable disk file. byte header [7]= { 0xFE }; // Header identification byte. // Start address. header [1]= minused & 0xFF; header [2]= minused >> 8; // End address. header [3]= maxused & 0xFF; header [4]= maxused >> 8; // Exec address. address entry= 0; if (hasentrypoint) entry= entrypoint; header [5]= entry & 0xFF; header [6]= entry >> 8; // Write hader. out.write (reinterpret_cast (header), sizeof (header) ); // Write code. writebincode (out); } void Asm::In::emitprl (std::ostream & out) { message_emit ("PRL"); // Assembly with 1 page offset to obtain the information needed // to create the prl relocation table. In asmoff (* this); asmoff.setbase (0x100); asmoff.processfile (); if (minused - base != asmoff.minused - asmoff.base) throw OutOfSyncPRL; if (maxused - base != asmoff.maxused - asmoff.base) throw OutOfSyncPRL; address len= getcodesize (); address off= asmoff.base - base; // PRL header. byte prlhead [256]= { 0 }; prlhead [1]= len & 0xFF; prlhead [2]= len >> 8; out.write (reinterpret_cast (prlhead), sizeof (prlhead) ); address reloclen= (len + 7) / 8; byte * reloc= new byte [reloclen]; //memset (reloc, 0, reloclen); fill (reloc, reloc + reloclen, byte (0) ); // Build relocation bitmap. for (address i= minused; i <= maxused; ++i) { byte b= mem [i]; byte b2= asmoff.mem [i + off]; if (b != b2) { if (b2 - b != off / 256) { * perr << "off= " << hex4 (off) << ", b= " << hex2 (b) << ", b2= " << hex2 (b2) << endl; throw OutOfSyncPRL; } address pos= i - minused; static const byte mask [8]= { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 }; reloc [pos / 8]|= mask [pos % 8]; } } // Write code in position 0x0100 asmoff.writebincode (out); // Write relocation bitmap. out.write (reinterpret_cast (reloc), reloclen); if (! out) throw ErrorOutput; } namespace { class CmdGroup { public: CmdGroup (); // Create empty group CmdGroup (address lengthn); // Create Code group void put (std::ostream & out) const; private: byte type; address length; address base; address minimum; address maximum; static address para (address n); }; address CmdGroup::para (address n) { return (n + 15) / 16; } CmdGroup::CmdGroup () : type (0), length (0), base (0), minimum (0), maximum (0) { } CmdGroup::CmdGroup (address lengthn) : type (1), length (para (lengthn) + 0x0010), base (0), minimum (length), maximum (0x0FFF) { } void CmdGroup::put (std::ostream & out) const { out.put (type); putword (out, length); putword (out, base); putword (out, minimum); putword (out, maximum); } } // namespace void Asm::In::emitcmd (std::ostream & out) { message_emit ("CMD"); address codesize= getcodesize (); CmdGroup code (codesize); CmdGroup empty; // CMD header. // 8 group descriptors: 72 bytes in total. code.put (out); for (size_t i= 1; i < 8; ++i) empty.put (out); // Until 128 bytes: filled with zeroes (in this case). char fillhead [128 - 72]= { }; out.write (fillhead, sizeof (fillhead) ); // First 256 bytes of prefix in 8080 model. char prefix [256]= { }; out.write (prefix, sizeof (prefix) ); // Binary image. writebincode (out); if (! out) throw ErrorOutput; } //********************************************************* // Symbol table generation. //********************************************************* void Asm::In::dumppublic (std::ostream & out) { for (setpublic_t::iterator pit= setpublic.begin (); pit != setpublic.end (); ++pit) { mapvar_t::iterator it= mapvar.find (* pit); if (it != mapvar.end () ) { out << tablabel (it->first) << "EQU 0" << hex4 (it->second.getvalue () ) << 'H' << endl; } } } void Asm::In::dumpsymbol (std::ostream & out) { for (mapvar_t::iterator it= mapvar.begin (); it != mapvar.end (); ++it) { const VarData & vd= it->second; // Dump only EQU and label valid symbols. if (vd.def () != DefinedPass2) continue; out << tablabel (it->first) << "EQU 0" << hex4 (vd.getvalue () ) << 'H' << endl; } } //********************************************************* // class Asm //********************************************************* Asm::Asm () : pin (new In) { } Asm::~Asm () { delete pin; } void Asm::setheadername (const std::string & headername_n) { pin->setheadername (headername_n); } void Asm::verbose () { pin->verbose (); } void Asm::setdebugtype (DebugType type) { pin->setdebugtype (type); } void Asm::errtostdout () { pin->errtostdout (); } void Asm::setbase (unsigned int addr) { pin->setbase (addr); } void Asm::caseinsensitive () { pin->caseinsensitive (); } void Asm::autolocal () { pin->autolocal (); } void Asm::bracketonly () { pin->bracketonly (); } void Asm::warn8080 () { pin->warn8080 (); } void Asm::set86 () { pin->set86 (); } void Asm::addincludedir (const std::string & dirname) { pin->addincludedir (dirname); } void Asm::addpredef (const std::string & predef) { pin->addpredef (predef); } void Asm::loadfile (const std::string & filename) { pin->loadfile (filename); } void Asm::processfile () { pin->processfile (); } void Asm::emitobject (std::ostream & out) { pin->emitobject (out); } void Asm::emitplus3dos (std::ostream & out) { pin->emitplus3dos (out); } void Asm::emittap (std::ostream & out) { pin->emittap (out); } void Asm::emittzx (std::ostream & out) { pin->emittzx (out); } void Asm::emitcdt (std::ostream & out) { pin->emitcdt (out); } void Asm::emitcdtbas (std::ostream & out) { pin->emitcdtbas (out); } void Asm::emittapbas (std::ostream & out) { pin->emittapbas (out); } void Asm::emittzxbas (std::ostream & out) { pin->emittzxbas (out); } void Asm::emithex (std::ostream & out) { pin->emithex (out); } void Asm::emitamsdos (std::ostream & out) { pin->emitamsdos (out); } void Asm::emitprl (std::ostream & out) { pin->emitprl (out); } void Asm::emitcmd (std::ostream & out) { pin->emitcmd (out); } void Asm::emitmsx (std::ostream & out) { pin->emitmsx (out); } void Asm::dumppublic (std::ostream & out) { pin->dumppublic (out); } void Asm::dumpsymbol (std::ostream & out) { pin->dumpsymbol (out); } // End of asm.cpp pasmo-0.5.3/asmfile.h0000644000175000017500000000206410172234341011347 00000000000000#ifndef INCLUDE_ASMFILE_H #define INCLUDE_ASMFILE_H // asmfile.h // Revision 12-dec-2004 #include "token.h" #include #include #include class AsmFile { public: AsmFile (); AsmFile (const AsmFile & af); ~AsmFile (); void addincludedir (const std::string & dirname); void loadfile (const std::string & filename, bool nocase, std::ostream & outverb, std::ostream& outerr); size_t getline () const; protected: void openis (std::ifstream & is, const std::string & filename, std::ios::openmode mode) const; void showlineinfo (std::ostream & os, size_t nline) const; void showcurrentlineinfo (std::ostream & os) const; bool getvalidline (); bool passeof () const; Tokenizer & getcurrentline (); const std::string & getcurrenttext () const; void setline (size_t line); void setendline (); void beginline (); bool nextline (); void prevline (); private: class In; In * pin; In & in (); const In & in () const; static const size_t LINE_BEGIN= static_cast (-1); size_t currentline; }; #endif // End of asmfile.h pasmo-0.5.3/asmfile.cpp0000644000175000017500000002555710172262550011721 00000000000000// asmfile.cpp // Revision 15-jan-2005 #include "asmfile.h" #include #include using std::runtime_error; #include #define ASSERT assert namespace { class FileNotFound : public runtime_error { public: FileNotFound (const std::string & filename) : runtime_error ("File '" + filename + "' not found") { } }; class InvalidInclude : public runtime_error { public: InvalidInclude (const Token & tok) : runtime_error ("Unexpected " + tok.str () + " after INCLUDE file name") { } }; class FileLine { public: FileLine (const std::string & text_n, const Tokenizer & tkz_n, size_t linenum_n); bool empty () const; size_t numline () const; Tokenizer & gettkz (); const std::string & getstrline () const; private: std::string text; Tokenizer tkz; size_t linenum; }; FileLine::FileLine (const std::string & text_n, const Tokenizer & tkz_n, size_t linenum_n) : text (text_n), tkz (tkz_n), linenum (linenum_n) { } bool FileLine::empty () const { return tkz.empty (); } size_t FileLine::numline () const { return linenum; } Tokenizer & FileLine::gettkz () { return tkz; } const std::string & FileLine::getstrline () const { return text; } typedef std::vector filelines_t; class FileRef { public: FileRef (const std::string & name, size_t linebeg); void setend (size_t n); size_t linebegin () const; size_t lineend () const; std::string name () const; bool lineempty (size_t n) const; size_t numline (size_t n) const; Tokenizer & gettkz (size_t n); const std::string & getstrline (size_t n) const; void pushline (const std::string & text, const Tokenizer & tkz, size_t realnumline); private: std::string filename; filelines_t line; size_t l_begin; size_t l_end; }; FileRef::FileRef (const std::string & name, size_t linebeg) : filename (name), l_begin (linebeg) { } void FileRef::setend (size_t n) { l_end= n; } size_t FileRef::linebegin () const { return l_begin; } size_t FileRef::lineend () const { return l_end; } std::string FileRef::name () const { return filename; } bool FileRef::lineempty (size_t n) const { ASSERT (n < line.size () ); return line [n].empty (); } size_t FileRef::numline (size_t n) const { ASSERT (n < line.size () ); return line [n].numline (); } Tokenizer & FileRef::gettkz (size_t n) { ASSERT (n < line.size () ); return line [n].gettkz (); } const std::string & FileRef::getstrline (size_t n) const { ASSERT (n < line.size () ); return line [n].getstrline (); } void FileRef::pushline (const std::string & text, const Tokenizer & tkz, size_t realnumline) { //line.push_back (FileLine (text, tkz) ); FileLine fl (text, tkz, realnumline); line.push_back (fl); } struct LineContent { public: LineContent (size_t linenumn, size_t filenumn); size_t getfileline () const; size_t getfilenum () const; private: size_t filenum; size_t linenum; }; LineContent::LineContent (size_t filenumn, size_t linenumn) : filenum (filenumn), linenum (linenumn) { } size_t LineContent::getfileline () const { return linenum; } size_t LineContent::getfilenum () const { return filenum; } } // namespace class AsmFile::In { public: In (); void addref (); void delref (); size_t numlines () const; size_t numfiles () const; bool lineempty (size_t n) const; Tokenizer & gettkz (size_t n); const std::string & getstrline (size_t n) const; void addincludedir (const std::string & dirname); void openis (std::ifstream & is, const std::string & filename, std::ios::openmode mode) const; void copyfile (FileRef & fr, std::ostream & outverb); void loadfile (const std::string & filename, bool nocase, std::ostream & outverb, std::ostream& outerr); void showlineinfo (std::ostream & os, size_t nline) const; private: In (const In &); // Forbidden. In & operator = (const In &); // Forbidden. const FileRef & getfile (size_t n) const; FileRef & getfile (size_t n); const LineContent & getline (size_t n) const; LineContent & getline (size_t n); size_t numrefs; typedef std::vector vlinecont_t; vlinecont_t vlinecont; std::vector vfileref; void pushline (size_t linenum, size_t file); // ******** Paths for include ************ std::vector includepath; }; AsmFile::In::In () { numrefs= 1; } void AsmFile::In::addref () { ++numrefs; } void AsmFile::In::delref () { --numrefs; if (numrefs == 0) delete this; } size_t AsmFile::In::numlines () const { return vlinecont.size (); } size_t AsmFile::In::numfiles () const { return vfileref.size (); } const FileRef & AsmFile::In::getfile (size_t n) const { ASSERT (n < numfiles () ); return vfileref [n]; } FileRef & AsmFile::In::getfile (size_t n) { ASSERT (n < numfiles () ); return vfileref [n]; } const LineContent & AsmFile::In::getline (size_t n) const { ASSERT (n < numlines () ); return vlinecont [n]; } LineContent & AsmFile::In::getline (size_t n) { ASSERT (n < numlines () ); return vlinecont [n]; } bool AsmFile::In::lineempty (size_t n) const { ASSERT (n < numlines () ); //return vlinecont [n].empty (); const LineContent & lc= getline (n); return getfile (lc.getfilenum () ).lineempty (lc.getfileline () ); } Tokenizer & AsmFile::In::gettkz (size_t n) { ASSERT (n < numlines () ); //return vlinecont [n].gettkz (); LineContent & lc= getline (n); return getfile (lc.getfilenum () ).gettkz (lc.getfileline () ); } const std::string & AsmFile::In::getstrline (size_t n) const { ASSERT (n < numlines () ); //return vlinecont [n].getstrline (); const LineContent & lc= getline (n); return getfile (lc.getfilenum () ).getstrline (lc.getfileline () ); } void AsmFile::In::addincludedir (const std::string & dirname) { std::string aux (dirname); std::string::size_type l= aux.size (); if (l == 0) return; char c= aux [l - 1]; if (c != '\\' && c != '/') aux+= '/'; includepath.push_back (aux); } void AsmFile::In::openis (std::ifstream & is, const std::string & filename, std::ios::openmode mode) const { ASSERT (! is.is_open () ); is.open (filename.c_str (), mode); if (is.is_open () ) return; for (size_t i= 0; i < includepath.size (); ++i) { std::string path (includepath [i] ); path+= filename; is.clear (); is.open (path.c_str (), mode); if (is.is_open () ) return; } throw FileNotFound (filename); } void AsmFile::In::pushline (size_t filenum, size_t linenum) { ASSERT (filenum < vfileref.size () ); vlinecont.push_back (LineContent (filenum, linenum) ); } void AsmFile::In::copyfile (FileRef & fr, std::ostream & outverb) { using std::endl; outverb << "Reloading file: " << fr.name () << " in " << numlines () << endl; const size_t linebegin= fr.linebegin (); const size_t lineend= fr.lineend (); for (size_t i= linebegin; i < lineend; ++i) { LineContent l= getline (i); vlinecont.push_back (l); } outverb << "Finished reloading file: " << fr.name () << " in " << numlines () << endl; } void AsmFile::In::loadfile (const std::string & filename, bool nocase, std::ostream & outverb, std::ostream& outerr) { using std::endl; for (size_t i= 0; i < vfileref.size (); ++i) { if (vfileref [i].name () == filename) { copyfile (vfileref [i], outverb); return; } } // Load the file in memory. outverb << "Loading file: " << filename << " in " << numlines () << endl; std::ifstream file; openis (file, filename, std::ios::in); vfileref.push_back (FileRef (filename, numlines () ) ); const size_t filenum= vfileref.size () - 1; std::string line; size_t linenum; size_t realnum; try { for (linenum= 0, realnum= 0; std::getline (file, line); ++linenum, ++realnum) { Tokenizer tz (line, nocase); Token tok= tz.gettoken (); getfile (filenum).pushline (line, tz, realnum); pushline (filenum, linenum); if (tok.type () == TypeINCLUDE) { std::string includefile= tz.getincludefile (); tok= tz.gettoken (); if (tok.type () != TypeEndLine) throw InvalidInclude (tok); loadfile (includefile, nocase, outverb, outerr); Tokenizer tzaux (TypeEndOfInclude); getfile (filenum).pushline ("", tzaux, 0); ++linenum; pushline (filenum, linenum); } } getfile (filenum).setend (numlines () ); } catch (...) { outerr << "ERROR on line " << linenum + 1 << " of file " << filename << endl; throw; } outverb << "Finished loading file: " << filename << " in " << numlines () << endl; } void AsmFile::In::showlineinfo (std::ostream & os, size_t nline) const { ASSERT (nline < numlines () ); const LineContent & linf= getline (nline); const FileRef & fileref= getfile (linf.getfilenum () ); os << " on line " << fileref.numline (linf.getfileline () ) + 1 << " of file " << fileref.name (); } //******************************************************************* AsmFile::AsmFile () : pin (new In) { } AsmFile::AsmFile (const AsmFile & af) : pin (af.pin) { pin->addref (); } AsmFile::~AsmFile () { pin->delref (); } // These functions are for propagate constness to the internal class. inline AsmFile::In & AsmFile::in () { return * pin; } inline const AsmFile::In & AsmFile::in () const { return * pin; } void AsmFile::addincludedir (const std::string & dirname) { in ().addincludedir (dirname); } void AsmFile::openis (std::ifstream & is, const std::string & filename, std::ios::openmode mode) const { in ().openis (is, filename, mode); } void AsmFile::loadfile (const std::string & filename, bool nocase, std::ostream & outverb, std::ostream& outerr) { in ().loadfile (filename, nocase, outverb, outerr); } bool AsmFile::getvalidline () { for (;;) { if (currentline >= in ().numlines () ) return false; //if (! in ().getlinecont (currentline).empty () ) if (! in ().lineempty (currentline) ) return true; ++currentline; } } bool AsmFile::passeof () const { return currentline >= in ().numlines (); } size_t AsmFile::getline () const { return currentline; } Tokenizer & AsmFile::getcurrentline () { ASSERT (! passeof () ); //Tokenizer & tz= in ().getlinecont (currentline).gettkz (); Tokenizer & tz= in ().gettkz (currentline); tz.reset (); return tz; } const std::string & AsmFile::getcurrenttext () const { ASSERT (! passeof () ); //return in ().getlinecont (currentline).getstrline (); return in ().getstrline (currentline); } void AsmFile::setline (size_t line) { currentline= line; } void AsmFile::setendline () { currentline= in ().numlines (); } void AsmFile::beginline () { currentline= LINE_BEGIN; } bool AsmFile::nextline () { if (currentline == LINE_BEGIN) currentline= 0; else { if (passeof () ) return false; ++currentline; } if (! getvalidline () ) return false; return true; } void AsmFile::prevline () { ASSERT (currentline > 0); --currentline; } void AsmFile::showlineinfo (std::ostream & os, size_t nline) const { in ().showlineinfo (os, nline); } void AsmFile::showcurrentlineinfo (std::ostream & os) const { if (passeof () ) os << " detected after end of file"; else in ().showlineinfo (os, getline () ); } // End of asmfile.cpp pasmo-0.5.3/cpc.h0000644000175000017500000000270110155650671010503 00000000000000#ifndef INCLUDE_CPCCRC_H #define INCLUDE_CPCCRC_H // cpc.h // Revision 5-dec-2004 #include #include "pasmotypes.h" namespace cpc { unsigned short crc (const unsigned char * data, size_t size); class Header { public: Header (); Header (const std::string & filename); enum Type { Basic, Binary }; void clear (); void setfilename (const std::string & filename); void settype (Type type); void setblock (byte n); void firstblock (bool isfirst); void lastblock (bool islast); void setlength (address len); void setblocklength (address blen); void setloadaddress (address load); void setentry (address entry); void write (std::ostream & out); private: static const size_t headsize= 64; byte data [headsize]; }; class AmsdosHeader { public: AmsdosHeader (); AmsdosHeader (const std::string & filename); void clear (); void setfilename (const std::string & filename); void setlength (address len); void setloadaddress (address load); void setentry (address entry); void write (std::ostream & out); private: static const size_t headsize= 128; byte amsdos [headsize]; }; // CPC Locomotive Basic generation. extern const std::string tokHexNumber; extern const std::string tokCALL; extern const std::string tokLOAD; extern const std::string tokMEMORY; std::string number (address n); std::string hexnumber (address n); std::string basicline (address linenum, const std::string & line); } // namespace cpc #endif // End of cpc.h pasmo-0.5.3/cpc.cpp0000644000175000017500000001123210157346503011033 00000000000000// cpc.cpp // Revision 13-dec-2004 #include "cpc.h" #include #include #include using std::fill; using std::logic_error; // This routine is adapted from 2CDT from Kevin Thacker // (at his time taken from Pierre Guerrier's AIFF decoder). unsigned short cpc::crc (const unsigned char * data, size_t size) { typedef unsigned short word; typedef unsigned char byte; const word crcinitial= 0xFFFF; const word crcpoly= 0x1021; const word crcfinalxor= 0xFFFF; const size_t cpcchunksize= 256; word crc= crcinitial; for (size_t n= 0; n < cpcchunksize; ++n) { char c= n < size ? data [n] : 0; crc^= (static_cast (c) << 8); for (size_t i= 0; i < 8; ++i) { if (crc & 0x8000) crc= (crc << 1) ^ crcpoly; else crc<<= 1; } } crc^= crcfinalxor; return crc; } cpc::Header::Header () { clear (); } cpc::Header::Header (const std::string & filename) { clear (); setfilename (filename); } void cpc::Header::clear () { //memset (data, 0, headsize); fill (data, data + headsize, byte (0) ); } void cpc::Header::setfilename (const std::string & filename) { std::string::size_type l= filename.size (); if (l > 16) l= 16; for (std::string::size_type i= 0; i < l; ++i) data [i]= filename [i]; for (std::string::size_type i= l; i < 16; ++i) data [i]= '\0'; } void cpc::Header::settype (Type type) { byte b; switch (type) { case Basic: b= 0; break; case Binary: b= 2; break; default: throw logic_error ("Unexpected CPC file type"); } data [0x12]= b; } void cpc::Header::setblock (byte n) { data [0x010]= n; } void cpc::Header::firstblock (bool isfirst) { data [0x17]= isfirst ? 0xFF : 0x00; } void cpc::Header::lastblock (bool islast) { data [0x11]= islast ? 0xFF : 0x00; } void cpc::Header::setlength (address len) { data [0x18]= lobyte (len); data [0x19]= hibyte (len); } void cpc::Header::setblocklength (address blen) { data [0x13]= lobyte (blen); data [0x14]= hibyte (blen); } void cpc::Header::setloadaddress (address load) { data [0x15]= lobyte (load); data [0x16]= hibyte (load); } void cpc::Header::setentry (address entry) { data [0x1A]= lobyte (entry); data [0x1B]= hibyte (entry); } void cpc::Header::write (std::ostream & out) { out.put (0x2C); // Header identifier. out.write (reinterpret_cast (data), headsize); for (size_t i= headsize; i < 256; ++i) out.put ('\x00'); address crcword= crc (data, headsize); out.put (hibyte (crcword) ); // CRC in hi-lo format. out.put (lobyte (crcword) ); out.put (0xFF); out.put (0xFF); out.put (0xFF); out.put (0xFF); } cpc::AmsdosHeader::AmsdosHeader () { clear (); } cpc::AmsdosHeader::AmsdosHeader (const std::string & filename) { clear (); setfilename (filename); } void cpc::AmsdosHeader::clear () { //memset (amsdos, 0, headsize); fill (amsdos, amsdos + headsize, byte (0) ); amsdos [0x12]= 2; // File type: binary. } void cpc::AmsdosHeader::setfilename (const std::string & filename) { amsdos [0]= 0; // User number. // 01-0F: filename, padded with 0. std::string::size_type l= filename.size (); if (l > 15) l= 15; for (std::string::size_type i= 0; i < l; ++i) amsdos [i + 1]= filename [i]; for (std::string::size_type i= l; i < 15; ++i) amsdos [i + 1]= '\0'; } void cpc::AmsdosHeader::setlength (address len) { // 18-19: logical length. amsdos [0x18]= lobyte (len); amsdos [0x19]= hibyte (len); // 40-42: real length of file. amsdos [0x40]= lobyte (len); amsdos [0x41]= hibyte (len); amsdos [0x42]= 0; } void cpc::AmsdosHeader::setloadaddress (address load) { // 15-16: Load address. amsdos [0x15]= lobyte (load); amsdos [0x16]= hibyte (load); } void cpc::AmsdosHeader::setentry (address entry) { // 1A-1B: Entry address. amsdos [0x1A]= lobyte (entry); amsdos [0x1B]= hibyte (entry); } void cpc::AmsdosHeader::write (std::ostream & out) { // 43-44 checksum of bytes 00-42 address check= 0; for (int i= 0; i < 0x43; ++i) check+= amsdos [i]; amsdos [0x43]= lobyte (check); amsdos [0x44]= hibyte (check); // Write header. out.write (reinterpret_cast (amsdos), headsize); } // CPC Locomotive Basic generation. const std::string cpc::tokHexNumber (1, '\x1C'); const std::string cpc::tokCALL (1, '\x83'); const std::string cpc::tokLOAD (1, '\xA8'); const std::string cpc::tokMEMORY (1, '\xAA'); std::string cpc::number (address n) { std::string r (1, lobyte (n) ); r+= hibyte (n); return r; } std::string cpc::hexnumber (address n) { return tokHexNumber + number (n); } std::string cpc::basicline (address linenum, const std::string & line) { address linelen= static_cast
(line.size () + 5); return number (linelen) + number (linenum) + line + '\0'; } // End of cpc.cpp pasmo-0.5.3/pasmo.cpp0000644000175000017500000002053010552443106011402 00000000000000// pasmo.cpp // Revision 14-jan-2007 #include "asm.h" #include #include #include #include #include using std::cout; using std::cerr; using std::endl; namespace { using std::string; using std::vector; using std::runtime_error; const string pasmoversion (VERSION); class Usage { }; class NeedArgument : public runtime_error { public: NeedArgument (const string & option) : runtime_error ("Option " + option + " requires argument") { } }; class InvalidOption : public runtime_error { public: InvalidOption (const string & option) : runtime_error ("Invalid option: " + option) { } }; runtime_error CreateObjectError ("Error creating object file"); runtime_error SymbolFileError ("Error creating symbols file"); runtime_error PublicFileError ("Error creating public symbols file"); std::ostream * perr= & cerr; const string opt1 ("-1"); const string opt8 ("-8"); const string optd ("-d"); const string optv ("-v"); const string optB ("-B"); const string optE ("-E"); const string optI ("-I"); const string opt86 ("--86"); const string optalocal ("--alocal"); const string optamsdos ("--amsdos"); const string optbin ("--bin"); const string optbracket ("--bracket"); const string optcdt ("--cdt"); const string optcdtbas ("--cdtbas"); const string optcmd ("--cmd"); const string optequ ("--equ"); const string opterr ("--err"); const string opthex ("--hex"); const string optmsx ("--msx"); const string optname ("--name"); const string optnocase ("--nocase"); const string optplus3dos ("--plus3dos"); const string optprl ("--prl"); const string optpublic ("--public"); const string opttap ("--tap"); const string opttapbas ("--tapbas"); const string opttzx ("--tzx"); const string opttzxbas ("--tzxbas"); const string optw8080 ("--w8080"); class Options { public: Options (int argc, char * * argv); typedef void (Asm::* emitfunc_t) (std::ostream &); emitfunc_t getemit () const { return emitfunc; } bool redirerr () const { return redirecterr; } bool publiconly () const { return emitpublic; } string getfilein () const { return filein; } string getfileout () const { return fileout; } string getfilesymbol () const { return filesymbol; } string getfilepublic () const; string getheadername () const { return headername; } void apply (Asm & assembler) const; private: emitfunc_t emitfunc; static const emitfunc_t emitdefault; bool verbose; bool emitpublic; Asm::DebugType debugtype; bool redirecterr; bool nocase; bool autolocal; bool bracketonly; bool warn8080; bool mode86; vector includedir; vector labelpredef; string filein; string fileout; string filesymbol; string filepublic; string headername; }; const Options::emitfunc_t Options::emitdefault (& Asm::emitobject); Options::Options (int argc, char * * argv) : emitfunc (emitdefault), verbose (false), emitpublic (false), debugtype (Asm::NoDebug), redirecterr (false), nocase (false), autolocal (false), bracketonly (false), warn8080 (false), mode86 (false) { int argpos; for (argpos= 1; argpos < argc; ++argpos) { const string arg (argv [argpos] ); if (arg == optbin) emitfunc= & Asm::emitobject; else if (arg == opthex) emitfunc= & Asm::emithex; else if (arg == optprl) emitfunc= & Asm::emitprl; else if (arg == optcmd) emitfunc= & Asm::emitcmd; else if (arg == optplus3dos) emitfunc= & Asm::emitplus3dos; else if (arg == opttap) emitfunc= & Asm::emittap; else if (arg == opttzx) emitfunc= & Asm::emittzx; else if (arg == optcdt) emitfunc= & Asm::emitcdt; else if (arg == opttapbas) emitfunc= & Asm::emittapbas; else if (arg == opttzxbas) emitfunc= & Asm::emittzxbas; else if (arg == optcdtbas) emitfunc= & Asm::emitcdtbas; else if (arg == optamsdos) emitfunc= & Asm::emitamsdos; else if (arg == optmsx) emitfunc= & Asm::emitmsx; else if (arg == optpublic) emitpublic= true; else if (arg == optname) { ++argpos; if (argpos >= argc) throw NeedArgument (optname); headername= argv [argpos]; } else if (arg == optv) verbose= true; else if (arg == optd) debugtype= Asm::DebugSecondPass; else if (arg == opt1) debugtype= Asm::DebugAll; else if (arg == opterr) redirecterr= true; else if (arg == optnocase) nocase= true; else if (arg == optalocal) autolocal= true; else if (arg == optB) bracketonly= true; else if (arg == optbracket) bracketonly= true; else if (arg == opt8 || arg == optw8080) warn8080= true; else if (arg == opt86) mode86= true; else if (arg == optI) { ++argpos; if (argpos >= argc) throw NeedArgument (optI); //a.addincludedir (argv [argpos] ); includedir.push_back (argv [argpos] ); } else if (arg == optE || arg == optequ) { ++argpos; if (argpos >= argc) throw NeedArgument (arg); labelpredef.push_back (argv [argpos] ); } else if (arg == "--") { ++argpos; break; } else if (arg.substr (0, 1) == "-") throw InvalidOption (arg); else break; } // File parameters. if (argpos >= argc) throw Usage (); filein= argv [argpos]; ++argpos; if (argpos >= argc) throw Usage (); fileout= argv [argpos]; ++argpos; if (argpos < argc) { filesymbol= argv [argpos]; ++argpos; if (! emitpublic && argpos < argc) { filepublic= argv [argpos]; ++argpos; } if (argpos < argc) cerr << "WARNING: Extra arguments ignored" << endl; } if (headername.empty () ) headername= fileout; } string Options::getfilepublic () const { if (emitpublic) return filesymbol; else return filepublic; } void Options::apply (Asm & assembler) const { assembler.setdebugtype (debugtype); if (verbose) assembler.verbose (); if (redirecterr) assembler.errtostdout (); if (nocase) assembler.caseinsensitive (); if (autolocal) assembler.autolocal (); if (bracketonly) assembler.bracketonly (); if (warn8080) assembler.warn8080 (); if (mode86) assembler.set86 (); for (size_t i= 0; i < includedir.size (); ++i) assembler.addincludedir (includedir [i] ); for (size_t i= 0; i < labelpredef.size (); ++i) assembler.addpredef (labelpredef [i] ); assembler.setheadername (headername); } int doit (int argc, char * * argv) { // Process command line options. Options option (argc, argv); if (option.redirerr () ) perr= & cout; // Assemble. Asm assembler; option.apply (assembler); assembler.loadfile (option.getfilein () ); assembler.processfile (); // Generate ouptut file. std::ofstream out (option.getfileout ().c_str (), std::ios::out | std::ios::binary); if (! out.is_open () ) throw CreateObjectError; (assembler.* option.getemit () ) (out); out.close (); // Generate symbol table and public symbol table if required. string filesymbol= option.getfilesymbol (); if (! option.publiconly () && ! filesymbol.empty () ) { std::ofstream sout; std::streambuf * cout_buf= 0; if (filesymbol != "-") { sout.open (filesymbol.c_str () ); if (! sout.is_open () ) throw SymbolFileError; cout_buf= cout.rdbuf (); cout.rdbuf (sout.rdbuf () ); } assembler.dumpsymbol (cout); if (cout_buf) { cout.rdbuf (cout_buf); sout.close (); } } string filepublic= option.getfilepublic (); if (! filepublic.empty () ) { std::ofstream sout; std::streambuf * cout_buf= 0; if (filepublic != "-") { sout.open (filepublic.c_str () ); if (! sout.is_open () ) throw PublicFileError; cout_buf= cout.rdbuf (); cout.rdbuf (sout.rdbuf () ); } assembler.dumppublic (cout); if (cout_buf) { cout.rdbuf (cout_buf); sout.close (); } } return 0; } } // namespace int main (int argc, char * * argv) { // Just call doit and show possible errors. try { return doit (argc, argv); } catch (std::logic_error & e) { * perr << "ERROR: " << e.what () << endl << "This error is unexpected, please " "send a bug report." << endl; } catch (std::exception & e) { * perr << "ERROR: " << e.what () << endl; } catch (Usage &) { cerr << "Pasmo v. " << pasmoversion << " (C) 2004-2005 Julian Albo\n\n" "Usage:\n\n" "\tpasmo [options] source object [symbol]\n\n" "See the README file for details.\n"; } catch (...) { cerr << "ERROR: Unexpected exception.\n" "Please send a bug report.\n"; } // Added to fix Debian bug report #394733 return 1; } // End of pasmo.cpp pasmo-0.5.3/pasmotypes.h0000644000175000017500000000366610155650670012154 00000000000000#ifndef INCLUDE_PASMOTYPES_H #define INCLUDE_PASMOTYPES_H // pasmotypes.h // Revision 8-dec-2004 #include #include #include #include #if USHRT_MAX == 65535 typedef unsigned short address; #else // Using the C99 types, hoping they will be available. #include typedef uint16_t address: #endif #if UCHAR_MAX == 255 typedef unsigned char byte; typedef signed char sbyte; #else #include typedef uint8_t byte; typedef int8_t sbyte; #endif inline byte lobyte (address n) { return static_cast (n & 0xFF); } inline byte hibyte (address n) { return static_cast (n >> 8); } inline void putword (std::ostream & os, address word) { os.put (lobyte (word) ); os.put (hibyte (word) ); } std::string hex2str (byte b); std::string hex4str (address n); std::string hex8str (size_t nn); inline std::string hex2str (sbyte b) { return hex2str (static_cast (b) ); } inline std::string hex2str (char b) { return hex2str (static_cast (b) ); } class Hex2 { public: Hex2 (byte b) : b (b) { } byte getb () const { return b; } std::string str () const; private: byte b; }; class Hex4 { public: Hex4 (address n) : n (n) { } address getn () const { return n; } std::string str () const; private: address n; }; class Hex8 { public: Hex8 (size_t nn) : nn (nn) { } size_t getnn () const { return nn; } std::string str () const; private: size_t nn; }; inline Hex2 hex2 (byte b) { return Hex2 (b); } inline Hex2 hex2 (sbyte b) { return Hex2 (static_cast (b) ); } inline Hex2 hex2 (char b) { return Hex2 (static_cast (b) ); } inline Hex4 hex4 (address n) { return Hex4 (n); } inline Hex8 hex8 (size_t nn) { return Hex8 (nn); } std::ostream & operator << (std::ostream & os, const Hex2 & h2); std::ostream & operator << (std::ostream & os, const Hex4 & h4); std::ostream & operator << (std::ostream & os, const Hex8 & h8); #endif // End of pasmotypes.h pasmo-0.5.3/pasmotypes.cpp0000644000175000017500000000176110155650670012501 00000000000000// pasmotypes.cpp // Revision 8-dec-2004 #include "pasmotypes.h" namespace { const char hexdigit []= { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; } // namespace std::string hex2str (byte b) { return std::string (1, hexdigit [ (b >> 4) & 0x0F] ) + hexdigit [b & 0x0F]; } std::string hex4str (address n) { return hex2str (hibyte (n) ) + hex2str (lobyte (n) ); } std::string hex8str (size_t nn) { return hex4str ( (nn >> 16) & 0xFFFF) + hex4str (nn & 0xFFFF); } std::string Hex2::str () const { return hex2str (b); } std::string Hex4::str () const { return hex4str (n); } std::string Hex8::str () const { return hex8str (nn); } std::ostream & operator << (std::ostream & os, const Hex2 & h2) { os << h2.str (); return os; } std::ostream & operator << (std::ostream & os, const Hex4 & h4) { os << h4.str (); return os; } std::ostream & operator << (std::ostream & os, const Hex8 & h8) { os << h8.str (); return os; } // End of pasmotypes.cpp pasmo-0.5.3/spectrum.h0000644000175000017500000000162410155650671011603 00000000000000#ifndef INCLUDE_SPECTRUM_H #define INCLUDE_SPECTRUM_H // spectrum.h // Revision 5-dec-2004 #include "pasmotypes.h" #include namespace spectrum { class Plus3Head { public: Plus3Head (); void setsize (address size); void setstart (address start); void write (std::ostream & out); private: static const size_t headsize= 128; byte plus3 [headsize]; }; // Spectrum Basic generation. extern const std::string tokNumPrefix; extern const std::string tokEndLine; extern const std::string tokCODE; extern const std::string tokUSR; extern const std::string tokLOAD; extern const std::string tokPOKE; extern const std::string tokRANDOMIZE; extern const std::string tokCLEAR; std::string number (address n); std::string linenumber (address n); std::string linelength (address n); std::string basicline (address linenum, const std::string & line); } // namespace spectrum #endif // End of spectrum.h pasmo-0.5.3/spectrum.cpp0000644000175000017500000000527710157346725012152 00000000000000// spectrum.cpp // Revision 13-dec-2004 #include "spectrum.h" #include #include using std::fill; using std::copy; spectrum::Plus3Head::Plus3Head () { static const byte ident []= { 'P', 'L', 'U', 'S', '3', 'D', 'O', 'S', // Identifier. 0x1A, // CP/M EOF. 1, // Issue number. 0, // Version number. }; //memset (plus3, 0, headsize); fill (plus3, plus3 + headsize, byte (0) ); //memcpy (plus3, ident, sizeof (ident) ); copy (ident, ident + sizeof (ident), plus3); plus3 [15]= 3; // Type: code. plus3 [20]= 0x80; // Don't know if used for something. plus3 [21]= 0x80; } void spectrum::Plus3Head::setsize (address size) { size_t filesize= size + 128; // Size of file including code and header. plus3 [11]= filesize & 0xFF; plus3 [12]= (filesize >> 8) & 0xFF; plus3 [13]= (filesize >> 16) & 0xFF; plus3 [14]= (filesize >> 24) & 0xFF; // Size of code. plus3 [16]= lobyte (size); plus3 [17]= hibyte (size); } void spectrum::Plus3Head::setstart (address start) { // Start address. plus3 [18]= lobyte (start); plus3 [19]= hibyte (start); } void spectrum::Plus3Head::write (std::ostream & out) { // Checksum byte check= 0; for (int i= 0; i < 127; ++i) check+= plus3 [i]; plus3 [127]= check; // Write the header. out.write (reinterpret_cast (plus3), headsize); } // Spectrum Basic generation. const std::string spectrum::tokNumPrefix (1, '\x0E'); const std::string spectrum::tokEndLine (1, '\x0D'); const std::string spectrum::tokCODE (1, '\xAF'); const std::string spectrum::tokUSR (1, '\xC0'); const std::string spectrum::tokLOAD (1, '\xEF'); const std::string spectrum::tokPOKE (1, '\xF4'); const std::string spectrum::tokRANDOMIZE (1, '\xF9'); const std::string spectrum::tokCLEAR (1, '\xFD'); std::string spectrum::number (address n) { std::ostringstream oss; oss << n; std::string str (oss.str () ); str+= tokNumPrefix; // Special format of Spectrum numbers for integers. str+= '\x00'; str+= '\x00'; //str+= static_cast (n & 0xFF); //str+= static_cast (n >> 8); str+= static_cast (lobyte (n) ); str+= static_cast (hibyte (n) ); str+= '\x00'; return str; } std::string spectrum::linenumber (address n) { std::string str (1, hibyte (n) ); str+= lobyte (n); return str; } std::string spectrum::linelength (address n) { std::string str (1, lobyte (n) ); str+= hibyte (n); return str; } std::string spectrum::basicline (address linenum, const std::string & line) { std::string result (linenumber (linenum) ); result+= linelength (static_cast
(line.size () ) + 1); result+= line; result+= tokEndLine; return result; } // End of spectrum.cpp pasmo-0.5.3/tap.h0000644000175000017500000000170410155650671010524 00000000000000#ifndef INCLUDE_TAP_H #define INCLUDE_TAP_H // tap.h // Revision 4-dec-2004 #include "pasmotypes.h" #include namespace tap { class CodeHeader { public: CodeHeader (address init, address size, const std::string & filename); void write (std::ostream & out) const; address size () const { return sizeof (block); } private: byte block [21]; }; class CodeBlock { public: CodeBlock (address sizen, const byte * datan); void write (std::ostream & out) const; address size () const; private: address datasize; const byte * data; byte head [3]; byte check; }; class BasicHeader { public: BasicHeader (const std::string & basic); void write (std::ostream & out) const; private: byte block [21]; }; class BasicBlock { public: BasicBlock (const std::string & basicn); void write (std::ostream & out) const; private: const std::string & basic; address basicsize; byte block [3]; byte check; }; } // namespace tap #endif // End of tap.h pasmo-0.5.3/tap.cpp0000644000175000017500000000640610157347344011065 00000000000000// tap.cpp // Revision 13-dec-2004 #include "tap.h" #include using std::fill; tap::CodeHeader::CodeHeader (address init, address size, const std::string & filename) { //memset (block, 0, sizeof (block) ); fill (block, block + sizeof (block), byte (0) ); block [0]= 19; // Length of block: 17 bytes + flag + checksum block [1]= 0; block [2]= 0; // Flag: 00 -> header block [3]= 3; // Type: code block. // File name. std::string::size_type l= filename.size (); if (l > 10) l= 10; for (std::string::size_type i= 0; i < 10; ++i) block [4 + i]= i < l ? filename [i] : ' '; // Length of the code block. block [14]= lobyte (size); block [15]= hibyte (size); // Start of the code block. block [16]= lobyte (init); block [17]= hibyte (init); // Parameter 2: 32768 in a code block. block [18]= 0x00; block [19]= 0x80; // Checksum byte check= block [2]; // Flag byte included. for (int i= 3; i < 20; ++i) check^= block [i]; block [20]= check; } void tap::CodeHeader::write (std::ostream & out) const { out.write (reinterpret_cast (block), sizeof (block) ); } tap::CodeBlock::CodeBlock (address sizen, const byte * datan) : datasize (sizen), data (datan) { address blocksize= datasize + 2; // Code + flag + checksum. head [0]= lobyte (blocksize); head [1]= hibyte (blocksize); head [2]= 0xFF; // Flag: data block. // Compute the checksum. check= 0xFF; // Flag byte included. for (int i= 0; i < datasize; ++i) check^= data [i]; } void tap::CodeBlock::write (std::ostream & out) const { out.write (reinterpret_cast (head), sizeof (head) ); out.write (reinterpret_cast (data), datasize); out.write (reinterpret_cast (& check), 1); } address tap::CodeBlock::size () const { return datasize + sizeof (head) + 1; } tap::BasicHeader::BasicHeader (const std::string & basic) { block [0]= 19; block [1]= 0; block [2]= 0; // Flag: header. block [3]= 0; // Type: Basic block. for (int i= 0; i < 10; ++i) block [4 + i]= "loader " [i]; // Length of the basic block. const address basicsize= static_cast
(basic.size () ); block [14]= lobyte (basicsize); block [15]= hibyte (basicsize); // Autostart in line 10. block [16]= '\x0A'; block [17]= '\x00'; // Start of variable area: at the end. block [18]= block [14]; block [19]= block [15]; // Checksum byte check= block [2]; // Flag byte included. for (int i= 3; i < 20; ++i) check^= block [i]; block [20]= check; } void tap::BasicHeader::write (std::ostream & out) const { out.write (reinterpret_cast (block), sizeof (block) ); } tap::BasicBlock::BasicBlock (const std::string & basicn) : basic (basicn), basicsize (static_cast
(basic.size () ) ) { address blocksize= basicsize + 2; // Code + flag + checksum. block [0]= blocksize & 0xFF; block [1]= blocksize >> 8; block [2]= 0xFF; // Flag: data block. // Compute the checksum. check= 0xFF; // Flag byte included. for (int i= 0; i < basicsize; ++i) check^= static_cast (basic [i]); } void tap::BasicBlock::write (std::ostream & out) const { out.write (reinterpret_cast (block), sizeof (block) ); out.write (basic.data (), basicsize); out.write (reinterpret_cast (& check), 1); } // End of tap.cpp pasmo-0.5.3/token.h0000644000175000017500000000673510172235703011063 00000000000000#ifndef INCLUDE_TOKEN_H #define INCLUDE_TOKEN_H // token.h // Revision 15-jan-2005 #include #include #include "pasmotypes.h" enum TypeToken { TypeUndef= 0, TypeEndLine= 1, // Single char operators. TypeComma= ',', TypeColon= ':', TypePlus= '+', TypeMinus= '-', TypeMult= '*', TypeDiv= '/', TypeEqOp= '=', TypeOpen= '(', TypeClose= ')', TypeOpenBracket= '[', TypeCloseBracket= ']', TypeDollar= '$', TypeMod= '%', TypeLtOp= '<', TypeGtOp= '>', TypeBitNotOp= '~', TypeBoolNotOp= '!', TypeBitAnd= '&', TypeBitOr= '|', TypeQuestion= '?', TypeSharp= '#', // Literals. TypeIdentifier= 0x100, TypeLiteral, TypeNumber, // Special tokens. TypeEndOfInclude, // Not single char operators. TypeMOD, TypeFirstName= TypeMOD, TypeSHL, TypeShlOp, TypeSHR, TypeShrOp, TypeNOT, // AND, OR and XOR are nemonics. TypeEQ, TypeLT, TypeLE, TypeLeOp, TypeGT, TypeGE, TypeGeOp, TypeNE, TypeNeOp, TypeNUL, TypeDEFINED, TypeHIGH, TypeLOW, TypeBoolAnd, TypeBoolOr, TypeSharpSharp, // Nemonics TypeADC, TypeADD, TypeAND, TypeBIT, TypeCALL, TypeCCF, TypeCP, TypeCPD, TypeCPDR, TypeCPI, TypeCPIR, TypeCPL, TypeDAA, TypeDEC, TypeDI, TypeDJNZ, TypeEI, TypeEX, TypeEXX, TypeHALT, TypeIM, TypeIN, TypeINC, TypeIND, TypeINDR, TypeINI, TypeINIR, TypeJP, TypeJR, TypeLD, TypeLDD, TypeLDDR, TypeLDI, TypeLDIR, TypeNEG, TypeNOP, TypeOR, TypeOTDR, TypeOTIR, TypeOUT, TypeOUTD, TypeOUTI, TypePOP, TypePUSH, TypeRES, TypeRET, TypeRETI, TypeRETN, TypeRL, TypeRLA, TypeRLC, TypeRLCA, TypeRLD, TypeRR, TypeRRA, TypeRRC, TypeRRCA, TypeRRD, TypeRST, TypeSBC, TypeSCF, TypeSET, TypeSLA, TypeSLL, TypeSRA, TypeSRL, TypeSUB, TypeXOR, // Registers // C is listed as flag. TypeA, TypeAF, TypeAFp, // AF' TypeB, TypeBC, TypeD, TypeE, TypeDE, TypeH, TypeL, TypeHL, TypeSP, TypeIX, TypeIXH, TypeIXL, TypeIY, TypeIYH, TypeIYL, TypeI, TypeR, // Flags TypeNZ, TypeZ, TypeNC, TypeC, TypePO, TypePE, TypeP, TypeM, // Directives TypeDEFB, TypeDB, TypeDEFM, TypeDEFW, TypeDW, TypeDEFS, TypeDS, TypeEQU, TypeDEFL, TypeORG, TypeINCLUDE, TypeINCBIN, TypeIF, TypeELSE, TypeENDIF, TypePUBLIC, TypeEND, TypeLOCAL, TypePROC, TypeENDP, TypeMACRO, TypeENDM, TypeEXITM, TypeREPT, TypeIRP, // Directives with . Type_ERROR, Type_WARNING, Type_SHIFT, // Last used type number. TypeLastName= Type_SHIFT }; std::string gettokenname (TypeToken tt); class Token { public: Token (); Token (TypeToken ttn); Token (address n); Token (TypeToken ttn, const std::string & sn); TypeToken type () const; std::string str () const; address num () const; private: TypeToken tt; std::string s; address number; }; std::ostream & operator << (std::ostream & oss, const Token & tok); class Tokenizer { public: Tokenizer (); Tokenizer (bool nocase_n); Tokenizer (TypeToken ttok); Tokenizer (const Tokenizer & tz); Tokenizer (const std::string & line, bool nocase_n); ~Tokenizer (); Tokenizer & operator = (const Tokenizer &); bool getnocase () const { return nocase; } void push_back (const Token & tok); bool empty () const; bool endswithparen () const; void reset (); Token gettoken (); void ungettoken (); std::string getincludefile (); friend std::ostream & operator << (std::ostream & oss, const Tokenizer & tz); private: typedef std::deque tokenlist_t; tokenlist_t tokenlist; tokenlist_t::iterator current; size_t endpassed; bool nocase; }; #endif // End of token.h pasmo-0.5.3/token.cpp0000644000175000017500000004540210172232162011404 00000000000000// token.cpp // Revision 15-jan-2005 #include "token.h" #include #include #include #include #include #include #include #include #include #include #define ASSERT assert using std::cout; using std::cerr; using std::endl; using std::istringstream; using std::ostringstream; using std::for_each; using std::runtime_error; using std::logic_error; //********************************************************* // Auxiliary functions and constants. //********************************************************* namespace { std::string upper (const std::string & str) { std::string r; const std::string::size_type l= str.size (); for (std::string::size_type i= 0; i < l; ++i) r+= toupper (str [i] ); return r; } typedef std::map tmap_t; tmap_t tmap; typedef std::map invmap_t; invmap_t invmap; struct NameType { const char * const str; const TypeToken type; NameType (const char * str, TypeToken type) : str (str), type (type) { } }; #define NT(n) NameType (#n, Type ## n) #define NT_(n) NameType ("." #n, Type_ ## n) const NameType nt []= { // Operators NT (MOD), NT (SHL), NameType ("<<", TypeShlOp), NT (SHR), NameType (">>", TypeShrOp), NT (NOT), NT (EQ), NT (LT), NT (LE), NameType ("<=", TypeLeOp), NT (GT), NT (GE), NameType (">=", TypeGeOp), NT (NE), NameType ("!=", TypeNeOp), NT (NUL), NT (DEFINED), NT (HIGH), NT (LOW), NameType ("&&", TypeBoolAnd), NameType ("||", TypeBoolOr), NameType ("##", TypeSharpSharp), // Nemonics NT (ADC), NT (ADD), NT (AND), NT (BIT), NT (CALL), NT (CCF), NT (CP), NT (CPD), NT (CPDR), NT (CPI), NT (CPIR), NT (CPL), NT (DAA), NT (DEC), NT (DI), NT (DJNZ), NT (EI), NT (EX), NT (EXX), NT (HALT), NT (IM), NT (IN), NT (INC), NT (IND), NT (INDR), NT (INI), NT (INIR), NT (JP), NT (JR), NT (LD), NT (LDD), NT (LDDR), NT (LDI), NT (LDIR), NT (NEG), NT (NOP), NT (OR), NT (OTDR), NT (OTIR), NT (OUT), NT (OUTD), NT (OUTI), NT (POP), NT (PUSH), NT (RES), NT (RET), NT (RETI), NT (RETN), NT (RL), NT (RLA), NT (RLC), NT (RLCA), NT (RLD), NT (RR), NT (RRA), NT (RRC), NT (RRCA), NT (RRD), NT (RST), NT (SBC), NT (SCF), NT (SET), NT (SLA), NT (SLL), NT (SRA), NT (SRL), NT (SUB), NT (XOR), // Registers. // C is listed as flag. NT (A), NT (AF), NameType ("AF'", TypeAFp), NT (B), NT (BC), NT (D), NT (E), NT (DE), NT (H), NT (L), NT (HL), NT (SP), NT (IX), NT (IXH), NT (IXL), NT (IY), NT (IYH), NT (IYL), NT (I), NT (R), // Flags NT (NZ), NT (Z), NT (NC), NT (C), NT (PO), NT (PE), NT (P), NT (M), // Directives NT (DEFB), NT (DB), NT (DEFM), NT (DEFW), NT (DW), NT (DEFS), NT (DS), NT (EQU), NT (DEFL), NT (ORG), NT (INCLUDE), NT (INCBIN), NT (IF), NT (ELSE), NT (ENDIF), NT (PUBLIC), NT (END), NT (LOCAL), NT (PROC), NT (ENDP), NT (MACRO), NT (ENDM), NT (EXITM), NT (REPT), NT (IRP), // Directives with . NT_ (ERROR), NT_ (WARNING), NT_ (SHIFT) }; class mapiniter { mapiniter (); static mapiniter instance; }; mapiniter mapiniter::instance; mapiniter::mapiniter () { #ifndef NDEBUG bool typeused [TypeLastName + 1]= { false }; bool checkfailed= false; #endif for (const NameType * p= nt; p != nt + (sizeof (nt) / sizeof (nt [0] ) ); ++p) { TypeToken tt= p->type; #ifndef NDEBUG ASSERT (tt >= TypeFirstName); ASSERT (tt <= TypeLastName); if (typeused [tt] ) { cerr << "Type " << tt << " duplicated" << endl; checkfailed= true; } typeused [tt]= true; #endif tmap [p->str]= tt; invmap [tt]= p->str; } #ifndef NDEBUG for (TypeToken tt= TypeFirstName; tt <= TypeLastName; tt= TypeToken (tt + 1) ) { if (! typeused [tt] ) { cerr << "Type " << tt << " unasigned" << endl; checkfailed= true; } } ASSERT (! checkfailed); #endif } TypeToken getliteraltoken (const std::string & str) { tmap_t::iterator it= tmap.find (upper (str) ); if (it != tmap.end () ) return it->second; else return TypeUndef; } } // namespace std::string gettokenname (TypeToken tt) { invmap_t::iterator it= invmap.find (tt); if (it != invmap.end () ) return it->second; else return std::string (1, static_cast (tt) ); } //********************************************************* // class Token //********************************************************* Token::Token () : tt (TypeUndef) { } Token::Token (TypeToken ttn) : tt (ttn) { } Token::Token (address n) : tt (TypeNumber), number (n) { } Token::Token (TypeToken ttn, const std::string & sn) : tt (ttn), s (sn) { } TypeToken Token::type () const { return tt; } namespace { class addescaped { public: addescaped (std::string & str) : str (str) { } void operator () (char c); private: std::string & str; }; void addescaped::operator () (char c) { unsigned char c1= c; if (c1 >= ' ' && c1 < 128) str+= c; else { str+= "\\x"; str+= hex2str (c1); } } std::string escapestr (const std::string & str) { std::string result; for_each (str.begin (), str.end (), addescaped (result) ); return result; } } // namespace std::string Token::str () const { switch (tt) { case TypeUndef: return "(undef)"; case TypeEndLine: return "(eol)"; case TypeIdentifier: return s; case TypeLiteral: return s; case TypeNumber: return hex4str (number); default: return gettokenname (tt); } } address Token::num () const { ASSERT (tt == TypeNumber); return number; } std::ostream & operator << (std::ostream & oss, const Token & tok) { oss << tok.str (); return oss; } //********************************************************* // Tokenizer auxiliary functions. //********************************************************* namespace { logic_error tokenizerunderflow ("Tokenizer underflowed"); logic_error missingfilename ("Missing filename"); runtime_error unclosed ("Unclosed literal"); runtime_error invalidhex ("Invalid hexadecimal number"); runtime_error invalidnumber ("Inavlid numeric format"); runtime_error outofrange ("Number out of range"); runtime_error needfilename ("Filename required"); runtime_error invalidfilename ("Invalid file name"); class UnexpectedChar : public runtime_error { public: UnexpectedChar (char c) : runtime_error ("Unexpected character: " + chartostr (c) ) { } private: static std::string chartostr (char c) { std::string r; if (c < 32 || c >= 127) r= '&' + hex2str (c); else { r= '\''; r+= c; r+= '\''; } return r; } }; Token parseless (std::istream & iss) { char c= iss.get (); if (iss) { switch (c) { case '=': return Token (TypeLeOp); case '<': return Token (TypeShlOp); default: iss.unget (); return Token (TypeLtOp); } } else return Token (TypeLtOp); } Token parsegreat (std::istream & iss) { char c= iss.get (); if (iss) { switch (c) { case '=': return Token (TypeGeOp); case '>': return Token (TypeShrOp); default: iss.unget (); return Token (TypeGtOp); } } else return Token (TypeGtOp); } Token parsenot (std::istream & iss) { char c= iss.get (); if (iss) { switch (c) { case '=': return Token (TypeNeOp); default: iss.unget (); return Token (TypeBoolNotOp); } } else return Token (TypeBoolNotOp); } Token parsestringc (std::istream & iss) { std::string str; for (;;) { char c= iss.get (); if (! iss) throw unclosed; if (c == '"') return Token (TypeLiteral, str); if (c == '\\') { c= iss.get (); if (! iss) throw unclosed; switch (c) { case '\\': break; case 'n': c= '\n'; break; case 'r': c= '\r'; break; case 't': c= '\t'; break; case 'a': c= '\a'; break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': { c-= '0'; char c2= iss.get (); if (! iss) throw unclosed; if (c2 < '0' || c2 > '7') iss.unget (); else { c*= 8; c+= c2 - '0'; c2= iss.get (); if (! iss) throw unclosed; if (c2 < '0' || c2 > '7') iss.unget (); else { c*= 8; c+= c2 - '0'; } } } break; case 'x': case 'X': { char x [3]= { 0 }; c= iss.get (); if (! iss) throw unclosed; if (! isxdigit (c) ) iss.unget (); else { x [0]= c; c= iss.get (); if (! iss) throw unclosed; if (! isxdigit (c) ) iss.unget (); else x [1]= c; } c= strtoul (x, NULL, 16); } break; } str+= c; } else str+= c; } } Token parsestringasm (std::istream & iss) { std::string str; for (;;) { char c= iss.get (); if (! iss) throw unclosed; if (c == '\'') { c= iss.get (); if (! iss) return Token (TypeLiteral, str); if (c != '\'') { iss.unget (); return Token (TypeLiteral, str); } } str+= c; } } Token parsedollar (std::istream & iss) { char c; c= iss.get (); if (iss && isxdigit (c) ) { std::string str; do { if (c != '$') str+= c; c= iss.get (); } while (iss && (isxdigit (c) || c == '$') ); if (str.empty () ) throw invalidhex; if (iss) iss.unget (); unsigned long n; char * aux; n= strtoul (str.c_str (), & aux, 16); if (* aux != '\0') throw invalidnumber; if (n > 0xFFFFUL) throw outofrange; return Token (static_cast
(n) ); } else { if (iss) iss.unget (); return Token (TypeDollar); } } Token parsesharp (std::istream & iss) { std::string str; char c= iss.get (); if (c == '#') return Token (TypeSharpSharp); while (iss && (isxdigit (c) || c == '$') ) { if (c != '$') str+= c; c= iss.get (); } if (str.empty () ) return Token (TypeSharp); if (iss) iss.unget (); unsigned long n; char * aux; n= strtoul (str.c_str (), & aux, 16); if (* aux != '\0') throw invalidnumber; if (n > 0xFFFFUL) throw outofrange; return Token (static_cast
(n) ); } Token parseampersand (std::istream & iss) { char c= iss.get (); if (! iss) return Token (TypeBitAnd); std::string str; int base= 16; switch (c) { case '&': return Token (TypeBoolAnd); case 'h': case 'H': break; case 'o': case 'O': base= 8; break; case 'x': case 'X': base= 2; break; default: if (isxdigit (c) ) str= c; else { iss.unget (); return Token (TypeBitAnd); } } c= iss.get (); while (iss && (isxdigit (c) || c == '$') ) { if (c != '$') str+= c; c= iss.get (); } if (str.empty () ) throw invalidnumber; if (iss) iss.unget (); char * aux; unsigned long n= strtoul (str.c_str (), & aux, base); if (* aux != '\0') throw invalidnumber; if (n > 0xFFFFUL) throw outofrange; return Token (static_cast
(n) ); } Token parseor (std::istream & iss) { char c= iss.get (); if (iss && c == '|') return Token (TypeBoolOr); else { if (iss) iss.unget (); return Token (TypeBitOr); } } Token parsepercent (std::istream & iss) { char c= iss.get (); if (! iss || (c != '0' && c != '1') ) { // Mod operator. if (iss) iss.unget (); return Token (TypeMod); } // Binary number. std::string str; do { if (c != '$') str+= c; c= iss.get (); } while (iss && (c == '0' || c == '1' || c == '$') ); if (iss) iss.unget (); unsigned long n; char * aux; n= strtoul (str.c_str (), & aux, 2); if (* aux != '\0') throw invalidnumber; if (n > 0xFFFFUL) throw outofrange; return Token (static_cast
(n) ); } Token parsedigit (std::istream & iss, char c) { std::string str; do { if (c != '$') str+= c; c= iss.get (); if (! iss) c= 0; } while (isalnum (c) || c == '$'); if (iss) iss.unget (); const std::string::size_type l= str.size (); unsigned long n; char * aux; // Hexadecimal with 0x prefix. if (str [0] == '0' && l > 1 && (str [1] == 'x' || str [1] == 'X') ) { str.erase (0, 2); if (str.empty () ) throw invalidhex; n= strtoul (str.c_str (), & aux, 16); } else { // Decimal, hexadecimal, octal and binary // with or without suffix. switch (toupper (str [l - 1]) ) { case 'H': // Hexadecimal. str.erase (l - 1); n= strtoul (str.c_str (), & aux, 16); break; case 'O': // Octal. case 'Q': // Octal. str.erase (l - 1); n= strtoul (str.c_str (), & aux, 8); break; case 'B': // Binary. str.erase (l - 1); n= strtoul (str.c_str (), & aux, 2); break; case 'D': // Decimal str.erase (l - 1); n= strtoul (str.c_str (), & aux, 10); break; default: // Decimal n= strtoul (str.c_str (), & aux, 10); } } if (* aux != '\0') throw invalidnumber; // Testing: do not forbid numbers out of 16 bits range, // just truncate it. //if (n > 0xFFFFUL) // throw outofrange; return Token (static_cast
(n) ); } void stripdollar (std::string & str) { std::string::size_type n; while ( (n= str.find ('$') ) != std::string::npos) str.erase (1, n); } bool ischarbeginidentifier (char c) { return isalpha (static_cast (c) ) || c == '_' || c == '?' || c == '@' || c == '.'; } bool ischaridentifier (char c) { return isalnum (static_cast (c) ) || c == '_' || c == '$' || c == '?' || c == '@' || c == '.'; } Token parseidentifier (std::istream & iss, char c, bool nocase) { std::string str; // Check conditional operator. if (c == '?') { str+= '?'; c= iss.get (); if (! ischaridentifier (c) ) { iss.unget (); return Token (TypeQuestion); } } do { // Changed this. Now a $ can be used to create // an identifier with the same name of a // reserved word. //if (c != '$') // str+= c; str+= c; c= iss.get (); } while (iss && ischaridentifier (c) ); if (iss) iss.unget (); TypeToken tt= getliteraltoken (str); if (tt == TypeUndef) { stripdollar (str); if (nocase) str= upper (str); return Token (TypeIdentifier, str); } else { if (tt == TypeAF && c == '\'') { iss.get (); tt= TypeAFp; } return Token (tt); } } Token parsetoken (std::istream & iss, bool nocase) { char c; if (! (iss >> c) ) return Token (TypeEndLine); switch (c) { case ';': return Token (TypeEndLine); case ',': return Token (TypeComma); case ':': return Token (TypeColon); case '+': return Token (TypePlus); case '-': return Token (TypeMinus); case '*': return Token (TypeMult); case '/': return Token (TypeDiv); case '=': return Token (TypeEqOp); case '<': // Less or less equal. return parseless (iss); case '>': // Greater or greter equal. return parsegreat (iss); case '~': return Token (TypeBitNotOp); case '!': // Not or not equal. return parsenot (iss); case '(': return Token (TypeOpen); case ')': return Token (TypeClose); case '[': return Token (TypeOpenBracket); case ']': return Token (TypeCloseBracket); case '$': // Hexadecimal number. return parsedollar (iss); case '\'': // Classic assembler string literal. return parsestringasm (iss); case '"': // C style string literal. return parsestringc (iss); case '#': // Hexadecimal number. return parsesharp (iss); case '&': // Hexadecimal, octal or binary number, // or and operators. return parseampersand (iss); case '|': // Or operators. return parseor (iss); case '%': // Binary number or mod operator. return parsepercent (iss); default: ; // Nothing } if (isdigit (c) ) return parsedigit (iss, c); if (ischarbeginidentifier (c) ) return parseidentifier (iss, c, nocase); // Any other case, invalid character. throw UnexpectedChar (c); } std::string parseincludefile (std::istream & iss) { char c; iss >> c; if (! iss) throw needfilename; std::string r; switch (c) { case '"': do { c= iss.get (); if (! iss) throw invalidfilename; if (c != '"') r+= c; } while (c != '"'); break; case '\'': do { c= iss.get (); if (! iss) throw invalidfilename; if (c != '\'') r+= c; } while (c != '\''); break; default: do { r+= c; c= iss.get (); } while (iss && ! isspace (c) ); if (iss) iss.unget (); } return r; } std::string parsemessage (std::istream & iss) { char c; std::string result; // Message can be empty. if (iss >> c) { do { result+= c; c= iss.get (); } while (iss); } return result; } } // namespace //********************************************************* // class Tokenizer //********************************************************* Tokenizer::Tokenizer () : current (tokenlist.begin () ), endpassed (0), nocase (false) { } Tokenizer::Tokenizer (bool nocase_n) : current (tokenlist.begin () ), endpassed (0), nocase (nocase_n) { } Tokenizer::Tokenizer (TypeToken ttok) : endpassed (0) { tokenlist.push_back (Token (ttok) ); current= tokenlist.begin (); } Tokenizer::Tokenizer (const Tokenizer & tz) : tokenlist (tz.tokenlist), current (tokenlist.begin () ), endpassed (0), nocase (tz.nocase) { } Tokenizer::Tokenizer (const std::string & line, bool nocase_n) : current (tokenlist.begin () ), endpassed (0), nocase (nocase_n) { istringstream iss (line); // Optional line number ignored. char c; do { c= iss.get (); } while (iss && isdigit (c) ); if (iss) iss.unget (); Token tok; while ( (tok= parsetoken (iss, nocase) ).type () != TypeEndLine) { tokenlist.push_back (tok); switch (tok.type () ) { case TypeINCLUDE: case TypeINCBIN: tokenlist.push_back (Token (TypeLiteral, parseincludefile (iss) ) ); break; case Type_ERROR: case Type_WARNING: tokenlist.push_back (Token (TypeLiteral, parsemessage (iss) ) ); break; default: // Nothing special. break; } } current= tokenlist.begin (); } Tokenizer::~Tokenizer () { } Tokenizer & Tokenizer::operator = (const Tokenizer & tz) { tokenlist= tz.tokenlist; current= tokenlist.begin (); endpassed= 0; nocase= tz.nocase; return * this; } std::ostream & operator << (std::ostream & oss, const Tokenizer & tz) { std::copy (tz.tokenlist.begin (), tz.tokenlist.end (), std::ostream_iterator (oss, " ") ); return oss; } void Tokenizer::push_back (const Token & tok) { tokenlist.push_back (tok); current= tokenlist.begin (); } bool Tokenizer::empty () const { return tokenlist.empty (); } bool Tokenizer::endswithparen () const { ASSERT (! tokenlist.empty () ); return tokenlist.back ().type () == TypeClose; } void Tokenizer::reset () { current= tokenlist.begin (); endpassed= 0; } Token Tokenizer::gettoken () { if (current == tokenlist.end () ) { ++endpassed; return Token (TypeEndLine); } else { Token tok= * current; ++current; return tok; } } void Tokenizer::ungettoken () { if (endpassed > 0) { ASSERT (current == tokenlist.end () ); --endpassed; } else { if (current == tokenlist.begin () ) throw tokenizerunderflow; --current; } } std::string Tokenizer::getincludefile () { Token tok= gettoken (); if (tok.type () != TypeLiteral) throw missingfilename; return tok.str (); } // End of token.cpp pasmo-0.5.3/tzx.h0000644000175000017500000000051710155652222010560 00000000000000#ifndef INCLUDE_TZX_H #define INCLUDE_TZX_H // tzx.h // Revision 8-dec-2004 #include #include namespace tzx { void writefilehead (std::ostream & out); void writestandardblockhead (std::ostream & out); void writeturboblockhead (std::ostream & out, size_t len); } // namespace tzx #endif // End of tzx.h pasmo-0.5.3/tzx.cpp0000644000175000017500000000224210155650670011115 00000000000000// tzx.cpp // Revision 4-dec-2004 #include "tzx.h" #include "pasmotypes.h" #include #define ASSERT assert void tzx::writefilehead (std::ostream & out) { // TZX header. static const char tzxhead []= { 'Z', 'X', 'T', 'a', 'p', 'e', '!', 0x1A, // TZX ID. 1, 13, // TZX format version. }; out.write (tzxhead, sizeof (tzxhead) ); } void tzx::writestandardblockhead (std::ostream & out) { out.put ('\x10'); // Standard speed block. address pause= 1000; // Pause after block in milisecs. out.put (lobyte (pause) ); out.put (hibyte (pause) ); } void tzx::writeturboblockhead (std::ostream & out, size_t len) { ASSERT (len <= 0xFFFFFF); out.put (0x11); // Block type. putword (out, 0x0380); // Pilot pulse putword (out, 0x01C0); // Sync first pulse putword (out, 0x01C0); // Sync second pulse putword (out, 0x01C0); // Zero bit pulse putword (out, 0x0380); // One bit pulse putword (out, 0x1000); // Pilot tone out.put (0x08); // Bits used in last byte //putword (out, 0x03E8); // Pause after block putword (out, 0x0970); // Pause after block // Length of data putword (out, len & 0xFFFF); out.put ( (len >> 16) & 0xFF); } // End of tzx.cpp pasmo-0.5.3/bootstrap0000755000175000017500000000010210227033610011505 00000000000000#!/bin/sh -e aclocal -I . automake --add-missing --copy autoconf pasmo-0.5.3/autogen.sh0000755000175000017500000000005110227033654011556 00000000000000#!/bin/sh ./bootstrap && ./configure $* pasmo-0.5.3/pasmodoc.html0000644000175000017500000011536310231246547012267 00000000000000 Pasmo documentation.

Pasmo documentation.

(C) 2004-2005 Julián Albo.

Use and distribution allowed under the terms of the GPL license.

Last revision date: 19-apr-2005

Current Pasmo version: 0.5.2

Index.

Introduction.

Pasmo is a multiplatform Z80 cross-assembler, easy to compile and easy to use. It can generate object code in several formats suitable for many Z80 machines and emulators.
Pasmo generates fixed position code, can not be used to create relocatable object files for use with linkers.

Pasmo is compatible with the syntax used in several old assemblers, by supporting several styles of numeric and string literals and by providing several names of the most used directives.
However, in Pasmo the Z80 mnemonics, register and flags names and directives are reserved words, this may require changes of symbol names conflicting in some programs.

Pasmo can also generate the 8086 equivalent to the z80 assembly code. It can create COM files for ms-dos, by using the binary generation mode, or CMD files for CP/M 86, by using the --cmd generation mode. This feature is experimental, use with care.

Installation.

Download Pasmo from http://www.arrakis.es/~ninsesabe/pasmo/.
Several binary executable are provided in the web, if your platform is not between these, or wants a more recent version, you must download the source package and compile it. If you want to compile it in windows you can use cygwin or mingw with the Makefile provided, with other compilers you may need to create a project, workspace or whatever your compiler or IDE uses.
To compile you need gcc version 2.95 or later, with the c++ language included (usually a package called g++-something).
Others compilers may also be used, any reasonable standard complaint c++ compiler must compile it with few or none corrections.
From version 0.5.2 a configure script is provided. You can use the usual './configure ; make ; make install' procedure.
You have also an official Debian package for testing and unstable releases.

Command line use.

Pasmo is invoked from command line as:

	pasmo [options] file.asm file.bin [file.symbol [file.publics] ]

Where file.asm is the source file, file.bin is the object file to be created and optionally file.symbol is the file where the symbol table will be written and file.publics is the file for the public symbols table. Both symbol file names can be an empty string for no generation or - to write in the standard output. When the --public option is used this is handled in another way, see below.

Options can be zero or more of the following:

-d
Show debug info during second pass of assembly.
-1 (digit 'one')
Show debug info during both passes of assembly.
-8
Same as --w8080
-v
Verbose mode. Show progress information about loading of files, progress of assembly and maybe other things.
-I (upper case i)
Add directory to the list for searching files in INCLUDE and INCBIN.
-B
Same as --bracket
-E
Same as --equ
--86
Generate 8086 code instead of Z80. This feature is experimental.
--bin
Generate the object file in raw binary format without headers.
--hex
Generate the object file in Intel HEX format.
--prl
Generate the object file in CP/M PRL format.
--cmd
Generate the object file in CP/M 86 CMD format.
--tap
Generate the object file in .tap format.
--tzx
Generate the object file in .tzx format.
--cdt
Generate the object file in .cdt format.
--tapbas
Same as --tap but adding a Basic loader before the code.
--tzxbas
Same as --txz but adding a Basic loader before the code.
--cdtbas
Same as --cdt but adding a Basic loader before the code.
--plus3dos
Generate the object file in PLUS3DOS format.
--amsdos
Generate the object file in Amsdos format.
--msx
Generate the object file in MSX format.
--public
Only the public symbols table is generated, using the file.symbol name, file.symbol must not be specified when using this option.
--name
Name to put in the header in the formats that use it. If unspecified the object file name will be used.
--err
Direct error messages to standard output instead of error output (except for errors in options).
--nocase
Make identifiers case insensitive.
--alocal
Use autolocal mode. In this mode all labels that begins with '_' are locals. See the chapter about labels for details.
--bracket
Use bracket only mode. In this mode the parenthesis are valid only in expressions, for indirections brackets must be used.
--equ
Predefine a symbol. Predefined symbol are treated in a similar way as defineds with EQU. Some possible uses are exemplified in the black.asm example file. The syntax is: '--equ label=value' where label must be a valid label name and value a numeric constant in a format valid in pasmo syntax. The part =value is optional, if not specified the value asigned is FFFF hex.
--w8080
Show warnings when Z80 instructions that have no equivalent in 8080 are used. Makes easy to write programs for 8080 processor using Z80 assembler syntax.

When no option for code generation is specified, --bin is used by default.

The -d option is intended to debug pasmo itself, but can also be useful to find errors in asm code. When used the information is showed in the standard output. Error messages goes to error ouptut unless the --err option is used.

Code generation modes.

Default mode

If none of the code generation options is specified, then --bin mode is used by default.

--bin mode

The --bin mode just dumps the code generated from the first position used without any header. This mode can be used for direct generation of CP/M or MSX COM files, supposed that you use a ORG 100H directive at the beginning of the code, or to generate blocks of code to be INCBINed in other programs.

--hex mode

The --hex mode generates code in Intel HEX format. This format can be used with the LOAD or HEXCOM CP/M utilities, can be transmitted more easily than a binary format, and is also used in some PROM programming tools.

--prl mode

The prl format is used in several variants of Digital Research CP/M operating system. In pasmo is supported only to create RSX files for use in CP/M Plus, use for PRL files in MP/M is not supported because I don't have a MP/M system, real or emulated, where to test it.

--cmd mode

The --cmd option generates a CP/M 86 CMD mode, using the 8080 memory model of CP/M 86. Used in conjuction with the --86 option can easily generate CP/M 86 executables from CP/M 80 sources with minimal changes.

--tap mode

The --tap options generates a tap file with a code block, with the loading position set to the beginnig of the code so you can load it from Basic with a LOAD "" CODE instruction.

--tzx mode

Same as --tap but using tzx format instead of tap.

--cdt mode

The --cdt options generates a cdt file with a code block, with the loading position set to the beginning of the code and the start address to the start point specified in the source, if any, so you can use RUN "" to execute it or LOAD "" to load it.

--tapbas mode

With the --tapbas option a tap file is generated with two parts: a Basic loader and a code block with the object code. The Basic loader does a CLEAR before the initial address of the code, loads the code, and executes it if a entry point is defined (see the END directive). That way you can directly launch the code in a emulator, or transfer it to a tape for use in a real Spectrum.

--tzxbas mode

Same as --tapbas but using tzx format instead of tap.

--cdtbas mode

Same as --tapbas but using cdt format instead of tap and with a Locomotive Basic loader instead of Spectrum Basic.

--plus3dos mode

Generate the object file in plus3dos format, used by the Spectrum +3 disks. The file can be loaded from Basic with a LOAD "filename" CODE instruction.

--amsdos mode

Generate the object file with Amsdos header, used by the Amstrad CPC on disk files. The file generated can be loaded from Basic with LOAD "filename", address or executed with RUN "filename" if an entry point has been specified in the source (see the END directive).

--msx mode

Generate the object file with header for use with BLOAD in MSX Basic.

Symbol table

The symbol table generated contains all identifiers used in the program, with the locals represented as a 8 digit hexadecimal number in order of use, unless the --public option is used. In that case only the symbols specified in PUBLIC directives are listed.

The symbol table format is a list of EQU directives. That way you can INCLUDE it in another source to create programs composed of several blocks.

Source code format.

Generalities.

Source code files must be valid text files in the platform used. The use of, for example, unix text files under pasmo in windows, is unsupported and the result is undefined (may depend of the compiler used to build pasmo, for example). The result of the use of a file that contains vertical tab or form feed characters is also undefined.

Everything after a ; in a line is a comment (unlees the ; is part of a string literal, of course). There are no multiline comments, you can use IF 0 .... ENDIF instead (but see INCLUDE).

String literals are written to the object file without any character set translation. Then the use of any character with a different meaning in the platform were pasmo is running and the destination machine must be avoided, and the code of the character may be used instead. That also means that using Pasmo in any machine that uses a non ascii compatible character set may be difficult, and that a source written in utf-8 may give undesired results. This may be changed in future versions of Pasmo.

A line may begin with a decimal number followed by blanks. This number is ignored by the assembler, is allowed for compatibility with old assemblers. The line number reported in errors is the sequential number of the line in the file, not this.

Blanks are significative only in string literals and when they separate lexical elements. Any number of blanks has the same meaning as one. A blank between operators and operands is allowed but no required except when the same character has other meaning as prefix ('$' and '%', for example).

Literals.

Numeric literals.

Numeric literals can be written in decimal, binary, octal and hexadecimal formats. Several formats are accepted to obtain compatibility with the source format of several assemblers.

A literal that begins with $ is a hexadecimal constant, except if the literal is only the $ symbol, in that case is an operator, see below.

A literal that begins with # is a hexadecimal constant, except if there are two consecitives #, see the ## operator.

A literal that begins with & can be hexadecimal, octal or binary constant, depending of the character that follows the &: H means hexadecimal, O octal and X hexadecimal, if none of this the caracter must be a valid hexadecimal digit and the constant is hexadecimal.

A literal that begins with % is a binary constant, except if the literal is only the % symbol, in that case is an operator, see below.

A literal that begins with a decimal digit can be a decimal, binary, octal or hexadecimal. If the digit is 0 and the following character is an X, the number is hexadecimal. If not, the suffix of the literal is examined: D means decimal, B binary, H hexadcimal and O or Q octal, in any other case is taken as decimal. Take care, FFFFh for example is not an hexadecimal constant, is an identifier, to write it with the suffix notation you must do it as 0FFFFh.

All numeric formats can have $ signs between the digits to improve readability. They are ignored.

String literals.

There are two formats of string literals: single or double quote delimited.

A string literal delimited with single quotes is the simpler format, all characters are included in the string without any special interpretation, with the only exception that two consecutive single quotes are taken as one single quote character to be included in the string. For example: the single quote delimited string 'That''s all folks' generates the same string as the double quote delimited "That's all folks".

A string literal delimited with double quotes is interpreted in a way similar to the C and C++ languages. The \ character is taken as escape character, with the following interpretations: n is a new line character (0A hex), r is a carriage return (0D hex), t is a tabulator (09 hex), a is a bell (07 hex), x indicates that the two next characters will be considered the hexadecimal code of a char and a char with that code is inserted, an octal digit prefixes and begins an octal number of up to three digits, and the corresponding character is inserted into the string, the characters \ and " means to insert itself in the string, and any other char is reserved for future use.

A string literal of length 1 can be used as a numeric constant with the numeric value of the character contained. This allows expressions such as 'A' + 80h to be evaluated as expected.

Identifiers.

Identifiers are the names used for labels, EQU and DEFL symbols and macro names and parameters. The names of the Z80 mnemonics, registers and flag names, and of pasmo operands and assemble directives are reserved and can not be used as names of identifiers. Reserved names are case insensitive, even if case sensitive mode is used.

In the following 'letter' means an english letter character in upper or lower case. Characters that correspond to letters in other languages are not allowed in identifiers.

Identifiers begins with a letter, '_', '?', '@' or '.', followed for zero or more letter, decimal digit, '_', '?', '@', '.' or '$'. The '$' are ignored, but a reserved word with a '$' embedded or appended is not recognized as such.

Identifiers that begins with '_' are special when using autolocal mode, see the --alocal option and the chapter about labels for details.

Identifiers are case sensitive if the option --nocase is not used. When using --nocase, they are always converted to upper case.

File names.

File names are used in the INCLUDE and INCBIN directives. They follow special rules.

A file name that begins with a double quote character must end with another double quote, and the file name contains all character between them without any special interpretation.

A file name that begins with a single quote character must end with another single quote, and the file name contains all character between them without any special interpretation.

In any other case all characteres until the next blank or the end of line are considered part of the file name. Blank characters are space and tab.

Labels.

A label can be placed at the beginning of any line, before any assembler mnemonic or directive. Optionally can be followed by a ':', but is not recommended to use it in directives, for compatibility with other assemblers. A line that has a label with no mnemonic nor directive is also valid.

The label has special meaning in the MACRO, EQU and DEFL directives, in any other case the value of the current code generation position is assigned to the label.

Labels can be used before his definition, but the result of doing this with labels assigned with DEFL is undefined.

The value of a label cannot be changed unless DEFL is used in all assignments of that label. If the value assigned to a label is different in the two passes of the assembly the program is illegal, but is not guaranteed that an error is generated. However, is legal to assign a value undefined in the first pass (by using an expression that contains a label not yet defined, for example).

In the default mode a label is global unless declared as LOCAL into a MACRO, REPT or IRP block, see the LOCAL directive for details.

In the autolocal mode, introduced by using the --alocal command line option, all labels that begins with a '_' are locals. His ambit ends at the next non local label or in the next PROC, LOCAL, MACRO, ENDP or ENDM directive.

Both automatic and explicit local labels are represented in the symbol table listing as 8 digit hexadecimal numbers, corresponding to the first use of the label in the source.

Directives.

List of directives supported in Pasmo, in alphabetical order.

.ERROR
Generates an error during assembly if the line is actively used, that is, in a macro if it gets expanded, in an IF if the current branch is taken. All text following the directive is used as error message.
.SHIFT
Shift MACRO arguments, see the chapter about macros.
.WARNING
Same as .ERROR but emiting a a warning message instead of generating an error.
DB
Define Byte. The argument is a comma separated list of string literals or numeric expressions. The string literals are inserted in the object code, and the result of the numeric expression is inserted as a single byte, truncating it if needed.
DEFB
DEFine Byte, same as DB.
DEFL
DEFine Label. Must be preced by a label. The argument must be a numeric expression, the result is assigned to the label. The label used can be redefined with other DEFL directive.
DEFM
DEFine Message, same as DB.
DEFS
DEFine Space, same as DS.
DEFW
Same as DW.
DS
Define Space. Take one or two comma separated arguments. The first or only argument is the amount of space to define, in bytes. The second is the value used to fill the space, if absent 0 will be used.
DW
Define Word. The argument is a comma separated list of numeric expressions. Each numeric expression is evaluated as a two byte word and the result inserted in the code in the Z80 word format.
ELSE
See IF.
END
Ends the assembly. All lines after this directive are ignored. If it has an argument is evaluated as a numeric expression and the result is set as the program entry point. The result of setting an entry point depends of the type of code generation used, may be none but even in this case may be used for documentation purposes.
ENDIF
See IF.
ENDM
Ends a macro, see the chapter about macros.
ENDP
Marks the end of a PROC block, see PROC.
EQU
EQUate. Must be preceded by a label. The argument must be a numeric expression, the result is assigned to the label. The label used can't be redefined.
EXITM
Exits a macro, see the chapter about macros.
IF
Contional assembly. The argument must be a numeric expression, a result of 0 is considered as false, any other as true. If the argument is true the following code is assembled until the end of the IF section or an ELSE directive is encountered, else is ignored. If the ELSE direcive is present the following code is ignored if the argument was true, or is assembled if was false.
The IF section is ended with a ENDIF or a ENDM directive (in the last case the ENDM has also his usual effect).
IF can be nested, in that case each ELSE and ENDIF takes effect only on his corresponding IF, but ENDM ends all pending IF sections.
INCLUDE
Include a file. See the file names chapter for the conventions used in the argument. The file is readed and the result is the same as if the file were copied in the current file instead of the INCLUDE line.
The file included may contain INCLUDE directives, and so on.
INCLUDE directives are processed before the assembly phases, so the use of IF directives to conditionally include different files is not allowed.
INCBIN
INClude BINary. Include a binary file. Reads a binary file and insert his content in the generated code at the current position. See the file names chapter for the conventions used in the argument.
IRP
Repeat a block of code substituing arguments. See the chapter about macros.
LOCAL
Marks identifiers as local to the current block. The block may be a MACRO, REPT, IRP or PROC directive, the local ambit ends in the corresponding ENDM or ENDP directive. The ambit begins at the LOCAL directive, not at the beginning of the block, take care with that.
If several LOCAL declations of the same identifier are used in the same block, only the first has effect, the others are ignored.
MACRO
Defines a macro, see the chapter about macros.
ORG
ORiGin. Establishes the origin position where to place generated code. Several ORG directives can be used in the same program, but if the result is that code generated overwrites previous, the result is undefined.
PROC
Marks the begin of a PROC block. The only effect is to define an ambit for LOCAL directives. The block ends with a corresponding ENDP directive. The recommended use is to enclose a subroutine in a PROC block, but can also be used in any other situation.
PUBLIC
The argument is a comma separated list of identifiers. Each identifier is marked as public. When using the --public command line option only the identifiers marked as public are included in the symbol table listing.
REPT
REPeaTs a block. See the chapter about macros.

Operators.

Generalities.

All numeric values are taken as 16 bits unsigned, using 2 complement or trucating when required. Logical operators return FFFF hex for true and 0 for false, in the arguments 0 is false and any other value true.

Parenthesis may be used to group parts of expressions. They are also used to express indirections in the z80 instructions that allows or require it. This can cause some errors when a parenthesized expression is used in a place were an indirections is allowed. Pasmo uses some heuristic to allow the expression to be correctly interpreted, but are far from perfect.

Using the bracket only mode the parenthesis have the unique meaning of grouping expressions, brackets are required for indirections, thus solving ambiguities.

Short circuit evaluation: the && and || operators and the conditional expression are short circuited. This means that if one of his operators need not be evaluted, it can include undefined symbols or divisions by 0 without generating an error (but still must have correct syntax). In the conditional expression this applies to the branch not taken, in the && operator to the second operand if the first is false, and in the || operator to the second operand if the first is true.

Table of precedence.

Table of operators by order of precedence, those in the same line have the same precedence:

	## (see note)
	$, NUL, DEFINED
	*, /, MOD, %, SHL, SHR, <<, >>
	+, - (binary)
	EQ, NE, LT, LE, GT, GE, =, !=, <, >, <=, >=
	NOT, ~, !, +, - (unary)
	AND, &
	OR, |, XOR
	&&
	||
	HIGH, LOW
	?

The ## operator is an special case, is processed during the macro expansion, see the chapter about macros.

Alphabetic list of operators.

!
Logical not. Returns true if his argument is 0, false otherwise.
!=
Same as NE.
##
Identifier pasting operator, see the chapter about macros.
$
Gives the value of the position counter at the begin of the current sentence. For example, in a DW directive it gives the position of the first item in the list, not the current item.
%
Same as MOD.
&
Same as AND.
&&
Logical and. True if both operands are true.
*
Multiplication.
+
Addition or unary +.
-
Substraction or unary -.
/
Integer division, truncated.
<
Same as LT
<<
Same as SHL
<=
Same as LE
=
Same as EQ
>
Same as GT
>=
Same as GE
>>
Same as SHR
?
Condtional expression. Must be followed by two expressions separated by a :, if the expression on the right of ? is true, the first expressions is evaluted, if false, the second.
|
Same as OR.
||
Logical or. True if one of his operands is true.
~
Same as NOT
AND
Bitwise and operator.
DEFINED
The argument must be a identifier. The result is true if the identifier is defined, false otherwise.
EQ
Equals. True if both operands are equal, false otherwise.
GE
Greater or equal. True if the left operand is greater or equal than the right.
GT
Greater than. True if the left operand is greater than the right.
HIGH
Returns the high order byte of the argument.
LE
Less or equal. True if the left operand is lesser or equal than the right.
LOW
Returns the low order byte of the argument.
LT
Less than. True if the lefth operand is lesser than the right.
MOD
Modulus. The remainder of the integer division.
NE
Not equal. False if both operands are equal, true otherwise.
NOT
Bitwise not. Return the ones complement of his operand.
NUL
Returns true if there is something at his right, false in other case. Useful if the arguments are parameters of macros.
OR
Bitwise or operator.
SHL
Shif left. Returns the left operand shifted to the left the number of bits specified in the right operand, filling with zeroes.
SHR
Shif right. Returns the left operand shifted to the right the number of bits specified in the right operand, filling with zeroes.
XOR
Bitwise xor (exclusive or) operator.

Macros.

Generalities.

There are two types of macro directives: the proper MACRO directive and the repetition directives REPT and IRP. In addition the ENDM and EXITM directives controls the end of the macro expansion.

A macro parameter is an indentifier that when the macro is expanded is substitued by the value of the argument applied. The argument can be empty, or be composed by one or more tokens. If a MACRO is defined inside another macro directive the external parameters are not substitued, with the other macro directives the parameter substitution is done beginnig by the most external directive. The NUL operator can be used to check if an argument is not empty. The .SHIFT directive can be used to work with an undeterminated number of arguments.

Identifier pasting: inside a MACRO the operator ## can be used to join two idenfiers resulting in another identifier. This is intended to allow the creation of identifiers dependent of macro arguments.

Directives.

.SHIFT
Can be used only inside a MACRO. The MACRO arguments are shitted one place to the left, the first argument is discarded. If there are not enough arguments to fill the parameter list after the shift, the remaining arguments get undefined.
ENDM
Marks the end of the current MACRO definition, or the current REPT or IRP block. All IF blocks contained in the macro block are also closed.
EXITM
Exits the curren MACRO, REPT or IRP block. In the case of MACRO, the macro expansion is finished, in the other cases the code generation of the block is terminated and the assembly continues after the corresponding ENDM.
IRP
	IRP parameter, argument list.
Repeats the block of code between the IRP directive and his corresponding ENDM one time for each of the arguments.
MACRO
Defines a macro. There are two forms that can be used:
	name	MACRO [ list of parameters]
or:
	MACRO name [ , list of parameters]
In all cases, list of paramenters is a comma separated list of identifiers, and name is the name assigned to the macro created.
A macro is used by simply specifying his name, and optionally a list of arguments. The arguments list does not need to have the same length as the parameter list of the macro. If it is longer, the extra arguments are not used, but can be retrieved by using .SHIFT inside the MACRO. If it is shorter some parameters get undefined, this can be tested inside the MACRO by using the NUL operator.
REPT
Repeats the block of code between the REPT directive and his corresponding ENDM the number of times specified in his argument. The argument can be 0, in that case the block is skipped.
Additionally a loop var can be specified. This var is not a macro parameter, is used as a LOCAL DEFL symbol, whose value is incremented in every loop iteration. The initial value and incement can be specified, with defaults of 0 and 1 respectively.

About suggestions and possible improvements.

The assumption of Pasmo if that, being a cross-assembler, it will be used on a machine with many available resources. Then I do not make any effort to provide means to do things that can be easily made with other utilities, unless I think (or other people convince me) that including it in Pasmo can be much more convenient.
For example, if you want to create a sin table you can write a program in your favourite language that writes a file with the table and INCLUDE that file, and if you want to automate that type of things you can use make.

Taken that into account, I am open to suggestions to improve Pasmo and to patches that implements it. In the later case please take care to write things in a portable way, without operating system or compiler dependences.

Why Pasmo can not generate linkable code?

Pasmo has a simple code generator that uses absolute address of memory. That will make difficult to adapt it to generate relocatable code for use with linkers. I don't have plans to do it for the moment, maybe someone want to contribute?

Game Boy.

Some people suggested to add support for Game Boy programming. There are two problems, the simplified way used to generate code in Pasmo, and my inexistent knowledge of the Game Boy.

Thanks.

Thanks to all people that has made suggestions and notified or corrected bugs. And to these that show me the beautiful things they do with Pasmo.

Tricks.

You can use Pasmo to convert any binary file to .tap, just write a tiny program called for example convert.asm:

	ORG address_to_load_the_file
	INCBIN file.bin

Assemble it with: pasmo --tap convert.asm file.tap, and you have it. The same may be done for the other formats supported.

Bugs.

Pasmo emits a warning when using a expression that looks line a non existent z80 instruction, such as 'ld b, (nn)', but the simplified way used to detect that also warns in cases like 'ld b,(i1+i2)*(i3+i4)'.
A way to avoid the warning in that case is to prefix the expression with parenthesis with '+' or '0 +'.
Using the bracket only mode the problem does not exist, in that case the parenthesis are always taken as expresssions (and the programmer is supposed to know that), thus the warning is not emitted.
More suggestions about that are wellcome.

There is no way to include a file whose name contains blanks, single and double quoutes. Someone use file names like that?

Epilogue.

That's all folks!

Send comments and criticisms to:

julian.notfound@gmail.com

Valid HTML 4.0!

pasmo-0.5.3/align.asm0000644000175000017500000000250710155650667011372 00000000000000; align.asm ; (C) 2004 Julian Albo ; This code may be freely used. ;-------------------------------------------------------------------- ; Sample of macro that can be used to align the current position to ; a multiple of some number, like the align and aligndata directives ; of some oher assemblers. ;-------------------------------------------------------------------- align macro n local newpos, oldpos oldpos equ $ newpos equ (oldpos + n - 1) / n * n if newpos < oldpos .error Align out of memory endif ; The second method is faster, the first can be used to align code ; in 8086 generation mode (code of NOP is not 00). ; If align of data and code is needed can be better to define another ; macro called aligndata. if defined ALIGN_WITH_NOP rept newpos - oldpos nop endm else org newpos endif endm ; align ;-------------------------------------------------------------------- ; Test program. ;-------------------------------------------------------------------- org 100h ; To view the result with a cp/m debugger. ld a, a align 8 ld a, b ld a, c ld a, d align 64 align 16 ; Do nothing, already aligned. ld a, e if defined TESTERROR org 0E000h ld a, h align 16384 ; Must generate an error. ld a, l endif end ;-------------------------------------------------------------------- ; End of align.asm pasmo-0.5.3/all.asm0000644000175000017500000002575310155650667011060 00000000000000; all.asm ; All instructions of the Z80 org 100h ; Useful for some tests. des equ 05h n equ 20h nn equ 0584h ; ADC adc a, (hl) if ! defined ONLY8080 && ! defined ONLY86 adc a, (ix + des) adc a, (iy + des) endif adc a, a adc a, b adc a, c adc a, d adc a, e adc a, h adc a, l adc a, n if ! defined ONLY8080 adc hl, bc adc hl, de adc hl, hl adc hl, sp endif ; ADD add a, (hl) if ! defined ONLY8080 && ! defined ONLY86 add a, (ix + des) add a, (iy + des) endif add a, a add a, b add a, c add a, d add a, e add a, h add a, l add a, n add hl, bc add hl, de add hl, hl add hl, sp if ! defined ONLY8080 && ! defined ONLY86 add ix, bc add ix, de add ix, ix add ix, sp add iy, bc add iy, de add iy, iy add iy, sp endif ; AND and (hl) if ! defined ONLY8080 && ! defined ONLY86 and (ix + des) and (iy + des) endif and a and b and c and d and e and h and l and n ; BIT if ! defined ONLY8080 && ! defined ONLY86 bit 0, (hl) bit 0, (ix + des) bit 0, (iy + des) bit 0, a bit 0, b bit 0, c bit 0, d bit 0, e bit 0, h bit 0, l bit 1, (hl) bit 1, (ix + des) bit 1, (iy + des) bit 1, a bit 1, b bit 1, c bit 1, d bit 1, e bit 1, h bit 1, l bit 2, (hl) bit 2, (ix + des) bit 2, (iy + des) bit 2, a bit 2, b bit 2, c bit 2, d bit 2, e bit 2, h bit 2, l bit 3, (hl) bit 3, (ix + des) bit 3, (iy + des) bit 3, a bit 3, b bit 3, c bit 3, d bit 3, e bit 3, h bit 3, l bit 4, (hl) bit 4, (ix + des) bit 4, (iy + des) bit 4, a bit 4, b bit 4, c bit 4, d bit 4, e bit 4, h bit 4, l bit 5, (hl) bit 5, (ix + des) bit 5, (iy + des) bit 5, a bit 5, b bit 5, c bit 5, d bit 5, e bit 5, h bit 5, l bit 6, (hl) bit 6, (ix + des) bit 6, (iy + des) bit 6, a bit 6, b bit 6, c bit 6, d bit 6, e bit 6, h bit 6, l bit 7, (hl) bit 7, (ix + des) bit 7, (iy + des) bit 7, a bit 7, b bit 7, c bit 7, d bit 7, e bit 7, h bit 7, l endif ; CALL call c, nn call m, nn call nc, nn call nz, nn call p, nn call pe, nn call po, nn call z, nn call nn ; CCF ccf ; CP cp (hl) if ! defined ONLY8080 && ! defined ONLY86 cp (ix + des) cp (iy + des) endif cp a cp b cp c cp d cp e cp h cp l cp n ; CP.. if ! defined ONLY8080 && ! defined ONLY86 cpd cpdr cpir cpi endif cpl ; DAA daa ; DEC dec (hl) if ! defined ONLY8080 && ! defined ONLY86 dec (ix + des) dec (iy + des) endif dec a dec b dec bc dec c dec d dec de dec e dec h dec hl if ! defined ONLY8080 && ! defined ONLY86 dec ix dec iy endif dec l dec sp ; DI di ; DJNZ if ! defined ONLY8080 l1 djnz l1 endif ; EI ei ; EX if ! defined ONLY86 ex (sp), hl endif if ! defined ONLY8080 && ! defined ONLY86 ex (sp), ix ex (sp), iy ex af, af' endif ex de, hl if ! defined ONLY8080 && ! defined ONLY86 exx endif ; HALT halt ; IM if ! defined ONLY8080 && ! defined ONLY86 im 0 im 1 im 2 endif ; IN if ! defined ONLY8080 && ! defined ONLY86 in a, (c) in b, (c) in c, (c) in d, (c) in e, (c) in h, (c) in l, (c) endif ; INC inc (hl) if ! defined ONLY8080 && ! defined ONLY86 inc (ix + des) inc (iy + des) endif inc a inc b inc bc inc c inc d inc de inc e inc h inc hl if ! defined ONLY8080 && ! defined ONLY86 inc ix inc iy endif inc l inc sp ; IN... in a, (n) if ! defined ONLY8080 && ! defined ONLY86 ind indr ini inir endif ; JP jp nn jp (hl) if ! defined ONLY8080 && ! defined ONLY86 jp (ix) jp (iy) endif jp c, nn jp m, nn jp nc, nn jp nz, nn jp p, nn jp pe, nn jp po, nn jp z, nn ; JR if ! defined ONLY8080 jr c, $ + 22h jr nc, $ + 22h jr nz, $ + 22h jr z, $ + 22h jr $ + 22h endif ; LD ld (bc), a ld (de), a ld (hl), a ld (hl), b ld (hl), c ld (hl), d ld (hl), e ld (hl), h ld (hl), l ld (hl), n if ! defined ONLY8080 && ! defined ONLY86 ld (ix + des), a ld (ix + des), b ld (ix + des), c ld (ix + des), d ld (ix + des), e ld (ix + des), h ld (ix + des), l ld (ix + des), n ld (iy + des), a ld (iy + des), b ld (iy + des), c ld (iy + des), d ld (iy + des), e ld (iy + des), h ld (iy + des), l ld (iy + des), n endif ld (nn), a if ! defined ONLY8080 ld (nn), bc ld (nn), de endif ld (nn), hl if ! defined ONLY8080 && ! defined ONLY86 ld (nn), ix ld (nn), iy endif if ! defined ONLY8080 ld (nn), sp endif ld a, (bc) ld a, (de) ld a, (hl) if ! defined ONLY8080 && ! defined ONLY86 ld a, (ix + des) ld a, (iy + des) endif ld a, (nn) ld a, a ld a, b ld a, c ld a, d ld a, e ld a, h if ! defined ONLY8080 && ! defined ONLY86 ld a, i endif ld a, l ld a, n if ! defined ONLY8080 && ! defined ONLY86 ld a, r endif ld b, (hl) if ! defined ONLY8080 && ! defined ONLY86 ld b, (ix + des) ld b, (iy + des) endif ld b, a ld b, b ld b, c ld b, d ld b, e ld b, h ld b, l ld b, n if ! defined ONLY8080 ld bc, (nn) endif ld bc, nn ld c, (hl) if ! defined ONLY8080 && ! defined ONLY86 ld c, (ix + des) ld c, (iy + des) endif ld c, a ld c, b ld c, c ld c, d ld c, e ld c, h ld c, l ld c, n ld d, (hl) if ! defined ONLY8080 && ! defined ONLY86 ld d, (ix + des) ld d, (iy + des) endif ld d, a ld d, b ld d, c ld d, d ld d, e ld d, h ld d, l ld d, n if ! defined ONLY8080 ld de, (nn) endif ld de, nn ld e, (hl) if ! defined ONLY8080 && ! defined ONLY86 ld e, (ix + des) ld e, (iy + des) endif ld e, a ld e, b ld e, c ld e, d ld e, e ld e, h ld e, l ld e, n ld h, (hl) if ! defined ONLY8080 && ! defined ONLY86 ld h, (ix + des) ld h, (iy + des) endif ld h, a ld h, b ld h, c ld h, d ld h, e ld h, h ld h, l ld h, n ld hl, (nn) ld hl, nn if ! defined ONLY8080 && ! defined ONLY86 ld i, a endif if ! defined ONLY8080 && ! defined ONLY86 ld ix, (nn) ld ix, nn ld iy, (nn) ld iy, nn endif ld l, (hl) if ! defined ONLY8080 && ! defined ONLY86 ld l, (ix + des) ld l, (iy + des) endif ld l, a ld l, b ld l, c ld l, d ld l, e ld l, h ld l, l ld l, n if ! defined ONLY8080 && ! defined ONLY86 ld r, a endif if ! defined ONLY8080 ld sp, (nn) endif ld sp, hl if ! defined ONLY8080 && ! defined ONLY86 ld sp, ix ld sp, iy endif ld sp, nn if ! defined ONLY8080 && ! defined ONLY86 ldd lddr ldi ldir endif ; NEG if ! defined ONLY8080 && ! defined ONLY86 neg endif ; NOP nop ; OR or (hl) if ! defined ONLY8080 && ! defined ONLY86 or (ix + des) or (iy + des) endif or a or b or c or d or e or h or l or n ; OT... if ! defined ONLY8080 && ! defined ONLY86 otdr otir endif ; OUT if ! defined ONLY8080 && ! defined ONLY86 out (c), a out (c), b out (c), c out (c), d out (c), e out (c), h out (c), l out (n), a endif ; OUTD/I if ! defined ONLY8080 && ! defined ONLY86 outd outi endif ; POP pop af pop bc pop de pop hl if ! defined ONLY8080 && ! defined ONLY86 pop ix pop iy endif ; PUSH push af push bc push de push hl if ! defined ONLY8080 && ! defined ONLY86 push ix push iy endif ; RES if ! defined ONLY8080 && ! defined ONLY86 res 0, (hl) res 0, (ix + des) res 0, (iy + des) res 0, a res 0, b res 0, c res 0, d res 0, e res 0, h res 0, l res 1, (hl) res 1, (ix + des) res 1, (iy + des) res 1, a res 1, b res 1, c res 1, d res 1, e res 1, h res 1, l res 2, (hl) res 2, (ix + des) res 2, (iy + des) res 2, a res 2, b res 2, c res 2, d res 2, e res 2, h res 2, l res 3, (hl) res 3, (ix + des) res 3, (iy + des) res 3, a res 3, b res 3, c res 3, d res 3, e res 3, h res 3, l res 4, (hl) res 4, (ix + des) res 4, (iy + des) res 4, a res 4, b res 4, c res 4, d res 4, e res 4, h res 4, l res 5, (hl) res 5, (ix + des) res 5, (iy + des) res 5, a res 5, b res 5, c res 5, d res 5, e res 5, h res 5, l res 6, (hl) res 6, (ix + des) res 6, (iy + des) res 6, a res 6, b res 6, c res 6, d res 6, e res 6, h res 6, l res 7, (hl) res 7, (ix + des) res 7, (iy + des) res 7, a res 7, b res 7, c res 7, d res 7, e res 7, h res 7, l endif ; RET ret ret c ret m ret nc ret nz ret p ret pe ret po ret z if ! defined ONLY8080 && ! defined ONLY86 reti retn endif ; RL if ! defined ONLY8080 && ! defined ONLY86 rl (hl) rl (ix + des) rl (iy + des) rl a rl b rl c rl d rl e rl h rl l endif ; RLA rla ; RLC if ! defined ONLY8080 && ! defined ONLY86 rlc (hl) rlc (ix + des) rlc (iy + des) rlc a rlc b rlc c rlc d rlc e rlc h rlc l endif ; RLCA rlca ; RLD if ! defined ONLY8080 && ! defined ONLY86 rld endif ; RR if ! defined ONLY8080 && ! defined ONLY86 rr (hl) rr (ix + des) rr (iy + des) rr a rr b rr c rr d rr e rr h rr l endif ; RRA rra ; RRC if ! defined ONLY8080 && ! defined ONLY86 rrc (hl) rrc (ix + des) rrc (iy + des) rrc a rrc b rrc c rrc d rrc e rrc h rrc l endif ; RRCA rrca ; RRD if ! defined ONLY8080 && ! defined ONLY86 rrd endif ; RST if ! defined MODE86 && ! defined ONLY86 rst 0 rst 8 rst 10h rst 18h rst 20h rst 28h rst 30h rst 38h endif ; SBC sbc a, n sbc a, (hl) if ! defined ONLY8080 && ! defined ONLY86 sbc a, (ix + des) sbc a, (iy + des) endif sbc a, a sbc a, b sbc a, c sbc a, d sbc a, e sbc a, h sbc a, l if ! defined ONLY8080 sbc hl, bc sbc hl, de sbc hl, hl sbc hl, sp endif ; SCF scf ; SET if ! defined ONLY8080 && ! defined ONLY86 set 0, (hl) set 0, (ix + des) set 0, (iy + des) set 0, a set 0, b set 0, c set 0, d set 0, e set 0, h set 0, l set 1, (hl) set 1, (ix + des) set 1, (iy + des) set 1, a set 1, b set 1, c set 1, d set 1, e set 1, h set 1, l set 2, (hl) set 2, (ix + des) set 2, (iy + des) set 2, a set 2, b set 2, c set 2, d set 2, e set 2, h set 2, l set 3, (hl) set 3, (ix + des) set 3, (iy + des) set 3, a set 3, b set 3, c set 3, d set 3, e set 3, h set 3, l set 4, (hl) set 4, (ix + des) set 4, (iy + des) set 4, a set 4, b set 4, c set 4, d set 4, e set 4, h set 4, l set 5, (hl) set 5, (ix + des) set 5, (iy + des) set 5, a set 5, b set 5, c set 5, d set 5, e set 5, h set 5, l set 6, (hl) set 6, (ix + des) set 6, (iy + des) set 6, a set 6, b set 6, c set 6, d set 6, e set 6, h set 6, l set 7, (hl) set 7, (ix + des) set 7, (iy + des) set 7, a set 7, b set 7, c set 7, d set 7, e set 7, h set 7, l endif ; SLA if ! defined ONLY8080 && ! defined ONLY86 sla (hl) sla (ix + des) sla (iy + des) sla a sla b sla c sla d sla e sla h sla l endif ; SRA if ! defined ONLY8080 && ! defined ONLY86 sra (hl) sra (ix + des) sra (iy + des) sra a sra b sra c sra d sra e sra h sra l endif ; SRL if ! defined ONLY8080 && ! defined ONLY86 srl (hl) srl (ix + des) srl (iy + des) srl a srl b srl c srl d srl e srl h srl l endif ; SUB sub (hl) if ! defined ONLY8080 && ! defined ONLY86 sub (ix + des) sub (iy + des) endif sub a sub b sub c sub d sub e sub h sub l sub n ; XOR xor (hl) if ! defined ONLY8080 && ! defined ONLY86 xor (ix + des) xor (iy + des) endif xor a xor b xor c xor d xor e xor h xor l xor n this_is_the_end: end ; End of all.asm pasmo-0.5.3/allb.asm0000644000175000017500000001755710155650670011217 00000000000000; allb.asm ; All instructions of the Z80 in bracketd form. des equ 05h n equ 20h nn equ 0584h ; ADC adc a, [hl] adc a, [ix + des] adc a, [iy + des] adc a, a adc a, b adc a, c adc a, d adc a, e adc a, h adc a, l adc a, n adc hl, bc adc hl, de adc hl, hl adc hl, sp ; ADD add a, [hl] add a, [ix + des] add a, [iy + des] add a, a add a, b add a, c add a, d add a, e add a, h add a, l add a, n add hl, bc add hl, de add hl, hl add hl, sp add ix, bc add ix, de add ix, ix add ix, sp add iy, bc add iy, de add iy, iy add iy, sp ; AND and [hl] and [ix + des] and [iy + des] and a and b and c and d and e and h and l and n ; BIT bit 0, [hl] bit 0, [ix + des] bit 0, [iy + des] bit 0, a bit 0, b bit 0, c bit 0, d bit 0, e bit 0, h bit 0, l bit 1, [hl] bit 1, [ix + des] bit 1, [iy + des] bit 1, a bit 1, b bit 1, c bit 1, d bit 1, e bit 1, h bit 1, l bit 2, [hl] bit 2, [ix + des] bit 2, [iy + des] bit 2, a bit 2, b bit 2, c bit 2, d bit 2, e bit 2, h bit 2, l bit 3, [hl] bit 3, [ix + des] bit 3, [iy + des] bit 3, a bit 3, b bit 3, c bit 3, d bit 3, e bit 3, h bit 3, l bit 4, [hl] bit 4, [ix + des] bit 4, [iy + des] bit 4, a bit 4, b bit 4, c bit 4, d bit 4, e bit 4, h bit 4, l bit 5, [hl] bit 5, [ix + des] bit 5, [iy + des] bit 5, a bit 5, b bit 5, c bit 5, d bit 5, e bit 5, h bit 5, l bit 6, [hl] bit 6, [ix + des] bit 6, [iy + des] bit 6, a bit 6, b bit 6, c bit 6, d bit 6, e bit 6, h bit 6, l bit 7, [hl] bit 7, [ix + des] bit 7, [iy + des] bit 7, a bit 7, b bit 7, c bit 7, d bit 7, e bit 7, h bit 7, l ; CALL call c, nn call m, nn call nc, nn call nz, nn call p, nn call pe, nn call po, nn call z, nn call nn ; CCF ccf ; CP cp [hl] cp [ix + des] cp [iy + des] cp a cp b cp c cp d cp e cp h cp l cp n ; CP.. cpd cpdr cpir cpi cpl ; DAA daa ; DEC dec [hl] dec [ix + des] dec [iy + des] dec a dec b dec bc dec c dec d dec de dec e dec h dec hl dec ix dec iy dec l dec sp ; DI di ; DJNZ l1 djnz l1 ; EI ei ; EX ex [sp], hl ex [sp], ix ex [sp], iy ex af, af' ex de, hl exx ; HALT halt ; IM im 0 im 1 im 2 ; IN in a, [c] in b, [c] in c, [c] in d, [c] in e, [c] in h, [c] in l, [c] ; INC inc [hl] inc [ix + des] inc [iy + des] inc a inc b inc bc inc c inc d inc de inc e inc h inc hl inc ix inc iy inc l inc sp ; IN... in a, [n] ind indr ini inir ; JP jp nn jp [hl] jp [ix] jp [iy] jp c, nn jp m, nn jp nc, nn jp nz, nn jp p, nn jp pe, nn jp po, nn jp z, nn ; JR jr c, $ + 22h jr nc, $ + 22h jr nz, $ + 22h jr z, $ + 22h jr $ + 22h ; LD ld [bc], a ld [de], a ld [hl], a ld [hl], b ld [hl], c ld [hl], d ld [hl], e ld [hl], h ld [hl], l ld [hl], n ld [ix + des], a ld [ix + des], b ld [ix + des], c ld [ix + des], d ld [ix + des], e ld [ix + des], h ld [ix + des], l ld [ix + des], n ld [iy + des], a ld [iy + des], b ld [iy + des], c ld [iy + des], d ld [iy + des], e ld [iy + des], h ld [iy + des], l ld [iy + des], n ld [nn], a ld [nn], bc ld [nn], de ld [nn], hl ld [nn], ix ld [nn], iy ld [nn], sp ld a, [bc] ld a, [de] ld a, [hl] ld a, [ix + des] ld a, [iy + des] ld a, [nn] ld a, a ld a, b ld a, c ld a, d ld a, e ld a, h ld a, i ld a, l ld a, n ld a, r ld b, [hl] ld b, [ix + des] ld b, [iy + des] ld b, a ld b, b ld b, c ld b, d ld b, e ld b, h ld b, l ld b, n ld bc, [nn] ld bc, nn ld c, [hl] ld c, [ix + des] ld c, [iy + des] ld c, a ld c, b ld c, c ld c, d ld c, e ld c, h ld c, l ld c, n ld d, [hl] ld d, [ix + des] ld d, [iy + des] ld d, a ld d, b ld d, c ld d, d ld d, e ld d, h ld d, l ld d, n ld de, [nn] ld de, nn ld e, [hl] ld e, [ix + des] ld e, [iy + des] ld e, a ld e, b ld e, c ld e, d ld e, e ld e, h ld e, l ld e, n ld h, [hl] ld h, [ix + des] ld h, [iy + des] ld h, a ld h, b ld h, c ld h, d ld h, e ld h, h ld h, l ld h, n ld hl, [nn] ld hl, nn ld i, a ld ix, [nn] ld ix, nn ld iy, [nn] ld iy, nn ld l, [hl] ld l, [ix + des] ld l, [iy + des] ld l, a ld l, b ld l, c ld l, d ld l, e ld l, h ld l, l ld l, n ld r, a ld sp, [nn] ld sp, hl ld sp, ix ld sp, iy ld sp, nn ldd lddr ldi ldir ; NEG neg ; NOP nop ; OR or [hl] or [ix + des] or [iy + des] or a or b or c or d or e or h or l or n ; OT... otdr otir ; OUT out [c], a out [c], b out [c], c out [c], d out [c], e out [c], h out [c], l out [n], a ; OUTD/I outd outi ; POP pop af pop bc pop de pop hl pop ix pop iy ; PUSH push af push bc push de push hl push ix push iy ; RES res 0, [hl] res 0, [ix + des] res 0, [iy + des] res 0, a res 0, b res 0, c res 0, d res 0, e res 0, h res 0, l res 1, [hl] res 1, [ix + des] res 1, [iy + des] res 1, a res 1, b res 1, c res 1, d res 1, e res 1, h res 1, l res 2, [hl] res 2, [ix + des] res 2, [iy + des] res 2, a res 2, b res 2, c res 2, d res 2, e res 2, h res 2, l res 3, [hl] res 3, [ix + des] res 3, [iy + des] res 3, a res 3, b res 3, c res 3, d res 3, e res 3, h res 3, l res 4, [hl] res 4, [ix + des] res 4, [iy + des] res 4, a res 4, b res 4, c res 4, d res 4, e res 4, h res 4, l res 5, [hl] res 5, [ix + des] res 5, [iy + des] res 5, a res 5, b res 5, c res 5, d res 5, e res 5, h res 5, l res 6, [hl] res 6, [ix + des] res 6, [iy + des] res 6, a res 6, b res 6, c res 6, d res 6, e res 6, h res 6, l res 7, [hl] res 7, [ix + des] res 7, [iy + des] res 7, a res 7, b res 7, c res 7, d res 7, e res 7, h res 7, l ; RET ret ret c ret m ret nc ret nz ret p ret pe ret po ret z reti retn ; RL rl [hl] rl [ix + des] rl [iy + des] rl a rl b rl c rl d rl e rl h rl l ; RLA rla ; RLC rlc [hl] rlc [ix + des] rlc [iy + des] rlc a rlc b rlc c rlc d rlc e rlc h rlc l ; RLCA rlca ; RLD rld ; RR rr [hl] rr [ix + des] rr [iy + des] rr a rr b rr c rr d rr e rr h rr l ; RRA rra ; RRC rrc [hl] rrc [ix + des] rrc [iy + des] rrc a rrc b rrc c rrc d rrc e rrc h rrc l ; RRCA rrca ; RRD rrd ; RST rst 0 rst 8 rst 10h rst 18h rst 20h rst 28h rst 30h rst 38h ; SBC sbc a, n sbc a, [hl] sbc a, [ix + des] sbc a, [iy + des] sbc a, a sbc a, b sbc a, c sbc a, d sbc a, e sbc a, h sbc a, l sbc hl, bc sbc hl, de sbc hl, hl sbc hl, sp ; SCF scf ; SET set 0, [hl] set 0, [ix + des] set 0, [iy + des] set 0, a set 0, b set 0, c set 0, d set 0, e set 0, h set 0, l set 1, [hl] set 1, [ix + des] set 1, [iy + des] set 1, a set 1, b set 1, c set 1, d set 1, e set 1, h set 1, l set 2, [hl] set 2, [ix + des] set 2, [iy + des] set 2, a set 2, b set 2, c set 2, d set 2, e set 2, h set 2, l set 3, [hl] set 3, [ix + des] set 3, [iy + des] set 3, a set 3, b set 3, c set 3, d set 3, e set 3, h set 3, l set 4, [hl] set 4, [ix + des] set 4, [iy + des] set 4, a set 4, b set 4, c set 4, d set 4, e set 4, h set 4, l set 5, [hl] set 5, [ix + des] set 5, [iy + des] set 5, a set 5, b set 5, c set 5, d set 5, e set 5, h set 5, l set 6, [hl] set 6, [ix + des] set 6, [iy + des] set 6, a set 6, b set 6, c set 6, d set 6, e set 6, h set 6, l set 7, [hl] set 7, [ix + des] set 7, [iy + des] set 7, a set 7, b set 7, c set 7, d set 7, e set 7, h set 7, l ; SLA sla [hl] sla [ix + des] sla [iy + des] sla a sla b sla c sla d sla e sla h sla l ; SRA sra [hl] sra [ix + des] sra [iy + des] sra a sra b sra c sra d sra e sra h sra l ; SRL srl [hl] srl [ix + des] srl [iy + des] srl a srl b srl c srl d srl e srl h srl l ; SUB sub [hl] sub [ix + des] sub [iy + des] sub a sub b sub c sub d sub e sub h sub l sub n ; XOR xor [hl] xor [ix + des] xor [iy + des] xor a xor b xor c xor d xor e xor h xor l xor n ; End of allb.asm pasmo-0.5.3/alocal.asm0000644000175000017500000000061610155650667011532 00000000000000; alocal.asm ; Test of autolocal mode in CP/M. bdos equ 5 conout equ 2 start org 100h jp _hola _exit db "Good morning.\r\n", 0 _hola ld hl, _exit call showtext jp hola showtext _hola ld a, (hl) cp 0 jp z, _exit push hl ld e, a ld c, conout call bdos pop hl inc hl jp _hola _exit ret hola ld hl, _exit call showtext jp 0 _exit db "Hello, autolocal world\r\n", 0 end start pasmo-0.5.3/bad.asm0000644000175000017500000000002710155650667011021 00000000000000 ld b,+(12+34)*(56+78) pasmo-0.5.3/black.asm0000644000175000017500000000342310155650667011352 00000000000000 ; black.asm ; Fills slowly the spectrum screen. ; This program test some capabilities of Pasmo. ; Try for example: ; pasmo --tapbas black.asm black.tap ; pasmo --tapbas --equ NODELAY black.asm black.tap ; pasmo --tapbas --equ DELAYVALUE=0F000h black.asm black.tap ; To run it in fuse, for example: ; fuse black.tap ; Testing ? short-circuit operator org defined LOADPOS ? LOADPOS : 30000 if defined FILLVALUE value equ FILLVALUE else value equ 0FFh endif start ; Point to the screen bitmap. screen equ defined CPC ? 0C000h : 04000h ; High word of end of screen endscreen equ defined CPC ? 00h : 58h if defined USEHL ld hl, screen else ld ix,screen endif other ; Fills an octet of the screen with the value specified. if defined USEHL ld (hl), value inc hl else ld (ix), value inc ix endif ; Delay ;if not defined NODELAY ;if ~ defined NODELAY ;if ! defined NODELAY ; Testing short-circuit evaluation. if ! defined NODELAY && (! defined DELAYVALUE || DELAYVALUE != 0) ;if ! defined NODELAY || ! defined DELAYVALUE || DELAYVALUE != 0 ; if defined DELAYVALUE ;loops equ DELAYVALUE ; else ;loops equ 100h ; endif ; Testing ? short-circuit operator loops equ defined DELAYVALUE ? DELAYVALUE : 100h ; ld bc, loops ; Testing high and low operators ld b, high loops ld c, low loops delay dec bc ld a,b or c if defined USEJP jp nz, delay else jr nz, delay endif endif ; Test if reached end of screen. ld a, 0 if defined USEHL cp l else cp ixl endif if defined USEJP jp nz, other else jr nz, other endif ld a, endscreen if defined USEHL cp h else cp ixh endif if defined USEJP jp nz, other else jr nz, other endif ; And return to Basic. ret ; Set the entry point, needed with the --tapbas option to autorun. end start pasmo-0.5.3/callvers.asm0000644000175000017500000000063010155650670012100 00000000000000; callvers.asm ; Show the effect of attach the sample RSX echovers ; Adapted from The CP/M Plus programmers guide. bdos equ 5 prtstr equ 9 vers equ 12 cr equ 0dh lf equ 0ah org 100h ld d, 5 loop: push de ld c, prtstr ld de, call$msg call bdos ld c, vers call bdos ld a, l ld (curvers), a pop de dec d jp nz, loop ld c, 0 jp bdos call$msg: db cr, lf, '**** CALLVERS ****$' curvers db 0 end pasmo-0.5.3/defb.asm0000644000175000017500000000123210155650671011165 00000000000000q equ 1 qq equ 1 qqq equ 1 qqqq equ 1 qqqqq equ 1 qqqqqq equ 1 qqqqqqq equ 1 qqqqqqqq equ 1 qqqqqqqqq equ 1 qqqqqqqqqq equ 1 qqqqqqqqqqq equ 1 qqqqqqqqqqqq equ 1 qqqqqqqqqqqqq equ 1 qqqqqqqqqqqqqq equ 1 qqqqqqqqqqqqqqq equ 1 qqqqqqqqqqqqqqqq equ 1 qqqqqqqqqqqqqqqqq equ 1 db 1 db 1, 2 db 1, 2, 3 db 1, 2, 3, 4 db 1, 2, 3, 4, 5 db 1, 2, 3, 4, 5, 6 db 1, 2, 3, 4, 5, 6, 7 db 1, 2, 3, 4, 5, 6, 7, 8 db 1, 2, 3, 4, 5, 6, 7, 8, 9 dw 1 dw 1, 2 dw 1, 2, 3 dw 1, 2, 3, 4 dw 1, 2, 3, 4, 5 dw 1, 2, 3, 4, 5, 6 dw 1, 2, 3, 4, 5, 6, 7 dw 1, 2, 3, 4, 5, 6, 7, 8 dw 1, 2, 3, 4, 5, 6, 7, 8, 9 proc local n n defl 0 rept 20 ds n n defl n + 1 endm endp pasmo-0.5.3/echovers.asm0000644000175000017500000000172710155650670012113 00000000000000; echovers.asm ; Sample RSX for CP/M Plus. ; Adapted from The CP/M Plus programmers guide. ; Changed the 8080 sintaxis to Z80. ; Assemble it with: ; pasmo --prl echovers.asm ECHOVERS.RSX ; Assemble the callvers program with: ; pasmo callvers.asm CALLVERS.COM ; To attach the RSX to the program excute in CP/M Plus: ; GENCOM CALLVERS ECHOVERS ; Now CALLVERS.COM has the RSX attached, run it to see the result. pstring equ 9 cr equ 0dh lf equ 0ah ; RSX PREFIX STRUCTURE db 0,0,0,0,0,0 jp ftest next: db 0c3h ; Jump dw 0 ; Next module in line prev: dw 0 ; Previous module remov: db 0FFh ; Remove flag set nonbnk: db 0 db 'ECHOVERS' db 0,0,0 ftest: ; Is this function 12? ld a, c cp 12 jp z, begin jp next begin: ld hl, 0 add hl, sp ld (ret$stack), hl ld sp, loc$stack ld c, pstring ld de, test$msg call next ld hl, (ret$stack) ld sp, hl ld hl, 0031h ld c, 12 call next ret test$msg: db cr, lf, '***** ECHOVERS *****$' ret$stack: dw 0 ds 32 loc$stack: end pasmo-0.5.3/fill8k.asm0000644000175000017500000000123410161262262011450 00000000000000; fill8k.asm ; ; Generate a file of some size, useful for testing. ; Shows the use of some operators and directives. ; if 0 ; This is for pasmo testing. else fill256 macro local n n defl 0 rept 256 db n n defl n + 1 endm endm endif fill1k macro rept 4 fill256 endm endm filln macro n local j j defl 0 rept n db j j defl (j + 1) mod 256 endm endm init: rept 8 fill1k endm if 1 ; This is for pasmo testing. if defined SOMEMORE && SOMEMORE != 0 filln SOMEMORE endif else if defined SOMEMORE && SOMEMORE != 0 proc local j j defl 0 rept SOMEMORE db j j defl (j + 1) mod 256 endm endp endif endif ; End of fill8k.asm pasmo-0.5.3/hellocpc.asm0000644000175000017500000000122310155650671012056 00000000000000 org 33000 KM_WAIT_CHAR equ #BB06 TXT_INITIALISE equ #BB4E TXT_VDU_ENABLE equ #BB54 TXT_OUTPUT equ #BB5A TXT_CUR_ENABLE equ #BB7B TXT_SET_PEN equ #BB90 TXT_CUR_ON equ #BB81 MC_START_PROGRAM equ #BD16 start if 0 ld hl, program ld c, 0 call MC_START_PROGRAM endif program if 0 call TXT_INITIALISE call TXT_VDU_ENABLE ld a,1 call TXT_SET_PEN endif ld bc,1010h another push bc ld hl,hello again ld a,(hl) cp 0 jr z, exit push hl call TXT_OUTPUT pop hl inc hl jr again exit pop bc djnz another ;call TXT_CUR_ENABLE call TXT_CUR_ON call KM_WAIT_CHAR ret hello db "Hello, Amstrad CPC world.", 0Dh, 0Ah, 0 end start pasmo-0.5.3/hellocpm.asm0000644000175000017500000000230610155650670012072 00000000000000; hellocpm.asm ; (C) 2004 Julian Albo. ; This code may be freely used. ; Simple hello world for cp/m, showing the use of some ; pasmo options to adapt cp/m programs for cp/m 86 or ; ms-dos. ; Assembly with: ; - For cp/m: ; pasmo hellocpm.asm HELLOCPM.COM ; - For cp/m 86: ; pasmo --86 --cmd --equ CPM86 hellocpm.asm HELLOCPM.CMD ; - For ms-dos: ; pasmo --86 --equ MSDOS hellocpm.asm HELLOCPM.COM ; This macro allows to easily adapt the program to run ; in ms-dos or cp/m 86, using the --86 option and, in ; the case of cp/m 86, the --cmd option. ; The MSDOS is really not needed, ms-dos can handle ; call 5 use, but under dosemu this does not work, ; I still don't know why. Defining MSDOS it runs in any ; dos clone. BDOS_CALL macro if defined CPM86 db 0CDh, 0E0h ; int 0E0h, bdos call in cp/m 86 else if defined MSDOS db 088h, 0CCh ; mov ah, cl db 0CDH, 021h ; int 0CDh, ms-dos call. else call 5 ; endif ; endif endm ; BDOS_CALL ; Some cp/m values. CPM_TPA equ 0100h SYSTEM_RESET equ 0 PRINT_STRING equ 9 ; Main program. org CPM_TPA ld de, hello ld c, PRINT_STRING BDOS_CALL ld c, SYSTEM_RESET BDOS_CALL ; Variables. hello db 'Hello, world.', 0Dh, 0Ah, '$' end ; End of hellocpm.asm pasmo-0.5.3/hellospec.asm0000644000175000017500000000045710155650667012260 00000000000000 org 30000 tv_flag equ 5C3Ch start ; Directs rst 10h output to main screen. xor a ld (tv_flag),a ld b, 50 another push bc ld hl,hello again ld a,(hl) cp 0 jr z, exit push hl rst 10h pop hl inc hl jr again exit pop bc djnz another ret hello db "Hello, world.", 0Dh, 0 end start pasmo-0.5.3/hilo.asm0000644000175000017500000000140010155650670011214 00000000000000; hilo.asm ; Test of HIGH and LOW operators. bdos equ 5 org 100h l1 equ 01234h l2 equ 0FFFFh l3 equ 0F07Fh ld a, high l1 call showreg call showendline ld a, low l1 call showreg call showendline ld a, high l1 or l3 call showreg call showendline ld a, high (low l1) and l3 call showreg call showendline call 0 showendline: ld de, endline ld c, 9 call bdos ret endline defb 0Dh, 0Ah, '$' showreg: push bc push hl push af push af ld e, 20h ld c, 2 call bdos pop af ; Para ver mejor al trazar. and 0F0h rept 4 rrca endm call shownibble pop af call shownibble pop hl pop bc ret shownibble: and 0Fh add a, 30h cp 3Ah jp c, isdigit add a, 7 isdigit: ld e, a ld c, 2 call bdos ret ; End of showline.asm pasmo-0.5.3/hola.asm0000644000175000017500000000102710155650667011217 00000000000000; hola.asm ;bdos: equ 5 org 5 bdos: org 100H if defined CPM86 ; Install a call to bdos in the cp/m bdos call address ld a,0CDh ld (5),a ld a,0E0h ld (6),a ld a,0C3h ld (7),a endif ld bc,2565 ; scf ccf sigue: push bc call sayhello ; ld a, 1 ;otro: ; dec a ; defb 214, 1; SUB 1 ; jp nz, otro pop bc dec c ; jr nz, sigue jp nz, sigue ; djnz sigue ld c, 0 call bdos halt sayhello: ld c, 9 ld de, hola call bdos ; ret ld c, 2 dec c ret nz call 0 hola: defb 'Hola, mundo.', 13, 10, '$' end pasmo-0.5.3/if.asm0000644000175000017500000000015410155650667010672 00000000000000; if.asm proc local v v equ 0 if v ld a, 0 else ld a, 1 endif endp nop ; if.asm finished pasmo-0.5.3/include.asm0000644000175000017500000000014510155650667011717 00000000000000 org 100h ; include.asm nop include if.asm halt include if.asm ex de,hl exx ex af, af' end pasmo-0.5.3/indent.asm0000644000175000017500000000006110171245317011540 00000000000000; indent.asm l1 nop l2 nop l3 nop l4 end pasmo-0.5.3/jumptable.asm0000644000175000017500000000203010161306015012230 00000000000000; jumptable.asm ; Test of ## operator. org 100h bdos equ 5 conin equ 1 pstring equ 9 start jp init jpfunc macro nfunc jp function_ ## nfunc endm table: irp func, mess1, mess2, presskey, endline jpfunc func endm print ld c, pstring jp bdos init if 0 rept 3, nfunc ld a, nfunc call usefunc endm else rept 3, nfunc, 2, -1 ld a, nfunc call usefunc endm endif ld a, 3 call usefunc ld c, 0 call bdos usefunc ld b, a add a, a add a, b ld c, a ld b, 0 ld hl, table add hl, bc push hl ret function_mess1 proc local message ld de, message call print ret message db "Hello, world\r\n$" endp function_mess2 proc local message ld c, pstring ld de, message jp bdos message db 'Have a nice day', 0Dh, 0Ah, '$' endp function_presskey proc local message ld c, pstring ld de, message call bdos ld c, conin call bdos ret message db 'Press any key...$' endp function_endline proc local message ld de, message jp print message db 0Dh, 0Ah, '$' endp end start ; End of jumptable.asm pasmo-0.5.3/lee.asm0000644000175000017500000000164010155650667011042 00000000000000; lee.asm fcb1 equ 05Ch bdos equ 5 bdosconsoleoutput equ 02h bdosprintstring equ 09h bdosopenfile equ 0Fh bdosclosefile equ 10h bdosreadsequential equ 14h bdossetdmaaddress equ 1Ah org 100h ld de, fcb1 ld c, bdosopenfile call bdos cp 0FFh jp z, fallo ld de, buffer again push de ld c, bdossetdmaaddress call bdos ld de, fcb1 ld c, bdosreadsequential call bdos cp 0 jp z, sigue cp 1 jp z, finlee jp fallo sigue pop de ld hl, 128 add hl, de ld d, h ld e, l jp again finlee ld c, bdosclosefile ld de, fcb1 call bdos ld hl, buffer ld bc, 512 nextchar ld e, (hl) push hl push bc ld c, bdosconsoleoutput call bdos pop bc pop hl inc hl dec bc ld a, c or b jp nz, nextchar ld c, 0 call bdos fallo ld de, mensajeerror ld c, bdosprintstring call bdos ld c, 0 call bdos mensajeerror defb 'Error.', 0Dh, 0Ah, '$' public again, fallo buffer equ $ end 100h ; End of lee.asm pasmo-0.5.3/limit64.asm0000644000175000017500000000004310170776146011557 00000000000000 org $002B nop idbyt1 ds $002B -$ pasmo-0.5.3/local.asm0000644000175000017500000000052010155650667011363 00000000000000; local.asm ; Test of LOCAL, PROC and ENDP under CP/M. bdos equ 5 conout equ 2 org 100h jp hola exit db "Hello, local world\r\n", 0 showtext proc local hola, exit hola ld a, (hl) cp 0 jp z, exit push hl ld e, a ld c, conout call bdos pop hl inc hl jp hola exit ret endp hola ld hl, exit call showtext jp 0 end pasmo-0.5.3/macro.asm0000644000175000017500000000133410155650667011376 00000000000000; macro.asm ; Test of MACRO and ENDM directives. ; Following a sample of the documentation of Digital Research MAC. ; For use with CP/M. reboot equ 0 tpa equ 100h bdos equ 5 type equ 2 cr equ 0Dh lf equ 0Ah _hola chrout macro ld c, type call bdos endm typeout macro ?message local pastsub jp pastsub msgout: ld e, (hl) ld a, e or a ret z inc hl push hl chrout pop hl jp msgout pastsub: ; Redefine the typeout macro after the first invocation. typeout macro ??message local tymsg local pastm ld hl, tymsg call msgout jp pastm tymsg: db ??message, cr, lf, 0 pastm: endm typeout ?message endm org 100h typeout "Hello, \"macro\" world" typeout "\x30\7" typeout 'That''s all folks!' jp reboot end pasmo-0.5.3/mas.asm0000644000175000017500000001244110155650667011056 00000000000000; MAS ; ; Revista "El Ordenador Personal" num 57, marzo 1987 ; Autor: L. Suárez ; Adaptación para posibilitar su ensamblado para CP/M 86 ; con pasmo por Julian Albo. ;El programa funciona como la orden TYPE de CPM, excepto que se ;detiene cada vez que se escriben 24 líneas de pantalla, esperando por la ;pulsación de cualqier tecla. ;La sintaxis correcta es: MAS d:FILENAME.TYP, en la que d es la ;identificación del drive en el que se encuentra el archivo ;FILENAME.TYP. ; VALORES UTILIZABLES NULO EQU 00H ; Caracter nulo. BACK EQU 08H ; Cursor un lugar a la izquierda. LF EQU 0AH ; Cursor una línea abajo. UP EQU 0BH ; Cursor una línea arriba. CLS EQU 0CH ; Cursor a la página siguiente. CR EQU 0DH ; Cursor al comienzo de la línea. EOF EQU 1AH ; Señala el final de un archivo ASCII. FIL EQU 24 ; Número de filas de pantalla. COL EQU 80 ; Número de columnas de pantalla. TASEC EQU 128 ; Tamaño de un sector. if ! defined CPM86 TAPILA EQU 50 ; Tamaño de la pila, o stack. endif CMDBUF EQU 0080H ; Buffer del CP/M para órdenes. DFTFCB12 EQU 0068H DFTFCB EQU 005CH ; Dirección del FCB por defecto. BDOS EQU 5 ; Punto de entrada de las rutinas BDOS. PRBYT EQU 2 ; Envia un caracter a la pantalla. INOUT EQU 6 ; Enviar/Recibir un byte pant/teclado. OPEN EQU 15 ; Abrir un archivo. READSE EQU 20 ; Leer sectores de forma secuencial. SETDMA EQU 26 ; Lugar para dejar sector leído. RECIB EQU 0FFH ; Para indicar recibir desde teclado. ORG 100H if ! defined CPM86 LD (STACK), SP ; Resguardo del stack. LD SP, PILA ; nuevo stack para programa. else ; Install a call to bdos in the cp/m bdos call address ld a,0CDh ld (5),a ld a,0E0h ld (6),a ld a,0C3h ld (7),a endif CALL PANCR ; Cursor a nueva línea. LD A, (CMDBUF) ; Num. de caracteres de la CP 2 ; orden inicial JP C, ERROR LD HL, DFTFCB12 ; Lugar siguiente al nombre. LD B, 24 ; Resto del FCB. INI1: LD (HL), NULO ; relleno con ceros. INC HL DJNZ INI1 LD DE, DFTFCB ; Dirección del FCB del LD A, OPEN ; archivo a abrir. CALL CPM ; Sale con A=0FFH si no INC A ; existe el archivo buscado. JP Z, ERROR ; No existe. LD C, FIL ; Inicia la cuenta de filas, LD B, COL ; y de columnas. LEER: LD DE, DMASRC ; Donde colocar el sector. LD A, SETDMA ; que se va a leer y, CALL CPM LD DE, DFTFCB ; desde que archivo se lee. LD A, READSE ; Leer sector secuencialmente. CALL CPM ; Sale con A=0 si pudo leer. OR A ; ¿Final archivo? JP NZ, FINAL ; Sí, ya no hay más. LD HL, DMASRC ; Apunta a comienzo de sector. ESC1: LD A, (HL) ; Toma un caracter. CP EOF ; ¿Es el final del archivo? JP Z, FINAL ; Sí, no hay más. OR A ; ¿Otro tipo de final? JP Z, FINAL ; Sí, no hay más. CP CLS ; ¿Cursor a página nueva? JR NZ, ESC2 ; No. LD C, FIL ; Sí, reinciar filas, LD B, COL ; y columnas. JR ESPERA ESC2: CP LF ; ¿A la línea inferior? JR NZ, ESC4 ; No. ESC3: DEC C ; Sí, una fila menos. LD A, C OR A ; ¿Era la última? JR NZ, ESCRIB ; No. LD C, FIL ; Sí, reinicia filas. JR ESPERA ESC4: CP CR ; ¿A comienzo de línea? JR NZ, ESC5 ; No. LD B, COL ; Sí, reinicia columnas. JR ESCRIB ESC5: CP UP ; ¿A la línea superior? JR NZ, ESC7 ; No. ESC6: INC C ; Sí, una fila más. LD A, FIL CP C ; ¿Era ya C el valor máximo? JR NC, ESCRIB ; No. LD C, A ; FIL como máximo. JR ESCRIB ESC7: CP BACK ; ¿Cursor un lugar atrás? JR NZ, ESC8 ; No. INC B ; Sí, una columna más. LD A, COL CP B ; ¿Era B ya el valor máximo? JR NC, ESCRIB ; No. LD B, 1 ; Sí, último de la anterior, JR ESC6 ; y aumentar el num. de filas. ESC8: DEC B ; En cualquier otro caso, una LD A, B ; columna menos, salvo que ya OR A ; fuese la última. JR NZ, ESCRIB ; No. LD B, COL ; Sí, reinicia columnas, JR ESC3 ; y reduce el num. de filas. ESPERA: LD E, RECIB ; Espera a que se pulse una LD A, INOUT ; tecla cualquiera. CALL CPM OR A ; ¿Se ha pulsado alguna? JR Z, ESPERA ; No. ESCRIB: LD E, (HL) ; Sí, tomar de nuevo el mismo CALL SALPAN ; carc. y enviarlo a pantalla. LD DE, FINDMA INC HL LD A, H ; ¿Es el final del sector? CP D JR C, ESC1 ; No, ya que HLDE. LD A, L ; Puesto que H=D ver L y E. CP E ;JR C, ESC1 ; No, ya que HL=DE, leer otro ; sector del archivo. CPM PUSH HL ; Resguardar HL. PUSH BC ; Resguardar BC. LD C, A ; Índice de rutina a C. CALL BDOS POP BC ; Recuperar BC. POP HL ; Recuperar HL. RET PANCR: LD E, LF ; Una línea más abajo. CALL SALPAN LD E, CR ; y al comienzo de la misma. SALPAN: LD A, PRBYT ; Enviar el caracter en E a la CALL CPM ; pantalla. RET ERROR: LD HL, CMDBUF ; CP/M deja allí la orden. LD A, (HL) ; inicial, con A caracteres. OR A JR Z, FINAL0 ; No hay ninguno tras MAS. INC HL ; Si los hay, pasa el número LD B, A ; al registro B, ESORD1: LD E, (HL) ; los toma uno a uno, y los CALL SALPAN ; saca a pantalla. INC HL DJNZ ESORD1 FINAL0: LD E, '?' ; Más una interrogación, y CALL SALPAN FINAL: CALL PANCR ; pasa a una línea más abajo. if ! defined CPM86 LD SP, (STACK) ; Recupera el stack original, RET ; y termina el programa. else ld c, 0 call BDOS endif if ! defined CPM86 STACK: DS 2 ; Para guardar el stack. PILA EQU $ + TAPILA ; Comienzo stack propio. DMASRC EQU PILA + 1 ; Comienzo almacén sector. else DMASRC EQU $ endif FINDMA EQU DMASRC + TASEC ; Siguiente a último lugar ; del almacén del sector. this_is_the_end: END pasmo-0.5.3/protector.asm0000644000175000017500000000457210155650667012325 00000000000000; protector.asm ; Rutinas RSX para un juego de Amstrad CPC. ; Revista "El Ordenador Personal" num. 52, octubre 1986 org #0A000 extcom equ #0BCD1 askcur equ #0BBC6 linrel equ #0BBF9 linabs equ #0BBF6 movrel equ #0BBC3 movabs equ #0BBC0 setpen equ #0BBDE tstrel equ #0BBF3 ld bc, rsx ld hl, kernal jp extcom rsx defw table jp boum jp vise jp choc table defm 'BOU', 'M' + 80H defm 'VIS', 'E' + 80H defm 'CHO', 'C' + 80H, 0 ; Cambiado esto para que coincida con las DATA de la revista ; y asi poder comprobar el checksum. ;kernal defs 4 kernal defb #FC, #A6, #09, #A0 boum cp 1 ret nz call askcur push hl push de ld a, 1 call setpen ld a, (ix + 0) ; and #0Fh ; Debe ser par - ERRATA and #FE ; Debe ser par push af ; Memoriza este valor ld d, 0 ld e, a ld h, 0 ld l, a call movrel pop af add a, a ; Longitud de un lado ld h, 0 ld l, a push hl ; Memoriza la longitud call invers push hl ; Memoriza -L ld de, 0 ; 0, -L call linrel pop de ; -L, 0 ld hl, 0 call linrel ld de, 0 ; 0, L pop hl push hl call linrel pop de ; L, 0 ld hl, 0 call linrel jp centre vise cp 2 ret nz ld d, (ix + 3) ld e, (ix + 2) ld h, (ix + 1) ld l, (ix + 0) push hl push de call movabs ld a, 3 ; Pen 3 call setpen ld de, 0 ; mover 0, 6 ld hl, 6 push hl push de call movrel pop de ; drawr 0, 6 pop hl push de call linrel pop de ; mover 0, 24 ld hl, 24 call invers call movrel ld de, 0 ; draw 0, 6 ld hl, 6 push hl call linrel pop de ; mover -12, 6 ld hl, 12 call invers ex de, hl call movrel ld de, 6 ; draw 6, 0 ld hl, 0 push hl call linrel ld de, 12 ; mover 12, 0 pop hl push hl call movrel ld de, 6 ; draw 6, 0 pop hl call linrel jp centre choc cp 2 ret nz ld d, (ix + 3) ld e, (ix + 2) ld h, (ix + 1) ld l, (ix + 0) push hl push de call movabs ld a, 0 ld (result), a ld de, 0 ; testr (0, 0) push de pop hl call tstrel call ajout ld de, 12 ; testr (12, 0) ld hl, 0 call tstrel call ajout ld hl, 6 ; testr (-6, -8) call invers push hl pop de dec hl dec hl call tstrel call ajout ld de, 0 ; testr (0, 2) ld hl, 2 call tstrel call ajout jp centre ajout cp 1 jr z, suite1 cp 2 ret nz ; Si rojo ld a, 10 suite1 ld hl, result add a, (hl) ld (hl), a ret centre pop de pop hl jp movabs invers xor a sub l ld l, a sbc a, h sub l cp h ld h, a scf ret nz cp 1 ret result defb 0 end #0A000 pasmo-0.5.3/rept.asm0000644000175000017500000000152610157044662011244 00000000000000; rept.asm ; Test of rept and irp directives. ; Macro with rept and irp inside. hola macro local unused, unused2 unused rept 2 db 'Rept inside macro', 0 endm unused2 irp ?reg, af,bc, de, hl push ?reg endm endm ; hola ;------------------------------------- rept 10 db 'Hello, reptworld' endm rept 3 ; Rept with calculated end condition. n defl 1 rept 0FFFFh n defl n + 2 if n gt 10 exitm endif rept 4 db n endm endm endm ; Macro call inside rept. rept 2 hola endm ; New syntax. counter equ 1234h ; With counter (initial value 0 and step 1 assumed): rept 3, counter db counter endm ; With counter and initial value (step 1 assumed): rept 3, counter, 5 db counter endm ; With counter, initial value and step: rept 3, counter, 7, -1 db counter endm ; Testing that counter was local: defw counter end pasmo-0.5.3/reserv.asm0000644000175000017500000000012510155650670011572 00000000000000 org 100h nn equ 1 add$: nop jr add$ ld b, (1) add a,(nn) add a,(add$) or (nn) pasmo-0.5.3/showfcb.asm0000644000175000017500000000246710155650667011740 00000000000000; showfcb.asm bdos equ 5 conout equ 2 printstring equ 9 public fcb1, fcb2 fcb1 equ 005Ch fcb2 equ 006Ch org 100h call endline ld hl, fcb1 call showfcb call endline ld hl, fcb2 call showfcb call endline ld hl, fcb1 ld de, 12 add hl, de ld (hl), 0 ld de, dma ld c, 1Ah call bdos ld de, fcb1 ld c, 11h call bdos cp 0FFh jp z, final public otro otro: ld hl, dma ; Calculate the position of the result ; into the dma. add a, a add a, a add a, a add a, a add a, a ld e, a ld d, 0 add hl, de call showfcb call endline ld de, fcb1 ld c, 12h call bdos cp 0FFh jp z, final jp otro public final final: ld c, 0 call bdos public showfcb showfcb ld a, (hl) cp 0 ;jr z, nodrive jp z, nodrive dec a add a, 'A' ld e, a call printchar ld e, ':' call printchar nodrive inc hl ld b, 8 public name name ld e, (hl) call printchar inc hl ;djnz name dec b jp nz, name ld e, '.' call printchar ld b, 3 public ext ext ld e, (hl) call printchar inc hl ;djnz ext dec b jp nz, ext ret HERE: public HERE public printchar printchar push bc push de push hl ld c, conout call bdos pop hl pop de pop bc ret public endline endline ld de, crlf ld c, printstring jp bdos crlf db 0Dh, 0Ah, '$' public dma dma equ $ public this_is_the_end this_is_the_end end pasmo-0.5.3/showkeys.asm0000644000175000017500000000120510155650667012146 00000000000000; showkeys.asm bdos equ 5 org 100h other: ld c, 6 ; This works only in cp/m plus. ;ld e, 0FDh ;call bdos ld e,0FFh call bdos cp 0 jp z, other cp 20h jp z, finish call showreg jp other finish ld c, 2 ld e, 0Dh call bdos ld c, 2 ld e, 0Ah call bdos call 0 showreg: push bc push hl push af push af ld e, 20h ld c, 2 call bdos pop af ; Para ver mejor al trazar. and 0F0h rrca rrca rrca rrca call shownibble pop af call shownibble pop hl pop bc ret shownibble: and 0Fh add a, 30h cp 3Ah jp c, isdigit add a, 7 isdigit: ld e, a ld c, 2 call bdos ret this_is_the_end: end ; End pasmo-0.5.3/showline.asm0000644000175000017500000000160510155650667012126 00000000000000; showline.asm bdos equ 5 parambegin equ 80h paramlen equ 128 org 100h call showendline ld hl, parambegin ld b, paramlen nextchar: ld a, (hl) call showreg inc hl ;djnz nextchar dec b jp nz, nextchar call showendline ld hl, parambegin ld a, (hl) nextchar2: inc hl cp 0 jp z, nomorechar ld e, (hl) ld c, 2 push hl push af call bdos pop af pop hl dec a jp nextchar2 nomorechar: call showendline call 0 showendline: ld de, endline ld c, 9 call bdos ret showreg: push bc push hl push af push af ld e, 20h ld c, 2 call bdos pop af ; Para ver mejor al trazar. and 0F0h rrca rrca rrca rrca call shownibble pop af call shownibble pop hl pop bc ret shownibble: and 0Fh add a, 30h cp 3Ah jp c, isdigit add a, 7 isdigit: ld e, a ld c, 2 call bdos ret endline defb 0Dh, 0Ah, '$' this_is_the_end: end ; End of showline.asm pasmo-0.5.3/t86.asm0000644000175000017500000000010310155650670010701 00000000000000 ld a,(hl) ld a,a ld a,b ld a,c ld a,d ld a,e ld a,h ld a,l pasmo-0.5.3/test.asm0000644000175000017500000000127510155650667011260 00000000000000; test.asm org 100H ; Instructions without parameters. ccf cpd cpdr cpi cpir cpl daa di ei exx halt ldd lddr ldi ldir nop neg otdr otir outd outi reti retn rla rlca rld rra rrca rrd scf ld a, 1 ld (hl), 2 ld a, (hl) inc hl dec hl inc (hl) dec (hl) ld b, b ld b, c ld b, d ld b, e ld b, h ld b, l ld b, (hl) ld b, a ld c, b ld c, c ld c, d ld c, e ld c, h ld c, l ld c, (hl) ld c, a ld d, b ld d, c ld d, d ld d, e ld d, h ld d, l ld d, (hl) ld d, a cp 128 cp b cp c cp d cp e cp h cp l cp (hl) cp a cp (ix) cp (iy + 10) jp (hl) jp (ix) jp (iy) ex af, af' ex de,hl ex (sp), hl ex (sp), ix ex (sp), iy call 0 pasmo-0.5.3/tmacro.asm0000644000175000017500000000147610161406433011554 00000000000000; tmacro.asm ; Some tests of macro usage. org 100h ; To run in cp/m start: macro bdos, function ld c, function call 5 endm lineend macro ld e, 0Dh bdos 2 ld e, 0Ah bdos 2 endm macro pushall push af push bc push de push hl endm popall macro pop hl pop de pop bc pop af endm ; Another way. pall macro operation irp reg, af, bc, de, hl local i1 operation reg endm endm pushall2 macro pall push endm popall2 macro irp reg, af, bc, de, hl pop reg endm endm ; Yet another way pushmany macro reg rept -1 if nul reg exitm endif push reg .shift endm endm pushall3 macro pushmany af, bc, de, hl endm ; Main program ; pushall ; pushall2 pushall3 ld de, hello i1 bdos 9 i2: lineend ;popall popall2 bdos 0 hello db 'Hello, world.$' end start ; End of tmacro.asm pasmo-0.5.3/undoc.asm0000644000175000017500000000216110155650667011404 00000000000000; undoc.asm ; Test of assembling of undocumented z80 instructions. org 100h ; For tests with cp/m ld a,ixh ld a,ixl ld a,iyh ld a,iyl ld b,ixh ld b,ixl ld b,iyh ld b,iyl ld c,ixh ld c,ixl ld c,iyh ld c,iyl ld d,ixh ld d,ixl ld d,iyh ld d,iyl ld e,ixh ld e,ixl ld e,iyh ld e,iyl ld ixh,a ld ixh,b ld ixh,c ld ixh,d ld ixh,e ld ixh,ixh ld ixh,ixl ld ixh,20h ld ixl,a ld ixl,b ld ixl,c ld ixl,d ld ixl,e ld ixl,ixh ld ixl,ixl ld ixl,20h ld iyh,a ld iyh,b ld iyh,c ld iyh,d ld iyh,e ld iyh,iyh ld iyh,iyl ld iyh,20h ld iyl,a ld iyl,b ld iyl,c ld iyl,d ld iyl,e ld iyl,iyh ld iyl,iyl ld iyl,20h inc ixh inc ixl inc iyh inc iyl dec ixh dec ixl dec iyh dec iyl add a,ixh add a,ixl add a,iyh add a,iyl adc a,ixh adc a,ixl adc a,iyh adc a,iyl sbc a, ixh sbc a, ixl sbc a, iyh sbc a, iyl sub ixh sub ixl sub iyh sub iyl and ixh and ixl and iyh and iyl xor ixh xor ixl xor iyh xor iyl or ixh or ixl or iyh or iyl cp ixh cp ixl cp iyh cp iyl sll a sll b sll c sll d sll e sll h sll l sll (hl) sll (ix+20h) sll (iy+20h) end