{
Switch PC speaker on with specified frequency,Hz.
Use SoundOn(0) if you need switch PC speaker off.
Uses const: $42=66,$43=67,$61=97,$B6=182,$FC=252.
That is "magic numbers" for IBM PC speaker.
}
procedure PcSound(Hz:Integer);
var i,w:Integer;
begin
 if Hz>0 then begin
  w:=Round(1193180/Hz);
  i:=OutPortB(97,iOr(InPortB(97),3));
  i:=OutPortB(67,182);
  i:=OutPortB(66,iAnd(w,255));
  i:=OutPortB(66,iAnd(w div 256,255));
 end else begin
  i:=OutPortB(97,iAnd(InPortB(97),252));
 end;
end;
