home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast2.iso / fido / gendrivr.zip / DRIVER.DOC next >
Text File  |  1987-07-07  |  7KB  |  204 lines

  1. Universal Drivers for Telink, Minitel, Fido, FidoNet,
  2. Sysop, and Rolodex.
  3.  
  4. T. Jennings     27 Nov 84
  5.          7 Jul 87    _mbusy
  6.  
  7.     All IO drivers MUST conform to this standard. All software will do
  8. screen, clock, and modem IO through these drivers.
  9.  
  10. GENERAL
  11.  
  12.     You should put certain functions into seperate files, along the
  13. following guidelines. The reason is that some programs use only the screen
  14. functions (Rolodex, etc) some use only the modem functions (ViaDev, etc)
  15. and some use both (Fido, Telink, etc). Seperating them will allow not
  16. loading the whole damn thing everytime.
  17.  
  18.     Also, lconout must be in a seperate file; sometimes it is necessary
  19. to use the standard MSDOS lconout() so that redirection can still be used.
  20. PLINK will complain about multiple defineds unless you seperate them.
  21.  
  22.     DRIVER.H defines the static variables that must be set. These are:
  23.  
  24.  
  25. CRT Variables
  26.  
  27. int lines;    Number of lines on the screen, i.e. 24 for a
  28.         24 line screen.
  29.  
  30. int cols;    The number of columns on the screen, i.e. 80
  31.         for an 80 column screen.
  32.  
  33. int top;    A mistake, but this is the top line NUMBER. Zero
  34.         is just about universal, though, if the hardware
  35.         starts its line numbering at 1, set it to 1.
  36.  
  37. int bottom;    The last line NUMBER, i.e. if the first line
  38.         number is 0, then for a 24 line screen this will
  39.         be 23.
  40.  
  41.  
  42. char ulcorner = '+';    These are the characters used in drawing
  43. char urcorner = '+';    boxes on the screen. if DRIVER.H is used,
  44. char llcorner = '+';    they have the indicated defaults.
  45. char lrcorner = '+';    They can be changed at init() time.
  46. char vertbar = '|';
  47. char horizbar = '-';
  48.  
  49. char graph_on[];    These are null terminated strings, used to
  50. char graph_of[];    enable and disable graphics mode. If they are 
  51.             not null, then they are sent out before any 
  52.             attempts are made to draw the graphic 
  53.             characters above. These must be set at init() 
  54.             time.
  55.  
  56.  
  57. MODEM PARAMETERS
  58.  
  59. unsigned cd_bit;    A bit mask for the modem input status
  60.             function. This should be used by the
  61.             _dsr() function (below) for testing
  62.             for Carrier Detect. It is set by the
  63.             main() of the program, with some sort
  64.             of default. If desired, the default can
  65.             be changed by the driver at init() time.
  66.  
  67. TIMER PARAMETERS:
  68.  
  69. long millisec;        These are incremented as millisecond
  70. long millis2;        counters. The resolution is 1 millisec;
  71.             however, high accuracy is not required. For
  72.             the IBM PC, 55 is added every timer tick,
  73.             and is close enough. For a 10 mS timer tick,
  74.             add 10, etc.
  75.  
  76. int seconds;        Incremented at the same time as millisec,
  77. int minutes;        above. Seconds should run from 0 to 59, then
  78.             be cleared to zero, and minutes incremented. 
  79.             Minutes increments indefinitely; there is
  80.             no hours counter.
  81.  
  82.  
  83.  
  84. FUNCTIONS:
  85.  
  86. scrinit()        Set all the abovementioned screen variables.
  87.             This is always called before any screen
  88.             access is done.
  89.  
  90. init()            Full hardware initialization. This sets up
  91.             any interrupt structures, calls scrinit(),
  92.             and performs any other initialization
  93.             necessary to make the hardware usable. This
  94.             should also raise the DTR line, if any 
  95.             (described below). There is a matching 
  96.             function, uninit().
  97.  
  98.             This should start the clock ticking, and the
  99.             'minutes' variable incremented once per
  100.             minute. See NOTES, below, on a function to
  101.             perform this.
  102.  
  103. uninit()        Take down any initialization necessary before
  104.             returning to DOS, such as clock interrupts.
  105.             NOTE: This should NEVER disturb the current
  106.             state of DTR. This is to allow one program
  107.             to terminate, and take control of the modem,
  108.             without losing carrier. See NOTES on taking
  109.             down the clock.
  110.  
  111. baud(rate)        Set the baud rate of the serial port or
  112.             modem. 'rate' is the desired baud rate; it
  113.             returns the baud rate set, or zero if that 
  114.             rate is not supported.
  115.  
  116. _mconstat()        Returns 0 if no character ready at the modem,
  117.             else any non-zero value. Do not remove the
  118.             character from the modem. Non-destructive
  119.             reads are performed at the next highest layer.
  120.  
  121. _mconin()        Returns the contents of the modem data port. 
  122.             Wait for a character if necessary. Must return
  123.             an 8 bit value.
  124.  
  125. _mconostat()        Return true if the modem is ready to accept
  126.             a character.
  127.  
  128. _mconout(c)        Output character 'c' to the modem. Wait for
  129.             output ready if necessary.
  130.  
  131. _cd()            Return true if CD is
  132.             true. This reads whatever status port, masks
  133.             it with the cd_bit value, and if true, returns
  134.             true. 
  135.             
  136. lower_dtr()        Drop a modem output control line. The
  137.             actual line used depends on the hardware.
  138.  
  139. raise_dtr()        Raise a modem control line. This also
  140.             depends on the hardware. It should be
  141.             called by init().
  142.  
  143. _mflush()        Flushes both (if any) input and output
  144.             buffers.
  145.  
  146. _mbusy()        Returns true if there is anything in the
  147.             output buffer; ie. returns zero when the
  148.             output buffer is empty.
  149.             If there is no output buffer, then this
  150.             can return zero immediately.
  151.  
  152. _mbreak(n)        Set a line break (n != 0) or remove a line
  153.             break. (n == 0). 
  154.  
  155.  
  156. TIMER FUNCTIONS:
  157.  
  158. set_clk();        Start the timer running, and incrementing
  159.             the TIMER PARAMETERS, mentioned above.
  160.  
  161. clr_clk();        Clears all of the timer counters to zero;
  162.             millisec, millis2, seconds, minutes.
  163.  
  164. reset_clk();        Removes the clock timer.
  165.  
  166.  
  167. CRT FUNCTIONS:
  168.  
  169.  
  170. _lconout()        Optional function. The default one is in the
  171.             XENIX library, which goes through the DOS.
  172.             Create this one for custom applications
  173.             or raw speed.
  174.  
  175.             Note that MSDOS redirection cannot be used
  176.             if this function is invoked. If redirection
  177.             is needed, write an _lconout() in the main
  178.             function, that uses MSDOS calls.
  179.  
  180. place(line,col)        Place cursor at the specified line and 
  181.             column. Input has already been bounded and 
  182.             error checked; code for speed. The passed
  183.             line number starts at 0 (top of screen)
  184.             and columns start at 0 (left edge of screen.)
  185.  
  186.             Avoid the use of printf(), etc, or anything 
  187.             else in "higher" level libraries. Use the 
  188.             local _lconout(), as this function wont be 
  189.             used if the program can use redirection.
  190.  
  191. clreol()        Clear from current cursor position to end 
  192.             of line. Do not move the cursor. 
  193.  
  194. insline()        Insert a blank line at the current cursor
  195.             line, and scroll the line under the cursor,
  196.             and all below it, down one. The inserted
  197.             line does not have to have any specific 
  198.             contents. Code for speed.
  199.  
  200. delline()        Delete a line at the current cursor line.
  201.             The line under the cursor disappears, and
  202.             all lines below it scroll up one. The 
  203.             bottom line does not have to be cleared.
  204.