home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 2 / crawlyvol2.bin / program / c / bts314b4 / com_st.h < prev    next >
C/C++ Source or Header  |  1994-09-07  |  9KB  |  263 lines

  1. #ifndef H_COM_ST
  2. #define H_COM_ST
  3. /*
  4.  * com_st.h
  5.  *
  6.  * Atari ST version of com_dos.h and com_os2.h
  7.  *
  8.  * This emulates some of the Fossil functions
  9.  * Refer to FSC-0015.CHT and FSC-0015.DOC
  10.  *
  11.  */
  12.  
  13. #ifndef _PORTAB_H
  14. #include <portab.h>
  15. #endif
  16.  
  17. #ifdef LATTICE
  18. #ifndef _OSBIND_H
  19. #include <osbind.h>
  20. #endif
  21. #endif
  22.  
  23. #ifdef __TOS__
  24. #include "tos.h"
  25. #ifndef TRUE
  26. typedef int BOOLEAN;
  27. #define FALSE 0
  28. #define TRUE 1
  29. #endif
  30. #endif
  31.  
  32. extern unsigned int comm_bits;
  33. extern unsigned int parity;
  34. extern unsigned int stop_bits;
  35.  
  36.  
  37. #define BITS_7            0x20
  38. #define BITS_8            0x00
  39.  
  40. #define STOP_1             0x08
  41. #define STOP_2             0x18
  42.  
  43. #define ODD_PARITY        0x06
  44. #define EVEN_PARITY     0x04
  45. #define NO_PARITY        0x00
  46.  
  47.  
  48. #define BAUD_300        300            /* These are the Rsconf parameters */
  49. #define BAUD_1200    1200
  50. #define BAUD_2400        2400
  51. #define BAUD_4800        4800
  52. #define BAUD_9600        9600
  53. #define BAUD_19200    19200
  54. #define BAUD_38400    38400
  55. #define BAUD_57600      57600
  56. #define BAUD_76800  76800
  57. #define BAUD_115200 115200
  58. #define BAUD_153600 153600
  59.  
  60. #define USE_XON            0x01        /* OR these for both */
  61. #define USE_CTS            0x02
  62.  
  63. #define BRK             0x01
  64. #define MDM             0x02
  65.  
  66.  
  67. #define PSG_RTS 0x08
  68. #define PSG_DTR 0x10
  69.  
  70. #define DTR_BITS (PSG_DTR+PSG_RTS)
  71.  
  72. /* Status return values */
  73.  
  74. #define DATA_READY        0x0100
  75. #define OVERRUN_ERR        0x0200
  76. #define PARITY_ERR        0x0400
  77. #define FRAMING_ERR        0x0800
  78. #define BREAK_INT        0x1000
  79. #define TX_HOLD_EMPTY    0x2000
  80. #define TX_SHIFT_EMPTY    0x4000
  81.  
  82.  
  83.  
  84.  
  85. #define GENERIC            /* Keep Zmodem happy with 68000 ordering */
  86.  
  87.  
  88.  
  89. /* The fossil routines */
  90.  
  91.                            /*-----------------------------------------------*/
  92.                            /* Service 0: SET BAUD(etc)                      */
  93.                            /*-----------------------------------------------*/
  94.  
  95.  
  96. void MDM_ENABLE(unsigned baud);
  97.  
  98.                            /*-----------------------------------------------*/
  99.                            /* Service 1: SEND CHAR (wait)                   */
  100.                            /*-----------------------------------------------*/
  101. extern BOOLEAN HardCTS;
  102. long get_cts(void);
  103. #define CTS ((BOOLEAN)Supexec(get_cts))
  104. void SENDBYTE(unsigned char);
  105.                            /*-----------------------------------------------*/
  106.                            /* Service 2: GET CHAR (wait)                    */
  107.                            /*-----------------------------------------------*/
  108. int MODEM_IN(void);
  109.                            /*-----------------------------------------------*/
  110.                            /* Service 3: GET STATUS                         */
  111.                            /*-----------------------------------------------*/
  112. long get_dcd(void);
  113. #define CARRIER         ((BOOLEAN)Supexec(get_dcd))
  114. long CHAR_AVAIL(void);
  115. long OUT_FULL(void);
  116. BOOLEAN OUT_EMPTY(void);
  117.                            /*-----------------------------------------------*/
  118.                            /* Service 4: INIT/INSTALL                       */
  119.                            /*-----------------------------------------------*/
  120. int Cominit(int);
  121.                            /*-----------------------------------------------*/
  122.                            /* Service 5: UNINSTALL                          */
  123.                            /*-----------------------------------------------*/
  124. void MDM_DISABLE(void);
  125.                            /*-----------------------------------------------*/
  126.                            /* Service 6: SET DTR                            */
  127.                            /*-----------------------------------------------*/
  128. long dtr_on(void);
  129. #define DTR_ON()             Supexec(dtr_on)
  130. long dtr_off(void);
  131. #define DTR_OFF()         Supexec(dtr_off)
  132.                            /*-----------------------------------------------*/
  133.                            /* Service 7: GET TIMER TICK PARMS               */
  134.                            /*-----------------------------------------------*/
  135.  
  136.                            /*-----------------------------------------------*/
  137.                            /* Service 8: FLUSH OUTBOUND RING-BUFFER         */
  138.                            /*-----------------------------------------------*/
  139.  
  140.                            /*-----------------------------------------------*/
  141.                            /* Service 9: NUKE OUTBOUND RING-BUFFER          */
  142.                            /*-----------------------------------------------*/
  143. void CLEAR_OUTBOUND(void);
  144.                            /*-----------------------------------------------*/
  145.                            /* Service a: NUKE INBOUND RING-BUFFER           */
  146.                            /*-----------------------------------------------*/
  147. void CLEAR_INBOUND(void);
  148.                            /*-----------------------------------------------*/
  149.                            /* Service b: SEND CHAR (no wait)                */
  150.                            /*-----------------------------------------------*/
  151. BOOLEAN Com_Tx_NW(char);
  152.                            /*-----------------------------------------------*/
  153.                            /* Service c: GET CHAR (no wait)                 */
  154.                            /*-----------------------------------------------*/
  155. int PEEKBYTE(void);
  156.                            /*-----------------------------------------------*/
  157.                            /* Service d: GET KEYBOARD STATUS                */
  158.                            /*-----------------------------------------------*/
  159.  
  160. /*
  161.  * I seem to be losing a lot of characters when calling Bios, I suspect
  162.  * GemDos is grabbing them into its own internal buffer
  163.  *
  164.  * Try using GEMDOS instead
  165.  */
  166. #define KEYPRESS()        Cconis()
  167.  
  168.                            /*-----------------------------------------------*/
  169.                            /* Service e: GET KEYBOARD CHARACTER (wait)      */
  170.                            /*-----------------------------------------------*/
  171. int getkey(void);
  172. #define READKB()    getkey()
  173. #define FOSSIL_CHAR()   getkey()
  174.                            /*-----------------------------------------------*/
  175.                            /* Service f: SET/GET FLOW CONTROL STATUS        */
  176.                            /*-----------------------------------------------*/
  177.  
  178. #ifdef OLDXON
  179.  
  180. #define XON_ENABLE()    Rsconf(-1, /* xonflow| */ ctsflow        ,-1,-1,-1,-1)
  181. #define XON_DISABLE()   Rsconf(-1, ctsflow,-1,-1,-1,-1)
  182. #define IN_XON_ENABLE()    Rsconf(-1, /* xonflow| */ ctsflow        ,-1,-1,-1,-1)
  183.  
  184. #else    /* NULL Functions */
  185.  
  186. #define XON_ENABLE()
  187. #define XON_DISABLE()
  188. #define IN_XON_ENABLE()
  189.  
  190. #endif
  191.  
  192.                            /*-----------------------------------------------*/
  193.                            /* Service 10: SET/GET CTL-BREAK CONTROLS        */
  194.                            /*             Note that the "break" here refers */
  195.                            /*             to ^C and ^K rather than the      */
  196.                            /*             tradition modem BREAK.            */
  197.                            /*-----------------------------------------------*/
  198.  
  199. #define _BRK_ENABLE()   ((void)0)    /* Null function */
  200. #define _BRK_DISABLE()  ((void)0)    /* Null function */
  201. #define RECVD_BREAK()    0
  202.  
  203.                            /*-----------------------------------------------*/
  204.                            /* Service 11: SET LOCAL VIDEO CURSOR POSITION   */
  205.                            /*-----------------------------------------------*/
  206.  
  207.                            /*-----------------------------------------------*/
  208.                            /* Service 12: GET LOCAL VIDEO CURSOR POSITION   */
  209.                            /*-----------------------------------------------*/
  210.  
  211.                            /*-----------------------------------------------*/
  212.                            /* Service 13: WRITE LOCAL ANSI CHARACTER        */
  213.                            /*-----------------------------------------------*/
  214.  
  215. #ifdef BIOSDISPLAY
  216. #define WRITE_ANSI(c)   (BIOSdisplay ? Bconout(2, c) : Cconout(c))
  217. #else
  218. #define WRITE_ANSI(c)   Cconout(c)
  219. #endif
  220.                            /*-----------------------------------------------*/
  221.                            /* Service 14: WATCHDOG on/off                   */
  222.                            /*-----------------------------------------------*/
  223.  
  224.                            /*-----------------------------------------------*/
  225.                            /* Service 15: BIOS write to screen              */
  226.                            /*-----------------------------------------------*/
  227.  
  228.  
  229. /*
  230.  * Other miscellaneous Comms functions
  231.  */
  232.  
  233. int real_flush (int);        /* Flush the file */
  234.  
  235. void do_break (int);        /* Send break signal */
  236.  
  237. /*
  238.  * Send a block of data to modem
  239.  * if carcheck is non zero then abort if no carrier
  240.  *
  241.  * Will NOT wait for buffer space.
  242.  */
  243.  
  244. void SENDCHARS(char *buf, size_t size, BOOLEAN carcheck);
  245.  
  246. void BUFFER_BYTE (unsigned char);
  247. void UNBUFFER_BYTES (void);
  248.  
  249. extern BOOLEAN ikbdclock;
  250. extern BOOLEAN hard_38400;
  251. extern BOOLEAN rsve_board;
  252.  
  253. void update_time(void);
  254. extern int ctsflow;            /* Mask for CTS flow enabling */
  255. /* extern int xonflow; */            /* Xon/Xoff flow mask */
  256. extern unsigned int st_lock_baud;
  257.  
  258. extern size_t tBufSize;            /* New size of buffers */
  259. extern size_t rBufSize;
  260.  
  261.  
  262. #endif    /* H_COM_ST */
  263.