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