From: Jason Green Newsgroups: comp.os.msdos.djgpp Subject: Re: How to ring tge bell? Date: Wed, 27 Sep 2000 20:36:56 +0100 Organization: Customer of Energis Squared Lines: 41 Message-ID: References: <7e82tsc2jrko61qdim56cnehgbhkrbtqcv AT 4ax DOT com> NNTP-Posting-Host: modem-235.california.dialup.pol.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: newsg4.svr.pol.co.uk 970083497 11039 62.137.56.235 (27 Sep 2000 19:38:17 GMT) NNTP-Posting-Date: 27 Sep 2000 19:38:17 GMT X-Complaints-To: abuse AT theplanet DOT net X-Newsreader: Forte Agent 1.7/32.534 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Eli Zaretskii 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); }