#include "dos.h" void onbeep(int freq) { int temp; long val = ((182 * 65535)/10)/freq; if (val > 65535) val = 65535; outportb(0x43,0xb6); outportb(0x42,val & 0xff); outportb(0x42,val >> 8); temp = inportb(0x61); temp |= 3; outportb(0x61,temp); } void offbeep(void) { int temp = inportb(0x61); temp &= 0xfc; outportb(0x61,temp); } void main(int argc, char *argv[]) { onbeep(atoi(argv[1])); delay(1000); offbeep(); }