title Example 80X86 Assembly Program
; by Sergio A. Alvarez
; by the way, ';' begins a comment

.model small
; restricts code to single 64KB segment
; restricts data to single 64KB segment

.stack 200h
; allocates 200h (512d) bytes for stack
; default value is 100h

.data
; start of the default data segment
; define constants and variables here

numfingers = 5
; don't use this constant near a meat chopper

fingersandtoes = 4*numfingers
; constants may involve expressions & other constants

temperature dw ?
; variables are often better - this one is a 16-bit word

mytemperature dw 72
; this variable has been initialized to 72d

.code
; start of default code segment
; put procedures here

main proc
; start of procedure called main

.startup
; default initialization directive

mov ax,mytemperature
mov bl,2
idiv bl
; bl is divisor (denominator)
; default dividend is ax

mov temperature,ax
; quotient is really only in al,
; but I happen to know that ah=0

.exit
; default finalization directive

main endp
; end of procedure called main

end
; end of code
; one should use "end main" to specify the
; program entry point if .startup is not used

