system/atarisio: Added (peripheral emu for Atari 8bit and SIO2PC)

Signed-off-by: Dave Woodfall <dave@slackbuilds.org>

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
B. Watson 2022-07-15 18:00:05 +01:00 committed by Willy Sudiarto Raharjo
parent 2c1bdc5aea
commit 0b5d802d66
No known key found for this signature in database
GPG key ID: 3F617144D7238786
11 changed files with 692 additions and 0 deletions

30
system/atarisio/README Normal file
View file

@ -0,0 +1,30 @@
atarisio (peripheral emulator for Atari 8-bit computer and SIO2PC)
AtariSIO allows a Linux system to act as one or more disk drives,
a printer, and/or a cassette drive for an Atari 8-bit (400/800/XL/XE)
computer, using an SIO2PC cable.
Even without SIO2PC or a real Atari, this package includes some
utilities that are useful for manipulating and examining Atari disk,
cassette, and executable images.
AtariSIO can use either a regular serial port or its own kernel
driver. The kernel driver requires a real serial port with a 16550A
UART, which is fairly rare on modern PC hardware. The regular serial
port mode works with most USB serial port adaptors. For best results,
use an FTDI-based adaptor.
By default, the kernel driver is not built because it's not very
useful (or even functional) on modern PCs. To enable it, read the
instructions in "README_kernel.txt".
By default, the atariserver and atarixfer executables are installed
setgid dialout so they can access the serial port, and have the
appropriate capability bits set so they can use realtime scheduling.
If you don't like this, you can set SETGID=no in the script's
environment, and run the programs as root (e.g. with su or sudo).
If you're using a filesystem that doesn't support capabilities,
you can instead set SETUID=yes in the script's environment, to make
atariserver and atarixfer run as root.

View file

@ -0,0 +1,64 @@
*******************************************************************
* If your serial port is a USB adaptor, STOP reading this NOW and *
* go build atarisio _without_ KERNEL="yes"! *
*******************************************************************
AtariSIO's atariserver and atarixfer use your serial (RS232) port to
communicate with the SIO2PC device. This can be done one of two ways:
using the regular Linux serial port driver or a special AtariSIO
kernel driver that "takes over" the serial port [1].
The kernel driver exists because the SIO protocol relies on tight
timing, especially when using high bitrates (lower POKEY divisor
numbers). On older machines, scheduling latency can cause "hiccups"
in the SIO transfers, resulting in slow loading (due to retries)
or failures.
On modern machines (especially with modern kernels), there's less of
a need for the kernel driver. Also, modern computers don't often have
real serial ports. It's still possible to use AtariSIO with a USB to
RS232 adaptor on such a machine, but not with the kernel module.
The AtariSIO kernel driver can only be used if you have a real (not
USB) serial port that uses a 16550A or 100% compatible UART. If you're
using USB, stop reading this and build atarisio without KERNEL=yes.
Also, even if you do have a real 16550A serial port, you still might
want to avoid the kernel driver: if atarisio works fine without it,
there's no need for the kernel driver's extra complexity.
If you're determined to use the kernel driver, read on.
1. Build atarisio with KERNEL=yes [2].
2. Install the atarisio package you just built.
3. The atarisio module needs to know which serial port to use. The
default is /dev/ttyS0. If you only have one serial port, this
should be the correct one. If you need to change this, edit
/etc/modprobe.d/atarisio.conf and change the "port=/dev/ttyS0" to
whatever it should be.
4. As root, run "modprobe atarisio". The module will be loaded on
every boot; this step is just to avoid rebooting. If you don't
want to load the module at boot, edit /etc/rc.d/rc.modules.local
and comment out the "/sbin/modprobe atarisio" line.
At this point, you should be ready to run atarisio. If you have
trouble with the kernel module, try building atarisio without it and
see if it works. If not, there's probably something wrong with your
hardware.
Notes:
[1] The SlackBuild author hasn't tested the kernel module. I don't
currently own any machines with 16550A serial ports, only USB.
I used to use the kernel module with older hardware (up to 2016
or so) and it worked fine then.
[2] If building the kernel module fails, it means your kernel is too
new for atarisio. The current version of atarisio works with
kernels up to 5.15.x (which is what Slackware 15.0 runs). If
you're running Slackware-current and can't compile the kernel
module, tough luck (for now anyway). Use atarisio without the
kernel module, or use Slackware 15.0.

