News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

specify LOCAL in macro

Started by RedXVII, March 28, 2007, 10:17:36 PM

Previous topic - Next topic

RedXVII

im making a complicated MACRO but would like to be able to specify/add a local variable of a proc in a macro, see below for a simplified idea of what i want to do. Thanks for any help  :U

MAKELOCAL MACRO name, type
  .code
  LOCAL name:type
ENDM


Myfunction proc coffee:DWORD, carrots:DWORD
  LOCAL chips:DWORD
  LOCAL beans:DWORD
  MAKELOCAL toffees, DWORD
  MAKELOCAL window, RECT
  mov eax, coffee
  mov toffees, eax
  ;... etc
Myfunction endp

RedXVII

just did it, the & sign was needed. Wow, im suprised that works, the more i use masm the more i realise how powerful these macros are. Im impressed it works without fuss too, if this were a C or C++ program, i'd be burried under 1000 lines of errors by now  :lol

Thanks anyway  :U

MAKELOCAL MACRO name, type
  .code
  LOCAL &name:&type
ENDM


Myfunction proc coffee:DWORD, carrots:DWORD
  LOCAL chips:DWORD
  LOCAL beans:DWORD
  MAKELOCAL toffees, DWORD
  MAKELOCAL window, RECT
  mov eax, coffee
  mov toffees, eax
  ;... etc
Myfunction endp