Hi, just wondering, as with most languages, the first thing you learn is ow to write out "Hello World". I was wondering
if I could be pointed to some examples on this forum.
Just wanted to keep the first question an easy one.
Cheers, runtime.
Welcome runtimeTerror, :U
You will find some the best people in the world, come here to get answers, as well as give them.
If you like getting and giving help in Assembler, this is the place for you!! :clap:
Look forward to you participating with us.
Start with Downloading MASM32 package and start going through the helps, examples and tutorials there.
This will start you Quick!
Regards, P1 :8)
well everyone would point you to iczelion's tutorial which you can find here (http://win32asm.cjb.net/). This is the best tutorial around for masm so i would say give it a try :)
as for a simple hello world:
.386
.model small,stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\user32.inc
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\user32.lib
.DATA
AppName db "White Scorpion",0
Hello db "Hello World!",0
.CODE
start:
invoke MessageBox,NULL,addr Hello,addr AppName,MB_OK
invoke ExitProcess,0
end start
this code calls a messagebox as a simple hello world program.
.386
.model small,stdcall
option casemap:none
include \masm32\include\kernel32.inc
include \masm32\include\user32.inc
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\user32.lib
include \masm32\macros\macrso.asm
.DATA
Hello db "Hello World!",0
.CODE
start:
Routine Proc
lpstring[128]:DWORD; For user input, see macros.asm
invoke StdOut, ADDR Hello; Print the message to the screen
mov lpstring, input (); Press enter and it quits.
ret
endp
end start
Thanks guys! Appreciate the help.
hmmmmm,
How about simpler code again using macros.
cls
print "Hello World"
exit
This is why MASM32 has a macro system so the hack stuff is easy to do and make learning assembler a lot simpler.
Otherwise, if you wanted to avoid MASM32 macros, it would look something like this...
; This works a lot better if it's created as a console application
; (linker option /subsystem:console)
.386
.model small,stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\user32.inc
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\user32.lib
.DATA
Hello db "Hello World!",13,10
Hello_length equ $-Hello
BytesWritten dd 0
.CODE
start:
invoke GetStdHandle,STD_OUTPUT_HANDLE
invoke WriteFile,eax,ADDR Hello,Hello_length,ADDR BytesWritten,NULL
invoke ExitProcess,0
end start
Personally I like "tenkey"'s example.