View file

@ -0,0 +1,99 @@
.\" Man page generated from reStructuredText.
.
.
.nr rst2man-indent-level 0
.
.de1 rstReportMargin
\\$1 \\n[an-margin]
level \\n[rst2man-indent-level]
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
-
\\n[rst2man-indent0]
\\n[rst2man-indent1]
\\n[rst2man-indent2]
..
.de1 INDENT
.\" .rstReportMargin pre:
. RS \\$1
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
. nr rst2man-indent-level +1
.\" .rstReportMargin post:
..
.de UNINDENT
. RE
.\" indent \\n[an-margin]
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
.nr rst2man-indent-level -1
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.TH "ATARICOM" 1 "2022-07-14" "0.30-210714" "HiassofT Atari 8-bit Tools"
.SH NAME
ataricom \- utility for manipulating Atari 8-bit executable files
.\" RST source for ataricom(1) man page. Convert with:
.
.\" rst2man.py ataricom.rst > ataricom.1
.
.\" rst2man.py comes from the SBo development/docutils package.
.
.SH SYNOPSIS
.sp
ataricom [\fIoptions\fP]... \fBfile\fP [\fBoutfile\fP]
.SH DESCRIPTION
.sp
ataricom performs various useful operations on Atari 8\-bit executable
files. These files are also known as binary load files, or COM, BIN,
XEX, OBJ, OBX, et al. These are only names; there is only one Atari
8\-bit executable file format.
.SH OPTIONS
.INDENT 0.0
.TP
.BI \-c \ address
create COM file from raw data file.
.TP
.B \-e
extract blocks to outfileBBBB.ext.
.TP
.B \-E
extract blocks to outfileBBBB_SADR_EADR.ext.
.TP
.BI \-r \ address
add RUN block with specified address at end of file.
.TP
.BI \-i \ address
add INIT block with specified address at end of file.
.UNINDENT
.INDENT 0.0
.TP
.B \-b start[\-end][,...]
only process specified blocks.
.TP
.B \-x start[\-end][,...]
exclude specified blocks.
.TP
.B \-m start\-end[,...]
merge specified blocks.
.TP
.B \-s block,adr...
split block at given addresses.
.UNINDENT
.INDENT 0.0
.TP
.B \-n
write raw data blocks (no COM headers).
.TP
.B \-X
show block length and file offset in hex.
.UNINDENT
.SH AUTHOR
.sp
Matthias Reichl <\fI\%hias@horus.com\fP>.
.sp
Man page by B. Watson <\fI\%urchlay@urchlay.com\fP>.
.SH SEE ALSO
.sp
\fBatariserver\fP(1), \fBatarixfer\fP(1), \fBdir2atr\fP(1), \fBadir\fP(1), \fBcasinfo\fP(1).
.sp
AtariSIO home page: \fI\%https://www.horus.com/~hias/atari/\fP
.\" Generated by docutils manpage writer.
.

View file

@ -0,0 +1,82 @@
.. RST source for ataricom(1) man page. Convert with:
.. rst2man.py ataricom.rst > ataricom.1
.. rst2man.py comes from the SBo development/docutils package.
.. |version| replace:: 0.30-210714
.. |date| date::
========
ataricom
========
-----------------------------------------------------
utility for manipulating Atari 8-bit executable files
-----------------------------------------------------
:Manual section: 1
:Manual group: HiassofT Atari 8-bit Tools
:Date: |date|
:Version: |version|
SYNOPSIS
========
ataricom [*options*]... **file** [**outfile**]
DESCRIPTION
===========
ataricom performs various useful operations on Atari 8-bit executable
files. These files are also known as binary load files, or COM, BIN,
XEX, OBJ, OBX, et al. These are only names; there is only one Atari
8-bit executable file format.
OPTIONS
=======
-c address
create COM file from raw data file.
-e
extract blocks to outfileBBBB.ext.
-E
extract blocks to outfileBBBB_SADR_EADR.ext.
-r address
add RUN block with specified address at end of file.
-i address
add INIT block with specified address at end of file.
-b start[-end][,...]
only process specified blocks.
-x start[-end][,...]
exclude specified blocks.
-m start-end[,...]
merge specified blocks.
-s block,adr...
split block at given addresses.
-n
write raw data blocks (no COM headers).
-X
show block length and file offset in hex.
AUTHOR
======
Matthias Reichl <hias@horus.com>.
Man page by B. Watson <urchlay@urchlay.com>.
SEE ALSO
========
**atariserver**\(1), **atarixfer**\(1), **dir2atr**\(1), **adir**\(1), **casinfo**\(1).
AtariSIO home page: https://www.horus.com/~hias/atari/

