The MASM Forum Archive 2004 to 2012

Project Support Forums => MASM32 => Topic started by: danzar on December 08, 2009, 09:01:26 PM

Title: Masm conversion
Post by: danzar on December 08, 2009, 09:01:26 PM
I was woundering if there is a tut or a posting on conversion from Masm to C++ or some HLL or C++ to Masm so I can help understand the logic. I have been reading and studing Kip Irvine's "Assembly Language for Intel-Based Computers". It has some conversions but I would like to see more so I can grasp the logic better.

Thanks for any and all help
Danzar
Title: Re: Masm conversion
Post by: jj2007 on December 08, 2009, 09:28:22 PM
Masm has a powerful macro engine that makes it emulate anything from C-style to BASIC-style. Conversions depend on what you were used to. The best starting point is \masm32\help\hlhelp.chm, from Overview/Creating procedures onwards.
Second step could be a look at the Masm32 examples, e.g. \masm32\examples\exampl01\generic\generic.asm
I attach a very simple Windows example taken from the RichMasm/MasmBasic (//http://) editor; open it either in RichMasm or in MsWord or in WordPad.
Title: Re: Masm conversion
Post by: hutch-- on December 09, 2009, 12:18:34 AM
Danzar,

Microsoft C  can be set with a switch so that it creates an assembler dump and while the output is no joy to read, you can simplify it by turning the internal compiler optimisation off. As long as you are familiar with the  standard C notation there are only minor notation differences in terms of IF blocks, WHILE loops and C style runtime evaluation.

What will take the time is learning the basics of registers and the intel instruction set but the reference material from intel is excellent if a bit technical. With practice you write MASM code at about the same speed as low level C. Very high level C++ is a lot more complicated internally and it goes together with a different brain being an OOP language, this can be done to some extent in MASM with the right support but its not a native capacity as assembler is simply lower level than OOP.