Mail Archives: djgpp/2000/09/27/20:00:32
Eli Zaretskii <eliz AT is DOT elta DOT co DOT il> wrote:
> But please first test that the original libc version does have
> problems as reported in this thread, before you try the new version
> above. Otherwise, we don't know that this change indeed fixes that
> problem.
ok, I managed to get access to an NT machine to do some testing. The
patch I posted does not in fact fix the problem.
Below is a description of the bug and a patch which fixes sound() to
work on NT. This has been tested (on NT) but I would appreciate
someone with knowledge of PC hardware programming to look at it to
determine that nothing will get broken by the changes.
In an NT 'DOS box', the first call to sound() is ignored. Subsequent
calls to sound() are honoured. The effect persists for each DOS box
session, ie the second time a program is run, its first call to
sound() will work. If the DOS box is closed and another is opened,
then again the first call to sound() will be ignored.
The patch I previously posted assumed that the suggestion to call
nosound() before sound() would fix the problem, it does not.
Here is a patch that causes sound() to behave on NT:
--- src/libc/pc_hw/sound/sound.c.original Wed Sep 27 11:52:52 2000
+++ src/libc/pc_hw/sound/sound.c Wed Sep 27 11:55:34 2000
@@ -11,8 +11,11 @@
return;
}
scale = 1193046 / freq;
+
+ /* Enable PC-speaker; do this first to work around a NT bug */
+ outportb(0x61, inportb(0x61) | 3);
+
outportb(0x43, 0xb6);
outportb(0x42, scale & 0xff);
outportb(0x42, scale >> 8);
- outportb(0x61, inportb(0x61) | 3);
}
- Raw text -