From 3abd2e87aa35f02a20c8bcb6899cde1c8f41a20d Mon Sep 17 00:00:00 2001 From: asc Date: Wed, 22 Jan 2014 20:42:34 -0800 Subject: [PATCH] Refactor to use GNU build tools * Added configure.ac and non-recursive Makefile.am * Modularized source into subdirectories * Simplified header inclusion --- .apple2 | 2 +- .gitignore | 35 + ASM | 17 +- AUTHORS | 24 +- ChangeLog | 16 + INSTALL | 182 -- Makefile.am | 65 + NEWS | 17 + PROBLEMS | 61 +- configure.ac | 208 ++ disks/blank.dsk.gz | Bin 0 -> 7335 bytes docs/apple2ix.6 | 234 ++ reconf.sh | 12 + src/Makefile | 408 ---- src/apple2.h | 8 +- src/{ => asm386}/cpu.S | 0 src/{ => asm386}/display.S | 2 +- src/{ => asm386}/genglue | 2 +- src/{ => asm386}/glue-prologue.h | 0 src/{ => asm386}/memory.S | 0 src/{ => audio}/AY8910.c | 10 +- src/{ => audio}/AY8910.h | 0 src/{ => audio}/SSI263Phonemes.h | 0 src/{ => audio}/alhelpers.c | 10 +- src/{ => audio}/alhelpers.h | 0 src/{ => audio}/ds-shim.h | 2 +- src/{ => audio}/mockingboard.c | 14 +- src/{ => audio}/mockingboard.h | 4 +- src/{ => audio}/peripherals.h | 4 +- src/{ => audio}/soundcore-openal.c | 5 +- src/{ => audio}/soundcore-openal.h | 2 - src/{ => audio}/soundcore.c | 12 +- src/{ => audio}/soundcore.h | 2 +- src/{ => audio}/speaker.c | 12 +- src/{ => audio}/speaker.h | 2 +- src/{ => audio}/win-shim.c | 2 +- src/{ => audio}/win-shim.h | 0 src/common.h | 35 +- src/cpu-supp.c | 2 - src/debug.c | 3397 ---------------------------- src/disk.c | 10 - src/genfont.c | 3 +- src/interface.c | 12 - src/joystick.c | 30 +- src/keys.c | 17 +- src/keys.h | 2 +- src/{ => meta}/debug.h | 0 src/{ => meta}/debug.l | 12 +- src/{ => meta}/debugger.c | 13 +- src/{ => meta}/opcodes.c | 2 +- src/misc.c | 45 +- src/misc.h | 4 - src/prefs.c | 29 +- src/prefs.h | 8 +- src/timing.c | 11 +- src/{ => video}/video.h | 0 src/{ => video}/xvideo.c | 64 +- src/vidsup.c | 5 +- src/zlib-helpers.c | 5 +- 59 files changed, 783 insertions(+), 4297 deletions(-) delete mode 100644 INSTALL create mode 100644 Makefile.am create mode 100644 configure.ac create mode 100644 disks/blank.dsk.gz create mode 100644 docs/apple2ix.6 create mode 100755 reconf.sh delete mode 100644 src/Makefile rename src/{ => asm386}/cpu.S (100%) rename src/{ => asm386}/display.S (99%) rename src/{ => asm386}/genglue (75%) rename src/{ => asm386}/glue-prologue.h (100%) rename src/{ => asm386}/memory.S (100%) rename src/{ => audio}/AY8910.c (99%) rename src/{ => audio}/AY8910.h (100%) rename src/{ => audio}/SSI263Phonemes.h (100%) rename src/{ => audio}/alhelpers.c (99%) rename src/{ => audio}/alhelpers.h (100%) rename src/{ => audio}/ds-shim.h (99%) rename src/{ => audio}/mockingboard.c (99%) rename src/{ => audio}/mockingboard.h (97%) rename src/{ => audio}/peripherals.h (96%) rename src/{ => audio}/soundcore-openal.c (99%) rename src/{ => audio}/soundcore-openal.h (97%) rename src/{ => audio}/soundcore.c (99%) rename src/{ => audio}/soundcore.h (99%) rename src/{ => audio}/speaker.c (99%) rename src/{ => audio}/speaker.h (97%) rename src/{ => audio}/win-shim.c (98%) rename src/{ => audio}/win-shim.h (100%) delete mode 100644 src/debug.c rename src/{ => meta}/debug.h (100%) rename src/{ => meta}/debug.l (99%) rename src/{ => meta}/debugger.c (99%) rename src/{ => meta}/opcodes.c (99%) rename src/{ => video}/video.h (100%) rename src/{ => video}/xvideo.c (97%) diff --git a/.apple2 b/.apple2 index 06332eb1..96d9f4a4 100644 --- a/.apple2 +++ b/.apple2 @@ -1,8 +1,8 @@ speed = 1.00 altspeed = 4.00 -mode = //e disk path = /usr/local/games/apple2/disks color = interpolated +video = 1X volume = 8 joystick = joy keypad system path = /usr/local/games/apple2/rom diff --git a/.gitignore b/.gitignore index 94205106..6b1d4b65 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,38 @@ # vimstuff *.swp + +# GNU buildtools autogenerated +configure +autom4te.cache +.deps +stamp-h1 +config.h +config.h.in* +config.log +config.status +aclocal.m4 +Makefile +Makefile.in +compile +depcomp +install-sh +INSTALL +missing +ylwrap +.dirstamp +apple2ix*.tar.gz + +# generated sources +src/font.c +src/asm386/glue.S +src/meta/debug.c + +# generated binaries +apple2ix +genfont + +# man testing +man +man6 + diff --git a/ASM b/ASM index 649b7a5d..df502013 100644 --- a/ASM +++ b/ASM @@ -1,15 +1,14 @@ Begin3 -Title: Apple // emulator for Linux +Title: Apple //ix Author: alexb@csd.uu.se (Alexander Jean-Claude Bottema) sl14@cornell.edu (Stephen Lee) - asc@mhpcc.edu (Aaron Culliney) michael@talamasca.ocis.net (Michael Deutschmann) -Version: 0.7.4 -Entered-date: 2000-03-24 -Description: Apple II+, //e emulator. Uses svgalib or X. -Keywords: emulator, linux -Uploader: michael@talamasca.ocis.net (Michael Deutschmann) -Primary-site: ftp.ocis.net /pub/users/ldeutsch/release/ - 257k apple2-emul-0.7.4.tar.gz + ASC _at_ BITR0T (Aaron Culliney) +Version: 0.8 +Entered-date: 2014-02-27 +Description: Apple //e emulator for POSIX systems +Keywords: emulator, linux, posix +Uploader: ASC _at_ BITR0T (Aaron Culliney) +Primary-site: https://github.com/mauiaaron/apple2 Platform: Linux i386 End diff --git a/AUTHORS b/AUTHORS index 17bc46ea..fbf0b130 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,11 +1,19 @@ -Alexander Jean-Claude Bottema made the original -version of the emulator in 1994. +Apple //ix was originally developed as the "apple2-emul-linux" package. -Stephen Lee and particularly Aaron Culliney - have done much work on the emulator since. +Alexander Jean-Claude Bottema made the original version of the +emulator in 1994. -Michael Deutschmann cleaned up the -build sequence to use standard GNU tools, and is the present coordinator. +Stephen Lee contributed early work on the emulator. + +Michael Deutschmann cleaned up the build sequence +to use standard GNU tools. + +Tom Lear maintained a Debian package of this program, +and has contributed some fixes. + +Aaron Culliney contributed to early versions of this emulator, and picked up +development again in 2012. + +In addition we are indebted to Tom Charlesworth from the AppleWin emulator +project. AppleWin is free software for the Windows platform. -Tom Lear maintains the Debian package of -this program, and has contributed some fixes. diff --git a/ChangeLog b/ChangeLog index f4780689..444d4ea0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +Thu Feb 27, 2014 : Aaron Culliney @ bitr0t.com + * Rebranded as "apple2ix" with a 0.8 revision + * X11 now uses true color and can dynamically resize window between 1x + and 2x. + * Better emulation fidelity by counting 6502 CPU cycles. This is + necessary for proper generation of digital audio. + * Use OpenAL backend for all sound (some soundcode/speaker source + derived/shimmed from AppleWin source). + * Preliminary support for Mockingboard (again sourced from AppleWin) + * Fixes for Linux Joystick (both PC Joystick and Emulated Keypad/Arrows) + * Simplifications to interface modes and preferences + * Interfaces are now 80columns + * Removed support for console SVGAlib + * Use zlib for inflating/deflating disk images + * Deprecated support for ][+ and ][+ undocumented modes + Thu Mar 23, 2000 : Michael Deutschmann * configure.in: set revision to 0.7.4, final release diff --git a/INSTALL b/INSTALL deleted file mode 100644 index b42a17ac..00000000 --- a/INSTALL +++ /dev/null @@ -1,182 +0,0 @@ -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, a file -`config.cache' that saves the results of its tests to speed up -reconfiguring, and a file `config.log' containing compiler output -(useful mainly for debugging `configure'). - - 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 at some point `config.cache' -contains results you don't want to keep, you may remove or edit it. - - The file `configure.in' is used to create `configure' by a program -called `autoconf'. You only need `configure.in' 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. You can give `configure' -initial values for variables by setting them in the environment. Using -a Bourne-compatible shell, you can do that on the command line like -this: - CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure - -Or on systems that have the `env' program, you can do it like this: - env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure - -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 supports 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' can not 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 can not guess the host type, give it the -`--host=TYPE' option. TYPE can either be a short name for the system -type, such as `sun4', or a canonical name with three fields: - CPU-COMPANY-SYSTEM - -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 can also -use the `--target=TYPE' option to select the type of system they will -produce code for and the `--build=TYPE' option to select the type of -system on which you are compiling the package. - -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. - -Operation Controls -================== - - `configure' recognizes the following options to control how it -operates. - -`--cache-file=FILE' - Use and save the results of the tests in FILE instead of - `./config.cache'. Set FILE to `/dev/null' to disable caching, for - debugging `configure'. - -`--help' - Print a summary of the options to `configure', and exit. - -`--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. - -`--version' - Print the version of Autoconf used to generate the `configure' - script, and exit. - -`configure' also accepts some other, not widely useful, options. diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 00000000..cd3509e7 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,65 @@ + +AM_CPPFLAGS = -Isrc +AM_CPPFLAGS += -I../src # work around some bug in make distcheck +#LDFLAGS = +#LDADD = + +man_MANS = docs/apple2ix.6 + +noinst_HEADERS = src/apple2.h src/common.h src/cpu.h src/disk.h src/glue.h \ + src/interface.h src/joystick.h src/keys.h src/misc.h src/prefs.h \ + src/timing.h src/uthash.h src/video/video.h src/zlib-helpers.h \ + \ + src/asm386/glue-prologue.h \ + src/meta/debug.h \ + \ + src/audio/alhelpers.h src/audio/AY8910.h src/audio/ds-shim.h \ + src/audio/mockingboard.h src/audio/peripherals.h src/audio/soundcore.h \ + src/audio/soundcore-openal.h src/audio/speaker.h \ + src/audio/SSI263Phonemes.h src/audio/win-shim.h + +noinst_PROGRAMS = genfont + +genfont_SOURCES = src/genfont.c + +bin_PROGRAMS = apple2ix + + +# selectively enabled through configuration process ... +EXTRA_apple2ix_SOURCES = \ + src/asm386/glue.S src/asm386/cpu.S src/asm386/display.S src/asm386/memory.S \ + \ + src/meta/debug.l src/meta/debugger.c src/meta/opcodes.c \ + \ + src/video/xvideo.c \ + \ + src/audio/soundcore.c src/audio/soundcore-openal.c src/audio/speaker.c \ + src/audio/win-shim.c src/audio/alhelpers.c src/audio/mockingboard.c \ + src/audio/AY8910.c + +apple2ix_SOURCES = src/font.c src/misc.c src/vidsup.c src/interface.c \ + src/timing.c src/zlib-helpers.c src/joystick.c src/keys.c src/prefs.c \ + src/disk.c src/cpu-supp.c + +apple2ix_CFLAGS = @AM_CFLAGS@ @X_CFLAGS@ +apple2ix_LDFLAGS = @ARCHOS_HACK_LDFLAGS@ +apple2ix_LDADD = @ASM_O@ @VIDEO_O@ @AUDIO_O@ @META_O@ @X_LIBS@ +apple2ix_DEPENDENCIES = @ASM_O@ @VIDEO_O@ @AUDIO_O@ @META_O@ + +src/font.c: src/font.txt genfont + ./genfont < $< > $@ + +src/asm386/glue.S: src/disk.c src/misc.c @AUDIO_GLUE_C@ + ./src/asm386/genglue $^ > $@ + +EXTRA_DIST = reconf.sh configure README.debugger PROBLEMS .apple2 \ + \ + disks/README disks/blank.dsk.gz disks/blank.nib.gz disks/etc.dsk.gz \ + disks/mystery.dsk.gz disks/speedtest.dsk.gz disks/speedtest.txt \ + \ + docs/apple2ix.6 \ + \ + src/font.txt \ + src/asm386/genglue + +CLEANFILES = src/font.c src/meta/debug.c src/asm386/glue.S diff --git a/NEWS b/NEWS index 868251cb..0cf5dc8b 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,20 @@ +Changed in 0.8: + +Upgraded to modern-ish times...X11 now uses 32bit color! + +Audio is now OpenAL instead of raw PC speaker access. We are indebted to +AppleWin for much of the sound code including preliminary suport for +Mockingboard emulation. + +Bugfix and simplification for PC Joystick. Joystick emulation is now +bug-for-bug compatible with original Apple ][. Better calibration routines and +better "feel" for emulation of joystick on keypad/arrow-keys. + +Better emulation fidelity overall by counting 6502 CPU cycles. This was +necessary for proper output of stream digital audio in OpenAL. + +Significant interface and preferences changes and simplifications. + Changed in 0.7.4: Many bugs have been fixed, including a calling-convention mistake that diff --git a/PROBLEMS b/PROBLEMS index e1896489..728acc2d 100644 --- a/PROBLEMS +++ b/PROBLEMS @@ -11,19 +11,12 @@ the optimal speed. (see Specific Programs, below). Low-Res what 80 Column text is to 40 column text. We don't support it as yet, although it should be relatively simple. -- Joystick. The apple joystick hardware is read by measuring the time it -takes for a specific softswitch to clear. The emulator cannot as yet -compensate for the speed of the loop used to measure the joystick -- -applications using ROM routines will be fine, but custom joystick code -may become mistuned. The Range configuration feature can be used to -compensate for this. - - We don't emulate the //e's vertical blanking interval detection feature. + This is on the TODO list. Graphics: -- Composite graphics artifacts are not emulated. This is not a big -interest to me (Michael), but the previous programmers have suggested it. +- Composite graphics artifacts are not emulated. This is on the TODO list. - B/W color setting does not apply to lores or double hires. This generally is not an issue in practice though, as it's really only needed @@ -40,18 +33,7 @@ remain on the screen. If a menu is brought up it will `stick'. This may make people think the emulator crashed, although it will recover if the application returns to 40-column mode. -- There is no 80-column mode for svgalib apple2. It would be possible on -standard VGA, although there are not enough colors to do flashing letters -by palette tricks as we do now. - -- In X, the emulator window takes over the palette, causing all the other -windows to be miscolored. We only need 20 or so colors, so it would be -better if we could share the common palette. - Keyboard: - -- Key Handling is a little messy, especially with the way the X support -is bolted on top of core code originally designed for SVGA scancodes. - Presently, the Backspace key is interpreted as Left-Arrow (Code 0x88). It could be argued that it should be interpreted as Delete (Code 0xff) @@ -59,35 +41,6 @@ instead. Real Apples had no seperate Backspace key, but the //e's Delete key was in an analogous position to the PC's Backspace). The PC keyboard's Delete is assigned to 0xff (in //e mode). -- If you're using Apple ][+ mode, the keyboard may appear broken. That's -a feature -- the program is imitating the historical ][+ keyboard layout. -Press F5 to see a map. Maybe we should add a means to turn it off. - -- On my X system, without explict xmodmap or xkbcomp intervention, -Break (reset) won't work with XKB enabled, and PrintScreen (reboot) won't -work with it disabled. - - This is X's fault, and I've sent them a bug-report, but maybe we should -consider moving the keys (again...) - -Miscellany: - -- Older versions of this file note problems with scandir() in the -presence of orphan symlinks in some versions of the C library. Hasn't -been a problem for my glibc 2.1.2 system. - -- Presently the programs are not automatically set SUID on install. - -- The emulator requires ROMs for both ][+ and //e even if only used to -emulate one of them. - -- In theory, typing "Ctrl-Left Alt-Pause" should be equivalent to -"Ctrl-Open Apple-Reset" and make the //e reboot. This doesn't work -properly in practice. Somehow CXROMINT is not cleared at disk-interface -detection time, so the disk won't boot. - - (Ctrl-Right Alt-Pause activates diagnostic mode, as expected.) - Specific Programs: - Some programs (Computist's Nibbler, Sword of Kadash Master copy for @@ -103,13 +56,3 @@ effect that takes longer than I'm willing to wait to finish (mode switches would be much faster on a real Apple.) I can get into the program with some nontrivial debugger manipulation to `short out' the offending loops. -- ``Moon Patrol'' will crash in ][+ mode at the end of the first level -(ie: Point E). This is caused by a "02" opcode at address 1E15, an -undocumented HANG instruction. //e mode works, since the 65C02 treats -this instruction as a no-op. - - Moon Patrol may actually be //e-only. Yet this seems a gratutious -incompatibility, since the fact you can play the first level (and further -ones using the debugger) under ][+ mode indicates it doesn't need any //e -features. Perhaps the bug was introduced by the people who cracked it's -copy protection. diff --git a/configure.ac b/configure.ac new file mode 100644 index 00000000..301603c4 --- /dev/null +++ b/configure.ac @@ -0,0 +1,208 @@ +dnl --------------------------------------------------------------------------- + +AC_PREREQ([2.69]) +AC_INIT([apple2ix], [0.8]) + +AM_INIT_AUTOMAKE([foreign subdir-objects]) + +AM_CONFIG_HEADER(src/config.h) + +AC_PROG_CC([clang gcc]) +AM_PROG_CC_C_O dnl apparently required for custom font.c target? +AM_PROG_AS +AC_PROG_INSTALL + + +dnl --------------------------------------------------------------------------- +dnl Arch i386 checks, sigh... The plan is to eventually support x64 and certain +dnl ARM targets, but we only handle i386 at the moment thus this hackishness + +dnl arch check (currently must be i386) +my_save_cflags="$CFLAGS" +CFLAGS="-m32 -Xassembler --32" +AC_MSG_CHECKING([whether CC supports compiling for i386 ]) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [ + AC_MSG_RESULT([w00t!]) + AC_MSG_WARN([compiling for i386 architecture appears to work, but emulator may fail to link if i386 versions of required libraries are not present...]) + AM_CFLAGS="-std=gnu11 -Wall $CFLAGS" +], [ + AC_MSG_RESULT([oops]) + AC_MSG_ERROR([emulator currently supports (cross-)compilation for i386 architecture only]) +]) + +CFLAGS="$my_save_cflags" +CCASFLAGS="$CCASFLAGS -m32 -Xassembler --32" + +AC_SUBST([AM_CFLAGS]) + +dnl OS Check (currently must be Linux until we sort the arch crap out) ... +AC_EGREP_CPP(unsupported_, [ +#if defined(__ANDROID__) +unsupported_for_now +#elif __APPLE__ +unsupported_for_now + #include "TargetConditionals.h" + #if TARGET_IPHONE_SIMULATOR + #elif TARGET_OS_IPHONE + #elif TARGET_OS_MAC + #else + #endif +#elif __linux +linux +#elif __unix +unsupported_for_now +#elif __posix +unsupported_for_now +#endif +], [ + AC_MSG_CHECKING([Operating System ]) + AC_MSG_RESULT([unsupported]) + AC_MSG_ERROR([Apparently you have an unsupported OS, build aborted]) +], [ + AC_MSG_CHECKING([Operating System ]) + AC_MSG_RESULT([supported]) +]) + +dnl ASM underscore linking test +AC_TRY_LINK([asm("_glibc_foobar:");], [glibc_foobar()], [ + AC_MSG_NOTICE([Underscores in assembly linkage allowed...]) +], [ + AC_MSG_NOTICE([Underscores in assembly linkage not allowed...]) + AC_DEFINE(NO_UNDERSCORES, 1, [Underscores allowed in assembly linkage]) +]) + +dnl at this point we believe arch/os is good ... + +ARCHOS_HACK_LDFLAGS="-L/usr/lib/i386-linux-gnu -L/lib/i386-linux-gnu" +AC_SUBST(ARCHOS_HACK_LDFLAGS) + +ASM_O="src/asm386/glue.o src/asm386/cpu.o src/asm386/display.o src/asm386/memory.o" +AC_SUBST(ASM_O) + + +dnl --------------------------------------------------------------------------- + +AM_PROG_LEX + +dnl AS_IF([test "x$LEX" = "xno"], [ +dnl AC_MSG_ERROR([Emulator needs lex/flex to build source...]) +dnl ], [ +dnl AC_MSG_WARN([Found lex $LEX]) +dnl ]) + +dnl POSIX high-precision clock +AC_SEARCH_LIBS(clock_gettime, rt, [], [ + AC_MSG_ERROR([Emulator needs realtime clocks (-lrt) to build...]) +], []) + +AC_CHECK_HEADER(zlib.h, [], [ + AC_MSG_ERROR([Emulator requires zlib headers to build...]) +]) +AC_SEARCH_LIBS(gzopen, z, [], [ + AC_MSG_ERROR([Emulator requires zlib library to build...]) +], []) + +AC_CHECK_HEADER(pthread.h, [], [ + AC_MSG_ERROR([Emulator requires pthread headers to build...]) +]) +AC_SEARCH_LIBS(pthread_create, pthread, [], [ + AC_MSG_ERROR([Emulator requires pthread library to build...]) +], []) + + +dnl --------------------------------------------------------------------------- +dnl Video ... + +dnl currently X11 is required ... +AC_PATH_XTRA + +AC_CHECK_HEADER(X11/XKBlib.h, [], [ + AC_MSG_ERROR([Emulator needs X11 headers to build this software...]) +]) +AC_SEARCH_LIBS(XPutImage, [X11], [], [ + AC_MSG_ERROR([Emulator need X11 libraries to build the emulator...]) +], [-LX11]) + +AC_SEARCH_LIBS(XShmAttach, Xext, [ + AC_DEFINE(HAVE_X11_SHM, 1, [Enable X11 MIT SHM extension]) +], [ + AC_MSG_WARN([Building emulator without support of X11 MITSHM extension...]) +], [-lX11]) + +AC_DEFINE(VIDEO_X11, 1, [Enable common X11 video]) + +VIDEO_O="src/video/xvideo.o" +AC_SUBST(VIDEO_O) + + +dnl --------------------------------------------------------------------------- +dnl Sound ... + +AC_ARG_ENABLE([audio], AS_HELP_STRING([--disable-audio], [Disable emulator audio output]), [], [ + AC_CHECK_HEADER(AL/al.h, [ + AC_CHECK_HEADER(AL/alc.h, [ + AC_CHECK_HEADER(AL/alext.h, [ + AC_SEARCH_LIBS(alcOpenDevice, openal, [ + dnl found OpenAL ... + AC_DEFINE(AUDIO_OPENAL, 1, [Enable OpenAL audio output]) + AC_DEFINE(AUDIO_ENABLED, 1, [Enable sound module]) + AUDIO_GLUE_C="src/audio/mockingboard.c" + AUDIO_O="src/audio/soundcore.o src/audio/soundcore-openal.o src/audio/speaker.o src/audio/win-shim.o src/audio/alhelpers.o src/audio/mockingboard.o src/audio/AY8910.o" + ], [ + AC_MSG_WARN([Could not find OpenAL libraries, sound will be disabled]) + ], []) + ], [ + AC_MSG_WARN([Could not find OpenAL headers, sound will be disabled]) + ], [ +#include +#include +]) + ], [ + AC_MSG_WARN([Could not find OpenAL headers, sound will be disabled]) + ]) + ], [ + AC_MSG_WARN([Could not find OpenAL headers, sound will be disabled]) + ]) +]) +AC_SUBST(AUDIO_GLUE_C) +AC_SUBST(AUDIO_O) + +dnl AS_IF([test "x$audio_disabled" = "xno"], [ +dnl ... +dnl ]) + + +dnl --------------------------------------------------------------------------- +dnl Debugger ... +AC_ARG_ENABLE([debugger], AS_HELP_STRING([--disable-debugger], [Disable 6502 debugging console]), [], [ + AC_DEFINE(DEBUGGER, 1, [Enable 6502 debugger module]) + META_O="src/meta/debug.o src/meta/debugger.o src/meta/opcodes.o" +]) +AC_SUBST(META_O) + + +dnl --------------------------------------------------------------------------- +dnl Misc ... + +AC_DEFINE(APPLE2IX, 1, [Denotes a section of code as Apple//ix sourced, used with external sources]) +AC_DEFINE(_640x400, 1, [Screen dimensions ... this should be evenutally deprecated when we support dynamic resolutions]) +AC_DEFINE(KEYPAD_JOYSTICK, 1, [Joystick emulated on keyboard ... should not be true on mobile devices]) + +dnl Joystick device +AC_CHECK_HEADER(linux/joystick.h, [ + AC_DEFINE(LINUX_JOYSTICK, 1, [Enable Linux joystick device]) +], [ + AC_MSG_WARN([Could not find Linux PC Joystick/GamePad header...]) + AC_MSG_WARN([Emulator will be built without Joystick device support, but this may diminish the experience!]) +]) + + +dnl --------------------------------------------------------------------------- + +AC_DEFINE(PACKAGE_URL, "https://github.com/mauiaaron/apple2", [apple2ix project URL]) +AC_DEFINE(WEB_RESOURCES, "ftp://ftp.apple.asimov.net", [Apple II Web Resources]) +AC_DEFINE(PACKAGE_MANPAGE, "man apple2ix", [manpage info]) + +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT + diff --git a/disks/blank.dsk.gz b/disks/blank.dsk.gz new file mode 100644 index 0000000000000000000000000000000000000000..e09655155857d56821ce8a7e99be1f6753b044ae GIT binary patch literal 7335 zcmd6pMOzyHv$iV~C|=xYp}4zSv6kQ#AV|?5!6l_gio3hJOK5Pn;$Aekr+9(lcHZ|~ z-|G7XXETd=W)}B7o1u%u#3X`|^S^j)4l#4I=dyIOe{sBo?L#z|Bl34RQ6Nc3w*T%0 zK0ZJ;-Xu3!8r#A4eZRlC7mJj$PhLEB1aQ&n^n~r&q_+!^?fBjIg^66~RDHGuld5W{ zhE1MKr9-e7=8b$cutzHouRufd&y(7#gSE+%yW5-Rqte{V=lcW|Ch&ylMJ7LZBHfk; zO{uBahN9=NBru8T)bdv9vgL2Sa;LQ1T znbp)2DFMxqfaOFz)(mE7q%~LdB$tG_x2(abx{+F!=D(&0&Ra)y_s}#QezdTWEUqH$PIf`M;<~^H9 zgAm6KTGoA|C%vQB)B2v^@Fdn4(m;?b3WFoNdR1~_-`tsSiIZ-FpfU`9D<4M4er6Fd z8+hpxsSk*$Jr&XG-;1GJEtdR853RaC4ua-Z2=d4wkfW73aMl*=^hn4*lxHc#U5zyPB`8}26wD<9Z zkFrBYH#L9rt~{XT)zNmQUoH|VBd&tSlB-4_mg{?NAa?!*w`jvjn97eI-wD^(QH^$~ zAF=(aklgbn>!}Q%*Wn|OxiKZaOYPy=z>KHFj`V~|?w=iAO3a;6m)1;D@NpxUB#P2_ z>!v_4(zr_eK@K^BV|MAW_R|}fc8Syw(l#)=ikT3V(CcF5%d3ThgOOmb2cJPKH$cfG z`4|KcO>XDI(Syo*b89028%o39#dI$A~NYdt^~ zKKC)g*PiVS&)LxR=Z!u&I^T!kO$JlyV=2!E`N>q%?7O?n8E~iM{pvMp;##3l3+xUZ zjUBbYPJT)=YLqXm-`PTlQnGI19L`gz!qYhQY%RWOTRH!zRxDw?@-Gjh_psf^Lu~*W zjlLt}M)_-+5w@tB)p1UE*Ywi7-&{^*DBjFfhwr$5pyiD>gJMjpkej<6sucEkbir!@ zKWz0|!QHNdxfS}Imt;D%TsCH{Ei*slhQowy5j`jM%a~tAYbjwCDnFxXdvF_<$Em@T zqdl%c~htUT+l}3Orv9dMB(-?HzfXa%M4z=x?Yc->!YMejsNC z71agz?Yo!Y(?UMeWtZ(MThOB%q?6KLVB5QLQ;;EK`+;g{JUt?wy+J)drY>+4Ilr0C zd;>#`Dwk4p>)BE!H&>nG7$v_?ltm%C{S6&(Pr|*wJH@{+q)V%}rLM-!xkLxK!Q;%x z;K~S%=n-oFI)<6KgYfGtL5j)ivlj1IFDfBJ279e`f=nRq|6!6kgJ&7&DNVBXn08l8VCJ$w8*ctwvITYwf&ZjLvAF^Ol_qg zCPoZ&bu2~-e}VxJYq{VVew*Z;ox@im2GQY znPq#^kzBd5_Gwsu$v%0kxWjr_1687RC)MOPM=4zOeP!2iG2Ak6RmNkC$jfNIQJqB2s$cqru_Iq0_Em=FyVvu#WJwxGLX#3nPY(9VZn0CCedxlF)R9 zn79AAVSgHgfGo+_zA(ySTtYg-75Elfh9#Hl1i-rjgYRvfzib^yxLIa+Dl1pJ9bVU` zU$&7U>6v;R;t>F#ejX01&EMz)eKVJ=fWu`@?4AB&nhrflZ0j5oeihg?WWGIcqgwS}IK_o-m%N zwNe@tad1dEwR5$J;Vge;l&(h`Y{@!HTl*`S4ysQI?s2OO5U|Hbr{CA+kNmh6Q~uYFKpY% zsbPaljkTGRoEVy^GOWu@8PRN1t9-yPP*)jcm zWsUWCa17hUr`n=QnL(Ayh&~H7cn8**%lG4wK=m+50PNQ27{Jc@FO?67^Zf4L-H7h# z?&O}7uiyV_@DS)z=~L(vw)67v#*vVdrIFkW=1He@?02eemB8?POmBU6d#{@(!ZA9< zob4AjM<%7V#ZnU#8zYqv3OVqID)I z_h0VLNhhdLJjWA0Sp-JNKyK;NZvCo@VtL_~F;AZkyJkgcb9mPXgUfD?5^U298&j{+Km zG(i)m)jwikZ=GwC;Z>h~8pH2ikRmOXUP1AyY?u&vBirJ%Af2LkP9R8!# z!)clF(Xtyyp+S9fg;@L1@Fq-CME42&+|X!hu_kmRVFh6LiS0?cwnd$&NM20I|OqR!tKHun2+^{AJW8;~>k{tSN_?D7?n zJ>+ero#Aoow8h1~ftannZefR;8H!0nsQ+uwVzu+{TQc^Wy^4Aan?EnHLiYg4(M_d8 ztqN+P7>i7m)XXZ=7JGK8R+;af{ zp%s=G?1^l+b+%4ylQTkJy5tS;=$2?87DUT7?kXY5Md65gKZ;;cRf1G)(PRe-RZ1bn zn(}F`Q+Gu!vs(v_xh303_Z#$@X$az-d0<(-8JU&~1qog8mN^?&{>~I0qszmRpz}9y zFTRG=2O7K7)27j-i_OsTr)wT{8Eo6oS68vFn=H!>CcbVytyz)|1he%7V*LzB#}auG zpN_9G@&JIhr0vqct7LTJ({;{!bURqUDRfw>@GAP8XU;@ln1-(!7KM&IFRgsbHOvWD znctzfILfo)5IHV;!ZK)yf7X6eFZ9+as4{8*?yn{>c1oJ}x;H&g&05vHH?Di>f}?(( zA}z1@!(mfJmD%FasYj0)a*6FS+`wm0(KBqmBH;a4il`C;vTyk)K7Z$7Ao$JSsm>|g z*Oh+_>uS3}wT}6thvyy14Eor7#-B*V{W+^Xt7oo)#l_y=f6in$U-&_RXtD=$YWxt! z2zc`li84Ebqmthw(e%G!GwO<(;ESKf^4gEGB5q{^1YX7V#%#NC4w7WV#wRq3#<>S{8T+{%fxE;aBt^*%^qH@U>Xq+fV0Lw5XBfi6 z=!-=hB^kyBpEh6dcMk`{tNsvTDSUyxP>Tw8sy^R)gWcX@sVtaopjuNE!cXt0eVb7s z51fHp!4lGCI@ON~8!7F~&zL?1J|KA0Qy(ZA<5DXWK~jS{e63xNlj)((YH%-kTI1sZ`XIzHHZFgrC zgKUy$=Aqqhq<eB>oZ&v4GV;Jh59L}>;0jEeUqNcJ4`K9Z+zU~g`5$e29EZ=eCa51i@n4uF2U=E^}a%W*OF-StA-g}v6d*ZopCQ~*^ppPAEp zer=3%sp<=MqmAg%m0ua;1I~pp@>6SPz;oRG<-2bWVk>Jcka(JM-2qwH9db=9u?VT} zv;*(0;^<-&XotiemQ)cWQpq%I5CX!P2EW(Tch+pU4EDt`$`Xo?qbw@pu0+eHoyzI8 z5>v}&5WpBYPs7Qs*rkAr714ct1ng_>tDq8M&7V1Jb!BB*e-5U~8|vwLr962db$-d` zXmgNF=JJ!HZwa0fvYUJ}Zi_=@bfjNvVX!hz|e-2--@e(Sc&&+gvF_Bbz$qp_!X_?7Yx2XnB_1#b04cQ zXt6u-YtxwwUkXzljqux2C8D0p$yTeeB9uG4lqE0suzuZDIEDQ#Xf)U;;$9qk_TrZ~ z@a%)UMeg`#(1Z|HW}(ZCz7GqeM)r6@@H$hoNjJiNis9G}9PEULTKK~etmcM3v2>2n zTZyck-f08539GE^W;wyE`J>w+AG$?}p=A-F5vmo4uuGZ#j6XkL>&N2mMJNcQF;5f( z2-KU2a!zvkgK%v1jZeNCI5>>Vs$mlXzcX`kTFcSn%))B+a%-&RMl{G(H;_yVAcC=r z*81(=Q>`o4soKYNgoC!^EpLJ^LUH}Zxr{-nm8DY&tt)e0Yb$~p#>O?>j^e-b6bxMj zsp{1LIgU1D*4>O|bQe{QjNymCA%C{^mWUqwXee2*3qNoBmp<2k7Nx;tRBND@Qp^0g z(b9=a-(UtE5VVkl^6ZZKCVII;JsyO1oguI0lrxw)N>}4KdPLQ(e~9<*TdG&;_jYyf zTw;keiZx+LleJ|oG^cg@^TWV?FM%|MiQ-OvDo$65V9Gf|C=O3tAFQ77^m`+QRPsw!Qkl3fgN~;)$H4e--LL5yoEQHEqUi zr)*qVGkldco|{>{1u+E%H8Jf5bw>P|k;eQN*7YjGnTdmB9lV8Q7S``LtVx{MvRZ5v z*H*Q$y%wIz4L8SL-$ImbA+fi$ZC*87z2&EFeW}U-;oeN68)j#QDoZ5hA?C#p2}6oC z_qcIJ8y~bdy3WNKZ@y*o`EyPH46tsy)`dDY7Kb)ZYeY-in+^fH$K4(!MzD z1h>$w`v#(i`K*oEx?PmC42>0tesnT1`H-7B*+eW?5!oCO8M$UXh@!8Hh}>%~8FLYA zvnGuzC@*^NG@<565N@s=xin8~>rj(fiBPEP{TO|MH1t3Rcy>ew%^ea0KUL9H20p5@Ph`sO5tF==f`2o_UUrf- zi9z`eF!%&CtQlim+POojmMwK4~?|=4Z)2eCZU&VYQnv*yI&_givHlhVqczZ zl#TcQD>JROdM0#0dJ|gs@lf{($s+oXElMS~eDk=15GV*>#<-p{Pc`(^VRZ25d}9Td zH`9tJ9ohsI%rFFQ#FtdRbyT7aJ6Bh-npoH6rg|`)mE+R-OKEx5rODk{9f6^H zFj*;$xYtcfeyqOSX~g_e&3O82D9CW=ZJ}c%rMhJ}Ggd$7&`gV1z4DCvpr2N7O_$rR zJf#CZ;%i>Y=2yW6i;kcxqj(4~OfP)$wF9C=s>$}UdZo@ly0%*VCc4P-rI(!Ig(GTb z94ggv_QT^1me=+OmlauEI<*OzO`NT$9ryOqUdfC5irTVimdrwDpS96u#f;sRwS<=QuRX1IOnk+87z2^RxpTP+Zmu;ydi-|yrp_e#whr~ zQ~ec5U#lU8>FP%fW|y3EpQmC1By~7W)hIO4`)~-`gVrCGup9U#z=xn!BgCp^H1t#> z!zuK4CWD6F1dY1}34Vn}94ueWgw-*O$?;C8_Vtgje9_GsA2|W!`EW&o(xB(9)g-FI zvlUf4Vp{wVM|U#v#5$r!1n!3wnVbZ=E#4^l?k}^=#>Lw_(4hs z^Q{k*_+DynI|v;d<~lX5D)V2n`Ami%F|5z^;<*he!H11rgnVw!7h$h`8c-t_Cz6wg zB}L))vGeelP%$!3^l%Q^rMimkalXIZ++p%;q`&S9N(%$zW=k3;=vOI**8~!V_a&h( z9={`!kQC6VGqenMxG7izy~xHaDSL3HFRrWvP-1!1>ZT>?Un1eR6%17Gl?{Ss@nAZ2 z@w0B{Rs?D9DXb=N@nw=V*EgKl3wf$rVtRv6URiDzGrc)Um`N-yJ}d+v&ap5~JL9K2 zUmm%bnXiq2BEci=(F>xt;e|qpZ4AS7=bnoBP};~|52ys?kbk8Os2(6r_4$}%jyqWe zS8Eo=HbQ^IF%^TcVn`-n`2)1Qu7}?e#!fFT_r1PIUV@g0>JYGfSzUYt{ahwV4Cfwh zv>9C3R~o7zPp1uhjqThj_;ohwrP~AUpUE@5Ka;(e7<0ww{yrwy{Sgf3F)rabA6YQw zAfG$8Kb_Z+B`)h+QCW)Li}GcObOl5k>q2KgnGQu11znftH|d&GC*yeBwnihkUal|Z zS0`CAUjS#1WnI7B|A%Mk0aRD|B(;JjbX zZXf|)=gfknf>>HB)u${Xw~QjZ8`sC>+u zXD}{UH#~4m$fl(#jFUJvgsLz@az!653z@RCvM($?+_3Cc%eMo5Y!{*oI8|gRtk>|| zfom`NYoy#%>ph6gThCSv+n;WoB1R~5B`CGO>t1PJnChNYrk$s=<(PMIL;F98mm?wx z1<@ZV9osGS-kTF7Ihp_dAylyZ(JfO>Sh>-oUAV%h=Hysslk`t*>$SEnjCg>%@h<+L zjgru8`@@`YTCq>T9rbWhtZp-jiN>KfnPaRJP@P)qIJR`YJG^{!;Wtd;jqt)*k(v+l zblhphjt1vWuo+23Kzy=@ot#phG2jtGjDK5Ly~_bS_mTauhzC}2RHm&bIMEy3vb#w$ zY&6ED1IjVaB53Sv6PJo946mtm1yN^Qx&T~f!iAafC-E1S5;Z9~8o@aX&Nh$@-kxrT zAkWH8YY*M016Ij411<=DQadxBI+9D2c24`skK)pp?Yf6Z5@)zcc8IFLIUg)BQR6jaYVn^Ze2fCOw9v0? z9c$tFZe}{cvwDy$6x(>Zu%O0nk`W50Koi!X`K_z2Xign`E)j*kF71|qi(c*huk4Cs zwzRbG(pRfv%U!@=f%T;|_Zj9tB@%0%cN3Sqq$o38SB>2;F-dd7ZNTV{x~?KX@T?#p zrXn&&q)O_nyDdV^cbh;7*_2e1kLDY-^SUVGO`Lc zo^$CdvZDBm+0%X0a~w-ufI>vKJDcQ9V+-06#o!MG&2IDT;Be1v6e=J|eE40m!auj7PrL zkIohjwXUPAJ_du;yC$v8{Wo=1ZvuO6r75UBVSWfA_&-#p;3>#-$F1fI>D1$EG9WsY zh+|P8|AV`Q={mPJeGp`#RHyp1umgzkE6CHrF&QnD*OK%ul+Yhbw9=A!9=zHcbj_lzb)`me?!myz-+yF=FSv?2`wL=aG=@rJo9MY^KPK`2JE&ju P6HSdJ2=4{Ys~7(R`JgkK literal 0 HcmV?d00001 diff --git a/docs/apple2ix.6 b/docs/apple2ix.6 new file mode 100644 index 00000000..f0b22cdd --- /dev/null +++ b/docs/apple2ix.6 @@ -0,0 +1,234 @@ +.\" Apple //e emulator manpage +.\" +.\" MODIFICATION HISTORY +.\" v0.8 by Aaron Culliney @ BitR0t.com Feb 2014. +.\" v0.5 by Aaron Culliney , Feb 1998. +.\" v0.6 by Aaron Culliney , Aug 1998. +.\" This code has nothing to do with my employer, GTE Internetworking, +.\" BBN Technologies. It was written completely on my own time and on +.\" my own machine. +.\" +.TH APPLE2IX 6 "v0.8 February 2014" +.UC 7 +.SH NAME +apple2ix \- Apple //e emulator +.SH SYNOPSIS +.ft B +apple2ix +.ft R +.SH DESCRIPTION +.I apple2ix +emulates a 128k Apple //e computer. To use the emulator effectively you need to +acquire the original //e ROM file which is not distributed due to copyright +reasons. The emulator reads standard 143360-byte and 232960-byte disk image +files with +.I .dsk +, +.I .do +, and +.I .nib +suffixes. +.PP +There are only a few command line options: +.TP +.I --help +Display a quick help +.TP +.I --version +Display version of emulator +.TP +.I --noshm +Run emulator with no shared memory (for remote X11 desktops) +.PP +.ft R +.SH THE .apple2 FILE +The emulator reads user preferences from a +.I .apple2 +file located in your home directory. This file is auto-magically created for +you. +.I .apple2 +You can edit the settings using your favorite editor, but most of the settings +can be adjusted from the emulator itself (see menus section below). +.TP +.I speed +Multiple of the Apple //e CPU speed. 1.0 attempts to match the speed of the +//e. 2.0 is twice as fast. 0.5 is half. +.TP +.I altspeed +Alternate speed setting. F9 key in emulator will toggle between this and the +regular configured speed. This is useful to slow or speed up emulation as +needed. +.TP +.I disk path +Toplevel path of disk images directory. Personally I like +/path/to/your/home/directory/.apple2ix/disks +.TP +.I color +Color modes. One of Black/white, color, interpolated. +.TP +.I video +The size of the emulation 1X, 2X +.TP +.I volume +Speaker Volume setting 0-10 +.TP +.I joystick +Off, joy keypad, or pc joystick +.TP +.I pc joystick parms +PC Joystick calibration parameters. This is best adjusted from the calibration +routine from within the emulator. Press F10 to bring up the settings menu and +select Calibrate Joystick. +If the emulator complains that it cannot open the joystick device, make sure +your joystick or gamepad is connected to the PC and make sure the Linux joystick +module is loaded. +.TP +.I keypad joystick parms +Keypad/arrow-keys joystick parameters. Change this through the calibration +routine from the F10 settings menu. +.TP +.I system path +The directory holding the rom files. The emulator won't run if this is not set +properly. You can only change this by editing the +.I .apple2 +file. +.PP +A sample .apple2 file: +.nf + speed = 1.00 + altspeed = 4.00 + disk path = /usr/local/games/apple2/disks + color = interpolated + video = 1X + volume = 8 + joystick = joy keypad + system path = /usr/local/games/apple2/rom + pc joystick parms = 128 128 255 1 255 1 + keypad joystick parms = 8 1 +.fi +.PP +.ft R +.SH ROM FILES +The emulator requires several ROM files to run. +.TP +.I slot6.rom +You need this file for basic disk drive emulation. It is 256 byte +memory dump of the consecutive addresses from C600 to C6FF. This file +is not distributed again due to copyright issues. This file may also +be named +.I controller.rom, +but is referenced internally as +.I slot6.rom. +.TP +.I apple_IIe.rom +It is the 32K ROM of your 128k Apple //e, a dump of main memory (bank 0) +addresses C000-FFFF concatenated with auxiliary memory (bank 1) addresses +C000-FFFF. Because the +.I apple_IIe.rom +contains the C600 slot, you can construct the +.I slot6.rom +file from this one. The +.I apple_IIe.rom +file may also be named +.I apple2e.rom +but is referenced internally as +.I apple_IIe.rom. +.PP +.ft R +.SH DISK IMAGES +The emulator reads standard DOS3.3-order 143360 byte '.dsk' images (sometimes +with a '.do' extension and raw-nibble 232960 byte '.nib' images. The emulator +will also attempt to read and write to compressed disk images with an additional .gz +extension. +.PP +The images are raw binary dumps, containing the tracks from 0 to 34 from the +original 5.25 disk. For the standard 143360 byte '.dsk' format each track is +partitioned into sectors of 256 bytes, numbered from 0 to 15. +.PP +The raw nibblized 232960-byte images are usually made of programs that have +non-standard formatting as a means of copy protection. The nibblized format +attempts to preserve the non-standard format, and so defeats the copy protection +without "cracking" the program. +.PP +To transfer Apple ][ diskettes into one of these formats requires that you own +an original Apple ][. Since the drives provided by the IBM PC's are not +compatible with the original Apple ][ drives there are no conversion programs +directly available. If you have used other Apple ][ emulators it is most likely +that the files will work with this emulator too. For more information on Apple +][ disk formats and such, see +.I Beneath Apple DOS +by Don Worth and Pieter Lechner, published long ago by Quality Software. +.PP +.ft R +.SH EMULATOR KEYS/MENUS +.TP +.I F1 +Interface to switch disk in Drive A, Slot 6. Arrow keys navigate the +selection. If the disk highlighted is already in the drive, it will +have a or tag after the name indicating read/write or +read-only access. Select this disk to eject it. To select a disk, +you can press 'w' or RETURN to insert it into the drive. Pressing 'w' +will attempt to open the disk as read/write (if you have permission to +do so). +Pressing RETURN defaults to opening the disk read-only. Press +ESC to accept current settings and exit the menu. +.TP +.I F2 +Interface to switch disk in Drive B, Slot 6. Same controls as for +.I F1. +.TP +.I Pause/Break key +Pause the emulation. Hit a key to resume emulation. +.TP +.I F5 +Display the Apple //e keyboard layout. +.TP +.I F7 +Enter the Debugger console (if this support was compiled into the +program). See the file README.debugger that came with the emulator for +more information. +.TP +.I F8 +The boot/welcome screen! Just in case you need to get back here =) +.TP +.I F9 +Toggles between the speed and altspeed settings. This is useful to 'fastboot' +programs, or possibly to slow them down, and then slip back to normal Apple //e +speed. +.TP +.I F10 +General parameter settings menu, including the all-important QUIT option. +You can edit most of the parameters in your +.I .apple2 +file from this menu. Adjusting a parameter will auto-magically save it to your +.I .apple +preferences file. +You can also select to calibrate/tune the PC Joystick or keypad joystick here. +.TP +.I Special Keys +The key combination Ctrl-End will trigger an Apple //e reset. Ctrl-AltLeft-End +operates just like a Ctrl-OpenApple-Reset and reboots the Apple //e. AltLeft +and AltRight keys correspond to the OpenApple and ClosedApple keys (joystick +buttons 0 & 1). NOTE: In //e mode try Ctrl-AltRight-End to trigger a system +self-test. The numeric keypad and general arrow keys are also used for emulated +joystick movement. +.ft R +.SH BUGS AND STUFF +See the PROBLEMS file that came with the code. +.ft R +.SH MORE INFO +More information is available in the online newsgroups +.I comp.emulators.apple2, +and +.I comp.sys.apple2. +.PP +See also: +.TP +.I Apple //e Technical Reference Manual +.TP +.I Beneath Apple DOS +.TP +.I Beneath Apple ProDOS +.ft R +.SH AUTHORS +See the AUTHORS file that was packaged with this software. diff --git a/reconf.sh b/reconf.sh new file mode 100755 index 00000000..6d1ea461 --- /dev/null +++ b/reconf.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +set -x + +rm -f config.cache + +aclocal +autoconf +autoheader +automake -a --warnings=all + +set +x diff --git a/src/Makefile b/src/Makefile deleted file mode 100644 index d6e9d7c6..00000000 --- a/src/Makefile +++ /dev/null @@ -1,408 +0,0 @@ -# Generated automatically from Makefile.in by configure. -# Makefile.in generated automatically by automake 1.4 from Makefile.am - -# Copyright (C) 1994, 1995-8, 1999 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. - - -SHELL = /bin/sh - -srcdir = . -top_srcdir = .. -prefix = /tmp -exec_prefix = ${prefix} - -bindir = ${exec_prefix}/bin -sbindir = ${exec_prefix}/sbin -libexecdir = ${exec_prefix}/libexec -datadir = ${prefix}/share -sysconfdir = ${prefix}/etc -sharedstatedir = ${prefix}/com -localstatedir = ${prefix}/var -libdir = ${exec_prefix}/lib -infodir = ${prefix}/info -mandir = ${prefix}/man -includedir = ${prefix}/include -oldincludedir = /usr/include - -DESTDIR = - -pkgdatadir = $(datadir)/apple2-emul -pkglibdir = $(libdir)/apple2-emul -pkgincludedir = $(includedir)/apple2-emul - -top_builddir = .. - -ACLOCAL = aclocal -AUTOCONF = autoconf -AUTOMAKE = automake -AUTOHEADER = autoheader - -INSTALL = /usr/bin/install -c -INSTALL_PROGRAM = ${INSTALL} $(AM_INSTALL_PROGRAM_FLAGS) -INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_SCRIPT = ${INSTALL_PROGRAM} -transform = s,x,x, - -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -CC = gcc -DEBUGGER_O = -JOYSTICK_O = joystick.o -PACKAGE = apple2-emul -PROGS = xapple2-80col -VERSION = 0.7.4 - -noinst_HEADERS = apple2.h debug.h disk.h interface.h keys.h misc.h video.h cpu.h glue.h glue-prologue.h prefs.h timing.h - - -SUFFIXES = .l -80.o - -man_MANS = apple2.6 - -EXTRA_PROGRAMS = xapple2-80col -bin_PROGRAMS = xapple2-80col - - - -EXTRA_xapple2_80col_SOURCES = debugger.c opcodes.c debug.c joystick.c -xapple2_80col_SOURCES = cpu.S memory.S glue.S keys.c prefs.c disk.c font.c cpu-supp.c misc.c win-shim.c soundcore.c soundcore-openal.c alhelpers.c speaker.c AY8910.c mockingboard.c interface.c timing.c zlib-helpers.c - - -xapple2_80col_LDADD = joystick.o vidsup-80.o xvideo-80.o display-80.o -L/usr/lib/i386-linux-gnu -L/lib/i386-linux-gnu -lX11 -lXext -lrt -lopenal -lpthread -lz - -xapple2_80col_DEPENDENCIES = joystick.o vidsup-80.o xvideo-80.o display-80.o - - -noinst_PROGRAMS = genfont - -BUILT_SOURCES = font.c debug.c glue.S - -EXTRA_DIST = font.txt apple2.6 debug.l genglue - -CLEANFILES = font.c glue.S -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_CLEAN_FILES = -PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) - - -DEFS = -DPACKAGE=\"apple2-emul\" -DVERSION=\"0.7.4\" -DKEYPAD_JOYSTICK=1 -DPC_JOYSTICK=1 -DHAVE_UNISTD_H=1 -DHAVE_GETPAGESIZE=1 -DHAVE_MMAP=1 -DNO_UNDERSCORES=1 -DDEBUGGER=1 -DAPPLE2IX=1 -DAPPLE_IIE=1 -I. -I$(srcdir) -CPPFLAGS = -LDFLAGS = -LIBS = -X_CFLAGS = -X_LIBS = -X_EXTRA_LIBS = -X_PRE_LIBS = -lSM -lICE -xapple2_80col_OBJECTS = cpu.o memory.o glue.o keys.o prefs.o disk.o debugger.o opcodes.o debug.o font.o cpu-supp.o misc.o AY8910.o mockingboard.o win-shim.o soundcore.o soundcore-openal.o alhelpers.o speaker.o interface.o timing.o zlib-helpers.o -xapple2_80col_LDFLAGS = -genfont_SOURCES = genfont.c -genfont_OBJECTS = genfont.o -genfont_LDADD = $(LDADD) -genfont_DEPENDENCIES = -genfont_LDFLAGS = -CFLAGS = -std=gnu11 -Wall -Werror -g -O0 -m32 -Xassembler --32 -pthread -COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ -man6dir = $(mandir)/man6 -MANS = $(man_MANS) - -NROFF = nroff -HEADERS = $(noinst_HEADERS) - -DIST_COMMON = - - -DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) - -TAR = tar -GZIP_ENV = --best -SOURCES = $(apple2_SOURCES) $(EXTRA_apple2_SOURCES) $(xapple2_SOURCES) $(EXTRA_xapple2_SOURCES) $(xapple2_80col_SOURCES) $(EXTRA_xapple2_80col_SOURCES) genfont.c -OBJECTS = $(apple2_OBJECTS) $(xapple2_OBJECTS) $(xapple2_80col_OBJECTS) genfont.o - -all: all-redirect -.SUFFIXES: -.SUFFIXES: -80.o .S .c .l .o .s - - - -mostlyclean-binPROGRAMS: - -clean-binPROGRAMS: - -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) - -distclean-binPROGRAMS: - -maintainer-clean-binPROGRAMS: - -install-binPROGRAMS: $(bin_PROGRAMS) - @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(bindir) - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - if test -f $$p; then \ - echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \ - $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ - else :; fi; \ - done - -uninstall-binPROGRAMS: - @$(NORMAL_UNINSTALL) - list='$(bin_PROGRAMS)'; for p in $$list; do \ - rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ - done - -mostlyclean-noinstPROGRAMS: - -clean-noinstPROGRAMS: - -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) - -distclean-noinstPROGRAMS: - -maintainer-clean-noinstPROGRAMS: - -.c.o: - $(COMPILE) -c $< - -.s.o: - $(COMPILE) -c $< - -.S.o: - $(COMPILE) -c $< - -mostlyclean-compile: - -rm -f *.o core *.core - -clean-compile: - -distclean-compile: - -rm -f *.tab.c - -maintainer-clean-compile: - -apple2: $(apple2_OBJECTS) $(apple2_DEPENDENCIES) - @rm -f apple2 - $(LINK) $(apple2_LDFLAGS) $(apple2_OBJECTS) $(apple2_LDADD) $(LIBS) - -xapple2: $(xapple2_OBJECTS) $(xapple2_DEPENDENCIES) - @rm -f xapple2 - $(LINK) $(xapple2_LDFLAGS) $(xapple2_OBJECTS) $(xapple2_LDADD) $(LIBS) - -xapple2-80col: $(xapple2_80col_OBJECTS) $(xapple2_80col_DEPENDENCIES) - @rm -f xapple2-80col - $(LINK) $(xapple2_80col_LDFLAGS) $(xapple2_80col_OBJECTS) $(xapple2_80col_LDADD) $(LIBS) - -genfont: $(genfont_OBJECTS) $(genfont_DEPENDENCIES) - @rm -f genfont - $(LINK) $(genfont_LDFLAGS) $(genfont_OBJECTS) $(genfont_LDADD) $(LIBS) - -install-man6: - $(mkinstalldirs) $(DESTDIR)$(man6dir) - @list='$(man6_MANS)'; \ - l2='$(man_MANS)'; for i in $$l2; do \ - case "$$i" in \ - *.6*) list="$$list $$i" ;; \ - esac; \ - done; \ - for i in $$list; do \ - if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ - else file=$$i; fi; \ - ext=`echo $$i | sed -e 's/^.*\\.//'`; \ - inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ - inst=`echo $$inst | sed '$(transform)'`.$$ext; \ - echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man6dir)/$$inst"; \ - $(INSTALL_DATA) $$file $(DESTDIR)$(man6dir)/$$inst; \ - done - -uninstall-man6: - @list='$(man6_MANS)'; \ - l2='$(man_MANS)'; for i in $$l2; do \ - case "$$i" in \ - *.6*) list="$$list $$i" ;; \ - esac; \ - done; \ - for i in $$list; do \ - ext=`echo $$i | sed -e 's/^.*\\.//'`; \ - inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ - inst=`echo $$inst | sed '$(transform)'`.$$ext; \ - echo " rm -f $(DESTDIR)$(man6dir)/$$inst"; \ - rm -f $(DESTDIR)$(man6dir)/$$inst; \ - done -install-man: $(MANS) - @$(NORMAL_INSTALL) - $(MAKE) $(AM_MAKEFLAGS) install-man6 -uninstall-man: - @$(NORMAL_UNINSTALL) - $(MAKE) $(AM_MAKEFLAGS) uninstall-man6 - -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - here=`pwd` && cd $(srcdir) \ - && mkid -f$$here/ID $$unique $(LISP) - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ - || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) - -mostlyclean-tags: - -clean-tags: - -distclean-tags: - -rm -f TAGS ID - -maintainer-clean-tags: - -distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) - -subdir = src - -distdir: $(DISTFILES) - @for file in $(DISTFILES); do \ - d=$(srcdir); \ - if test -d $$d/$$file; then \ - cp -pr $$/$$file $(distdir)/$$file; \ - else \ - test -f $(distdir)/$$file \ - || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/$$file || :; \ - fi; \ - done - $(MAKE) $(AM_MAKEFLAGS) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-hook -info-am: -info: info-am -dvi-am: -dvi: dvi-am -check-am: all-am -check: check-am -installcheck-am: -installcheck: installcheck-am -install-exec-am: install-binPROGRAMS -install-exec: install-exec-am - -install-data-am: install-man -install-data: install-data-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -install: install-am -uninstall-am: uninstall-binPROGRAMS uninstall-man -uninstall: uninstall-am -all-am: Makefile $(PROGRAMS) $(MANS) $(HEADERS) -all-redirect: all-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install -installdirs: - $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man6 - - -mostlyclean-generic: - -clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) - -distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) - -rm -f config.cache config.log stamp-h stamp-h[0-9]* - -maintainer-clean-generic: - -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) -mostlyclean-am: mostlyclean-binPROGRAMS mostlyclean-noinstPROGRAMS \ - mostlyclean-compile mostlyclean-tags \ - mostlyclean-generic - -mostlyclean: mostlyclean-am - -clean-am: clean-binPROGRAMS clean-noinstPROGRAMS clean-compile \ - clean-tags clean-generic mostlyclean-am - -clean: clean-am - -distclean-am: distclean-binPROGRAMS distclean-noinstPROGRAMS \ - distclean-compile distclean-tags distclean-generic \ - clean-am - -distclean: distclean-am - -maintainer-clean-am: maintainer-clean-binPROGRAMS \ - maintainer-clean-noinstPROGRAMS \ - maintainer-clean-compile maintainer-clean-tags \ - maintainer-clean-generic distclean-am - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." - -maintainer-clean: maintainer-clean-am - -.PHONY: mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \ -maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \ -mostlyclean-noinstPROGRAMS distclean-noinstPROGRAMS \ -clean-noinstPROGRAMS maintainer-clean-noinstPROGRAMS \ -mostlyclean-compile distclean-compile clean-compile \ -maintainer-clean-compile install-man6 uninstall-man6 install-man \ -uninstall-man tags mostlyclean-tags distclean-tags clean-tags \ -maintainer-clean-tags distdir info-am info dvi-am dvi check check-am \ -installcheck-am installcheck install-exec-am install-exec \ -install-data-am install-data install-am install uninstall-am uninstall \ -all-redirect all-am all installdirs mostlyclean-generic \ -distclean-generic clean-generic maintainer-clean-generic clean \ -mostlyclean distclean maintainer-clean - - -# Warning: this will trip on a cross-compile -# (not that we're otherwise portable to non-Linux yet...) -font.c : font.txt genfont - ./genfont < $< > $@ - -glue.S : disk.c misc.c mockingboard.c - $(srcdir)/genglue $^ > $@ - -%-80.o: %.c - $(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) -D_640x400 -c -o $@ $< - -display-80.o: display.S - $(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) -D_640x400 -c -o $@ $< - -# I couldn't get Automake's internal Lex support to work with this, as -# Automake assumes the program was built to cope with no -P option. These -# files require it and also need preprocessing. -# -# Of course this is really our fault for being nonportable to standard Lex... -# (which I presume has no -P) - -#%.c: %.l-cpp -# $(CC) -x c -E -P $(CPPFLAGS) $(DEFS) $< | flex -i -P$* -o$@ -%.c: %.l - flex -i -P$* -o$@ $< - -# Another hack. I can't see any other way to get across to automake that some -# built sources should not be distributed. (since they vary with -# configuration) - -dist-hook: - rm -f $(distdir)/font.c $(distdir)/glue.S - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/src/apple2.h b/src/apple2.h index 289abf64..dea2e52b 100644 --- a/src/apple2.h +++ b/src/apple2.h @@ -14,8 +14,10 @@ * */ -#ifndef A2_H -#define A2_H +#ifndef _A2_H_ +#define _A2_H_ + +#include "config.h" #define BANK2 0x10000 @@ -35,4 +37,4 @@ #define E(foo) .globl _##foo; ALIGN; _##foo##: #endif /* !NO_UNDERSCORES */ -#endif /* A2_H */ +#endif /* _A2_H_ */ diff --git a/src/cpu.S b/src/asm386/cpu.S similarity index 100% rename from src/cpu.S rename to src/asm386/cpu.S diff --git a/src/display.S b/src/asm386/display.S similarity index 99% rename from src/display.S rename to src/asm386/display.S index 84bc1edd..b382e468 100644 --- a/src/display.S +++ b/src/asm386/display.S @@ -17,7 +17,7 @@ #define __ASSEMBLY__ #include "apple2.h" -#include "video.h" +#include "video/video.h" #include "cpu.h" #include "misc.h" diff --git a/src/genglue b/src/asm386/genglue similarity index 75% rename from src/genglue rename to src/asm386/genglue index ea147a09..4b9f626d 100755 --- a/src/genglue +++ b/src/asm386/genglue @@ -1,5 +1,5 @@ #! /bin/sh echo '/* Automatically Generated -- do not edit */' -echo '#include "glue-prologue.h"' +echo '#include "asm386/glue-prologue.h"' grep -E -h '^(GLUE_)|(#if)|(#endif)|(#else)|(#elif)' $* exit 0 diff --git a/src/glue-prologue.h b/src/asm386/glue-prologue.h similarity index 100% rename from src/glue-prologue.h rename to src/asm386/glue-prologue.h diff --git a/src/memory.S b/src/asm386/memory.S similarity index 100% rename from src/memory.S rename to src/asm386/memory.S diff --git a/src/AY8910.c b/src/audio/AY8910.c similarity index 99% rename from src/AY8910.c rename to src/audio/AY8910.c index a2b3974a..7437ac13 100644 --- a/src/AY8910.c +++ b/src/audio/AY8910.c @@ -24,10 +24,9 @@ // [AppleWin-TC] From FUSE's sound.c module -#ifdef APPLE2IX #include "common.h" -#include "win-shim.h" -#include "timing.h" +#ifdef APPLE2IX +#include "audio/win-shim.h" #else #include "StdAfx.h" #include @@ -35,10 +34,11 @@ #include #endif -#include "AY8910.h" #ifdef APPLE2IX -#include "mockingboard.h" +#include "audio/AY8910.h" +#include "audio/mockingboard.h" #else +#include "AY8910.h" #include "Common.h" #include "Structs.h" #include "Applewin.h" // For g_fh diff --git a/src/AY8910.h b/src/audio/AY8910.h similarity index 100% rename from src/AY8910.h rename to src/audio/AY8910.h diff --git a/src/SSI263Phonemes.h b/src/audio/SSI263Phonemes.h similarity index 100% rename from src/SSI263Phonemes.h rename to src/audio/SSI263Phonemes.h diff --git a/src/alhelpers.c b/src/audio/alhelpers.c similarity index 99% rename from src/alhelpers.c rename to src/audio/alhelpers.c index a15f2cd9..cdaec2c1 100644 --- a/src/alhelpers.c +++ b/src/audio/alhelpers.c @@ -28,14 +28,12 @@ * finding an appropriate buffer format, and getting readable strings for * channel configs and sample types. */ -#include +#include +#include +#include -#include "AL/al.h" -#include "AL/alc.h" -#include "AL/alext.h" - -#include "alhelpers.h" #include "common.h" +#include "audio/alhelpers.h" /* InitAL opens the default device and sets up a context using default diff --git a/src/alhelpers.h b/src/audio/alhelpers.h similarity index 100% rename from src/alhelpers.h rename to src/audio/alhelpers.h diff --git a/src/ds-shim.h b/src/audio/ds-shim.h similarity index 99% rename from src/ds-shim.h rename to src/audio/ds-shim.h index 3b56d14d..0a077c26 100644 --- a/src/ds-shim.h +++ b/src/audio/ds-shim.h @@ -12,7 +12,7 @@ #ifndef _DS_SHIM_H_ #define _DS_SHIM_H_ -#include "win-shim.h" +#include "audio/win-shim.h" // 2013/09/19 - http://msdn.microsoft.com/en-us/library/ms897820.aspx diff --git a/src/mockingboard.c b/src/audio/mockingboard.c similarity index 99% rename from src/mockingboard.c rename to src/audio/mockingboard.c index 4ca1e68f..0d5ff0e1 100644 --- a/src/mockingboard.c +++ b/src/audio/mockingboard.c @@ -78,15 +78,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // . ORB = 0x3F (STOP) // -#ifdef APPLE2IX #include "common.h" -#include "glue.h" -#include "cpu.h" -#include "win-shim.h" -#include "soundcore.h" -#include "speaker.h" -#include "timing.h" -#include "mockingboard.h" +#ifdef APPLE2IX +#include "audio/win-shim.h" # ifdef __linux # include # endif @@ -108,8 +102,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include -#include "AY8910.h" -#include "SSI263Phonemes.h" +#include "audio/AY8910.h" +#include "audio/SSI263Phonemes.h" #define SY6522_DEVICE_A 0 diff --git a/src/mockingboard.h b/src/audio/mockingboard.h similarity index 97% rename from src/mockingboard.h rename to src/audio/mockingboard.h index eea32433..d5ff3f2f 100644 --- a/src/mockingboard.h +++ b/src/audio/mockingboard.h @@ -13,8 +13,8 @@ #define _MOCKINGBOARD_H__ #ifdef APPLE2IX -#include "win-shim.h" -#include "peripherals.h" +#include "audio/win-shim.h" +#include "audio/peripherals.h" extern bool g_bDisableDirectSoundMockingboard; diff --git a/src/peripherals.h b/src/audio/peripherals.h similarity index 96% rename from src/peripherals.h rename to src/audio/peripherals.h index 6d5dc365..5dccd7a2 100644 --- a/src/peripherals.h +++ b/src/audio/peripherals.h @@ -12,8 +12,8 @@ #ifndef _PERIPHERALS_H_ #define _PERIPHERALS_H_ -#include "cpu.h" -#include "win-shim.h" +#include "common.h" +#include "audio/win-shim.h" typedef enum eIRQSRC { IS_6522=0x08, // NOTE : matches IRQ... defines in cpu.h diff --git a/src/soundcore-openal.c b/src/audio/soundcore-openal.c similarity index 99% rename from src/soundcore-openal.c rename to src/audio/soundcore-openal.c index 8960add7..fc95224d 100644 --- a/src/soundcore-openal.c +++ b/src/audio/soundcore-openal.c @@ -14,8 +14,9 @@ // Here I must confess that because of general ignorance of the mockingboard and other soundcard code at this time, // there is a need to track any changes/fixes implemented in AppleWin... -#include "soundcore-openal.h" -#include "alhelpers.h" +#include "common.h" +#include "audio/soundcore-openal.h" +#include "audio/alhelpers.h" LPALBUFFERSAMPLESSOFT alBufferSamplesSOFT = wrap_BufferSamples; LPALISBUFFERFORMATSUPPORTEDSOFT alIsBufferFormatSupportedSOFT = NULL; diff --git a/src/soundcore-openal.h b/src/audio/soundcore-openal.h similarity index 97% rename from src/soundcore-openal.h rename to src/audio/soundcore-openal.h index 4ffd4e62..2eec7292 100644 --- a/src/soundcore-openal.h +++ b/src/audio/soundcore-openal.h @@ -13,8 +13,6 @@ #define _SOUNDCORE_OPENAL_H_ #include "common.h" -#include "soundcore.h" -#include "uthash.h" #include #include diff --git a/src/soundcore.c b/src/audio/soundcore.c similarity index 99% rename from src/soundcore.c rename to src/audio/soundcore.c index 183e1782..15b7a34e 100644 --- a/src/soundcore.c +++ b/src/audio/soundcore.c @@ -24,20 +24,18 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /* Description: Core sound related functionality * * Author: Tom Charlesworth - * Linux ALSA Port : Aaron Culliney + * Linux ALSA/OpenAL Port : Aaron Culliney */ +#include "common.h" + #ifdef APPLE2IX #ifdef USE_ALSA -#include "soundcore-alsa.h" +#include "audio/soundcore-alsa.h" #endif -#include "common.h" -#include "win-shim.h" -#include "soundcore.h" -#include "speaker.h" -#include "misc.h" +#include "audio/win-shim.h" #if defined(__GNUC__) # pragma GCC diagnostic push diff --git a/src/soundcore.h b/src/audio/soundcore.h similarity index 99% rename from src/soundcore.h rename to src/audio/soundcore.h index 5b73644a..54667d85 100644 --- a/src/soundcore.h +++ b/src/audio/soundcore.h @@ -17,7 +17,7 @@ #ifndef _SOUNDCORE_H_ #define _SOUNDCORE_H_ -#include "ds-shim.h" +#include "audio/ds-shim.h" #define MAX_SAMPLES (8*1024) diff --git a/src/speaker.c b/src/audio/speaker.c similarity index 99% rename from src/speaker.c rename to src/audio/speaker.c index 28d64760..c72733e3 100644 --- a/src/speaker.c +++ b/src/audio/speaker.c @@ -24,16 +24,14 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /* Description: Speaker emulation * * Author: Various - * Linux ALSA Port : Aaron Culliney + * Linux ALSA/OpenAL Port : Aaron Culliney */ -#ifdef APPLE2IX #include "common.h" -#include "cpu.h" -#include "win-shim.h" -#include "speaker.h" -#include "timing.h" -#include "soundcore.h" + +#ifdef APPLE2IX + +#include "audio/win-shim.h" # ifdef __linux # include # endif diff --git a/src/speaker.h b/src/audio/speaker.h similarity index 97% rename from src/speaker.h rename to src/audio/speaker.h index d24f67fe..e8587d93 100644 --- a/src/speaker.h +++ b/src/audio/speaker.h @@ -13,7 +13,7 @@ #define _SPEAKER_H_ #ifdef APPLE2IX -#include "win-shim.h" +#include "audio/win-shim.h" #endif extern DWORD soundtype; diff --git a/src/win-shim.c b/src/audio/win-shim.c similarity index 98% rename from src/win-shim.c rename to src/audio/win-shim.c index b2e3297e..f1edc7ec 100644 --- a/src/win-shim.c +++ b/src/audio/win-shim.c @@ -10,7 +10,7 @@ */ #include "common.h" -#include "win-shim.h" +#include "audio/win-shim.h" pthread_t CreateThread(void* unused_lpThreadAttributes, int unused_dwStackSize, LPTHREAD_START_ROUTINE lpStartRoutine, LPVOID lpParameter, DWORD unused_dwCreationFlags, LPDWORD lpThreadId) { diff --git a/src/win-shim.h b/src/audio/win-shim.h similarity index 100% rename from src/win-shim.h rename to src/audio/win-shim.h diff --git a/src/common.h b/src/common.h index 0aea35ce..ba745347 100644 --- a/src/common.h +++ b/src/common.h @@ -16,8 +16,12 @@ # define _GNU_SOURCE #endif -#include +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include +#include #include #include #include @@ -28,11 +32,38 @@ #include #include #include +#include +#include + +#include #include #include #include +#include "misc.h" +#include "timing.h" +#include "cpu.h" +#include "video/video.h" +#include "disk.h" +#include "interface.h" +#include "keys.h" +#include "joystick.h" +#include "glue.h" +#include "prefs.h" +#include "uthash.h" +#include "zlib-helpers.h" + +#ifdef DEBUGGER +#include "meta/debug.h" +#endif + +#ifdef AUDIO_ENABLED +#include "audio/soundcore.h" +#include "audio/speaker.h" +#include "audio/mockingboard.h" +#endif + #ifndef NDEBUG # if defined(__GNUC__) # pragma GCC diagnostic push @@ -57,7 +88,7 @@ static FILE *error_log=0; #define ERRQUIT(...) \ do { \ ERRLOG(__VA_ARGS__); \ - exit(0); \ + exit(1); \ } while(0); #else // NDEBUG diff --git a/src/cpu-supp.c b/src/cpu-supp.c index 1f9e272e..38469619 100644 --- a/src/cpu-supp.c +++ b/src/cpu-supp.c @@ -15,8 +15,6 @@ */ #include "common.h" -#include "cpu.h" -#include "mockingboard.h" // These match the bit positions of the 6502 P-register, they are not the same as in cpu.h -- see note there #define C_Flag_6502 0x1 // [C]arry diff --git a/src/debug.c b/src/debug.c deleted file mode 100644 index dd22a282..00000000 --- a/src/debug.c +++ /dev/null @@ -1,3397 +0,0 @@ -#line 2 "debug.c" - -#line 4 "debug.c" - -#define YY_INT_ALIGNED short int - -/* A lexical scanner generated by flex */ - -#define yy_create_buffer debug_create_buffer -#define yy_delete_buffer debug_delete_buffer -#define yy_flex_debug debug_flex_debug -#define yy_init_buffer debug_init_buffer -#define yy_flush_buffer debug_flush_buffer -#define yy_load_buffer_state debug_load_buffer_state -#define yy_switch_to_buffer debug_switch_to_buffer -#define yyin debugin -#define yyleng debugleng -#define yylex debuglex -#define yylineno debuglineno -#define yyout debugout -#define yyrestart debugrestart -#define yytext debugtext -#define yywrap debugwrap -#define yyalloc debugalloc -#define yyrealloc debugrealloc -#define yyfree debugfree - -#define FLEX_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 35 -#if YY_FLEX_SUBMINOR_VERSION > 0 -#define FLEX_BETA -#endif - -/* First, we deal with platform-specific or compiler-specific issues. */ - -/* begin standard C headers. */ -#include -#include -#include -#include - -/* end standard C headers. */ - -/* flex integer type definitions */ - -#ifndef FLEXINT_H -#define FLEXINT_H - -/* C99 systems have . Non-C99 systems may or may not. */ - -#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - -/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, - * if you want the limit (max/min) macros for int types. - */ -#ifndef __STDC_LIMIT_MACROS -#define __STDC_LIMIT_MACROS 1 -#endif - -#include -typedef int8_t flex_int8_t; -typedef uint8_t flex_uint8_t; -typedef int16_t flex_int16_t; -typedef uint16_t flex_uint16_t; -typedef int32_t flex_int32_t; -typedef uint32_t flex_uint32_t; -#else -typedef signed char flex_int8_t; -typedef short int flex_int16_t; -typedef int flex_int32_t; -typedef unsigned char flex_uint8_t; -typedef unsigned short int flex_uint16_t; -typedef unsigned int flex_uint32_t; - -/* Limits of integral types. */ -#ifndef INT8_MIN -#define INT8_MIN (-128) -#endif -#ifndef INT16_MIN -#define INT16_MIN (-32767-1) -#endif -#ifndef INT32_MIN -#define INT32_MIN (-2147483647-1) -#endif -#ifndef INT8_MAX -#define INT8_MAX (127) -#endif -#ifndef INT16_MAX -#define INT16_MAX (32767) -#endif -#ifndef INT32_MAX -#define INT32_MAX (2147483647) -#endif -#ifndef UINT8_MAX -#define UINT8_MAX (255U) -#endif -#ifndef UINT16_MAX -#define UINT16_MAX (65535U) -#endif -#ifndef UINT32_MAX -#define UINT32_MAX (4294967295U) -#endif - -#endif /* ! C99 */ - -#endif /* ! FLEXINT_H */ - -#ifdef __cplusplus - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -/* C99 requires __STDC__ to be defined as 1. */ -#if defined (__STDC__) - -#define YY_USE_CONST - -#endif /* defined (__STDC__) */ -#endif /* ! __cplusplus */ - -#ifdef YY_USE_CONST -#define yyconst const -#else -#define yyconst -#endif - -/* Returned upon end-of-file. */ -#define YY_NULL 0 - -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. - */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) - -/* Enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN. - */ -#define BEGIN (yy_start) = 1 + 2 * - -/* Translate the current start state into a value that can be later handed - * to BEGIN to return to the state. The YYSTATE alias is for lex - * compatibility. - */ -#define YY_START (((yy_start) - 1) / 2) -#define YYSTATE YY_START - -/* Action number for EOF rule of a given start state. */ -#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - -/* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE debugrestart(debugin ) - -#define YY_END_OF_BUFFER_CHAR 0 - -/* Size of default input buffer. */ -#ifndef YY_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k. - * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. - * Ditto for the __ia64__ case accordingly. - */ -#define YY_BUF_SIZE 32768 -#else -#define YY_BUF_SIZE 16384 -#endif /* __ia64__ */ -#endif - -/* The state buf must be large enough to hold one state per character in the main buffer. - */ -#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) - -#ifndef YY_TYPEDEF_YY_BUFFER_STATE -#define YY_TYPEDEF_YY_BUFFER_STATE -typedef struct yy_buffer_state *YY_BUFFER_STATE; -#endif - -extern int debugleng; - -extern FILE *debugin, *debugout; - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - - #define YY_LESS_LINENO(n) - -/* Return all but the first "n" matched characters back to the input stream. */ -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up debugtext. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ - *yy_cp = (yy_hold_char); \ - YY_RESTORE_YY_MORE_OFFSET \ - (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up debugtext again */ \ - } \ - while ( 0 ) - -//#define unput(c) yyunput( c, (yytext_ptr) ) - -#ifndef YY_TYPEDEF_YY_SIZE_T -#define YY_TYPEDEF_YY_SIZE_T -typedef size_t yy_size_t; -#endif - -#ifndef YY_STRUCT_YY_BUFFER_STATE -#define YY_STRUCT_YY_BUFFER_STATE -struct yy_buffer_state - { - FILE *yy_input_file; - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - int yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; - - int yy_bs_lineno; /**< The line count. */ - int yy_bs_column; /**< The column count. */ - - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; - - int yy_buffer_status; - -#define YY_BUFFER_NEW 0 -#define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via debugrestart()), so that the user can continue scanning by - * just pointing debugin at a new input file. - */ -#define YY_BUFFER_EOF_PENDING 2 - - }; -#endif /* !YY_STRUCT_YY_BUFFER_STATE */ - -/* Stack of input buffers. */ -static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ -static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ -static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ - -/* We provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state". - * - * Returns the top of the stack, or NULL. - */ -#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ - ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ - : NULL) - -/* Same as previous macro, but useful when we know that the buffer stack is not - * NULL or when we need an lvalue. For internal use only. - */ -#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] - -/* yy_hold_char holds the character lost when debugtext is formed. */ -static char yy_hold_char; -static int yy_n_chars; /* number of characters read into yy_ch_buf */ -int debugleng; - -/* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; -static int yy_init = 0; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ - -/* Flag which is used to allow debugwrap()'s to do buffer switches - * instead of setting up a fresh debugin. A bit of a hack ... - */ -static int yy_did_buffer_switch_on_eof; - -void debugrestart (FILE *input_file ); -void debug_switch_to_buffer (YY_BUFFER_STATE new_buffer ); -YY_BUFFER_STATE debug_create_buffer (FILE *file,int size ); -void debug_delete_buffer (YY_BUFFER_STATE b ); -void debug_flush_buffer (YY_BUFFER_STATE b ); -void debugpush_buffer_state (YY_BUFFER_STATE new_buffer ); -void debugpop_buffer_state (void ); - -static void debugensure_buffer_stack (void ); -static void debug_load_buffer_state (void ); -static void debug_init_buffer (YY_BUFFER_STATE b,FILE *file ); - -#define YY_FLUSH_BUFFER debug_flush_buffer(YY_CURRENT_BUFFER ) - -YY_BUFFER_STATE debug_scan_buffer (char *base,yy_size_t size ); -YY_BUFFER_STATE debug_scan_string (yyconst char *yy_str ); -YY_BUFFER_STATE debug_scan_bytes (yyconst char *bytes,int len ); - -void *debugalloc (yy_size_t ); -void *debugrealloc (void *,yy_size_t ); -void debugfree (void * ); - -#define yy_new_buffer debug_create_buffer - -#define yy_set_interactive(is_interactive) \ - { \ - if ( ! YY_CURRENT_BUFFER ){ \ - debugensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ - debug_create_buffer(debugin,YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ - } - -#define yy_set_bol(at_bol) \ - { \ - if ( ! YY_CURRENT_BUFFER ){\ - debugensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ - debug_create_buffer(debugin,YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ - } - -#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) - -/* Begin user sect3 */ - -typedef unsigned char YY_CHAR; - -FILE *debugin = (FILE *) 0, *debugout = (FILE *) 0; - -typedef int yy_state_type; - -extern int debuglineno; - -int debuglineno = 1; - -extern char *debugtext; -#define yytext_ptr debugtext - -static yy_state_type yy_get_previous_state (void ); -static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); -static int yy_get_next_buffer (void ); -static void yy_fatal_error (yyconst char msg[] ); - -/* Done after the current pattern has been matched and before the - * corresponding action - sets up debugtext. - */ -#define YY_DO_BEFORE_ACTION \ - (yytext_ptr) = yy_bp; \ - debugleng = (size_t) (yy_cp - yy_bp); \ - (yy_hold_char) = *yy_cp; \ - *yy_cp = '\0'; \ - (yy_c_buf_p) = yy_cp; - -#define YY_NUM_RULES 60 -#define YY_END_OF_BUFFER 61 -/* This struct is not used in this scanner, - but its presence is necessary. */ -struct yy_trans_info - { - flex_int32_t yy_verify; - flex_int32_t yy_nxt; - }; -static yyconst flex_int16_t yy_accept[373] = - { 0, - 0, 0, 61, 59, 58, 59, 59, 59, 59, 59, - 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, - 59, 59, 59, 59, 59, 0, 0, 0, 0, 0, - 54, 0, 0, 0, 0, 0, 6, 0, 0, 0, - 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, - 0, 0, 39, 0, 0, 0, 0, 0, 16, 0, - 0, 0, 0, 0, 0, 27, 0, 0, 30, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 37, 0, - 0, 0, 0, 0, 0, 50, 0, 0, 0, 0, - 0, 0, 0, 0, 25, 0, 0, 0, 0, 0, - - 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 28, 0, 0, 52, 0, 0, 0, 0, 0, 31, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 51, 0, 0, 0, 0, - 0, 0, 53, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 44, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 22, 0, 0, - 0, 0, 0, 3, 0, 0, 0, 34, 0, 0, - - 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, - 13, 0, 0, 0, 0, 29, 0, 38, 0, 0, - 56, 0, 26, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 43, 0, 32, 0, 0, 5, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, - 57, 0, 0, 0, 26, 0, 0, 0, 0, 0, - 0, 1, 0, 0, 0, 9, 0, 0, 35, 0, - 0, 0, 0, 41, 0, 0, 11, 0, 0, 0, - 19, 0, 49, 0, 0, 45, 0, 0, 0, 23, - - 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, - 14, 0, 0, 0, 0, 0, 0, 0, 47, 0, - 0, 0, 0, 7, 0, 0, 36, 0, 0, 42, - 0, 0, 0, 0, 17, 0, 0, 0, 2, 0, - 10, 0, 0, 0, 12, 0, 20, 0, 46, 0, - 0, 0, 0, 24, 0, 0, 0, 0, 0, 0, - 8, 0, 0, 18, 0, 48, 0, 0, 0, 0, - 55, 0 - } ; - -static yyconst flex_int32_t yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, - 1, 1, 4, 1, 1, 1, 5, 6, 7, 8, - 9, 9, 10, 11, 9, 9, 9, 12, 1, 1, - 1, 1, 13, 1, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 1, 23, 24, 25, 26, 27, 28, - 1, 29, 30, 31, 32, 33, 34, 35, 36, 1, - 1, 1, 1, 1, 1, 1, 37, 38, 39, 40, - - 41, 42, 43, 44, 45, 1, 46, 47, 48, 49, - 50, 51, 1, 52, 53, 54, 55, 56, 57, 58, - 59, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1 - } ; - -static yyconst flex_int32_t yy_meta[61] = - { 0, - 1, 2, 2, 3, 4, 5, 5, 5, 5, 5, - 5, 6, 1, 7, 7, 7, 7, 7, 7, 1, - 1, 1, 1, 8, 1, 1, 9, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 7, 7, 7, 7, - 7, 7, 1, 1, 1, 1, 8, 1, 1, 9, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 10 - } ; - -static yyconst flex_int16_t yy_base[414] = - { 0, - 265, 0, 254, 1812, 1812, 59, 61, 120, 179, 238, - 297, 356, 64, 66, 415, 47, 474, 71, 98, 42, - 231, 533, 592, 77, 651, 73, 145, 75, 65, 106, - 1812, 233, 124, 292, 168, 301, 1812, 329, 274, 68, - 221, 114, 59, 710, 78, 1812, 769, 131, 97, 828, - 100, 333, 1812, 360, 366, 239, 412, 327, 1812, 419, - 168, 887, 112, 452, 209, 1812, 198, 310, 1812, 459, - 409, 364, 389, 392, 140, 240, 489, 496, 1812, 163, - 425, 519, 437, 500, 184, 1812, 573, 564, 299, 526, - 444, 578, 448, 478, 1812, 946, 523, 597, 589, 550, - - 1812, 226, 1005, 555, 642, 569, 601, 599, 237, 672, - 1812, 603, 632, 1812, 666, 250, 678, 674, 704, 1812, - 96, 682, 206, 0, 236, 750, 684, 308, 347, 743, - 811, 713, 259, 395, 234, 799, 388, 272, 698, 806, - 205, 825, 870, 487, 0, 509, 890, 921, 702, 552, - 600, 701, 727, 901, 780, 1812, 747, 949, 783, 995, - 802, 861, 1812, 884, 898, 619, 909, 623, 951, 953, - 306, 964, 998, 409, 972, 1812, 363, 1035, 1094, 1043, - 936, 964, 1059, 1082, 1051, 975, 987, 1812, 198, 1012, - 922, 200, 1066, 1812, 789, 822, 1028, 1812, 446, 695, - - 524, 524, 1071, 1812, 530, 733, 1074, 1086, 174, 1097, - 1812, 761, 815, 848, 1102, 1812, 0, 1812, 797, 1105, - 1812, 1114, 1812, 1117, 805, 1119, 1125, 834, 840, 1137, - 1142, 1148, 1145, 1812, 1150, 1812, 913, 1152, 1812, 0, - 1156, 1165, 1179, 985, 1158, 1020, 1168, 168, 1182, 156, - 1184, 1186, 1812, 0, 1188, 1191, 1189, 1204, 1197, 1211, - 1812, 1214, 141, 1220, 1812, 1228, 1224, 1232, 1234, 1238, - 1240, 1812, 1248, 138, 1256, 1812, 1247, 1259, 1812, 127, - 1263, 119, 1265, 1812, 1267, 1270, 1812, 1271, 98, 1279, - 1812, 1282, 1812, 1284, 1287, 1812, 1285, 1294, 1299, 1812, - - 1301, 1812, 0, 1304, 1307, 1309, 1311, 1315, 1318, 1320, - 1812, 0, 1329, 1326, 1332, 1331, 81, 1338, 1812, 1341, - 1346, 1348, 1350, 1812, 1353, 1355, 1812, 1360, 1366, 1812, - 1370, 1373, 1379, 1381, 1812, 1385, 1388, 1390, 1812, 1392, - 1812, 1397, 1396, 1402, 1812, 1409, 1812, 1414, 1812, 1416, - 1418, 1421, 1425, 1812, 1429, 67, 1440, 1429, 1435, 1444, - 1812, 0, 1446, 1812, 1451, 1812, 1453, 1456, 1458, 1461, - 1812, 1812, 1521, 1530, 1537, 1543, 1552, 1561, 1570, 1579, - 1588, 1597, 1603, 1609, 1615, 1621, 1630, 1639, 1645, 1651, - 1657, 1666, 1672, 1678, 1685, 1688, 1691, 1697, 1703, 1713, - - 1723, 1732, 1741, 1747, 1753, 1759, 1765, 1771, 1777, 1786, - 1795, 1798, 1804 - } ; - -static yyconst flex_int16_t yy_def[414] = - { 0, - 373, 372, 372, 372, 372, 374, 372, 374, 372, 374, - 374, 11, 372, 372, 372, 372, 372, 372, 372, 372, - 372, 372, 372, 372, 372, 372, 374, 375, 372, 372, - 372, 376, 8, 372, 372, 372, 372, 377, 27, 39, - 372, 372, 372, 372, 372, 372, 372, 10, 48, 372, - 372, 372, 372, 378, 372, 372, 372, 372, 372, 372, - 372, 372, 62, 372, 372, 372, 379, 372, 372, 372, - 372, 372, 380, 372, 15, 15, 372, 372, 372, 372, - 372, 372, 372, 372, 372, 372, 376, 372, 372, 372, - 381, 372, 372, 372, 372, 372, 372, 372, 372, 372, - - 372, 372, 372, 372, 372, 372, 372, 372, 23, 372, - 372, 372, 372, 372, 382, 25, 372, 372, 372, 372, - 375, 375, 372, 383, 372, 87, 372, 372, 372, 372, - 377, 131, 372, 372, 372, 372, 44, 372, 384, 384, - 372, 372, 372, 372, 385, 372, 378, 147, 372, 372, - 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, - 372, 372, 372, 379, 380, 372, 372, 372, 381, 372, - 96, 372, 372, 96, 372, 372, 372, 386, 372, 372, - 372, 372, 372, 372, 372, 382, 372, 372, 372, 383, - 372, 372, 387, 372, 388, 372, 372, 372, 372, 389, - - 372, 372, 384, 372, 372, 390, 385, 372, 372, 391, - 372, 372, 392, 372, 372, 372, 165, 372, 393, 372, - 372, 372, 372, 372, 372, 386, 394, 372, 372, 372, - 372, 372, 372, 372, 372, 372, 395, 372, 372, 396, - 372, 387, 387, 372, 388, 372, 389, 372, 372, 372, - 390, 372, 372, 397, 391, 255, 372, 392, 393, 372, - 372, 372, 372, 372, 372, 394, 398, 395, 395, 396, - 372, 372, 372, 372, 399, 372, 400, 372, 372, 372, - 401, 372, 390, 372, 397, 372, 372, 372, 372, 402, - 372, 372, 372, 372, 372, 372, 372, 398, 372, 372, - - 403, 372, 404, 399, 304, 400, 372, 401, 372, 405, - 372, 406, 402, 313, 407, 372, 372, 372, 372, 403, - 320, 404, 372, 372, 408, 372, 372, 372, 372, 372, - 405, 331, 406, 372, 372, 407, 372, 372, 372, 409, - 372, 408, 372, 372, 372, 410, 372, 372, 372, 411, - 409, 351, 372, 372, 372, 372, 410, 357, 411, 372, - 372, 412, 372, 372, 372, 372, 412, 413, 413, 372, - 372, 0, 372, 372, 372, 372, 372, 372, 372, 372, - 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, - 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, - - 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, - 372, 372, 372 - } ; - -static yyconst flex_int16_t yy_nxt[1873] = - { 0, - 4, 4, 5, 4, 4, 6, 6, 6, 6, 6, - 6, 4, 7, 8, 9, 10, 11, 6, 12, 13, - 14, 15, 16, 17, 18, 19, 20, 4, 21, 22, - 4, 23, 24, 25, 4, 4, 8, 9, 10, 11, - 6, 12, 13, 14, 15, 16, 17, 18, 19, 20, - 4, 21, 22, 4, 23, 24, 25, 4, 4, 4, - 26, 26, 30, 30, 80, 67, 67, 30, 30, 96, - 28, 362, 87, 87, 26, 26, 121, 121, 112, 112, - 123, 39, 29, 70, 28, 337, 134, 80, 88, 71, - 68, 138, 96, 72, 89, 90, 29, 121, 121, 91, - - 91, 113, 312, 123, 39, 29, 70, 30, 30, 134, - 48, 88, 71, 68, 138, 92, 72, 89, 90, 29, - 31, 32, 32, 69, 113, 31, 309, 144, 93, 123, - 37, 28, 94, 48, 307, 33, 114, 372, 92, 27, - 133, 34, 303, 35, 27, 294, 26, 26, 27, 36, - 144, 93, 123, 372, 29, 94, 28, 95, 33, 372, - 372, 282, 27, 133, 34, 31, 35, 27, 29, 157, - 157, 27, 36, 280, 128, 128, 372, 29, 254, 37, - 38, 38, 372, 129, 27, 27, 27, 27, 27, 27, - 28, 29, 39, 27, 27, 27, 40, 27, 166, 67, - - 67, 41, 42, 167, 240, 43, 129, 44, 45, 237, - 157, 157, 189, 189, 205, 39, 27, 27, 27, 40, - 27, 166, 132, 132, 41, 42, 167, 66, 43, 61, - 44, 45, 97, 97, 32, 32, 124, 125, 46, 47, - 47, 191, 192, 201, 28, 150, 150, 43, 98, 28, - 99, 48, 61, 372, 151, 49, 35, 69, 177, 372, - 100, 50, 372, 372, 51, 372, 52, 5, 66, 372, - 43, 98, 199, 99, 48, 38, 38, 151, 49, 35, - 46, 177, 372, 100, 50, 372, 372, 51, 372, 52, - 101, 372, 37, 87, 87, 199, 41, 53, 54, 54, - - 43, 372, 87, 87, 202, 128, 128, 372, 28, 195, - 195, 67, 67, 127, 168, 89, 130, 372, 55, 41, - 56, 372, 34, 43, 89, 57, 58, 202, 148, 148, - 38, 38, 372, 46, 140, 140, 127, 168, 89, 130, - 28, 55, 372, 56, 372, 34, 372, 89, 57, 58, - 149, 37, 29, 196, 196, 43, 59, 60, 60, 51, - 37, 54, 54, 145, 146, 30, 30, 148, 148, 69, - 372, 28, 372, 149, 372, 29, 61, 62, 43, 29, - 224, 63, 51, 56, 64, 65, 59, 372, 46, 149, - 73, 73, 53, 73, 73, 58, 200, 200, 372, 61, - - 62, 372, 29, 224, 63, 372, 56, 64, 65, 372, - 30, 30, 149, 152, 152, 66, 73, 73, 58, 59, - 60, 60, 372, 31, 372, 59, 81, 81, 372, 153, - 28, 372, 74, 154, 75, 372, 72, 372, 81, 81, - 76, 77, 29, 78, 155, 91, 91, 372, 79, 91, - 91, 79, 153, 159, 159, 74, 154, 75, 372, 72, - 30, 30, 246, 76, 77, 29, 78, 155, 31, 160, - 372, 156, 161, 372, 79, 81, 81, 372, 66, 91, - 91, 162, 71, 372, 86, 246, 72, 82, 206, 206, - 73, 73, 160, 83, 372, 161, 86, 73, 73, 84, - - 85, 81, 81, 95, 162, 71, 74, 95, 93, 72, - 82, 163, 372, 74, 208, 209, 83, 78, 31, 83, - 81, 81, 84, 85, 97, 97, 372, 87, 87, 74, - 372, 93, 372, 86, 91, 91, 74, 95, 83, 248, - 78, 249, 83, 372, 84, 250, 102, 372, 79, 89, - 103, 97, 97, 213, 213, 79, 91, 91, 372, 86, - 104, 83, 248, 105, 249, 87, 87, 84, 250, 102, - 106, 106, 89, 103, 87, 87, 124, 125, 86, 91, - 91, 372, 101, 104, 372, 37, 105, 89, 90, 372, - 97, 97, 95, 106, 106, 372, 89, 372, 97, 97, - - 106, 106, 106, 106, 112, 112, 214, 214, 93, 101, - 89, 90, 94, 107, 95, 108, 99, 109, 100, 89, - 219, 219, 110, 37, 108, 372, 100, 372, 111, 128, - 128, 93, 37, 112, 112, 94, 107, 95, 108, 99, - 109, 100, 372, 91, 91, 110, 372, 108, 101, 100, - 372, 111, 115, 115, 372, 184, 101, 372, 111, 185, - 111, 372, 114, 372, 116, 372, 117, 115, 115, 104, - 372, 118, 372, 106, 106, 115, 115, 372, 184, 115, - 115, 119, 185, 187, 187, 87, 87, 116, 372, 117, - 372, 114, 104, 107, 118, 108, 200, 200, 118, 203, - - 203, 95, 152, 152, 119, 115, 115, 89, 150, 150, - 120, 132, 132, 372, 132, 132, 107, 212, 108, 117, - 135, 118, 372, 136, 118, 120, 372, 137, 152, 152, - 89, 111, 41, 120, 206, 206, 43, 120, 372, 43, - 212, 188, 117, 37, 87, 87, 136, 118, 157, 157, - 137, 193, 193, 372, 372, 41, 372, 204, 372, 43, - 156, 372, 43, 120, 34, 372, 89, 150, 150, 46, - 47, 47, 46, 372, 139, 139, 139, 139, 139, 139, - 28, 152, 152, 372, 159, 159, 156, 34, 372, 89, - 195, 195, 29, 244, 372, 51, 372, 153, 219, 219, - - 132, 132, 37, 159, 159, 372, 66, 140, 140, 194, - 262, 263, 197, 197, 372, 29, 213, 213, 51, 257, - 153, 41, 372, 195, 195, 43, 140, 140, 53, 140, - 140, 372, 51, 237, 372, 267, 267, 372, 141, 156, - 372, 142, 163, 123, 41, 143, 228, 228, 43, 213, - 213, 51, 372, 52, 51, 51, 52, 372, 46, 237, - 372, 163, 159, 159, 142, 53, 123, 372, 143, 372, - 198, 140, 140, 372, 51, 372, 52, 51, 372, 52, - 372, 161, 372, 142, 53, 215, 215, 53, 157, 157, - 372, 210, 210, 372, 372, 372, 51, 372, 52, 217, - - 217, 372, 152, 152, 161, 372, 142, 61, 158, 372, - 220, 220, 63, 372, 268, 268, 65, 372, 153, 51, - 163, 52, 148, 148, 145, 146, 240, 192, 192, 53, - 61, 158, 372, 155, 372, 63, 372, 227, 227, 65, - 372, 153, 372, 216, 149, 372, 66, 170, 170, 211, - 157, 157, 222, 222, 170, 170, 155, 218, 372, 182, - 156, 171, 172, 173, 372, 170, 170, 149, 221, 61, - 228, 228, 174, 170, 170, 175, 235, 235, 65, 229, - 59, 173, 182, 372, 171, 172, 173, 372, 187, 187, - 273, 274, 61, 175, 372, 174, 159, 159, 175, 170, - - 170, 65, 229, 372, 173, 176, 178, 178, 66, 372, - 223, 372, 176, 238, 238, 161, 175, 372, 179, 372, - 180, 277, 277, 176, 162, 181, 372, 175, 182, 197, - 197, 176, 104, 183, 236, 372, 178, 178, 161, 225, - 372, 179, 372, 180, 227, 227, 188, 162, 181, 372, - 175, 182, 91, 91, 163, 104, 183, 176, 182, 372, - 227, 227, 372, 181, 95, 372, 182, 241, 241, 242, - 372, 239, 203, 203, 180, 252, 252, 372, 104, 181, - 372, 182, 182, 230, 230, 372, 181, 198, 372, 182, - 254, 209, 209, 372, 95, 227, 227, 180, 210, 210, - - 255, 104, 181, 215, 215, 182, 220, 220, 372, 180, - 95, 231, 232, 233, 181, 222, 222, 182, 260, 260, - 264, 264, 183, 372, 372, 194, 227, 227, 372, 225, - 204, 372, 180, 253, 231, 232, 233, 181, 230, 230, - 182, 234, 372, 230, 230, 183, 230, 230, 182, 230, - 230, 235, 235, 238, 238, 372, 211, 241, 241, 275, - 275, 216, 372, 372, 221, 372, 372, 372, 242, 278, - 278, 182, 372, 223, 231, 372, 261, 231, 265, 233, - 271, 271, 372, 281, 281, 283, 283, 252, 252, 372, - 372, 372, 286, 286, 288, 289, 234, 231, 292, 292, - - 231, 234, 233, 372, 234, 290, 290, 234, 372, 236, - 372, 239, 260, 260, 372, 194, 372, 276, 294, 263, - 263, 264, 264, 372, 372, 267, 267, 279, 297, 295, - 295, 372, 372, 268, 268, 299, 299, 372, 272, 301, - 301, 271, 271, 284, 372, 253, 372, 372, 277, 277, - 287, 372, 303, 274, 274, 372, 293, 275, 275, 304, - 278, 278, 372, 291, 281, 281, 283, 283, 310, 310, - 261, 286, 286, 372, 372, 312, 289, 289, 372, 265, - 290, 290, 313, 292, 292, 315, 315, 296, 295, 295, - 316, 317, 372, 300, 372, 318, 318, 302, 372, 272, - - 299, 299, 301, 301, 320, 372, 372, 372, 323, 323, - 325, 325, 326, 326, 372, 276, 328, 328, 279, 329, - 329, 310, 310, 331, 284, 372, 311, 334, 334, 287, - 372, 372, 372, 315, 315, 337, 317, 317, 291, 318, - 318, 293, 372, 372, 372, 372, 296, 338, 338, 340, - 340, 323, 323, 319, 325, 325, 326, 326, 300, 372, - 302, 328, 328, 372, 343, 372, 324, 329, 329, 372, - 327, 372, 372, 372, 344, 344, 372, 330, 372, 311, - 346, 346, 334, 334, 372, 335, 348, 348, 372, 350, - 350, 338, 338, 340, 340, 351, 372, 319, 353, 353, - - 372, 355, 356, 344, 344, 339, 372, 341, 372, 324, - 346, 346, 357, 372, 327, 348, 348, 350, 350, 372, - 372, 372, 360, 360, 372, 330, 353, 353, 372, 372, - 363, 363, 345, 362, 356, 356, 365, 365, 347, 372, - 335, 372, 372, 372, 349, 360, 360, 363, 363, 339, - 372, 341, 365, 365, 368, 368, 354, 368, 368, 370, - 370, 345, 370, 370, 372, 372, 372, 372, 347, 372, - 372, 372, 372, 349, 372, 372, 372, 372, 372, 372, - 361, 372, 372, 372, 354, 372, 372, 372, 364, 372, - 372, 372, 372, 372, 366, 372, 372, 372, 372, 372, - - 372, 372, 372, 361, 372, 364, 372, 372, 372, 372, - 366, 372, 372, 372, 372, 372, 372, 371, 372, 372, - 371, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 27, 372, 372, 27, 27, 27, 27, 122, 372, - 372, 122, 372, 122, 126, 126, 126, 126, 126, 126, - 126, 372, 126, 131, 372, 372, 131, 131, 131, 131, - 131, 131, 147, 147, 147, 147, 147, 147, 147, 372, - 147, 164, 372, 372, 164, 372, 164, 372, 372, 164, - 165, 372, 372, 165, 372, 372, 372, 372, 165, 169, - 372, 372, 169, 372, 169, 372, 372, 169, 186, 372, - - 372, 186, 372, 186, 372, 372, 186, 190, 372, 190, - 139, 372, 372, 139, 372, 372, 372, 372, 139, 207, - 372, 207, 226, 372, 226, 226, 372, 226, 226, 372, - 226, 243, 243, 372, 243, 372, 243, 372, 372, 243, - 245, 372, 245, 245, 372, 245, 247, 372, 372, 247, - 372, 247, 251, 372, 372, 251, 372, 251, 256, 256, - 372, 256, 372, 256, 372, 372, 256, 258, 372, 258, - 258, 372, 258, 259, 372, 372, 259, 372, 259, 266, - 372, 266, 266, 372, 266, 266, 269, 372, 372, 269, - 372, 269, 270, 372, 270, 285, 372, 285, 298, 372, - - 298, 298, 372, 298, 305, 305, 372, 305, 372, 305, - 372, 372, 305, 306, 306, 306, 306, 306, 306, 306, - 306, 306, 306, 308, 308, 308, 308, 308, 308, 308, - 308, 308, 308, 314, 314, 372, 314, 372, 314, 372, - 372, 314, 321, 321, 372, 321, 372, 321, 372, 372, - 321, 322, 372, 322, 332, 332, 372, 332, 372, 332, - 372, 372, 332, 333, 372, 333, 336, 372, 372, 336, - 372, 336, 342, 372, 372, 342, 372, 342, 352, 352, - 372, 352, 372, 352, 372, 372, 352, 358, 358, 372, - 358, 372, 358, 372, 372, 358, 359, 372, 372, 359, - - 372, 359, 367, 372, 367, 369, 372, 372, 369, 372, - 369, 3, 372, 372, 372, 372, 372, 372, 372, 372, - 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, - 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, - 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, - 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, - 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, - 372, 372 - } ; - -static yyconst flex_int16_t yy_chk[1873] = - { 0, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 6, 6, 7, 7, 16, 13, 13, 14, 14, 20, - 6, 356, 18, 18, 26, 26, 28, 28, 24, 24, - 29, 40, 6, 14, 26, 317, 43, 16, 18, 14, - 13, 45, 20, 14, 18, 18, 26, 121, 121, 19, - - 19, 24, 289, 29, 40, 6, 14, 30, 30, 43, - 49, 18, 14, 13, 45, 19, 14, 18, 18, 26, - 7, 8, 8, 13, 24, 14, 282, 51, 19, 42, - 18, 8, 19, 49, 280, 8, 24, 63, 19, 33, - 42, 8, 274, 8, 48, 263, 27, 27, 48, 8, - 51, 19, 42, 33, 48, 19, 27, 19, 8, 75, - 63, 250, 33, 42, 8, 30, 8, 48, 27, 61, - 61, 48, 8, 248, 35, 35, 33, 48, 209, 8, - 9, 9, 75, 35, 9, 9, 9, 9, 9, 9, - 9, 27, 9, 9, 9, 9, 9, 9, 80, 67, - - 67, 9, 9, 85, 192, 9, 35, 9, 9, 189, - 65, 65, 123, 123, 141, 9, 9, 9, 9, 9, - 9, 80, 41, 41, 9, 9, 85, 61, 9, 65, - 9, 9, 21, 21, 32, 32, 32, 32, 9, 10, - 10, 125, 125, 135, 32, 56, 56, 41, 21, 10, - 21, 10, 65, 3, 56, 10, 32, 67, 102, 76, - 21, 10, 109, 116, 10, 76, 10, 1, 65, 0, - 41, 21, 133, 21, 10, 39, 39, 56, 10, 32, - 41, 102, 76, 21, 10, 109, 116, 10, 76, 10, - 21, 0, 32, 34, 34, 133, 39, 10, 11, 11, - - 39, 0, 36, 36, 138, 89, 89, 0, 11, 128, - 128, 68, 68, 34, 89, 34, 36, 0, 11, 39, - 11, 171, 36, 39, 36, 11, 11, 138, 58, 58, - 38, 38, 0, 39, 52, 52, 34, 89, 34, 36, - 38, 11, 0, 11, 171, 36, 0, 36, 11, 11, - 58, 34, 38, 129, 129, 38, 11, 12, 12, 52, - 36, 54, 54, 54, 54, 72, 72, 55, 55, 68, - 0, 54, 0, 58, 0, 38, 12, 12, 38, 12, - 177, 12, 52, 54, 12, 12, 58, 0, 38, 55, - 73, 73, 52, 74, 74, 55, 134, 134, 137, 12, - - 12, 0, 12, 177, 12, 137, 54, 12, 12, 0, - 71, 71, 55, 57, 57, 12, 15, 15, 55, 54, - 60, 60, 0, 72, 174, 55, 81, 81, 137, 57, - 60, 0, 15, 57, 15, 174, 71, 0, 83, 83, - 15, 15, 60, 15, 57, 91, 91, 174, 73, 93, - 93, 74, 57, 64, 64, 15, 57, 15, 174, 71, - 70, 70, 199, 15, 15, 60, 15, 57, 71, 64, - 0, 57, 64, 0, 15, 17, 17, 0, 60, 94, - 94, 64, 70, 0, 81, 199, 70, 17, 144, 144, - 77, 77, 64, 17, 0, 64, 83, 78, 78, 17, - - 17, 84, 84, 91, 64, 70, 77, 93, 94, 70, - 17, 64, 0, 78, 146, 146, 17, 77, 70, 84, - 82, 82, 17, 17, 97, 97, 0, 90, 90, 77, - 0, 94, 0, 17, 22, 22, 78, 94, 82, 201, - 77, 202, 84, 0, 82, 205, 22, 0, 77, 90, - 22, 100, 100, 150, 150, 78, 104, 104, 0, 84, - 22, 82, 201, 22, 202, 88, 88, 82, 205, 22, - 106, 106, 90, 22, 87, 87, 87, 87, 82, 92, - 92, 0, 97, 22, 87, 90, 22, 88, 88, 0, - 99, 99, 22, 23, 23, 0, 87, 0, 98, 98, - - 108, 108, 107, 107, 112, 112, 151, 151, 92, 100, - 88, 88, 92, 23, 104, 23, 98, 23, 99, 87, - 166, 166, 23, 88, 107, 0, 98, 0, 106, 168, - 168, 92, 87, 113, 113, 92, 23, 92, 23, 98, - 23, 99, 0, 105, 105, 23, 0, 107, 99, 98, - 0, 23, 25, 25, 0, 105, 98, 0, 108, 105, - 107, 0, 112, 0, 25, 0, 25, 115, 115, 105, - 0, 25, 0, 110, 110, 118, 118, 0, 105, 117, - 117, 25, 105, 122, 122, 127, 127, 25, 0, 25, - 0, 113, 105, 110, 25, 110, 200, 200, 117, 139, - - 139, 105, 152, 152, 25, 119, 119, 127, 149, 149, - 25, 44, 44, 0, 132, 132, 110, 149, 110, 119, - 44, 117, 0, 44, 119, 115, 0, 44, 153, 153, - 127, 110, 44, 118, 206, 206, 44, 117, 0, 132, - 149, 122, 119, 127, 130, 130, 44, 119, 157, 157, - 44, 126, 126, 126, 126, 44, 0, 139, 0, 44, - 152, 0, 132, 119, 130, 0, 130, 212, 212, 44, - 47, 47, 132, 126, 47, 47, 47, 47, 47, 47, - 47, 155, 155, 0, 159, 159, 153, 130, 0, 130, - 195, 195, 47, 195, 0, 47, 126, 155, 219, 219, - - 136, 136, 130, 161, 161, 0, 157, 140, 140, 126, - 225, 225, 131, 131, 0, 47, 213, 213, 47, 213, - 155, 136, 131, 196, 196, 136, 142, 142, 47, 50, - 50, 0, 140, 196, 131, 228, 228, 131, 50, 155, - 0, 50, 159, 50, 136, 50, 229, 229, 136, 214, - 214, 142, 0, 142, 50, 140, 50, 131, 136, 214, - 131, 161, 162, 162, 50, 140, 50, 0, 50, 0, - 131, 143, 143, 0, 142, 0, 142, 50, 0, 50, - 0, 162, 0, 143, 142, 164, 164, 50, 62, 62, - 0, 147, 147, 147, 147, 0, 143, 0, 143, 165, - - 165, 147, 154, 154, 162, 0, 143, 62, 62, 0, - 167, 167, 62, 147, 237, 237, 62, 0, 154, 143, - 162, 143, 148, 148, 148, 148, 191, 191, 191, 143, - 62, 62, 0, 154, 0, 62, 147, 181, 181, 62, - 0, 154, 0, 164, 148, 0, 62, 96, 96, 147, - 158, 158, 169, 169, 170, 170, 154, 165, 0, 181, - 154, 96, 96, 96, 0, 172, 172, 148, 167, 158, - 182, 182, 96, 175, 175, 96, 186, 186, 158, 182, - 148, 172, 181, 0, 96, 96, 96, 0, 187, 187, - 244, 244, 158, 172, 0, 96, 160, 160, 96, 173, - - 173, 158, 182, 0, 172, 96, 103, 103, 158, 0, - 169, 0, 170, 190, 190, 160, 172, 0, 103, 0, - 103, 246, 246, 172, 160, 103, 0, 173, 103, 197, - 197, 175, 103, 103, 186, 0, 178, 178, 160, 178, - 0, 103, 0, 103, 180, 180, 187, 160, 103, 0, - 173, 103, 185, 185, 160, 103, 103, 173, 178, 0, - 183, 183, 0, 180, 103, 0, 180, 193, 193, 193, - 0, 190, 203, 203, 183, 207, 207, 0, 185, 183, - 0, 178, 183, 184, 184, 0, 180, 197, 0, 180, - 208, 208, 208, 0, 178, 179, 179, 183, 210, 210, - - 210, 185, 183, 215, 215, 183, 220, 220, 0, 179, - 185, 184, 184, 184, 179, 222, 222, 179, 224, 224, - 226, 226, 179, 226, 0, 193, 227, 227, 0, 227, - 203, 0, 179, 207, 184, 184, 184, 179, 230, 230, - 179, 184, 226, 231, 231, 179, 233, 233, 227, 232, - 232, 235, 235, 238, 238, 0, 210, 241, 241, 245, - 245, 215, 245, 0, 220, 226, 242, 242, 242, 247, - 247, 227, 0, 222, 233, 0, 224, 232, 226, 232, - 243, 243, 243, 249, 249, 251, 251, 252, 252, 255, - 255, 255, 256, 256, 257, 257, 230, 233, 259, 259, - - 232, 231, 232, 0, 233, 258, 258, 232, 258, 235, - 0, 238, 260, 260, 0, 241, 0, 245, 262, 262, - 262, 264, 264, 0, 242, 267, 267, 247, 267, 266, - 266, 0, 266, 268, 268, 269, 269, 0, 243, 270, - 270, 271, 271, 251, 0, 252, 0, 255, 277, 277, - 256, 266, 273, 273, 273, 0, 259, 275, 275, 275, - 278, 278, 0, 258, 281, 281, 283, 283, 285, 285, - 260, 286, 286, 0, 266, 288, 288, 288, 0, 264, - 290, 290, 290, 292, 292, 294, 294, 266, 295, 295, - 297, 297, 0, 269, 0, 298, 298, 270, 298, 271, - - 299, 299, 301, 301, 301, 304, 304, 304, 305, 305, - 306, 306, 307, 307, 0, 275, 308, 308, 278, 309, - 309, 310, 310, 310, 283, 0, 285, 314, 314, 286, - 313, 313, 313, 315, 315, 316, 316, 316, 290, 318, - 318, 292, 320, 320, 320, 0, 295, 321, 321, 322, - 322, 323, 323, 298, 325, 325, 326, 326, 299, 0, - 301, 328, 328, 304, 328, 0, 305, 329, 329, 0, - 307, 331, 331, 331, 332, 332, 0, 309, 0, 310, - 333, 333, 334, 334, 0, 314, 336, 336, 313, 337, - 337, 338, 338, 340, 340, 340, 0, 318, 342, 342, - - 320, 343, 343, 344, 344, 321, 0, 322, 0, 323, - 346, 346, 346, 0, 326, 348, 348, 350, 350, 351, - 351, 351, 352, 352, 0, 329, 353, 353, 0, 331, - 358, 358, 332, 355, 355, 355, 359, 359, 333, 0, - 334, 357, 357, 357, 336, 360, 360, 363, 363, 338, - 0, 340, 365, 365, 367, 367, 342, 368, 368, 369, - 369, 344, 370, 370, 0, 0, 0, 0, 346, 0, - 0, 0, 0, 348, 0, 0, 0, 351, 0, 0, - 352, 0, 0, 0, 353, 0, 0, 0, 358, 0, - 0, 0, 0, 0, 359, 0, 0, 0, 0, 357, - - 0, 0, 0, 360, 0, 363, 0, 0, 0, 0, - 365, 0, 0, 0, 0, 0, 0, 369, 0, 0, - 370, 373, 373, 373, 373, 373, 373, 373, 373, 373, - 373, 374, 0, 0, 374, 374, 374, 374, 375, 0, - 0, 375, 0, 375, 376, 376, 376, 376, 376, 376, - 376, 0, 376, 377, 0, 0, 377, 377, 377, 377, - 377, 377, 378, 378, 378, 378, 378, 378, 378, 0, - 378, 379, 0, 0, 379, 0, 379, 0, 0, 379, - 380, 0, 0, 380, 0, 0, 0, 0, 380, 381, - 0, 0, 381, 0, 381, 0, 0, 381, 382, 0, - - 0, 382, 0, 382, 0, 0, 382, 383, 0, 383, - 384, 0, 0, 384, 0, 0, 0, 0, 384, 385, - 0, 385, 386, 0, 386, 386, 0, 386, 386, 0, - 386, 387, 387, 0, 387, 0, 387, 0, 0, 387, - 388, 0, 388, 388, 0, 388, 389, 0, 0, 389, - 0, 389, 390, 0, 0, 390, 0, 390, 391, 391, - 0, 391, 0, 391, 0, 0, 391, 392, 0, 392, - 392, 0, 392, 393, 0, 0, 393, 0, 393, 394, - 0, 394, 394, 0, 394, 394, 395, 0, 0, 395, - 0, 395, 396, 0, 396, 397, 0, 397, 398, 0, - - 398, 398, 0, 398, 399, 399, 0, 399, 0, 399, - 0, 0, 399, 400, 400, 400, 400, 400, 400, 400, - 400, 400, 400, 401, 401, 401, 401, 401, 401, 401, - 401, 401, 401, 402, 402, 0, 402, 0, 402, 0, - 0, 402, 403, 403, 0, 403, 0, 403, 0, 0, - 403, 404, 0, 404, 405, 405, 0, 405, 0, 405, - 0, 0, 405, 406, 0, 406, 407, 0, 0, 407, - 0, 407, 408, 0, 0, 408, 0, 408, 409, 409, - 0, 409, 0, 409, 0, 0, 409, 410, 410, 0, - 410, 0, 410, 0, 0, 410, 411, 0, 0, 411, - - 0, 411, 412, 0, 412, 413, 0, 0, 413, 0, - 413, 372, 372, 372, 372, 372, 372, 372, 372, 372, - 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, - 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, - 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, - 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, - 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, - 372, 372 - } ; - -static yy_state_type yy_last_accepting_state; -static char *yy_last_accepting_cpos; - -extern int debug_flex_debug; -int debug_flex_debug = 0; - -/* The intent behind this definition is that it'll catch - * any uses of REJECT which flex missed. - */ -#define REJECT reject_used_but_not_detected -#define yymore() yymore_used_but_not_detected -#define YY_MORE_ADJ 0 -#define YY_RESTORE_YY_MORE_OFFSET -char *debugtext; -#line 1 "debug.l" -/* - * Apple // emulator for Linux: Lexer for debugger - * - * Copyright 1994 Alexander Jean-Claude Bottema - * Copyright 1995 Stephen Lee - * Copyright 1997, 1998 Aaron Culliney - * Copyright 1998, 1999, 2000 Michael Deutschmann - * - * This software package is subject to the GNU General Public License - * version 2 or later (your choice) as published by the Free Software - * Foundation. - * - * THERE ARE NO WARRANTIES WHATSOEVER. - * - */ -/* ASSUMPTIONS: - * flex version 2.5.2 or later - * - */ -#line 24 "debug.l" - -/* process includes only the second time we parse this file. */ -#include "misc.h" -#include "interface.h" -#include "debug.h" -#include "disk.h" -#include "video.h" -#include "keys.h" -#include -#include -#include -#include "cpu.h" - - -YY_BUFFER_STATE buffer = 0; - -/* - d{is} {lc1|lc2} {/bank/}{addr} {+}{len} - m{em} {lc1|lc2} {/bank/}{addr} {+}{len} - a{scii} {lc1|lc2} {/bank/}{addr} {+}{len} - r{egs} - {lc1|lc2} : - bload - bsave // - (s{tep} | n{ext}) {len} - f{inish} - u{ntil} - g{o} {addr} - sea{rch} {lc1|lc2} - (b{reak} | w{atch}) {addr} - (b{reak} | w{atch}) {addr} - b{reak} op - (c{lear} | i{gnore}) {num} - c{lear} op - key - sta{tus} - l{ang} - dr{ive} - vm - fr{esh} - (? | h{elp}) -*/ - -#line 1086 "debug.c" - -#define INITIAL 0 - -#ifndef YY_NO_UNISTD_H -/* Special case for "unistd.h", since it is non-ANSI. We include it way - * down here because we want the user's section 1 to have been scanned first. - * The user has a chance to override it with an option. - */ -#include -#endif - -#ifndef YY_EXTRA_TYPE -#define YY_EXTRA_TYPE void * -#endif - -static int yy_init_globals (void ); - -/* Accessor methods to globals. - These are made visible to non-reentrant scanners for convenience. */ - -int debuglex_destroy (void ); - -int debugget_debug (void ); - -void debugset_debug (int debug_flag ); - -YY_EXTRA_TYPE debugget_extra (void ); - -void debugset_extra (YY_EXTRA_TYPE user_defined ); - -FILE *debugget_in (void ); - -void debugset_in (FILE * in_str ); - -FILE *debugget_out (void ); - -void debugset_out (FILE * out_str ); - -int debugget_leng (void ); - -char *debugget_text (void ); - -int debugget_lineno (void ); - -void debugset_lineno (int line_number ); - -/* Macros after this point can all be overridden by user definitions in - * section 1. - */ - -#ifndef YY_SKIP_YYWRAP -#ifdef __cplusplus -extern "C" int debugwrap (void ); -#else -extern int debugwrap (void ); -#endif -#endif - -// static void yyunput (int c,char *buf_ptr ); - -#ifndef yytext_ptr -static void yy_flex_strncpy (char *,yyconst char *,int ); -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * ); -#endif - -#ifndef YY_NO_INPUT - -#if 0 -#ifdef __cplusplus -static int yyinput (void ); -#else -static int input (void ); -#endif -#endif - -#endif - -/* Amount of stuff to slurp up with each read. */ -#ifndef YY_READ_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k */ -#define YY_READ_BUF_SIZE 16384 -#else -#define YY_READ_BUF_SIZE 8192 -#endif /* __ia64__ */ -#endif - -/* Copy whatever the last rule matched to the standard output. */ -#ifndef ECHO -/* This used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite(). - */ -#define ECHO do { if (fwrite( debugtext, debugleng, 1, debugout )) {} } while (0) -#endif - -/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, - * is returned in "result". - */ -#ifndef YY_INPUT -#define YY_INPUT(buf,result,max_size) \ - if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ - { \ - int c = '*'; \ - size_t n; \ - for ( n = 0; n < max_size && \ - (c = getc( debugin )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ) \ - buf[n++] = (char) c; \ - if ( c == EOF && ferror( debugin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - result = n; \ - } \ - else \ - { \ - errno=0; \ - while ( (result = fread(buf, 1, max_size, debugin))==0 && ferror(debugin)) \ - { \ - if( errno != EINTR) \ - { \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - break; \ - } \ - errno=0; \ - clearerr(debugin); \ - } \ - }\ -\ - -#endif - -/* No semi-colon after return; correct usage is to write "yyterminate();" - - * we don't want an extra ';' after the "return" because that will cause - * some compilers to complain about unreachable statements. - */ -#ifndef yyterminate -#define yyterminate() return YY_NULL -#endif - -/* Number of entries by which start-condition stack grows. */ -#ifndef YY_START_STACK_INCR -#define YY_START_STACK_INCR 25 -#endif - -/* Report a fatal error. */ -#ifndef YY_FATAL_ERROR -#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) -#endif - -/* end tables serialization structures and prototypes */ - -/* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ -#ifndef YY_DECL -#define YY_DECL_IS_OURS 1 - -extern int debuglex (void); - -#define YY_DECL int debuglex (void) -#endif /* !YY_DECL */ - -/* Code executed at the beginning of each rule, after debugtext and debugleng - * have been set up. - */ -#ifndef YY_USER_ACTION -#define YY_USER_ACTION -#endif - -/* Code executed at the end of each rule. */ -#ifndef YY_BREAK -#define YY_BREAK break; -#endif - -#define YY_RULE_SETUP \ - if ( debugleng > 0 ) \ - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ - (debugtext[debugleng - 1] == '\n'); \ - YY_USER_ACTION - -/** The main scanner function which does all the work. - */ -YY_DECL -{ - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; - -#line 80 "debug.l" - - - - -#line 1281 "debug.c" - - if ( !(yy_init) ) - { - (yy_init) = 1; - -#ifdef YY_USER_INIT - YY_USER_INIT; -#endif - - if ( ! (yy_start) ) - (yy_start) = 1; /* first start state */ - - if ( ! debugin ) - debugin = stdin; - - if ( ! debugout ) - debugout = stdout; - - if ( ! YY_CURRENT_BUFFER ) { - debugensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - debug_create_buffer(debugin,YY_BUF_SIZE ); - } - - debug_load_buffer_state( ); - } - - while ( 1 ) /* loops until end-of-file is reached */ - { - yy_cp = (yy_c_buf_p); - - /* Support of debugtext. */ - *yy_cp = (yy_hold_char); - - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; - - yy_current_state = (yy_start); - yy_current_state += YY_AT_BOL(); -yy_match: - do - { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 373 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 1812 ); - -yy_find_action: - yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - yy_act = yy_accept[yy_current_state]; - } - - YY_DO_BEFORE_ACTION; - -do_action: /* This label is used only to access EOF actions. */ - - switch ( yy_act ) - { /* beginning of action switch */ - case 0: /* must back up */ - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = (yy_hold_char); - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - goto yy_find_action; - -case 1: -/* rule 1 can match eol */ -YY_RULE_SETUP -#line 84 "debug.l" -{ - /* mem */ - int do_ascii = 0; - - if (tolower(debugtext[0]) == 'a') - do_ascii = 1; - while (!isspace(*debugtext)) ++debugtext; - - arg1 = strtol(debugtext, &debugtext, 16); - arg2 = strtol(debugtext, &debugtext, 16); - dump_mem(arg1, arg2, 0, do_ascii, -1); - return MEM; -} - YY_BREAK -case 2: -/* rule 2 can match eol */ -YY_RULE_SETUP -#line 98 "debug.l" -{ - /* mem // */ - int do_ascii = 0; - - if (tolower(debugtext[0]) == 'a') - do_ascii = 1; - while (*debugtext != '/') ++debugtext; - ++debugtext; /* after / */ - arg3 = strtol(debugtext, &debugtext, 10); - ++debugtext; /* after / */ - - arg1 = strtol(debugtext, &debugtext, 16); - arg2 = strtol(debugtext, &debugtext, 16); - dump_mem(arg1, arg2, 0, do_ascii, arg3); - return MEM; -} - YY_BREAK -case 3: -/* rule 3 can match eol */ -YY_RULE_SETUP -#line 115 "debug.l" -{ - /* mem */ - int do_ascii = 0; - - if (tolower(debugtext[0]) == 'a') - do_ascii = 1; - while (!isspace(*debugtext)) ++debugtext; - - arg1 = strtol(debugtext, &debugtext, 16); - dump_mem(arg1, 256, 0, do_ascii, -1); - return MEM; -} - YY_BREAK -case 4: -/* rule 4 can match eol */ -YY_RULE_SETUP -#line 128 "debug.l" -{ - /* mem // */ - int do_ascii = 0; - - if (tolower(debugtext[0]) == 'a') - do_ascii = 1; - while (*debugtext != '/') ++debugtext; - ++debugtext; /* after / */ - arg3 = strtol(debugtext, &debugtext, 10); - ++debugtext; /* after / */ - - arg1 = strtol(debugtext, &debugtext, 16); - dump_mem(arg1, 256, 0, do_ascii, arg3); - return MEM; -} - YY_BREAK -case 5: -/* rule 5 can match eol */ -YY_RULE_SETUP -#line 144 "debug.l" -{ - /* mem + */ - int do_ascii = 0; - - if (tolower(debugtext[0]) == 'a') - do_ascii = 1; - while (*debugtext != '+') ++debugtext; - ++debugtext; - - arg1 = strtol(debugtext, &debugtext, 16); - dump_mem(cpu65_current.pc, arg1, 0, do_ascii, -1); - return MEM; -} - YY_BREAK -case 6: -/* rule 6 can match eol */ -YY_RULE_SETUP -#line 158 "debug.l" -{ - /* dump mem from current location */ - int do_ascii = 0; - - if (tolower(debugtext[0]) == 'a') - do_ascii = 1; - dump_mem(cpu65_current.pc, 256, 0, do_ascii, -1); - return MEM; -} - YY_BREAK -case 7: -/* rule 7 can match eol */ -YY_RULE_SETUP -#line 168 "debug.l" -{ - /* dump mem from lc */ - int do_ascii = 0; - int lc; - - if (tolower(debugtext[0]) == 'a') - do_ascii = 1; - while (tolower(*debugtext) != 'l') ++debugtext; ++debugtext; - if (tolower(*debugtext) == 'c') ++debugtext; - - lc = strtol(debugtext, &debugtext, 10); - arg1 = strtol(debugtext, &debugtext, 16); - arg2 = strtol(debugtext, &debugtext, 16); - - dump_mem(arg1, arg2, lc, do_ascii, -1); - return MEM; -} - YY_BREAK -case 8: -/* rule 8 can match eol */ -YY_RULE_SETUP -#line 186 "debug.l" -{ - /* dump mem from lc // */ - int do_ascii = 0; - int lc; - - if (tolower(debugtext[0]) == 'a') - do_ascii = 1; - while (tolower(*debugtext) != 'l') ++debugtext; ++debugtext; - if (tolower(*debugtext) == 'c') ++debugtext; - lc = strtol(debugtext, &debugtext, 10); - - while (*debugtext != '/') ++debugtext; - ++debugtext; /* after / */ - arg3 = strtol(debugtext, &debugtext, 10); - ++debugtext; /* after / */ - arg1 = strtol(debugtext, &debugtext, 16); - arg2 = strtol(debugtext, &debugtext, 16); - - dump_mem(arg1, arg2, lc, do_ascii, arg3); - return MEM; -} - YY_BREAK -case 9: -/* rule 9 can match eol */ -YY_RULE_SETUP -#line 208 "debug.l" -{ - /* dump mem from lc */ - int do_ascii = 0; - int lc; - - if (tolower(debugtext[0]) == 'a') - do_ascii = 1; - while (tolower(*debugtext) != 'l') ++debugtext; ++debugtext; - if (tolower(*debugtext) == 'c') ++debugtext; - - lc = strtol(debugtext, &debugtext, 10); - arg1 = strtol(debugtext, &debugtext, 16); - - dump_mem(arg1, 256, lc, do_ascii, -1); - return MEM; -} - YY_BREAK -case 10: -/* rule 10 can match eol */ -YY_RULE_SETUP -#line 225 "debug.l" -{ - /* dump mem from lc // */ - int do_ascii = 0; - int lc; - - if (tolower(debugtext[0]) == 'a') - do_ascii = 1; - while (tolower(*debugtext) != 'l') ++debugtext; ++debugtext; - if (tolower(*debugtext) == 'c') ++debugtext; - lc = strtol(debugtext, &debugtext, 10); - - while (*debugtext != '/') ++debugtext; - ++debugtext; /* after / */ - arg3 = strtol(debugtext, &debugtext, 10); - ++debugtext; /* after / */ - arg1 = strtol(debugtext, &debugtext, 16); - - dump_mem(arg1, 256, lc, do_ascii, arg3); - return MEM; -} - YY_BREAK -case 11: -/* rule 11 can match eol */ -YY_RULE_SETUP -#line 246 "debug.l" -{ - /* disassemble at */ - while (!isspace(*debugtext)) ++debugtext; - - arg1 = strtol(debugtext, &debugtext, 16); - arg2 = strtol(debugtext, &debugtext, 16); - - disasm(arg1, arg2, 0, -1); - return DIS; -} - YY_BREAK -case 12: -/* rule 12 can match eol */ -YY_RULE_SETUP -#line 257 "debug.l" -{ - /* disassemble at // */ - while (*debugtext != '/') ++debugtext; - ++debugtext; /* after / */ - arg3 = strtol(debugtext, &debugtext, 10); - ++debugtext; /* after / */ - - arg1 = strtol(debugtext, &debugtext, 16); - arg2 = strtol(debugtext, &debugtext, 16); - - disasm(arg1, arg2, 0, arg3); - return DIS; -} - YY_BREAK -case 13: -/* rule 13 can match eol */ -YY_RULE_SETUP -#line 271 "debug.l" -{ - /* disassemble at */ - while (!isspace(*debugtext)) ++debugtext; - - arg1 = strtol(debugtext, &debugtext, 16); - arg2 = 256; - if ((arg1 < 0) || (arg1 > 65535)) arg1 = cpu65_current.pc; - - disasm(arg1, arg2, 0, -1); - return DIS; -} - YY_BREAK -case 14: -/* rule 14 can match eol */ -YY_RULE_SETUP -#line 283 "debug.l" -{ - /* disassemble at // */ - while (*debugtext != '/') ++debugtext; - ++debugtext; /* after / */ - arg3 = strtol(debugtext, &debugtext, 10); - ++debugtext; /* after / */ - - arg1 = strtol(debugtext, &debugtext, 16); - arg2 = 256; - if ((arg1 < 0) || (arg1 > 65535)) arg1 = cpu65_current.pc; - - disasm(arg1, arg2, 0, arg3); - return DIS; -} - YY_BREAK -case 15: -/* rule 15 can match eol */ -YY_RULE_SETUP -#line 298 "debug.l" -{ - /* disassemble current location + */ - while (*debugtext != '+') ++debugtext; - ++debugtext; - - arg1 = strtol(debugtext, &debugtext, 16); - disasm(cpu65_current.pc, arg1, 0, -1); - return DIS; -} - YY_BREAK -case 16: -/* rule 16 can match eol */ -YY_RULE_SETUP -#line 308 "debug.l" -{ - /* disassemble current location */ - disasm(cpu65_current.pc, 256, 0, -1); - return DIS; -} - YY_BREAK -case 17: -/* rule 17 can match eol */ -YY_RULE_SETUP -#line 314 "debug.l" -{ - /* disassemble language */ - int lc; - - while (tolower(*debugtext) != 'l') ++debugtext; ++debugtext; - if (tolower(*debugtext) == 'c') ++debugtext; - - lc = strtol(debugtext, &debugtext, 10); - arg1 = strtol(debugtext, &debugtext, 16); - arg2 = strtol(debugtext, &debugtext, 16); - - disasm(arg1, arg2, lc, -1); - return DIS; -} - YY_BREAK -case 18: -/* rule 18 can match eol */ -YY_RULE_SETUP -#line 329 "debug.l" -{ - /* disassemble language // */ - int lc; - - while (tolower(*debugtext) != 'l') ++debugtext; ++debugtext; - if (tolower(*debugtext) == 'c') ++debugtext; - lc = strtol(debugtext, &debugtext, 10); - - while (*debugtext != '/') ++debugtext; - ++debugtext; /* after / */ - arg3 = strtol(debugtext, &debugtext, 10); - ++debugtext; /* after / */ - - arg1 = strtol(debugtext, &debugtext, 16); - arg2 = strtol(debugtext, &debugtext, 16); - - disasm(arg1, arg2, lc, arg3); - return DIS; -} - YY_BREAK -case 19: -/* rule 19 can match eol */ -YY_RULE_SETUP -#line 349 "debug.l" -{ - /* disassemble language */ - int lc; - - while (tolower(*debugtext) != 'l') ++debugtext; ++debugtext; - if (tolower(*debugtext) == 'c') ++debugtext; - - lc = strtol(debugtext, &debugtext, 10); - arg1 = strtol(debugtext, &debugtext, 16); - - disasm(arg1, 256, lc, -1); - return DIS; -} - YY_BREAK -case 20: -/* rule 20 can match eol */ -YY_RULE_SETUP -#line 363 "debug.l" -{ - /* disassemble language // */ - int lc; - - while (tolower(*debugtext) != 'l') ++debugtext; ++debugtext; - if (tolower(*debugtext) == 'c') ++debugtext; - lc = strtol(debugtext, &debugtext, 10); - - while (*debugtext != '/') ++debugtext; - ++debugtext; /* after / */ - arg3 = strtol(debugtext, &debugtext, 10); - ++debugtext; /* after / */ - - arg1 = strtol(debugtext, &debugtext, 16); - - disasm(arg1, 256, lc, arg3); - return DIS; -} - YY_BREAK -case 21: -/* rule 21 can match eol */ -YY_RULE_SETUP -#line 382 "debug.l" -{ - /* show cpu state */ - show_regs(); - return REGS; -} - YY_BREAK -case 22: -/* rule 22 can match eol */ -YY_RULE_SETUP -#line 388 "debug.l" -{ - /* set memory : */ - arg1 = strtol(debugtext, &debugtext, 16); - - while (*debugtext != ':') ++debugtext; ++debugtext; - while (isspace(*debugtext)) ++debugtext; - - set_mem(arg1, debugtext); - return SETMEM; -} - YY_BREAK -case 23: -/* rule 23 can match eol */ -YY_RULE_SETUP -#line 399 "debug.l" -{ - /* set LC memory lc1|lc2 : */ - int lc; - - arg1 = strtol(debugtext, &debugtext, 16); - - while (tolower(*debugtext) != 'l') ++debugtext; ++debugtext; - if (tolower(*debugtext) == 'c') ++debugtext; - lc = strtol(debugtext, &debugtext, 10); - ++debugtext; while (isspace(*debugtext)) ++debugtext; - - set_lc_mem(arg1, lc, debugtext); - return SETMEM; -} - YY_BREAK -case 24: -/* rule 24 can match eol */ -YY_RULE_SETUP -#line 414 "debug.l" -{ - /* bload */ - FILE *fp = NULL; - char *ptr = NULL; - char name[128]; - int len = -1; - - while (!isspace(*debugtext)) ++debugtext; - while (isspace(*debugtext)) ++debugtext; - ptr = debugtext; - while (!isspace(*debugtext)) ++debugtext; - len = debugtext-ptr; - - /* filename */ - strncpy(name, ptr, len); - name[len] = '\0'; - - /* bload addr */ - while (isspace(*debugtext)) ++debugtext; - arg1 = strtol(debugtext, (char**)NULL, 16); - - fp = fopen(name, "r"); - if (fp == NULL) { - sprintf(second_buf[num_buffer_lines++], "problem: %s", name); - perror(name); - return BLOAD; - } - - bload(fp, name, arg1); - fclose(fp); - return BLOAD; -} - YY_BREAK -case 25: -/* rule 25 can match eol */ -YY_RULE_SETUP -#line 447 "debug.l" -{ - /* step / step next instruction */ - if (*debugtext == 'n') step_next = 1; - - do_step_or_next(1); - return STEP; -} - YY_BREAK -case 26: -/* rule 26 can match eol */ -YY_RULE_SETUP -#line 455 "debug.l" -{ - /* step / step next instructions */ - if (*debugtext == 'n') step_next = 1; - - while (!isspace(*debugtext)) ++debugtext; - - arg1 = strtol(debugtext, (char**)NULL, 16); - if ((arg1 < 1) || (arg1 > 255)) arg1 = 255; - - do_step_or_next(arg1); - return STEP; -} - YY_BREAK -case 27: -/* rule 27 can match eol */ -YY_RULE_SETUP -#line 468 "debug.l" -{ - int step_frame = 1; - unsigned char op; - - /* step until finished with curent stack frame */ - while ((c_mygetch(0) == -1) && !at_haltpt()) { - op = get_current_opcode(); - - if (op == 0x20) ++step_frame; /* JSR */ - if (op == 0x60) --step_frame; /* RTS */ - - if (!step_frame) break; /* finished */ - begin_cpu_step(); - } - end_cpu_step(); /* print location */ - return FINISH; -} - YY_BREAK -case 28: -/* rule 28 can match eol */ -YY_RULE_SETUP -#line 486 "debug.l" -{ - /* step until PC == next instruction. good for finishing backward - loops */ - unsigned char op; - int delta=0; - op = get_current_opcode(); - - switch (opcodes[op].mode) - { - case addr_implied: - case addr_accumulator: - delta = 1; - break; - case addr_immediate: - case addr_zeropage: - case addr_zeropage_x: - case addr_zeropage_y: - case addr_indirect: - case addr_indirect_x: - case addr_indirect_y: - case addr_relative: - delta = 2; - break; - case addr_absolute: - case addr_absolute_x: - case addr_absolute_y: - case addr_j_indirect: - case addr_j_indirect_x: - delta = 3; - break; - } - - arg1 = cpu65_current.pc + delta; - - while ((cpu65_current.pc != arg1) && !at_haltpt() && (c_mygetch(0) == -1)) - begin_cpu_step(); - end_cpu_step(); /* print location */ - return UNTIL; -} - YY_BREAK -case 29: -/* rule 29 can match eol */ -YY_RULE_SETUP -#line 526 "debug.l" -{ - /* jump to addrs and run while remaining in debugger console */ - while (!isspace(*debugtext)) ++debugtext; - - /* DANGEROUS! */ - cpu65_current.pc = strtol(debugtext, (char**)NULL, 16); - while (!at_haltpt() && (c_mygetch(0) == -1)) - begin_cpu_step(); - end_cpu_step(); /* print location */ - return GO; -} - YY_BREAK -case 30: -/* rule 30 can match eol */ -YY_RULE_SETUP -#line 538 "debug.l" -{ - /* run while remaining in debugger console */ - while (!at_haltpt() && (c_mygetch(0) == -1)) - begin_cpu_step(); - end_cpu_step(); /* print location */ - return GO; -} - YY_BREAK -case 31: -/* rule 31 can match eol */ -YY_RULE_SETUP -#line 546 "debug.l" -{ - /* set watchpoint */ - set_halt(watchpoints, cpu65_current.pc); - return WATCH; -} - YY_BREAK -case 32: -/* rule 32 can match eol */ -YY_RULE_SETUP -#line 552 "debug.l" -{ - /* set watchpoint */ - while (!isspace(*debugtext)) ++debugtext; - - arg1 = strtol(debugtext, (char**)NULL, 16); - if ((arg1 < 0) || (arg1 > 65535)) { - sprintf(second_buf[num_buffer_lines++], "invalid address"); - return WATCH; - } - - set_halt(watchpoints, arg1); - return WATCH; -} - YY_BREAK -case 33: -/* rule 33 can match eol */ -YY_RULE_SETUP -#line 567 "debug.l" -{ - /* set breakpoint */ - set_halt(breakpoints, cpu65_current.pc); - return BREAK; -} - YY_BREAK -case 34: -/* rule 34 can match eol */ -YY_RULE_SETUP -#line 573 "debug.l" -{ - /* set breakpoint */ - while (!isspace(*debugtext)) ++debugtext; - - arg1 = strtol(debugtext, (char**)NULL, 16); - if ((arg1 < 0) || (arg1 > 65535)) { - sprintf(second_buf[num_buffer_lines++], "invalid address"); - return BREAK; - } - - set_halt(breakpoints, arg1); - return BREAK; -} - YY_BREAK -case 35: -/* rule 35 can match eol */ -YY_RULE_SETUP -#line 587 "debug.l" -{ - /* set breakpoint */ - while (!(*debugtext == 'p')) ++debugtext; - ++debugtext; - - arg1 = strtol(debugtext, (char**)NULL, 16); - if ((arg1 < 0) || (arg1 > 0xFF)) { - sprintf(second_buf[num_buffer_lines++], "invalid opcode"); - return BREAK; - } - - set_halt_opcode((unsigned char)arg1); - return BREAK; -} - YY_BREAK -case 36: -/* rule 36 can match eol */ -YY_RULE_SETUP -#line 602 "debug.l" -{ - /* set opcode breakpoints on 65c02 instructions */ - set_halt_65c02(); - return BREAK; -} - YY_BREAK -case 37: -/* rule 37 can match eol */ -YY_RULE_SETUP -#line 608 "debug.l" -{ - /* ignore everything */ - clear_halt(watchpoints, 0); - sprintf(second_buf[num_buffer_lines++], "ignored all"); - return IGNORE; -} - YY_BREAK -case 38: -/* rule 38 can match eol */ -YY_RULE_SETUP -#line 615 "debug.l" -{ - /* ignore ... */ - - while (!isspace(*debugtext)) ++debugtext; - - while (*debugtext) { - arg1 = strtol(debugtext, &debugtext, 10); - if ((arg1 < 1) || (arg1 > MAX_BRKPTS)) { - sprintf(second_buf[num_buffer_lines++], "invalid watchpoint"); - return IGNORE; - } - clear_halt(watchpoints, arg1); - sprintf(second_buf[num_buffer_lines++], "ignored %d", arg1); - } - return IGNORE; -} - YY_BREAK -case 39: -/* rule 39 can match eol */ -YY_RULE_SETUP -#line 633 "debug.l" -{ - /* clear everything */ - clear_halt(breakpoints, 0); - sprintf(second_buf[num_buffer_lines++], "cleared all"); - return CLEAR; -} - YY_BREAK -case 40: -/* rule 40 can match eol */ -YY_RULE_SETUP -#line 640 "debug.l" -{ - /* clear ... */ - while (!isspace(*debugtext)) ++debugtext; - - while (*debugtext) { - arg1 = strtol(debugtext, &debugtext, 10); - if ((arg1 < 1) || (arg1 > MAX_BRKPTS)) { - sprintf(second_buf[num_buffer_lines++], "invalid breakpoint"); - return CLEAR; - } - clear_halt(breakpoints, arg1); - sprintf(second_buf[num_buffer_lines++], "cleared %d", arg1); - } - return CLEAR; -} - YY_BREAK -case 41: -/* rule 41 can match eol */ -YY_RULE_SETUP -#line 656 "debug.l" -{ - /* clear ... */ - while (!(*debugtext == 'p')) ++debugtext; - ++debugtext; - - while (*debugtext) { - arg1 = strtol(debugtext, &debugtext, 16); - if ((arg1 < 0) || (arg1 > 255)) { - sprintf(second_buf[num_buffer_lines++], "invalid opcode"); - return CLEAR; - } - clear_halt_opcode((unsigned char)arg1); - sprintf(second_buf[num_buffer_lines++], "cleared opcode %02X", - (unsigned char)arg1); - } - return CLEAR; -} - YY_BREAK -case 42: -/* rule 42 can match eol */ -YY_RULE_SETUP -#line 674 "debug.l" -{ - /* clear 65c02 ... */ - clear_halt_65c02(); - return CLEAR; -} - YY_BREAK -case 43: -/* rule 43 can match eol */ -YY_RULE_SETUP -#line 680 "debug.l" -{ - /* show breakpoints and watchpoints */ - show_breakpts(); - return STATUS; -} - YY_BREAK -case 44: -/* rule 44 can match eol */ -YY_RULE_SETUP -#line 686 "debug.l" -{ - /* show opcode breakpoints */ - show_opcode_breakpts(); - return OPCODES; -} - YY_BREAK -case 45: -/* rule 45 can match eol */ -YY_RULE_SETUP -#line 692 "debug.l" -{ - /* search main memory for */ - while (!isspace(*debugtext)) ++debugtext; - while (isspace(*debugtext)) ++debugtext; - - search_mem(debugtext, 0, -1); - - return SEARCH; -} - YY_BREAK -case 46: -/* rule 46 can match eol */ -YY_RULE_SETUP -#line 702 "debug.l" -{ - /* search memory for */ - while (*debugtext != '/') ++debugtext; - ++debugtext; /* after / */ - arg3 = strtol(debugtext, &debugtext, 10); - ++debugtext; /* after / */ - while (isspace(*debugtext)) ++debugtext; - - search_mem(debugtext, 0, arg3); - - return SEARCH; -} - YY_BREAK -case 47: -/* rule 47 can match eol */ -YY_RULE_SETUP -#line 715 "debug.l" -{ - /* search LC for */ - int lc; - - while (tolower(*debugtext) != 'l') ++debugtext; ++debugtext; - if (tolower(*debugtext) == 'c') ++debugtext; - lc = strtol(debugtext, &debugtext, 10); - - while (!isspace(*debugtext)) ++debugtext; - while (isspace(*debugtext)) ++debugtext; - - search_mem(debugtext, lc, -1); - - return SEARCH; -} - YY_BREAK -case 48: -/* rule 48 can match eol */ -YY_RULE_SETUP -#line 731 "debug.l" -{ - /* search LC memory for */ - int lc; - - while (tolower(*debugtext) != 'l') ++debugtext; ++debugtext; - if (tolower(*debugtext) == 'c') ++debugtext; - lc = strtol(debugtext, &debugtext, 10); - - while (*debugtext != '/') ++debugtext; - ++debugtext; /* after / */ - arg3 = strtol(debugtext, &debugtext, 10); - ++debugtext; /* after / */ - while (isspace(*debugtext)) ++debugtext; - - search_mem(debugtext, lc, arg3); - - return SEARCH; -} - YY_BREAK -case 49: -/* rule 49 can match eol */ -YY_RULE_SETUP -#line 750 "debug.l" -{ - /* send key code to emulator */ - unsigned char key; - - while (!isspace(*debugtext)) ++debugtext; - while (isspace(*debugtext)) ++debugtext; - key = (unsigned char) strtol(debugtext, &debugtext, 16); - - apple_ii_64k[0][0xC000] = key; - apple_ii_64k[1][0xC000] = key; -} - YY_BREAK -case 50: -/* rule 50 can match eol */ -YY_RULE_SETUP -#line 762 "debug.l" -{ - /* display language card settings */ - show_lc_info(); - return LC; -} - YY_BREAK -case 51: -/* rule 51 can match eol */ -YY_RULE_SETUP -#line 768 "debug.l" -{ - /* show disk settings */ - show_disk_info(); - return DRIVE; -} - YY_BREAK -case 52: -/* rule 52 can match eol */ -YY_RULE_SETUP -#line 774 "debug.l" -{ - /* show other VM softswitch settings */ - show_misc_info(); - return VM; -} - YY_BREAK -case 53: -/* rule 53 can match eol */ -YY_RULE_SETUP -#line 780 "debug.l" -{ - /* refresh the screen */ - clear_debugger_screen(); -} - YY_BREAK -case 54: -/* rule 54 can match eol */ -YY_RULE_SETUP -#line 785 "debug.l" -{ - display_help(); - return HELP; -} - YY_BREAK -case 55: -/* rule 55 can match eol */ -YY_RULE_SETUP -#line 790 "debug.l" -{ - /* bsave // */ - /* save memory dump to file */ - FILE *fp = NULL; - char *ptr = NULL; - int len, start, len2, bank; - - while (!isspace(*debugtext)) ++debugtext; - while (isspace(*debugtext)) ++debugtext; - - /* copy file name */ - ptr = debugtext; - while (!isspace(*debugtext)) ++debugtext; - len = debugtext - ptr; - strncpy(temp, ptr, len); - temp[len] = '\0'; - - /* get bank info */ - while (*debugtext != '/') ++debugtext; - ++debugtext; - bank = strtol(debugtext, &debugtext, 10); - ++debugtext; - - /* extract start and len */ - start = strtol(debugtext, &debugtext, 16); - len2 = strtol(debugtext, &debugtext, 16); - - fp = fopen(temp, "w"); /* try to open file for writing */ - if (fp == NULL) { - sprintf(second_buf[num_buffer_lines++], "problem: %s", temp); - perror(temp); - return BSAVE; - } - len = fwrite(apple_ii_64k[bank]+start, 1, len2, fp); - if (len < len2) { - sprintf(second_buf[num_buffer_lines++], "problem: %s", temp); - perror(temp); - fclose(fp); - return BSAVE; - } - - sprintf(second_buf[num_buffer_lines++], "bsaved: %s", temp); - fclose(fp); - return BSAVE; -} - YY_BREAK -case 56: -/* rule 56 can match eol */ -YY_RULE_SETUP -#line 836 "debug.l" -{ - /* log debugger output to file - not implemented */ - return LOG; -} - YY_BREAK -case 57: -/* rule 57 can match eol */ -YY_RULE_SETUP -#line 841 "debug.l" -{ - /* save apple2 state to a .img file - not implemented I'd like to - * be compatible with the applePC emulator's .img format. anyone - * have documentation on this? -ASC - **/ - return SAVE; -} - YY_BREAK -case 58: -/* rule 58 can match eol */ -YY_RULE_SETUP -#line 850 "debug.l" -/* ignore newlines */ - YY_BREAK -case 59: -YY_RULE_SETUP -#line 852 "debug.l" -/* ignore extraneous characters */ - YY_BREAK -case 60: -YY_RULE_SETUP -#line 855 "debug.l" -ECHO; - YY_BREAK -#line 2372 "debug.c" -case YY_STATE_EOF(INITIAL): - yyterminate(); - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = (yy_hold_char); - YY_RESTORE_YY_MORE_OFFSET - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed debugin at a new source and called - * debuglex(). If so, then we have to assure - * consistency between YY_CURRENT_BUFFER and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - YY_CURRENT_BUFFER_LVALUE->yy_input_file = debugin; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( ); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans( yy_current_state ); - - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++(yy_c_buf_p); - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { - yy_cp = (yy_c_buf_p); - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer( ) ) - { - case EOB_ACT_END_OF_FILE: - { - (yy_did_buffer_switch_on_eof) = 0; - - if ( debugwrap( ) ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * debugtext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! (yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = - (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( ); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - (yy_c_buf_p) = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; - - yy_current_state = yy_get_previous_state( ); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ -} /* end of debuglex */ - -/* yy_get_next_buffer - try to read in a new buffer - * - * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file - */ -static int yy_get_next_buffer (void) -{ - register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - register char *source = (yytext_ptr); - register int number_to_move, i; - int ret_val; - - if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) - { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; - - else - { - int num_to_read = - YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ - - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER; - - int yy_c_buf_p_offset = - (int) ((yy_c_buf_p) - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) - { - int new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; - - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - debugrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; - - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); - - (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; - - num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - - number_to_move - 1; - - } - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - (yy_n_chars), (size_t) num_to_read ); - - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - if ( (yy_n_chars) == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - debugrestart(debugin ); - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { - /* Extend the array by 50%, plus the number we really need. */ - yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) debugrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); - if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); - } - - (yy_n_chars) += number_to_move; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; - - (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; - - return ret_val; -} - -/* yy_get_previous_state - get the state just before the EOB char was reached */ - - static yy_state_type yy_get_previous_state (void) -{ - register yy_state_type yy_current_state; - register char *yy_cp; - - yy_current_state = (yy_start); - yy_current_state += YY_AT_BOL(); - - for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) - { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 60); - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 373 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - } - - return yy_current_state; -} - -/* yy_try_NUL_trans - try to make a transition on the NUL character - * - * synopsis - * next_state = yy_try_NUL_trans( current_state ); - */ - static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) -{ - register int yy_is_jam; - register char *yy_cp = (yy_c_buf_p); - - register YY_CHAR yy_c = 60; - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 373 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 372); - - return yy_is_jam ? 0 : yy_current_state; -} - -#if 0 - static void yyunput (int c, register char * yy_bp ) -{ - register char *yy_cp; - - yy_cp = (yy_c_buf_p); - - /* undo effects of setting up debugtext */ - *yy_cp = (yy_hold_char); - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register int number_to_move = (yy_n_chars) + 2; - register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - register char *source = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; - - while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - - (yytext_ptr) = yy_bp; - (yy_hold_char) = *yy_cp; - (yy_c_buf_p) = yy_cp; -} - -#ifndef YY_NO_INPUT -#ifdef __cplusplus - static int yyinput (void) -#else - static int input (void) -#endif - -{ - int c; - - *(yy_c_buf_p) = (yy_hold_char); - - if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) - /* This was really a NUL. */ - *(yy_c_buf_p) = '\0'; - - else - { /* need more input */ - int offset = (yy_c_buf_p) - (yytext_ptr); - ++(yy_c_buf_p); - - switch ( yy_get_next_buffer( ) ) - { - case EOB_ACT_LAST_MATCH: - /* This happens because yy_g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ - - /* Reset buffer status. */ - debugrestart(debugin ); - - /*FALLTHROUGH*/ - - case EOB_ACT_END_OF_FILE: - { - if ( debugwrap( ) ) - return EOF; - - if ( ! (yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; -#ifdef __cplusplus - return yyinput(); -#else - return input(); -#endif - } - - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = (yytext_ptr) + offset; - break; - } - } - } - - c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ - *(yy_c_buf_p) = '\0'; /* preserve debugtext */ - (yy_hold_char) = *++(yy_c_buf_p); - - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); - - return c; -} -#endif /* ifndef YY_NO_INPUT */ -#endif - -/** Immediately switch to a different input stream. - * @param input_file A readable stream. - * - * @note This function does not reset the start condition to @c INITIAL . - */ - void debugrestart (FILE * input_file ) -{ - - if ( ! YY_CURRENT_BUFFER ){ - debugensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - debug_create_buffer(debugin,YY_BUF_SIZE ); - } - - debug_init_buffer(YY_CURRENT_BUFFER,input_file ); - debug_load_buffer_state( ); -} - -/** Switch to a different input buffer. - * @param new_buffer The new input buffer. - * - */ - void debug_switch_to_buffer (YY_BUFFER_STATE new_buffer ) -{ - - /* TODO. We should be able to replace this entire function body - * with - * debugpop_buffer_state(); - * debugpush_buffer_state(new_buffer); - */ - debugensure_buffer_stack (); - if ( YY_CURRENT_BUFFER == new_buffer ) - return; - - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - YY_CURRENT_BUFFER_LVALUE = new_buffer; - debug_load_buffer_state( ); - - /* We don't actually know whether we did this switch during - * EOF (debugwrap()) processing, but the only time this flag - * is looked at is after debugwrap() is called, so it's safe - * to go ahead and always set it. - */ - (yy_did_buffer_switch_on_eof) = 1; -} - -static void debug_load_buffer_state (void) -{ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; - debugin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; - (yy_hold_char) = *(yy_c_buf_p); -} - -/** Allocate and initialize an input buffer state. - * @param file A readable stream. - * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. - * - * @return the allocated buffer state. - */ - YY_BUFFER_STATE debug_create_buffer (FILE * file, int size ) -{ - YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) debugalloc(sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in debug_create_buffer()" ); - - b->yy_buf_size = size; - - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) debugalloc(b->yy_buf_size + 2 ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in debug_create_buffer()" ); - - b->yy_is_our_buffer = 1; - - debug_init_buffer(b,file ); - - return b; -} - -/** Destroy the buffer. - * @param b a buffer created with debug_create_buffer() - * - */ - void debug_delete_buffer (YY_BUFFER_STATE b ) -{ - - if ( ! b ) - return; - - if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ - YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; - - if ( b->yy_is_our_buffer ) - debugfree((void *) b->yy_ch_buf ); - - debugfree((void *) b ); -} - -#ifndef __cplusplus -extern int isatty (int ); -#endif /* __cplusplus */ - -/* Initializes or reinitializes a buffer. - * This function is sometimes called more than once on the same buffer, - * such as during a debugrestart() or at EOF. - */ - static void debug_init_buffer (YY_BUFFER_STATE b, FILE * file ) - -{ - int oerrno = errno; - - debug_flush_buffer(b ); - - b->yy_input_file = file; - b->yy_fill_buffer = 1; - - /* If b is the current buffer, then debug_init_buffer was _probably_ - * called from debugrestart() or through yy_get_next_buffer. - * In that case, we don't want to reset the lineno or column. - */ - if (b != YY_CURRENT_BUFFER){ - b->yy_bs_lineno = 1; - b->yy_bs_column = 0; - } - - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; - - errno = oerrno; -} - -/** Discard all buffered characters. On the next scan, YY_INPUT will be called. - * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. - * - */ - void debug_flush_buffer (YY_BUFFER_STATE b ) -{ - if ( ! b ) - return; - - b->yy_n_chars = 0; - - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - - b->yy_buf_pos = &b->yy_ch_buf[0]; - - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; - - if ( b == YY_CURRENT_BUFFER ) - debug_load_buffer_state( ); -} - -/** Pushes the new state onto the stack. The new state becomes - * the current state. This function will allocate the stack - * if necessary. - * @param new_buffer The new state. - * - */ -void debugpush_buffer_state (YY_BUFFER_STATE new_buffer ) -{ - if (new_buffer == NULL) - return; - - debugensure_buffer_stack(); - - /* This block is copied from debug_switch_to_buffer. */ - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - /* Only push if top exists. Otherwise, replace top. */ - if (YY_CURRENT_BUFFER) - (yy_buffer_stack_top)++; - YY_CURRENT_BUFFER_LVALUE = new_buffer; - - /* copied from debug_switch_to_buffer. */ - debug_load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; -} - -/** Removes and deletes the top of the stack, if present. - * The next element becomes the new top. - * - */ -void debugpop_buffer_state (void) -{ - if (!YY_CURRENT_BUFFER) - return; - - debug_delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - if ((yy_buffer_stack_top) > 0) - --(yy_buffer_stack_top); - - if (YY_CURRENT_BUFFER) { - debug_load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; - } -} - -/* Allocates the stack if it does not exist. - * Guarantees space for at least one push. - */ -static void debugensure_buffer_stack (void) -{ - int num_to_alloc; - - if (!(yy_buffer_stack)) { - - /* First allocation is just for 2 elements, since we don't know if this - * scanner will even need a stack. We use 2 instead of 1 to avoid an - * immediate realloc on the next call. - */ - num_to_alloc = 1; - (yy_buffer_stack) = (struct yy_buffer_state**)debugalloc - (num_to_alloc * sizeof(struct yy_buffer_state*) - ); - if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in debugensure_buffer_stack()" ); - - memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - - (yy_buffer_stack_max) = num_to_alloc; - (yy_buffer_stack_top) = 0; - return; - } - - if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ - - /* Increase the buffer to prepare for a possible push. */ - int grow_size = 8 /* arbitrary grow size */; - - num_to_alloc = (yy_buffer_stack_max) + grow_size; - (yy_buffer_stack) = (struct yy_buffer_state**)debugrealloc - ((yy_buffer_stack), - num_to_alloc * sizeof(struct yy_buffer_state*) - ); - if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in debugensure_buffer_stack()" ); - - /* zero only the new slots.*/ - memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); - (yy_buffer_stack_max) = num_to_alloc; - } -} - -/** Setup the input buffer state to scan directly from a user-specified character buffer. - * @param base the character buffer - * @param size the size in bytes of the character buffer - * - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE debug_scan_buffer (char * base, yy_size_t size ) -{ - YY_BUFFER_STATE b; - - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return 0; - - b = (YY_BUFFER_STATE) debugalloc(sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in debug_scan_buffer()" ); - - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = 0; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; - - debug_switch_to_buffer(b ); - - return b; -} - -/** Setup the input buffer state to scan a string. The next call to debuglex() will - * scan from a @e copy of @a str. - * @param yystr a NUL-terminated string to scan - * - * @return the newly allocated buffer state object. - * @note If you want to scan bytes that may contain NUL values, then use - * debug_scan_bytes() instead. - */ -YY_BUFFER_STATE debug_scan_string (yyconst char * yystr ) -{ - - return debug_scan_bytes(yystr,strlen(yystr) ); -} - -/** Setup the input buffer state to scan the given bytes. The next call to debuglex() will - * scan from a @e copy of @a bytes. - * @param yybytes the byte buffer to scan - * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. - * - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE debug_scan_bytes (yyconst char * yybytes, int _yybytes_len ) -{ - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - int i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; - buf = (char *) debugalloc(n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in debug_scan_bytes()" ); - - for ( i = 0; i < _yybytes_len; ++i ) - buf[i] = yybytes[i]; - - buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - - b = debug_scan_buffer(buf,n ); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in debug_scan_bytes()" ); - - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; - - return b; -} - -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 -#endif - -static void yy_fatal_error (yyconst char* msg ) -{ - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); -} - -/* Redefine yyless() so it works in section 3 code. */ - -#undef yyless -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up debugtext. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ - debugtext[debugleng] = (yy_hold_char); \ - (yy_c_buf_p) = debugtext + yyless_macro_arg; \ - (yy_hold_char) = *(yy_c_buf_p); \ - *(yy_c_buf_p) = '\0'; \ - debugleng = yyless_macro_arg; \ - } \ - while ( 0 ) - -/* Accessor methods (get/set functions) to struct members. */ - -/** Get the current line number. - * - */ -int debugget_lineno (void) -{ - - return debuglineno; -} - -/** Get the input stream. - * - */ -FILE *debugget_in (void) -{ - return debugin; -} - -/** Get the output stream. - * - */ -FILE *debugget_out (void) -{ - return debugout; -} - -/** Get the length of the current token. - * - */ -int debugget_leng (void) -{ - return debugleng; -} - -/** Get the current token. - * - */ - -char *debugget_text (void) -{ - return debugtext; -} - -/** Set the current line number. - * @param line_number - * - */ -void debugset_lineno (int line_number ) -{ - - debuglineno = line_number; -} - -/** Set the input stream. This does not discard the current - * input buffer. - * @param in_str A readable stream. - * - * @see debug_switch_to_buffer - */ -void debugset_in (FILE * in_str ) -{ - debugin = in_str ; -} - -void debugset_out (FILE * out_str ) -{ - debugout = out_str ; -} - -int debugget_debug (void) -{ - return debug_flex_debug; -} - -void debugset_debug (int bdebug ) -{ - debug_flex_debug = bdebug ; -} - -static int yy_init_globals (void) -{ - /* Initialization is the same as for the non-reentrant scanner. - * This function is called from debuglex_destroy(), so don't allocate here. - */ - - (yy_buffer_stack) = 0; - (yy_buffer_stack_top) = 0; - (yy_buffer_stack_max) = 0; - (yy_c_buf_p) = (char *) 0; - (yy_init) = 0; - (yy_start) = 0; - -/* Defined in main.c */ -#ifdef YY_STDINIT - debugin = stdin; - debugout = stdout; -#else - debugin = (FILE *) 0; - debugout = (FILE *) 0; -#endif - - /* For future reference: Set errno on error, since we are called by - * debuglex_init() - */ - return 0; -} - -/* debuglex_destroy is for both reentrant and non-reentrant scanners. */ -int debuglex_destroy (void) -{ - - /* Pop the buffer stack, destroying each element. */ - while(YY_CURRENT_BUFFER){ - debug_delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - debugpop_buffer_state(); - } - - /* Destroy the stack itself. */ - debugfree((yy_buffer_stack) ); - (yy_buffer_stack) = NULL; - - /* Reset the globals. This is important in a non-reentrant scanner so the next time - * debuglex() is called, initialization will occur. */ - yy_init_globals( ); - - return 0; -} - -/* - * Internal utility routines. - */ - -#ifndef yytext_ptr -static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) -{ - register int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; -} -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * s ) -{ - register int n; - for ( n = 0; s[n]; ++n ) - ; - - return n; -} -#endif - -void *debugalloc (yy_size_t size ) -{ - return (void *) malloc( size ); -} - -void *debugrealloc (void * ptr, yy_size_t size ) -{ - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void *) realloc( (char *) ptr, size ); -} - -void debugfree (void * ptr ) -{ - free( (char *) ptr ); /* see debugrealloc() for (char *) cast */ -} - -#define YYTABLES_NAME "yytables" - -#line 855 "debug.l" - - - - -int debugwrap () { - return 1; -} - -/* initialize the buffer - needed each time through */ -void init_lex (char *str, int size) { - if (buffer) debug_delete_buffer(buffer); - buffer = debug_scan_buffer(str,size); - - if (!buffer) { /* oops */ - video_shutdown(); - printf("lex buffer not big enough\n"); - exit(1); - } -} - - diff --git a/src/disk.c b/src/disk.c index 27a792d8..a3aad85a 100644 --- a/src/disk.c +++ b/src/disk.c @@ -14,17 +14,7 @@ * */ -#include "disk.h" -#include "misc.h" -#include "cpu.h" -#include "glue.h" -#include "prefs.h" -#include "keys.h" -#include "interface.h" #include "common.h" -#include "zlib-helpers.h" - -#include #define PHASE_BYTES 3328 diff --git a/src/genfont.c b/src/genfont.c index 4bd0f05f..8a35b114 100644 --- a/src/genfont.c +++ b/src/genfont.c @@ -104,8 +104,7 @@ int main(void) { printf("0x%02x, ",byte); } - else - if (i) + else if (i) { printf("0x%02x,\n ",byte); /* last byte in glyph */ } diff --git a/src/interface.c b/src/interface.c index 2d7bbaf5..98cc61e5 100644 --- a/src/interface.c +++ b/src/interface.c @@ -14,19 +14,7 @@ * */ -#include "interface.h" -#include "timing.h" -#include "keys.h" -#include "disk.h" -#include "misc.h" -#include "video.h" -#include "cpu.h" -#include "prefs.h" -#include "joystick.h" #include "common.h" -#include "zlib-helpers.h" - -#include static struct stat statbuf; static int altdrive; diff --git a/src/joystick.c b/src/joystick.c index f9f7d2a5..2259d60d 100644 --- a/src/joystick.c +++ b/src/joystick.c @@ -14,24 +14,12 @@ * */ -#ifdef PC_JOYSTICK +#include "common.h" + +#ifdef LINUX_JOYSTICK #include #endif -#include -#include -#include -#include -#include -#include - -#include "joystick.h" -#include "interface.h" -#include "video.h" -#include "keys.h" -#include "misc.h" -#include "prefs.h" - /* parameters for generic and keyboard-simulated joysticks */ short joy_x = HALF_JOY_RANGE; short joy_y = HALF_JOY_RANGE; @@ -44,7 +32,7 @@ short joy_step = 1; uint8_t auto_recenter = 0; #endif -#ifdef PC_JOYSTICK +#ifdef LINUX_JOYSTICK int js_center_x; int js_center_y; int js_max_x; @@ -329,7 +317,7 @@ static void c_calibrate_pc_joystick() nanosleep(&ts, NULL); } } -#endif // PC_JOYSTICK +#endif // LINUX_JOYSTICK #ifdef KEYPAD_JOYSTICK static void c_calibrate_keypad_joystick() @@ -438,7 +426,7 @@ static void c_calibrate_keypad_joystick() nanosleep(&ts, NULL); } } -#endif +#endif // KEYPAD_JOYSTICK #ifdef TOUCH_JOYSTICK // TBD ... @@ -448,7 +436,7 @@ static void c_calibrate_keypad_joystick() void c_open_joystick() { -#ifdef PC_JOYSTICK +#ifdef LINUX_JOYSTICK if (joy_mode == JOY_PCJOY) { c_open_pc_joystick(); @@ -465,7 +453,7 @@ void c_open_joystick() void c_close_joystick() { -#ifdef PC_JOYSTICK +#ifdef LINUX_JOYSTICK c_close_pc_joystick(); #endif @@ -479,7 +467,7 @@ void c_close_joystick() void c_calibrate_joystick() { -#ifdef PC_JOYSTICK +#ifdef LINUX_JOYSTICK if (joy_mode == JOY_PCJOY) { c_calibrate_pc_joystick(); diff --git a/src/keys.c b/src/keys.c index 5ddc063a..7edd31a4 100644 --- a/src/keys.c +++ b/src/keys.c @@ -14,20 +14,7 @@ * */ -#ifdef __linux__ -#include -#endif - #include "common.h" -#include "keys.h" -#include "misc.h" -#include "video.h" -#include "interface.h" -#include "cpu.h" -#include "prefs.h" -#include "timing.h" -#include "soundcore.h" -#include "joystick.h" /* from misc.c */ extern uid_t user, privileged; @@ -44,7 +31,7 @@ extern unsigned char joy_button1; /* mutex used to synchronize between cpu and main threads */ pthread_mutex_t interface_mutex = PTHREAD_MUTEX_INITIALIZER; -#ifdef PC_JOYSTICK +#ifdef LINUX_JOYSTICK #include extern int raw_js_x; extern int raw_js_y; @@ -378,7 +365,7 @@ void c_handle_input(int scancode, int pressed) } #endif -#if defined(PC_JOYSTICK) +#if defined(LINUX_JOYSTICK) else if ((joy_mode == JOY_PCJOY) && !(js_fd < 0)) { if (read(js_fd, &js, JS_RETURN) == -1) diff --git a/src/keys.h b/src/keys.h index d1aca7a8..dc970c10 100644 --- a/src/keys.h +++ b/src/keys.h @@ -139,7 +139,7 @@ extern pthread_mutex_t interface_mutex; extern bool caps_lock; -#ifdef PC_JOYSTICK +#ifdef LINUX_JOYSTICK extern int js_fd; extern struct JS_DATA_TYPE js; extern int js_offset_x, js_offset_y; diff --git a/src/debug.h b/src/meta/debug.h similarity index 100% rename from src/debug.h rename to src/meta/debug.h diff --git a/src/debug.l b/src/meta/debug.l similarity index 99% rename from src/debug.l rename to src/meta/debug.l index 3295284c..89583a92 100644 --- a/src/debug.l +++ b/src/meta/debug.l @@ -22,17 +22,9 @@ %{ /* process includes only the second time we parse this file. */ -#include "misc.h" -#include "interface.h" -#include "debug.h" -#include "disk.h" -#include "video.h" -#include "keys.h" -#include -#include -#include -#include "cpu.h" +#include "common.h" +#define debugtext yytext YY_BUFFER_STATE buffer = 0; diff --git a/src/debugger.c b/src/meta/debugger.c similarity index 99% rename from src/debugger.c rename to src/meta/debugger.c index 17a439f3..99aab412 100644 --- a/src/debugger.c +++ b/src/meta/debugger.c @@ -14,14 +14,7 @@ * */ -#include "debug.h" -#include "misc.h" -#include "keys.h" -#include "video.h" -#include "disk.h" -#include "interface.h" -#include "cpu.h" -#include "prefs.h" +#include "common.h" const struct opcode_struct *opcodes; @@ -68,7 +61,7 @@ unsigned char current_opcode; int op_breakpoints[256]; /* opcode breakpoints */ /* in debug.l */ -extern int debuglex(); /* yylex() */ +extern int yylex(); extern void init_lex(char *buf, int size); /* ------------------------------------------------------------------------- @@ -1186,7 +1179,7 @@ void do_debug_command() { /* call lex to perform the command.*/ strncpy(lexbuf, command_line + PROMPT_X, BUF_X); init_lex(lexbuf, BUF_X+2); - debuglex(); + yylex(); /* set up to copy results into main buffer */ if (num_buffer_lines >= PROMPT_Y) diff --git a/src/opcodes.c b/src/meta/opcodes.c similarity index 99% rename from src/opcodes.c rename to src/meta/opcodes.c index 254db95d..8417a273 100644 --- a/src/opcodes.c +++ b/src/meta/opcodes.c @@ -14,7 +14,7 @@ * */ -#include "debug.h" +#include "common.h" const char * const disasm_templates[15] = { diff --git a/src/misc.c b/src/misc.c index 19cc34ea..480fa0b3 100644 --- a/src/misc.c +++ b/src/misc.c @@ -14,29 +14,7 @@ * */ -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "misc.h" -#include "video.h" -#include "disk.h" -#include "interface.h" -#include "keys.h" -#include "debug.h" -#include "cpu.h" -#include "glue.h" -#include "prefs.h" -#include "timing.h" -#include "speaker.h" -#include "soundcore.h" -#include "mockingboard.h" +#include "common.h" /* ---------------------------------- internal apple2 variables @@ -519,7 +497,9 @@ void c_initialize_tables() { // HACK TODO FIXME : this needs to be tied to the UI/configuration system (once we have more/conflicting options) +#ifdef AUDIO_ENABLED mb_io_initialize(4, 5); /* Mockingboard(s) and/or Phasor in slots 4 & 5 */ +#endif disk_io_initialize(6); /* Put a Disk ][ Controller in slot 6 */ } @@ -643,10 +623,16 @@ void c_initialize_apple_ii_memory() void c_initialize_sound_hooks() { +#ifdef AUDIO_ENABLED SpkrSetVolume(sound_volume * (SPKR_DATA_INIT/10)); +#endif for (int i = 0xC030; i < 0xC040; i++) { - cpu65_vmem[i].r = cpu65_vmem[i].w = (sound_volume > 0) ? read_speaker_toggle_pc : ram_nop; + cpu65_vmem[i].r = cpu65_vmem[i].w = +#ifdef AUDIO_ENABLED + (sound_volume > 0) ? read_speaker_toggle_pc : +#endif + ram_nop; } } @@ -708,6 +694,7 @@ void reinitialize(void) { int i; +#ifdef DEBUGGER /* reset the watchpoints and breakpoints */ for (i=0; i -#include - #define SW_TEXT 0xC050 #define SW_MIXED 0xC052 #define SW_PAGE2 0xC054 diff --git a/src/prefs.c b/src/prefs.c index ac35f348..c4f16228 100644 --- a/src/prefs.c +++ b/src/prefs.c @@ -16,18 +16,7 @@ #define _GNU_SOURCE -#include -#include -#include -#include - -#include "misc.h" -#include "prefs.h" -#include "keys.h" -#include "interface.h" -#include "timing.h" -#include "cpu.h" -#include "joystick.h" +#include "common.h" #define PRM_NONE 0 #define PRM_SPEED 1 @@ -46,7 +35,7 @@ char system_path[SYSSIZE]; char disk_path[DISKSIZE]; -int apple_mode; +int apple_mode = IIE_MODE; int sound_volume; color_mode_t color_mode; a2_video_mode_t a2_video_mode; @@ -133,10 +122,10 @@ static const struct match_table joy_input_table[] = { "joy keypad", JOY_KPAD }, { "joy_keypad", JOY_KPAD }, #endif -#ifdef PC_JOYSTICK +#ifdef LINUX_JOYSTICK { "pc joystick", JOY_PCJOY }, { "pc_joystick", JOY_PCJOY }, -#endif /* PC_JOYSTICK */ +#endif /* LINUX_JOYSTICK */ { 0, JOY_OFF } }; @@ -273,10 +262,6 @@ void load_settings(void) break; } - case PRM_MODE: - apple_mode = match(modes_table, argument); - break; - case PRM_DISK_PATH: strncpy(disk_path, argument, DISKSIZE); break; @@ -298,7 +283,7 @@ void load_settings(void) break; case PRM_JOY_PC_CALIBRATE: -#ifdef PC_JOYSTICK +#ifdef LINUX_JOYSTICK /* pc joystick parms generated by the calibration routine (shouldn't need to hand tweak these) = origin_x origin_y max_x min_x max_y min_y */ @@ -400,7 +385,6 @@ bool save_settings(void) int err = fprintf(config_file, "speed = %0.2lf\n" "altspeed = %0.2lf\n" - "mode = %s\n" "disk path = %s\n" "color = %s\n" "video = %s\n" @@ -409,7 +393,6 @@ bool save_settings(void) "system path = %s\n", cpu_scale_factor, cpu_altscale_factor, - reverse_match(modes_table, apple_mode), disk_path, reverse_match(color_table, color_mode), reverse_match(video_table, a2_video_mode), @@ -418,7 +401,7 @@ bool save_settings(void) system_path); anErr = anErr || (err < 0); -#ifdef PC_JOYSTICK +#ifdef LINUX_JOYSTICK err = fprintf(config_file, "pc joystick parms = %d %d %d %d %d %d\n", js_center_x, js_center_y, js_max_x, js_min_x, diff --git a/src/prefs.h b/src/prefs.h index 64793c37..b5d7097a 100644 --- a/src/prefs.h +++ b/src/prefs.h @@ -17,8 +17,6 @@ #ifndef PREFS_H #define PREFS_H -#include "common.h" - #ifndef __ASSEMBLER__ typedef enum joystick_mode_t { @@ -26,7 +24,7 @@ typedef enum joystick_mode_t { #ifdef KEYPAD_JOYSTICK JOY_KPAD, #endif -#ifdef PC_JOYSTICK +#ifdef LINUX_JOYSTICK JOY_PCJOY, #endif NUM_JOYOPTS @@ -66,7 +64,7 @@ extern short joy_step; extern uint8_t auto_recenter; #endif -#ifdef PC_JOYSTICK +#ifdef LINUX_JOYSTICK /* real joystick settings */ extern int js_center_x; extern int js_center_y; @@ -74,7 +72,7 @@ extern int js_max_x; extern int js_max_y; extern int js_min_x; extern int js_min_y; -#endif /* PC_JOYSTICK */ +#endif /* LINUX_JOYSTICK */ /* functions in prefs.c */ extern void load_settings(void); diff --git a/src/timing.c b/src/timing.c index 0ad8c535..60842a7b 100644 --- a/src/timing.c +++ b/src/timing.c @@ -16,12 +16,7 @@ * */ -#include "timing.h" -#include "misc.h" -#include "cpu.h" -#include "speaker.h" -#include "keys.h" -#include "mockingboard.h" +#include "common.h" #define EXECUTION_PERIOD_NSECS 1000000 // AppleWin: nExecutionPeriodUsec @@ -209,7 +204,9 @@ void cpu_thread(void *dummyptr) { cpu65_cycle_count = 0; g_nCyclesExecuted = 0; +#ifdef AUDIO_ENABLED MB_StartOfCpuExecute(); +#endif cpu65_run(); // run emulation for cpu65_cycles_to_execute cycles ... @@ -223,6 +220,7 @@ void cpu_thread(void *dummyptr) { #endif unsigned int uExecutedCycles = cpu65_cycle_count; +#ifdef AUDIO_ENABLED MB_UpdateCycles(uExecutedCycles); // Update 6522s (NB. Do this before updating g_nCumulativeCycles below) // N.B.: IO calls that depend on accurate timing will update g_nCyclesExecuted @@ -236,6 +234,7 @@ void cpu_thread(void *dummyptr) { // N.B.: technically this is not the end of the video frame... MB_EndOfVideoFrame(); +#endif clock_gettime(CLOCK_MONOTONIC, &tj); pthread_mutex_unlock(&interface_mutex); diff --git a/src/video.h b/src/video/video.h similarity index 100% rename from src/video.h rename to src/video/video.h diff --git a/src/xvideo.c b/src/video/xvideo.c similarity index 97% rename from src/xvideo.c rename to src/video/xvideo.c index 2b312175..c954c6cf 100644 --- a/src/xvideo.c +++ b/src/video/xvideo.c @@ -14,26 +14,18 @@ * */ -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "common.h" #include #include #include #include + +#ifdef HAVE_X11_SHM +#include +#include #include /* MITSHM! */ - - -#include "video.h" -#include "misc.h" -#include "keys.h" +#endif static unsigned char vga_mem_page_0[SCANWIDTH*SCANHEIGHT]; /* page0 framebuffer */ static unsigned char vga_mem_page_1[SCANWIDTH*SCANHEIGHT]; /* page1 framebuffer */ @@ -61,9 +53,11 @@ static uint32_t green_shift; static uint32_t blue_shift; static uint32_t alpha_shift; +#ifdef HAVE_X11_SHM static int doShm = 1; /* assume true */ static XShmSegmentInfo xshminfo; static int xshmeventtype; +#endif // pad pixels to uint32_t boundaries static int bitmap_pad = sizeof(uint32_t); @@ -84,6 +78,7 @@ void video_setpage(int p) video__current_page = p; } +#ifdef HAVE_X11_SHM /* * XShm code influenced from the DOOM source code. * This tries to find some shared memory to use. It checks for stale segments @@ -202,7 +197,7 @@ static void getshm(int size) { printf("Using shared memory key=`%c%c%c%c', id=%d, addr=%p\n", (key & 0xff000000)>>24, (key & 0xff0000)>>16, (key & 0xff00)>>8, (key & 0xff), id, image->data); } - +#endif static void c_initialize_colors() { static unsigned char col2[ 3 ] = { 255,255,255 }; @@ -500,6 +495,7 @@ static void post_image() { } // post image... +#ifdef HAVE_X11_SHM if (doShm) { if (!XShmPutImage( @@ -514,8 +510,8 @@ static void post_image() { { fprintf(stderr, "XShmPutImage() failed\n"); } - } - else + } else +#endif { if (XPutImage( display, @@ -578,12 +574,13 @@ void video_sync(int block) { bool keyevent = true; do { +#ifdef HAVE_X11_SHM if (doShm) { XNextEvent(display, &xevent); keyevent = !(xevent.type == xshmeventtype); - } - else + } else +#endif { keyevent = XCheckMaskEvent(display, KeyPressMask|KeyReleaseMask, &xevent); } @@ -648,14 +645,26 @@ static void parseArgs() { int i; for (i=0; idata); @@ -680,6 +689,7 @@ static void _destroy_image() { static void _create_image() { int pixel_buffer_size = width*height*bitmap_pad; +#ifdef HAVE_X11_SHM if (doShm) { image = XShmCreateImage(display, visualinfo.visual, visualinfo.depth, ZPixmap, NULL, &xshminfo, width, height); @@ -696,7 +706,9 @@ static void _create_image() { if (!XShmAttach(display, &xshminfo)) { ERRQUIT("XShmAttach() failed"); } - } else { + } else +#endif + { void *data = malloc(pixel_buffer_size); if (!data) { ERRQUIT("no memory for image data!"); @@ -904,12 +916,14 @@ void video_init() { width = SCANWIDTH*scale; height = SCANHEIGHT*scale; +#ifdef HAVE_X11_SHM /* init MITSHM if we're doing it */ if (doShm) { /* make sure we have it */ doShm = XShmQueryExtension(display); } +#endif displayname = getenv("DISPLAY"); if (displayname) @@ -917,6 +931,7 @@ void video_init() { if (*displayname != ':') { printf("NOTE: Sound not allowed for remote display \"%s\".\n", displayname); +#ifdef HAVE_X11_SHM if (doShm) { printf("NOTE: Cannot run MITSHM version of emulator with display \"%s\"\n" @@ -926,6 +941,7 @@ void video_init() { doShm=0; //soundAllowed=0; FIXME TODO enforce this ... +#endif } } @@ -999,7 +1015,9 @@ void video_init() { } } +#ifdef HAVE_X11_SHM xshmeventtype = XShmGetEventBase(display) + ShmCompletion; +#endif _create_image(); diff --git a/src/vidsup.c b/src/vidsup.c index e6589f5b..d69eddb5 100644 --- a/src/vidsup.c +++ b/src/vidsup.c @@ -14,10 +14,7 @@ * */ -#include "video.h" -#include "cpu.h" -#include "misc.h" -#include "prefs.h" +#include "common.h" #ifdef _640x400 unsigned char video__wider_font[0x8000]; diff --git a/src/zlib-helpers.c b/src/zlib-helpers.c index 26848c6b..aa4a831b 100644 --- a/src/zlib-helpers.c +++ b/src/zlib-helpers.c @@ -26,10 +26,7 @@ xxx 22 Dec 2013 Switched to gz...() routines for simplicity and to be compatible with gzip */ -#include "misc.h" -#include "zlib-helpers.h" - -#include +#include "common.h" #define CHUNK 16384 #define UNKNOWN_ERR 42