flat assembler
Message board for the users of flat assembler.
Index
> Main > 'out of scope' why? |
Author |
|
vid 06 Nov 2011, 20:55
are you sure the second code really has "mov eax,w3.%w1"? The error code only says "mov eax,%w1".
|
|||
06 Nov 2011, 20:55 |
|
revolution 06 Nov 2011, 20:56
Use the dot.
Code: .%w = $ ;... .%w1 = $ - .%w BTW: Your first code does not compile normally: error: undefined symbol 'w3.%w1' |
|||
06 Nov 2011, 20:56 |
|
vid 06 Nov 2011, 20:57
You edited your post while I was typing my previous answer, disregard it. For answer to your question, read http://flatassembler.net/docs.php?article=manual#1.2.3
|
|||
06 Nov 2011, 20:57 |
|
xRom 06 Nov 2011, 20:59
vid wrote: are you sure the second code really has "mov eax,w3.%w1"? The error code only says "mov eax,%w1". Sorry, a'm corrected. But still don't work. |
|||
06 Nov 2011, 20:59 |
|
revolution 06 Nov 2011, 21:03
The reason you get out of scope is because you are defining %w1 and later redefining %w1 again. You can't forward reference variables that are redefined. Use the dot like I showed above.
|
|||
06 Nov 2011, 21:03 |
|
xRom 06 Nov 2011, 21:23
revolution wrote: The reason you get out of scope is because you are defining %w1 and later redefining %w1 again. You can't forward reference variables that are redefined. Use the dot like I showed above. Greate thanks, but if I can not use the name of the structure in this case (which I do not know beforehand)? how calculate the offset fields inside the structure so as not to write later in the procedure: mov eax,[ebp+10] and write mov eax,[ebp+%window.size] for example? If procedure is one, and macro 'window' are two? or more? |
|||
06 Nov 2011, 21:23 |
|
revolution 06 Nov 2011, 21:35
If you want the size of the structure use this:
Code: struc _win x,y { .1 dw x .2 dw y } virtual _win _win 0,0 _win.size = $-$$ end virtual ;... mov eax,_win.size |
|||
06 Nov 2011, 21:35 |
|
xRom 07 Nov 2011, 06:46
revolution wrote:
Thanx! This is work. But i'm not understand why |
|||
07 Nov 2011, 06:46 |
|
goldenspider 07 Nov 2011, 07:32
Or you can use struct.
Code: struct _win 1 dw ? 2 dw ? ends ... movzx eax,[w3.1] mov eax,sizeof._win mov eax,sizeof._win.1 ... w3 _win 10,20 |
|||
07 Nov 2011, 07:32 |
|
xRom 07 Nov 2011, 08:24
goldenspider wrote: Or you can use struct. thanx! it's work. but what is it - struct? in manual http://flatassembler.net/docs.php?article=manual#2.3.4 - no about this... |
|||
07 Nov 2011, 08:24 |
|
revolution 07 Nov 2011, 08:30
xRom wrote: thanx! it's work. but what is it - struct? in manual http://flatassembler.net/docs.php?article=manual#2.3.4 - no about this... |
|||
07 Nov 2011, 08:30 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.