How do you write a simple Assembly Language program that says " Hello World"?
Also, how do you run the program/
Note: I am running Windows Vista, 32bit Operating system
- ZeeLv 41 decade agoFavorite Answer
Here's the "Hello World" program in assembly:
.MODEL flat, stdcall
HelloMsg DB "Hello World", 0
CRLF DB 00Ah, 00Dh, 0
ExitMsg DB "Enter to Exit", 0
buffer DB ?
invoke StdOut, addr HelloMsg
invoke StdOut, addr CRLF
invoke StdOut, addr ExitMsg
invoke StdIn, addr buffer, 1
invoke ExitProcess, 0
You need WinAsm to run this:
- jplatt39Lv 71 decade ago
Use interrupt 10h. That's a call which is left over from the very earliest days of IBM PCs.
Here's a link to an old C influenced Assembly language program which writes a string to the screen:
It writes a null terminated string. How? cputs calls cputs_2. cputs_2 compares the char to be written to the null char. If it's not equal, it jumps back to cputs_1, which calls putch then falls back int cputs_2. When cputs_2 reaches he null character, it terminates. This program was meant to be compiled with nasm, which is a good program.
Here is another simple example, for older compilers:
Gosh, this all reminds me I haven't tried ANY Assembler in years.