Refactor to use GNU build tools

* Added configure.ac and non-recursive Makefile.am
    * Modularized source into subdirectories
    * Simplified header inclusion
This commit is contained in:
asc 2014-01-22 20:42:34 -08:00
parent 12f6c9704e
commit 3abd2e87aa
59 changed files with 783 additions and 4297 deletions

View File

@ -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

35
.gitignore vendored
View File

@ -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

17
ASM
View File

@ -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

24
AUTHORS
View File

@ -1,11 +1,19 @@
Alexander Jean-Claude Bottema <alexb@csd.uu.se> made the original
version of the emulator in 1994.
Apple //ix was originally developed as the "apple2-emul-linux" package.
Stephen Lee <sl14@cornell.edu> and particularly Aaron Culliney
<asc@mhpcc.edu> have done much work on the emulator since.
Alexander Jean-Claude Bottema <alexb@csd.uu.se> made the original version of the
emulator in 1994.
Michael Deutschmann <michael@talamasca.ocis.net> cleaned up the
build sequence to use standard GNU tools, and is the present coordinator.
Stephen Lee <sl14@cornell.edu> contributed early work on the emulator.
Michael Deutschmann <michael@talamasca.ocis.net> cleaned up the build sequence
to use standard GNU tools.
Tom Lear <tom@trap.mtview.ca.us> 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 <tom@trap.mtview.ca.us> maintains the Debian package of
this program, and has contributed some fixes.

View File

@ -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 <michael@talamasca.ocis.net>
* configure.in: set revision to 0.7.4, final release

182
INSTALL
View File

@ -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.

65
Makefile.am Normal file
View File

@ -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

17
NEWS
View File

@ -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

View File

@ -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.

208
configure.ac Normal file
View File

@ -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 <AL/al.h>
#include <AL/alc.h>
])
], [
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

BIN
disks/blank.dsk.gz Normal file

Binary file not shown.

234
docs/apple2ix.6 Normal file
View File

@ -0,0 +1,234 @@
.\" Apple //e emulator manpage
.\"
.\" MODIFICATION HISTORY
.\" v0.8 by Aaron Culliney @ BitR0t.com Feb 2014.
.\" v0.5 by Aaron Culliney <chernabog@baldmountain.bbn.com>, Feb 1998.
.\" v0.6 by Aaron Culliney <chernabog@baldmountain.bbn.com>, 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 <rw1> or <r1> 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.

12
reconf.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/sh
set -x
rm -f config.cache
aclocal
autoconf
autoheader
automake -a --warnings=all
set +x

View File

@ -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:

View File

@ -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_ */

View File

@ -17,7 +17,7 @@
#define __ASSEMBLY__
#include "apple2.h"
#include "video.h"
#include "video/video.h"
#include "cpu.h"
#include "misc.h"

View File

@ -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

View File

@ -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 <windows.h>
@ -35,10 +34,11 @@
#include <crtdbg.h>
#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

View File

@ -28,14 +28,12 @@
* finding an appropriate buffer format, and getting readable strings for
* channel configs and sample types. */
#include <stdio.h>
#include <AL/al.h>
#include <AL/alc.h>
#include <AL/alext.h>
#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

View File

@ -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

View File

@ -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 <sys/io.h>
# endif
@ -108,8 +102,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include <wchar.h>
#include "AY8910.h"
#include "SSI263Phonemes.h"
#include "audio/AY8910.h"
#include "audio/SSI263Phonemes.h"
#define SY6522_DEVICE_A 0

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -13,8 +13,6 @@
#define _SOUNDCORE_OPENAL_H_
#include "common.h"
#include "soundcore.h"
#include "uthash.h"
#include <AL/al.h>
#include <AL/alc.h>

View File

@ -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

View File

@ -17,7 +17,7 @@
#ifndef _SOUNDCORE_H_
#define _SOUNDCORE_H_
#include "ds-shim.h"
#include "audio/ds-shim.h"
#define MAX_SAMPLES (8*1024)

View File

@ -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 <sys/io.h>
# endif

View File

@ -13,7 +13,7 @@
#define _SPEAKER_H_
#ifdef APPLE2IX
#include "win-shim.h"
#include "audio/win-shim.h"
#endif
extern DWORD soundtype;

View File

@ -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)
{

View File

@ -16,8 +16,12 @@
# define _GNU_SOURCE
#endif
#include <stdio.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <stdint.h>
@ -28,11 +32,38 @@
#include <pthread.h>
#include <ctype.h>
#include <dirent.h>
#include <fcntl.h>
#include <limits.h>
#include <zlib.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>
#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

View File

@ -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

File diff suppressed because it is too large Load Diff

View File

@ -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 <zlib.h>
#define PHASE_BYTES 3328

View File

@ -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 */
}

