{======================================= =================================}
{==========          Component TVicHW_95                   ===============}
{=========================================================================}
{==========    Copyright (c) 1996-1997 Victor I.Ishikeev   ===============}
{==========    e-mail: root@nplks.bash.ru (office)         ===============}
{==========    victor@ivi.ugatu.ac.ru (at home)            ===============}
{=========================================================================}

(: SORRY MY BAD ENGLISH :)


1. OVERVIEW
===========

   TVicHW_95 is beta-version (0.1) shareware- of handle by the
equipment PC for use in Delphi 2.x under Windows 95. The registration will
begin after 01.01.1997 years. To 01.02.1997 I plan the release similar a
component for Delphi 2.x under Windows NT.
   TVicHW_95 is simplified analogue of the WinRT(R) tool ("Blue Water
Systems" company).

   Possibilities a component:

   - reading and writing of input\output ports;
   - access to given addresses of the physical memory;
   - processing hardware interrupts (FOR REGISTERED USERS ONLY!)


2. FILE LIST
============

readme.txt    - this file in English
readme.rus    - this file in Russian
hwport95.dcu  - implementation a component TVictorHW_95
hwport95.vxd  - dynamic loaded virtual driver
hwport95.dcr  - image for a components palette
hw_test.dpr   - test example (together with main.pas, main.dfm, hw_test.res)

   The registered users will receive in addition hwport95.pas file (precisely),
and also hwport95.kfg and hwport95.hlp (can be:). Besides new methods and
properties will be added. Finishing at will of the user and advice on e-mail is
possible.
   Though in this document methods of operation with interruptions are
described, but they will be accessible only to the registered users.

3. INSTALLATION
===============

   Components will be installed in a graphic palette of components on page
"Samples".
   - copy all files in the your directory (i.e. C:\HW).;
   - start Delphi and to select Component | Install | Add | browse to
     C:\HW\hwctrl.dcu;
   - press OK for recompilation of the components library.

4. TESTING
==========

  Package contains a test example HW_TEST.DPR.

5. NOTES
========

   - the hwport.vxd file is necessary for moving to the current directory of
     your project or in the /windows/-directory;
   - operation only with one hardware interrupt is possible
   - the OnHWInterrupt event handler is fulfilled in separate thread, therefore
     the call from him of functions VCL is possible only through a method
     Synchronize() (analogue of the same method from TThread);
   - I check efficiency of interrupt processing with minimum period 1 millisecond      at the "empty" handler of an event OnHWInterrupt on the computer Pentium-90      with tpNormal priority;
   - do not try to reassign irq0 (interruption from the system timer),
     components does not allow it to make.


6. PROPERTY
===========

   Active: Boolean; (public, read, write)
   ------------------
   Whether operation with the equipment is possible? Whether Is open of
   components?

   IsIRQSet: Boolean; (public, read, only)
   --------------------------------------- -
   Checks, whether the handler of hardware interrupt is installed

   Masked: Boolean; (public, read only)
   --------------------------------------- -
   Checks whether interruption is masked

   IRQ: Byte; (published, read, write, default 10)
   --------------------------------------- ---------
   Sets number of hardware interrupt

   Priority: TThreadPriority (published, read, write, default tpHigher);
   --------------------------------------- ------------------------------
   Installs priority of thread, in which event onHWInterrupt is processed

   Port [Index: Word]: Byte (public, read, write)
   --------------------------------------- -----
   Writes/reads one byte in/from the input\output port, for example:

   With VicHW_95 do
   Begin
    .....
     Port [$2F8]:=$34;
    .....
     MyByte:=Port [$2f9];
    .....
   End;


7. METHODS
===========

Constructor TVicHW_95. Create (Owner: TComponent);
--------------------------------------- ----------     

Destructor TVicHW_95. Destroy;                   
-------------------------------

procedure TVicHW_95. OpenDriver;
-----------------------------------
    Loads the virtual driver (hwport95.vxd) and opens access to the equipment.
If returned in ActiveHW result - TRUE, the operation with the equipment is         possible. To open an once at start of the application. The reopening is impossible.

Procedure TVicHW_95. Close;
----------------------------

    Completes operation with the equipment. If operation with interruption was
used, it masks and is deleted.

Function TVicHW_95. SetPointerToPhysicalAddress (PhAddr: dWord; Size:dWord):                                                                       Pointer;
--------------------------------------- ---------------------------------------

    Installs the pointer on the given address (PhAddr) actual storage. Size -
size of the used actual storage. For example, for installation of the pointer
on area ROM BIOS (f000:0000) it is possible to make so:

    Type TBiosArray = array [0 ..255] of Byte;
         PBiosArray = ^TBiosArray;
    Var pBIOS: PBiosArray;
   ....
    Begin
      
        VicHW_95. Open;
       .....
        pBIOS:=VicHW_95. SetPointerToPhysicalMemory ($F8000,256)
       .....
       ..... Working with pBIOS.....
       .....
        VicHW_95. Close;

    End;


Procedure TVicHW_95. SetIRQ;
-----------------------------

    Links hardware interrupt, number of which should be given in property IRQ,
with an event OnHWInterrupt. Now, if interruption unmasked (see "UnmaskInterrupt" method), at each hardware interrupt will be generated an event OnHWInterrupt. 
Installs property IsIRQSet to value TRUE.

Procedure TVicHW_95. DestroyIRQ;
---------------------------------

    Deletes hardware interrupt

Procedure TVicHW_95. MaskInterrupt;
------------------------------------

    Masks hardware interrupt.

Procedure TVicHW_95. UnMaskInterrupt;
--------------------------------------

    Unmasks hardware interrupt

Function TVicHW_95. GetInterruptCounter: dWord;
--------------------------------------- ----------

    Returns amounty of hardware interrupts, really obtained in the virtual
driver.


8. EVENT
========

Component generate only OnHWInterrupt: TNotifyEvent



=============================================================================

Results of use the component, wish and sentence ask to transmit me through
e-mail.

With best wishes

Victor I.Ishikeev,
Ufa, Russia
