Delphi实现变速齿轮


本文整理自网络,侵删。

 unit MainUnit; 

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
procEDure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}
procedure speed(count:word);stdcall;
const
Exception_Used=$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;

procedure TForm1.Button1Click(Sender: TObject);
begin
speed($6000);//慢
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
Speed($1044);
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
speed($500);
end;

end.

相关阅读 >>

Delphi 实现从下载链接提取文件名的函数

Delphi编程之关闭所有qq进程

Delphi andorid应用程序检查wifi有效还是无效

Delphi 计算文件大小

Delphi固定窗口大小

Delphi xe2 - 实现主窗口在任务栏上不显示

Delphi设计循环播放声音文件程序

Delphi winapi: flashwindow - 闪烁窗口

Delphi 创建文件夹并打开

Delphi 几个实用的html解析函数

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...