Article View: comp.os.os2.programmer
Article #1621Re: if (DosBeep == _WORTHLESS) {plead('Help!);}
From: Mikael Wahlgren
Date: Tue, 06 Nov 1990 16:33
Date: Tue, 06 Nov 1990 16:33
36 lines
1918 bytes
1918 bytes
In article <81@cscdec.cs.com> jack@cscdec.cs.com (Jack Hudler) writes:
>In article <10312@milton.u.washington.edu> zyx@milton.u.washington.edu (Bt Garner) writes:
>>The Plea: Is there a way to access the speaker without the use of DosBeep?
>>Examples would be greatly apprecited, any language will do.
>>
>Probably not, but don;t take my word for it. However, why don't you just start
>a thread that handles the beeping.
It is possible to do this if you have IOPL. An example in Modula-2:
(*# call (iopl => on) *)
IMPLEMENTATION MODULE IOPsound;
IMPORT SYSTEM;
PROCEDURE BeepProc;
TYPE bs = SET OF [0..7};
CONST freq=3000; PPIport=60H; Timer=42H;
VAR m:bs; delay,j,interval:CARDINAL;
BEGIN
interval := CARDINAL(1193181 DIV LONGVARD(freq));
m := bs(SYSTEM.In(PPIport+1));
IF m*bs{0,1} = bs{} THEN
SYSTEM.Out(Timer+1,SHORTCARD(m+bs{0,1}));
SYSTEM.Out(Timer+3,0B6H);
END;
SYSTEM.Out(Timer+3,SHORTCARD(interval MOD 256));
SYSTEM.Out(Timer+2,SHORTCARD(interval DIV 256));
FOR delay := 1 TO 10000 DO j := delay*delay END;
m := bs(SYSTEM.In(PPIport+1));
SYSTEM.Out(PPIport+1,SHORTCARD(m*bs{2,3,4,5,6,7}));
END BeepProc;
END IOPsound.
Example taken from the Modula-2 1.0 OS/2 supplemental documentation.
Mikael Wahlgren d9mikael@dtek.chalmers.se
Technical Details
Message-ID:
<1990Nov6.163346.2430@mathrt0.math.chalmers.se>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!samsung!umich!yale!mintaka!bloom-beacon!eru!hagbard!sunic!chalmers.se!mathrt0.math.chalmers.se!d9mikaelReferences:
<10312@milton.u.washington.edu> <81@cscdec.cs.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!samsung!umich!yale!mintaka!bloom-beacon!eru!hagbard!sunic!chalmers.se!mathrt0.math.chalmers.se!d9mikael
From: d9mikael@dtek.chalmers.se (Mikael Wahlgren)
Newsgroups: comp.os.os2.programmer
Subject: Re: if (DosBeep == _WORTHLESS) {plead('Help!);}
Keywords: DosBeep, speaker, Begging
Message-ID: <1990Nov6.163346.2430@mathrt0.math.chalmers.se>
Date: 6 Nov 90 16:33:46 GMT
References: <10312@milton.u.washington.edu> <81@cscdec.cs.com>
Sender: news@mathrt0.math.chalmers.se (Evald Nyhetsson)
Organization: Chalmers University of Technology, Gothenburg, Sweden.
Lines: 36