aboutsummaryrefslogtreecommitdiff
path: root/development/dasm
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2022-09-30 22:09:13 +0100
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2022-10-01 09:01:16 +0700
commiteb759e589721fd3aeffb8d62d7480c1740895cdb (patch)
treec6e38574c9ab69fd937184ad3fbe7c0c0741b59e /development/dasm
parent74b641bef7b7958306b9c0e878d4870b7bc194b8 (diff)
development/dasm: Added (assembler for 6502 & other 8-bit CPUs)
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'development/dasm')
-rw-r--r--development/dasm/README16
-rw-r--r--development/dasm/dasm.SlackBuild101
-rw-r--r--development/dasm/dasm.info10
-rw-r--r--development/dasm/ftohex.182
-rw-r--r--development/dasm/ftohex.rst67
-rw-r--r--development/dasm/manpagefix.diff53
-rw-r--r--development/dasm/slack-desc19
-rw-r--r--development/dasm/vcs-old.txt10
-rw-r--r--development/dasm/vcs.h.old158
9 files changed, 516 insertions, 0 deletions
diff --git a/development/dasm/README b/development/dasm/README
new file mode 100644
index 0000000000000..5758caa952fa2
--- /dev/null
+++ b/development/dasm/README
@@ -0,0 +1,16 @@
+dasm (cross assembler for 6502 and other 8-bit CPUs)
+
+DASM is versatile macro assembler with support for several 8-bit
+microprocessors including MOS 6502 & 6507; Motorola 6803, 68705, and
+68HC11; Hitachi HD6303 (extended Motorola 6801) and Fairchild F8.
+
+DASM also includes platform support for the Atari 2600, Atari 7800,
+and Fairchild Channel F game consoles.
+
+Support files are installed to /usr/share/dasm/machines; usual
+practice is to copy them to your project directory, or use
+e.g. -I/usr/share/dasm/machines/atari2600 to set the include path.
+
+Also provided is "ftohex", which converts an output file in one of
+the three formats to an Intel hex format suitable for many intelligent
+prom programmers (e.g. GTEK).
diff --git a/development/dasm/dasm.SlackBuild b/development/dasm/dasm.SlackBuild
new file mode 100644
index 0000000000000..07cf98723edf8
--- /dev/null
+++ b/development/dasm/dasm.SlackBuild
@@ -0,0 +1,101 @@
+#!/bin/bash
+
+# Slackware build script for dasm
+
+# Written by B. Watson (urchlay@slackware.uk)
+
+# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
+
+cd $(dirname $0) ; CWD=$(pwd)
+
+PRGNAM=dasm
+VERSION=${VERSION:-2.20.14.1}
+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
+
+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
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $PRGNAM-$VERSION
+tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
+cd $PRGNAM-$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 {} \+
+
+# ftohex refs unfile, doubleplusungood.
+sed -i 's,AUTHORS,README,' src/ftohex.c
+
+# Man page really should include this information: -f option's
+# argument is numeric, and it's annoying to have to dig through a PDF
+# to find out what the numbers mean. Also, fix the formatting of lists
+# for -T and -E options, and use the correct path for dasm.pdf under
+# 'see also'... and add a note that that source file must appear first
+# on the command line.
+patch -p1 < $CWD/manpagefix.diff
+
+# Easy build:
+make CFLAGS="$SLKCFLAGS"
+
+# No 'make install', do it manually.
+PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
+mkdir -p $PKG/usr/bin $PKG/usr/man/man1 $PKG/usr/share/$PRGNAM $PKGDOC
+
+install -s bin/* $PKG/usr/bin
+gzip -9c < docs/$PRGNAM.1 > $PKG/usr/man/man1/$PRGNAM.1.gz
+
+# The PDF doc does not mention ftohex, and there's no man page for it...
+gzip -9c < $CWD/ftohex.1 > $PKG/usr/man/man1/ftohex.1.gz
+
+cp -a README ChangeLog NEWS LICENSE docs/*.{pdf,txt} $PKGDOC
+cp -a machines $PKG/usr/share/$PRGNAM
+
+# Include ancient (ca 2000) copy of vcs.h, for assembling older sources
+# such as Thomas Jentzsch's River Raid reverse-engineering.
+cat $CWD/vcs.h.old > $PKG/usr/share/$PRGNAM/machines/atari2600/vcs.h.old
+cat $CWD/vcs-old.txt > $PKGDOC/vcs-old.txt
+
+# This belongs in the doc dir, too:
+ln -s ../../share/$PRGNAM/machines/channel-f/README $PKGDOC/channel-f.txt
+
+cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
diff --git a/development/dasm/dasm.info b/development/dasm/dasm.info
new file mode 100644
index 0000000000000..ec86e00a8016d
--- /dev/null
+++ b/development/dasm/dasm.info
@@ -0,0 +1,10 @@
+PRGNAM="dasm"
+VERSION="2.20.14.1"
+HOMEPAGE="https://dasm-assembler.github.io/"
+DOWNLOAD="https://github.com/dasm-assembler/dasm/archive/2.20.14.1/dasm-2.20.14.1.tar.gz"
+MD5SUM="315b70803f2831a6ca54a47da9aae745"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+REQUIRES=""
+MAINTAINER="B. Watson"
+EMAIL="urchlay@slackware.uk"
diff --git a/development/dasm/ftohex.1 b/development/dasm/ftohex.1
new file mode 100644
index 0000000000000..85aff49ac214e
--- /dev/null
+++ b/development/dasm/ftohex.1
@@ -0,0 +1,82 @@
+.\" 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 "FTOHEX" 1 "2022-09-29" "2.20.14.1" "SlackBuilds.org"
+.SH NAME
+ftohex \- convert dasm output files to intel hex format
+.\" RST source for ftohex(1) man page. Convert with:
+.
+.\" rst2man.py ftohex.rst > ftohex.1
+.
+.\" rst2man.py comes from the SBo development/docutils package.
+.
+.SH SYNOPSIS
+.sp
+ftohex \fIformat\fP \fIinfile\fP [\fIoutfile\fP]
+.SH DESCRIPTION
+.sp
+\fBftohex\fP converts a binary file produced by \fBdasm\fP(1) to an Intel
+\&.HEX file, which may be useful as input to an EPROM programmer.
+.sp
+\fIformat\fP is required, and must match the \fB\-f\fP option given to
+\fBdasm\fP to produce the file. Format \fI3\fP is a raw binary image, which
+need not have been produced by \fBdasm\fP\&. Format \fI1\fP is \fBdasm\fP\(aqs default,
+if no \fB\-f\fP was given.
+.sp
+\fIinfile\fP is required; there\(aqs no option to read from \fBstdin\fP, but you
+might try \fB/dev/stdin\fP if that\(aqs supported on your OS.
+.sp
+If \fIoutfile\fP is given, .HEX output will be written to it. Otherwise, the output
+is written to \fBstdout\fP\&.
+.SH EXAMPLE
+.INDENT 0.0
+.INDENT 3.5
+.sp
+.nf
+.ft C
+dasm example.asm \-f2 \-oexample.out
+ftohex 2 example.out example.hex
+.ft P
+.fi
+.UNINDENT
+.UNINDENT
+.SH COPYRIGHT
+.sp
+See the file /usr/doc/dasm\-2.20.14.1/LICENSE for license information.
+.SH AUTHORS
+.sp
+\fBftohex\fP is written and maintained by the DASM team and its contributors.
+.sp
+This man page written for the SlackBuilds.org project
+by B. Watson, and is licensed under the WTFPL.
+.SH SEE ALSO
+.sp
+\fBdasm\fP(1)
+.\" Generated by docutils manpage writer.
+.
diff --git a/development/dasm/ftohex.rst b/development/dasm/ftohex.rst
new file mode 100644
index 0000000000000..e0519963c0de1
--- /dev/null
+++ b/development/dasm/ftohex.rst
@@ -0,0 +1,67 @@
+.. RST source for ftohex(1) man page. Convert with:
+.. rst2man.py ftohex.rst > ftohex.1
+.. rst2man.py comes from the SBo development/docutils package.
+
+.. |version| replace:: 2.20.14.1
+.. |date| date::
+
+======
+ftohex
+======
+
+---------------------------------------------
+convert dasm output files to intel hex format
+---------------------------------------------
+
+:Manual section: 1
+:Manual group: SlackBuilds.org
+:Date: |date|
+:Version: |version|
+
+SYNOPSIS
+========
+
+ftohex *format* *infile* [*outfile*]
+
+DESCRIPTION
+===========
+
+**ftohex** converts a binary file produced by **dasm**\(1) to an Intel
+.HEX file, which may be useful as input to an EPROM programmer.
+
+*format* is required, and must match the **-f** option given to
+**dasm** to produce the file. Format *3* is a raw binary image, which
+need not have been produced by **dasm**. Format *1* is **dasm**'s default,
+if no **-f** was given.
+
+*infile* is required; there's no option to read from **stdin**, but you
+might try **/dev/stdin** if that's supported on your OS.
+
+If *outfile* is given, .HEX output will be written to it. Otherwise, the output
+is written to **stdout**.
+
+EXAMPLE
+=======
+
+::
+
+ dasm example.asm -f2 -oexample.out
+ ftohex 2 example.out example.hex
+
+COPYRIGHT
+=========
+
+See the file /usr/doc/dasm-|version|/LICENSE for license information.
+
+AUTHORS
+=======
+
+**ftohex** is written and maintained by the DASM team and its contributors.
+
+This man page written for the SlackBuilds.org project
+by B. Watson, and is licensed under the WTFPL.
+
+SEE ALSO
+========
+
+**dasm**\(1)
diff --git a/development/dasm/manpagefix.diff b/development/dasm/manpagefix.diff
new file mode 100644
index 0000000000000..5e35a7a1b00c7
--- /dev/null
+++ b/development/dasm/manpagefix.diff
@@ -0,0 +1,53 @@
+diff -Naur dasm-2.20.14.1/docs/dasm.1 dasm-2.20.14.1.patched/docs/dasm.1
+--- dasm-2.20.14.1/docs/dasm.1 2020-11-09 16:50:22.000000000 -0500
++++ dasm-2.20.14.1.patched/docs/dasm.1 2022-09-29 11:35:53.562786259 -0400
+@@ -16,12 +16,22 @@
+ \fBdasm\fP is a versatile macro assembler with support for several
+ 8\-bit microprocessors including MOS 6502 & 6507; Motorola 6803, 68705,
+ and 68HC11; Hitachi HD6303 (extended Motorola 6801) and Fairchild F8.
++.PP
++\fBNote:\fP The source filename \fImust\fP be given as the first
++argument; this is unlike most assemblers and compilers.
+ .SH OPTIONS
+ \fBdasm\fP supports the following options, briefly described below.
+ For more information see the \fBdasm\fP \fITechnical Reference Manual\fP.
+ .TP
+ .BI \-f #
+ output format 1\-3 [default: \fI1\fP]
++.RS
++.IR 1 " = \fB2-byte header; rest is data\fP"
++.br
++.IR 2 " = \fBRandom Access Segments (see dasm.pdf)\fP"
++.br
++.IR 3 " = \fBRaw (no headers/segments; just code)\fP"
++.RE
+ .TP
+ .BI \-o name
+ output file name [default: \fIa.out\fP]
+@@ -57,6 +67,7 @@
+ symbol table sorting [default: \fI0\fP]
+ .RS
+ .IR 0 " = \fBalphabetical\fP"
++.br
+ .IR 1 " = \fBaddress/value\fP"
+ .RE
+ .TP
+@@ -64,7 +75,9 @@
+ error format [default: \fI0\fP]
+ .RS
+ .IR 0 " = \fBMS\fP"
++.br
+ .IR 1 " = \fBDillon\fP"
++.br
+ .IR 2 " = \fBGNU\fP"
+ .RE
+ .TP
+@@ -78,7 +91,7 @@
+ maximum allowed file-size in kB
+ .SH SEE ALSO
+ .TP
+-.IR /usr/share/doc/dasm/dasm.pdf :
++.IR /usr/doc/dasm-2.20.14.1/dasm.pdf :
+ .B dasm Technical Reference Manual
+ .SH AUTHOR
+ Written and maintained by the DASM team and its contributors.
diff --git a/development/dasm/slack-desc b/development/dasm/slack-desc
new file mode 100644
index 0000000000000..26d358b7295e6
--- /dev/null
+++ b/development/dasm/slack-desc
@@ -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 ':' except on otherwise blank lines.
+
+ |-----handy-ruler------------------------------------------------------|
+dasm: dasm (cross assembler for 6502 and other 8-bit CPUs)
+dasm:
+dasm: DASM is versatile macro assembler with support for several 8-bit
+dasm: microprocessors including MOS 6502 & 6507; Motorola 6803, 68705, and
+dasm: 68HC11; Hitachi HD6303 (extended Motorola 6801) and Fairchild F8.
+dasm:
+dasm: DASM also includes platform support for the Atari 2600, Atari 7800,
+dasm: and Fairchild Channel F game consoles.
+dasm:
+dasm:
+dasm:
diff --git a/development/dasm/vcs-old.txt b/development/dasm/vcs-old.txt
new file mode 100644
index 0000000000000..fe7cf332d0ad8
--- /dev/null
+++ b/development/dasm/vcs-old.txt
@@ -0,0 +1,10 @@
+Around 2003, the Atari 2600 vcs.h file changed greatly, in ways that
+make it somewhat incompatible with the older vcs.h. For instance,
+Thomas Jentzsch's River Raid commented source no longer assembles
+correctly with the new vcs.h.
+
+If you need it, there's a copy of the old vcs.h from around 2000 included
+in the dasm package as: /usr/share/dasm/machines/atari2600/vcs.h.old
+
+New projects should use the new vcs.h; the old one exists only for
+backwards compatibility with old sources.
diff --git a/development/dasm/vcs.h.old b/development/dasm/vcs.h.old
new file mode 100644
index 0000000000000..dbddf057b34a9
--- /dev/null
+++ b/development/dasm/vcs.h.old
@@ -0,0 +1,158 @@
+;
+; VCS system equates
+;
+; Vertical blank registers
+;
+VSYNC = $00
+;VS_Enable = 2
+;
+VBLANK = $01
+;VB_Enable = 2
+;VB_Disable = 0
+;VB_LatchEnable = 64
+;VB_LatchDisable = 0
+;VB_DumpPots = 128
+; I don't know a good name to un-dump the pots,
+; at least that makes sense.
+
+WSYNC = $02
+RSYNC = $03 ;for sadists
+;
+; Size registers for players and missiles
+;
+NUSIZ0 = $04
+NUSIZ1 = $05
+;P_Single = 0
+;P_TwoClose = 1
+;P_TwoMedium = 2
+;P_ThreeClose = 3
+;P_TwoFar = 4
+;P_Double = 5
+;P_ThreeMedium = 6
+;P_Quad = 7
+
+;M_Single = $00
+;M_Double = $10
+;M_Quad = $20
+;M_Oct = $40
+
+;
+; Color registers
+;
+COLUP0 = $06
+COLUP1 = $07
+COLUPF = $08
+COLUBK = $09
+
+;
+; Playfield Control
+;
+CTRLPF = $0A
+;PF_Reflect = $01
+;PF_Score = $02
+;PF_Priority = $04
+; Use missile equates to set ball width.
+
+REFP0 = $0B
+REFP1 = $0C
+;P_Reflect = $08
+
+PF0 = $0D
+PF1 = $0E
+PF2 = $0F
+RESP0 = $10
+RESP1 = $11
+RESM0 = $12
+RESM1 = $13
+RESBL = $14
+AUDC0 = $15
+AUDC1 = $16
+AUDF0 = $17
+AUDF1 = $18
+AUDV0 = $19
+AUDV1 = $1A ;duh
+
+;
+; Players
+;
+GRP0 = $1B
+GRP1 = $1C
+
+;
+; Single-bit objects
+;
+ENAM0 = $1D
+ENAM1 = $1E
+ENABL = $1F
+;M_Enable = 2
+
+HMP0 = $20
+HMP1 = $21
+HMM0 = $22
+HMM1 = $23
+HMBL = $24
+
+; Miscellaneous
+VDELP0 = $25
+VDEL01 = $26
+VDELP1 = $26
+VDELBL = $27
+RESMP0 = $28
+RESMP1 = $29
+HMOVE = $2A
+HMCLR = $2B
+CXCLR = $2C
+CXM0P = $30
+CXM1P = $31
+CXP0FB = $32
+CXP1FB = $33
+CXM0FB = $34
+CXM1FB = $35
+CXBLPF = $36
+CXPPMM = $37
+INPT0 = $38
+INPT1 = $39
+INPT2 = $3A
+INPT3 = $3B
+INPT4 = $3C
+INPT5 = $3D
+
+;
+; Switch A equates.
+;
+; There are more elegant ways than using all eight of these. :-)
+;
+SWCHA = $0280
+;J0_Right = $80
+;J0_Left = $40
+;J0_Down = $20
+;J0_Up = $10
+;J1_Right = $08
+;J1_Left = $04
+;J1_Down = $02
+;J1_up = $01
+;
+; Switch B equates
+;
+SWCHB = $0282
+;P0_Diff = $80
+;P1_Diff = $40
+;Con_Color = $08
+;Con_Select = $02
+;Con_Start = $01
+
+;
+; Switch Control
+;
+SWACNT = $281
+SWBCNT = $283
+
+;
+; Timer
+;
+INTIM = $0284
+TIM1T = $0294
+TIM8T = $0295
+TIM64T = $0296
+TIM1024T = $0297
+