To write and use the following "Hello World" program you will need to have Microsoft Macro Assemble ( MASM for short )...It is a free download from Microsoft and is included in every edition of Visual Studio ( the latest been MASM 9 in Visual Studio 2008 ).....
Just open Notepad and copy the code shown below and save it as hello.asm on your desktop...
.586
.model small,c
.stack 100h
.data
msg db "Hello World!",0
.code
includelib MSVCRT
extrn printf:near
extrn exit:near
public main
main proc
push offset msg
call printf
push 0
call exit
main endp
end main
Now open Visual Studio command prompt and execute the following command: ml hello.asm /link /subsystem:console
This will create two files: hello.obj and hello.exe on your desktop...To run the program just type hello or hello.exe on your command prompt.
I wouldn't explain the details of the code but know that the .586 means that the source uses the Pentium microprocessor instruction set...That means it would run on any computer which has at least the Intel Pentium processor( released in 1993 ).
Cheers-guestworm
No comments:
Post a Comment