Could someone please tell me how to compile an assembly program.
I have the code, but I can't compile it.

Also, my "Hello, world!" program does not run when using Flat Assemble, a compiler I got off the internet.
Here is my code:

.386
.model flat, stdcall
option casemap :none
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\masm32.inc
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\masm32.lib
.data
HelloWorld db "Hello World!", 0
.code
start:
invoke StdOut, addr HelloWorld
invoke ExitProcess, 0
end start

;the reason I put [] on either side of my code is to show it is code

It is meant to make a message box appear to display "Hello World!", and the program is called Hello.asm and when I compile it it says that Hello.asm is an error in the code. It doesn't make sense.

Please help me,
Rileyh

Edited 5 Years Ago by Ezzaral: Added code tags. Please use them to format any code that you post.

function stdout prints the string in to the console, so you have to "assemble" (not compile)as a console program to produce an output from the above code.
If you want to "make" a message box then you have to invoke the MessageBox funtion(In that case don't forget to include "user32.inc" and "user32.lib" in your code).

You downloaded "Flat Assembler"? That is FASM, your code is MASM. It WILL NOT assemble with FASM without some modifications.

if you want to actually understand how assembly works, you shouldn't use all those pre-defined macros! there isn't one single CPU instruction in all of the code you pasted. understanding assembly means understanding the instructions and what they do.

and in the future please just use the CODE tags instead of just throwing a [ and a ] at the beginning and end.

I already tested a lot of ASM Compilers, and the one which i most liked was WinASM, but you need MASM to use it, and i think its better you use MessageBox in your hello world

PUSH 0 ;specify that its a MB_OK message
PUSH HelloWorld ;text from the message
PUSH HelloWorld ;title of the message
PUSH 0 ;handle of the message, 0 as the program itself
CALL MessageBoxA
This article has been dead for over six months. Start a new discussion instead.