flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > "Assuming" parameters

Author
Thread Post new topic Reply to topic
alorent



Joined: 05 Dec 2005
Posts: 208
alorent 17 Nov 2010, 21:25
Hello!

I was wondering what's wrong with this assume in the "proc" parameter:

Code:
format PE GUI 4.0
entry start

include 'win32ax.inc'
include 'macro\if.inc'
include 'macro\masm.inc'

struct my_struct
   Member1   dd  ?
   Member2   dd  ?
ends


list_member dd 11111111h, 22222222h


.code

start:

    stdcall  MyProc, list_member    



MyProc proc pList

    assume pList:my_struct

    push   [pList.Member1]     ; FASM error here: "undefined symbol pList.Member1"

MyProc endp    


I guess the problem is that "pList" is taken as [ebp + XXX] and the assume causes error there.

Or maybe is there an alternative macro "assume_ptr" that can deal with that type of "assuming"?

Thanks in advance!
Post 17 Nov 2010, 21:25
View user's profile Send private message Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 17 Nov 2010, 23:03
alorent,

assume macro from MACRO\MASM.INC is limited to assume reg:struct syntax.

Let's see, pList is a pointer to structure? x86 doesn't support double indirection, you have to put pointer in register beforehand (then assume becomes useful).
Post 17 Nov 2010, 23:03
View user's profile Send private message Reply with quote
alorent



Joined: 05 Dec 2005
Posts: 208
alorent 18 Nov 2010, 12:46
Thanks baldr.

Well, it seems that the following is accepted (at least with latest FASM):

Code:
assume list_member:my_struct
mov    eax, [list_member.Member1]    


Thanks!
Post 18 Nov 2010, 12:46
View user's profile Send private message Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 18 Nov 2010, 17:51
alorent,

list_member should be address of my_struct then, not address of pointer to it. You may think of assume as type cast.

That's my favorite part: there are ways thing is supposed to be used, and much more ways thing can be used (some of them are productive too). Wink
Post 18 Nov 2010, 17:51
View user's profile Send private message Reply with quote
alorent



Joined: 05 Dec 2005
Posts: 208
alorent 19 Nov 2010, 05:49
Thanks for clarifying that baldr! Wink
Post 19 Nov 2010, 05:49
View user's profile Send private message 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-2023, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.