Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
  2. #include <pc.h>
  3. #include <assert.h>
  4.  
  5. void sound(int freq)
  6. {
  7.   int scale;
  8.   if (freq == 0)
  9.   {
  10.     outportb(0x61, inportb(0x61) & ~3);
  11.     return;
  12.   }
  13.   scale = 1193046 / freq;
  14.   outportb(0x43, 0xb6);
  15.   outportb(0x42, scale & 0xff);
  16.   outportb(0x42, scale >> 8);
  17.   outportb(0x61, inportb(0x61) | 3);
  18. }
  19.