unit IRQFormu; interface uses Windows, SysUtils, Classes, Dialogs, Forms, StdCtrls, Controls, ExtCtrls; type TForm1 = class(TForm) InitButton: TButton; StartButton: TButton; IRQEdit: TEdit; Label1: TLabel; CountLabel: TLabel; Bevel1: TBevel; StatusLabel: TLabel; GroupBox1: TGroupBox; BusTypeCombo: TComboBox; Label4: TLabel; BusNumberEdit: TEdit; Label5: TLabel; Label6: TLabel; Label7: TLabel; BaseEdit: TEdit; LatchEdit: TEdit; Bevel3: TBevel; Bevel4: TBevel; Label3: TLabel; Label8: TLabel; OffsetEdit: TEdit; ValueEdit: TEdit; WriteButton: TButton; Bevel5: TBevel; Label9: TLabel; Memo1: TMemo; ExitButton: TButton; Bevel2: TBevel; ReadButton: TButton; WriteRadio: TRadioButton; ReadRadio: TRadioButton; AbortButton: TButton; procedure InitButtonClick(Sender: TObject); procedure StartButtonClick(Sender: TObject); procedure ExitButtonClick(Sender: TObject); procedure WriteButtonClick(Sender: TObject); procedure ReadButtonClick(Sender: TObject); procedure AbortButtonClick(Sender: TObject); procedure FormCreate(Sender: TObject); private { Private declarations } public IRQ : Byte; IRQ_Count : DWord; end; var Form1: TForm1; x: Integer; DLLHandle : THANDLE; Success: Bytebool; implementation uses IRQThrdu, ACCES32, WIN32IRQ; var MyThread: IRQThread; {$R *.DFM} procedure TForm1.InitButtonClick(Sender: TObject); var BusType : ShortInt; IRQ, BN, Method : Byte; BaseAddress : DWORD; ClearOffset : WORD; begin if BusTypeCombo.Text = 'ISA' then BusType := Isa else if BusTypeCombo.Text = 'PCI' then BusType := PCIBus else if BusTypeCombo.Text = 'PCMCIA' then BusType := PCMCIABus else BusType := InterfaceTypeUndefined; IRQ := StrToInt(IRQEdit.Text); BaseAddress := StrToInt('$' + BaseEdit.Text); ClearOffset := StrToInt('$' + LatchEdit.Text); try BN := StrToInt(BusNumberEdit.Text); except BN := 0; end; if WriteRadio.Checked then Method := WRITE_TO_CLEAR else Method := READ_TO_CLEAR; Success := InitGenDriver(BaseAddress, IRQ, BusType, BN, ClearOffset, Method); if Success then StatusLabel.Caption := 'Setup card using Write Port, then press Start Acquisition' else StatusLabel.Caption := 'Driver Error During Initialization'; end; procedure TForm1.StartButtonClick(Sender: TObject); begin StartButton.Enabled := false; MyThread := IRQThread.Create(false); AbortButton.Enabled := true; end; procedure TForm1.ExitButtonClick(Sender: TObject); begin Close; end; procedure TForm1.WriteButtonClick(Sender: TObject); begin OutPortB(StrToInt('$'+BaseEdit.Text)+StrToInt('$'+OffsetEdit.Text), StrToInt('$'+ValueEdit.Text)); end; procedure TForm1.ReadButtonClick(Sender: TObject); begin ValueEdit.Text := IntToHex(InPortB(StrToInt('$'+BaseEdit.Text)+StrToInt('$'+OffsetEdit.Text)),2); end; procedure TForm1.AbortButtonClick(Sender: TObject); begin MyThread.Terminate; AbortRequest; StatusLabel.Caption := 'Aborted - press Start Acquisition to resume'; StartButton.Enabled := true; AbortButton.Enabled := false; end; procedure TForm1.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.