.model small
.stack 1000h
.data
t equ 4000

.code  

tone macro div,dur 
    
    mov al,0b6h
    out 43h , al
    
    mov ax ,div
    out 42h,al 
    
    mov al,ah
    out 42h,al
    
    mov al,03h
    out 61h ,al 
    
    mov cx,dur
    call delay1 
    
    mov ax,0h
    out 61h,al  
    
    call delay2
endm

.startup  

tone 4542,t   ; hap ( C4 )
tone 4542,t   ; py ( C4 )
tone 4048,2*t   ; birth ( D4 )
tone 4542,2*t   ; day ( C4 )
tone 3410,2*t   ; to ( F4 )
tone 3606,4*t   ; you ( E4 )
tone 4542,t   ; hap ( C4 )
tone 4542,t   ; py ( C4 )
tone 4048,2*t   ; birth ( D4 )
tone 4542,2*t   ; day ( C4 )
tone 3036,2*t   ; to ( G4 )
tone 3410,4*t   ; you ( F4 )
tone 4542,t   ; hap ( C4 )
tone 4542,t   ; py ( C4 )
tone 2275,2*t   ; birth ( C5 )
tone 2705,2*t   ; day ( A4 )
tone 3410,2*t   ; dear ( F4 )
tone 3606,2*t   ; so ( E4 )
tone 4048,6*t   ; so ( D4 )
tone 2554,t   ; hap ( B4b )
tone 2554,t   ; py ( B4b )
tone 2705,2*t   ; birth ( A4 )
tone 3410,2*t   ; day ( F4 )
tone 3036,2*t   ; to ( G4 )
tone 3410,4*t   ; you ( F4 )
   
mov ax ,4c00h
int 21h   

delay1 proc near
    d1:
    push cx
    mov cx,38000
    d2:
    loop d2
    pop cx
    loop d1
    ret 
delay1 endp  

delay2 proc near
    mov cx,65000
    d3:
    loop d3
    ret 
delay2 endp

end