The MASM Forum Archive 2004 to 2012

Project Support Forums => 64 Bit Assembler => Topic started by: GUAN DE DIO on July 26, 2008, 12:12:07 AM

Title: .IF .ELSIF .ELSE .ENDIF
Post by: GUAN DE DIO on July 26, 2008, 12:12:07 AM
Hi everybody,

        I'm making  several program test and I found that the .IF .ELSE .ENDIF macros don't work  properly.

        Has anybody the implementation of new macros to work on 64 bits?
       
       Maybe somebody has a link to know how to implement it ?

Thanks in advance,

GUAN
Title: Re: .IF .ELSIF .ELSE .ENDIF
Post by: MazeGen on July 30, 2008, 08:18:32 AM
Emulating these constructs using macros is not easy. I remember that someone posted macros which simulates these directives some months ago on this board, try to search it.
Title: Re: .IF .ELSIF .ELSE .ENDIF
Post by: GUAN DE DIO on July 30, 2008, 02:54:04 PM
The unique macros that I found here it is within the file x64calling.inc where we have the macros: INOVOKE, "LOCAL", ... the new way of declaration  functions to use with the new macros but nothing about .IF, .BREAK.WHILE, ...

GUAN
Title: Re: .IF .ELSIF .ELSE .ENDIF
Post by: MazeGen on July 30, 2008, 03:38:59 PM
See this:

http://www.masm32.com/board/index.php?topic=5654.0
Title: Re: .IF .ELSIF .ELSE .ENDIF
Post by: GUAN DE DIO on July 30, 2008, 05:38:01 PM
Thanks MazeGen,

    I was waiting for a solution like as MASM32 but this solution is good too, now my code is readable xD


GUAN

function WndProc,hWin:QWORD,uMsg:DWORD,wParam:QWORD,lParam:QWORD

   xor rax,rax
   mov eax,uMsg
   
   @IF <<cmp eax,WM_INITDIALOG>>, EQUAL?
   
      push   hWin
      pop   hWnd
      
   @ELSEIF <<cmp eax,WM_COMMAND>>,EQUAL?
   
      mov      rax,wParam
      @IF <<cmp ax,IDM_FILE_EXIT>>,EQUAL?
         invoke SendMessage,hWin,WM_CLOSE,0,0
         
      @ELSEIF <<cmp ax,IDM_HELP_ABOUT>>,EQUAL?      
      
         invoke ShellAbout,hWin,addr AppName,addr AboutMsg,NULL
         
      @ENDIF
   @ELSEIF <<cmp eax,WM_CLOSE>>,EQUAL?
   
      invoke DestroyWindow,hWin
      
   @ELSEIF <<cmp eax,WM_DESTROY>>,EQUAL?
      invoke PostQuitMessage,NULL
   
   @ELSE
      invoke DefWindowProc,hWin,uMsg,wParam,lParam
      return rax
   @ENDIF   
   
   return FALSE

endf
ret