]> Shamusworld >> Repos - rmac/blobdiff - sect.h
EOY minor update.
[rmac] / sect.h
diff --git a/sect.h b/sect.h
index 58c81ec6be7e5b3164f9b87258609cebeeeb7bbe..14dc65f86b046be347c32592a408f288ef10267f 100644 (file)
--- a/sect.h
+++ b/sect.h
@@ -1,7 +1,7 @@
 //
 // 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-2020 Reboot and Friends
 // RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
 // Source utilized with the kind permission of Landon Dyer
 //
@@ -10,6 +10,7 @@
 #define __SECT_H__
 
 #include "rmac.h"
+#include "riscasm.h"
 
 // Macros to deposit code in the current section (in Big Endian)
 #define D_byte(b)      {chcheck(1);*chptr++=(uint8_t)(b); sloc++; ch_size++; \
@@ -38,7 +39,7 @@
        sloc+=2; ch_size+=2;if(orgactive) orgaddr += 2;}
 
 // Macro for the 56001. Word size on this device is 24 bits wide. I hope that
-// orgaddr += 1 means that the addresses in the device reflect this.
+// orgaddr += 1 means that the addresses in the device reflect this. [A: Yes.]
 #define D_dsp(w)       {chcheck(3);*chptr++=(uint8_t)(w>>16); \
        *chptr++=(uint8_t)(w>>8); *chptr++=(uint8_t)w; \
        sloc+=1; ch_size += 3; if(orgactive) orgaddr += 1; \
@@ -53,7 +54,9 @@
 #define D_ZEROFILL(n)  {chcheck(n); memset(chptr, 0, n); chptr+=n; sloc+=n; \
        ch_size+=n; if (orgactive) orgaddr+=n;}
 
-#define NSECTS       16                        // Max. number of sections
+//OK, this is bad, mmkay? The constants defined in rmac.h are used as indices into an array which means that this was never meant to be defined this way--at least if it was, it was a compromise that has come home to bite us all in the ass.  !!! FIX !!!
+//#define NSECTS       16                      // Max. number of sections
+#define NSECTS       256                       // Max. number of sections
 
 // Tunable (storage) definitions
 #define CH_THRESHOLD    32             // Minimum amount of space in code chunk
 #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, 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_PCRELX    0x1000000 // 030 variant
 #define FU_EXPR      0x0040            // Expression (not symbol) follows
 
 #define FU_GLOBAL    0x0080            // Mark global symbol
 #define FU_DONE      0x8000            // Fixup has been done
 
 // FPU fixups
-// TODO: these are obviously bogus for now!
-#define FU_FLOATSING 0x0D0B            // Fixup 32-bit float
-#define FU_FLOATDOUB 0x0E0B            // Fixup 64-bit float
-#define FU_FLOATEXT  0x0F0B            // Fixup 96-bit float
+#define FU_FLOATSING 0x000D            // Fixup 32-bit float
+#define FU_FLOATDOUB 0x000E            // Fixup 64-bit float
+#define FU_FLOATEXT  0x000F            // Fixup 96-bit float
+
+// OP fixups
+#define FU_OBJLINK   0x10000   // Fixup OL link addr (bits 24-42, drop last 3)
+#define FU_OBJDATA   0x20000   // Fixup OL data addr (bits 43-63, drop last 3)
+
+// DSP56001 fixups
+#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
 #define CHUNK  struct _chunk