flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > Use a struc on a label? |
Author |
|
revolution 24 Nov 2009, 14:43
Both 'label' and 'struc' are internal directives. You will experience a lot of trouble trying to define them as something else.
|
|||
24 Nov 2009, 14:43 |
|
Azu 24 Nov 2009, 14:48
Sorry bad example.
Let's use "blaa1" and "blaa2" instead. Any ideas how to make it work? |
|||
24 Nov 2009, 14:48 |
|
revolution 24 Nov 2009, 14:53
Show some code please. With the abstraction above is not clear what you want to achieve.
|
|||
24 Nov 2009, 14:53 |
|
Azu 24 Nov 2009, 15:07
Code: blaa1 = 12345678 struc blaa2{ .element1 dd ? .element2 dd ? } virtual at blaa1 blaa1 blaa2 end virtual I want; blaa1.element1 to be 12345678 blaa1.element2 to be 12345682 |
|||
24 Nov 2009, 15:07 |
|
revolution 24 Nov 2009, 15:22
This works for me:
Code: blaa3 = 12345678 struc blaa2{ .element1 dd ? .element2 dd ? } virtual at blaa3 blaa1 blaa2 end virtual |
|||
24 Nov 2009, 15:22 |
|
Azu 24 Nov 2009, 15:26
Thanks.. is there a way to redefine it then?
Something like this? Code: blaa1 = 12345678 struc blaa2{ .element1 dd ? .element2 dd ? } virtual at blaa1 local blaa3 blaa3 blaa2 undefine blaa1 blaa1 = blaa3 end virtual I need to keep it the same name.. |
|||
24 Nov 2009, 15:26 |
|
revolution 24 Nov 2009, 15:31
fasm does not support undefine.
'restore', 'purge' and 'restruc' only work at the preprocessor stage so they won't help you at the assembler stage |
|||
24 Nov 2009, 15:31 |
|
Azu 24 Nov 2009, 15:41
Thank you.
Is there a way to make it do whatever blaa1+blaa2.element1 does? I don't know what you call it but that is what I want (but condensed).. |
|||
24 Nov 2009, 15:41 |
|
revolution 24 Nov 2009, 15:49
You can always do it manually of course.
Code: blaa1 = 12345678 label blaa1.element1 dword at blaa1 label blaa1.element2 dword at blaa1+4 |
|||
24 Nov 2009, 15:49 |
|
Azu 24 Nov 2009, 15:51
I mean automatically
Something like this Code: for each element in blaa2 blaa1#.elementName=blaa1+elementOffset end for Please isn't there some way to have FASM do it? |
|||
24 Nov 2009, 15:51 |
|
revolution 24 Nov 2009, 15:57
I'm not really sure what you want.
Code: struc x { .e1 dd ? .e2 dd ? if . end if } y=1234 virtual at y y x end virtual |
|||
24 Nov 2009, 15:57 |
|
Azu 24 Nov 2009, 16:14
Thank you
Putting Code: if . end if I don't understand though.. why does it fix it? It's an empty statement.. it shouldn't do anything should it? Unless I had "if used y" or something.. but I don't.. so I'm really confused. Why does it work? o.0 p.s. Why aren't strucs like this by default? Is there a drawback in certain situations? |
|||
24 Nov 2009, 16:14 |
|
revolution 24 Nov 2009, 16:22
Using 'if .' is a side effect that exploits the structure processing. When fasm detects that you used '.' it won't automatically assign it and assumes you will assign it in your own way. So using the '.' in an empty construct stops fasm from defining it.
|
|||
24 Nov 2009, 16:22 |
|
vid 24 Nov 2009, 16:23
nice trick
|
|||
24 Nov 2009, 16:23 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.