2 // RMAC - Reboot's Macro Assembler for all Atari computers
3 // DIRECT.C - Directive Handling
4 // Copyright (C) 199x Landon Dyer, 2011-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
27 TOKEN exprbuf[128]; // Expression buffer
28 SYM * symbolPtr[1000000]; // Symbol pointers table
29 static long unused; // For supressing 'write' warnings
30 char buffer[256]; // Scratch buffer for messages
32 // Function prototypes
69 int d_equrundef(void);
81 // Directive handler table
92 (void *)d_init, // 9 init
94 (void *)d_goto, // 11 goto
95 (void *)d_dc, // 12 dc
96 (void *)d_ds, // 13 ds
97 d_undmac, // 14 undefmac
100 (void *)d_dcb, // 17 dcb
104 d_incbin, // 21 .incbin //load
105 d_unimpl, // 22 disable
106 d_unimpl, // 23 enable
108 d_regbank0, // 25 .regbank0
109 d_regbank1, // 26 .regbank1
111 d_assert, // 28 assert
113 d_unimpl, // 30* endif
114 d_unimpl, // 31* endc
116 d_include, // 33 include
118 d_unimpl, // 35* macro
119 ExitMacro, // 36* exitm
120 d_unimpl, // 37* endm
124 d_phrase, // 41* endr
125 d_dphrase, // 42 struct
126 d_qphrase, // 43 ends
128 d_subttl, // 45 subttl
132 d_noclear, // 49 .noclear
133 d_equrundef, // 50 .equrundef/.regundef
134 d_ccundef, // 51 .ccundef
135 d_print, // 52 .print
136 d_cstruct, // 53 .cstruct
137 d_jpad, // 54 .jpad (deprecated)
138 d_nojpad, // 55 .nojpad (deprecated)
139 d_gpumain, // 56 .gpumain (deprecated)
140 d_prgflags, // 57 .prgflags
141 d_68020, // 58 .68020
142 d_68030, // 59 .68030
143 d_68040, // 60 .68040
144 d_68060, // 61 .68060
145 d_68881, // 62 .68881
146 d_68882, // 63 .68882
147 d_56001, // 64 .56001
154 // .error - Abort compilation, printing an error message
156 int d_error(char *str)
159 return error("error directive encountered - aborting assembling");
165 return error(string[tok[1]]);
168 return error("error directive encountered - aborting assembling");
175 // .warn - Just display a warning on screen
177 int d_warn(char *str)
180 return warn("WARNING WARNING WARNING");
186 return warn(string[tok[1]]);
189 return warn("WARNING WARNING WARNING");
202 if (!rgpu && !rdsp && !m6502)
203 return error(".org permitted only in gpu/dsp and 6502 sections");
205 if (abs_expr(&address) == ERROR)
207 error("cannot determine org'd address");
218 // 6502. We also kludge `lsloc' so the listing generator doesn't try
219 // to spew out megabytes.
220 if (address > 0xFFFF)
221 return error(range_error);
223 if (sloc != currentorg[0])
225 currentorg[1] = sloc;
229 currentorg[0] = address;
231 lsloc = sloc = address;
232 chptr = scode->chptr + address;
247 char prntstr[LNSIZ]; // String for PRINT directive
248 char format[LNSIZ]; // Format for PRINT directive
249 int formatting = 0; // Formatting on/off
250 int wordlong = 0; // WORD = 0, LONG = 1
251 int outtype = 0; // 0:hex, 1:decimal, 2:unsigned
253 VALUE eval; // Expression value
254 WORD eattr; // Expression attributes
255 SYM * esym; // External symbol involved in expr.
256 TOKEN r_expr[EXPRSIZE];
263 sprintf(prntstr, "%s", string[tok[1]]);
264 printf("%s", prntstr);
267 unused = write(list_fd, prntstr, (LONG)strlen(prntstr));
274 if (tok[1] != SYMBOL)
277 // strcpy(prntstr, (char *)tok[2]);
278 strcpy(prntstr, string[tok[2]]);
282 case 'l': case 'L': wordlong = 1; break;
283 case 'w': case 'W': wordlong = 0; break;
284 case 'x': case 'X': outtype = 0; break;
285 case 'd': case 'D': outtype = 1; break;
286 case 'u': case 'U': outtype = 2; break;
288 error("unknown print format flag");
298 if (expr(r_expr, &eval, &eattr, &esym) != OK)
304 case 0: strcpy(format, "%X"); break;
305 case 1: strcpy(format, "%d" ); break;
306 case 2: strcpy(format, "%u" ); break;
310 sprintf(prntstr, format, eval);
312 sprintf(prntstr, format, eval & 0xFFFF);
314 printf("%s", prntstr);
317 unused = write(list_fd, prntstr, (LONG)strlen(prntstr));
333 error("illegal print token");
339 // Undefine an equated condition code
345 // Check that we are in a RISC section
348 error(".ccundef must be defined in .gpu/.dsp section");
354 error("syntax error; expected symbol");
358 ccname = lookup(string[tok[1]], LABEL, 0);
360 // Make sure symbol is a valid ccdef
361 if (!ccname || !(ccname->sattre & EQUATEDCC))
363 error("invalid equated condition name specified");
367 ccname->sattre |= UNDEF_CC;
374 // Undefine an equated register
376 int d_equrundef(void)
380 // Check that we are in a RISC section
382 return error(".equrundef/.regundef must be defined in .gpu/.dsp section");
386 // Skip preceeding or seperating commas (if any)
390 // Check we are dealing with a symbol
392 return error("syntax error; expected symbol");
394 // Lookup and undef if equated register
395 regname = lookup(string[tok[1]], LABEL, 0);
397 if (regname && (regname->sattre & EQUATEDREG))
399 // Reset the attributes of this symbol...
401 regname->sattre &= ~(EQUATEDREG | BANK_0 | BANK_1);
402 regname->sattre |= UNDEF_EQUR;
405 // Skip over symbol token and address
414 // Do not allow use of the CLR.L opcode
418 warn("CLR.L opcode ignored...");
424 // Include binary file
430 long pos, size, bytesRead;
435 // Check to see if we're in BSS, and, if so, throw an error
438 errors("cannot include binary file \"%s\" in BSS section", string[tok[1]]);
444 error("syntax error; string missing");
448 // Attempt to open the include file in the current directory, then (if that
449 // failed) try list of include files passed in the enviroment string or by
451 if ((fd = open(string[tok[1]], _OPEN_INC)) < 0)
453 for(i=0; nthpath("RMACPATH", i, buf1)!=0; i++)
457 // Append path char if necessary
458 if (fd > 0 && buf1[fd - 1] != SLASHCHAR)
459 strcat(buf1, SLASHSTRING);
461 strcat(buf1, string[tok[1]]);
463 if ((fd = open(buf1, _OPEN_INC)) >= 0)
467 return errors("cannot open: \"%s\"", string[tok[1]]);
472 size = lseek(fd, 0L, SEEK_END);
473 pos = lseek(fd, 0L, SEEK_SET);
476 DEBUG { printf("INCBIN: File '%s' is %li bytes.\n", string[tok[1]], size); }
478 char * fileBuffer = (char *)malloc(size);
479 bytesRead = read(fd, fileBuffer, size);
481 if (bytesRead != size)
483 sprintf(msg, "was only able to read %li bytes from binary file (%s, %li bytes)", bytesRead, string[tok[1]], size);
488 memcpy(chptr, fileBuffer, size);
503 // Set RISC register banks
507 // Set active register bank zero
515 // Set active register bank one
522 // Helper function, to cut down on mistakes & typing
524 static inline void SkipBytes(unsigned bytesToSkip)
529 if ((scattr & SBSS) == 0)
531 chcheck(bytesToSkip);
532 D_ZEROFILL(bytesToSkip);
539 orgaddr += bytesToSkip;
545 // Adjust location to an EVEN value
550 return error(in_6502mode);
552 unsigned skip = (rgpu || rdsp ? orgaddr : sloc) & 0x01;
556 if ((scattr & SBSS) == 0)
575 // Adjust location to a LONG value
579 unsigned lower2Bits = (rgpu || rdsp ? orgaddr : sloc) & 0x03;
580 unsigned bytesToSkip = (0x04 - lower2Bits) & 0x03;
581 SkipBytes(bytesToSkip);
588 // Adjust location to a PHRASE value
590 // N.B.: We have to handle the GPU/DSP cases separately because you can embed
591 // RISC code in the middle of a regular 68K section. Also note that all
592 // of the alignment pseudo-ops will have to be fixed this way.
594 // This *must* behave differently when in a RISC section, as following sloc
595 // (instead of orgaddr) will fuck things up royally. Note that we do it this
596 // way because you can embed RISC code in a 68K section, and have the origin
597 // pointing to a different alignment in the RISC section than the 68K section.
601 unsigned lower3Bits = (rgpu || rdsp ? orgaddr : sloc) & 0x07;
602 unsigned bytesToSkip = (0x08 - lower3Bits) & 0x07;
603 SkipBytes(bytesToSkip);
610 // Adjust location to a DPHRASE value
614 unsigned lower4Bits = (rgpu || rdsp ? orgaddr : sloc) & 0x0F;
615 unsigned bytesToSkip = (0x10 - lower4Bits) & 0x0F;
616 SkipBytes(bytesToSkip);
623 // Adjust location to a QPHRASE value
627 unsigned lower5Bits = (rgpu || rdsp ? orgaddr : sloc) & 0x1F;
628 unsigned bytesToSkip = (0x20 - lower5Bits) & 0x1F;
629 SkipBytes(bytesToSkip);
636 // Do auto-even. This must be called ONLY if 'sloc' is odd.
638 // This is made hairy because, if there was a label on the line, we also have
639 // to adjust its value. This won't work with more than one label on the line,
640 // which is OK since multiple labels are only allowed in AS68 kludge mode, and
641 // the C compiler is VERY paranoid and uses ".even" whenever it can
643 // N.B.: This probably needs the same fixes as above...
647 if (cursect != M6502)
650 sloc++; // Bump BSS section
652 D_byte(0); // Deposit 0.b in non-BSS
654 if (lab_sym != NULL) // Bump label if we have to
661 // Unimplemened directive error
665 return error("unimplemented directive");
670 // Return absolute (not TDB) and defined expression or return an error
672 int abs_expr(VALUE * a_eval)
676 if (expr(exprbuf, a_eval, &eattr, NULL) < 0)
679 if (!(eattr & DEFINED))
680 return error(undef_error);
683 return error(rel_error);
690 // Hand symbols in a symbol-list to a function (kind of like mapcar...)
692 int symlist(int(* func)())
694 const char * em = "symbol list syntax";
701 if ((*func)(string[tok[1]]) != OK)
720 // .include "filename"
730 if (*tok == STRING) // Leave strings ALONE
732 else if (*tok == SYMBOL) // Try to append ".s" to symbols
734 strcpy(buf, string[*++tok]);
738 else // Punt if no STRING or SYMBOL
739 return error("missing filename");
741 // Make sure the user didn't try anything like:
742 // .include equates.s
744 return error("extra stuff after filename -- enclose it in quotes");
746 // Attempt to open the include file in the current directory, then (if that
747 // failed) try list of include files passed in the enviroment string or by
749 if ((j = open(fn, 0)) < 0)
751 for(i=0; nthpath("RMACPATH", i, buf1)!=0; i++)
755 // Append path char if necessary
756 if (j > 0 && buf1[j - 1] != SLASHCHAR)
757 strcat(buf1, SLASHSTRING);
761 if ((j = open(buf1, 0)) >= 0)
765 return errors("cannot open: \"%s\"", fn);
775 // .assert expression [, expression...]
782 for(; expr(exprbuf, &eval, &eattr, NULL)==OK; ++tok)
784 if (!(eattr & DEFINED))
785 return error("forward or undefined .assert");
788 return error("assert failure");
800 // .globl symbol [, symbol] <<<cannot make local symbols global>>>
807 return error("cannot .globl local symbol");
809 if ((sy = lookup(p, LABEL, 0)) == NULL)
811 sy = NewSymbol(p, LABEL, 0);
814 //printf("glob1: Making global symbol: attr=%04X, eattr=%08X, %s\n", sy->sattr, sy->sattre, sy->sname);
826 return error(in_6502mode);
834 // .prgflags expression
841 return error("PRGFLAGS requires value");
842 else if (abs_expr(&eval) == OK)
849 return error("PRGFLAGS requires value");
862 return error(in_6502mode);
868 else if (abs_expr(&eval) != OK)
883 return error("directive forbidden in gpu/dsp mode");
885 return error(in_6502mode);
900 return error("directive forbidden in gpu/dsp mode");
902 return error(in_6502mode);
917 return error("directive forbidden in gpu/dsp mode");
919 return error(in_6502mode);
932 // .ds[.size] expression
936 DEBUG { printf("Directive: .ds.[size] = %u, sloc = $%X\n", siz, sloc); }
940 if (cursect != M6502)
942 if ((siz != SIZB) && (sloc & 1)) // Automatic .even
946 if (abs_expr(&eval) != OK)
949 // Check to see if the value being passed in is negative (who the hell does
950 // that?--nobody does; it's the code gremlins, or rum, that does it)
951 // N.B.: Since VALUE is of type uint32_t, if it goes negative, it will have
953 if (eval & 0x80000000)
954 return error("negative sizes not allowed");
956 // In non-TDB section (BSS, ABS and M6502) just advance the location
957 // counter appropriately. In TDB sections, deposit (possibly large) chunks
958 // of zeroed memory....
959 if ((scattr & SBSS) || cursect == M6502)
965 if (cursect == M6502)
968 just_bss = 1; // No data deposited (8-bit CPU mode)
972 dep_block(eval, siz, (VALUE)0, (WORD)(DEFINED | ABS), NULL);
981 // dc.b, dc.w / dc, dc.l, dc.i
989 if ((scattr & SBSS) != 0)
990 return error("illegal initialization of section");
992 // Do an auto_even if it's not BYTE sized (hmm, should we be doing this???)
993 if (cursect != M6502 && (siz != SIZB) && (sloc & 1))
996 // Check to see if we're trying to set LONGS on a non 32-bit aligned
997 // address in a GPU or DSP section, in their local RAM
998 if ((siz == SIZL) && (orgaddr & 0x03)
999 && ((rgpu && (orgaddr >= 0xF03000) && (orgaddr <= 0xF03FFFF))
1000 || (rdsp && (orgaddr >= 0xF1B000) && (orgaddr <= 0xF1CFFFF))))
1001 warn("depositing LONGs on a non-long address in local RAM");
1005 // dc.b 'string' [,] ...
1006 if (siz == SIZB && (*tok == STRING || *tok == STRINGA8) && (tok[2] == ',' || tok[2] == EOL))
1008 uint32_t i = strlen(string[tok[1]]);
1010 if ((challoc - ch_size) < i)
1015 for(p=string[tok[1]]; *p!=EOS; p++)
1018 else if(*tok == STRINGA8)
1020 for(p=string[tok[1]]; *p!=EOS; p++)
1021 D_byte(strtoa8[*p]);
1025 error("String format not supported... yet");
1032 int movei = 0; // MOVEI flag for dc.i
1041 // dc.x <expression>
1044 if (expr(exprbuf, &eval, &eattr, &esym) != OK)
1047 uint16_t tdb = eattr & TDB;
1048 uint16_t defined = eattr & DEFINED;
1050 if ((challoc - ch_size) < 4)
1058 AddFixup(FU_BYTE | FU_SEXT, sloc, exprbuf);
1064 return error("non-absolute byte value");
1066 if (eval + 0x100 >= 0x200)
1068 sprintf(buffer, "%s (value = $%X)", range_error, eval);
1069 return error(buffer);
1080 AddFixup(FU_WORD | FU_SEXT, sloc, exprbuf);
1085 if (eval + 0x10000 >= 0x20000)
1086 return error(range_error);
1089 MarkRelocatable(cursect, sloc, tdb, MWORD, NULL);
1091 // Deposit 68000 or 6502 (byte-reversed) word
1092 if (cursect != M6502)
1101 return error(in_6502mode);
1106 AddFixup(FU_LONG | FU_MOVEI, sloc, exprbuf);
1108 AddFixup(FU_LONG, sloc, exprbuf);
1115 MarkRelocatable(cursect, sloc, tdb, MLONG, NULL);
1118 eval = WORDSWAP32(eval);
1136 // dcb[.siz] expr1,expr2 - Make 'expr1' copies of 'expr2'
1143 DEBUG { printf("dcb: section is %s%s%s (scattr=$%X)\n", (cursect & TEXT ? "TEXT" : ""), (cursect & DATA ? " DATA" : ""), (cursect & BSS ? "BSS" : ""), scattr); }
1145 if ((scattr & SBSS) != 0)
1146 return error("illegal initialization of section");
1148 if (abs_expr(&evalc) != OK)
1152 return error("missing comma");
1154 if (expr(exprbuf, &eval, &eattr, NULL) < 0)
1157 if (cursect != M6502 && (siz != SIZB) && (sloc & 1))
1160 dep_block(evalc, siz, eval, eattr, exprbuf);
1166 // Generalized initialization directive
1168 // .init[.siz] [#count,] expression [.size] , ...
1170 // The size suffix on the ".init" directive becomes the default size of the
1171 // objects to deposit. If an item is preceeded with a sharp (immediate) sign
1172 // and an expression, it specifies a repeat count. The value to be deposited
1173 // may be followed by a size suffix, which overrides the default size.
1175 int d_init(WORD def_siz)
1182 if ((scattr & SBSS) != 0)
1183 return error(".init not permitted in BSS or ABS");
1186 return error("directive forbidden in gpu/dsp mode");
1190 // Get repeat count (defaults to 1)
1195 if (abs_expr(&count) != OK)
1199 return error(comma_error);
1204 // Evaluate expression to deposit
1205 if (expr(exprbuf, &eval, &eattr, NULL) < 0)
1208 switch ((int)*tok++)
1209 { // Determine size of object to deposit
1210 case DOTB: siz = SIZB; break;
1211 case DOTW: siz = SIZB; break;
1212 case DOTL: siz = SIZL; break;
1219 dep_block(count, siz, eval, eattr, exprbuf);
1229 return error(comma_error);
1236 // Deposit 'count' values of size 'siz' in the current (non-BSS) segment
1238 int dep_block(VALUE count, WORD siz, VALUE eval, WORD eattr, TOKEN * exprbuf)
1243 tdb = (WORD)(eattr & TDB);
1244 defined = (WORD)(eattr & DEFINED);
1248 if ((challoc - ch_size) < 4)
1256 AddFixup(FU_BYTE | FU_SEXT, sloc, exprbuf);
1262 return error("non-absolute byte value");
1264 if (eval + 0x100 >= 0x200)
1265 return error(range_error);
1275 AddFixup(FU_WORD | FU_SEXT, sloc, exprbuf);
1281 MarkRelocatable(cursect, sloc, tdb, MWORD, NULL);
1283 if (eval + 0x10000 >= 0x20000)
1284 return error(range_error);
1286 // Deposit 68000 or 6502 (byte-reversed) word
1287 if (cursect != M6502)
1297 return error(in_6502mode);
1301 AddFixup(FU_LONG, sloc, exprbuf);
1307 MarkRelocatable(cursect, sloc, tdb, MLONG, NULL);
1321 // .comm symbol, size
1330 return error(in_6502mode);
1333 return error("missing symbol");
1338 if (*p == '.') // Cannot .comm a local symbol
1339 return error(locgl_error);
1341 if ((sym = lookup(p, LABEL, 0)) == NULL)
1342 sym = NewSymbol(p, LABEL, 0);
1345 if (sym->sattr & DEFINED)
1346 return error(".comm symbol already defined");
1349 sym->sattr = GLOBAL | COMMON | BSS;
1352 return error(comma_error);
1354 if (abs_expr(&eval) != OK) // Parse size of common region
1357 sym->svalue = eval; // Install common symbol's size
1364 // .list - Turn listing on
1376 // .nlist - Turn listing off
1388 // .68000 - Back to 68000 TEXT segment
1393 // Switching from gpu/dsp sections should reset any ORG'd Address
1397 SwitchSection(TEXT);
1398 activecpu = CPU_68000;
1404 // .68020 - Back to 68000 TEXT segment and select 68020
1409 activecpu = CPU_68020;
1415 // .68030 - Back to 68000 TEXT segment and select 68030
1420 activecpu = CPU_68030;
1426 // .68040 - Back to 68000 TEXT segment and select 68040
1431 activecpu = CPU_68040;
1432 activefpu = FPU_68040;
1438 // .68060 - Back to 68000 TEXT segment and select 68060
1443 activecpu = CPU_68060;
1444 activefpu = FPU_68040;
1450 // .68881 - Back to 68000 TEXT segment and select 68881 FPU
1455 activefpu = FPU_68881;
1461 // .68882 - Back to 68000 TEXT segment and select 68882 FPU
1466 activefpu = FPU_68881;
1472 // nofpu - Deselect FPUs.
1476 activefpu = FPU_NONE;
1486 return error("Not yet, child. Be patient.");
1491 // .gpu - Switch to GPU assembler
1495 if ((cursect != TEXT) && (cursect != DATA))
1497 error(".gpu can only be used in the TEXT or DATA segments");
1501 // If previous section was dsp or 68000 then we need to reset ORG'd Addresses
1504 //printf("Resetting ORG...\n");
1508 //else printf("NOT resetting ORG!\n");
1510 rgpu = 1; // Set GPU assembly
1511 rdsp = 0; // Unset DSP assembly
1512 regbank = BANK_N; // Set no default register bank
1518 // .dsp - Switch to DSP assembler
1522 if ((cursect != TEXT) && (cursect != DATA))
1524 error(".dsp can only be used in the TEXT or DATA segments");
1528 // If previous section was gpu or 68000 then we need to reset ORG'd Addresses
1535 rdsp = 1; // Set DSP assembly
1536 rgpu = 0; // Unset GPU assembly
1537 regbank = BANK_N; // Set no default register bank
1543 // .cargs [#offset], symbol[.size], ...
1545 // Lists of registers may also be mentioned; they just take up space. Good for
1546 // "documentation" purposes:
1548 // .cargs a6, .arg1, .arg2, .arg3...
1550 // Symbols thus created are ABS and EQUATED.
1554 VALUE eval = 4; // Default to 4 if no offset specified (to account for
1563 return error("directive forbidden in gpu/dsp mode");
1569 if (abs_expr(&eval) != OK)
1572 // Eat the comma, if it's there
1583 // Set env to either local (dot prefixed) or global scope
1584 env = (*p == '.' ? curenv : 0);
1585 symbol = lookup(p, LABEL, env);
1589 symbol = NewSymbol(p, LABEL, env);
1592 else if (symbol->sattr & DEFINED)
1593 return errors("multiply-defined label '%s'", p);
1595 // Put symbol in "order of definition" list
1596 AddToSymbolDeclarationList(symbol);
1598 symbol->sattr |= (ABS | DEFINED | EQUATED);
1599 symbol->svalue = eval;
1602 // What this does is eat any dot suffixes attached to a symbol. If
1603 // it's a .L, it adds 4 to eval; if it's .W or .B, it adds 2. If
1604 // there is no dot suffix, it assumes a size of 2.
1616 else if (*tok >= KW_D0 && *tok <= KW_A7)
1618 if (reglist(&rlist) < 0)
1621 for(i=0; i<16; i++, rlist>>=1)
1644 return error(".cargs syntax");
1648 // Eat commas in between each argument, if they exist
1656 // .cstruct [#offset], symbol[.size], ...
1658 // Lists of registers may also be mentioned; they just take up space. Good for
1659 // "documentation" purposes:
1661 // .cstruct a6, .arg1, .arg2, .arg3...
1663 // Symbols thus created are ABS and EQUATED. Note that this is for
1664 // compatibility with VBCC and the Remover's library. Thanks to GroovyBee for
1669 VALUE eval = 0; // Default, if no offset specified, is zero
1677 return error("directive forbidden in gpu/dsp mode");
1683 if (abs_expr(&eval) != OK)
1686 // Eat the comma, if it's there
1695 symbolName = string[tok[1]];
1697 // Set env to either local (dot prefixed) or global scope
1698 env = (symbolName[0] == '.' ? curenv : 0);
1699 symbol = lookup(symbolName, LABEL, env);
1701 // If the symbol wasn't found, then define it. Otherwise, throw an
1705 symbol = NewSymbol(symbolName, LABEL, env);
1708 else if (symbol->sattr & DEFINED)
1709 return errors("multiply-defined label '%s'", symbolName);
1711 // Put symbol in "order of definition" list
1712 AddToSymbolDeclarationList(symbol);
1716 // Adjust label start address if it's a word or a long, as a byte
1717 // label might have left us on an odd address.
1722 eval += eval & 0x01;
1725 symbol->sattr |= (ABS | DEFINED | EQUATED);
1726 symbol->svalue = eval;
1728 // Check for dot suffixes and adjust space accordingly (longs and
1729 // words on an odd boundary get bumped to the next word aligned
1730 // address). If no suffix, then throw an error.
1743 return error("Symbol missing dot suffix in .cstruct construct");
1748 else if (*tok >= KW_D0 && *tok <= KW_A7)
1750 if (reglist(&rlist) < 0)
1753 for(i=0; i<16; i++, rlist>>=1)
1776 return error(".cstruct syntax");
1780 // Eat commas in between each argument, if they exist
1788 // Undefine a macro - .undefmac macname [, macname...]
1790 int undmac1(char * p)
1792 SYM * symbol = lookup(p, MACRO, 0);
1794 // If the macro symbol exists, cause it to disappear
1796 symbol->stype = (BYTE)SY_UNDEF;
1811 warn("JPAD directive is deprecated/non-functional");
1818 warn("NOJPAD directive is deprecated/non-functional");
1825 return error("What the hell? Do you think we adhere to the Goof standard?");
1830 // .opt - turn a specific (or all) optimisation on or off
1839 char * tmpstr = string[*tok++];
1841 if (ParseOptimization(tmpstr) != OK)
1844 sprintf(temperr, "unknown optimization flag '%s'", tmpstr);
1845 return error(temperr);
1849 return error(".opt directive needs every switch enclosed inside quotation marks");