The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: runtimeTerror on February 04, 2005, 07:39:49 PM

Title: functions/classes in MASM
Post by: runtimeTerror on February 04, 2005, 07:39:49 PM
Ok, time for the dumb question of the day, but just say that I want to make an MASM app with several windows. I would want to do this as easily as possible, so could i do the equvalent of making a function in VB, and calling it with various properties?
Title: Re: functions/classes in MASM
Post by: P1 on February 04, 2005, 08:30:56 PM
You are now getting a grasp of why VB is a HLL vs MASM.  There as some pre-built stuff for MASM.  You may wish to check out one of the MASM IDEs.  Like RADasm.

Regards,  P1  :8)
Title: Re: functions/classes in MASM
Post by: runtimeTerror on February 04, 2005, 09:25:13 PM
So functions, or even blocks of call-able code are not possible in MASM?
Title: Re: functions/classes in MASM
Post by: James Ladd on February 04, 2005, 09:30:07 PM
yes functions are possible in masm.
so are blocks of callable code.

eg:


     myfunction proc arg1:DWORD
          ; just return the argument passed in.
          mov eax, arg1
          ret
     myfunction endp


eg: call


     invoke myfunction, 42



Title: Re: functions/classes in MASM
Post by: runtimeTerror on February 04, 2005, 09:35:13 PM
Cool, thanks.
Title: Re: functions/classes in MASM
Post by: Bieb on February 05, 2005, 04:49:02 PM
It's important to know that ASM doesn't have intrinsic support for returning values from functions, though, and it's conventional to use certain registers.  If you're just migrating in from VB, you should have a look at Easy Code (it's forum is in the IDE Development forum on this site).  It lets you program in ASM in a way somewhat similar to VB.  It'll handle resource files and creation of windows for you, and includes some handy macros for dealing with controls.