home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / tsr / tsrsrc33.zip / IPX.PAS < prev    next >
Pascal/Delphi Source File  |  1992-01-08  |  4KB  |  131 lines

  1. {**************************************************************************
  2. *   IPX - unit of IPX functions                                           *
  3. *   Copyright (c) 1991 Kim Kokkonen, TurboPower Software.                 *
  4. *   May be freely distributed and used but not sold except by permission. *
  5. *                                                                         *
  6. *   Version 3.0 9/24/91                                                   *
  7. *     first release                                                       *
  8. *   Version 3.1 11/4/91                                                   *
  9. *     no change                                                           *
  10. *   Version 3.2 11/22/91                                                  *
  11. *     no change                                                           *
  12. *   Version 3.3 1/8/92                                                    *
  13. *     no change                                                           *
  14. ***************************************************************************}
  15.  
  16. {$R-,S-,I-,V-,B-,F-,A-,E-,N-,G-,X-}
  17.  
  18. unit IPX;
  19.   {-IPX functions needed for RELNET}
  20.  
  21. interface
  22.  
  23. type
  24.   PhysicalNodeAddress = array[1..6] of Byte;
  25.  
  26.   FragmentDescriptor  =
  27.     record
  28.       Address         : Pointer;              {the data}
  29.       Size            : Word;                 {the size of the data}
  30.     end;
  31.  
  32.   IpxEcbPtr = ^IpxEcb;
  33.   IpxEcb =
  34.     record
  35.       Link            : IpxEcbPtr;            {link to next IPXECB}
  36.       EsrAddress      : Pointer;              {Event Service Routine}
  37.       InUse           : Byte;                 {inuse semaphore}
  38.       CompletionCode  : Byte;                 {error code}
  39.       SocketNumber    : Word;                 {the session socket}
  40.       IpxWorkSpace    : LongInt;              {reserved for internal use}
  41.       DriverWorkSpace : Array[1..12] of Byte; {reserved}
  42.       ImmediateAddress: PhysicalNodeAddress;  {the internet address}
  43.       FragmentCount   : Word;                 {the number of buffers}
  44.       FD1             : FragmentDescriptor;   {buffer 1}
  45.       FD2             : FragmentDescriptor;   {buffer 2}
  46.       FD3             : FragmentDescriptor;   {buffer 3}
  47.       FD4             : FragmentDescriptor;   {buffer 4}
  48.     end;
  49.  
  50. function IpxInstalled : Boolean;
  51.   {-Return True if IPX is installed}
  52.  
  53. procedure CloseSocket(Socket : Word);
  54.   {-Close specified socket number (after swapping hi-lo)}
  55.  
  56. function CancelEvent(var ECB : IPXECB) : Byte;
  57.   {-Cancel IPX event}
  58.  
  59. procedure ScheduleSpecialEvent(Delay : Word; var ECB : IPXECB);
  60.   {-Schedule a special event}
  61.  
  62.   {=======================================================================}
  63.  
  64. implementation
  65.  
  66. var
  67.   IpxOfs : Word;
  68.   IpxSeg : Word;
  69.  
  70. function IpxInstalled : Boolean; assembler;
  71. asm
  72.   MOV     AX,[IpxOfs]
  73.   OR      AX,[IpxSeg]
  74.   MOV     AL,00
  75.   JZ      @Done
  76.   INC     AL
  77. @Done:
  78. end;
  79.  
  80. procedure CloseSocket(Socket : Word); assembler;
  81. asm
  82.   MOV     AX,[IpxOfs]
  83.   OR      AX,[IpxSeg]
  84.   JZ      @Done
  85.   MOV     BX,0001
  86.   MOV     DX,Socket
  87.   CALL    DWORD PTR [IpxOfs]
  88. @Done:
  89. end;
  90.  
  91. function CancelEvent(var ECB : IPXECB) : Byte; assembler;
  92. asm
  93.   MOV     AX,[IpxOfs]
  94.   OR      AX,[IpxSeg]
  95.   MOV     AL,$FF
  96.   JZ      @Done
  97.   MOV     BX,0006
  98.   LES     SI,ECB
  99.   CALL    DWORD PTR [IpxOfs]
  100. @Done:
  101. end;
  102.  
  103. procedure ScheduleSpecialEvent(Delay : Word; var ECB : IPXECB); assembler;
  104. asm
  105.   MOV     AX,[IpxOfs]
  106.   OR      AX,[IpxSeg]
  107.   JZ      @Done
  108.   MOV     BX,0007
  109.   MOV     AX,Delay
  110.   LES     SI,ECB
  111.   CALL    DWORD PTR [IpxOfs]
  112. @Done:
  113. end;
  114.  
  115. procedure CheckIpx; assembler;
  116. asm
  117.   MOV     AX,$7A00
  118.   INT     $2F
  119.   CMP     AL,$FF
  120.   JZ      @StoreIpxPtr
  121.   XOR     DI,DI
  122.   MOV     ES,DI
  123. @StoreIpxPtr:
  124.   MOV     [IpxOfs],DI
  125.   MOV     [IpxSeg],ES
  126. end;
  127.  
  128. begin
  129.   CheckIpx;
  130. end.
  131.