Hi,
I installed the masm32 and im following a simple tutorial to get hello world working and i can't get any output from the program. What is wrong with the code? Please help. Thanks
.386
.model flat, stdcall
option casemap :none
includeincludeinclude\masm32\include\windows.inc
\masm32\include\kernel32.inc
\masm32\include\masm32.inc
includelibincludelib\masm32\lib\kernel32.lib
\masm32\lib\masm32.lib
.data
HelloWorld db "Hello World!", 0
.code
start:
invoke StdOut, addr HelloWorld
invoke ExitProcess, 0
end start
It assembles and links ok but no output.
Hi hghesteemed,
Welcome to the forum.
Did you build your project as CONSOLE application?
\masm32\bin\link /SUBSYSTEM:CONSOLE hello.obj
Don't forget to run your application from the command-line prompt.
Hi
Yes its a console application, i use the gui to assemble and link, it seems to since I can see both my object code and executable. Just no output when I run.
Hi
Try the "inkey" macro...
include \masm32\include\masm32rt.inc
.data
HelloWorld db "Hello World!",13,10,0
.code
start:
invoke StdOut, addr HelloWorld
inkey "Press a key to continue ..."
invoke ExitProcess, 0
end start
(also more easy to use the masm runtime include)
Greetings
i am a bit surprised it assembles with all this...
includeincludeinclude\masm32\include\windows.inc
\masm32\include\kernel32.inc
\masm32\include\masm32.inc
includelibincludelib\masm32\lib\kernel32.lib
\masm32\lib\masm32.lib
at any rate, we have a little shortcut
you can look inside the \masm32\include\masm32rt.inc file with a text editor to see what it does
include \masm32\include\masm32rt.inc
.data
HelloWorld db "Hello World!", 0
.code
start:
invoke StdOut, addr HelloWorld
inkey
invoke ExitProcess, 0
end start
Hi hghesteemed,
welcome to the forum.
Gunther
for a messagebox :
type in .CODE section :
invoke MessageBox, NULL, offset msg, offset cap, MB_OK
invoke ExitProcess, eax
type in .DATA section :
msg db "Hello World ", 0
cap db "Hey There! ",0
hope this helpss
Hi kroz,
In addition :
\masm32\bin\link /SUBSYSTEM:WINDOWS ...