[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
Assembley Language (Visual Studio 2015)
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 15
Thread images: 2
File: net-kurs.jpg (16 KB, 419x278) Image search: [Google]
net-kurs.jpg
16 KB, 419x278
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 it
Testing
>>
>>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*.
>>
File: really4.gif (2 MB, 360x282) Image search: [Google]
really4.gif
2 MB, 360x282
>>51304424
I meant get the value senpai
Thread replies: 15
Thread images: 2

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.