path: root/system/kegs
diff options
author B. Watson <>2011-08-23 08:55:48 -0300
committer Niels Horn <>2011-08-23 08:55:48 -0300
commit6b6c8ec350e3c15a4a374cb3580e227da34b03ac (patch)
treebc2d1bdddf2cd68ab45b4b7e6132c02bfcae89d5 /system/kegs
parent6b3dd7e2812a14275ad9c17c416f254b336df4ee (diff)
system/kegs: Added (Kent's Emulated GS)
Signed-off-by: Niels Horn <>
Diffstat (limited to 'system/kegs')
-rw-r--r--system/kegs/kegs.pngbin0 -> 40005 bytes
13 files changed, 511 insertions, 0 deletions
diff --git a/system/kegs/README b/system/kegs/README
new file mode 100644
index 0000000000..a2d91a7ee0
--- /dev/null
+++ b/system/kegs/README
@@ -0,0 +1,29 @@
+KEGS (Kent's Emulated GS)
+KEGS is an Apple IIgs emulator for Mac OS X, Linux, and Win32. The Apple
+IIgs was the most powerful computer in the Apple II line. It first was
+sold in 1986. An Apple IIgs has the capability to run almost all Apple
+II, Apple IIe, and Apple IIc programs.
+KEGS requires a ROM image dumped from an Apple IIgs. This will typically
+be called either "rom01" (131072 bytes) or "rom03" (262144 bytes),
+and will often be distributed in zip files called and (for use with MESS). This package can optionally include
+the ROM file. To do this, place the ROM image in the slackbuild
+directory before running the script. The image will be installed
+as /usr/share/kegs/rom03 (or rom01). If you do not include the ROM
+in the package, you will need to manually copy the rom03 image to
+/usr/share/kegs/rom03 before the emulator will work properly.
+Optional dependency: If you intend to run Apple's GS/OS in
+the emulator, you will need macutils to extract the .sea.bin
+archives from Apple's website. Download disk image(s) from
+ and then
+run e.g.:
+$ macunpack -d Disk_2_of_7-System.Disk.sea.bin
+$ mv system_disk.dsk
+Mount system_disk.dsk on slot 5 using the config menu within xkegs,
+set slot 5 as the default startup device in the IIgs control panel,
+and you should be booting into the IIgs native GUI environment.
diff --git a/system/kegs/allow_window_close.diff b/system/kegs/allow_window_close.diff
new file mode 100644
index 0000000000..538022e044
--- /dev/null
+++ b/system/kegs/allow_window_close.diff
@@ -0,0 +1,35 @@
+diff -Naur kegs.0.91/src/xdriver.c kegs.0.91.patched//src/xdriver.c
+--- kegs.0.91/src/xdriver.c 2004-12-06 19:42:47.000000000 -0500
++++ kegs.0.91.patched//src/xdriver.c 2011-01-27 04:28:42.000000000 -0500
+@@ -57,6 +57,7 @@
+ Display *g_display = 0;
+ Visual *g_vis = 0;
+ Window g_a2_win;
++Atom g_wmdelete_atom;
+ GC g_a2_winGC;
+ XFontStruct *g_text_FontSt;
+ Colormap g_a2_colormap = 0;
+@@ -582,6 +583,9 @@
+ 0, &my_winSizeHints, 0, &my_winClassHint);
+ XMapRaised(g_display, g_a2_win);
++ g_wmdelete_atom = XInternAtom(g_display, "WM_DELETE_WINDOW", True);
++ XSetWMProtocols(g_display, g_a2_win, &g_wmdelete_atom, 1);
+ XSync(g_display, False);
+ g_a2_winGC = XCreateGC(g_display, g_a2_win, 0, (XGCValues *) 0);
+@@ -1086,6 +1090,13 @@
+ (word32)ev.xcolormap.colormap,
+, ev.xcolormap.state);
+ break;
++ case ClientMessage:
++ if([0] == g_wmdelete_atom) {
++ x_auto_repeat_on(1);
++ XCloseDisplay(g_display);
++ exit(0);
++ }
++ break;
+ default:
+ printf("X event 0x%08x is unknown!\n",
+ ev.type);
diff --git a/system/kegs/config.kegs.default b/system/kegs/config.kegs.default
new file mode 100644
index 0000000000..782bfb8f3a
--- /dev/null
+++ b/system/kegs/config.kegs.default
@@ -0,0 +1,11 @@
+# KEGS configuration file version 0.91
+s5d1 = #XMAS_DEMO
+s5d2 =
+s6d1 = #dos33.dsk
+s6d2 =
+s7d1 = #NUCLEUS03
+g_cfg_rom_path = @ROM@
diff --git a/system/kegs/ b/system/kegs/
new file mode 100644
index 0000000000..5fb28930db
--- /dev/null
+++ b/system/kegs/
@@ -0,0 +1,3 @@
+if [ -x /usr/bin/update-desktop-database ]; then
+ /usr/bin/update-desktop-database -q usr/share/applications >/dev/null 2>&1
diff --git a/system/kegs/kegs.SlackBuild b/system/kegs/kegs.SlackBuild
new file mode 100644
index 0000000000..debc922f51
--- /dev/null
+++ b/system/kegs/kegs.SlackBuild
@@ -0,0 +1,125 @@
+# Slackware build script for kegs
+# Written by B. Watson (
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i486 ;;
+ arm*) ARCH=arm ;;
+ *) ARCH=$( uname -m ) ;;
+ esac
+if [ "$ARCH" = "i486" ]; then
+ SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+elif [ "$ARCH" = "i686" ]; then
+ SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+elif [ "$ARCH" = "x86_64" ]; then
+set -e
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+tar xvf $CWD/$PRGNAM.$VERSION.tar.gz
+chown -R root:root .
+find . \
+ \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
+ -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
+ -exec chmod 644 {} \;
+# xkegs refuses to close (close button greyed-out by window manager).
+# Small patch by SlackBuild author fixes this large annoyance (which is
+# extra-annoying because there's also no Quit option in the kegs menu).
+# I've sent this upstream, maybe it'll get integrated in future versions.
+patch -p1 < $CWD/allow_window_close.diff
+cd src
+rm -f vars
+ln -s vars_x86linux vars
+make CCOPTS="$SLKCFLAGS" x$PRGNAM to_pro partls
+cd -
+# No install target, just stick it all where it goes.
+# The icon was converted from the Mac OSX icon with icns2png.
+# The .desktop has 'Terminal=true' because xkegs *really* wants
+# to be started from a terminal (the debugger uses stdio, and
+# is too easy to accidentally enter by center-clicking the window).
+mkdir -p \
+ $PKG/usr/bin \
+ $PKG/usr/libexec \
+ $PKG/usr/share/pixmaps \
+ $PKG/usr/share/applications \
+ $PKG/usr/share/$PRGNAM \
+ $PKG/usr/man/man1
+install -s -m0755 x$PRGNAM $PKG/usr/libexec/
+install -s -m0755 src/to_pro src/partls $PKG/usr/bin/
+install -m0755 $CWD/x$ $PKG/usr/bin/x$PRGNAM
+install -m0644 $CWD/$PRGNAM.png $PKG/usr/share/pixmaps/
+install -m0644 $CWD/$PRGNAM.desktop $PKG/usr/share/applications/
+# Man pages are specific to the SlackBuild, though I've sent
+# them upstream for consideration.
+for file in $CWD/*.1; do
+ sed "s/@VERSION@/$VERSION/g" $file \
+ | gzip -9c \
+ > $PKG/usr/man/man1/$( basename $file ).gz
+# Half the supplied documentation refers to it as "kegs" and
+# the other half calls it "xkegs". To avoid confusion:
+ln -s x$PRGNAM.1.gz $PKG/usr/man/man1/$PRGNAM.1.gz
+ln -s x$PRGNAM $PKG/usr/bin/$PRGNAM
+# Handle the ROM image, if we find it. Filenames are listed in
+# reverse order of preference.
+for file in ROM01 rom01 ROM03 rom03; do
+ if [ -e "$CWD/$file" ]; then
+ ROMFILE="$CWD/$file"
+ fi
+if [ -e "$ROMFILE" ]; then
+ ROMNAME="$( basename "$ROMFILE" )"
+ install -m0644 "$ROMFILE" $PKG/usr/share/$PRGNAM
+ # We don't have a ROM, so we don't include one in the package, but we
+ # do still set the path to /usr/share/kegs/rom03 in the config file,
+ # so all the user has to do is copy the ROM there later.
+ ROMNAME=rom03
+sed "s,@ROM@,/usr/share/$PRGNAM/$ROMNAME," \
+ < $CWD/config.$PRGNAM.default \
+ > $PKG/usr/share/$PRGNAM/config.$PRGNAM.default
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+install -m0644 *.txt $PKG/usr/doc/$PRGNAM-$VERSION
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+cat $CWD/ > $PKG/install/
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
diff --git a/system/kegs/kegs.desktop b/system/kegs/kegs.desktop
new file mode 100644
index 0000000000..bf2b147dce
--- /dev/null
+++ b/system/kegs/kegs.desktop
@@ -0,0 +1,10 @@
+[Desktop Entry]
+GenericName=Apple IIgs Emulator
diff --git a/system/kegs/ b/system/kegs/
new file mode 100644
index 0000000000..4503dfc3b9
--- /dev/null
+++ b/system/kegs/
@@ -0,0 +1,10 @@
+APPROVED="Niels Horn"
diff --git a/system/kegs/kegs.png b/system/kegs/kegs.png
new file mode 100644
index 0000000000..578329931f
--- /dev/null
+++ b/system/kegs/kegs.png
Binary files differ
diff --git a/system/kegs/partls.1 b/system/kegs/partls.1
new file mode 100644
index 0000000000..1af148532b
--- /dev/null
+++ b/system/kegs/partls.1
@@ -0,0 +1,23 @@
+.TH PARTLS "1" "January 2011" "" "User Commands"
+partls \- Lists partitions on Apple\-partitioned hard drives or CD-ROMs
+.B partls
+partls is distributed with the KEGS emulator.
+partls displays the partition table on an Apple\-partitioned disk or
+disk image file. Generally, these partitions will use the Apple HFS filesystem.
+With the \fB\-l\fR option, more information is displayed.
+KEGS and partls are by Kent Dickey <kadickey at princeton dot edu>.
+This manual page was written by B. Watson for the project (but
+may be used by anyone for any reason).
diff --git a/system/kegs/slack-desc b/system/kegs/slack-desc
new file mode 100644
index 0000000000..39de2bc9b4
--- /dev/null
+++ b/system/kegs/slack-desc
@@ -0,0 +1,19 @@
+# The "handy ruler" below makes it easier to edit a package description. Line
+# up the first '|' above the ':' following the base package name, and the '|'
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':'.
+ |-----handy-ruler------------------------------------------------------|
+kegs: KEGS (Kent's Emulated GS)
+kegs: KEGS is an Apple IIgs emulator for Mac OS X, Linux, and Win32. The
+kegs: Apple IIgs was the most powerful computer in the Apple II line. It
+kegs: first was sold in 1986. An Apple IIgs has the capability to run almost
+kegs: all Apple II, Apple IIe, and Apple IIc programs.
diff --git a/system/kegs/to_pro.1 b/system/kegs/to_pro.1
new file mode 100644
index 0000000000..a58fada52d
--- /dev/null
+++ b/system/kegs/to_pro.1
@@ -0,0 +1,55 @@
+.TH TO_PRO "1" "January 2011" "" "User Commands"
+to_pro \- creates and copies files to Apple ProDOS disk images
+.B to_pro
+<\fIfile\fR ...>
+to_pro is intended for use with the KEGS emulator.
+to_pro creates a new ProDOS disk image called POOF1 in the current
+directory, of the given size, containing the specified file(s). At
+least one file must be given (to_pro cannot create a completely blank
+image), and up to 51 file arguments are allowed.
+The size argument is in kilobytes (1024 bytes each), and must be larger than the total size of
+all the files (no checking is done, it's up to the user). ProDOS has a limit
+of 32MB per partition, so the \-size argument should always less than
+Long UNIX filenames are truncated to the 15\-character
+ProDOS limit.
+The author warns that the generated disk image files should only be used
+temporarily, to copy files from the image to another ProDOS disk image
+that was formatted within KEGS using ProDOS itself (or, the generated
+image may be formatted within KEGS to create a proper blank disk image).
+to_pro automatically sets the ProDOS filetype of files ending in ".shk"
+to $E0.
+to_pro \-800 wolfdemo.bxy
+Creates an 800KB disk image called POOF1, containing the file "wolfdemo.bxy"
+(which is likely an Apple IIgs archive, downloaded from an FTP or web site).
+Probably the next thing you will do be "mv POOF1 wolfdemo.dsk".
+to_pro \-4096 wolfdemo.bxy
+Same as above, but creates a 4MB POOF1 image file instead.
+to_pro \-32000 *.shk
+put all *.shk files in the current Unix directory into a 31.25MB
+image called POOF1.
+More information on to_pro in /usr/doc/kegs\-@VERSION@/README.kegs.txt
+KEGS and to_pro are by Kent Dickey <kadickey at princeton dot edu>.
+This manual page was written by B. Watson for the project (but
+may be used by anyone for any reason).
diff --git a/system/kegs/xkegs.1 b/system/kegs/xkegs.1
new file mode 100644
index 0000000000..907a6095cd
--- /dev/null
+++ b/system/kegs/xkegs.1
@@ -0,0 +1,176 @@
+.TH KEGS "1" "January 2011" "" "User Commands"
+xkegs \- Apple IIgs emulator
+.B xkegs
+KEGS (Kent's Emulated GS)
+is an Apple IIgs emulator for Mac OS X, Linux, and Win32. The Apple
+IIgs was the most powerful computer in the Apple II line. It first was
+sold in 1986. An Apple IIgs has the capability to run almost all Apple
+II, Apple IIe, and Apple IIc programs.
+xkegs is the KEGS binary, compiled for Linux and X\-Window support.
+This manual page only documents the command\-line options and key mappings.
+For the full documentation, see /usr/doc/kegs\-@VERSION@/README.kegs.txt
+(and the other files in the same directory).
+\fINote:\fR There is no way to specify disk or ROM images on the command line.
+Use the configuration menu (F4) from within the emulator to select images.
+\fB\-skip\fR \fI[num]\fR
+KEGS will "skip" that many screen redraws between refreshes.
+\-skip 0 will do 60 frames per second, \-skip 1 will do 30 fps,
+\-skip 5 will do 10 fps.
+\fB\-audio\fR \fI[0/1]\fR
+Forces audio [off/on]. By default, audio is on unless
+the X display is a remote machine or shared memory is off.
+This switch can override the default. \-audio 0 causes KEGS to
+not fork the background audio process, but Ensoniq emulation
+is still 100% accurate, just the sound is not sent to the
+workstation speaker.
+\fB\-arate\fR \fI[num]\fR
+Forces audio sample rate to \fI[num]\fR. 44100 and 48000 are
+usual, you can try 22050 to reduce KEGS's overhead. On a reasonably
+fast machine (>250MHz or so), you shouldn't need to mess with this.
+Will use the old Double\-hires color algorithm that results in
+exactly 140 colors across the screen, as opposed to the blending
+being done by default.
+KEGS will only look for a 15\-bit X\-Window display.
+KEGS will only look for a 16\-bit X\-Window display (not tested, probably
+ will get red colors wrong).
+KEGS will only look for a 24\-bit X\-Window display.
+\fB\-display\fR \fI[xdisplay]\fR
+Same as setting the environment variable DISPLAY.
+Sends X display to \fI[xdisplay]\fR
+KEGS will not try to used shared memory for the X graphics display.
+This will make KEGS much slower on graphics\-intensive tasks,
+by as much as a factor of 10! By default, \-noshm causes an
+effective \-skip of 3 which is 15 fps. You can override this
+default by specifying a \-skip explicitly.
+Alias of Command
+Alias of Option
+Alias of ESC for OS/2 compatibility.
+Configuration Panel
+Toggle through the 4 speeds:
+Unlimited, 1MHz, 2.8MHz, 8.0MHz
+Enter KEGS debugger (can also be done by center\-clicking the mouse on
+the xkegs window).
+The debugger is tty\-based, and runs on the terminal
+that xkegs was started from.
+Toggle fast_disk_emul on/off
+Toggle pointer hiding on/off.
+Invert the sense of the joystick.
+Swap x and y joystick/paddle axes.
+Attempt to change the a2vid_palette (only useful on 256\-color displays)
+Full screen mode (only on Mac OS X).
+Alias of Pause/Break which is treated as Reset
+\fBF2\fR, \fBAlt_R\fR, \fBMeta_r\fR, \fBMenu\fR, \fBPrint\fR, \fBMode_switch\fR, \fBOption\fR
+Option key
+\fBF1\fR, \fBAlt_L\fR, \fBMeta_L\fR, \fBCancel\fR, \fBScroll_lock\fR, \fBCommand\fR
+Command key
+Keypad "Clear".
+\fBF12\fR, \fBPause\fR, \fBBreak\fR
+Alias for "=" on the keypad
+The KEGS configuration file. This can be directly edited if
+necessary, but normally is changed by using the configuration
+menu (F4) from within KEGS. To return to the default configuration,
+you may remove this file.
+\fB/usr/share/kegs/rom03\fR (or \fB/usr/share/kegs/rom01\fR)
+The Apple IIgs BIOS ROM image. If KEGS can't find this ROM, it
+will start up with a black display, full of white @ characters.
+Press F4 for the config menu and use the UI to select the correct
+ROM image file.
+For reference, the ROM image details are:
+\fBrom03\fR: size 262144 bytes, md5sum ba89edf2729a28a17cd9e0f7a0ac9a39
+\fBrom01\fR: size 131072 bytes, md5sum 20a0334c447cb069a040ae5be1d938df
+Other versions of the IIgs ROMs may exist (this author isn't aware of any),
+but these two images are known to work.
+Wrapper script. xkegs will fail to run if it can't find its config file,
+so this script creates one in the user's home directory if necessary,
+then runs the real xkegs binary.
+Actual xkegs binary. Shouldn't be run directly (use the wrapper instead).
+Copied to \fB~/.config.kegs\fR by the wrapper script, if \fB~/.config.kegs\fR
+doesn't already exist. Can be used to set system\-wide defaults (such as the
+path to the ROM image).
+Full KEGS docs in /usr/doc/kegs\-@VERSION@/*.txt
+KEGS homepage at
+KEGS is by Kent Dickey <kadickey at princeton dot edu>.
+This manual page was written by B. Watson for the project (but
+may be used by anyone for any reason).
+Wrapper script also by B. Watson.
diff --git a/system/kegs/ b/system/kegs/
new file mode 100644
index 0000000000..55f0719b73
--- /dev/null
+++ b/system/kegs/
@@ -0,0 +1,15 @@
+# Wrapper script for xkegs, part of kegs package
+# By B. Watson
+# xkegs is smart enough to read its conf file from ~/.config.kegs, but
+# it will choke if the file's not found. Also, it's smart enough to
+# read it from /usr/share/kegs/config.kegs, but it'll freeze if
+# it doesn't have write permission!
+if [ ! -e ~/.config.kegs ]; then
+ cat /usr/share/kegs/config.kegs.default > ~/.config.kegs
+exec /usr/libexec/xkegs