#include "sect.h"
#include "symbol.h"
#include "token.h"
+#include "math.h"
+#include "sect.h"
#define DEF_KW
#include "kwtab.h"
+
TOKEN exprbuf[128]; // Expression buffer
SYM * symbolPtr[1000000]; // Symbol pointers table
static long unused; // For supressing 'write' warnings
return error("PRGFLAGS requires value");
else if (abs_expr(&eval) == OK)
{
- PRGFLAGS=eval;
+ PRGFLAGS = (uint32_t)eval;
return 0;
}
else
return 0;
SwitchSection(ABS);
- sloc = eval;
+ sloc = (uint32_t)eval;
return 0;
}
// of zeroed memory....
if ((scattr & SBSS) || cursect == M6502)
{
- listvalue(eval);
+ listvalue((uint32_t)eval);
eval *= siz;
- sloc += eval;
+ sloc += (uint32_t)eval;
if (cursect == M6502)
chptr += eval;
//
-// dc.b, dc.w / dc, dc.l, dc.i
+// dc.b, dc.w / dc, dc.l, dc.i, dc.q, dc.d
//
int d_dc(WORD siz)
{
D_long(eval);
}
break;
- case SIZD:
+ case SIZQ:
// 64-bit size
- // N.B.: May have to come up with section/fixup markers for this;
- // ATM it's only used in dc.d statements...
- D_long(eval >> 32);
- D_long(eval & 0xFFFFFFFF);
+ if (m6502)
+ return error(in_6502mode);
+
+ // Shamus: We only handle DC.Q type stuff, will have to add fixups
+ // and stuff later (maybe... might not be needed...)
+ D_quad(eval);
+ break;
+ case SIZS:
+ if (m6502)
+ return error(in_6502mode);
+
+ if (!defined)
+ {
+ float vv = 0;
+ AddFixup(FU_FLOATSING, sloc, exprbuf);
+
+ D_single(vv);
+ }
+ else
+ {
+ if (tdb)
+ MarkRelocatable(cursect, sloc, tdb, MSINGLE, NULL);
+
+ D_single(eval);
+ }
+
+ break;
+ case SIZD:
+ if (m6502)
+ return error(in_6502mode);
+
+ if (!defined)
+ {
+ double vv = 0;
+ AddFixup(FU_FLOATDOUB, sloc, exprbuf);
+
+ D_double(vv);
+ }
+ else
+ {
+ if (tdb)
+ MarkRelocatable(cursect, sloc, tdb, MDOUBLE, NULL);
+
+ double vv = *(double *)&eval;
+ D_double(vv);
+ }
+
+ break;
+ case SIZX:
+ if (m6502)
+ return error(in_6502mode);
+
+ if (!defined)
+ {
+ double vv = 0;
+ AddFixup(FU_FLOATEXT, sloc, exprbuf);
+
+ D_extend(vv);
+ }
+ else
+ {
+ if (tdb)
+ MarkRelocatable(cursect, sloc, tdb, MEXTEND, NULL);
+
+ float vv = *(double *)&eval;
+ D_extend(vv);
+ }
+
break;
}
if (cursect != M6502 && (siz != SIZB) && (sloc & 1))
auto_even();
- dep_block(evalc, siz, eval, eattr, exprbuf);
+ dep_block((uint32_t)evalc, siz, (uint32_t)eval, eattr, exprbuf);
return 0;
}
// Get repeat count (defaults to 1)
if (*tok == '#')
{
- ++tok;
+ tok++;
if (abs_expr(&count) != OK)
return 0;
if (expr(exprbuf, &eval, &eattr, NULL) < 0)
return 0;
- switch ((int)*tok++)
+ switch (*tok++)
{ // Determine size of object to deposit
case DOTB: siz = SIZB; break;
case DOTW: siz = SIZB; break;
break;
}
- dep_block(count, siz, eval, eattr, exprbuf);
+ dep_block((uint32_t)count, siz, (uint32_t)eval, eattr, exprbuf);
- switch ((int)*tok)
+ switch (*tok)
{
case EOL:
return 0;
if (abs_expr(&eval) != OK) // Parse size of common region
return 0;
- sym->svalue = eval; // Install common symbol's size
+ sym->svalue = (uint32_t)eval; // Install common symbol's size
at_eol();
return 0;
}
return ERROR;
}
- // If previous section was dsp or 68000 then we need to reset ORG'd Addresses
+ // If previous section was DSP or 68000 then we need to reset ORG'd Addresses
if (!rgpu)
{
-//printf("Resetting ORG...\n");
orgactive = 0;
orgwarning = 0;
}
-//else printf("NOT resetting ORG!\n");
rgpu = 1; // Set GPU assembly
rdsp = 0; // Unset DSP assembly
AddToSymbolDeclarationList(symbol);
symbol->sattr |= (ABS | DEFINED | EQUATED);
- symbol->svalue = eval;
+ symbol->svalue = (uint32_t)eval;
tok += 2;
// What this does is eat any dot suffixes attached to a symbol. If
}
symbol->sattr |= (ABS | DEFINED | EQUATED);
- symbol->svalue = eval;
+ symbol->svalue = (uint32_t)eval;
// Check for dot suffixes and adjust space accordingly (longs and
// words on an odd boundary get bumped to the next word aligned