News:

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

Win32 API and Assembler

Started by jnrico, October 26, 2005, 06:15:39 PM

Previous topic - Next topic

jnrico

I have this question that is always pops up my mind when talking about writing Windows programming in assembler.

Windows programming heavily rely on Windows API. I beleive most of those API if not all are written in C. Are you really getting much as far as speed by writing Windows program in assembler since your assembly code simply calls those API? Wouldn't the speed of your program be the same if you just write your Windows program in C?

I would appreciate it if anyone could shed some lights on this.

Rico

Mincho Georgiev

Hi, jnrico!
First of all, for a different purposes there's a different 'best' language. There is no such thing as "The Best Programming Language ever"!
For most efficient code the important thing is the way of coding. If you had a good known's about the code optimization ,well thats great. If something coded by you is bettter written in C , than ASM, offcource it will be more
efficient and backward...
There's a big number of advantages of ASM than the other languages. The ASM written PE is more compact,more fast (there is no 'noneeded' API's and stack spaces) and more portable if you like.
The disquisition of that theme can be years continued,but we all here prefare ASM than C or other languages for those and more,more other advantages!

hutch--

Rico,

There is more to Windows programming than just API code and the main advantage to assembler programmers is they can perform most of the higer level OS based junk by using system API calls. The real advantages come in doing something not canned in an API call and in te algoritm area assembler is very powerful and far more flexible. You are not stuck with an either C or assembler approach either, you can use both as the object module format is compatible so you can use C moduls in your asm code and asm modules in your C code.

This interoperability gives you a better selection in how you produce a working app. Small programs can easily be done in masm if you are familiar with it, mixed C and masm is capable of far larger projects while maintaining very good performance and in project types that are not highly speed critical, entire applications are a good choice in C.

Once the application is not highly speed critical, other languages and development time issues come into play. VB, Pacal and basic compilers are viable players in normal app development.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

jnrico

Hutch,

I see thanks for that explanation.

The way that I was thnking about it is that every time you call an API, that piece of code runs a bit slower than the portion that is written in assembler.
Is this true?