flat assembler
Message board for the users of flat assembler.

Index > Main > make fasm know [sample.m2] is actually [_sample.m2]

Author
Thread Post new topic Reply to topic
vbVeryBeginner



Joined: 15 Aug 2004
Posts: 884
Location: \\world\asia\malaysia
vbVeryBeginner
Code:
include '%fasminc%\win32ax.inc'

.code

struct ts
        m1 dd ?
        m2 dd ?
ends

        _sample ts
        sample equ _sample

  start:
                        mov  [_sample.m1],20
                        mov  [sample.m2],30
        invoke  ExitProcess,0

.end start
    


output
Code:
ts.txt [15]:
                        mov  [sample.m2],30
error: undefined symbol.
    


is there any possible way to let assembler know that [sample.m2] is actually same as [_sample.m2]?
Post 16 Jan 2006, 00:44
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7720
Location: Kraków, Poland
Tomasz Grysztar
Maybe
Code:
virtual at _sample
  sample ts
end virtual    
?
Post 16 Jan 2006, 09:22
View user's profile Send private message Visit poster's website Reply with quote
vbVeryBeginner



Joined: 15 Aug 2004
Posts: 884
Location: \\world\asia\malaysia
vbVeryBeginner
hi tomasz,
no luck Sad

Code:
include '%fasminc%\win32ax.inc' 
.code 
struct ts 
        m1 dd ? 
        m2 dd ? 
ends 
        _sample ts
virtual at _sample 
  sample ts 
end virtual
       
  start: 
                        mov  [sample.m2],30 
        invoke  ExitProcess,0 

.end start
    


the above result

testing.exe has encountered a problem and needs to close. We are sorry for the inconvenience.

If you were in the middle of ... ... bla bla bla
for more information about this error, click here ...
Post 16 Jan 2006, 10:06
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7720
Location: Kraków, Poland
Tomasz Grysztar
That problem is only because you try to write the not-writeable section (the .code one). Remove ".code" macro to make it use default ".flat" section and it works.
Post 16 Jan 2006, 10:13
View user's profile Send private message Visit poster's website Reply with quote
vbVeryBeginner



Joined: 15 Aug 2004
Posts: 884
Location: \\world\asia\malaysia
vbVeryBeginner
thank you tomasz for your fast reply Smile
thanks :p
and sorry for my stupid :p

but, why "sample equ _sample" couldn't solve such problem, since when sample equ to _sample, no variable with name "sample" is allowed anymore, and imho, the assembler should know [sample.xval] is equal to [_sample.xval]. :p
Post 16 Jan 2006, 10:24
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7720
Location: Kraków, Poland
Tomasz Grysztar
This is because the dot is not a special character in fasm, in a sense that is the part of label name as any other character is. So after the "_sample.xval" gets defined, it's the whole entity and assembler cannot know what was it made from - well, you could also define it just this way:
Code:
_sample.xval:    

etc.
Post 16 Jan 2006, 10:26
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-2020, Tomasz Grysztar.

Powered by rwasa.