Is it possible to mimic an if-statment in x86 assembly language (using masm syntax)? I want to do something like this in x86 assembly language, but I'm not sure which operator I should use to mimic an if-else statement. Should I use the jl
instruction, or the cmp
instruction, or some other instruction?
int i = 2;
int j = 3;
if(i > j){
i = 1;
}
else{
i = 4;
}
A combination of cmp
and jcc
(that is, conditional jump) instructions will do. Look up your CPU manual.