title  Hello World Program                         (hello.asm)

; This program displays "Hello, world!"

dosseg

.model 	small			;Identifies type of memory model to use

.stack 	100h			; Identifies size of stack segment

.data				;Contains all variables for program

msg	db	'Hello World!',0Ah,0Dh,'$'
varbyte     db 0A1h
varword     dw 0FF01h

array       dw 10h
            dw 30h
            dw 50h
            dw 70h
            dw 90h

.code				;Contains all code from program
main  	proc
      	mov   	ax,@data	;Required to setup the data segment in the ds register.
      	mov   	ds,ax

    ; mov instructions
    ; byte level 
    mov   al, 10h
    mov   ah, 20h
    mov   bl, [varbyte]
    mov   ax, array + 3
    xchg  ax, bx
    
    ; push 
    mov   ax, 1
    mov   bx, 2
    mov   cx, 3
    push  ax
    push  bx
    push  cx
    pop   ax
    pop   bx
    pop   cx
    ; arithmetic operations
    mov   ax, 1 
    inc   ax
    inc   ax
    dec   ax
    mov   bx, 3
    add   ax, bx
    sub   ax, bx
    sub   ax, 100
    ; multiply
    mov   ax, 300h
    mov   bx, 500h
    mul   bx
    ; divide
    mov   ax, 14
    mov   dx, 0
    mov   bx, 4
    div   bx
    ; addressing 
    mov   bx, offset array
    mov   ax, [bx]
    mov   ax, 3[bx]
    mov   si, 2
    mov   ax, [si][bx]
    ; terminate the program     
  	mov   	ax,4C00h	;Required to terminate program normally
	int   	21h
main  	endp
end   	main

