From 2d044bfe809be2fb02ae5aa8540cd57f7af407a1 Mon Sep 17 00:00:00 2001 From: Jason Self Date: Sat, 25 Nov 2017 21:34:10 -0800 Subject: [PATCH 1/1] Importing a56 version 1.3 from http://www.zdomain.com/a56.html. Copyright of examples is not clear so I removed them. --- Makefile | 116 +++ README-1.1 | 143 ++++ README-1.2 | 169 +++++ README-1.3 | 145 ++++ a56.h | 94 +++ a56.key | 193 +++++ a56.y | 2114 ++++++++++++++++++++++++++++++++++++++++++++++++++++ frac2int.c | 118 +++ getopt.c | 129 ++++ keybld.c | 231 ++++++ lex.c | 477 ++++++++++++ main.c | 467 ++++++++++++ subs.c | 165 ++++ tok.awk | 4 + toktab.c | 131 ++++ toomf.c | 60 ++ torom.c | 70 ++ 17 files changed, 4826 insertions(+) create mode 100644 Makefile create mode 100644 README-1.1 create mode 100644 README-1.2 create mode 100644 README-1.3 create mode 100644 a56.h create mode 100644 a56.key create mode 100644 a56.y create mode 100644 frac2int.c create mode 100644 getopt.c create mode 100644 keybld.c create mode 100644 lex.c create mode 100644 main.c create mode 100644 subs.c create mode 100644 tok.awk create mode 100644 toktab.c create mode 100644 toomf.c create mode 100644 torom.c diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..fc5b25d --- /dev/null +++ b/Makefile @@ -0,0 +1,116 @@ +####################################################### +# +# a56 - a DSP56001 assembler +# +# Written by Quinn C. Jensen +# July 1990 +# +####################################################### + +# environment definitions +# uncomment the ones you like + +# generic unix +CC = cc +HOSTCC = cc +YACC = yacc +CCDEFS = -DLDEBUG +MV = mv +YTABC = y.tab.c +YTABH = y.tab.h +POSTPROCESS = echo + +# gcc & bison +#CC = gcc +#HOSTCC = gcc +#YACC = bison -y +#CCDEFS = +#MV = mv +#YTABC = y.tab.c +#YTABH = y.tab.h +#POSTPROCESS = echo + +# Delorie's DOS gcc (from ftp://omnigate.clarkson.edu/pub/msdos/djgpp) +#CC = gcc +#HOSTCC = gcc +#YACC = bison -y +#CCDEFS = +#MV = ren +#YTABC = y_tab.c +#YTABH = y_tab.h +#POSTPROCESS = coff2exe + +# gcc cross-compile to go32 environment +#CC = i386-go32-gcc +#HOSTCC = cc +#YACC = yacc +#CCDEFS = +#MV = mv +#YTABC = y.tab.c +#YTABH = y.tab.h +#POSTPROCESS = echo + +####################################################### + +# -O or -g +#DEBUG = -O -Olimit 3000 +DEBUG = -O + +SRCS = main.c a56.y lex.c subs.c getopt.c kparse.key +OBJS = main.o gram.o lex.o toktab.o subs.o getopt.o kparse.o + +DEFINES = $(CCDEFS) +#DEFINES = -DYYDEBUG -DLDEBUG $(CCDEFS) + +CFLAGS = $(DEBUG) $(DEFINES) + +all: keybld a56 toomf + +a56: $(OBJS) + $(CC) $(CFLAGS) -o a56 $(OBJS) -lm + @$(POSTPROCESS) a56 + +keybld: keybld.o ksubs.o + $(HOSTCC) $(CFLAGS) -o keybld keybld.o ksubs.o + @$(POSTPROCESS) keybld + +keybld.o: keybld.c + $(HOSTCC) $(CFLAGS) -c keybld.c + +ksubs.o: subs.c + $(HOSTCC) $(CFLAGS) -c subs.c + $(MV) subs.o ksubs.o + +lex.o: lex.c gram.h + +kparse.c: a56.key keybld + keybld < a56.key > kparse.c + +gram.c gram.h: a56.y + @echo "[expect 2 shift/reduce conflicts here]" + $(YACC) -d a56.y + $(MV) $(YTABC) gram.c + $(MV) $(YTABH) gram.h + +toktab.c: gram.h + awk -f tok.awk < gram.h > toktab.c + +y.output: a56.y + $(YACC) -v a56.y + +toomf: toomf.o + $(CC) -o toomf $(CFLAGS) toomf.o + @$(POSTPROCESS) toomf + +torom: torom.o subs.o + $(CC) -o torom $(CFLAGS) torom.o subs.o + +tape: toktab.c + csh -c 'tar cvbf 1 - `cat files` | gzip > a56.tar.gz' + +main.o gram.o lex.o: a56.h + +clean: ; rm -f a56 toomf y.output *.o *.out tmp *.bak a56.tar.gz keybld + +spotless: clean + rm -f gram.c lexyy.c gram.h toktab.c kparse.c diff --git a/README-1.1 b/README-1.1 new file mode 100644 index 0000000..daf3194 --- /dev/null +++ b/README-1.1 @@ -0,0 +1,143 @@ + + a56 - a DSP56001 assembler - version 1.1 + +/* + * Copyright (C) 1990-1992 Quinn C. Jensen + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. The author makes no representations + * about the suitability of this software for any purpose. It is + * provided "as is" without express or implied warranty. + * + */ + +V1.1 CHANGES + +Many thanks to Tom Cunningham at Motorola who noted several bugs, fixing +most of them. Thanks also to Stephen Edwards at CalTech for his fixes as well. +Both he and Tom fixed up the XY parallel move code; I believe all the +fixes are integrated. + +Summary of changes since v1.0: + + - Jcc, JScc, Tcc recognizes "CC" synonym for "HS" (Tom) + - LUA syntax fixed (Tom, Stephen) + - DIV syntax fixed (Tom) + - XY move fixed (Tom, Stephen) + - a56 now detects phase errors (changes in symbol values + between pass 1 and 2) + - several causes of phase errors fixed + - immediate value handling improved for both integer and + fixed-point values + - symbols have type (INT or FLOAT) + - cpp droppings are properly handled + - ALIGN pseudo-op added + +Known bugs/deficiencies: + + - MOVE to a control reg generates bogus code (always use MOVEC, + MOVEM, and MOVEP) + +The example code has been cleaned up a bit and I've included my +56K board's envelope code - tdsg.basic.a56. This code is specific to +my implimentation. + +A note on the reverb code - I have since found since posting version 1.0 +that the reverb code has a great-big almost-DC bumb in its impulse +response. I found this after doing some simulations. I suspected something +was wrong because I had to scale the output of the comb filters by .046 +or something before going into the two all-pass stages. Overall I think it +works better without the 1.7 ms all-pass. There's another reverb example +on Dr. Bubb that fits Moorer's 1979 model better. I've included this in +the examples but I have not yet assembled or tried it. + +OVERVIEW + +This program was written as a vehicle to learn the intricacies +of the DSP56001 instruction set, and to provide a tool for Unix-based +DSP code development (for those of us without a NeXT machine.) + +The intent was to provide compatibility with Motorola assembler's syntax. +But since the author did not have Motorola's assembler or its documentation, +it is no doubt far from compatible. Only a few pseudo-ops are implemented-- +probably only partially. + +Macros are not supported, except through the use of an external macro +preprocessor, such as /lib/cpp. To facilitate cpp macro expansion, multiple +assembler statements on a single input line are delimited with an '@', e.g.: + + #define JCHEQ(c,label) move #c,x0 @cmp x0,a @jeq label + + #define JCHNE(c,label) move #c,x0 @cmp x0,a @jne label + + +SUPPORTED PSEUDO-OPS + +The following is a list of the pseudo-ops that are recognized: + + = ;assign a symbol + + ALIGN ;set location pointer + ;to next integral + ;multiple of + + ORG ;new location pointer + ORG , + + DC ;declare constants + + PAGE , , , ;ignored + + INCLUDE ;file inclusion + + END ;end + +In addition, a "PSECT" pseudo-op was implemented. It allows program sections +to be defined and bopped in and out of, each with its own location counter and +space. The Motorola assembler probably does not have this pseudo-op, but no +doubt supports the concept in some way. + + PSECT : ;define + + PSECT ;switch to psect + + +FUTURE DIRECTION + +The assembler probably generates bogus code here and there, and no doubt +does not handle all of the syntax. I welcome all comments, fixes and +enhancements. + +TO MAKE AND USE + +Type "make". gram.c and lex.yy.c are provided for those without yacc +(or bison) and/or lex. + +The resulting program, a56, is used as follows: + + a56 [-b] [-l] [-o output-file] file [...] + +An assembler listing is sent to the standard-output and an ascii-formatted +object file (a56.out) is produced. The "-b" option adds binary to the listing. +"-l" causes included files to be listed. "-o" directs the output to the +specified file rather than the default, a56.out. + +A separate program, toomf, converts a56.out into "OMF" format suitable for +downloading to the 56001 via the sloader.a56 program. + + toomf < a56.out > file.omf + +AUTHOR + +11/28/91 +v1.1 8/6/92 + +Quinn C. Jensen +1374 N 40 E +Orem, UT 84057 + +home: jensenq@zdomain.com (preferred address for a56 correspondence) +work: jensenq@novell.com diff --git a/README-1.2 b/README-1.2 new file mode 100644 index 0000000..682e499 --- /dev/null +++ b/README-1.2 @@ -0,0 +1,169 @@ + + a56 - a DSP56001 assembler - version 1.2 + +/* + * Copyright (C) 1990-1994 Quinn C. Jensen + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. The author makes no representations + * about the suitability of this software for any purpose. It is + * provided "as is" without express or implied warranty. + * + */ + +V1.2 CHANGES + +Contributors to V1.2 - + + Andreas Gustafsson + - Added DS and DSM directives + - Generalization of the use of "*" allowing current program counter + to be used in any expression (including "org l:*" which is useful + for changing spaces without changing the PC) + - Noted a bug with MOVEP to a non-symbolic I/O address. I believe + this is now fixed. + - Noted that mispelled argumentless operators will be treated as + labels. For example, N0P (N-zero-P) will be treated as a label. + Unfortunately, my own use of a56 (i.e. using cpp as the macro + pre-processor) complicates this. However, the grammar might + have been simpler if the lexical analyzer was able to distinguish + between label declarations and references instead of leaving that + up to the YACC parser. + + Tim Channon and Peter Breuer + + - Missing ";" in grammar! + + Rober Ganter + - Fixed bad comment on line 10 of a56.y + + Me + - Listing now includes psect usage summary + - Better checking of movec arguments + - Added int(value) function to convert floating point constant expression + to integer (by truncation) + - Correctly convert a floating -1.0 to 0x800000 + - Wrote a new lexical analyzer and lexical parser generator + - Many other minor enhancements and fixes. + - Ported to DOS using DJ Delories' GCC port. (Tools available at + ftp://omnigate.clarkson.edu/pub/msdos/djgpp) + +Known bugs/deficiencies: + + - MOVE to a control reg generates bogus code (always use MOVEC, + MOVEM, and MOVEP) + +The example code this time around includes a full six-comb stereo reverb +(based on Moorer). This one sounds a lot better than the four-comb algorithm. +Each comb uses a one-pole low-pass filter in the loop. It lacks the +early-reflection FIR (although Motorola's rvb2.asm has it) but has +true stereo decorrelation by using a twin allpass stage. My old reverb +just used inversion to simulate stereo (the whole reverb effect would +disappear if you mixed the outputs). I've included only actual reverb +code itself. It lacks the hardware-implementation-specific shell. + + +--------------------------------------------------------------------------- + +OVERVIEW + +This program was written as a vehicle to learn the intricacies +of the DSP56001 instruction set, and to provide a tool for Unix-based +DSP code development (for those of us without a NeXT machine.) + +The intent was to provide compatibility with Motorola assembler's syntax. +But since the author did not have Motorola's assembler or its documentation, +it is no doubt far from compatible. Only a few pseudo-ops are implemented-- +probably only partially. + +Macros are not supported, except through the use of an external macro +preprocessor, such as /lib/cpp. To facilitate cpp macro expansion, multiple +assembler statements on a single input line are delimited with an '@', e.g.: + + #define JCHEQ(c,label) move #c,x0 @cmp x0,a @jeq label + + #define JCHNE(c,label) move #c,x0 @cmp x0,a @jne label + + +SUPPORTED PSEUDO-OPS + +The following is a list of the pseudo-ops that are recognized: + + = ;assign a symbol +