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