]> Shamusworld >> Repos - rmac/blobdiff - sect.c
Fix for #199 - stop tokenising after the first symbol when inside a disabled code...
[rmac] / sect.c
diff --git a/sect.c b/sect.c
index ebf80cfec02bf585886a89329dbe801022c533b9..20e6fcb4a32016685d68116e5024272eddcba10a 100644 (file)
--- a/sect.c
+++ b/sect.c
@@ -18,8 +18,8 @@
 #include "riscasm.h"
 #include "symbol.h"
 #include "token.h"
-#define DEF_KW
-#include "kwtab.h"
+#define DEF_REGRISC
+#include "riscregs.h"
 
 // Function prototypes
 void MakeSection(int, uint16_t);
@@ -548,6 +548,9 @@ int ResolveFixups(int sno)
                                                // In this instruction the PC is located a DWORD away
                                                if (dw & FU_PCRELX)
                                                        eval += 2;
+                                               
+                                               if ((int64_t)eval > 0x7fff || (int64_t)eval < -32768)
+                                                       error(range_error);
                                        }
                                        else
                                        {
@@ -721,7 +724,7 @@ int ResolveFixups(int sno)
                        }
                        else if ((dw & FUMASKRISC) == FU_REGONE)
                        {
-                               eval -= KW_R0;
+                               eval -= REGRISC_R0;
                                if (eval > 31)
                                {
                                        error("register one value out of range");
@@ -735,7 +738,7 @@ int ResolveFixups(int sno)
                        }
                        else if ((dw & FUMASKRISC) == FU_REGTWO)
                        {
-                               eval -= KW_R0;
+                               eval -= REGRISC_R0;
                                if (eval > 31)
                                {
                                        error("register two value out of range");