dos下的硬件设备中断编号到了windows下还管用吗?比如原来dos下可以直接想外设发送或接受一些byte,到了windows下的delphi还管用吗?编写的程序会不会出现"can't run on windows"的错误!
比如qbasic中:inp(),和out(),在Opascal中有没有类似的函数!
或者是dos下:
debug
-o 70,10
-o 71,10
-q
这段代码的功能到delphi中能编程实现吗?该如何做?是不是非得编写vxd!
比如qbasic中:inp(),和out(),在Opascal中有没有类似的函数!
或者是dos下:
debug
-o 70,10
-o 71,10
-q
这段代码的功能到delphi中能编程实现吗?该如何做?是不是非得编写vxd!
解决方案 »
- SOS 在线等..........
- TImage控件显示另存为JPEG
- 热烈庆祝饭桶JR又成功骗得了我200分!
- 如何转换
- SQL Any Where 谁用过???我把字段类型定义为decimal(16,2)后, 输入1234567.00 变成1234567.11啊???
- 超难题!有关文件流的使用。
- 如何让程序关闭后再自动运行
- 这个东东如何用?
- 加分,我在一个没有窗体的unit中写个生成窗体的过程,其中事件调用本unit中其他过程,但编译不了,为何?谢谢,哪个unit作为主程序调用的,代码已贴出,很容易的问题,帮忙
- 关于ASP组件中设置Cookie的问题。
- 什么是SDK啊?干吗用的?怎样用?
- 关于socket。
for example:unit Unit1;
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;
var
IDT : array [0..5] of byte; // 保存中断描述符表
lpOldGate : dword; // 存放旧向量
implementation{$R *.dfm}
procedure aa; stdcall;
const ExceptionUsed = $03; // 中断号。
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 // 修改向量,指向Ring0级代码段
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 // 恢复被改了的向量
ret @@Ring0Code: // Ring0级代码段
mov eax,cr0 // 此句在Ring3级会发生异常错误
mov dx, $61 // 以下语句是为了证明执行了此段代码,让PCSpeak发声
mov al, $ff
out dx, al
mov dx, $43
mov al, $b6
out dx, al
mov dx, $42
mov al, $f0
out dx, al
mov dx, $42
mov al, $0
out dx, al
iretd // 中断返回
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
aa;
end;procedure TForm1.Button2Click(Sender: TObject);
begin
asm
int 03h //
end;
end;procedure TForm1.Button3Click(Sender: TObject);
var bvalue : byte;
value : word;
begin // 停止PCSpeak发声
asm
mov dx, $61
in al, dx
mov bValue, al
end ;
value := bValue and $fc;
bValue := Trunc(Value and 255);
asm
mov dx, $61
mov al, bValue
out dx, al
end;
end; end.