unit Sample1u; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, ComCtrls, StdCtrls; type TSample1Form = class(TForm) CardName: TLabel; Memo1: TMemo; ExitButton: TButton; ISAPanel: TGroupBox; HexLabel: TLabel; BaseEdit: TEdit; TestButton: TButton; ChannelBox: TGroupBox; Label2: TLabel; Label3: TLabel; Label4: TLabel; Port0Text: TPanel; Port1Text: TPanel; Port2Text: TPanel; TestTimer: TTimer; procedure ExitButtonClick(Sender: TObject); procedure TestButtonClick(Sender: TObject); procedure TestTimerTimer(Sender: TObject); procedure FormCreate(Sender: TObject); private { Private declarations } public { Public declarations } end; var Sample1Form: TSample1Form; Address : Word; PortPanels : array[0..2] of ^TPanel; implementation uses ACCES32; {$R *.DFM} procedure TSample1Form.ExitButtonClick(Sender: TObject); begin Close(); end; procedure TSample1Form.TestButtonClick(Sender: TObject); begin if (TestTimer.Enabled) then begin TestTimer.Enabled := false; TestButton.Caption := 'Start Test'; BaseEdit.Enabled := true; end // end if else begin PortPanels[0] := @Port0Text; PortPanels[1] := @Port1Text; PortPanels[2] := @Port2Text; Address := StrToInt('$'+BaseEdit.Text); TestTimer.Enabled := true; TestButton.Caption := 'Abort Test'; BaseEdit.Enabled := false; end; // end else end; // end TestButtonClick procedure TSample1Form.TestTimerTimer(Sender: TObject); var port, i : integer; data, mask : Word; const ofs : array[0..5] of integer = ( 0,1,2,4,5,6 ); // Table of offsets to input registers begin PortPanels[0].Caption := ''; PortPanels[1].Caption := ''; PortPanels[2].Caption := ''; for port := 0 to 2 do begin // Read the first 8 input channels of current port data := InPortB(Address + ofs[2*port])*256; data := data + InPortB(Address + ofs[(2*port)+1]); // Check the status of each bit field and display result mask := 1; for i := 0 to 15 do begin if (mask and data) <> 0 then PortPanels[port].Caption := '1' + PortPanels[port].Caption else PortPanels[port].Caption := '0' + PortPanels[port].Caption; mask := mask SHL 1; end; // end for i end; // end for port end; procedure TSample1Form.FormCreate(Sender: TObject); begin if (InPortB($61) = $AA55) then begin Application.MessageBox('ACCESNT.SYS not detected. Please copy ACCESNT.SYS into [NT]/system32/drivers and re-run this sample.', 'Warning', IDOK); end; end; end.