//
// RMAC - Reboot's Macro Assembler for all Atari computers
// MACRO.C - Macro Definition and Invocation
-// Copyright (C) 199x Landon Dyer, 2011-2017 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 utilised with the kind permission of Landon Dyer
//
static LONG macuniq; // Unique-per-macro number
static SYM * curmac; // Macro currently being defined
-static VALUE argno; // Formal argument count
+static uint32_t argno; // Formal argument count
static LLIST * firstrpt; // First .rept line
static LLIST * nextrpt; // Last .rept line
curmac->lineList = malloc(sizeof(LLIST));
curmac->lineList->next = NULL;
curmac->lineList->line = strdup(ln);
+ curmac->lineList->lineno = curlineno;
curmac->last = curmac->lineList;
}
else
curmac->last->next = malloc(sizeof(LLIST));
curmac->last->next->next = NULL;
curmac->last->next->line = strdup(ln);
+ curmac->lineList->lineno = curlineno;
curmac->last = curmac->last->next;
}
{
argno = 0;
symlist(defmac2);
- at_eol();
+ ErrorIfNotAtEOL();
}
// Suck in the macro definition; we're looking for an ENDM symbol on a line
firstrpt = malloc(sizeof(LLIST));
firstrpt->next = NULL;
firstrpt->line = strdup(line);
+ firstrpt->lineno = curlineno;
nextrpt = firstrpt;
}
else
nextrpt->next = malloc(sizeof(LLIST));
nextrpt->next->next = NULL;
nextrpt->next->line = strdup(line);
+ nextrpt->next->lineno = curlineno;
nextrpt = nextrpt->next;
}
#endif
//
int HandleRept(void)
{
- VALUE eval;
+ uint64_t eval;
// Evaluate repeat expression
if (abs_expr(&eval) != OK)
IREPT * irept = inobj->inobj.irept;
irept->ir_firstln = firstrpt;
irept->ir_nextln = NULL;
- irept->ir_count = eval;
+ irept->ir_count = (uint32_t)eval;
}
return 0;
for(int i=0; i<3; i++)
*p++ = *tok++;
}
- else if (*tok == CONST)
+ else if (*tok == CONST) // Constants are 64-bits
{
- *p++ = *tok++;
- *p++ = *tok++;
+ *p++ = *tok++; // Token
+ uint64_t *p64 = (uint64_t *)p;
+ uint64_t *tok64 = (uint64_t *)tok;
+ *p64++ = *tok64++;
+ tok = (TOKEN *)tok64;
+ p = (uint32_t *)p64;
}
else if ((*tok == STRING) || (*tok == SYMBOL))
{