📄 port95.pas
字号:
{********************************************************}
{ unit Port95 }
{ }
{ Access to the I/O ports under Win95/98 in Pascal-style }
{ }
{ Copyright (c) 1997,1998 Vlad Sharnin }
{ }
{ E-mail: vladshar@ufanet.ru }
{ Home page: http://vladshar.ufanet.ru }
{ }
{********************************************************}
unit Port95;
interface
type
TPort = class
procedure SetPort(Index: Word; Value: Byte);
function GetPort(Index: Word): Byte;
property Port[Index: Word]: Byte read GetPort write SetPort; default;
end;
TPortW = class
procedure SetPortW(Index: Word; Value: Word);
function GetPortW(Index: Word): Word;
property PortW[Index: Word]: Word read GetPortW write SetPortW; default;
end;
var
Port: TPort;
PortW: TPortW;
implementation
procedure TPort.SetPort(Index: Word; Value: Byte); assembler; register;
asm
mov al,cl
out dx,al
end;
function TPort.GetPort(Index: Word): Byte; assembler; register;
asm
in al,dx
end;
procedure TPortW.SetPortW(Index: Word; Value: Word); assembler; register;
asm
mov ax,cx
out dx,ax
end;
function TPortW.GetPortW(Index: Word): Word; assembler; register;
asm
in ax,dx
end;
initialization
Port := TPort.Create;
PortW := TPortW.Create;
finalization
Port.Free;
PortW.Free;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -