a56-1.3+dfsg/0000755000175000017500000000000012054733307012121 5ustar debiandebiana56-1.3+dfsg/subs.c0000555000175000017500000000554405633433717013261 0ustar debiandebian/******************************************************* * * a56 - a DSP56001 assembler * * Written by Quinn C. Jensen * July 1990 * *******************************************************\ /* * 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. * */ static char *Copyright = "Copyright (C) 1990-1994 Quinn C. Jensen"; /* * subs.c - Some subroutines for the assembler. * */ #include "a56.h" #define MAX 1024 char *alloc(); FILE *open_read(file) char *file; { FILE *fp; if(strcmp(file, "-") == 0) fp = stdin; else if ((fp = fopen(file, "r")) == NULL) { perror(file); exit(1); } return fp; } FILE *open_write(file) char *file; { FILE *fp; if ((fp = fopen(file, "w")) == NULL) { perror(file); exit(1); } return fp; } FILE *open_append(file) char *file; { FILE *fp; if ((fp = fopen(file, "a")) == NULL) { perror(file); exit(1); } return fp; } fatal(c, a1, a2, a3, a4, a5, a6, a7, a8) char *c, *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8; { fprintf(stderr, c, a1, a2, a3, a4, a5, a6, a7, a8); exit(1); } #define TABS 8 #define MAX_BUF 256 char tabbuf[MAX_BUF], *untabn(); char *untab(s) /* expand tabs in s */ register char *s; { return untabn(s, TABS); } char *untabn(s, stops) /* expand tabs in s */ register char *s; register int stops; { char *o = s; /* copy input string into buffer to scan while input string is modified */ register char *b = tabbuf; strncpy(b, s, MAX_BUF); /* iterate until the copy of the input string is depleted */ while(*b) { if(*b == '\t') { do *s = ' '; while ((++s - o) % stops); } else { *s = *b; s++; } b++; } /* null terminate the resultant string */ *s = '\0'; return o; } char *alloc(size) int size; { char *p = (char *)malloc(size); if(NOT p) fatal("alloc: insufficient virtual memory to allocate %d bytes\n", size); return p; } #define ascii2n(c) \ ((c) >= 'a' ? (c) - 'a' + 10 : ((c) >= 'A' ? (c) - 'A' + 10 : (c) - '0')) #define valid(c) ((c) >= '0' && (c) <= '9' || \ (c) >= 'A' && (c) <= 'Z' || \ (c) >= 'a' && (c) <= 'z') strtol(s, p, base) register char *s, **p; register int base; { register long result = 0; register int sign = 0; while(*s == ' ' || *s == '\t') s++; if(*s == '-') { s++; sign++; } while(valid(*s)) { register int dig = ascii2n(*s); if(dig >= base) break; result *= base; result += dig; s++; } if(p) *p = s; return sign ? -result : result; } a56-1.3+dfsg/a56.key0000555000175000017500000001315705700326426013236 0ustar debiandebian.code #include "a56.h" .code #include "gram.h" X: {return XMEM;} Y: {return YMEM;} L: {return LMEM;} P: {return PMEM;} A10 {return A10;} A {return AAAA;} B10 {return B10;} B {return BBBB;} AB {return AABB;} BA {return BBAA;} X {return XXXX;} Y {return YYYY;} SR {return SR;} MR {return MR;} CCR {return CCR;} OMR {return OMR;} SP {return SP;} SSH {return SSH;} SSL {return SSL;} LA {return LA;} LC {return LC;} A0 {yylval.ival = 0; return AREG;} A1 {yylval.ival = 1; return AREG;} A2 {yylval.ival = 2; return AREG;} B0 {yylval.ival = 0; return BREG;} B1 {yylval.ival = 1; return BREG;} B2 {yylval.ival = 2; return BREG;} M0 {yylval.ival = 0; return MREG;} M1 {yylval.ival = 1; return MREG;} M2 {yylval.ival = 2; return MREG;} M3 {yylval.ival = 3; return MREG;} M4 {yylval.ival = 4; return MREG;} M5 {yylval.ival = 5; return MREG;} M6 {yylval.ival = 6; return MREG;} M7 {yylval.ival = 7; return MREG;} N0 {yylval.ival = 0; return NREG;} N1 {yylval.ival = 1; return NREG;} N2 {yylval.ival = 2; return NREG;} N3 {yylval.ival = 3; return NREG;} N4 {yylval.ival = 4; return NREG;} N5 {yylval.ival = 5; return NREG;} N6 {yylval.ival = 6; return NREG;} N7 {yylval.ival = 7; return NREG;} R0 {yylval.ival = 0; return RREG;} R1 {yylval.ival = 1; return RREG;} R2 {yylval.ival = 2; return RREG;} R3 {yylval.ival = 3; return RREG;} R4 {yylval.ival = 4; return RREG;} R5 {yylval.ival = 5; return RREG;} R6 {yylval.ival = 6; return RREG;} R7 {yylval.ival = 7; return RREG;} X0 {yylval.ival = 0; return XREG;} X1 {yylval.ival = 1; return XREG;} Y0 {yylval.ival = 0; return YREG;} Y1 {yylval.ival = 1; return YREG;} ABS {return OP_ABS;} ADC {return OP_ADC;} ADD {return OP_ADD;} ADDL {return OP_ADDL;} ADDR {return OP_ADDR;} ASL {return OP_ASL;} ASR {return OP_ASR;} CLR {return OP_CLR;} CMP {return OP_CMP;} CMPM {return OP_CMPM;} DIV {return OP_DIV;} MAC {return OP_MAC;} MACR {return OP_MACR;} MPY {return OP_MPY;} MPYR {return OP_MPYR;} NEG {return OP_NEG;} NORM {return OP_NORM;} RND {return OP_RND;} SBC {return OP_SBC;} SUB {return OP_SUB;} SUBL {return OP_SUBL;} SUBR {return OP_SUBR;} TCC {yylval.cond = 0x0; return OP_TCC;} THS {yylval.cond = 0x0; return OP_TCC;} TGE {yylval.cond = 0x1; return OP_TCC;} TNE {yylval.cond = 0x2; return OP_TCC;} TPL {yylval.cond = 0x3; return OP_TCC;} TNN {yylval.cond = 0x4; return OP_TCC;} TEC {yylval.cond = 0x5; return OP_TCC;} TLC {yylval.cond = 0x6; return OP_TCC;} TGT {yylval.cond = 0x7; return OP_TCC;} TCS {yylval.cond = 0x8; return OP_TCC;} TLO {yylval.cond = 0x8; return OP_TCC;} TLT {yylval.cond = 0x9; return OP_TCC;} TEQ {yylval.cond = 0xA; return OP_TCC;} TMI {yylval.cond = 0xB; return OP_TCC;} TNR {yylval.cond = 0xC; return OP_TCC;} TES {yylval.cond = 0xD; return OP_TCC;} TLS {yylval.cond = 0xE; return OP_TCC;} TLE {yylval.cond = 0xF; return OP_TCC;} TFR {return OP_TFR;} TST {return OP_TST;} AND {return OP_AND;} ANDI {return OP_ANDI;} EOR {return OP_EOR;} LSL {return OP_LSL;} LSR {return OP_LSR;} NOT {return OP_NOT;} OR {return OP_OR;} ORI {return OP_ORI;} ROL {return OP_ROL;} ROR {return OP_ROR;} BCLR {return OP_BCLR;} BSET {return OP_BSET;} BCHG {return OP_BCHG;} BTST {return OP_BTST;} DO {return OP_DO;} ENDDO {return OP_ENDDO;} LUA {return OP_LUA;} MOVE {return OP_MOVE;} MOVEC {return OP_MOVEC;} MOVEM {return OP_MOVEM;} MOVEP {return OP_MOVEP;} INCLUDE {return OP_INCLUDE;} ILLEGAL {return OP_ILLEGAL;} JCC {yylval.cond = 0x0; return OP_JCC;} JHS {yylval.cond = 0x0; return OP_JCC;} JGE {yylval.cond = 0x1; return OP_JCC;} JNE {yylval.cond = 0x2; return OP_JCC;} JPL {yylval.cond = 0x3; return OP_JCC;} JNN {yylval.cond = 0x4; return OP_JCC;} JEC {yylval.cond = 0x5; return OP_JCC;} JLC {yylval.cond = 0x6; return OP_JCC;} JGT {yylval.cond = 0x7; return OP_JCC;} JCS {yylval.cond = 0x8; return OP_JCC;} JLO {yylval.cond = 0x8; return OP_JCC;} JLT {yylval.cond = 0x9; return OP_JCC;} JEQ {yylval.cond = 0xA; return OP_JCC;} JMI {yylval.cond = 0xB; return OP_JCC;} JNR {yylval.cond = 0xC; return OP_JCC;} JES {yylval.cond = 0xD; return OP_JCC;} JLS {yylval.cond = 0xE; return OP_JCC;} JLE {yylval.cond = 0xF; return OP_JCC;} JMP {return OP_JMP;} JCLR {return OP_JCLR;} JSET {return OP_JSET;} JSCC {yylval.cond = 0x0; return OP_JSCC;} JSHS {yylval.cond = 0x0; return OP_JSCC;} JSGE {yylval.cond = 0x1; return OP_JSCC;} JSNE {yylval.cond = 0x2; return OP_JSCC;} JSPL {yylval.cond = 0x3; return OP_JSCC;} JSNN {yylval.cond = 0x4; return OP_JSCC;} JSEC {yylval.cond = 0x5; return OP_JSCC;} JSLC {yylval.cond = 0x6; return OP_JSCC;} JSGT {yylval.cond = 0x7; return OP_JSCC;} JSCS {yylval.cond = 0x8; return OP_JSCC;} JSLO {yylval.cond = 0x8; return OP_JSCC;} JSLT {yylval.cond = 0x9; return OP_JSCC;} JSEQ {yylval.cond = 0xA; return OP_JSCC;} JSMI {yylval.cond = 0xB; return OP_JSCC;} JSNR {yylval.cond = 0xC; return OP_JSCC;} JSES {yylval.cond = 0xD; return OP_JSCC;} JSLS {yylval.cond = 0xE; return OP_JSCC;} JSLE {yylval.cond = 0xF; return OP_JSCC;} JSR {return OP_JSR;} JSCLR {return OP_JSCLR;} JSSET {return OP_JSSET;} NOP {return OP_NOP;} REP {return OP_REP;} RESET {return OP_RESET;} RTI {return OP_RTI;} RTS {return OP_RTS;} STOP {return OP_STOP;} SWI {return OP_SWI;} WAIT {return OP_WAIT;} EQU {return OP_EQU;} ORG {return OP_ORG;} DC {return OP_DC;} DS {return OP_DS;} DSM {return OP_DSM;} INT {return OP_INT;} END {return OP_END;} PAGE {return OP_PAGE;} PSECT {return OP_PSECT;} ALIGN {return OP_ALIGN;} PI {return OP_PI;} SIN {return OP_SIN;} COS {return OP_COS;} TAN {return OP_TAN;} ATAN {return OP_ATAN;} ASIN {return OP_ASIN;} ACOS {return OP_ACOS;} EXP {return OP_EXP;} LN {return OP_LN;} LOG {return OP_LOG;} POW {return OP_POW;} a56-1.3+dfsg/README-1.30000444000175000017500000001202106503772223013274 0ustar debiandebian a56 - a DSP5600X assembler - version 1.3 /* * Copyright (C) 1990-1998 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.3 CHANGES - Added intrinsic transcendental functions for constant literal expressions (pi, sin, cos, tan atan, asin, acos, exp, ln, log, pow) - Added warnings for control register load/use hazards - More sophisticated constant expression evaluation including implicit float/integer conversion. Results of expressions are typed and so formatted in the listing and symbol table. - Various fixes including stray pointers, etc. (Thanks to Dirk Farin farindk@trick.informatik.uni-stuttgart.de) Known bugs/deficiencies: - MOVE to a control reg generates bogus code (always use MOVEC, MOVEM, and MOVEP) Wish list - Add support for new instructions and modes --------------------------------------------------------------------------- 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