/* yasep/ISM/ISM.js
This file is distributed under terms of the Affero GPL v3 license or later, see http://yasep.org
created lun. sept. 12 08:52:50 CEST 2011
version dim. sept. 18 17:25:04 CEST 2011 : adding the ISM/presentation.js code
version lun. sept. 19 08:45:47 CEST 2011 : translations OK
version jeu. août 30 04:33:32 CEST 2012 : utilisation de LS() au lieu de L[]
This is a generic page loader for the /ISM/ directory, it also handle aliases.
*/
//I8N("ISM")
ISM={
// win: null,
start: function(opc, orig_alias) {
opc=opc.slice(4);
orig_alias=orig_alias.slice(4); // remove "ISM/"
var cont=dcE("DIV");
ISM.cont=cont;
cont.innerHTML=import_htmi("ISM/"+orig_alias)+
'
'+I8N("ISM1")+'
\n'+
'\n
\n'+I8N("ISM2")
+'
\n\n
\n';
win= ygwm.new_window(
"Opcode "+orig_alias, null, cont,
500, 400, 250, 250, false, true, true, true, false, "doc_yelo");
/* yasep/ISM/presentation.js
created 2007-03-28 by yann guidon
2007-11-05 : rebranding to YASEP
2009-07-09 : changed before_load to addLoadEvent
2009-08-09
2009-08-23
*/
/* inclusion of yasep/ISM/dump_opcode_table.js
created 2007-03-28 by yann guidon
2007-04-01 : added the IR notice
2007-04-08
2007-04-16
2007-04-17 : allowing aliases
2007-11-05 : rebranding to YASEP
2007-11-07 : some healthy updates
2007-12-25 : changed the condition to display the link to test_eu.html
2007-11-?? : added support for OPTIONAL|YASEP32_ONLY|YASEP16_ONLY
2007-11-30 : test_eu turned into test_eu16 and test_eu32
2008-12-27 : included in yasep/ISM/presentation.js as after_load to make it work under Opera
2009-01-08 : changed after_load to before_load
*/
var x=getById("doc","p",cont),
y=getById("example","pre",cont),
z=getById("dump","div",cont),
op=orig_alias,
e,
h,
s=
u=
m="";
if (Y.table_opcode[op]) {
if ((opc=="UMIN")||(opc=="UMAX")||(opc=="SMIN")||(opc=="SMAX")) {
getById("minmax","span",cont).innerHTML=I8N("ISM3");
m+=I8N("ISM4");
}
if ((opc=="ROR")||(opc=="ROL"))
m+=I8N("ISM5");
if ((opc=="CMPU")||(opc=="CMPS")||(opc=="CMPE"))
m+=I8N("ISM6");
if (e=getById("rotrol","ul",cont))
e.innerHTML=I8N("ISM7");
if (e=getById("Mul8","div",cont))
e.innerHTML=I8N("ISM8");
if (Y.opcode_aliases[opc])
m+=I8N("ISM9")+Y.opcode_aliases[opc]+I8N("ISM10");
/* display the properties */
var o=Y.table_opcode[op];
t=o.val,
e=t & Y.FIELD_GROUP,
f=o.forms,
g=o.flags;
s=" Opcode : "+op+"\n"+I8N("ISM11")+int2hex(t)+"\n";
if (Y.GroupNames[e])
s+=I8N("ISM12") +Y.GroupNames[e].replace(/GROUP_/,"")+"\n";
if (g & (Y.CHANGE_CARRY | Y.CHANGE_ZERO))
m+=I8N("ISMc");
if (e == Y.GROUP_MUL)
m+=I8N("ISM13");
if (g & Y.IMM16_5LSB)
m+=I8N("ISM14");
if (g & Y.IMM16_8LSB)
m+=I8N("ISM15");
h='0';
if (op!="NOT")
h='SI4 (r/i4/i16)';
if (e==Y.GROUP_ROP2)
m+='SND (reg) | '
+' | '
+'result |
'+h+' |
';
//flags : OPTIONAL|YASEP32_ONLY|YASEP16_ONLY
if (g & Y.OPTIONAL)
m+=I8N("ISM16");
if (g & Y.Preliminary)
m+=I8N("ISM17");
if (g & Y.YASEP32_ONLY)
m+=I8N("ISM18");
if (g & Y.YASEP16_ONLY)
m+=I8N("ISM19");
if ((typeof(Y.opcode_table[t].action32) == "function")
|| (typeof(Y.opcode_table[t].action16) == "function"))
m+=I8N("ISM20");
if (o.description)
s+=I8N("ISM21")+o.description+"\n";
s+=I8N("ISM22")+Y.form2html(f)+"\n";
/* generate the examples */
var i,j,k,n,fill=" ";
for (i in Y.TableForm) {
if (f & i) {
j=Y.TableForm[i];
k=j.replace(/FORM_/,"");
n=Y.TableEncoders[j].ex(g,op);
if (n!="")
n=op+" "+n;
else
n=op;
u+='; '+j+"\n"
+''+n+"\n";
if ((i & Y.FORMS_EXTENDABLE)&&((g & Y.NO_CONDITION)==0))
u+=I8N("ISM23") +''+n+" "+Y.randomCondition()+"\n";
}
}
/* the flags */
if (g > 0) {
s+=I8N("ISM24");
for (i in Y.TableFlags) {
if (g & i) {
s+=' '
+Y.TableFlags[i]+"";
}
}
s+="\n";
}
} // table_opcode[op]!=undefined
x.innerHTML=m;
y.innerHTML=u;
z.innerHTML=s;
winman.patchInnerLinks(cont);
return win;
}
}