NASM INDEX
;----------------------------------------------------------------
; Default segment attributes are PUBLIC, ALIGN=1, no class,
; no overlay, and USE16.
;------------------
BITS 16 ;The BITS directive specifies whether NASM
;should generate 8086 code or 80386 code
;----------------------------------------------
SEGMENT CODE
..start: ; You specify the entry point by declaring
; the reserved symbol ..start at the point
; where you wish execution to begin.
;---------------------------------------------
mov ax,DATA ;Address of data segment...
mov ds,ax ;into DS
mov sp,stack_top ;Start stack pointer
mov ax,STACK ;Address of stack segment
mov ss,ax ;into SS
mov dx,msg ;Offset of msg to DX
mov ah,9 ;DOS function: "output string"
int 0x21 ;DOS interrupt
mov ah,0x4c ;Call DOS to exit
mov al,0 ;Return(0) - error code
int 0x21 ;DOS interrupt
SEGMENT DATA ;Start of DATA segment
msg: db "Hello, World!",'$'
SEGMENT STACK STACK
resb 100h ;EXE programs demands a stack.
stack_top: ;Reserve 256 bytes.
;End of stack segment=Stack Ptr.
;- Stack pointer grows towards
;lower addresses.
;------------------------------