this slowpoke moves

Create Sound Beep Audio Port

function InPort(PortAddr:word): byte; assembler; stdcall;
asm
  mov dx,PortAddr
  in al,dx
end;

procedure OutPort(PortAddr: word; Databyte: byte); assembler; stdcall;
asm
  mov al,Databyte
  mov dx,PortAddr
  out dx,al
end;

Procedure Sound(Hz : Word);
var TmpW : Word;
begin
  OutPort($43,182);
  TmpW :=InPort($61);
  OutPort($61,TmpW or 3);
  OutPort($42,lo(1193180 div hz));
  OutPort($42, hi(1193180 div hz));
end;

Procedure NoSound;
var TmpW : Word;
begin
  OutPort($43,182);
  TmpW := InPort($61);
  OutPort($61,TmpW and 3);
end;
Beispiel :
procedure TForm1.Button1Click(Sender: TObject);
begin
Windows.Beep(1000,   // Herz
             100);  // Dauer in Millisekunden
end;

Keine Kommentare:

Kommentar veröffentlichen

Beliebte Posts

Translate