2 // RMAC - Reboot's Macro Assembler for the Atari Jaguar Console System
3 // DIRECT.C - Directive Handling
4 // Copyright (C) 199x Landon Dyer, 2017 Reboot and Friends
5 // RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
6 // Source utilised with the kind permission of Landon Dyer
26 TOKEN exprbuf[128]; // Expression buffer
27 SYM * symbolPtr[1000000]; // Symbol pointers table
28 static long unused; // For supressing 'write' warnings
29 char buffer[256]; // Scratch buffer for messages
31 // Function prototypes
59 int d_equrundef(void);
71 // Directive handler table
82 (void *)d_init, // 9 init
84 (void *)d_goto, // 11 goto
85 (void *)d_dc, // 12 dc
86 (void *)d_ds, // 13 ds
87 d_undmac, // 14 undefmac
90 (void *)d_dcb, // 17 dcb
94 d_incbin, // 21 .incbin //load
95 d_unimpl, // 22 disable
96 d_unimpl, // 23 enable
98 d_regbank0, // 25 .regbank0
99 d_regbank1, // 26 .regbank1
101 d_assert, // 28 assert
103 d_unimpl, // 30* endif
104 d_unimpl, // 31* endc
106 d_include, // 33 include
108 d_unimpl, // 35* macro
109 ExitMacro, // 36* exitm
110 d_unimpl, // 37* endm
114 d_phrase, // 41* endr
115 d_dphrase, // 42 struct
116 d_qphrase, // 43 ends
118 d_subttl, // 45 subttl
122 d_noclear, // 49 .noclear
123 d_equrundef, // 50 .equrundef/.regundef
124 d_ccundef, // 51 .ccundef
125 d_print, // 52 .print
126 d_cstruct, // 53 .cstruct
127 d_jpad, // 54 .jpad (deprecated)
128 d_nojpad, // 55 .nojpad (deprecated)
129 d_gpumain, // 56 .gpumain (deprecated)
130 d_prgflags, // 57 .prgflags
131 d_68020, // 58 .68020
132 d_68030, // 59 .68030
133 d_68040, // 60 .68040
134 d_68060, // 61 .68060
135 d_68881, // 62 .68881
136 d_68882, // 63 .68882
137 d_56001, // 64 .56001
144 // .error - Abort compilation, printing an error message
146 int d_error(char *str)
149 return error("error directive encountered - aborting assembling");
155 return error(string[tok[1]]);
158 return error("error directive encountered - aborting assembling");
165 // .warn - Just display a warning on screen
167 int d_warn(char *str)
170 return warn("WARNING WARNING WARNING");
176 return warn(string[tok[1]]);
179 return warn("WARNING WARNING WARNING");
192 if (!rgpu && !rdsp && !m6502)
193 return error(".org permitted only in gpu/dsp and 6502 sections");
195 if (abs_expr(&address) == ERROR)
197 error("cannot determine org'd address");
208 // 6502. We also kludge `lsloc' so the listing generator doesn't try
209 // to spew out megabytes.
210 if (address > 0xFFFF)
211 return error(range_error);
213 if (sloc != currentorg[0])
215 currentorg[1] = sloc;
219 currentorg[0] = address;
221 lsloc = sloc = address;
222 chptr = scode->chptr + address;
237 char prntstr[LNSIZ]; // String for PRINT directive
238 char format[LNSIZ]; // Format for PRINT directive
239 int formatting = 0; // Formatting on/off
240 int wordlong = 0; // WORD = 0, LONG = 1
241 int outtype = 0; // 0:hex, 1:decimal, 2:unsigned
243 VALUE eval; // Expression value
244 WORD eattr; // Expression attributes
245 SYM * esym; // External symbol involved in expr.
246 TOKEN r_expr[EXPRSIZE];
253 sprintf(prntstr, "%s", string[tok[1]]);
254 printf("%s", prntstr);
257 unused = write(list_fd, prntstr, (LONG)strlen(prntstr));
264 if (tok[1] != SYMBOL)
267 // strcpy(prntstr, (char *)tok[2]);
268 strcpy(prntstr, string[tok[2]]);
272 case 'l': case 'L': wordlong = 1; break;
273 case 'w': case 'W': wordlong = 0; break;
274 case 'x': case 'X': outtype = 0; break;
275 case 'd': case 'D': outtype = 1; break;
276 case 'u': case 'U': outtype = 2; break;
278 error("unknown print format flag");
288 if (expr(r_expr, &eval, &eattr, &esym) != OK)
294 case 0: strcpy(format, "%X"); break;
295 case 1: strcpy(format, "%d" ); break;
296 case 2: strcpy(format, "%u" ); break;
300 sprintf(prntstr, format, eval);
302 sprintf(prntstr, format, eval & 0xFFFF);
304 printf("%s", prntstr);
307 unused = write(list_fd, prntstr, (LONG)strlen(prntstr));
323 error("illegal print token");
329 // Undefine an equated condition code
335 // Check that we are in a RISC section
338 error(".ccundef must be defined in .gpu/.dsp section");
344 error("syntax error; expected symbol");
348 ccname = lookup(string[tok[1]], LABEL, 0);
350 // Make sure symbol is a valid ccdef
351 if (!ccname || !(ccname->sattre & EQUATEDCC))
353 error("invalid equated condition name specified");
357 ccname->sattre |= UNDEF_CC;
364 // Undefine an equated register
366 int d_equrundef(void)
370 // Check that we are in a RISC section
372 return error(".equrundef/.regundef must be defined in .gpu/.dsp section");
376 // Skip preceeding or seperating commas (if any)
380 // Check we are dealing with a symbol
382 return error("syntax error; expected symbol");
384 // Lookup and undef if equated register
385 regname = lookup(string[tok[1]], LABEL, 0);
387 if (regname && (regname->sattre & EQUATEDREG))
389 // Reset the attributes of this symbol...
391 regname->sattre &= ~(EQUATEDREG | BANK_0 | BANK_1);
392 regname->sattre |= UNDEF_EQUR;
395 // Skip over symbol token and address
404 // Do not allow use of the CLR.L opcode
408 warn("CLR.L opcode ignored...");
414 // Include binary file
420 long pos, size, bytesRead;
425 // Check to see if we're in BSS, and, if so, throw an error
428 errors("cannot include binary file \"%s\" in BSS section", string[tok[1]]);
434 error("syntax error; string missing");
438 // Attempt to open the include file in the current directory, then (if that
439 // failed) try list of include files passed in the enviroment string or by
441 if ((fd = open(string[tok[1]], _OPEN_INC)) < 0)
443 for(i=0; nthpath("RMACPATH", i, buf1)!=0; i++)
447 // Append path char if necessary
448 if (fd > 0 && buf1[fd - 1] != SLASHCHAR)
449 strcat(buf1, SLASHSTRING);
451 strcat(buf1, string[tok[1]]);
453 if ((fd = open(buf1, _OPEN_INC)) >= 0)
457 return errors("cannot open: \"%s\"", string[tok[1]]);
462 size = lseek(fd, 0L, SEEK_END);
463 pos = lseek(fd, 0L, SEEK_SET);
466 DEBUG { printf("INCBIN: File '%s' is %li bytes.\n", string[tok[1]], size); }
468 char * fileBuffer = (char *)malloc(size);
469 bytesRead = read(fd, fileBuffer, size);
471 if (bytesRead != size)
473 sprintf(msg, "was only able to read %li bytes from binary file (%s, %li bytes)", bytesRead, string[tok[1]], size);
478 memcpy(chptr, fileBuffer, size);
493 // Set RISC register banks
497 // Set active register bank zero
505 // Set active register bank one
512 // Helper function, to cut down on mistakes & typing
514 static inline void SkipBytes(unsigned bytesToSkip)
519 if ((scattr & SBSS) == 0)
521 chcheck(bytesToSkip);
522 D_ZEROFILL(bytesToSkip);
529 orgaddr += bytesToSkip;
535 // Adjust location to an EVEN value
540 return error(in_6502mode);
542 unsigned skip = (rgpu || rdsp ? orgaddr : sloc) & 0x01;
546 if ((scattr & SBSS) == 0)
565 // Adjust location to a LONG value
569 unsigned lower2Bits = (rgpu || rdsp ? orgaddr : sloc) & 0x03;
570 unsigned bytesToSkip = (0x04 - lower2Bits) & 0x03;
571 SkipBytes(bytesToSkip);
578 // Adjust location to a PHRASE value
580 // N.B.: We have to handle the GPU/DSP cases separately because you can embed
581 // RISC code in the middle of a regular 68K section. Also note that all
582 // of the alignment pseudo-ops will have to be fixed this way.
584 // This *must* behave differently when in a RISC section, as following sloc
585 // (instead of orgaddr) will fuck things up royally. Note that we do it this
586 // way because you can embed RISC code in a 68K section, and have the origin
587 // pointing to a different alignment in the RISC section than the 68K section.
591 unsigned lower3Bits = (rgpu || rdsp ? orgaddr : sloc) & 0x07;
592 unsigned bytesToSkip = (0x08 - lower3Bits) & 0x07;
593 SkipBytes(bytesToSkip);
600 // Adjust location to a DPHRASE value
604 unsigned lower4Bits = (rgpu || rdsp ? orgaddr : sloc) & 0x0F;
605 unsigned bytesToSkip = (0x10 - lower4Bits) & 0x0F;
606 SkipBytes(bytesToSkip);
613 // Adjust location to a QPHRASE value
617 unsigned lower5Bits = (rgpu || rdsp ? orgaddr : sloc) & 0x1F;
618 unsigned bytesToSkip = (0x20 - lower5Bits) & 0x1F;
619 SkipBytes(bytesToSkip);
626 // Do auto-even. This must be called ONLY if 'sloc' is odd.
628 // This is made hairy because, if there was a label on the line, we also have
629 // to adjust its value. This won't work with more than one label on the line,
630 // which is OK since multiple labels are only allowed in AS68 kludge mode, and
631 // the C compiler is VERY paranoid and uses ".even" whenever it can
633 // N.B.: This probably needs the same fixes as above...
637 if (cursect != M6502)
640 sloc++; // Bump BSS section
642 D_byte(0); // Deposit 0.b in non-BSS
644 if (lab_sym != NULL) // Bump label if we have to
651 // Unimplemened directive error
655 return error("unimplemented directive");
660 // Return absolute (not TDB) and defined expression or return an error
662 int abs_expr(VALUE * a_eval)
666 if (expr(exprbuf, a_eval, &eattr, NULL) < 0)
669 if (!(eattr & DEFINED))
670 return error(undef_error);
673 return error(rel_error);
680 // Hand symbols in a symbol-list to a function (kind of like mapcar...)
682 int symlist(int(* func)())
684 const char * em = "symbol list syntax";
691 if ((*func)(string[tok[1]]) != OK)
710 // .include "filename"
720 if (*tok == STRING) // Leave strings ALONE
722 else if (*tok == SYMBOL) // Try to append ".s" to symbols
724 strcpy(buf, string[*++tok]);
728 else // Punt if no STRING or SYMBOL
729 return error("missing filename");
731 // Make sure the user didn't try anything like:
732 // .include equates.s
734 return error("extra stuff after filename -- enclose it in quotes");
736 // Attempt to open the include file in the current directory, then (if that
737 // failed) try list of include files passed in the enviroment string or by
739 if ((j = open(fn, 0)) < 0)
741 for(i=0; nthpath("RMACPATH", i, buf1)!=0; i++)
745 // Append path char if necessary
746 if (j > 0 && buf1[j - 1] != SLASHCHAR)
747 strcat(buf1, SLASHSTRING);
751 if ((j = open(buf1, 0)) >= 0)
755 return errors("cannot open: \"%s\"", fn);
765 // .assert expression [, expression...]
772 for(; expr(exprbuf, &eval, &eattr, NULL)==OK; ++tok)
774 if (!(eattr & DEFINED))
775 return error("forward or undefined .assert");
778 return error("assert failure");
790 // .globl symbol [, symbol] <<<cannot make local symbols global>>>
797 return error("cannot .globl local symbol");
799 if ((sy = lookup(p, LABEL, 0)) == NULL)
801 sy = NewSymbol(p, LABEL, 0);
804 //printf("glob1: Making global symbol: attr=%04X, eattr=%08X, %s\n", sy->sattr, sy->sattre, sy->sname);
816 return error(in_6502mode);
824 // .prgflags expression
831 return error("PRGFLAGS requires value");
832 else if (abs_expr(&eval) == OK)
839 return error("PRGFLAGS requires value");
852 return error(in_6502mode);
858 else if (abs_expr(&eval) != OK)
873 return error("directive forbidden in gpu/dsp mode");
875 return error(in_6502mode);
890 return error("directive forbidden in gpu/dsp mode");
892 return error(in_6502mode);
907 return error("directive forbidden in gpu/dsp mode");
909 return error(in_6502mode);
922 // .ds[.size] expression
926 DEBUG { printf("Directive: .ds.[size] = %u, sloc = $%X\n", siz, sloc); }
930 if (cursect != M6502)
932 if ((siz != SIZB) && (sloc & 1)) // Automatic .even
936 if (abs_expr(&eval) != OK)
939 // Check to see if the value being passed in is negative (who the hell does
940 // that?--nobody does; it's the code gremlins, or rum, that does it)
941 // N.B.: Since VALUE is of type uint32_t, if it goes negative, it will have
943 if (eval & 0x80000000)
944 return error("negative sizes not allowed");
946 // In non-TDB section (BSS, ABS and M6502) just advance the location
947 // counter appropriately. In TDB sections, deposit (possibly large) chunks
948 // of zeroed memory....
949 if ((scattr & SBSS) || cursect == M6502)
955 if (cursect == M6502)
958 just_bss = 1; // No data deposited (8-bit CPU mode)
962 dep_block(eval, siz, (VALUE)0, (WORD)(DEFINED | ABS), NULL);
971 // dc.b, dc.w / dc, dc.l, dc.i
979 if ((scattr & SBSS) != 0)
980 return error("illegal initialization of section");
982 // Do an auto_even if it's not BYTE sized (hmm, should we be doing this???)
983 if (cursect != M6502 && (siz != SIZB) && (sloc & 1))
986 // Check to see if we're trying to set LONGS on a non 32-bit aligned
987 // address in a GPU or DSP section, in their local RAM
988 if ((siz == SIZL) && (orgaddr & 0x03)
989 && ((rgpu && (orgaddr >= 0xF03000) && (orgaddr <= 0xF03FFFF))
990 || (rdsp && (orgaddr >= 0xF1B000) && (orgaddr <= 0xF1CFFFF))))
991 warn("depositing LONGs on a non-long address in local RAM");
995 // dc.b 'string' [,] ...
996 if (siz == SIZB && (*tok == STRING || *tok == STRINGA8) && (tok[2] == ',' || tok[2] == EOL))
998 uint32_t i = strlen(string[tok[1]]);
1000 if ((challoc - ch_size) < i)
1005 for(p=string[tok[1]]; *p!=EOS; p++)
1008 else if(*tok == STRINGA8)
1010 for(p=string[tok[1]]; *p!=EOS; p++)
1011 D_byte(strtoa8[*p]);
1015 error("String format not supported... yet");
1022 int movei = 0; // MOVEI flag for dc.i
1031 // dc.x <expression>
1034 if (expr(exprbuf, &eval, &eattr, &esym) != OK)
1037 uint16_t tdb = eattr & TDB;
1038 uint16_t defined = eattr & DEFINED;
1040 if ((challoc - ch_size) < 4)
1048 AddFixup(FU_BYTE | FU_SEXT, sloc, exprbuf);
1054 return error("non-absolute byte value");
1056 if (eval + 0x100 >= 0x200)
1058 sprintf(buffer, "%s (value = $%X)", range_error, eval);
1059 return error(buffer);
1070 AddFixup(FU_WORD | FU_SEXT, sloc, exprbuf);
1075 if (eval + 0x10000 >= 0x20000)
1076 return error(range_error);
1079 MarkRelocatable(cursect, sloc, tdb, MWORD, NULL);
1081 // Deposit 68000 or 6502 (byte-reversed) word
1082 if (cursect != M6502)
1091 return error(in_6502mode);
1096 AddFixup(FU_LONG | FU_MOVEI, sloc, exprbuf);
1098 AddFixup(FU_LONG, sloc, exprbuf);
1105 MarkRelocatable(cursect, sloc, tdb, MLONG, NULL);
1108 eval = WORDSWAP32(eval);
1126 // dcb[.siz] expr1,expr2 - Make 'expr1' copies of 'expr2'
1133 DEBUG { printf("dcb: section is %s%s%s (scattr=$%X)\n", (cursect & TEXT ? "TEXT" : ""), (cursect & DATA ? " DATA" : ""), (cursect & BSS ? "BSS" : ""), scattr); }
1135 if ((scattr & SBSS) != 0)
1136 return error("illegal initialization of section");
1138 if (abs_expr(&evalc) != OK)
1142 return error("missing comma");
1144 if (expr(exprbuf, &eval, &eattr, NULL) < 0)
1147 if (cursect != M6502 && (siz != SIZB) && (sloc & 1))
1150 dep_block(evalc, siz, eval, eattr, exprbuf);
1156 // Generalized initialization directive
1158 // .init[.siz] [#count,] expression [.size] , ...
1160 // The size suffix on the ".init" directive becomes the default size of the
1161 // objects to deposit. If an item is preceeded with a sharp (immediate) sign
1162 // and an expression, it specifies a repeat count. The value to be deposited
1163 // may be followed by a size suffix, which overrides the default size.
1165 int d_init(WORD def_siz)
1172 if ((scattr & SBSS) != 0)
1173 return error(".init not permitted in BSS or ABS");
1176 return error("directive forbidden in gpu/dsp mode");
1180 // Get repeat count (defaults to 1)
1185 if (abs_expr(&count) != OK)
1189 return error(comma_error);
1194 // Evaluate expression to deposit
1195 if (expr(exprbuf, &eval, &eattr, NULL) < 0)
1198 switch ((int)*tok++)
1199 { // Determine size of object to deposit
1200 case DOTB: siz = SIZB; break;
1201 case DOTW: siz = SIZB; break;
1202 case DOTL: siz = SIZL; break;
1209 dep_block(count, siz, eval, eattr, exprbuf);
1219 return error(comma_error);
1226 // Deposit 'count' values of size 'siz' in the current (non-BSS) segment
1228 int dep_block(VALUE count, WORD siz, VALUE eval, WORD eattr, TOKEN * exprbuf)
1233 tdb = (WORD)(eattr & TDB);
1234 defined = (WORD)(eattr & DEFINED);
1238 if ((challoc - ch_size) < 4)
1246 AddFixup(FU_BYTE | FU_SEXT, sloc, exprbuf);
1252 return error("non-absolute byte value");
1254 if (eval + 0x100 >= 0x200)
1255 return error(range_error);
1265 AddFixup(FU_WORD | FU_SEXT, sloc, exprbuf);
1271 MarkRelocatable(cursect, sloc, tdb, MWORD, NULL);
1273 if (eval + 0x10000 >= 0x20000)
1274 return error(range_error);
1276 // Deposit 68000 or 6502 (byte-reversed) word
1277 if (cursect != M6502)
1287 return error(in_6502mode);
1291 AddFixup(FU_LONG, sloc, exprbuf);
1297 MarkRelocatable(cursect, sloc, tdb, MLONG, NULL);
1311 // .comm symbol, size
1320 return error(in_6502mode);
1323 return error("missing symbol");
1328 if (*p == '.') // Cannot .comm a local symbol
1329 return error(locgl_error);
1331 if ((sym = lookup(p, LABEL, 0)) == NULL)
1332 sym = NewSymbol(p, LABEL, 0);
1335 if (sym->sattr & DEFINED)
1336 return error(".comm symbol already defined");
1339 sym->sattr = GLOBAL | COMMON | BSS;
1342 return error(comma_error);
1344 if (abs_expr(&eval) != OK) // Parse size of common region
1347 sym->svalue = eval; // Install common symbol's size
1354 // .list - Turn listing on
1366 // .nlist - Turn listing off
1378 // .68000 - Back to 68000 TEXT segment
1383 // Switching from gpu/dsp sections should reset any ORG'd Address
1387 SwitchSection(TEXT);
1388 activecpu=CPU_68000;
1393 // .68020 - Back to 68000 TEXT segment and select 68020
1398 activecpu=CPU_68020;
1403 // .68030 - Back to 68000 TEXT segment and select 68030
1408 activecpu=CPU_68030;
1413 // .68040 - Back to 68000 TEXT segment and select 68040
1418 activecpu=CPU_68040;
1419 activefpu=FPU_68040;
1424 // .68060 - Back to 68000 TEXT segment and select 68060
1429 activecpu=CPU_68060;
1430 activefpu=FPU_68040;
1435 // .68881 - Back to 68000 TEXT segment and select 68881 FPU
1440 activefpu=FPU_68881;
1445 // .68882 - Back to 68000 TEXT segment and select 68882 FPU
1450 activefpu=FPU_68881;
1455 // nofpu - Deselect FPUs.
1468 return error("Not yet, child. Be patient.");
1472 // .gpu - Switch to GPU assembler
1476 if ((cursect != TEXT) && (cursect != DATA))
1478 error(".gpu can only be used in the TEXT or DATA segments");
1482 // If previous section was dsp or 68000 then we need to reset ORG'd Addresses
1485 //printf("Resetting ORG...\n");
1489 //else printf("NOT resetting ORG!\n");
1491 rgpu = 1; // Set GPU assembly
1492 rdsp = 0; // Unset DSP assembly
1493 regbank = BANK_N; // Set no default register bank
1499 // .dsp - Switch to DSP assembler
1503 if ((cursect != TEXT) && (cursect != DATA))
1505 error(".dsp can only be used in the TEXT or DATA segments");
1509 // If previous section was gpu or 68000 then we need to reset ORG'd Addresses
1516 rdsp = 1; // Set DSP assembly
1517 rgpu = 0; // Unset GPU assembly
1518 regbank = BANK_N; // Set no default register bank
1524 // .cargs [#offset], symbol[.size], ...
1526 // Lists of registers may also be mentioned; they just take up space. Good for
1527 // "documentation" purposes:
1529 // .cargs a6, .arg1, .arg2, .arg3...
1531 // Symbols thus created are ABS and EQUATED.
1535 VALUE eval = 4; // Default to 4 if no offset specified (to account for
1544 return error("directive forbidden in gpu/dsp mode");
1550 if (abs_expr(&eval) != OK)
1553 // Eat the comma, if it's there
1564 // Set env to either local (dot prefixed) or global scope
1565 env = (*p == '.' ? curenv : 0);
1566 symbol = lookup(p, LABEL, env);
1570 symbol = NewSymbol(p, LABEL, env);
1573 else if (symbol->sattr & DEFINED)
1574 return errors("multiply-defined label '%s'", p);
1576 // Put symbol in "order of definition" list
1577 AddToSymbolDeclarationList(symbol);
1579 symbol->sattr |= (ABS | DEFINED | EQUATED);
1580 symbol->svalue = eval;
1583 // What this does is eat any dot suffixes attached to a symbol. If
1584 // it's a .L, it adds 4 to eval; if it's .W or .B, it adds 2. If
1585 // there is no dot suffix, it assumes a size of 2.
1597 else if (*tok >= KW_D0 && *tok <= KW_A7)
1599 if (reglist(&rlist) < 0)
1602 for(i=0; i<16; i++, rlist>>=1)
1625 return error(".cargs syntax");
1629 // Eat commas in between each argument, if they exist
1637 // .cstruct [#offset], symbol[.size], ...
1639 // Lists of registers may also be mentioned; they just take up space. Good for
1640 // "documentation" purposes:
1642 // .cstruct a6, .arg1, .arg2, .arg3...
1644 // Symbols thus created are ABS and EQUATED. Note that this is for
1645 // compatibility with VBCC and the Remover's library. Thanks to GroovyBee for
1650 VALUE eval = 0; // Default, if no offset specified, is zero
1658 return error("directive forbidden in gpu/dsp mode");
1664 if (abs_expr(&eval) != OK)
1667 // Eat the comma, if it's there
1676 symbolName = string[tok[1]];
1678 // Set env to either local (dot prefixed) or global scope
1679 env = (symbolName[0] == '.' ? curenv : 0);
1680 symbol = lookup(symbolName, LABEL, env);
1682 // If the symbol wasn't found, then define it. Otherwise, throw an
1686 symbol = NewSymbol(symbolName, LABEL, env);
1689 else if (symbol->sattr & DEFINED)
1690 return errors("multiply-defined label '%s'", symbolName);
1692 // Put symbol in "order of definition" list
1693 AddToSymbolDeclarationList(symbol);
1697 // Adjust label start address if it's a word or a long, as a byte
1698 // label might have left us on an odd address.
1703 eval += eval & 0x01;
1706 symbol->sattr |= (ABS | DEFINED | EQUATED);
1707 symbol->svalue = eval;
1709 // Check for dot suffixes and adjust space accordingly (longs and
1710 // words on an odd boundary get bumped to the next word aligned
1711 // address). If no suffix, then throw an error.
1724 return error("Symbol missing dot suffix in .cstruct construct");
1729 else if (*tok >= KW_D0 && *tok <= KW_A7)
1731 if (reglist(&rlist) < 0)
1734 for(i=0; i<16; i++, rlist>>=1)
1757 return error(".cstruct syntax");
1761 // Eat commas in between each argument, if they exist
1769 // Undefine a macro - .undefmac macname [, macname...]
1771 int undmac1(char * p)
1773 SYM * symbol = lookup(p, MACRO, 0);
1775 // If the macro symbol exists, cause it to disappear
1777 symbol->stype = (BYTE)SY_UNDEF;
1792 warn("JPAD directive is deprecated/non-functional");
1799 warn("NOJPAD directive is deprecated/non-functional");
1806 return error("What the hell? Do you think we adhere to the Goof standard?");
1811 // .opt - turn a specific (or all) optimisation on or off
1820 char * tmpstr = string[*tok++];
1822 if (ParseOptimization(tmpstr) != OK)
1825 sprintf(temperr, "unknown optimization flag '%s'", tmpstr);
1826 return error(temperr);
1830 return error(".opt directive needs every switch enclosed inside quotation marks");