NASM - The Netwide Assembler

NASM Forum => Using NASM => Topic started by: avcaballero on April 13, 2010, 09:10:57 AM

Title: Win32 local variables
Post by: avcaballero on April 13, 2010, 09:10:57 AM
Hello. Is there a way to define local variables inside a procedure as masm local "LOCAL myvar:DWORD" alike for example. I have revised win32 demos from nasmx package and I haven't found any.

Thank you
Title: Re: Win32 local variables
Post by: Keith Kanios on April 13, 2010, 05:46:40 PM
The NASMX way:
Code: [Select]
proc app
 LOCALS
  LOCAL stackvar, DWORD
 ENDLOCALS
 ;... rest of proc code...
endproc

The NASM way: Stack Relative Preprocessor Directives (http://www.nasm.us/doc/nasmdoc4.html#section-4.8).

Between the two, I would go with the one that has better documentation :P
Title: Re: Win32 local variables
Post by: Frank Kotler on April 15, 2010, 08:31:51 PM
Since Nasm expects macro parameters to be separated by commas, it's going to have trouble with "myvar:dword". With the (relatively new) substring capabilities, it "should" be possible to "parse" for the colon, and make two parameters out of one. If you can live with the comma, Alfonso, that would be much easier.

Best,
Frank