flat assembler
Message board for the users of flat assembler.
Index
> DOS > macro usage |
Author |
|
LocoDelAssembly 13 Nov 2005, 20:44
Try this:
Code: ;macrofill.inc macro fill op1,op2,op3 { if defined fill ;code....(usage of op1,op2,op3) ;code.... display 'macro fill is already used',13,10 else ;code....(usage of op1,op2,op3) ;code.... display 'macro fill is not used,will be now...',13,10 end if fill = 1 } fill fill fill I have a question too, exactly why FASM can't generete the code when something that below appears? Code: if ~defined foo foo = 1 end if I suppose this happends because the maximun number of passes is exceded, but why? |
|||
13 Nov 2005, 20:44 |
|
daluca 14 Nov 2005, 05:33
hey¡ thank you that's exactly what i needed
|
|||
14 Nov 2005, 05:33 |
|
revolution 14 Nov 2005, 06:09
Code: if ~defined foo foo = 1 end if Start of first pass: foo = undefined End if first pass: foo = 1 Start of second pass: foo = defined (as 1) End of second pass: foo = undefined (the IF was skipped) Start of third pass: foo = undefined .... etc. In case you were not aware the way to solve the problem is like this: Code: if ~defined foo | defined here foo = 1 here = 1 end if |
|||
14 Nov 2005, 06:09 |
|
LocoDelAssembly 14 Nov 2005, 11:37
What fool I am, I didn't see that :@
Thanks revolution!!! |
|||
14 Nov 2005, 11:37 |
|
LocoDelAssembly 19 Jan 2006, 02:01
Hey wait a minute, my code is a sh*t.
This Code: fill fill Code: macro fill is not used,will be now...
macro fill is already used Code: fill Code: macro fill is already used (no idea of how to fix it) |
|||
19 Jan 2006, 02:01 |
|
Tomasz Grysztar 19 Jan 2006, 08:01
When you define constant only once, it can be forward-referenced. Since "defined"
fasm manual, 2.2.1 wrote: checks whether the given expression contains only symbols that are defined in the source and accessible from the current position Code: macro fill op1,op2,op3 { if defined fill ;code....(usage of op1,op2,op3) ;code.... display 'macro fill is already used',13,10 else ;code....(usage of op1,op2,op3) ;code.... display 'macro fill is not used,will be now...',13,10 end if fill = 1 fill = 1 } But in my opinion much better would be just to use the value of "fill" instead of checking whether it's accessible: Code: fill = 0 macro fill op1,op2,op3 { if fill ;code....(usage of op1,op2,op3) ;code.... display 'macro fill is already used',13,10 else ;code....(usage of op1,op2,op3) ;code.... display 'macro fill is not used,will be now...',13,10 end if fill = 1 } And for your other (earlier) problem, read the section 2.2.5 |
|||
19 Jan 2006, 08:01 |
|
LocoDelAssembly 21 Jan 2006, 22:31
I like more the first one
Thanks Tomasz PS: Sorry for reply late, my phone/ADSL service was unavailable from thursday morning... |
|||
21 Jan 2006, 22:31 |
|
Tomasz Grysztar 21 Jan 2006, 23:14
But the first one requires to know to understand how does it work - the "defined" was introduced rather for other appliances.
|
|||
21 Jan 2006, 23:14 |
|
daluca 22 Jan 2006, 07:50
well I like more the second one: it is clearer
|
|||
22 Jan 2006, 07:50 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.