unit IRQMFormu; interface uses Windows, SysUtils, Classes, Dialogs, Forms, StdCtrls, Controls, ExtCtrls; type TForm1 = class(TForm) InitButton: 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; Bevel6: TBevel; LastIRQLabel: TLabel; Bevel7: TBevel; CheckBox1: TCheckBox; CheckBox2: TCheckBox; CheckBox3: TCheckBox; CheckBox4: TCheckBox; CheckBox5: TCheckBox; CheckBox7: TCheckBox; CheckBox6: TCheckBox; CheckBox8: TCheckBox; CheckBox9: TCheckBox; CheckBox10: TCheckBox; CheckBox11: TCheckBox; CheckBox12: TCheckBox; CheckBox13: TCheckBox; CheckBox14: TCheckBox; CheckBox15: TCheckBox; procedure InitButtonClick(Sender: TObject); procedure ExitButtonClick(Sender: TObject); procedure WriteButtonClick(Sender: TObject); procedure ReadButtonClick(Sender: TObject); procedure IRQCheckBoxClick(Sender: TObject); procedure FormCreate(Sender: TObject); private public IRQ : Byte; end; var Form1: TForm1; x: Integer; DLLHandle : THANDLE; Success: Bytebool; implementation uses IRQMThrdu, ACCES32, W32IRQM; var MyThreads: array [0..15] of TIRQThread; {$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 begin StatusLabel.Caption := 'Setup card using Write Port, then check the IRQ # to monitor'; case IRQ of 1: CheckBox1.Enabled := true; 2: CheckBox2.Enabled := true; 3: CheckBox3.Enabled := true; 4: CheckBox4.Enabled := true; 5: CheckBox5.Enabled := true; 6: CheckBox6.Enabled := true; 7: CheckBox7.Enabled := true; 8: CheckBox8.Enabled := true; 9: CheckBox9.Enabled := true; 10: CheckBox10.Enabled := true; 11: CheckBox11.Enabled := true; 12: CheckBox12.Enabled := true; 13: CheckBox13.Enabled := true; 14: CheckBox14.Enabled := true; 15: CheckBox15.Enabled := true; end; end else StatusLabel.Caption := 'Driver Error During Initialization'; 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.IRQCheckBoxClick(Sender: TObject); var IRQ: Byte; begin IRQ := ActiveControl.Tag; if not TCheckBox(ActiveControl).Checked then begin MyThreads[IRQ].Terminate; AbortRequest(IRQ); StatusLabel.Caption := 'Aborted - recheck the IRQ # to resume'; // ActiveControl.Enabled := false; end else begin MyThreads[IRQ] := TIRQThread.Create(true); MyThreads[IRQ].IRQ := IRQ; MyThreads[IRQ].Resume; end; 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.