Board index » delphi » Intrrupt procedures in WIN95 Dos-Box

Intrrupt procedures in WIN95 Dos-Box

Dit is een multi-gedeelten-bericht in MIME-formaat.

--------------75C7574C563C
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

For several reasons it is necessary to run a originally for the DOS
environment developped program in a DOS-box of WIN95. I expected
everything to run normal but the interrupt handler to deal with various
com-ports doesn't respond. As an example of the kind of handler I have
written the file DEACARDM.PAS is accompaniing this message. Can anyone
tell me why this interrupt handler doesn't work (I expect that is has
something to doe with the unavailability of the real-mode interrupt) en
more important how can I correct this. I have to add that it isn't
possible to rewrite the program in WINDOWS model because the timelimit
which has been put on me.

Thank everyone who takes the effort of responding.

Peter Remmen.

Resposen please to: peter.rem...@pi.net

--------------75C7574C563C
Content-Type: text/plain; charset=iso-8859-1; name="Deacardm.pas"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline; filename="Deacardm.pas"

(********************************************************************
*                                                                   *
*                     Horeca Informatie Systeem                     *
*                                                                   *
* SourceFile : DEACARDM.PAS                                         *
*   De Interrupt procedure voor het verwerken van signalen van de   *
*   DEA Proximity badgereader                                       *
*                                                                   *
* Programma versie    : 1.00                                        *
* Turbo Pascal versie : 7.0                                         *
* Laatste Wijziging   : 20 juli 1997                                *
*                                                                   *
* Geschreven door Peter H.J. Remmen                                 *
* (c) Copyright R.C.S.  Juli 1997                                   *
********************************************************************)

Unit   DeaCardModule;

InterFace

Procedure   ActiveerDeaCardLezer;
Procedure   DeActiveerDeaCardLezer;
Function    DeaKaartAanwezig : Boolean;

Var   DeaKaartNummer   : Integer;

Implementation

Uses   Crt, Dos,
       GenData, GenProc,
       SerPort;

Const   Com1BaseAdres =3D $3F8;
        Com3BaseAdres =3D $3E8;

Var   LaatsteTekenTijd : LongInt;
      OudeIntr04Vector : Pointer;
      Buffer           : Array[1..5]  Of  Byte;
      BufCount         : Byte;

Procedure   BepaalTijdKode (Var   TijdKode : LongInt);

  Var  BronKode : LongInt  Absolute  $0040:$006C;
                  {Dos systeemklok, aantal pulsen (18,06 per sec) sinds 0=
0:00}

  Begin   (* BepaalTijdKode *)
    TijdKode :=3D BronKode;
  End;    (* LeesRealTijd *)

Procedure   VerwerkSerieelSignaal; Interrupt;

  Var   IntrId : Byte;
        Teken  : Byte;

  Begin   (* VerwerkSerieelSignaal *)
    Inline($FA);    {CLI  Clear Intr flag <=3D> Disable interrupts}
    IntrId :=3D Port[Com1BaseAdres + 2];
    If  (IntrId And $07) =3D $04     {Intr Pending en data ontvangen}
      Then
        Begin
         Teken :=3D Port[Com1BaseAdres];
         If Teken =3D $FF
           Then  BufCount :=3D 0
           Else  If  BufCount < 5
                   Then
                     Begin
                      Inc(BufCount);
                      Buffer[BufCount] :=3D Teken;
                      If  BufCount =3D 5
                        Then  DeaKaartNummer :=3D Buffer[3];
                     End;
         BepaalTijdKode(LaatsteTekenTijd);
        End;
    InLine($FB);    {STI  Set Intr flag <=3D> Enable interrupts}
  End;    (* VerwerkSerieelSignaal *)

Procedure   ActiveerDeaCardLezer;

  Var  Adres : Pointer;
       x     : Byte;

  Begin   (*  *)
    InLine($FA);
    GetIntVec($0C,OudeIntr04Vector);
    SetIntVec($0C,@VerwerkSerieelSignaal);
    Port[$20] :=3D $11;
    Port[$A0] :=3D $11;
    Port[$21] :=3D $08;
    Port[$A1] :=3D $70;
    Port[$21] :=3D $04;
    Port[$A1] :=3D $02;
    Port[$21] :=3D $03;
    Port[$A1] :=3D $03;
    Port[$21] :=3D Port[$21] And (($01 Shl 4) Xor $FF); {8259 to unmask I=
RQ4}
    X :=3D Port[$21];   {Clear pending Intr van 8259}
    InLine($FB);
  End;    (*  *)

Procedure   DeActiveerDeaCardLezer;

  Begin   (*  *)
    SetIntVec($0C,OudeIntr04Vector);
    Port[$21] :=3D Port[$21] Or ($01 Shl 4); {8259 to mask IRQ4}
  End;    (*  *)

Function   DeaKaartAanwezig : Boolean;

  Var   Nu : LongInt;

  Begin   (* DeaKaartAanwezig *)
    If  DeaKaartnummer > 0
      Then
        Begin
         BepaalTijdKode(Nu);
         If  Nu - LaatsteTekenTijd > 4 { * 54.925 mSec =F7 220 mSec}
           Then  DeaKaartNummer :=3D 0
        End;
    DeaKaartAanwezig :=3D DeaKaartnummer <> 0;
  End;    (* DeaKaartAanwezig *)

Begin
  BufCount :=3D 0;
  DeaKaartnummer :=3D 0;
End.

--------------75C7574C563C--

 

Re:Intrrupt procedures in WIN95 Dos-Box


Quote
> Peter Remmen <peter.rem...@pi.net> wrote in article >

<33DC8F90....@pi.net>...
Quote
> For several reasons it is necessary to run a originally for the DOS
> environment developped program in a DOS-box of WIN95. I expected
> everything to run normal but the interrupt handler to deal with various
> com-ports doesn't respond. As an example of the kind of handler I have
> written the file DEACARDM.PAS is accompaniing this message. Can anyone
> tell me why this interrupt handler doesn't work (I expect that is has
> something to doe with the unavailability of the real-mode interrupt) en
> more important how can I correct this. I have to add that it isn't
> possible to rewrite the program in WINDOWS model because the timelimit
> which has been put on me.

Real-mode interrupts are always functional whether in Real mode or
V86(dosbox) mode. I don't really understand your code as there are written
in German(?). Anyway, I suspect that you didn't ActiveerDeaCardLezer; it.
That is the only logical reason why it didn't work.

If I didn't helped you, you can use BIOS functions.

--
Vinson ABS

Procedure   VerwerkSerieelSignaal; Interrupt;

  Var   IntrId : Byte;
        Teken  : Byte;

  Begin   (* VerwerkSerieelSignaal *)
    Inline($FA);    {CLI  Clear Intr flag <=> Disable interrupts}
**> CLI not needed. Int Flag is already clear.
    IntrId := Port[Com1BaseAdres + 2];
    If  (IntrId And $07) = $04     {Intr Pending en data ontvangen}
      Then
        Begin
         Teken := Port[Com1BaseAdres];
         If Teken = $FF
           Then  BufCount := 0
           Else  If  BufCount < 5
                   Then
                     Begin
                      Inc(BufCount);
                      Buffer[BufCount] := Teken;
                      If  BufCount = 5
                        Then  DeaKaartNummer := Buffer[3];
                     End;
         BepaalTijdKode(LaatsteTekenTijd);
        End;
    InLine($FB);    {STI  Set Intr flag <=> Enable interrupts}
**> same as CLI
  End;    (* VerwerkSerieelSignaal *)

Other Threads