⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 port95.~pas

📁 《Delphi实用程序100例》配套书源码盘
💻 ~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          }
{                                                        }
{********************************************************}
{

 My other products:

- NBLib32 (NetBios Library for Win32) - shareware native
  components collection for peer-to-peer networking
  LAN&WAN via NetBios under Windows 95/98/NT.
  For D2/3/4 & BCB 1/3.

- GetMACAddress - freeware Delphi-unit for determining
  MAC-Address of network interface cards (LAN&WAN).

Coming soon:

- Shareware NBLib32 as ActiveX Control (OCX)
- Freeware NBLib16 1.00b - compatible with NBLib32
  components collection for Delphi 1

{********************************************************}

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