Assembly Language (visual studio 2015)
how do i return from a jump
e.g.:
mov eax,3
cmp eax,5
jl hello
mov eax,50
hello:
mov eax,10
ret
finish:
is there a way where i can return and continue to the next line of code (mov eax,50) after i've finishing the jump to hello
>>51303714
call instruction
>>51303742
How do i combine jl with call
>>51303742
is it possible to combine JL with call??
i know i can just replace jmp with call
but sometimes i want to cmp two values
can i ret from JL or JG or JGE
>>51303894
i don't think so but you could always do it how you would in C, like:
if(a < b) {
hello();
}
so, in asm:
mov eax, 3
cmp eax, 5
jge call_skip
call hello
call_skip:
mov eax, 50
hello:
mov eax, 10
ret
finish:
Ok
suppose i want to compare two values
so something like
mov eax,3
cmp eax,5
jg greater
jl smaller
mov eax,10
so in this case, can i return from both jl and jg?
>>51304077
You cannot return from a jump.
You can return from a call.
What jmp/jX does: Sets the instruction pointer based on the state of the flags register.
What call does: Pushes the address of the next instruction, then sets the instruction pointer.
What ret does: Pops the instruction pointer.
If you want to combine the effects of conditional branching and call/ret, you need to use both instructions, as in >>51303963
And for fuck's sake people, use code tags.
>>51303947
Push the return address to the stack and do your jump. Just use RET to jump back.
All CALL does is PUSH <addr>, JMP <function>.
>>51304132
didn't know about code tags sorry I'm new to this board (coming from r9k)
Lemme try itTesting
>>51304301
That seems like it would be prone to bugs, and also I don't think you have permission to access the instruction pointer w/o call
how do i push the return address so i can return back
>>51304363
>and also I don't think you have permission to access the instruction pointer w/o call
Really? Here's how to move the IP by one byte:
NOP
>>51304132
>What call does: Pushes the address of the next instruction,
Address of the instruction to RETurn *TO*.
>>51304424
I meant get the value senpai