home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / sigm / vol183 / hardware.bb2 < prev    next >
Encoding:
Text File  |  1984-09-10  |  3.0 KB  |  95 lines

  1. /*
  2.  * This header file contains hardware-dependent definitions for C programs.
  3.  
  4.     Set up for Big Board II by Michael Mee        1983-7-30
  5.     Revision 0.0
  6.  
  7.     Includes initialization for use with modem, with thanks to
  8. Gordon Banks.
  9.  */
  10.  
  11. /*
  12.  * Some console (video) terminal characteristics:
  13.  */
  14.  
  15. #define TWIDTH    80    /* # of columns    */
  16. #define TLENGTH    24    /* # of lines    */
  17. #define CLEARS    "\032"    /* String to clear screen on console    */
  18. #define INTOREV    "\033G4" /* String to switch console into reverse video    */
  19. #define OUTAREV "\033G0" /* String to switch console OUT of reverse video  */
  20. #define ESC    '\033'    /* Standard ASCII 'escape' character    */
  21.  
  22.  
  23. /*
  24.     The following definitions provide a portable low-level interface
  25.     for direct I/O to the  console and modem devices. The values
  26.     used here are only for example; be certain to go in and customize
  27.     them for your system! Note that only one of the two sections
  28.     (I/O port vs. memory mapped) will be needed for your system,
  29.     so feel free to edit the unused section out of the file and remove
  30.     the conditional compilation lines around the section you end up
  31.     using.
  32. */
  33.                         /* Console */
  34. #define CON_TBE        (TRUE)        /* Memory mapped screen always rdy */
  35. #define CON_RDA        (bios(2,0))
  36. #define CON_TDATA(byte)    (bios(4,byte))
  37. #define CON_RDATA    (bios(3,0))
  38.  
  39.                         /* Modem */
  40. /*************
  41.     Comment out the appropriate block for SIO A/B
  42.                             *************/
  43. #define SIOA    /* change to SIOB for B port */
  44.  
  45. #ifdef SIOA
  46. #define CPORT     0x81            /* sio A control port */
  47. #define DPORT     0x80            /*  '      data   '   */
  48. #define BAUDPORT 0x89            /* CTC B channel 1    */
  49. #endif
  50. #ifdef SIOB
  51. #define CPORT    0x83            /* sio B control port */
  52. #define DPORT    0x82            /*  '      data   '   */
  53. #define BAUDPORT 0x88            /* CTC B channel 0    */
  54. #endif
  55.  
  56. #define    MOD_TBE        (inp(CPORT) & 4)
  57. #define MOD_RDA        (inp(CPORT) & 1)
  58. #define    MOD_TDATA(byte)    (outp(DPORT, byte))
  59. #define    MOD_RDATA    (inp(DPORT))
  60.  
  61.  
  62. /**********  init - set up SIO (port A)
  63.     For 8 bits, no parity, 1 start & stop bit
  64.  
  65. Add a call to init() from TELED, or incorporate this into
  66. your BIOS to set up your SIO & CTC for modem use.
  67.  
  68. ( I haven't checked this for port B.  Check SIO documentation
  69.  if you have problems - and channel A WILL work)
  70.                           *********/
  71.  
  72. #define X8BIT    0x60    /* transmit 8 bits */
  73. #define XDTR    0x80    /* ready to transmit */
  74. #define XBREAK    0x10    /* transmit a break */
  75. #define XENABLE 0x08    /* transmit enable */
  76. #define XRTS    0x02    /* Ready to send */
  77. #define R8BIT    0xC0    /* receive 8 bits */
  78. #define R1STOP  0x04    /* receive 1 stop bit */
  79. #define RENABLE 1    /* receive enable */
  80. #define R16CLCK 0x40    /* 16 x clock mode */
  81. #define BAUDPORT 0    /* baud rate generator port (SIO chan A) */
  82.  
  83.  
  84. init()        /* set up modem port */
  85. {
  86.     outp(BAUDPORT, 0x47);        /* set up baud rate */
  87.     outp(BAUDPORT, 128);        /* (to 300) */
  88.     outp(CPORT, 4);            /* select SIO reg 4 */
  89.     outp(CPORT, R16CLCK | 0x04);     /* 16 clock, 1 stop bit */
  90.     outp(CPORT, 3);            /* reg 3 */
  91.     outp(CPORT, R8BIT | RENABLE);    /* 8 bits, read enable */
  92.     outp(CPORT, 5);            /* reg 5 */
  93.     outp(CPORT, XDTR | X8BIT | XENABLE | XRTS);
  94. }
  95.