.MODEL SMALL 
.STACK 1000H
.DATA
COUNT EQU 238   ;counter value
TIME  EQU 30000 ;delay

.CODE 
START:

MOV AL,0B6H    ;send the control word to register(show fig 3.1)
OUT 43H,AL     ;43h the address of  CONTROL REGISTER

MOV AX,COUNT   ;sentd the count to AX
OUT 42H,AL     ;send the LSB  byte to COUNTER2

MOV AL,AH      ;send the MOS byte to COUNTER2
OUT 42H,AL

IN AL,61H      ;READ PORT B
OR AL,00000011B 
OUT 61H,AL    ; enable  G2 TO SPEAKER BY SENDING 03H TO PORT B

MOV CX,TIME   ; delay
DELAY1:
PUSH CX
MOV CX,30000   ;counter of 30000
DELAY2:
LOOP DELAY2
POP CX
LOOP DELAY1

IN AL,61H  
AND AL,11111100B
OUT 61H,AL  ;disable G2 SPEAKER by sending  FCH TO PORT B 

MOV AX,4CH
INT 21H

END START

