flat assembler
Message board for the users of flat assembler.

Index > Main > Simple question

Author
Thread Post new topic Reply to topic
ManOfSteel



Joined: 02 Feb 2005
Posts: 1154
ManOfSteel 07 Oct 2006, 09:49
Hello,
I would like to know what is returned in eax after the final subtraction. Is it the address of the Addr3 label? I just want to be sure.
thanks.

Code:
        call    Addr2
Addr1:
<some code>
Addr2:  pop     eax
        sub     eax,(Addr1 - Addr3)

<some code>

Addr3:
    
Post 07 Oct 2006, 09:49
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20451
Location: In your JS exploiting you and your system
revolution 07 Oct 2006, 10:06
Quote:
I would like to know what is returned in eax after the final subtraction.
You get: (Addr1 - (Addr1 - Addr3) ) = Addr3.
Post 07 Oct 2006, 10:06
View user's profile Send private message Visit poster's website Reply with quote
ManOfSteel



Joined: 02 Feb 2005
Posts: 1154
ManOfSteel 07 Oct 2006, 10:44
Ok, thanks. Just what I thought. So basically, one could just use the Addr3 label automatically instead of doing these computations, right?

like:

Code:
Addr3:
        mov    byte [Addr3],'w'
    


instead of:

Code:
        call    Addr2 
Addr1: 
<some code> 
Addr2:  pop     eax 
        sub     eax,(Addr1 - Addr3) 

<some code> 

Addr3:

mov byte [eax],'w'
    
Post 07 Oct 2006, 10:44
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20451
Location: In your JS exploiting you and your system
revolution 07 Oct 2006, 11:00
Quote:
one could just use the Addr3 label automatically
Yes
Post 07 Oct 2006, 11:00
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.