</verb></tscreen>
+<sect1><tt>.DEFINEDINSTR</tt><label id=".DEFINEDINSTR"><p>
+
+ Builtin function. The function expects an identifier as argument in braces.
+ The argument is evaluated, and the function yields "true" if the identifier
+ is defined as an instruction mnemonic that is recognized by the assembler.
+ Example:
+
+ <tscreen><verb>
+ .if .not .definedinstr(ina)
+ .macro ina
+ clc
+ adc #$01
+ .endmacro
+ .endif
+
+ </verb></tscreen>
+
+
<sect1><tt>.DESTRUCTOR</tt><label id=".DESTRUCTOR"><p>
Export a symbol and mark it as a module destructor. This may be used
static ExprNode* FuncDefinedInstr (void)
/* Handle the .DEFINEDINSTR builtin function */
{
- int Instr = 0;
+ int Instr = 0;
/* Check for a macro or an instruction depending on UbiquitousIdents */
if (CurTok.Tok == TOK_IDENT) {
if (UbiquitousIdents) {
/* Macros CAN be instructions, so check for them first */
- if (FindMacro(&CurTok.SVal) == 0) {
+ if (FindMacro (&CurTok.SVal) == 0) {
Instr = FindInstruction (&CurTok.SVal);
}
} else {
/* Macros and symbols may NOT use the names of instructions, so just check for the instruction */
- Instr = FindInstruction(&CurTok.SVal);
+ Instr = FindInstruction (&CurTok.SVal);
}
- NextTok();
} else {
- Error("Idenitifier expected.");
+ Error ("Idenitifier expected.");
}
+ /* Skip the name */
+ NextTok ();
- return GenLiteralExpr(Instr > 0);
+ return GenLiteralExpr (Instr > 0);
}
"force_range",
"underline_in_numbers",
"addrsize",
- "definedinstr",
};
case FEAT_FORCE_RANGE: ForceRange = 1; break;
case FEAT_UNDERLINE_IN_NUMBERS: UnderlineInNumbers= 1; break;
case FEAT_ADDRSIZE: AddrSize = 1; break;
- case FEAT_DEFINEDINSTR: DefinedInstr = 1; break;
default: /* Keep gcc silent */ break;
}
FEAT_FORCE_RANGE,
FEAT_UNDERLINE_IN_NUMBERS,
FEAT_ADDRSIZE,
- FEAT_DEFINEDINSTR,
/* Special value: Number of features available */
FEAT_COUNT
unsigned char ForceRange = 0; /* Force values into expected range */
unsigned char UnderlineInNumbers = 0; /* Allow underlines in numbers */
unsigned char AddrSize = 0; /* Allow .ADDRSIZE function */
-unsigned char DefinedInstr = 0; /* Allow .DEFINEDINSTR function */
extern unsigned char ForceRange; /* Force values into expected range */
extern unsigned char UnderlineInNumbers; /* Allow underlines in numbers */
extern unsigned char AddrSize; /* Allow .ADDRSIZE function */
-extern unsigned char DefinedInstr; /* Allow .DEFINEDINSTR function */
}
break;
- case TOK_DEFINEDINSTR:
- /* Disallow .DEFINEDINSTR function by default */
- if (DefinedInstr == 0) {
- return TOK_NONE;
- }
- break;
-
default:
break;
}