X-Git-Url: https://jxself.org/git/?p=zilutils.git;a=blobdiff_plain;f=zilasm%2Fopcodes.h;fp=zilasm%2Fopcodes.h;h=bddcb0d90e53846c35ac6cf4c49053465370e31e;hp=0000000000000000000000000000000000000000;hb=fd453701e368225dd15e9df2e5b1752aebe454e8;hpb=093225c7cb864aaa31567969301eb5f36bd9a5f4 diff --git a/zilasm/opcodes.h b/zilasm/opcodes.h new file mode 100644 index 0000000..bddcb0d --- /dev/null +++ b/zilasm/opcodes.h @@ -0,0 +1,49 @@ +/* + * opcodes.h -- part of ZilUtils/ZilAsm + * + * Copyright (C) 2016 Jason Self + * + * Based on ZILF (c) 2010, 2015 Jesse McGrew + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see + */ + +#ifndef ZILASM_OPCODES +#define ZILASM_OPCODES 1 + +#include "symtable.h" + +typedef enum { + Zop_none = 0, + Zop_store = 1, // ..stores a result + Zop_branch = 2, // ..branches to a label + Zop_extra = 4, // ..takes an extra operand type byte, for a total of 8 possible operands + Zop_varargs = 8, // ..is nominally 2OP but can take up to 4 operands + Zop_string = 16, // ..has a string literal operand + Zop_label = 32, // ..can take a local label operand + Zop_indvar = 64, // ..first operand is an indirect variable number + Zop_call = 128, // ..first operand is a packed routine address + Zop_term = 256 // ..control flow does not pass to the following instruction +} ZOpcode_flags; + +typedef struct { + unsigned opcode; + ZOpcode_flags flags; +} ZOpcode; + +extern Symtable *Opcodes; + +void init_opcodes(int version, int inform_syntax); + +#endif /* ifndef ZILASM_OPCODES */