Author Topic: Problems with NASM  (Read 11861 times)

Offline Lucas Nunes

  • New Member
  • Posts: 1
Problems with NASM
« on: February 27, 2010, 01:44:47 AM »
Hello!
I'm noob in NASM. Well, my biggest problem is a basic. I can't "compile".
I tried very Hello World programs that I found on the internet.
I am almost abandoning the NASM...  :-[

So please, someone can make a Hello World program for Windows?
How do I build?


Offline Mathi

  • Jr. Member
  • *
  • Posts: 82
  • Country: in
    • Win32NASM
Re: Problems with NASM
« Reply #1 on: February 27, 2010, 06:02:39 AM »

Offline Bryant Keller

  • Forum Moderator
  • Full Member
  • *****
  • Posts: 360
  • Country: us
    • About Bryant Keller
Re: Problems with NASM
« Reply #2 on: February 27, 2010, 06:25:46 AM »
I find it hard to believe you couldn't find a single win32 "hello, world" NASM application that worked... You apparently didn't look hard enough. Here is a basic hello world and build instructions for Win32 using NASM and GoLINK. Try using the forum search function and possibly Google Code Search.

Code: [Select]
BITS 32

EXTERN ExitProcess@4
EXTERN MessageBoxA@16

NULL EQU 000h
MB_OK EQU 000h
MB_ICONQUESTION EQU 020h

SECTION .data

strMessage DB "Hello, World!", 0
strTitle DB "Win32NASM", 0

SECTION .text

GLOBAL _main
_main:
Push DWORD MB_OK + MB_ICONQUESTION
Push DWORD strTitle
Push DWORD strMessage
Push DWORD NULL
Call MessageBox@16

Push DWORD 0
Call ExitProcess@4

To build it use:

Code: [Select]
nasm -f win32 -o test.obj test.asm
golink /entry _main test.obj kernel32.dll user32.dll
« Last Edit: February 27, 2010, 06:51:57 AM by Bryant Keller »

About Bryant Keller
bkeller@about.me