From: Jason Green To: Eli Zaretskii Cc: djgpp AT delorie DOT com Subject: Re: How to ring tge bell? Date: Tue, 26 Sep 2000 23:28:57 +0100 Message-ID: <7e82tsc2jrko61qdim56cnehgbhkrbtqcv@4ax.com> References: <39CD00B8 DOT 9CD51E2 AT lps DOT u-psud DOT fr> <8qj18f$ld9$1 AT uranium DOT btinternet DOT com> <83ya0i93b4 DOT fsf AT mercury DOT st DOT hmc DOT edu> <8qn2ka$ftp44$1 AT ID-43526 DOT news DOT cis DOT dfn DOT de> <0uivss0rdic5o754ibhrrgn9kkl8khoepi AT 4ax DOT com> <9743-Tue26Sep2000090737+0300-eliz AT is DOT elta DOT co DOT il> <3kr1tsol8hqa4b87tps9u59vje591dg2ib AT 4ax DOT com> <7458-Tue26Sep2000224417+0300-eliz AT is DOT elta DOT co DOT il> In-Reply-To: <7458-Tue26Sep2000224417+0300-eliz@is.elta.co.il> X-Mailer: Forte Agent 1.7/32.534 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id SAA10802 Reply-To: djgpp AT delorie DOT com "Eli Zaretskii" wrote: > > Even so, can someone point me to the sources for nosound()? > > It's in ;-) LOL. Ah!, so grepping the whole of /djgpp/src is no use. ;-) Anyhow, I would say the NT fix should be simple. Maybe someone wants to try this?... Download and install djlsr203.zip Edit the file \djgpp\src\libc\pc_hw\sound\sound.c change: int scale; if (freq == 0) { outportb(0x61, inportb(0x61) & ~3); return; } to: int scale; outportb(0x61, inportb(0x61) & ~3); if (freq == 0) { return; } Recompile and merge with libc: C:\djgpp\src\libc\pc_hw\sound>gcc -O2 -Wall -c sound.c C:\djgpp\src\libc\pc_hw\sound>ar rvs /djgpp/lib/libc.a sound.o r - sound.o And test to see if the bug is fixed for NT. [Note to Eli, is it really necessary to specify drive letter to ar? If not then there is a redundant note in the FAQ about this.] Here is a patch for the above code in case it tests ok without further changes: --- src/libc/pc_hw/sound/sound.c.original Sat Feb 25 22:19:34 1995 +++ src/libc/pc_hw/sound/sound.c Tue Sep 26 22:48:38 2000 @@ -5,14 +5,18 @@ sound(int freq) { int scale; + + /* Always disable PC speaker first. + This is to work around an nt4 bug */ + outportb(0x61, inportb(0x61) & ~3); + if (freq == 0) - { - outportb(0x61, inportb(0x61) & ~3); return; - } + scale = 1193046 / freq; + outportb(0x43, 0xb6); outportb(0x42, scale & 0xff); outportb(0x42, scale >> 8); - outportb(0x61, inportb(0x61) | 3); + outportb(0x61, inportb(0x61) | 3); /* re-enable PC speaker */ }