/*
VSP/vsp_flags.js
created 2006-08-10 by whygee@f-cpu.org
version 2006-08-12
version 2006-09-02 : moved to vspsim/JScore/
version 2007-04-01 : added FORM_RI
version 2007-04-05 : added the jmp/skip related forms
version 2007-04-08 : cleanup
version 2007-04-09 : moved elements from JSgui/decoration.js
to keep symbols in sync, split from vsp_forms
version 2007-04-15 : adding the USE_, READ_ and WRITE_ flags
The flags are additional indications on how to encode the operation,
some for syntactic convenience or readability/consistency,
others for guiding the assembler
Dependency : none
*/
/* flags : it's a simple bitfield */
var i=1;
const FLAG_SWAPDEST =i; i+=i; // SHL, SW/SB
const FLAG_ALIAS_RR =i; i+=i; // BSWAP
// new flags (may replace the above)
const READ_SRC1 =i; i+=i;
const READ_SRC1orIMM =i; i+=i;
const READ_SRC2 =i; i+=i;
const WRITE_SRC1 =i; i+=i;
const WRITE_SRC2 =i; i+=i;
const WRITE_SRC2ifIMM=i; i+=i;
const USE_IMMor0 =i; i+=i;
const USE_IMM16 =i; i+=i;
const USE_Q =i; i+=i;
const USE_SKIPCARRY =i; i+=i;
const USE_SKIPCOND =i; i+=i;
const USE_CONDITION =i; i+=i;
const MAX_FLAG = i;
var TableFlags=new Array();
TableFlags[FLAG_SWAPDEST] ="FLAG_SWAPDEST";
TableFlags[FLAG_ALIAS_RR] ="FLAG_ALIAS_RR";
TableFlags[READ_SRC1] ="READ_SRC1";
TableFlags[READ_SRC1orIMM]="READ_SRC1orIMM"; // when long : use Imm16, when short : use SRC1
TableFlags[READ_SRC2] ="READ_SRC2";
TableFlags[WRITE_SRC1] ="WRITE_SRC1";
TableFlags[WRITE_SRC2] ="WRITE_SRC2";
TableFlags[WRITE_SRC2ifIMM]="WRITE_SRC2ifIMM"; // For long SHL
TableFlags[USE_IMMor0] ="USE_IMMor0"; // when long : use Imm16, when short : generate constant 0 (for XOR-condX and add-CIP)
TableFlags[USE_IMM16] ="USE_IMM16"; // For NEG only (yet)
TableFlags[USE_Q] ="USE_Q";
TableFlags[USE_SKIPCARRY] ="USE_SKIPCARRY";
TableFlags[USE_SKIPCOND] ="USE_SKIPCOND";
TableFlags[USE_CONDITION] ="USE_CONDITION";
function flags2html(flag){ // will be scrapped soon
var s='';
if (flag & FLAG_SWAPDEST)
s= 'swp';
if (flag & FLAG_ALIAS_RR)
s+=' aRR';
return s;
}