home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1996 October / PCO_10.ISO / filesbbs / bsrc_260.arj / INCLUDE.ZIP / com_dos.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-03-26  |  11.2 KB  |  258 lines

  1. /*--------------------------------------------------------------------------*/
  2. /*                                                                          */
  3. /*                                                                          */
  4. /*      ------------         Bit-Bucket Software, Co.                       */
  5. /*      \ 10001101 /         Writers and Distributors of                    */
  6. /*       \ 011110 /          Freely Available<tm> Software.                 */
  7. /*        \ 1011 /                                                          */
  8. /*         ------                                                           */
  9. /*                                                                          */
  10. /*              (C) Copyright 1987-96, Bit Bucket Software Co.              */
  11. /*                                                                          */
  12. /*                                                                          */
  13. /*                                                                          */
  14. /*           Communications (FOSSIL) definitions for BinkleyTerm            */
  15. /*                                                                          */
  16. /*                                                                          */
  17. /*    For complete  details  of the licensing restrictions, please refer    */
  18. /*    to the License  agreement,  which  is published in its entirety in    */
  19. /*    the MAKEFILE and BT.C, and also contained in the file LICENSE.260.    */
  20. /*                                                                          */
  21. /*    USE  OF THIS FILE IS SUBJECT TO THE  RESTRICTIONS CONTAINED IN THE    */
  22. /*    BINKLEYTERM  LICENSING  AGREEMENT.  IF YOU DO NOT FIND THE TEXT OF    */
  23. /*    THIS  AGREEMENT IN ANY OF THE  AFOREMENTIONED FILES,  OR IF YOU DO    */
  24. /*    NOT HAVE THESE FILES,  YOU  SHOULD  IMMEDIATELY CONTACT BIT BUCKET    */
  25. /*    SOFTWARE CO.  AT ONE OF THE  ADDRESSES  LISTED BELOW.  IN NO EVENT    */
  26. /*    SHOULD YOU  PROCEED TO USE THIS FILE  WITHOUT HAVING  ACCEPTED THE    */
  27. /*    TERMS  OF  THE  BINKLEYTERM  LICENSING  AGREEMENT,  OR  SUCH OTHER    */
  28. /*    AGREEMENT AS YOU ARE ABLE TO REACH WITH BIT BUCKET SOFTWARE, CO.      */
  29. /*                                                                          */
  30. /*                                                                          */
  31. /* You can contact Bit Bucket Software Co. at any one of the following      */
  32. /* addresses:                                                               */
  33. /*                                                                          */
  34. /* Bit Bucket Software Co.        FidoNet  1:104/501, 1:343/491             */
  35. /* P.O. Box 460398                AlterNet 7:42/1491                        */
  36. /* Aurora, CO 80046               BBS-Net  86:2030/1                        */
  37. /*                                Internet f491.n343.z1.fidonet.org         */
  38. /*                                                                          */
  39. /* Please feel free to contact us at any time to share your comments about  */
  40. /* our software and/or licensing policies.                                  */
  41. /*                                                                          */
  42. /*--------------------------------------------------------------------------*/
  43.  
  44. /* Baud rate masks */
  45.  
  46. #define BAUD_300        0x040
  47. #define BAUD_1200        0x080
  48. #define BAUD_2400        0x0A0
  49. #define BAUD_4800        0x0C0
  50. #define BAUD_9600        0x0E0
  51. #define BAUD_19200        0x000
  52. #define BAUD_38400        0x020
  53.  
  54. #define EXTENDED_BAUDRATES
  55. #define BAUD_EXT_110    0x00
  56. #define BAUD_EXT_150    0x01
  57. #define BAUD_EXT_300    0x02
  58. #define BAUD_EXT_600    0x03
  59. #define BAUD_EXT_1200   0x04
  60. #define BAUD_EXT_2400   0x05
  61. #define BAUD_EXT_4800   0x06
  62. #define BAUD_EXT_9600   0x07
  63. #define BAUD_EXT_19200  0x08
  64. #define BAUD_EXT_28800  0x80
  65. #define BAUD_EXT_38400  0x81
  66. #define BAUD_EXT_57600  0x82
  67. #define BAUD_EXT_76800  0x83 /* With standard UART this isn't possible */
  68. #define BAUD_EXT_115200 0x84
  69.  
  70. /* Bit definitions for the Line Status Register */
  71.  
  72. #define DATA_READY        0x0100
  73. #define OVERRUN_ERR        0x0200
  74. #define PARITY_ERR        0x0400
  75. #define FRAMING_ERR        0x0800
  76. #define BREAK_INT        0x1000
  77. #define TX_HOLD_EMPTY    0x2000
  78. #define TX_SHIFT_EMPTY    0x4000
  79.  
  80. int com_getc (int);
  81. unsigned Cominit (int, int);
  82. unsigned Com_ (char, byte);
  83. void MDM_DISABLE (void);
  84. void MDM_ENABLE (unsigned long);
  85. int MODEM_IN (void);
  86. int MODEM_STATUS (void);
  87. int PEEKBYTE (void);
  88. void SENDBYTE (unsigned char);
  89. void CLEAR_INBOUND (void);
  90. void CLEAR_OUTBOUND (void);
  91. void SENDCHARS (char far *, unsigned int, int);
  92. void BUFFER_BYTE (unsigned char);
  93. void UNBUFFER_BYTES (void);
  94. void do_break (int);
  95. extern USHORT ComTXBlockTimeout (BYTE *lpBuf, USHORT cbBuf, ULONG ulTimer);
  96. extern USHORT ComTXRemain (void);
  97.  
  98. /*--------------------------------------------------------------------------*/
  99. /* MACROS that call the routines in COM_ASM                                 */
  100. /*--------------------------------------------------------------------------*/
  101. extern unsigned Com_ (char, byte);
  102. extern unsigned Cominit (int, int);
  103. extern int READBYTE ();
  104.  
  105. /*#define M_INSTALL(b)       {Cominit(com_port);Com_(0x0f,0);Com_(0x0f,handshake_mask);new_baud(0,b);}*/
  106.  
  107. /*-----------------------------------------------*/
  108. /* Service 0: SET BAUD(etc)                      */
  109. /*-----------------------------------------------*/
  110.  
  111. /*#define MDM_ENABLE(b)      (Com_(0x00,b|NO_PARITY|STOP_1|BITS_8))*/
  112.  
  113. /*-----------------------------------------------*/
  114. /* Service 1: SEND CHAR (wait)                   */
  115. /*-----------------------------------------------*/
  116.  
  117. /*#define SENDBYTE(x)    (Com_(0x01,x))*/
  118.  
  119. /*-----------------------------------------------*/
  120. /* Service 2: GET CHAR (wait)                    */
  121. /*-----------------------------------------------*/
  122.  
  123. /*#define MODEM_IN()         (Com_(0x02)&0x00ff)*/
  124.  
  125. /*-----------------------------------------------*/
  126. /* Service 3: GET STATUS                         */
  127. /*-----------------------------------------------*/
  128.  
  129. /*#define MODEM_STATUS()     (Com_(0x03))*/
  130. #define CARRIER            (Com_(0x03,0)&carrier_mask)
  131. #define CHAR_AVAIL()       (MODEM_STATUS()&DATA_READY)
  132. #define OUT_EMPTY()        (Com_(0x03,0)&TX_SHIFT_EMPTY)
  133. #define OUT_FULL()         (!(Com_(0x03,0)&TX_HOLD_EMPTY))
  134.  
  135. /*-----------------------------------------------*/
  136. /* Service 4: INIT/INSTALL                       */
  137. /*-----------------------------------------------*/
  138.  
  139. /*-----------------------------------------------*/
  140. /* Service 5: UNINSTALL                          */
  141. /*-----------------------------------------------*/
  142.  
  143. /*#define MDM_DISABLE()      (Com_(0x05,BAUD_2400|NO_PARITY|STOP_1|BITS_8))*/
  144.  
  145. /*-----------------------------------------------*/
  146. /* Service 6: SET DTR                            */
  147. /*-----------------------------------------------*/
  148.  
  149. #define LOWER_DTR()        ((void) Com_(0x06,0))
  150. #define RAISE_DTR()        ((void) Com_(0x06,1))
  151.  
  152. /*-----------------------------------------------*/
  153. /* Service 7: GET TIMER TICK PARMS               */
  154. /*-----------------------------------------------*/
  155.  
  156. /*-----------------------------------------------*/
  157. /* Service 8: FLUSH OUTBOUND RING-BUFFER         */
  158. /*-----------------------------------------------*/
  159.  
  160. /*-----------------------------------------------*/
  161. /* Service 9: NUKE OUTBOUND RING-BUFFER          */
  162. /*-----------------------------------------------*/
  163.  
  164. /*#define CLEAR_OUTBOUND()   (Com_(0x09,0))*/
  165.  
  166. /*-----------------------------------------------*/
  167. /* Service a: NUKE INBOUND RING-BUFFER           */
  168. /*-----------------------------------------------*/
  169.  
  170. /*#define CLEAR_INBOUND()    (Com_(0x0a,0))*/
  171.  
  172. /*-----------------------------------------------*/
  173. /* Service b: SEND CHAR (no wait)                */
  174. /*-----------------------------------------------*/
  175.  
  176. #define Com_Tx_NW(c)       (Com_(0x0b,c))
  177.  
  178. /*-----------------------------------------------*/
  179. /* Service c: GET CHAR (no wait)                 */
  180. /*-----------------------------------------------*/
  181.  
  182. /*#define PEEKBYTE()         (Com_(0x0c,0))*/
  183.  
  184. /*-----------------------------------------------*/
  185. /* Service d: GET KEYBOARD STATUS                */
  186. /*-----------------------------------------------*/
  187.  
  188. #define KEYPRESS()         (Com_(0x0d,0)!=(0xffff))
  189. #define FOSSIL_PEEKKB()    (Com_(0x0d,0))
  190.  
  191. /*-----------------------------------------------*/
  192. /* Service e: GET KEYBOARD CHARACTER (wait)      */
  193. /*-----------------------------------------------*/
  194.  
  195. #define READKB()           (Com_(0x0e,0)&0xff)
  196. #define READSCAN()         (Com_(0x0e,0))
  197.  
  198. #define FOSSIL_CHAR()      READSCAN()
  199.  
  200. /*-----------------------------------------------*/
  201. /* Service f: SET/GET FLOW CONTROL STATUS        */
  202. /*-----------------------------------------------*/
  203.  
  204. #define XON_ENABLE()       ((void) Com_(0x0f,(byte)handshake_mask))
  205. #define XON_DISABLE()      ((void) Com_(0x0f,(byte)(handshake_mask&(~USE_XON))))
  206. #define IN_XON_ENABLE()    ((void) Com_(0x0f,(byte)(handshake_mask|OTHER_XON)))
  207. #define IN_XON_DISABLE()   ((void) Com_(0x0f,(byte)(handshake_mask&(~OTHER_XON))))
  208.  
  209. /*-----------------------------------------------*/
  210. /* Service 10: SET/GET CTL-BREAK CONTROLS        */
  211. /*             Note that the "break" here refers */
  212. /*             to ^C and ^K rather than the      */
  213. /*             tradition modem BREAK.            */
  214. /*-----------------------------------------------*/
  215.  
  216. #define _BRK_ENABLE()      (Com_(0x10,BRK))
  217. #define _BRK_DISABLE()     (Com_(0x10,0))
  218. #define RECVD_BREAK()      (Com_(0x10,BRK)&BRK)
  219.  
  220. /*-----------------------------------------------*/
  221. /* Service 11: SET LOCAL VIDEO CURSOR POSITION   */
  222. /*-----------------------------------------------*/
  223.  
  224. /*-----------------------------------------------*/
  225. /* Service 12: GET LOCAL VIDEO CURSOR POSITION   */
  226. /*-----------------------------------------------*/
  227.  
  228. /*-----------------------------------------------*/
  229. /* Service 13: WRITE LOCAL ANSI CHARACTER        */
  230. /*-----------------------------------------------*/
  231.  
  232. #define WRITE_ANSI(c)    ((void) Com_(0x13,(byte)(c)))
  233.  
  234. /*-----------------------------------------------*/
  235. /* Service 14: WATCHDOG on/off                   */
  236. /*-----------------------------------------------*/
  237.  
  238. #define FOSSIL_WATCHDOG(x) (Com_(0x14,x))
  239.  
  240. /*-----------------------------------------------*/
  241. /* Service 15: BIOS write to screen              */
  242. /*-----------------------------------------------*/
  243.  
  244. #define WRITE_BIOS(c) (Com_(0x15,(byte)c))
  245.  
  246. /*--------------------------------------------------------------------------*/
  247. /*                                                                          */
  248. /* A no-stall ReadByte routine might look like this:                        */
  249. /*                                                                          */
  250. /*    int READBYTE()                                                        */
  251. /*    {                                                                     */
  252. /*       return( CHAR_AVAIL() ? MODEM_IN() : (-1) );                        */
  253. /*    }                                                                     */
  254. /*                                                                          */
  255. /*--------------------------------------------------------------------------*/
  256.  
  257. /* END OF FILE: com_dos.h */
  258.