How to write hello world in assembler on Windows?


I wanted to write something basic in assembly under Windows, I'm using NASM, but I can't get anything working.

How to write and compile hello world without the help of C functions on Windows?

NASM examples.

; ----------------------------------------------------------------------------
; helloworld.asm
; This is a Win32 console program that writes "Hello, World" on one line and
; then exits.  It needs to be linked with a C library.
; ----------------------------------------------------------------------------

    global  _main
    extern  _printf

    section .text
    push    message
    call    _printf
    add     esp, 4
    db  'Hello, World', 10, 0

Then run

nasm -fwin32 helloworld.asm
gcc helloworld.obj

There's also The Clueless Newbies Guide to Hello World in Nasm without the use of a C library. Then the code would look like this.

org 100h
mov dx,msg
mov ah,9
int 21h
mov ah,4Ch
int 21h
msg db 'Hello, World!',0Dh,0Ah,'$'

Good luck.