📄 bs1.pas
字号:
unit bs1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls,UnitPortTalk;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
Timer1: TTimer;
Edit1: TEdit;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
a1:integer;
implementation
{$R *.dfm}
{procedure speed(count:word);stdcall;
const
ExceptionUsed=$03;
var
IDT:array [0..5]of byte;
lpOldGate:dword;
begin
asm
sidt IDT
mov ebx,dword ptr [IDT+2]
add ebx,8*ExceptionUsed
cli
mov dx,word ptr [ebx+6]
shl edx,16d
mov dx,word ptr [ebx]
mov [lpOldGate],edx
mov eax,offset @@Ring0Code
mov word ptr [ebx],ax
shr eax,16d
mov word ptr [ebx+6],ax
int ExceptionUsed
mov ebx,dword ptr[IDT+2]
add ebx,8*ExceptionUsed
mov edx,[lpOldGate]
mov word ptr [ebx],dx
shr edx,16d
mov word ptr [ebx+6],dx
jmp @@exit
@@Ring0Code:
mov al,$34
out $43,al
mov ax,Count
out $40,al
mov al,ah
out $40,al
iretd
@@exit:
end;
end; //win98 }
procedure Speed(count:word); //winnt
begin
if not OpenPortTalk then exit;
outportb($43,$34); {写入8253控制寄存器,设置写0号定时器}
outportb($40,lo(count)); {写定时值低位}
outportb($40,hi(count)); {写定时值高位}
ClosePortTalk;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Speed($2ea5); // $1044
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
speed($6000);//慢
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
speed($500);
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
a1:=a1+1;
edit1.Text:=inttostr(a1);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -