Anonymous
Anonymous asked in Computers & InternetSoftware · 1 decade ago

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

2 Answers

Relevance
  • Zee
    Lv 4
    1 decade ago
    Favorite Answer

    Here's the "Hello World" program in assembly:

    .386

    .MODEL flat, stdcall

    OPTION CASEMAP:NONE

    Include windows.inc

    Include kernel32.inc

    Include masm32.inc

    IncludeLib kernel32.lib

    IncludeLib masm32.lib

    .data

    HelloMsg DB "Hello World", 0

    CRLF DB 00Ah, 00Dh, 0

    ExitMsg DB "Enter to Exit", 0

    .data?

    buffer DB ?

    .code

    Start:

    invoke StdOut, addr HelloMsg

    invoke StdOut, addr CRLF

    invoke StdOut, addr ExitMsg

    invoke StdIn, addr buffer, 1

    invoke ExitProcess, 0

    End Start

    You need WinAsm to run this:

    http://www.winasm.net/index.php?ind=downloads

    • Login to reply the answers
  • 1 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:

    http://my.execpc.com/~geezer/osd/cons/bios0e.asm

    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.

    http://nasm.sourceforge.net/

    Here is another simple example, for older compilers:

    http://www.emu8086.com/assembly_language_tutorial_...

    Gosh, this all reminds me I haven't tried ANY Assembler in years.

    • Login to reply the answers
Still have questions? Get your answers by asking now.