home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Supreme Volume 6 #1
/
swsii.zip
/
swsii
/
215
/
DDJ9302.ZIP
/
DFPP01.ZIP
/
SPEAKER.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1992-11-21
|
559b
|
23 lines
// -------- speaker.cpp
#include <dos.h>
#include <conio.h>
#include "speaker.h"
#include "dflatdef.h"
// -------- sound a tone
void Speaker::Beep()
{
outp(0x43, 0xb6); // program the frequency
outp(0x42, (int) (COUNT % 256));
outp(0x42, (int) (COUNT / 256));
outp(0x61, inp(0x61) | 3); // start the sound
// -------- wait two clock ticks
const int far *clk = (int far *) MK_FP(0x40,0x6c);
int then = *clk+2;
while (*clk < then)
;
outp(0x61, inp(0x61) & ~3); // stop the sound
}