View file

@ -0,0 +1,182 @@
#!/bin/bash
# Slackware build script for atarisio
# Written by B. Watson (yalhcru@gmail.com)
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=atarisio
VERSION=${VERSION:-210714}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i586 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
fi
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
exit 0
fi
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i586" ]; then
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
else
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
fi
set -e
SRCNAM=AtariSIO
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $SRCNAM-$VERSION
tar xvf $CWD/$SRCNAM-$VERSION.tar.gz
cd $SRCNAM-$VERSION
chown -R root:root .
find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
\! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
# The kernel driver is really nice, but has two issues:
# 1. It requires a real 16550A serial port. These are pretty rare on
# modern machines.
# 2. While the driver is loaded, you can't use the serial port as a
# normal serial port. This prevents using the Atari as a terminal
# or SLIP mode for FujiChat.
# By default, this build will disable it.
KERNEL=${KERNEL:-no}
if [ "$KERNEL" = "no" ]; then
DEFAULT_DEVICE=${DEFAULT_DEVICE:-/dev/ttyUSB0}
INCLUDES="does not include"
KVER=""
else
DEFAULT_DEVICE=${DEFAULT_DEVICE:-/dev/atarisio0}
INCLUDES="includes"
KERNVER="$( uname -r )"
KVER=" for kernel $KERNVER"
fi
# Use our flags, and don't waste time running depmod since we
# install the module to $PKG anyway.
sed -i "/^CFLAGS/s,-g,$SLKCFLAGS," Makefile
sed -i '/\tdepmod/d' driver/Makefile
# Thought about ENABLE_ATP=1, but ATP is incomplete and abandoned.
# Nothing ever used it, according to the AtariSIO author.
do_make() {
make $@ \
DEFAULT_DEVICE="$DEFAULT_DEVICE" \
INST_DIR=$PKG/usr \
MDIR=$PKG/lib/modules/$KERNVER/misc
}
do_make tools ENABLE_TESTS=1
do_make tools-install
strip $PKG/usr/bin/*
# built all the test stuff with ENABLE_TESTS, but not all
# of it's generally useful. These look like they are:
install -s -m0755 tools/{casinfo,serialwatcher,ataridd} $PKG/usr/bin
# atariserver and atarixfer get installed setuid root.
# we have 3 choices in this build:
# 1. leave them setuid root (SETUID=yes, ignore SETGID)
# 2. make them setgid dialout (so they can access /dev/ttyS*) and
# set capabilities in doinst.sh (SETUID=no, SETGID=yes)
# 3. no setuid or setgid; let the user sudo or whatever (SETUID=no, SETGID=no)
# default choice is 2.
SETUID="${SETUID:-no}"
SETGID="${SETGID:-yes}"
# thought about adding serialwatcher and ataridd to this list, but
# they're quick & dirty test tools, author probably didn't give a lot
# of thought to security.
SBINS="$PKG/usr/bin/atariserver $PKG/usr/bin/atarixfer"
# reset ownership to Slackware default:
chown root:root $PKG/usr/bin/*
chmod 0755 $PKG/usr/bin/*
if [ "$SETUID" = "yes" ]; then
# choice 1:
chown root:users $SBINS
chmod 4750 $SBINS
elif [ "$SETGID" = "yes" ]; then
# choice 2:
chown root:dialout $SBINS
chmod 2755 $SBINS
mkdir -p $PKG/install
cat $CWD/doinst.caps >> $PKG/install/doinst.sh
else
# choice 3: do nothing, leave at Slackware default
:
fi
if [ "$KERNEL" != "no" ]; then
do_make driver
do_make driver-install
mkdir -p $PKG/lib/udev/rules.d $PKG/etc/modprobe.d
cp -a atarisio-modprobe.conf $PKG/etc/modprobe.d/atarisio.conf.new
cp -a atarisio-udev.rules $PKG/lib/udev/rules.d/99-atarisio.rules
fi
# If the kernel stuff wasn't built, this is an empty dir.
rmdir $PKG/usr/include 2>/dev/null || true
# man pages and HTML docs not built by main Makefile
cd docbook
make docs-man
make docs-html
rm -f html/*.proc
mkdir -p $PKG/usr/man/man1
for i in man/*.1; do
gzip -c < $i > $PKG/usr/man/man1/$( basename $i ).gz
done
cd -
# there's no man pages for these, so I wrote them:
for i in ataricom casinfo; do
gzip -9c < $CWD/$i.1 > $PKG/usr/man/man1/$i.1.gz
done
PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
mkdir -p $PKGDOC
cp -a Changelog README* TODO docbook/html contrib $PKGDOC
if [ "$KERNEL" != "no" ]; then
cat $CWD/README_kernel.txt > $PKGDOC/README_kernel.txt
fi
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir -p $PKG/install
sed -e "s,@INCLUDES@,$INCLUDES," \
-e "s,@KVER@,$KVER," \
-e "s,@DEFAULT_DEVICE@,$DEFAULT_DEVICE," \
< $CWD/slack-desc > $PKG/install/slack-desc
[ "$KERNEL" != "no" ] && cat $CWD/doinst.kernel >> $PKG/install/doinst.sh
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE

View file

@ -0,0 +1,10 @@
PRGNAM="atarisio"
VERSION="210714"
HOMEPAGE="https://www.horus.com/~hias/atari/"
DOWNLOAD="https://github.com/HiassofT/AtariSIO/archive/210714/AtariSIO-210714.tar.gz"
MD5SUM="2081d17149596d7ec5d39a513c0393a4"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES="atasm"
MAINTAINER="B. Watson"
EMAIL="yalhcru@gmail.com"

109
system/atarisio/casinfo.1 Normal file
View file

@ -0,0 +1,109 @@
.\" Man page generated from reStructuredText.
.
.
.nr rst2man-indent-level 0
.
.de1 rstReportMargin
\\$1 \\n[an-margin]
level \\n[rst2man-indent-level]
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
-
\\n[rst2man-indent0]
\\n[rst2man-indent1]
\\n[rst2man-indent2]
..
.de1 INDENT
.\" .rstReportMargin pre:
. RS \\$1
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
. nr rst2man-indent-level +1
.\" .rstReportMargin post:
..
.de UNINDENT
. RE
.\" indent \\n[an-margin]
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
.nr rst2man-indent-level -1
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.TH "CASINFO" 1 "2022-07-14" "0.30-210714" "HiassofT Atari 8-bit Tools"
.SH NAME
casinfo \- print info about Atari 8-bit cassette images
.\" RST source for casinfo(1) man page. Convert with:
.
.\" rst2man.py casinfo.rst > casinfo.1
.
.\" rst2man.py comes from the SBo development/docutils package.
.
.SH SYNOPSIS
.sp
casinfo \fBfile\fP
.SH DESCRIPTION
.sp
\fBcasinfo\fP reads an Atari 8\-bit cassette image (aka CAS file) and prints
the following information:
.INDENT 0.0
.INDENT 3.5
.INDENT 0.0
.IP \(bu 2
Description
.IP \(bu 2
Number of Parts (aka Stages or Files)
.IP \(bu 2
Number of Blocks
.IP \(bu 2
The metadata for each block:
.INDENT 2.0
.IP \(bu 2
Block Number
.IP \(bu 2
Record Type (data or fsk)
.IP \(bu 2
Part (0 for the first file/stage, 1 for the 2nd, etc)
.IP \(bu 2
Baud (bits/sec; normally 600)
.IP \(bu 2
Gap aka PRWT (Pre\-Record Write Tone, in milliseconds)
.IP \(bu 2
Block length in bytes (normally 132)
.UNINDENT
.UNINDENT
.UNINDENT
.UNINDENT
.sp
If an invalid file (not a CAS image) is given, \fBcasinfo\fP will print
\fBError: "file" doesn\(aqt start with FUJI header\fP to stderr, then
exit. Beware that the exit status is always 0 (success), so a script
would have to capture and parse stderr to catch errors.
.SH EXAMPLE
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
$ casinfo test.cas
casinfo 0.30\-210714 (c) 2007\-2010 Matthias Reichl
infos for "test.cas":
Description: <none>
Number of Parts: 1
Number of Blocks: 3
0: data part: 0 baud: 600 gap: 25647 length: 132
1: data part: 0 baud: 600 gap: 252 length: 132
2: data part: 0 baud: 600 gap: 254 length: 132
.ft P
.fi
.UNINDENT
.UNINDENT
.SH AUTHOR
.sp
Matthias Reichl <\fI\%hias@horus.com\fP>.
.sp
Man page by B. Watson <\fI\%urchlay@urchlay.com\fP>.
.SH SEE ALSO
.sp
\fBatariserver\fP(1), \fBatarixfer\fP(1), \fBdir2atr\fP(1), \fBadir\fP(1), \fBataricom\fP(1).
.sp
AtariSIO home page: \fI\%https://www.horus.com/~hias/atari/\fP
.\" Generated by docutils manpage writer.
.

View file

@ -0,0 +1,76 @@
.. RST source for casinfo(1) man page. Convert with:
.. rst2man.py casinfo.rst > casinfo.1
.. rst2man.py comes from the SBo development/docutils package.
.. |version| replace:: 0.30-210714
.. |date| date::
=======
casinfo
=======
--------------------------------------------
print info about Atari 8-bit cassette images
--------------------------------------------
:Manual section: 1
:Manual group: HiassofT Atari 8-bit Tools
:Date: |date|
:Version: |version|
SYNOPSIS
========
casinfo **file**
DESCRIPTION
===========
**casinfo** reads an Atari 8-bit cassette image (aka CAS file) and prints
the following information:
- Description
- Number of Parts (aka Stages or Files)
- Number of Blocks
- The metadata for each block:
- Block Number
- Record Type (data or fsk)
- Part (0 for the first file/stage, 1 for the 2nd, etc)
- Baud (bits/sec; normally 600)
- Gap aka PRWT (Pre-Record Write Tone, in milliseconds)
- Block length in bytes (normally 132)
If an invalid file (not a CAS image) is given, **casinfo** will print
**Error: "file" doesn't start with FUJI header** to stderr, then
exit. Beware that the exit status is always 0 (success), so a script
would have to capture and parse stderr to catch errors.
EXAMPLE
=======
::
$ casinfo test.cas
casinfo 0.30-210714 (c) 2007-2010 Matthias Reichl
infos for "test.cas":
Description: <none>
Number of Parts: 1
Number of Blocks: 3
0: data part: 0 baud: 600 gap: 25647 length: 132
1: data part: 0 baud: 600 gap: 252 length: 132
2: data part: 0 baud: 600 gap: 254 length: 132
AUTHOR
======
Matthias Reichl <hias@horus.com>.
Man page by B. Watson <urchlay@urchlay.com>.
SEE ALSO
========
**atariserver**\(1), **atarixfer**\(1), **dir2atr**\(1), **adir**\(1), **ataricom**\(1).
AtariSIO home page: https://www.horus.com/~hias/atari/

View file

@ -0,0 +1,2 @@
[ -x /sbin/setcap ] && /sbin/setcap cap_ipc_lock,cap_sys_nice=ep usr/bin/atariserver
[ -x /sbin/setcap ] && /sbin/setcap cap_ipc_lock,cap_sys_nice=ep usr/bin/atarixfer

View file

@ -0,0 +1,19 @@
chroot . /sbin/depmod -a 2>/dev/null
config() {
NEW="$1"
OLD="$(dirname $NEW)/$(basename $NEW .new)"
if [ ! -r $OLD ]; then
mv $NEW $OLD
elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
rm $NEW
fi
}
config etc/modprobe.d/atarisio.conf.new
if [ -e etc/rc.d/rc.modules.local ]; then
if ! grep -q '# AtariSIO' etc/rc.d/rc.modules.local; then
echo "/sbin/modprobe atarisio # AtariSIO (added by SBo atarisio package)" >> etc/rc.d/rc.modules.local
fi
fi

View file

@ -0,0 +1,19 @@
# HOW TO EDIT THIS FILE:
# 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------------------------------------------------------|
atarisio: atarisio (peripheral emulator for Atari 8-bit computer and SIO2PC)
atarisio:
atarisio: AtariSIO allows a Linux system to act as one or more disk drives,
atarisio: a printer, and/or a cassette drive for an Atari 8-bit (400/800/XL/XE)
atarisio: computer, using an SIO2PC cable.
atarisio:
atarisio: Package @INCLUDES@ the atarisio kernel driver@KVER@.
atarisio: Default device: @DEFAULT_DEVICE@
atarisio:
atarisio:
atarisio: