flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Help with this ASSUME issue

Author
Thread Post new topic Reply to topic
alorent



Joined: 05 Dec 2005
Posts: 201
alorent
Hello guys,

I'm having problems with the following code:
Code:
format PE GUI 4.0
entry start

include 'WIN32AX.INC'
include 'macro\masm.inc'
include 'macro\if.INC'


struct my_struct
   Member1   dd  ?
   Member2   dd  ?
ends

.data

.code 

start:

    assume ebp:my_struct
    mov eax, [ebp.Member1]       ; WORKS!!

    ; start the party....

    reg_base EQU ebp

    assume reg_base:my_struct
    mov eax, [reg_base.Member1]   ; <--- ERROR!!! "Undefined symbol reg_base.Member1" 

    


How can I make the above work?

Thanks!!!
Post 23 Feb 2010, 19:57
View user's profile Send private message Reply with quote
bitshifter



Joined: 04 Dec 2007
Posts: 764
Location: Massachusetts, USA
bitshifter
I never used assume, but i have used label
Code:
label reg_base at ebp    
Maybe something like that would suit your needs?
Post 23 Feb 2010, 20:05
View user's profile Send private message Reply with quote
alorent



Joined: 05 Dec 2005
Posts: 201
alorent
Thanks bitshifter! That works fine for the above example.

The problem is that I want to chage later the "reg_base" to another register:

Code:

label reg_base at ebp

label reg_base at edi    ; <--- FAILS!!! It says "symbol already defined"

    


Is there an alternative solution to support the above?
Post 23 Feb 2010, 20:21
View user's profile Send private message Reply with quote
Borsuc



Joined: 29 Dec 2005
Posts: 2466
Location: Bucharest, Romania
Borsuc
Assume is a macro. "reg_base", if a symbolic constant (i.e 'equ' or 'define') will probably not get expanded, which is why it gives an error...
Post 23 Feb 2010, 20:46
View user's profile Send private message Reply with quote
bitshifter



Joined: 04 Dec 2007
Posts: 764
Location: Massachusetts, USA
bitshifter
You could use dot operator (.) to give its own scope...
Code:
scope1:
label .x at ebp
scope2:
label .x at edi

...

mov edx,[scope1.x]
mov ecx,[scope2.x]
    
Post 23 Feb 2010, 22:16
View user's profile Send private message Reply with quote
alorent



Joined: 05 Dec 2005
Posts: 201
alorent
Thanks bitshifter! I will try that!
Post 24 Feb 2010, 06:01
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-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.