News:

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

Just started

Started by rickszyr, June 22, 2009, 12:18:04 AM

Previous topic - Next topic

rickszyr

Hi! could anyone give me a hello world example and explain to me how to compile it, just so that i get the syntax right.

Thanx!

dedndave

if you have downloaded the masm32 package, there should be one there
the links in the upper right corner will get you there (masm32v10r.zip i think)
when installing, shut down all other programs so you will get no errors

welcome to masm32

this thread has a batch file for console apps...
http://www.masm32.com/board/index.php?topic=11694.msg88166#msg88166

disintx

Win32 hello:


.386
.model flat, stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\kernel32.lib
include \masm32\include\user32.inc
includelib \masm32\lib\user32.lib
.data
MsgBoxCaption db "A hello from win32 api!", 0
MsgBoxText db "Hello, world!", 0

.code
start:
push MB_OK
push offset MsgBoxCaption
push offset MsgBoxText
push NULL
call MessageBox
push 0
call ExitProcess
end start


If you're using the Masm32 QuickEditor, you can click on Project -> Assemble & Link.
If not, you will want to read what dedndave just linked :)

Vortex

Hi rickszyr,

Welcome to the forum.

herge

Hi rickszyr,

Hellow.asm ...

; HELLOW.ASM 11:10:53 AM Saturday, July 26, 2008
.386
.model flat, stdcall
option casemap:none
include c:\masm32\include\windows.inc
include c:\masm32\include\kernel32.inc
includelib c:\masm32\lib\kernel32.lib

.const
hello       db "Hello World!",13,10

.data?
hStdIn      HANDLE  ?
hStdOut     HANDLE  ?
nIOBytes    DWORD   ?
biff        DWORD   ?

.code
start:
    invoke GetStdHandle, STD_INPUT_HANDLE
    mov hStdIn,eax
    invoke GetStdHandle, STD_OUTPUT_HANDLE
    mov hStdOut,eax
    invoke WriteFile, hStdOut,ADDR hello,SIZEOF hello,ADDR nIOBytes,NULL
    invoke ReadFile, hStdIn,ADDR biff,1,ADDR nIOBytes,NULL
    invoke ExitProcess, NULL

end start
; End of C.masm32.bin.hellow.asm this helps u to find the directory!

Makpdb.bat ...

REM MAKPDB.BAT 5:15 AM 6/3/2006
REM From Masm Forum
\masm32\bin\ml /c /coff /Zi /Zd "%1.asm"
\masm32\bin\link /SUBSYSTEM:CONSOLE /OPT:NOREF /RELEASE /NOLOGO /DEBUG /PDB:"%1".pdb "%1.obj"
set _debug_this=c:\masm32\bin\%1.exe
dir %1.*
pause
REM End of File masm32.bin.Makpdb.bat


Make 2 files one makpdb.bat which U will run from a Dos Box ie command prompt
ie Start,run,cmd,makpdb hellow

Other file hellow.asm
U will have to get to masm32.bin directory first and save hellow.asm

Welcome to the forum.

The pdb file is used by windbg, Olly, for single stepping!

Regards: herge
// Herge born  Brussels, Belgium May 22, 1907
// Died March 3, 1983
// Cartoonist of Tintin and Snowy