home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 31 / CDASC_31_1996_juillet_aout.iso / vrac / cddk9605.zip / HEADERS.ARJ / FOSSIL.INT < prev    next >
Text File  |  1996-05-17  |  11KB  |  245 lines

  1.  
  2. { ───────────────────────────────────────────────────────────────────────── }
  3. {  Name        : FOSSIL.PAS                                                 }
  4. {  Description : FOSSIL [Fido/Opus/Seadog Standard Interface Layer] support }
  5. { ───────────────────────────────────────────────────────────────────────── }
  6.  
  7. UNIT FOSSIL;
  8.  
  9. {$B-} { . . . . . . . . . . . . . . . . . . . . Shortcut boolean evaluation }
  10. {$F+} { . . . . . . . . . . . . . . . . . . . .  Force far calls for safety }
  11. {$I-} { . . . . . . . . . . . . . . . . . . . Disable input/output checking }
  12. {$O+} { . . . . . . . . . . . . . . . . . . Allow this unit to be overlayed }
  13. {$Q-} { . . . . . . . . . . . . . .  Do not generate overflow-checking code }
  14. {$R-} { . . . . . . . . . . . . . . . . Do not generate range-checking code }
  15. {$S-} { . . . . . . . . . . . . . . . . Do not generate stack-checking code }
  16. {$X+} { . . . . . . . . . . . Extended syntax for pChars and function calls }
  17.  
  18. INTERFACE
  19.  
  20. CONST
  21.  
  22.   { Baud rates }
  23.  
  24.     _300 = $00 + $40 + $00; { 010----- }
  25.     _600 = $00 + $40 + $20; { 011----- }
  26.    _1200 = $80 + $00 + $00; { 100----- }
  27.    _2400 = $80 + $00 + $20; { 101----- }
  28.    _4800 = $80 + $40 + $00; { 110----- }
  29.    _9600 = $80 + $40 + $20; { 111----- }
  30.   _19200 = $00 + $00 + $00; { 000----- }
  31.   _38400 = $00 + $00 + $20; { 001----- }
  32.  
  33.  
  34.   { Communications ports }
  35.  
  36.   _COM1 = $00;
  37.   _COM2 = $01;
  38.   _COM3 = $02;
  39.   _COM4 = $03;
  40.  
  41.  
  42.   { FOSSIL status constants }
  43.  
  44.   RDA  = $01;  { AH 00000001 }
  45.   OVRN = $02;  { AH 00000010 }
  46.   THRE = $20;  { AH 00100000 }
  47.   TSRE = $40;  { AH 01000000 }
  48.   DCD  = $80;  { AL 10000000 }
  49.  
  50.  
  51.   { Flow control constants }
  52.  
  53.   XON_XOFF_Transmit = 1;
  54.   RTS_CTS           = 2;
  55.   DSR_DTR           = 4;
  56.   XON_XOFF_Receive  = 8;
  57.  
  58. TYPE
  59.  
  60.   FOSSIL_Info_Type = RECORD
  61.     Size     : Word;        { Size of structure in bytes              }
  62.     Spec     : Byte;        { Conforms to this specification          }
  63.     Version  : Byte;        { Version of this driver                  }
  64.     ASCII_ID : Pointer;     { Far pointer to ASCII ID string          }
  65.     IBSize   : Word;        { Size of inbound buffer                  }
  66.     IBFree   : Word;        { No. of bytes left in inbound buffer     }
  67.     OBSize   : Word;        { Size of outbound buffer                 }
  68.     OBFree   : Word;        { No. of bytes left in outbound buffer    }
  69.     Width    : Byte;        { Width of screen on adapter              }
  70.     Height   : Byte;        { Height of screen on adapter             }
  71.     Baud     : Byte;        { Baud code, per function 03h (see below) }
  72.     END;
  73.  
  74.     { The ASCII_ID string is null-terminated and will not contain a   }
  75.     { newline character.  The baud field uses the same format used    }
  76.     { by function 03h.  Port-specific fields are undefined if the     }
  77.     { port is FFh or invalid.                                         }
  78.  
  79.  
  80. FUNCTION MakeBaudCode(Baud:LongInt):Byte;
  81.   { Constructs a FOSSIL baud-rate code using 8N1 settings.                  }
  82.  
  83.  
  84. PROCEDURE FOSSIL_Set_Baud(FOSSIL_Port:Word; Code:Byte);
  85.   { Sets the baud rate for the specified port.  The code is a mask:         }
  86.   {                                                                         }
  87.   { 000 00 0 00                                                             }
  88.   {   │  │ │  └─ Character length; 00=5, 01=6, 10=7, 11=8                   }
  89.   {   │  │ └──── Stop bits; 0=1, 1=1.5 for 5-bit char or 2 for others       }
  90.   {   │  └────── Parity; 00=None, 10=None, 01=Odd, 11=Even                  }
  91.   {   └───────── Baud rate:  010 =   300   011 =   600                      }
  92.   {                          100 =  1200   101 =  2400                      }
  93.   {                          110 =  4800   111 =  9600                      }
  94.   {                          000 = 19200   001 = 38400                      }
  95.  
  96.  
  97. PROCEDURE FOSSIL_Xmit_Chr(FOSSIL_Port:Word; C:Char);
  98.   { Transmits the character.  Control will not be returned until there      }
  99.   { is room in the outbound buffer.                                         }
  100.  
  101.  
  102. PROCEDURE FOSSIL_Read_Chr(FOSSIL_Port:Word; VAR C:Char);
  103.   { Reads a character from the inbound buffer.  The FOSSIL driver will      }
  104.   { wait until a character is available.                                    }
  105.  
  106.  
  107. FUNCTION FOSSIL_Carrier_Detect(FOSSIL_Port:Word):Boolean;
  108.   { Returns TRUE if a user is online, FALSE if not.                         }
  109.  
  110.  
  111. FUNCTION FOSSIL_Char_Waiting(FOSSIL_Port:Word):Boolean;
  112.   { Returns TRUE if a character is waiting in the inbound buffer.           }
  113.  
  114.  
  115. FUNCTION FOSSIL_Init(FOSSIL_Port:Word):Boolean;
  116.   { Initializes the FOSSIL driver.  This function should be called before   }
  117.   { any communications routines are used.  Returns TRUE if a FOSSIL         }
  118.   { driver is installed, FALSE if not.                                      }
  119.  
  120.  
  121. PROCEDURE FOSSIL_DeInit(FOSSIL_Port:Word);
  122.   { Deinitializes the FOSSIL driver.  You should call this procedure        }
  123.   { when exiting your program.  DTR is not affected.                        }
  124.  
  125.  
  126. PROCEDURE FOSSIL_Lower_DTR(FOSSIL_Port:Word);
  127. PROCEDURE FOSSIL_Raise_DTR(FOSSIL_Port:Word);
  128.   { These two procedures control the DTR line to the modem.  Lowering       }
  129.   { DTR will usually terminate the connection (but not always).             }
  130.  
  131.  
  132. FUNCTION FOSSIL_Timer_Int:Byte;
  133. FUNCTION FOSSIL_Ticks_Per_Second:Byte;
  134. FUNCTION FOSSIL_MS_Per_Tick:Word;
  135.   { These three functions can be used for critical timing or to set         }
  136.   { up code that is executed every certain number of clock ticks.           }
  137.   { FOSSIL_Timer_Int returns the interrupt number of the timer.             }
  138.   { FOSSIL_Ticks_Per_Second returns the number of ticks per second          }
  139.   { of the interrupt.  FOSSIL_MS_Per_Tick returns the approximate           }
  140.   { number of milliseconds per pick.                                        }
  141.  
  142.  
  143. PROCEDURE FOSSIL_Flush_Output(FOSSIL_Port:Word);
  144.   { Sends any data waiting in the outbound buffer.  Control will not        }
  145.   { be returned until all of the data has been sent.                        }
  146.  
  147.  
  148. PROCEDURE FOSSIL_Purge_Output(FOSSIL_Port:Word);
  149. PROCEDURE FOSSIL_Purge_Input(FOSSIL_Port:Word);
  150.   { These two procedures are used to discard the data in the outbound       }
  151.   { and inbound buffers, respectively.                                      }
  152.  
  153.  
  154. FUNCTION FOSSIL_Xmit_Chr_No_Wait(FOSSIL_Port:Word; C:Char):Boolean;
  155.   { Attempts to transmit the specified character.  Returns TRUE if          }
  156.   { room was available in the outbound buffer, FALSE if not.                }
  157.  
  158.  
  159. FUNCTION FOSSIL_Peek(FOSSIL_Port:Word):Char;
  160.   { Returns the next character in the inbound buffer without removing       }
  161.   { that character from the buffer.  FFh (#255) is returned if no           }
  162.   { characters are waiting.  If your software is not prepared to check      }
  163.   { for FFh, you should use FOSSIL_Char_Waiting in combination with         }
  164.   { FOSSIL_Read_Chr.                                                        }
  165.  
  166.  
  167. PROCEDURE FOSSIL_Read_Key_No_Wait(VAR C:Char);
  168. PROCEDURE FOSSIL_Read_Key(VAR C:Char);
  169.   { These two procedures provide access to the IBM keyboard.                }
  170.   { FOSSIL_Read_Key waits until a key is available in the keyboard buffer.  }
  171.   { FOSSIL_Read_Key_No_Wait returns immediately with FFh (#255) if          }
  172.   { a key has not been pressed.                                             }
  173.  
  174.  
  175. PROCEDURE FOSSIL_Flow_Control(FOSSIL_Port:Word; Mask:Byte);
  176.   { Enables and disables flow control.                                      }
  177.   {                                                                         }
  178.   { xxxx 0000                                                               }
  179.   {   │  │││└─ XON/XOFF flow control on transmit                            }
  180.   {   │  ││└── RTS/CTS flow control                                         }
  181.   {   │  │└─── Reserved for DSR/DTR                                         }
  182.   {   │  └──── XON/XOFF flow control on receive                             }
  183.   {   │                                                                     }
  184.   {   └─────── The high bits are reserved for a different but not identical }
  185.   {            implemenation.  FOSSIL_Flow_Control will set these bits to 1 }
  186.   {            for compatibility reasons.                                   }
  187.   {                                                                         }
  188.   { Four constants have been provided:                                      }
  189.   {   XON_XOFF_Transmit = 1                                                 }
  190.   {   RTS_CTS           = 2                                                 }
  191.   {   DSR_DTR           = 4                                                 }
  192.   {   XON_XOFF_Receive  = 8                                                 }
  193.  
  194.  
  195. PROCEDURE FOSSIL_GotoXY(X,Y:Byte);
  196.   { Changes the position of the cursor.  The coordinates are 1-based (same  }
  197.   { as the Borland CRT unit).                                               }
  198.  
  199.  
  200. FUNCTION FOSSIL_WhereX:Byte;
  201. FUNCTION FOSSIL_WhereY:Byte;
  202.   { Returns the X or Y position of the cursor.  The coordinates are         }
  203.   { 1-based (same as the Borland CRT unit).                                 }
  204.  
  205.  
  206. PROCEDURE FOSSIL_ANSI_Write(C:Char);
  207.   { Sends character C to the screen in such a way that ANSI processing      }
  208.   { can occur (if available).  Never call this routine if DOS output        }
  209.   { cannot be used. Refer to FOSSIL_BIOS_Write below.                       }
  210.  
  211.  
  212. PROCEDURE FOSSIL_Watchdog(FOSSIL_Port:Word; Watch:Boolean);
  213.   { Enables or disables a carrier watchdog function.  The watchdog will     }
  214.   { reboot the system if the remote system drops the connected.  This       }
  215.   { allows the BBS or front-end to regain control of the system.  This      }
  216.   { function may not work under a multitasker.                              }
  217.  
  218.  
  219. PROCEDURE FOSSIL_BIOS_Write(C:Char);
  220.   { Sends a character to the screen using BIOS I/O routines.  DOS I/O       }
  221.   { routines are not used.                                                  }
  222.  
  223.  
  224. PROCEDURE FOSSIL_Reboot_Cold;
  225. PROCEDURE FOSSIL_Reboot_Warm;
  226.   { These two procedures are used to reboot the system.  A warm reboot      }
  227.   { usually skips the initial memory test, while a cold boot does not.      }
  228.   { These procedures may not work under a multitasker.                      }
  229.  
  230.  
  231. FUNCTION FOSSIL_Block_Write(FOSSIL_Port, Bytes:Word; Data:Pointer):Word;
  232.   { Copies data from your buffer to the outbound buffer.  This is           }
  233.   { much faster than a FOR loop of FOSSIL_Xmit_Chr calls.                   }
  234.  
  235.  
  236. FUNCTION FOSSIL_Xmit_Str(FOSSIL_Port:Word; CONST S:OpenString):Word;
  237.   { Essentially a wrapped FOSSIL_Block_Write (see above).                   }
  238.  
  239.  
  240. PROCEDURE FOSSIL_Info(FOSSIL_Port,Size:Word; Data:Pointer);
  241.   { Returns information about the fossil driver.  Data should point         }
  242.   { to a FOSSIL_Info_Type structure.                                        }
  243.  
  244.  
  245.