/* yasep/core-js/yasep_flags.js
This file is distributed under terms of the Affero GPL v3 license or later, see http://yasep.org
created 2006-08-10 by whygee@f-cpu.org
2006-08-12
2006-09-02 : moved to vspsim/JScore/
2007-04-01 : added FORM_RI
2007-04-05 : added the jmp/skip related forms
2007-04-08 : cleanup
2007-04-09 : moved elements from JSgui/decoration.js to keep symbols in sync, split from vsp_forms
2007-04-15 : adding the USE_, READ_ and WRITE_ flags
2007-11-05 : rebranding to YASEP, adding IMM16_5LSB and IMM16_8LSB
2007-12-25 : adding FLAG_TEST
2008-11-17 : added OPTIONAL|YASEP32_ONLY|YASEP16_ONLY
2009-07-15 : cleanup
2009-07-27 : new version
2009-07-30 : linked to flags.html
2009-08-05 : removed several flags
2009-08-05 : added ABORT_WRITE, NO_WRITEBACK, CHANGE_CARRY, IGNORE_SND, IGNORE_SI4
and changed the generation of the messages
2011-10-11 : added PRE
2012-09-25 : added READ_DST3 for IH/IB
2014-02-10 : renamed CHANGE_ZERO into CHANGE_EQUAL, rewrote the list parser, SWAP_IR might disappear
2014-04-28 : removed ["SWAP_IR","sIR"] => MOV, GET
The flags are additional indications on how to encode the operation,
some for syntactic convenience or readability/consistency,
others for guiding the assembler. They are combined in a bitfield
so their values are consecutive powers of 2 (which limits their number to 32).
Don't forget to update doc/flags.XX.html
Dependency : yasep_forms.js defines Y
*/
Y.MAX_FLAG=1;
Y.TableFlags=[];
Y.TableFlagsDesc=[];
(function (l) {
for (var i in l) {
var n=l[i][0],
d=l[i][1];
blackList(n);
Y[n]=Y.MAX_FLAG;
Y.TableFlags[Y.MAX_FLAG] = n;
Y.TableFlagsDesc[Y.MAX_FLAG] = d;
Y.MAX_FLAG*=2; // Y.MAX_FLAG+=Y.MAX_FLAG;
}
}([
// Attributes used only for assembly/disassembly
["OPTIONAL","Opt"],
["Preliminary","PRE"],
["YASEP16_ONLY","Y16"],
["YASEP32_ONLY","Y32"],
["ALIAS_RR","aRR"], // BSWAP NEG NOT
["ALIAS_IRR","aIRR"], //
// Attributes for assembly/disassembly and hardware decoding
["NO_CONDITION","!Cnd"],
["IMM_LSB"], // 20120925 : IB,EZB,ESB...
["IMM16_5LSB"],
["IMM16_8LSB"],
["IgnoreImmSign"], // SHL
["NO_WRITEBACK","!WR"], // CMPx, PUT, OUT
["ABORT_WRITE","aWR"], // xMIN/xMAX
["CHANGE_CARRY","C"], // ADD,SUB,CMPU,CMPS,IH,EZH,ESH
["CHANGE_EQUAL","Eq"], // SHL, ROP2, ASU and MUL
["IGNORE_SND_SHORT","!snd"],
["IGNORE_SND_LONG","!SND"],
["IGNORE_SI4","!SI4"],
["IGNORE_IMM16","!I16"],
["IMM20","I20"],
["READ_DST","rD"] // added 20120925 for IH/IB, then SHLO/SHRO
// 21 flags already, 11 slots left
]));
Y.flags2html=function(flag){ // used by the opcode map
var s="", i=1, j=0, t;
while (i<=flag) {
if ((flag & i)&&(Y.TableFlagsDesc[i])) {
if (j++==3)
s+="
",j=0;
t=Y.TableFlags[i];
s+=' '+Y.TableFlagsDesc[i]+"";
}
i<<=1;
}
return s;
}