变速齿轮Delphi实现_Delphi

  • 内容
  • 评论
  • 相关

{D7+Win98,不能用于2000}
unit MainUnit;

interface

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

type

http://www.gaodaima.com/?p=66046变速齿轮Delphi实现_Delphi

  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
  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;

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》,跪求各位点评,若觉得好的话请收藏本文,by 搞代码

原创文章,转载请注明: 转载自搞代码

本文链接地址: 变速齿轮Delphi实现_Delphi

微信支付二维码

微信 赏一包辣条吧~

支付宝支付二维码

支付宝 赏一听可乐吧~

评论

0条评论

发表评论

电子邮件地址不会被公开。 必填项已用*标注