unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
// Sound(frequencies)
procedure BeepStart(pitch:SMALLINT);
asm
mov bx, pitch
mov ax, 34DDh
mov dx, 0012h
cmp dx, bx
jnb @stop
div bx
mov bx, ax
in al, 61h
test al, 3
jne @j1
or al, 3
out 61h, al
mov al, 0B6h
out 43h, al
@j1:
mov al, bl
out 42h, al
mov al, bh
out 42h, al
@stop:
end;
// NoSound
procedure BeepStop;
asm
in al,61H
and al, 0fcH
out 61H, al
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
BeepStart(100); // 100Àº Á֯ļö
Sleep(500); // 0.5ÃÊ Áö¿¬
BeepStop;
BeepStart(500);
Sleep(500);
BeepStop;
BeepStart(1500);
Sleep(500);
BeepStop;
BeepStart(2000);
Sleep(500);
BeepStop;
end;
end. |
|