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