View File

@ -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 <zlib.h>
static struct stat statbuf;
static int altdrive;

View File

@ -14,24 +14,12 @@
*
*/
#ifdef PC_JOYSTICK
#include "common.h"
#ifdef LINUX_JOYSTICK
#include <linux/joystick.h>
#endif
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <values.h>
#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();

View File

@ -14,20 +14,7 @@
*
*/
#ifdef __linux__
#include <linux/keyboard.h>
#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 <linux/joystick.h>
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)

View File

@ -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;

View File

@ -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 <unistd.h>
#include <strings.h>
#include <ctype.h>
#include "cpu.h"
#include "common.h"
#define debugtext yytext
YY_BUFFER_STATE buffer = 0;

View File

@ -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)

View File

@ -14,7 +14,7 @@
*
*/
#include "debug.h"
#include "common.h"
const char * const disasm_templates[15] =
{

View File

@ -14,29 +14,7 @@
*
*/
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <signal.h>
#include <time.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <sys/io.h>
#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<MAX_BRKPTS; i++)
{
@ -719,6 +706,7 @@ void reinitialize(void)
{
op_breakpoints[(unsigned char)i] = 0;
}
#endif
c_initialize_vm();
@ -743,7 +731,9 @@ void reinitialize(void)
timing_initialize();
#ifdef AUDIO_ENABLED
MB_Reset();
#endif
}
static void c_initialize_firsttime()
@ -755,9 +745,11 @@ static void c_initialize_firsttime()
video_init();
// TODO FIXME : sound system never released ...
#ifdef AUDIO_ENABLED
DSInit();
SpkrInitialize();
MB_Initialize();
#endif
reinitialize();
}
@ -808,11 +800,12 @@ GLUE_C_READ(read_gc1)
// HACK FIXME TODO : candidate for GLUE_C_READ(...)
void c_read_random() {
static unsigned int seed=0;
static time_t seed=0;
if (!seed) {
seed = time(NULL);
srandom(seed);
}
random_value = (unsigned char)rand_r(&seed);
random_value = (unsigned char)random();
}
static void main_thread(void *dummyptr) {

View File

@ -19,10 +19,6 @@
#ifndef __ASSEMBLER__
#include "common.h"
#include <unistd.h>
#include <sys/types.h>
#define SW_TEXT 0xC050
#define SW_MIXED 0xC052
#define SW_PAGE2 0xC054

View File

@ -16,18 +16,7 @@
#define _GNU_SOURCE
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#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,

View File

@ -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);

View File

@ -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);

View File

@ -14,26 +14,18 @@
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/time.h>
#include "common.h"
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#include <X11/XKBlib.h>
#ifdef HAVE_X11_SHM
#include <sys/ipc.h>
#include <sys/shm.h>
#include <X11/extensions/XShm.h> /* 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; i<argc; i++)
{
if (strstr(argv[i], "-noshm"))
#ifdef HAVE_X11_SHM
if (strstr(argv[i], "--noshm"))
{
doShm=0;
} else
#endif
if (strstr(argv[i], "--help") || strstr(argv[i], "-h")) {
printf("%s v%s emulator help :\n", PACKAGE_NAME, PACKAGE_VERSION);
printf("\tManpage : %s\n", PACKAGE_MANPAGE);
printf("\tWeb Resources : %s\n", WEB_RESOURCES);
exit(0);
} else if (strstr(argv[i], "--version") || strstr(argv[i], "-v")) {
printf("%s v%s\n", PACKAGE_NAME, PACKAGE_VERSION);
exit(0);
}
}
}
static void _destroy_image() {
#ifdef HAVE_X11_SHM
if (doShm)
{
// Detach from X server
@ -669,8 +678,8 @@ static void _destroy_image() {
// Release shared memory.
shmdt(xshminfo.shmaddr);
shmctl(xshminfo.shmid, IPC_RMID, 0);
}
else
} else
#endif
{
XDestroyImage(image);
//free(image->data);
@ -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();

View File

@ -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];

View File

@ -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 <zlib.h>
#include "common.h"
#define CHUNK 16384
#define UNKNOWN_ERR 42