Hi I just switched to nasm and was wondering can i use masm's windows inc file which has all the equ's?

Thanks alot.

Posted on 2006-05-28 12:49:33 by gavin_

Hi I just switched to nasm and was wondering can i use masm's windows inc file which has all the equ's?

Thanks alot.

It shouldn't be too hard getting the EQUs to work with nasm, but the structs are an entirely different subject... it's going to be a lot of bother. If you want to use a non-MASM assembler, you should check out FASM or PoASM (which is MASM compatible) - or perhaps SynFire's NASM32 project on this board.
Posted on 2006-05-28 14:35:41 by f0dder

Sorry, I've been away for a few days due to personal reasons. My NASM32 project has a more or less complete version of the windows.inc file (including others). Even if that is the only part of the NASM32 project you get, it's well worth the small download as it also includes definitions for most of the structures you use in Win32 application development. If you plan to use the entire NASM32 project, please view the demo's. Using it is a little different from MASM as you don't need the Platform SDK (my includes handle DLL importing for you). Here is a quick example of the code.

; Compile with:
; nasmw -fobj demo1.nas
; alink -oPE demo1.obj

%include '\nasm32\inc\windows.inc'
%include '\nasm32\inc\kernel32.inc'
%include '\nasm32\inc\user32.inc'
%include '\nasm32\inc\nasm32.inc'

entry    demo1

proc    demo1
    invoke    my_p, dword szContentTwo, dword szTitleTwo
    invoke    MessageBoxA, dword NULL, dword szContent, dword szTitle, dword MB_OK
    invoke    ExitProcess, dword NULL


proc    my_p
sz_Content    argd
sz_Title      argd

    invoke    MessageBoxA, dword NULL, dword argv(sz_Content), dword argv(sz_Title), dword MB_OK


    szTitle:      db  'Demo1', 0x0
    szTitleTwo:    db  'Demo1 Procedure', 0x0
    szContent:    db  'Hello from the Application!', 0x0
    szContentTwo:  db  'Hello from the Procedure!', 0x0

FASM is a very good assembler in my oppinion. And it also comes with everything you need in the form of include files, and also doesn't require the Platform SDK. The reason I try to stay away from developing using assemblers that need the Platform SDK for development on Windows is mearly that it's huge. Both NASM32 and FASM contain everything you need in a very small amount of disk space.

Bryant Keller
Posted on 2006-05-28 18:53:07 by Synfire


- or perhaps SynFire's NASM32 project on this board.

Thank you Fodder I had a look at the nasm32 package and I will use the windows.inc file.I'll stick to nasm as I am very happy with the way it does things.

Great work SynFire I am using your windows.inc file and will definetly end up using your other include files along with all the structures you did.

I have a few questions there if you don't mind .

First what exactly are equates and where did you get them?

How do I make my own include files if needed ?

Thanks alot the work you did on nasm32 is cool ;)

Posted on 2006-05-29 11:44:38 by gavin_

The equates (or %defines in my case) are used for readability. They make your code easier to read by giving names to certain values. For example; say in your message loop you want to process menu commands. The MSDN Library says to process the WM_COMMAND message. In assembly (without the equates) you would test against the value 111h. But using equates we can simply test against WM_COMMAND.

; without WM_COMMAND equate
mov eax,
cmp eax, 111h

That's a little hard to read, instead we can do this.

mov eax,
cmp eax, WM_COMMAND

As you can see, that makes the code look a little more readable. And, if you make use of PROC/ENDPROC and the ARGD (Argument Definition) macro in NASM32.INC it becomes even more readable.

mov eax, argv(uMsg)
cmp eax, WM_COMMAND

An include file is just a collection of preprocessor directives and/or commands inserted into a text file (usually named .inc or .h). In your application you can add in this code using the %include directive. Where ever you put the %include directive, the assembler will stop reading from the file, read the file pointed to by %include, then pick up reading after the %include in your primary file.

If you would like to create an include to reference procedures in outside DLL's, you could read my include files which do this and try to design them like mine. But the NASM32.INC file supports an easier way. This easier way is the macro 'dllproc', chech Demo9 for more information. This is how I worked out creating and referencing home brew DLL's.
Posted on 2006-05-29 13:29:47 by Synfire

Oh I understand now.
Thanks for clearing that up man ;)

Going to ramble on here a little.

So all the words like WM_COMMAND etc are all coresponding to hex values.
So what microsoft did was have words instead of hex to make it easier .
Not sure if I'm right but here goes.

So back in the day when everyone used dos interupts, microsoft turned those interrupts into equates like WM_COMMAND etc?I mean now when they made there api or am i wrong.

About the include files I'll read yours as it would be nice to know how to make my own from other non system dll's if thats legal?


Posted on 2006-05-30 09:14:04 by gavin_