NASM - The Netwide Assembler
NASM Forum => Using NASM => Topic started by: rdtsc on January 23, 2011, 01:57:44 PM
-
I wrote 2 macroses to simplify using %args and %locals in my procs.
For example,for %local:
%macro LOCALS 1+
%push mycontext
%stacksize flat
%assign %$localsize 0
%local %1
enter %$localsize,0
%endmacro
Proc1:
LOCALS v:dword
...
Proc2:
LOCALS v:dword
...
The PROBLEM is that it dose not allow to make local vars with the same names in 2 (for example) procedures.
In the above code will be compile error((LOCALS:4) `%local' missing argument parameter) at line LOCALS in Proc2
BUT, when i use above code itself (without macro LOCALS) - ALL WORKS good.
Proc1:
%push mycontext
%stacksize flat
%assign %$localsize 0
%local v:dword
enter %$localsize,0
...
Proc2:
%push mycontext
%stacksize flat
%assign %$localsize 0
%local v:dword
enter %$localsize,0
...
Please, help, how should i modify LOCALS macro in order to use vars with identical (the same) names ?
-
NASMX solves this by using the nasm "dot" notation as offsets from ebp. If you're feeling "very" adventurous you can download the package http://sourceforge.net/projects/nasmx/ (http://sourceforge.net/projects/nasmx/) and see how it is handled there. You may want to look at the demos to see it in action first. A word of caution though, NASMX hides a huge amount of complexity with regards to parameters, local variables, procedure definitions, etc. In other words, the source for the macros is not for the feint of heart ;)
-
NASMX solves this by using the nasm "dot" notation as offsets from ebp. If you're feeling "very" adventurous you can download the package http://sourceforge.net/projects/nasmx/ (http://sourceforge.net/projects/nasmx/) and see how it is handled there. You may want to look at the demos to see it in action first. A word of caution though, NASMX hides a huge amount of complexity with regards to parameters, local variables, procedure definitions, etc. In other words, the source for the macros is not for the feint of heart ;)
I am nop english-man, and dont understand what is "is not for the feint of heart" ? Very interesting sentence..
I think you mean that source is hard for understanding..
-
Yes, it is if you're not fluent in Nasm preprocessing. However, the demos show how easy it is to use and will give you an idea of how you can solve your problem.
-
Yes, it is if you're not fluent in Nasm preprocessing. However, the demos show how easy it is to use and will give you an idea of how you can solve your problem.
Thanks! It 's realy powerfull thing..Stucttures,types,..Masm is knocked down)
-
Thanks! It 's realy powerfull thing..Stucttures,types,..Masm is knocked down)
Well, we're not quite there yet in stealing masm's thunder but it's a start. ;)