* added compilers lcc and bcc (linux86)
[mascara-docs.git] / compilers / linux86-0.16.17 / libc / msdos / sound.c
blob90c474c8a6e29d59fecd91157480b65c62d20bcc
2 #include <bios.h>
4 static int port_val = -1;
6 sound(freq)
7 unsigned freq; /* freq is in hertz */
9 if(port_val == -1 )
10 port_val = inp(0x61);
12 freq = 1193180L / freq;
14 outp(0x61, port_val|3);
15 outp(0x43, 0xb6);
16 outp(0x42, freq&0xFF);
17 outp(0x42, (freq>>8)&0xFF);
20 nosound()
22 if( port_val )
23 outp(0x61, port_val);
24 else
25 outp(0x61, inp(0x61)&~3);