Since my main OS is linux and have project on visual studio, I decided to use online compilers to achieve it. I found this which was suggested by many. So here is my code:
#include <iostream>
using namespace std;
int main(void) {
float a = 1;
float b = 20.2;
float res = 0;
float res1 = 0;
_asm {
FLD a
FCOM b
JA midi
JMP modi
midi:
FST res
JMP OUT
modi:
FST res1
JMP OUT
}
OUT:
cout << "res = " << res << endl;
cout << "res1 = " << res1 << endl;
return 0;
}
My goal is simple, if a
is greater that b
than put a
in res
, otherwise in res1
. But it seems like whatever I have in variable a
it always jumps on midi
and result is always res = whatever is in a
. Hope you can help. Sorry if my questions is silly, I've just started to learn assembly. thanks :)
P.S
same thing goes with JB
but the opposite. It always prints res1 = whatever is in b
.
From this page:
But your
JA midi
is testing the CPU flags.It goes on: