Re: Is MASM32 an evil Microsoft plot? (Part 2)

From: hutch-- (hutch_at_movsd.com)
Date: 11/15/04


Date: 15 Nov 2004 02:40:43 -0800

Ray,

You may need a slightly larger sample. Try this.

ALA low level
~~~~~~~~~~~~~
push MB_OK
push offset titletxt
push offset msgtxt
push hWnd
call MessageBox

invoke style
~~~~~~~~~~~~
invoke MessageBox,hWnd,ADDR TxtMsg,ADDRTtlTxt,MB_OK

simple macros
~~~~~~~~~~~~~
invoke MessageBox,hWnd,chr$("Arrrgh G'day"),chr$("Greetings"),MB_OK

inline text macro
~~~~~~~~~~~~~~~~~
fn MessageBox,hWnd,"Howdy Folkz","Greetings",MB_OK

Stuff all of these wicked illegal, immoral and fattening variations of
MASM code through the most powerful assembler available in 32 bit
Windows and guess what happens ? They all come out the same code.

What is the moral to this story ?

@@:
  fn MessageBox,hWnd,"An API is an API is an API","Lesson",MB_OK
  jmp @B

I guess it depends on if you like the extra typing or feel profound at
being able to type all of the pushes before the call but in the end,
and API call is just that, an API call.

Its handy to know how a manual API call works as in fact almost every
MASM programmer already knows that but there is a lot more to
programming than the profundity of mastering a manual API call once
you know how its done, there is productivity, type checking, ease and
convenience, all of those things you have with a big professional
assembler like MASM that make it such a good choice to write small
speed critical assembler applications.

Once you have been writing Windows code long enough, you see API code
as crap OS based code to get interfaces up and going, there is nothing
profound in how they work or how to call and run them, just hack OS
code to make the warm and fuzzies for your application so users can
understand it.

Why waste your time with crap when you can put research time into
ALGORITHMS where you get something for your work ?

Regards,

hutch at movsd dot com



Relevant Pages

  • Re: Learning Assembly with an HLL
    ... unavoidable API stuff. ... it more difficult to comprehend why you would recommend INVOKE. ... bytes and that the 32 bytes at top of stack must be available ... If the assembler doesn't know where the scratch space in the ...
    (comp.lang.asm.x86)
  • Re: Learning Assembly with an HLL
    ... unavoidable API stuff. ... it more difficult to comprehend why you would recommend INVOKE. ... bytes and that the 32 bytes at top of stack must be available ... If the assembler doesn't know where the scratch space in the ...
    (comp.lang.asm.x86)
  • Re: Converting char(s) into String
    ... Perhaps because it depends on knowledge of the API. ... If the compiler produced code using StringBuffer ... invoke 0 parameter constructor of StringBuffer. ... invoke 1 parameter append method. ...
    (comp.lang.java.programmer)
  • absolute address
    ... The general solution is to use the ShellExecuteAPI with the ... "print" verb to invoke the registered application to print it. ...
    (microsoft.public.dotnet.languages.vc)
  • Re: How to "Change user"
    ... can invoke this command with an API call? ... Thangs in advance! ...
    (microsoft.public.vb.general.discussion)