/* 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
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.
Don't forget to update doc/flags.XX.html
Dependency : yasep_forms.js defines Y
*/
Y.MAX_FLAG=1;
Y.TableFlags=[];
Y.TableFlagsDesc=[];
Y.newFlag=function(name,desc){
blackList(name);
Y[name]=Y.MAX_FLAG;
Y.TableFlags[Y.MAX_FLAG] = name;
Y.TableFlagsDesc[Y.MAX_FLAG] = desc;
Y.MAX_FLAG+=Y.MAX_FLAG;
};
Y.newFlag("SWAP_IR","sIR"); // MOV, GET
Y.newFlag("ALIAS_RR","aRR"); // NEG ?
Y.newFlag("ALIAS_IRR","aIRR"); // NEG ?
Y.newFlag("NO_CONDITION","!Cnd");
Y.newFlag("IMM_LSB"); // 20120925 : IB,EZB,ESB...
Y.newFlag("IMM16_5LSB");
Y.newFlag("IMM16_8LSB");
Y.newFlag("OPTIONAL","Opt");
Y.newFlag("YASEP16_ONLY","Y16");
Y.newFlag("YASEP32_ONLY","Y32");
Y.newFlag("IgnoreImmSign"); // SHL, GET/PUT
Y.newFlag("NO_WRITEBACK","!WR"); // CMPx, PUT
Y.newFlag("ABORT_WRITE","aWR"); // xMIN/xMAX
Y.newFlag("CHANGE_CARRY","C"); // ADD,SUB,CMPU,CMPS
Y.newFlag("CHANGE_ZERO","Z"); // SHL, ROP2, ASU and MUL
Y.newFlag("IGNORE_SND","!snd");
Y.newFlag("IGNORE_SI4","!si4");
Y.newFlag("IGNORE_IMM16","!I16");
Y.newFlag("IMM20","I20");
Y.newFlag("Preliminary","PRE");
Y.newFlag("READ_DST3","rD3"); // added 20120925 for IH/IB
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;
}