X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?p=rmac;a=blobdiff_plain;f=direct.c;h=155fa3fb360821bc945bb0e8e3a79ffd6fe973a9;hp=770fcf9958cbed8c1301b2069aed17869c44a9dc;hb=eace4e1b294ccec54a5c476619f616f5da0bf8a9;hpb=ff8188b7e279f99cf11ac8a283c4146af324d26f diff --git a/direct.c b/direct.c index 770fcf9..155fa3f 100644 --- a/direct.c +++ b/direct.c @@ -20,10 +20,13 @@ #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 @@ -859,7 +862,7 @@ int d_prgflags(void) return error("PRGFLAGS requires value"); else if (abs_expr(&eval) == OK) { - PRGFLAGS=eval; + PRGFLAGS = (uint32_t)eval; return 0; } else @@ -887,7 +890,7 @@ int d_abs(void) return 0; SwitchSection(ABS); - sloc = eval; + sloc = (uint32_t)eval; return 0; } @@ -976,9 +979,9 @@ int d_ds(WORD siz) // 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; @@ -996,7 +999,7 @@ int d_ds(WORD siz) // -// 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) { @@ -1136,12 +1139,76 @@ 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; } @@ -1180,7 +1247,7 @@ int d_dcb(WORD siz) 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; } @@ -1213,7 +1280,7 @@ int d_init(WORD def_siz) // Get repeat count (defaults to 1) if (*tok == '#') { - ++tok; + tok++; if (abs_expr(&count) != OK) return 0; @@ -1228,7 +1295,7 @@ int d_init(WORD def_siz) 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; @@ -1239,9 +1306,9 @@ int d_init(WORD def_siz) 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; @@ -1377,7 +1444,7 @@ int d_comm(void) 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; } @@ -1521,14 +1588,12 @@ int d_gpu(void) 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 @@ -1619,7 +1684,7 @@ int d_cargs(void) 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 @@ -1746,7 +1811,7 @@ int d_cstruct(void) } 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