Program Beeper;
const
_MF : Word = 16;
MF : Word = 280;
var
i : Word;
{Дождь/вода при MF=20000 и NoSound=On}
{Вертолёт при MF=20000 и NoSound=Off}
Procedure Sound(Freq : Word);Assembler;
asm
mov bx, sp
mov bx, ss:[bx+4]
mov ax, 34DDh
mov dx, 12h
cmp dx, bx
jnb @1
div bx
mov bx, ax
in al, 61h
test al, 3
jnz @2
or al, 3
out 61h, al
mov al, 0B6h
out 43h, al
@2:
mov al, bl
out 42h, al
mov al, bh
out 42h, al
@1:
end;
{------------------------}
Procedure NoSound;Assembler;
asm
in al, 61h
and al, 0FCh
out 61h, al
end;
Function KeyPressed : Boolean;Assembler;
asm
mov ah, $0B
int $21
end;
Function ReadKey : Byte; assembler;
asm
xor ax,ax
int 16h
end;
Function ScanKey : Byte; Assembler;
asm
in al, 60h
end;
begin
While not KeyPressed do
begin
Sound(55);
Sound(220);
end;
ReadKey;
While not Keypressed do
begin
for i := _MF to MF do
begin
Sound(i);
end;
for i := MF downto _MF do
begin
Sound(i);
end;
end;
NoSound;
ReadKey;
end.