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