]> Shamusworld >> Repos - rmac/blobdiff - token.c
.equr overhaul part 3: store and handle banks in .equr evaluation
[rmac] / token.c
diff --git a/token.c b/token.c
index 3e42501d604a2f80efae1356fb5b96e1e648553c..162e7390bcf2576998815c66c84db75d303c4986 100644 (file)
--- a/token.c
+++ b/token.c
@@ -1205,12 +1205,31 @@ DEBUG { printf("TokenizeLine: Calling fpop() from SRC_IFILE...\n"); }
                        if ((j < 0) || (state < 0))
                        {
                                // Last attempt: let's see if this is an equated register
+                               char temp = *ln;
+                               *ln = 0;
                                sy = lookup(nullspot, LABEL, 0);
+                               *ln = temp;
                                if (sy)
                                {
                                        if (sy->sattre & EQUATEDREG)
                                        {
-                                               *tk.u32++ = sy->svalue;
+                                               uint32_t register_token = sy->svalue;
+                                               if (rgpu || rdsp)
+                                               {
+                                                       // If we are in GPU or DSP mode then mark the register bank.
+                                                       // We will use it during EvaluateRegisterFromTokenStream()
+                                                       // when we check if we can use the equated register with the currently
+                                                       // selected bank.
+                                                       // Note (ggn): I find all this superfluous. Do we really want to be so
+                                                       //             protective? Plus, the current implementation happily skips
+                                                       //                         these checks on .equr that are set during fixups - oops!
+                                                       register_token |= 0x80000000;           // Mark that this is an .equr
+                                                       if (sy->sattre & BANK_1)
+                                                       {
+                                                               register_token |= 0x40000000;   // Mark bank 1
+                                                       }
+                                               }
+                                               *tk.u32++ = register_token;
                                                stuffnull = 0;
                                                continue;
                                        }