//
// Line Processor
//
-void assemble(void)
+void Assemble(void)
{
int state; // Keyword machine state (output)
int j; // Random int, must be fast
// Get another line of tokens
if (tokln() == TKEOF)
{
+if (verb_flag) printf("Assemble: Found TKEOF flag...\n");
if (list_flag && listflag) // Flush last line of source
listeol();
if (j == '=' || j == DEQUALS || j == SET || j == REG || j == EQUREG || j == CCDEF)
{
- equate = (char *)tok[1];
+// equate = (char *)tok[1];
+ equate = string[tok[1]];
equtyp = j;
tok += 3;
goto normal;
if (j == ':' || j == DCOLON)
{
as68label:
- label = (char *)tok[1]; // Get label name
+// label = (char *)tok[1]; // Get label name
+ label = string[tok[1]]; // Get label name
labtyp = tok[2]; // Get label type
tok += 3; // Go to next line token
// This is the problem here: On 64-bit platforms, this cuts the native pointer
// in half. We need to figure out how to fix this.
-#warning "!!! Bad pointer !!!"
+//#warning "!!! Bad pointer !!!"
+#if 0
opname = p = (char *)*tok++; // Store opcode name here
+#else
+ opname = p = string[*tok++];
+#endif
// Check to see if the SYMBOL is a keyword (a mnemonic or directive).
// On output, `state' will have one of the values:
if (label != NULL)
warn(lab_ignored);
- defmac();
+ DefineMacro();
}
goto loop;
if (label != NULL)
warn(lab_ignored);
- exitmac();
+ ExitMacro();
}
goto loop;
if (sy == NULL)
{
- sy = newsym(equate, LABEL, j);
+ sy = NewSymbol(equate, LABEL, j);
sy->sattr = 0;
if (equtyp == DEQUALS)
// Checking for a register symbol
else if (tok[0] == SYMBOL)
{
- sy2 = lookup((char *)tok[1], LABEL, j);
+// sy2 = lookup((char *)tok[1], LABEL, j);
+ sy2 = lookup(string[tok[1]], LABEL, j);
// Make sure symbol is a valid equreg
if (!sy2 || !(sy2->sattre & EQUATEDREG))
if (tok[0] == SYMBOL)
{
- sy2 = lookup((char *)tok[1], LABEL, j);
+// sy2 = lookup((char *)tok[1], LABEL, j);
+ sy2 = lookup(string[tok[1]], LABEL, j);
if (!sy2 || !(sy2->sattre & EQUATEDCC))
{
//equ a equr
else if (*tok == SYMBOL)
{
- sy2 = lookup((char *)tok[1], LABEL, j);
+// sy2 = lookup((char *)tok[1], LABEL, j);
+ sy2 = lookup(string[tok[1]], LABEL, j);
if (sy2 && (sy2->sattre & EQUATEDREG))
{
if (label != NULL)
{
do_label:
+ // Check for dot in front of label; means this is a local label if present
+#if 0
j = 0;
if (*label == '.')
j = curenv;
+#else
+ j = (*label == '.' ? curenv : 0);
+#endif
sy = lookup(label, LABEL, j);
if (sy == NULL)
{
- sy = newsym(label, LABEL, j);
+ sy = NewSymbol(label, LABEL, j);
sy->sattr = 0;
sy->sattre = RISCSYM;
}
lab_sym = sy;
if (!j)
- ++curenv;
+ curenv++;
// Make label global
if (labtyp == DCOLON)
if (state < 0)
{
if ((sy = lookup(opname, MACRO, 0)) != NULL)
- invokemac(sy, siz);
+ InvokeMacro(sy, siz);
else
errors("unknown op '%s'", opname);
// Alloc an IFENTRY
if ((rif = f_ifent) == NULL)
-// rif = (IFENT *)amem((LONG)sizeof(IFENT));
rif = (IFENT *)malloc(sizeof(IFENT));
else
f_ifent = rif->if_prev;
if (!disabled)
{
- if (expr(exprbuf, &eval, &eattr, &esym) != OK) return 0;
+ if (expr(exprbuf, &eval, &eattr, &esym) != OK)
+ return 0;
if ((eattr & DEFINED) == 0)
return error(undef_error);