Is there a way that u can write the code in C to generate tone such , A or G tone like in assembly?I know how to write the delay function, but I did not see any equivalent code in writing to the timer register.
// PC Running MS-DOS, Borland Turbo C++
#include <stdio.h>
void sound(int frequency);
void main(void) {
int myFrequency;
myFrequency = 2000; // Sample frequency to make this listing work...
sound(myFrequency); // Whatever the frequency for Middle C is...
}
void sound(int frequency) {
asm {
mov al, 182; out 43h, al; mov ax, frequency
out 42h, al; mov al, ah; out 42h, al; in al, 61h
or al, 2; out 61h, al; mov bx, 25
task1:
mov cx, 65535
task2:
dec cx; jne task2; dec bx; jne task1; in al, 61h
and al, 252; out 61h, al
}
}
by Jake Hertz
by Jake Hertz
by Duane Benson
by Jeff Child