//
// RMAC - Reboot's Macro Assembler for all Atari computers
// 6502.C - 6502 Assembler
-// Copyright (C) 199x Landon Dyer, 2011-2018 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2019 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// Source utilised with the kind permission of Landon Dyer
//
{
// (foo,x)
tok++;
+#if 0
p = string[tok[1]];
// Sleazo tolower() -----------------vvvvvvvvvvv
goto badmode;
tok += 2;
-
if (*tok++ != ')')
goto badmode;
amode = A65_INDX;
+#else
+ if (tok[0] == KW_X)
+ amode = A65_INDX;
+
+ if ((tok[1] != ')') || (tok[2] != EOL))
+ goto badmode;
+
+ tok += 2;
+#endif
}
else
goto badmode;
break;
+ // I'm guessing that the form of this is @<expr>(X) or @<expr>(Y), which
+ // I've *never* seen before. :-/
case '@':
tok++;
if (*tok == '(')
{
tok++;
+#if 0
p = string[tok[1]];
if (*tok != SYMBOL || p[1] != EOS || tok[2] != ')' || tok[3] != EOL)
goto badmode;
tok += 3; // Past SYMBOL <string> ')' EOL
+#else
+ if ((tok[1] != ')') || (tok[2] != EOL))
+ goto badmode;
+
+ if (tok[0] == KW_X)
+ amode = A65_INDX;
+ else if (tok[0] == KW_Y)
+ amode = A65_INDY;
+ else
+ goto badmode;
+
+ tok += 2;
+#endif
zpreq = 1; // Request zeropage optimization
}
else if (*tok == EOL)
//
// RMAC - Reboot's Macro Assembler for all Atari computers
// 6502.H - 6502 assembler
-// Copyright (C) 199x Landon Dyer, 2011-2018 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2019 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// Source utilised with the kind permission of Landon Dyer
//
//
// RMAC - Reboot's Macro Assembler for all Atari computers
// 68KGEN.C - Tool to Generate 68000 Opcode Table
-// Copyright (C) 199x Landon Dyer, 2011-2018 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2019 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// Source utilised with the kind permission of Landon Dyer
//
//
// RMAC - Reboot's Macro Assembler for all Atari computers
// AMODE.C - Addressing Modes
-// Copyright (C) 199x Landon Dyer, 2011-2018 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2019 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// Source utilised with the kind permission of Landon Dyer
//
//
// RMAC - Reboot's Macro Assembler for all Atari computers
// AMODE.H - Addressing Modes
-// Copyright (C) 199x Landon Dyer, 2011-2018 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2019 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// Source utilised with the kind permission of Landon Dyer
//
//
// RMAC - Reboot's Macro Assembler for all Atari computers
// DEBUG.C - Debugging Messages
-// Copyright (C) 199x Landon Dyer, 2011-2018 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2019 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// Source utilised with the kind permission of Landon Dyer
//
//
// RMAC - Reboot's Macro Assembler for all Atari computers
// DEBUG.H - Debugging Messages
-// Copyright (C) 199x Landon Dyer, 2011-2018 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2019 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// Source utilised with the kind permission of Landon Dyer
//
//
// RMAC - Reboot's Macro Assembler for all Atari computers
// DIRECT.C - Directive Handling
-// Copyright (C) 199x Landon Dyer, 2011-2018 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2019 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// Source utilised with the kind permission of Landon Dyer
//
while (*tok != EOL)
{
- switch(*tok)
+ switch (*tok)
{
case STRING:
sprintf(prntstr, "%s", string[tok[1]]);
{
strcpy(prntstr, string[tok[2]]);
- switch(prntstr[0])
+ switch (prntstr[0])
{
case 'l': case 'L': wordlong = 1; break;
case 'w': case 'W': wordlong = 0; break;
//
// RMAC - Reboot's Macro Assembler for all Atari computers
// DIRECT.H - Directive Handling
-// Copyright (C) 199x Landon Dyer, 2011-2018 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2019 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// Source utilised with the kind permission of Landon Dyer
//
//
// RMAC - Reboot's Macro Assembler for all Atari computers
// DSP56K.C - General DSP56001 routines
-// Copyright (C) 199x Landon Dyer, 2011-2017 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2019 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// Source utilised with the kind permission of Landon Dyer
//
//
// RMAC - Reboot's Macro Assembler for all Atari computers
// DSP56K.H - General DSP56001 routines
-// Copyright (C) 199x Landon Dyer, 2011-2017 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2019 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// Source utilised with the kind permission of Landon Dyer
//
//
// RMAC - Reboot's Macro Assembler for the Atari Jaguar Console System
// AMODE.C - DSP 56001 Addressing Modes
-// Copyright (C) 199x Landon Dyer, 2011 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2019 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// Source utilised with the kind permission of Landon Dyer
//
return ERROR;
- // If caller wants only one mode, return just one (ignore comma);
+ // If caller wants only one mode, return just one (ignore comma);
// If there is no second addressing mode (no comma), then return just one anyway.
nmodes = 1;
//
// RMAC - Reboot's Macro Assembler for the Atari Jaguar Console System
// DSP56K_AMODE.H - Addressing Modes for Motorola DSP56001
-// Copyright (C) 199x Landon Dyer, 2011 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2019 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// Source utilised with the kind permission of Landon Dyer
//
//
// RMAC - Reboot's Macro Assembler for the Atari Jaguar Console System
// DSP56L_MACH.C - Code Generation for Motorola DSP56001
-// Copyright (C) 199x Landon Dyer, 2011-2018 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2019 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// Source utilised with the kind permission of Landon Dyer
//
{
if (deposit_extra_ea == DEPOSIT_EXTRA_WORD)
{
- if (!(dspImmedEXATTR&FLOAT))
+ if (!(dspImmedEXATTR & FLOAT))
{
if (dspImmedEXATTR & DEFINED)
{
//
// RMAC - Reboot's Macro Assembler for the Atari Jaguar Console System
// DSP56L_MACH.C - Code Generation for Motorola DSP56001
-// Copyright (C) 199x Landon Dyer, 2011 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2019 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// Source utilised with the kind permission of Landon Dyer
//
//
// RMAC - Reboot's Macro Assembler for all Atari computers
// 68KGEN.C - Tool to Generate 68000 Opcode Table
-// Copyright (C) 199x Landon Dyer, 2011-2018 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2019 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// Source utilised with the kind permission of Landon Dyer
//
//
// RMAC - Reboot's Macro Assembler for all Atari computers
// EAGEN.C - Effective Address Code Generation
-// Copyright (C) 199x Landon Dyer, 2011-2018 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2019 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// Source utilised with the kind permission of Landon Dyer
//
//
// RMAC - Reboot's Macro Assembler for all Atari computers
// EAGEN.H - Effective address generation for 68K
-// Copyright (C) 199x Landon Dyer, 2011-2018 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2019 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// Source utilised with the kind permission of Landon Dyer
//
// RMAC - Reboot's Macro Assembler for all Atari computers
// EAGEN0.C - Effective Address Code Generation
// Generated Code for eaN (Included twice by "eagen.c")
-// Copyright (C) 199x Landon Dyer, 2011-2018 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2019 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// Source utilised with the kind permission of Landon Dyer
//
//
// RMAC - Reboot's Macro Assembler for all Atari computers
// ERROR.C - Error Handling
-// Copyright (C) 199x Landon Dyer, 2011-2018 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2019 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// Source utilised with the kind permission of Landon Dyer
//
//
// RMAC - Reboot's Macro Assembler for all Atari computers
// ERROR.H - Error Handling
-// Copyright (C) 199x Landon Dyer, 2011-2018 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2019 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// Source utilised with the kind permission of Landon Dyer
//
//
// RMAC - Reboot's Macro Assembler for all Atari computers
// EXPR.C - Expression Analyzer
-// Copyright (C) 199x Landon Dyer, 2011-2018 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2019 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// Source utilised with the kind permission of Landon Dyer
//
//
// RMAC - Reboot's Macro Assembler for all Atari computers
// EXPR.H - Expression Analyzer
-// Copyright (C) 199x Landon Dyer, 2011-2018 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2019 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// Source utilised with the kind permission of Landon Dyer
//
// Floating point to IEEE-754 conversion routines
//
// by James Hammons
-// (C) 2018 Underground Software
+// (C) 2019 Underground Software
//
// Since there are no guarantees vis-a-vis floating point numbers in C, we have
// to utilize routines like the following in order to guarantee that the thing
// Cross-platform floating point handling (fixed point handling too!)
//
// by James Hammons
-// (C) 2018 Underground Software
+// (C) 2019 Underground Software
//
#ifndef __FLTPOINT_H__
//
// RMAC - Reboot's Macro Assembler for all Atari computers
// KWGEN.C - Keyword & Mnemonic Definition and State Machine Creation Tool
-// Copyright (C) 199x Landon Dyer, 2011-2018 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2019 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// Source utilised with the kind permission of Landon Dyer
//
//
// RMAC - Reboot's Macro Assembler for all Atari computers
// LISTING.C - Listing Output
-// Copyright (C) 199x Landon Dyer, 2011-2018 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2019 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// Source utilised with the kind permission of Landon Dyer
//
//
// RMAC - Reboot's Macro Assembler for all Atari computers
// LISTING.H - Listing Output
-// Copyright (C) 199x Landon Dyer, 2011-2018 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2019 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// Source utilised with the kind permission of Landon Dyer
//
//
// RMAC - Reboot's Macro Assembler for all Atari computers
// MACH.C - Code Generation
-// Copyright (C) 199x Landon Dyer, 2011-2018 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2019 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// Source utilised with the kind permission of Landon Dyer
//
//
// RMAC - Reboot's Macro Assembler for all Atari computers
// MACH.H - Code Generation
-// Copyright (C) 199x Landon Dyer, 2011-2018 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2019 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// Source utilised with the kind permission of Landon Dyer
//
//
// RMAC - Reboot's Macro Assembler for all Atari computers
// MACRO.C - Macro Definition and Invocation
-// Copyright (C) 199x Landon Dyer, 2011-2018 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2019 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// Source utilised with the kind permission of Landon Dyer
//
//
// RMAC - Reboot's Macro Assembler for all Atari computers
// MACRO.H - Macro Definition and Invocation
-// Copyright (C) 199x Landon Dyer, 2011-2018 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2019 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// Source utilised with the kind permission of Landon Dyer
//
#
# RMAC - Reboot's Macro Assembler for all Atari computers
-# Copyright (C) 199x Landon Dyer, 2011-2018 Reboot & Friends
+# Copyright (C) 199x Landon Dyer, 2011-2019 Reboot & Friends
# MAKEFILE for *nix
#
//
// RMAC - Reboot's Macro Assembler for all Atari computers
// MARK.C - A record of things that are defined relative to any of the sections
-// Copyright (C) 199x Landon Dyer, 2011-2018 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2019 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// Source utilised with the kind permission of Landon Dyer
//
//
// RMAC - Reboot's Macro Assembler for all Atari computers
// MARK.H - A record of things that are defined relative to any of the sections
-// Copyright (C) 199x Landon Dyer, 2011-2018 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2019 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// Source utilised with the kind permission of Landon Dyer
//
//
// RMAC - Reboot's Macro Assembler for all Atari computers
// OBJECT.C - Writing Object Files
-// Copyright (C) 199x Landon Dyer, 2011-2018 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2019 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// Source utilised with the kind permission of Landon Dyer
//
//
// RMAC - Reboot's Macro Assembler for all Atari computers
// OBJECT.H - Writing Object Files
-// Copyright (C) 199x Landon Dyer, 2011-2018 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2019 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// Source utilised with the kind permission of Landon Dyer
//
// Jaguar Object Processor assembler
//
// by James Hammons
-// (C) 2018 Underground Software
+// (C) 2019 Underground Software
//
#include "op.h"
// Object Processor assembler
//
// by James Hammons
-// (C) 2018 Underground Software
+// (C) 2019 Underground Software
//
#ifndef __OP_H__
//
// RMAC - Reboot's Macro Assembler for all Atari computers
// PARMODE.C - Addressing Modes Parser Include
-// Copyright (C) 199x Landon Dyer, 2011-2018 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2019 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// Source utilised with the kind permission of Landon Dyer
//
//
// RMAC - Reboot's Macro Assembler for all Atari computers
// PROCLN.C - Line Processing
-// Copyright (C) 199x Landon Dyer, 2011-2018 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2019 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// Source utilised with the kind permission of Landon Dyer
//
//
// RMAC - Reboot's Macro Assembler for all Atari computers
// PROCLN.H - Line Processing
-// Copyright (C) 199x Landon Dyer, 2011-2018 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2019 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// Source utilised with the kind permission of Landon Dyer
//
//
// RMAC - Reboot's Macro Assembler for all Atari computers
// RISCA.C - GPU/DSP Assembler
-// Copyright (C) 199x Landon Dyer, 2011-2018 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2019 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// Source utilised with the kind permission of Landon Dyer
//
//
// RMAC - Reboot's Macro Assembler for all Atari computers
// RISCA.H - GPU/DSP Assembler
-// Copyright (C) 199x Landon Dyer, 2011-2018 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2019 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// Source utilised with the kind permission of Landon Dyer
//
//
// RMAC - Reboot's Macro Assembler for all Atari computers
// RMAC.C - Main Application Code
-// Copyright (C) 199x Landon Dyer, 2011-2018 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2019 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// Source utilised with the kind permission of Landon Dyer
//
//
// RMAC - Reboot's Macro Assembler for all Atari computers
// RMAC.H - Main Application Code
-// Copyright (C) 199x Landon Dyer, 2011-2018 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2019 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// Source utilised with the kind permission of Landon Dyer
//
//
// RMAC - Reboot's Macro Assembler for all Atari computers
// SECT.C - Code Generation, Fixups and Section Management
-// Copyright (C) 199x Landon Dyer, 2011-2018 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2019 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// Source utilised with the kind permission of Landon Dyer
//
exprlen = ExpressionLength(fexpr);
}
+ // Second, check to see if it's a DSP56001 fixup, and force the FU_56001
+ // flag into the attributes if so; also save the current org address.
+ if (attr & FUMASKDSP)
+ {
+ attr |= FU_56001;
+ _orgaddr = orgaddr;
+ }
+
// Allocate space for the fixup + any expression
FIXUP * fixup = malloc(sizeof(FIXUP) + (sizeof(TOKEN) * exprlen));
FIXUP * fup = fixup;
fixup = fixup->next;
- uint32_t w = fup->attr; // Fixup long (type + modes + flags)
+ uint32_t dw = fup->attr; // Fixup long (type + modes + flags)
uint32_t loc = fup->loc; // Location to fixup
cfileno = fup->fileno;
curlineno = fup->lineno;
// Compute expression/symbol value and attributes
// Complex expression
- if (w & FU_EXPR)
+ if (dw & FU_EXPR)
{
if (evexpr(fup->expr, &eval, &eattr, &esym) != OK)
continue;
//
// PC-relative fixups must be DEFINED and either in the same section
// (whereupon the subtraction takes place) or ABS (with no subtract).
- if (w & FU_PCREL)
+ if (dw & FU_PCREL)
{
if (eattr & DEFINED)
{
}
}
- if (sbra_flag && (w & FU_LBRA) && (eval + 0x80 < 0x100))
+ if (sbra_flag && (dw & FU_LBRA) && (eval + 0x80 < 0x100))
warn("unoptimized short branch");
}
else if (obj_format == MWC)
}
// Handle fixup classes
- switch (w & FUMASK)
+ switch (dw & FUMASK)
{
// FU_BBRA fixes up a one-byte branch offset.
case FU_BBRA:
continue;
}
- if ((w & FU_PCREL) && ((eval + 0x80) >= 0x100))
+ if ((dw & FU_PCREL) && ((eval + 0x80) >= 0x100))
goto rangeErr;
- if (w & FU_SEXT)
+ if (dw & FU_SEXT)
{
if ((eval + 0x100) >= 0x200)
goto rangeErr;
break;
// Fixup WORD forward references; the word could be unaligned in the
- // section buffer, so we have to be careful.
+ // section buffer, so we have to be careful. (? careful about what?)
case FU_WORD:
- if ((w & FUMASKRISC) == FU_JR)
+ if ((dw & FUMASKRISC) == FU_JR)
{
+#if 0
int reg;
if (fup->orgaddr)
reg = (signed)((eval - (fup->orgaddr + 2)) / 2);
else
reg = (signed)((eval - (loc + 2)) / 2);
+#else
+ int reg = (signed)((eval - ((fup->orgaddr ? fup->orgaddr : loc) + 2)) / 2);
+#endif
if ((reg < -16) || (reg > 15))
{
*locp |= ((uint8_t)reg & 0x07) << 5;
break;
}
- else if ((w & FUMASKRISC) == FU_NUM15)
+ else if ((dw & FUMASKRISC) == FU_NUM15)
{
if (((int)eval < -16) || ((int)eval > 15))
{
*locp |= ((uint8_t)eval & 0x07) << 5;
break;
}
- else if ((w & FUMASKRISC) == FU_NUM31)
+ else if ((dw & FUMASKRISC) == FU_NUM31)
{
if (eval > 31)
{
*locp |= ((uint8_t)eval & 0x07) << 5;
break;
}
- else if ((w & FUMASKRISC) == FU_NUM32)
+ else if ((dw & FUMASKRISC) == FU_NUM32)
{
if ((eval < 1) || (eval > 32))
{
break;
}
- if (w & FU_SUB32)
+ if (dw & FU_SUB32)
eval = (32 - eval);
eval = (eval == 32) ? 0 : eval;
*locp |= ((uint8_t)eval & 0x07) << 5;
break;
}
- else if ((w & FUMASKRISC) == FU_REGONE)
+ else if ((dw & FUMASKRISC) == FU_REGONE)
{
if (eval > 31)
{
*locp |= ((uint8_t)eval & 0x07) << 5;
break;
}
- else if ((w & FUMASKRISC) == FU_REGTWO)
+ else if ((dw & FUMASKRISC) == FU_REGTWO)
{
if (eval > 31)
{
{
flags = MWORD;
- if (w & FU_PCREL)
+ if (dw & FU_PCREL)
flags |= MPCREL;
MarkRelocatable(sno, loc, 0, flags, esym);
if (tdb)
MarkRelocatable(sno, loc, tdb, MWORD, NULL);
- if (w & FU_SEXT)
+ if (dw & FU_SEXT)
{
if (eval + 0x10000 >= 0x20000)
goto rangeErr;
else
{
// Range-check BRA and DBRA
- if (w & FU_ISBRA)
+ if (dw & FU_ISBRA)
{
if (eval + 0x8000 >= 0x10000)
goto rangeErr;
case FU_LONG:
flags = MLONG;
- if ((w & FUMASKRISC) == FU_MOVEI)
+ if ((dw & FUMASKRISC) == FU_MOVEI)
{
// Long constant in MOVEI # is word-swapped, so fix it here
eval = WORDSWAP32(eval);
// Fixup QUAD forward references (mainly used by the OP assembler)
case FU_QUAD:
- if (w & FU_OBJLINK)
+ if (dw & FU_OBJLINK)
{
uint64_t quad = GETBE64(locp, 0);
uint64_t addr = eval;
+//Hmm, not sure how this can be set, since it's only set if it's a DSP56001 fixup or a FU_JR... :-/
if (fup->orgaddr)
addr = fup->orgaddr;
eval = (quad & 0xFFFFFC0000FFFFFFLL) | ((addr & 0x3FFFF8) << 21);
}
- else if (w & FU_OBJDATA)
+ else if (dw & FU_OBJDATA)
{
// If it's in a TEXT or DATA section, be sure to mark for a
// fixup later
uint64_t quad = GETBE64(locp, 0);
uint64_t addr = eval;
+//Hmm, not sure how this can be set, since it's only set if it's a DSP56001 fixup or a FU_JR... :-/
if (fup->orgaddr)
addr = fup->orgaddr;
*locp = (uint8_t)eval;
break;
+ // Fixup DSP56001 addresses
+ case FU_56001:
+ switch (dw & FUMASKDSP)
+ {
+ // DSPIMM5 actually is clamped from 0 to 23 for our purposes
+ // and does not use the full 5 bit range.
+ case FU_DSPIMM5:
+ if (eval > 23)
+ {
+ error("immediate value must be between 0 and 23");
+ break;
+ }
+
+ locp[2] |= eval;
+ break;
+
+ // This is a 12-bit address encoded into the lower 12
+ // bits of a DSP word
+ case FU_DSPADR12:
+ if (eval >= 0x1000)
+ {
+ error("address out of range ($000-$FFF)");
+ break;
+ }
+
+ locp[1] |= eval >> 8;
+ locp[2] = eval & 0xFF;
+ break;
+
+ // This is a full DSP word containing Effective Address Extension
+ case FU_DSPADR24:
+ case FU_DSPIMM24:
+ if (eval >= 0x100000)
+ {
+ error("value out of range ($000-$FFFFFF)");
+ break;
+ }
+
+ *locp++ = (uint32_t)eval >> 16;
+ *locp++ = ((uint32_t)eval >> 8) & 0xFF;
+ *locp++ = (uint32_t)eval & 0xFF;
+ break;
+
+ // This is a 16bit absolute address into a 24bit field
+ case FU_DSPADR16:
+ if (eval >= 0x10000)
+ {
+ error("address out of range ($0000-$FFFF)");
+ break;
+ }
+
+ locp[1] = (uint8_t)(eval >> 8);
+ locp[2] = (uint8_t)eval;
+ break;
+
+ // This is 12-bit immediate short data
+ // The upper nibble goes into the last byte's low nibble
+ // while the remainder 8 bits go into the 2nd byte.
+ case FU_DSPIMM12:
+ if (eval >= 0x1000)
+ {
+ error("immediate out of range ($000-$FFF)");
+ break;
+ }
+
+ locp[1] = (uint8_t)eval;
+ locp[2] |= (uint8_t)(eval >> 8);
+ break;
+
+ // This is 8-bit immediate short data
+ // which goes into the middle byte of a DSP word.
+ case FU_DSPIMM8:
+ if (eval >= 0x100)
+ {
+ error("immediate out of range ($00-$FF)");
+ break;
+ }
+
+ locp[1] = (uint8_t)eval;
+ break;
+
+ // This is a 6 bit absoulte short address. It occupies
+ // the low 6 bits of the middle byte of a DSP word.
+ case FU_DSPADR06:
+ if (eval > 63)
+ {
+ error("address must be between 0 and 63");
+ break;
+ }
+
+ locp[1] |= eval;
+ break;
+
+ // This is a 6 bit absoulte short address. It occupies
+ // the low 6 bits of the middle byte of a DSP word.
+ case FU_DSPPP06:
+ if (eval < 0xFFFFFFC0)
+ {
+ error("address must be between $FFC0 and $FFFF");
+ break;
+ }
+
+ locp[1] |= eval & 0x3F;
+ break;
+
+ // Shamus: I'm pretty sure these don't make any sense...
+ case FU_DSPIMMFL8:
+ warn("FU_DSPIMMFL8 missing implementation\n%s", "And you may ask yourself, \"Self, how did I get here?\"");
+ break;
+
+ case FU_DSPIMMFL16:
+ warn("FU_DSPIMMFL16 missing implementation\n%s", "And you may ask yourself, \"Self, how did I get here?\"");
+ break;
+
+ case FU_DSPIMMFL24:
+ warn("FU_DSPIMMFL24 missing implementation\n%s", "And you may ask yourself, \"Self, how did I get here?\"");
+ break;
+
+ // Bad fixup type--this should *never* happen!
+ default:
+ interror(4);
+ // NOTREACHED
+ }
+ break;
+
// Fixup a 4-byte float
case FU_FLOATSING:
warn("FU_FLOATSING missing implementation\n%s", "And you may ask yourself, \"Self, how did I get here?\"");
//
// RMAC - Reboot's Macro Assembler for all Atari computers
// SECT.H - Code Generation, Fixups and Section Management
-// Copyright (C) 199x Landon Dyer, 2011-2018 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2019 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// Source utilized with the kind permission of Landon Dyer
//
#define FU_6BRA 0x0007 // Fixup 6502-format branch offset
#define FU_BYTEH 0x0008 // Fixup 6502 high byte of immediate word
#define FU_BYTEL 0x0009 // Fixup 6502 low byte of immediate word
-#define FU_QUAD 0x000A // Fixup quad-word (8 bytes)
-#define FU_56001 0x000B // Generic fixup code for all 56001 modes
-#define FU_56001_B 0x000C // Generic fixup code for all 56001 modes (ggn: I have no shame)
+#define FU_QUAD 0x000A // Fixup quad-word (8 bytes, typically OP)
+#define FU_56001 0x000B // Fixup code for all 56001 modes
#define FU_SEXT 0x0010 // Ok to sign extend
#define FU_PCREL 0x0020 // Subtract PC first
#define FU_OBJDATA 0x20000 // Fixup OL data addr (bits 43-63, drop last 3)
// DSP56001 fixups
-// TODO: Sadly we don't have any spare bits left inside a 16-bit word
-// so we use the 2nd nibble as control code and
-// stick $B or $C in the lower nibble - then it's picked up as
-// FU_56001 by the fixup routine and then a second switch
-// selects fixup mode. Since we now have 32 bits, we can fix this!
-// [N.B.: This isn't true anymore, we now have 32 bits! :-P]
-#define FU_DSPIMM5 0x090B // Fixup 5-bit immediate
-#define FU_DSPADR12 0x0A0B // Fixup 12-bit address
-#define FU_DSPADR24 0x0B0B // Fixup 24-bit address
-#define FU_DSPADR16 0x0C0B // Fixup 24-bit address
-#define FU_DSPIMM12 0x0D0B // Fixup 12-bit immediate
-#define FU_DSPIMM24 0x0E0B // Fixup 24-bit immediate
-#define FU_DSPIMM8 0x0F0B // Fixup 8-bit immediate
-#define FU_DSPADR06 0x090C // Fixup 6-bit address
-#define FU_DSPPP06 0x0A0C // Fixup 6 bit pp address
-#define FU_DSPIMMFL8 0x0B0C // Fixup 8-bit immediate float
-#define FU_DSPIMMFL16 0x0C0C // Fixup 16-bit immediate float
-#define FU_DSPIMMFL24 0x0D0C // Fixup 24-bit immediate float
+#define FUMASKDSP 0xF00000 // Mask for DSP56001 fuckups^Wfixups
+#define FU_DSPIMM5 0x100000 // Fixup 5-bit immediate
+#define FU_DSPADR12 0x200000 // Fixup 12-bit address
+#define FU_DSPADR24 0x300000 // Fixup 24-bit address
+#define FU_DSPADR16 0x400000 // Fixup 16-bit address
+#define FU_DSPIMM12 0x500000 // Fixup 12-bit immediate
+#define FU_DSPIMM24 0x600000 // Fixup 24-bit immediate
+#define FU_DSPIMM8 0x700000 // Fixup 8-bit immediate
+#define FU_DSPADR06 0x800000 // Fixup 6-bit address
+#define FU_DSPPP06 0x900000 // Fixup 6 bit pp address
+#define FU_DSPIMMFL8 0xA00000 // Fixup 8-bit immediate float
+#define FU_DSPIMMFL16 0xB00000 // Fixup 16-bit immediate float
+#define FU_DSPIMMFL24 0xC00000 // Fixup 24-bit immediate float
// Chunks are used to hold generated code and fixup records
//
// RMAC - Reboot's Macro Assembler for all Atari computers
// SYMBOL.C - Symbol Handling
-// Copyright (C) 199x Landon Dyer, 2011-2018 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2019 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// Source utilised with the kind permission of Landon Dyer
//
//
// RMAC - Reboot's Macro Assembler for all Atari computers
// SYMBOL.H - Symbol Handling
-// Copyright (C) 199x Landon Dyer, 2011-2018 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2019 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// Source utilised with the kind permission of Landon Dyer
//
//
// RMAC - Reboot's Macro Assembler for all Atari computers
// TOKEN.C - Token Handling
-// Copyright (C) 199x Landon Dyer, 2011-2018 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2019 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// Source utilised with the kind permission of Landon Dyer
//
// to choke on legitimate code... Need to investigate this further
// before changing anything else here!
case CONST:
- sprintf(numbuf, "$%lx", (uint64_t)*tk++);
+// sprintf(numbuf, "$%lx", (uint64_t)*tk++);
+ sprintf(numbuf, "$%" PRIX64, (uint64_t)*tk++);
tk++;
d = numbuf;
break;
//
// RMAC - Reboot's Macro Assembler for all Atari computers
// TOKEN.H - Token Handling
-// Copyright (C) 199x Landon Dyer, 2011-2018 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2019 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// Source utilised with the kind permission of Landon Dyer
//
//
// RMAC - Reboot's Macro Assembler for all Atari computers
// VERSION.H - Version Information
-// Copyright (C) 199x Landon Dyer, 2011-2018 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2019 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// Source utilised with the kind permission of Landon Dyer
//