ASMCODE: IF / ELSE EXAMPLE - DWB~2014
Posted: Sun Apr 27, 2014 3:12 am
I wanted to share this code,
to discuss further possibilities to execute a function IF / ELSE for the individual channels.
I found this very useful code to bypass or switch other pieces of code very complex and heavy for a single channel,
so as to have a single process and not only mask the result,
also a partner in poly section to always use the bypass / switch possibility.
to discuss further possibilities to execute a function IF / ELSE for the individual channels.
I found this very useful code to bypass or switch other pieces of code very complex and heavy for a single channel,
so as to have a single process and not only mask the result,
also a partner in poly section to always use the bypass / switch possibility.
Code: Select all
/* ## ASMCODE: IF / ELSE EXAMPLE - DWB~2014 ## */
streamin in1;streamin in2;
streamout out;
//>> ** TEMP VAR FOR IF / ELSE ROUTINE
float TmpCompare=0;
//<< ** TEMP VAR FOR IF / ELSE ROUTINE
//>> ** STORE EAX,EBX REGISTER
push eax;
push ebx;
//<< ** STORE EAX,EBX REGISTER
//>> ** ASSIGN VAR TO XMM REGISTER
movaps xmm0,in1;
movaps xmm1,in2;
//>> ** ASSIGN VAR TO XMM REGISTER
//>> ** COMPARE TWO XMM REGISTER
cmpps xmm0,xmm1,5;
// ** STORE RESULT IN TEMP VAR
movaps TmpCompare,xmm0;
//<< ** COMPARE TWO XMM REGISTER
//>> ** IF / ELSE ROUTINE >>>>>>>>>>>>>>>>>>>>>>>>>>
// ** Move the 1° CH Compared State to EAX Register
mov eax,TmpCompare[0];
// ** Compare the state mode (cmmps xmm,xmm,mode;)
// ** this set the FLAG for jump opcode
cmp eax,0;
jz if0;
//>> ** Your IF code here
// mov ebx,in1[0]; //Test Output
//<< ** Your IF code here
if0:
jnz else0;
//>> ** Your ELSE code here
//mov ebx,in2[0]; //Test Output
//<< ** Your ELSE code here
else0:
//>> ** Your THEN code here
//mov out[0],ebx; //Test Output
//<< ** Your THEN code here
//<< ** IF ELSE ROUTINE <<<<<<<<<<<<<<<<<<<<<<<<<<<<
//>> ** IF / ELSE ROUTINE >>>>>>>>>>>>>>>>>>>>>>>>>>
// ** Move the 2° CH Compared State to EAX Register
mov eax,TmpCompare[1];
// ** Compare the state mode (cmmps xmm,xmm,mode;)
// ** this set the FLAG for jump opcode
cmp eax,0;
jz if1;
//>> ** Your IF code here
// mov ebx,in1[1]; //Test Output
//<< ** Your IF code here
if1:
jnz else1;
//>> ** Your ELSE code here
//mov ebx,in2[1]; //Test Output
//<< ** Your ELSE code here
else1:
//>> ** Your THEN code here
//mov out[1],ebx; //Test Output
//<< ** Your THEN code here
//<< ** IF ELSE ROUTINE <<<<<<<<<<<<<<<<<<<<<<<<<<<<
//>> ** IF / ELSE ROUTINE >>>>>>>>>>>>>>>>>>>>>>>>>>
// ** Move the 3° CH Compared State to EAX Register
mov eax,TmpCompare[2];
// ** Compare the state mode (cmmps xmm,xmm,mode;)
// ** this set the FLAG for jump opcode
cmp eax,0;
jz if2;
//>> ** Your IF code here
// mov ebx,in1[2]; //Test Output
//<< ** Your IF code here
if2:
jnz else2;
//>> ** Your ELSE code here
//mov ebx,in2[2]; //Test Output
//<< ** Your ELSE code here
else2:
//>> ** Your THEN code here
//mov out[2],ebx; //Test Output
//<< ** Your THEN code here
//<< ** IF ELSE ROUTINE <<<<<<<<<<<<<<<<<<<<<<<<<<<<
//>> ** IF / ELSE ROUTINE >>>>>>>>>>>>>>>>>>>>>>>>>>
// ** Move the 4° CH Compared State to EAX Register
mov eax,TmpCompare[3];
// ** Compare the state mode (cmmps xmm,xmm,mode;)
// ** this set the FLAG for jump opcode
cmp eax,0;
jz if3;
//>> ** Your IF code here
// mov ebx,in1[3]; //Test Output
//<< ** Your IF code here
if3:
jnz else3;
//>> ** Your ELSE code here
//mov ebx,in2[3]; //Test Output
//<< ** Your ELSE code here
else3:
//>> ** Your THEN code here
//mov out[3],ebx; //Test Output
//<< ** Your THEN code here
//<< ** IF ELSE ROUTINE <<<<<<<<<<<<<<<<<<<<<<<<<<<<
//>> ** RESTORE EAX,EBX REGISTER
pop ebx;
pop eax;
//<< ** RESTORE EAX,EBX REGISTER