(Solved) : 1 Download Program Toneasm Assemble Link Run Hopefully Hear Speaker Beep 1 Khz Rate Short Q42874953 . . .

$9.00

1. Download the program TONE.ASM. Assemble, link, and run.Hopefully, you will hear the speaker beep at a 1 KHz rate for ashort period.

a. Adjust the INNER and OUTER values until the tone lasts for 5seconds. How many loops are required? What is the speed of theprocessor on your system? (my processor speed is 3.8GHz)

b. Readjust the INNER and OUTER values for tone duration of 0.25seconds.

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

d. Submit the final ASM file.

—————————————————————————————————————————-

;Program TONE.ASM: Generate a 1 KHz tone on the PC speaker for 5seconds.
;
.MODEL SMALL
.DATA
;Note: You will have to adjust these values to get the 5seconds.
;The current values give just over 1 second on a 1.3 GHzmachine.
OUTER   DW   4000           ;outer loop count
INNER   DW   50000          ;inner loop count

.CODE
.STARTUP
CALLSPKRON          ;turnspeaker on
MOV  CX,1190         ;divisorfor 1 KHz tone
CALLLDTIMER         ;setspeaker frequency
CALLDELAY          ;wait for chosen duration
CALLSPKROFF         ;turnspeaker off
.EXIT

SPKRON PROC NEAR
IN   AL,61H          ;readcurrent 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          ;readcurrent state of port 61h
AND  AL,0FCH         ;clearspeaker 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
RET
DELAY   ENDP

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

LDTIMER PROC NEAR
MOV  AL,0B6H         ;timer 2control 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

 

Expert Answer


Answer to 1. Download the program TONE.ASM. Assemble, link, and run. Hopefully, you will hear the speaker beep at a 1 KHz rate for…

Category:

Description

1. Download the program TONE.ASM. Assemble, link, and run.Hopefully, you will hear the speaker beep at a 1 KHz rate for ashort period.

a. Adjust the INNER and OUTER values until the tone lasts for 5seconds. How many loops are required? What is the speed of theprocessor on your system? (my processor speed is 3.8GHz)

b. Readjust the INNER and OUTER values for tone duration of 0.25seconds.

c. Modify the TONE.ASM program so that the 0.25-second 1 KHztones plays five times, once each second. Hint: Use DOSINT 21H Function 2CH (Get ... View full description