flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
baldr 28 Jan 2013, 12:58
TheRedPill wrote: As i expected, code branching using call and jmp instruction wont work properly, because they use absolute addressing. |
|||
![]() |
|
shutdownall 28 Jan 2013, 18:07
TheRedPill wrote:
I think this is quite bad programming style. Why don't you use labels ? Code: call function nop nop function: mov eax,[esp+0x8] mov ecx,[esp+0x4] add eax,ecx ret |
|||
![]() |
|
HaHaAnonymous 28 Jan 2013, 18:12
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 21:50; edited 1 time in total |
|||
![]() |
|
Spool 28 Jan 2013, 23:14
[ Post removed by author. ]
Last edited by Spool on 17 Mar 2013, 04:52; edited 1 time in total |
|||
![]() |
|
TheRedPill 28 Jan 2013, 23:53
Spool wrote:
Yes, i have to recalculate it,...but how? I guess i have to calculate the offset to the target memory and do a call/jmp on it from the calculating instruction. But how can this be done? |
|||
![]() |
|
TheRedPill 28 Jan 2013, 23:59
shutdownall wrote:
There is no static executabel this code is running in. It will be loaded dynamicall at runtime and executed and thus if i use a label, it will use a static (or does use in my case) address to jump to that address, but in dynamically loaded code, the address will point to something wrong and will make the process crash. The point is that i have to calculate the target instructions absolute address from the relative address somehow and make a branch to the target address, but how? |
|||
![]() |
|
Spool 29 Jan 2013, 00:05
[ Post removed by author. ]
Last edited by Spool on 17 Mar 2013, 04:53; edited 1 time in total |
|||
![]() |
|
Spool 29 Jan 2013, 00:06
[ Post removed by author. ]
Last edited by Spool on 17 Mar 2013, 04:53; edited 1 time in total |
|||
![]() |
|
TheRedPill 29 Jan 2013, 02:18
Spool wrote: dst addr is the procedure Can you please give me a example given the OP assembly code above? tia TRP |
|||
![]() |
|
Spool 29 Jan 2013, 06:16
[ Post removed by author. ]
Last edited by Spool on 17 Mar 2013, 04:54; edited 1 time in total |
|||
![]() |
|
TheRedPill 29 Jan 2013, 06:38
Spool wrote: here from the same add op: Thank you :thumbsup: |
|||
![]() |
|
shutdownall 29 Jan 2013, 20:46
TheRedPill wrote:
Labels are in general independent of static or dynamic. Please read the section in flat assembler manual about jumps and calls. So why ever calculate jumps and calls manually when you have an assembler engine doing it for you ??? ![]() Just use near jumps and calls. Quote:
|
|||
![]() |
|
TheRedPill 29 Jan 2013, 20:57
shutdownall wrote:
Yes this is true but i didnt know. I have written tons of lines of code in many languages over the years, even worked with debuggers, but mostly for validating pointers, heaps and analyzingparameters on callstacks, but i must confess my assembly language knowledge is pretty poor. I will read the fasm documentation from top to bottom and i guess this will make many things more clear. Thanky ou for the answer. |
|||
![]() |
|
shutdownall 29 Jan 2013, 21:09
And I don't know for what you exactly use the NOP statements, please take a look at the ALIGN statement for further information.
|
|||
![]() |
|
TheRedPill 29 Jan 2013, 22:46
shutdownall wrote: And I don't know for what you exactly use the NOP statements, please take a look at the ALIGN statement for further information. NOP was just to make "room" for me inside the code. It wasnt meant for alignment. |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.