Question: Modify the TONE.ASM program so that the 0.25-second 1 KHz tones plays five times, once each second. Hint: Use DOS INT 21H Function 2CH (Get

Modify the TONE.ASM program so that the 0.25-second 1 KHz tones plays five times, once each second. Hint: Use DOS INT 21H Function 2CH (Get Time) to read the system clock. Look for the seconds value to change. When it does, play the 0.25-second tone, then start watching the system clock again, waiting for the seconds to change again. Do this five times.

I TRIED BUT Donot repeating 5 times

;Program TONE.ASM: Generate a 1 KHz tone on the PC speaker for 5 seconds. ; .MODEL SMALL .DATA ;Note: You will have to adjust these values to get the 5 seconds. ;The current values give just over 1 second on a 1.3 GHz machine. OUTER DW 125 ;outer loop count INNER DW 500 ;inner loop count NOW DB 60 .CODE .STARTUP CALL SPKRON ;turn speaker on MOV CX,1190 ;divisor for 1 KHz tone CALL LDTIMER ;set speaker frequency CALL DELAY ;wait for chosen duration CALL SPKROFF ;turn speaker off .EXIT

SPKRON PROC NEAR IN AL,61H ;read current state of port 61h OR AL,3 ;set speaker control bits OUT 61H,AL ;output new state RET SPKRON ENDP

SPKROFF PROC NEAR IN AL,61H ;read current state of port 61h AND AL,0FCH ;clear speaker control bits OUT 61H,AL ;output new state RET SPKROFF ENDP

DELAY PROC NEAR MOV DX,OUTER WAIT1: MOV CX,INNER WAIT2: NOP NOP NOP NOP LOOP WAIT2 DEC DX JNZ WAIT1 WAIT3: MOV AH,2CH INT 21H MOV NOW,DH MOV AH,2CH INT 21H CMP NOW,DH JZ WAIT3 RET DELAY ENDP

;Note: Output frequency equals 1,190,000 divided by CX

LDTIMER PROC NEAR MOV AL,0B6H ;timer 2 control word OUT 43H,AL MOV AL,CL ;output lower byte of count OUT 42H,AL MOV AL,CH ;output upper byte of count OUT 42H,AL RET LDTIMER ENDP

END

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!