home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / mailers / x00v124.zip / X00REF.DOC < prev    next >
Text File  |  1990-07-15  |  68KB  |  1,719 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.                    Functions reference manual for the X00 developer
  28.  
  29.                   X.00 A Low Level Serial I/O Communications Driver
  30.                         for MS DOS and like Operating Systems.
  31.  
  32.                         Copyright (c) 1990 by Raymond L. Gwinn
  33.                                  12469 Cavalier Drive
  34.                               Woodbridge, Virginia 22192
  35.                                  All Rights Reserved
  36.  
  37.                                     July 15, 1990
  38.  
  39.  
  40.                                Fidonet address 1:265/1
  41.                                   Data 703-494-8331
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.                                                                           i
  50.  
  51.                                      INTRODUCTION
  52.  
  53.           Previously,  the documentation  for  X00 was  little more  than a
  54.           collection of notes.  The notes were added to as  the development
  55.           process continued and enhancements were made.  I honestly did not
  56.           suspect that  X00 would  become as  widely used as  it is.   This
  57.           manual is an attempt at some decent documentation for X00.
  58.  
  59.           But who do  I document for?   The user that  is setting up  a BBS
  60.           just wants  to get X00 installed and to move on to more important
  61.           things.  The user that is having problems needs information about
  62.           serial  I/O communications  in general  and the  PC specifically.
  63.           The application developer (programmer) needs detailed information
  64.           about each individual function and the information generated.
  65.  
  66.           This manual is  intended as  a reference for  use by  application
  67.           programmers who desires to use X00.   A separate Users manual  is
  68.           included in the distribution file(s).
  69.  
  70.           This manual and the software distributed with it is provided with
  71.           no guarantees.  Use at your own risk.
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.                                                                          ii
  80.  
  81.  
  82.           WHAT IS X00 . . . . . . . . . . . . . . . . . . . . . . . . .   1
  83.  
  84.           Warranty  . . . . . . . . . . . . . . . . . . . . . . . . . .   1
  85.  
  86.           Licensing Information . . . . . . . . . . . . . . . . . . . .   2
  87.                Non-Commercial License . . . . . . . . . . . . . . . . .   2
  88.                Commercial License . . . . . . . . . . . . . . . . . . .   2
  89.  
  90.           Functions . . . . . . . . . . . . . . . . . . . . . . . . . .   4
  91.                Function 00h - Set communications parameters . . . . . .   5
  92.                Function 01h - Transmit character and wait . . . . . . .   6
  93.                Function 02h - Get received character with wait  . . . .   6
  94.                Function 03h - Return Serial Port Status . . . . . . . .   7
  95.                Function 04h - Activate Port . . . . . . . . . . . . . .   8
  96.                Function 05h - Deactivate Port . . . . . . . . . . . . .   9
  97.                Function 06h - Raise/lower DTR . . . . . . . . . . . . .   9
  98.                Function 07h - Return timer tick information . . . . .    10
  99.                Function 08h - Flush output buffer . . . . . . . . . .    10
  100.                Function 09h - Purge output buffer . . . . . . . . . .    10
  101.                Function 0Ah - Purge input buffer  . . . . . . . . . .    11
  102.                Function 0Bh - Transmit no wait  . . . . . . . . . . .    11
  103.                Function 0Ch - Non-destructive read-ahead (Peek) . . .    11
  104.                Function 0Dh - Keyboard read without wait  . . . . . .    12
  105.                Function 0Eh - Keyboard read with wait . . . . . . . .    12
  106.                Function 0Fh - Flow Control for serial I/O . . . . . .    13
  107.                     Xon/Xoff flow control . . . . . . . . . . . . . .    13
  108.                     RTS/CTS flow control  . . . . . . . . . . . . . .    13
  109.                Function 10h - Control-C / Control-K checking  . . . .    14
  110.                Function 11h - Set current cursor location . . . . . .    14
  111.                Function 12h - Read current cursor location  . . . . .    15
  112.                Function 13h - Single character ANSI write to screen .    15
  113.                Function 14h - Enable or disable the DCD watchdog  . .    15
  114.                Function 15h - Write character to screen using BIOS  .    16
  115.                Function 16h - Add  or delete a routine from  the timer
  116.                     tick  . . . . . . . . . . . . . . . . . . . . . .    16
  117.                Function 17h - Reboot system . . . . . . . . . . . . .    17
  118.                Function 18h - Block Read  . . . . . . . . . . . . . .    17
  119.                Function 19h - Block Write . . . . . . . . . . . . . .    17
  120.                Function 1Ah - Break begin or end  . . . . . . . . . .    18
  121.                Function 1Bh - Return information about X00  . . . . .    19
  122.  
  123.           Superset Functions  . . . . . . . . . . . . . . . . . . . .    20
  124.                Function 1Ch - Activate Port . . . . . . . . . . . . .    21
  125.                Function 1Dh - Deactivate Port . . . . . . . . . . . .    22
  126.                Function 1Eh - Extended line control initialization  .    23
  127.                Function 1Fh - Extended serial port status/control . .    24
  128.                Function 20h - Read with no wait (destructive) . . . .    25
  129.                Function 21h - Stuff/Poke the receive buffer . . . . .    25
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.                                                                         iii
  138.  
  139.  
  140.           "Layered Application" services  . . . . . . . . . . . . . .    26
  141.                Function  7Eh  -   Install  an  "external  application"
  142.                     function  . . . . . . . . . . . . . . . . . . . .    26
  143.                Function  7Fh  -   Remove  an  "external   application"
  144.                     function  . . . . . . . . . . . . . . . . . . . .    27
  145.  
  146.           Application Notes . . . . . . . . . . . . . . . . . . . . .    28
  147.                Which Activate/Deactivate functions to use . . . . . .    28
  148.                Watch out for disk I/O . . . . . . . . . . . . . . . .    28
  149.                Successive timer tick calls  . . . . . . . . . . . . .    29
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.                                                                           1
  158.  
  159.  
  160.                                      WHAT IS X00
  161.  
  162.           X00 is  a Serial  Input/Output (SIO) communications  driver.   It
  163.           provides  an interface  between  an application  program and  the
  164.           serial communications hardware.
  165.  
  166.           X00 was originally  designed as a  FOSSIL driver.   FOSSIL is  an
  167.           acronym  containing the first character of several communications
  168.           programs.  The FOSSIL specification  is basically an extension of
  169.           the PC's BIOS services for serial communications.
  170.  
  171.           Except as  noted in the this Manual, X00 meets the FOSSIL level 5
  172.           specification.   X00 provides  additional functions that  are not
  173.           contained in the FOSSIL level 5 specification.
  174.  
  175.           X00 only works with 8250 (TYPE) serial I/O devices.  Such devices
  176.           include the  8250A, 16450, 16550, 16550A  and the 82510.   If you
  177.           have a PC that  is an IBM or near  compatible which has a  serial
  178.           communication  port, it is likely  that it contains  one of these
  179.           devices.  XU, a  utility distributed with X00, will  identify the
  180.           existence of compatible SIO devices.
  181.  
  182.           Like  other Device  Drivers,  X00 will  do  very little  standing
  183.           alone.  There must be an application(s) program to use X00 before
  184.           you will gain benefit.
  185.  
  186.           Since  the introduction  of the  FOSSILs, a  great number  of new
  187.           communications  programs  have come  into existence.   I  like to
  188.           think  that the FOSSILs are  largely responsible for  this.  Many
  189.           programs that contain their own communications drivers have added
  190.           FOSSIL support.  One notable example is RBBS.
  191.  
  192.           Many  programs  written  to   use  BIOS's  serial  communications
  193.           services will also work with X00.   This gives those programs the
  194.           benefits of buffered interrupt driven I/O.
  195.  
  196.           Warranty
  197.  
  198.           There is none.  Use X00 your own risk.
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.                                                                           2
  207.  
  208.  
  209.                                 Licensing Information
  210.  
  211.           Non-Commercial License:
  212.  
  213.           A  non-commercial license  for  use of  X00  is included  in  the
  214.           distribution file called LICENSE.TXT.
  215.  
  216.           I  have received  several unsolicited  checks from users  of X00.
  217.           All  of the checks  have been returned  or uncashed.   To date, I
  218.           have not accepted any payments for X00.  If you feel that  X00 is
  219.           useful  enough that some sort  of payment is  justified then read
  220.           on.
  221.  
  222.           Our  local (public)  High School  desperately needs  funds.   The
  223.           school officials work at keeping the students off the streets and
  224.           away from  drugs.   The local School  Board is unable  to provide
  225.           needed  funds for  non-academic activities.   I suggest  a $10.00
  226.           contribution be sent to:
  227.  
  228.                Woodbridge Senior High School
  229.                3001 Old Bridge Road
  230.                Woodbridge, Virginia, 22192
  231.  
  232.           You  can make the  check payable to  "WSHS, Ballfield Improvement
  233.           Fund".   Please make a  note "X00 contribution"  somewhere on the
  234.           check.
  235.  
  236.           Many of you have used X00 for years.  I believe  $10.00 is easily
  237.           affordable to most X00 users.   Please take the time to sit down,
  238.           make out the check, address the envelope and mail a contribution.
  239.  
  240.           Shareware authors that wish to  distribute X00 with their product
  241.           should contact me.  Permission will usually be granted.
  242.  
  243.           Commercial License:
  244.  
  245.           Commercial Licenses will  be liberally  granted in  return for  a
  246.           donation (usually tax deductible).   Each commercial license will
  247.           be individually granted.  That is, there is no single policy that
  248.           can be stated  here.  Some  generally uniform commercial  license
  249.           policies follow.
  250.  
  251.           1 - X00 is usually licensed by product.
  252.  
  253.           2 - All  commercial licensees of X00 will receive  a special copy
  254.           of X00 that will identify, at boot time, the commercial product.
  255.  
  256.           3 -  I may require a fully licensed, fully featured, copy of your
  257.           product for personal use on multiple computers.
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.                                                                           3
  266.  
  267.           4 - The required  contribution, which is never to  me personally,
  268.           will usually be a one time contribution of $100.00.
  269.  
  270.           5 -  Proof of licensing belongs to you.   That is, I am not going
  271.           to be responsible for keeping records.  I suggest that you keep a
  272.           copy of the donation  check so that you can  send me a copy  if a
  273.           question  arises.    Otherwise  you  may  have  to  make  another
  274.           contribution.
  275.  
  276.           6  - You may  only distribute versions  of X00 that  contain your
  277.           product name in the X00 banner (at boot time).
  278.  
  279.           7 - If you wish  to have the latest version of  X00 automatically
  280.           sent to you with your product name in the X00 banner, then do the
  281.           following:  Send me a check  for $10.00, in advance, along with a
  282.           pre-addressed mailing label.  If you require a 3.5 inch diskette,
  283.           then write "3.5 inch" on the pre-addressed mailing label and send
  284.           $15.00 (instead of  $10.00).   For updates, the  check should  be
  285.           made  out to Raymond  L. Gwinn.   The checks will  be cashed when
  286.           received.  Individuals that wish to receive a mailed  copy of the
  287.           latest X00 version may  also use this  procedure.  Once you  have
  288.           received an  update, you will need  to resend the  update fee and
  289.           pre-addressed mailing  label if  you desire  to receive the  next
  290.           update.
  291.  
  292.           8  -   Your  contribution  check  should   state  "X00  Licensing
  293.           contribution" in the Memo or comment field.
  294.  
  295.           If  you write  me about  a commercial  license, please  include a
  296.           voice phone number.  You may  not receive a response if the voice
  297.           phone number is omitted.  Correspondence should be sent to:
  298.  
  299.                     Raymond L. Gwinn
  300.                     12469 Cavalier Dr.
  301.                     Woodbridge, Va. 22192
  302.  
  303.           Prior to making the special version of X00 available, I  may wait
  304.           for  the check to clear the bank.   If the check bounces, I will,
  305.           most  likely, not give any further  consideration to a commercial
  306.           license.
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.                                                                           4
  315.  
  316.  
  317.                                       Functions
  318.  
  319.           X00  functions are  designed to  be  called by  assembly language
  320.           programs.    Some  rudimentary  High Level  access  routines  are
  321.           provided  in  the  X00  distribution files.    These  rudimentary
  322.           routines are the so called HLLAPI files.
  323.  
  324.           Parameters for all  X00 functions  are passed in  the basic  808x
  325.           registers.    In  most cases  the  results  of  the function  are
  326.           returned  in registers.    If  no  parameter  is  returned  in  a
  327.           register,  X00 will return the register  unchanged except for the
  328.           AX register.   If no information is returned in  the AX register,
  329.           then its contents upon return from a function is undefined.
  330.  
  331.           Many  (most) of the X00 functions require a port number be passed
  332.           in  the DX register.  Port numbers start at 0 (zero).  Port 0 and
  333.           COM1  are normally the same.  However, this relationship must not
  334.           be assumed.  It is possible for the X00 user to re-map the  ports
  335.           on their  systems.  Please  refer to  the Users  Manual for  more
  336.           information.
  337.  
  338.           I  have  noted that  some  application programs  are  calling X00
  339.           functions from  the timer tick.   This should be done  with care.
  340.           If  the X00 DV option is enabled  at load time, X00 could issue a
  341.           DESQview Pause command as a result  of your call.  I am  not sure
  342.           what  the results of this would be, but it points out the type of
  343.           consideration that  should be done before  issuing function calls
  344.           from the timer tick.
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352.                                                                           5
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.  
  361.           Function 00h - Set communications parameters, baud, parity etc.
  362.  
  363.                Input:    AH = 00h
  364.                          AL = Communications parameters (defined below)
  365.                          DX = Port number
  366.  
  367.                Output:   AX = Port status (see function 03h)
  368.  
  369.           This  function is identical to  the IBM PC  BIOS call except that
  370.           110 baud and 150 baud have been replaced by 19200  baud and 38400
  371.           baud respectively.  The high order  3 bits of AL specify the baud
  372.           rate  as  follows:   See functions  1Eh and  1Fh for  an enhanced
  373.           version of this function.
  374.  
  375.                          010 =   300 baud
  376.                          011 =   600  ''
  377.                          100 =  1200  ''
  378.                          101 =  2400  ''
  379.                          110 =  4800  ''
  380.                          111 =  9600  ''
  381.                          000 = 19200  '' (Replaces IBM 110 baud setting)
  382.                          001 = 38400  '' (Replaces IBM 150 baud setting)
  383.  
  384.           The low order 5 of AL specify the following:
  385.  
  386.                Bits 4-3 define parity:       0 0  no parity
  387.                                              1 0  no parity
  388.                                              0 1  odd parity
  389.                                              1 1  even parity
  390.  
  391.                Bit 2 defines stop bits:      0    1 stop bit;
  392.                                              1    1.5 bits for 5-bit codes,
  393.                                                   2 for others
  394.  
  395.                Bits 1-0 character length:    0 0  5 bits
  396.                                              0 1  6 bits
  397.                                              1 0  7 bits
  398.                                              1 1  8 bits
  399.  
  400.  
  401.  
  402.  
  403.  
  404.  
  405.  
  406.                                                                           6
  407.  
  408.  
  409.           Function 01h - Transmit character and wait.
  410.  
  411.                Input:    AH = 01h
  412.                          AL = Character
  413.                          DX = Port number
  414.  
  415.                Output:   AX = Port status (see function 03h)
  416.  
  417.           Upon  entry to this function, AL must contain a character that is
  418.           to be transmitted.   If there is room in the transmit buffer, the
  419.           character  buffered.   Otherwise, this  function will  loop until
  420.           their is  room in the buffer or until  a timeout occurs.  If set,
  421.           the high  order bit of  the returned status indicates  a time out
  422.           occurred.   See function 03h.   At the time of  this writing, the
  423.           timeout is set to 30 seconds.
  424.  
  425.           Note:  X00 executes functions with  the interrupt mask  set as it
  426.           was  when entered.   That is,  if X00  is called  will interrupts
  427.           masked, interrupts will  remain masked during  the processing  of
  428.           the function.  If this function is called with interrupts masked,
  429.           it may never return.
  430.  
  431.           -----------------------------------------------------------------
  432.  
  433.           Function 02h - Get received character with wait.
  434.  
  435.               Receive character with wait
  436.  
  437.                Input:    AH = 02h
  438.                          DX = Port number
  439.  
  440.                Output:   AH = Line status (same AH returned by function 3)
  441.                          AL = Input character
  442.  
  443.           If a  character available  in the  receive buffer, this  function
  444.           returns the next character from the  receive buffer in AL.  If no
  445.           receive character is available, this  function will wait until  a
  446.           character is received or  until a timeout occurs.   If a  timeout
  447.           occurs,  the high order bit of  AH will be set  upon return.  See
  448.           function 03h.   At the time of this writing, the timeout value is
  449.           set to 30 seconds.
  450.  
  451.           Note:  X00 executes functions with  the interrupt mask  set as it
  452.           was when  entered.   That is,  if X00  is called  will interrupts
  453.           masked, interrupts will  remain masked during  the processing  of
  454.           the function.  If this function is called with interrupts masked,
  455.           it may never return.
  456.  
  457.           Function 20h is a get character with no wait.
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.                                                                           7
  466.  
  467.  
  468.  
  469.  
  470.  
  471.  
  472.           Function 03h - Return Serial Port Status.
  473.  
  474.                Input:    AH = 03h
  475.                          DX = Port number
  476.  
  477.                Output:   AX = Status bits as follows:
  478.  
  479.                     AH = Line Status, where:
  480.                          Bit 0 = RDA  - input data is available in buffer
  481.                          Bit 1 = OVRN - the input buffer has been overrun
  482.                          Bit 2 = Reserved (Parity error in BIOS INT 14h)
  483.                          Bit 3 = Reserved (Framing error in BIOS INT 14h)
  484.                          Bit 4 = Reserved (Break detect in BIOS INT 14h)
  485.                          Bit 5 = THRE - room is available in output buffer
  486.                          Bit 6 = TSRE - output buffer is empty
  487.                          Bit 7 = Timeout (set by functions 1 and 2 only)
  488.  
  489.           Bit 7 of AH IS ALWAYS ZERO WHEN RETURNED BY FUNCTION 3.  Bit 7 of
  490.           AH may be  set to one by other functions (like 1 and 2) that also
  491.           return status.  When bit 7 of AH is set to one, none of the other
  492.           15 bits returned in AX are valid.
  493.  
  494.                     AL = Modem status, where:
  495.                          Bit 0 = Delta clear to send (not reliable)
  496.                          Bit 1 = Delta data set ready (not reliable)
  497.                          Bit 2 = Delta data carrier detect (not reliable)
  498.                          Bit 3 = Always set to 1 upon return (DUMMY DCD)
  499.                          Bit 4 = Clear to send (CTS)
  500.                          Bit 5 = Data set ready (DSR)
  501.                          Bit 6 = Ring indicator (RI)
  502.                          Bit 7 = Data carrier detect (DCD)
  503.  
  504.           Bit  3  of AL  is  always  returned  set  to  1.    This  enables
  505.           application programs  to use  bit 3  as a  carrier detect bit  on
  506.           hardwired (null modem) links.
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.                                                                           8
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.           Function 04h - Activate Port.
  524.  
  525.                Input:    AH = 04h
  526.                          DX = port number
  527.  
  528.                Output:   AX = 1954h if successful
  529.                          BL   =  maximum  function  number  supported  (not
  530.                          counting functions 7Eh and above)
  531.                          BH = rev of FOSSIL specification supported
  532.  
  533.           This function instructs X00  to use the FOSSIL specification  for
  534.           the specified port.  Prior to issuing this function, any function
  535.           that  requires a port number  in DX be will  passed on to BIOS or
  536.           X00's  INT 14h BIOS emulator.  When this function  is called, all
  537.           interrupts   involved  in  supporting   the  communications  port
  538.           (specified in DX) are  set up for support by X00.   DTR is turned
  539.           on by this function.  The baud rate is NOT set or changed by this
  540.           function.
  541.  
  542.           If an additional call  to this function occurs (2  Inits or Init,
  543.           Function nn, Init, etc.)  X00 will reset (clear) all  buffers and
  544.           all flow control is turned off.  Values returned in the registers
  545.           upon a re-init are the same as an initial init (defined above).
  546.  
  547.           NOTICE: At a future date (July 1991 or later), the author intends
  548.           to  make  this  function  identical to  the  PS/2's  function  4.
  549.           Function 1Ch is a  duplicate of this function.   New or  modified
  550.           application programs should discontinue  use of this function and
  551.           use the duplicate (1Ch) function.
  552.  
  553.           A section is the  application notes describes a simple  method of
  554.           determining  which Activate/Deactivate  function numbers  to use.
  555.           The described method should work on all FOSSIL implementations.
  556.  
  557.  
  558.  
  559.  
  560.  
  561.  
  562.  
  563.                                                                           9
  564.  
  565.  
  566.  
  567.  
  568.  
  569.  
  570.           Function 05h - Deactivate Port.
  571.  
  572.                Input:    AH = 05h
  573.                          DX = Port number
  574.  
  575.                Output:   Nothing
  576.  
  577.           This function  instructs X00  that it  should  no longer  process
  578.           calls for specified port (in  DX) using the FOSSIL specification.
  579.           If the port was never activated by function 4, then this function
  580.           is ignored.  Any  subsequent function calls, that require  a port
  581.           number  in  DX, will  be  passed  to BIOS  or  the  BIOS INT  14h
  582.           emulator.
  583.  
  584.           NOTICE: At a future date (July 1991 or later), the author intends
  585.           to  make  this  function  identical  to  the  PS/2's  function 5.
  586.           Function 1Dh is  a duplicate of this  function.  New  or modified
  587.           application programs should discontinue use of this function  and
  588.           use the duplicate (1Dh) function.
  589.  
  590.           A section is the  application notes describes a simple  method of
  591.           determining  which Activate/Deactivate  function numbers  to use.
  592.           The described method should work on all FOSSIL implementations.
  593.  
  594.           -----------------------------------------------------------------
  595.  
  596.           Function 06h - Raise/lower DTR.
  597.  
  598.                Input:    AH = 06h
  599.                          AL = DTR state to set
  600.                          DX = Port number
  601.  
  602.                Output:   Nothing
  603.  
  604.           This function is used to control the DTR signal.   AL = 00h means
  605.           lower DTR (turn it off), and AL = 01h means to raise DTR (turn it
  606.           on).  No other function (except functions 04h and 1Ch) will alter
  607.           DTR.
  608.  
  609.  
  610.  
  611.  
  612.  
  613.  
  614.  
  615.                                                                          10
  616.  
  617.  
  618.  
  619.           Function 07h - Return timer tick information.
  620.  
  621.                Input:    AH = 07h
  622.  
  623.                Output:   AL = Timer tick interrupt number
  624.                          AH = Approximate interrupts per second (18 on IBM)
  625.                          DX = Approximate number of milliseconds per tick
  626.  
  627.           This  function  is used  to determine  the characteristic  of the
  628.           timer tick for the computer.
  629.  
  630.           Application  programs  can  use  information  returned  by   this
  631.           function to dynamically  set up  code that is  executed on  every
  632.           timer tick. 
  633.  
  634.           -----------------------------------------------------------------
  635.  
  636.           Function 08h - Flush output buffer.
  637.  
  638.                Input:    AH = 08h
  639.                          DX = Port number
  640.  
  641.                Output:   Nothing
  642.  
  643.           This  function  is  used to  wait  until  any  pending output  is
  644.           transmitted.   It does not  return until all  buffered output has
  645.           been sent.  This function should be used with care.  Flow control
  646.           (documented  below) can  cause your  system hang  in a  tight un-
  647.           interruptable loop given the right circumstances.
  648.  
  649.           Note:  X00 executes functions with  the interrupt mask  set as it
  650.           was when  entered.   That is,  if X00  is called will  interrupts
  651.           masked, interrupts  will remain  masked during the  processing of
  652.           the function.  If this function is called with interrupts masked,
  653.           it may never return.
  654.  
  655.           -----------------------------------------------------------------
  656.  
  657.           Function 09h - Purge output buffer.
  658.  
  659.                Input:    AH = 09h
  660.                          DX = Port number
  661.  
  662.                Output:   Nothing
  663.  
  664.           This function  is used to  remove any buffered  output (transmit)
  665.           data.   Any  output  data remaining  in  the output  buffer  (not
  666.           transmitted yet) is discarded.
  667.  
  668.  
  669.  
  670.  
  671.  
  672.  
  673.  
  674.                                                                          11
  675.  
  676.  
  677.  
  678.  
  679.           Function 0Ah - Purge input buffer.
  680.  
  681.                Input:    AH = 0Ah
  682.                          DX = Port number
  683.  
  684.                Output:   Nothing
  685.  
  686.           This function is  used to  remove any  buffered input  (received)
  687.           data.    Any  input data  which  is  in  the  receive  buffer  is
  688.           discarded.
  689.  
  690.           -----------------------------------------------------------------
  691.  
  692.           Function 0Bh - Transmit no wait.
  693.  
  694.                Input:    AH = 0Bh
  695.                          AL = Character
  696.                          DX = Port number
  697.  
  698.                Output:   AX = 0001h - Character was buffered for xmit
  699.                          AX = 0000h - Character was not buffered
  700.  
  701.           This is exactly  the same as  function 01h, except  that it  will
  702.           always  return immediately.    If X00  is  unable to  buffer  the
  703.           character  (the transmit  buffer is  full), a  value of  0000h is
  704.           returned in AX. If X00 accepts the character (room is available),
  705.           0001h is returned in AX.
  706.  
  707.           -----------------------------------------------------------------
  708.  
  709.           Function 0Ch - Non-destructive read-ahead (Peek).
  710.  
  711.  
  712.                Input:    AH = 0Ch    
  713.                          DX = Port number
  714.  
  715.                Output:   AH = 00h if character is available
  716.                          AL = Next character if available
  717.                          AX = 0FFFFh = If no character is available
  718.  
  719.           This function returns the next character from the receive buffer.
  720.           If the  receive buffer is empty,  0FFFFh is returned in  AX.  The
  721.           character   returned  remains   in  the   receive   buffer.  Some
  722.           programmers call this function "peek".
  723.  
  724.           Function 20h is a destructive read with no wait.
  725.  
  726.  
  727.  
  728.  
  729.  
  730.  
  731.  
  732.                                                                          12
  733.  
  734.  
  735.  
  736.  
  737.  
  738.  
  739.  
  740.  
  741.  
  742.  
  743.  
  744.  
  745.           Function 0Dh - Keyboard read without wait.
  746.  
  747.  
  748.                Input:    AH = 0Dh
  749.  
  750.                Output:   AX = IBM-style scan code if available
  751.                             = 0FFFFh if no character not available
  752.  
  753.           This  function  returns  the  keyboard  scan  code  of  the  next
  754.           character from  the keyboard.   This is a  non-destructive (peek)
  755.           read of  the keyboard.  If no keyboard data is available,  0FFFFh
  756.           is returned in AX.
  757.  
  758.           -----------------------------------------------------------------
  759.  
  760.           Function 0Eh - Keyboard read with wait.
  761.  
  762.                Input:    AH = 0Eh
  763.  
  764.                Output:   AX = Keyboard scan code
  765.  
  766.           This  function  return  the  next character  available  from  the
  767.           keyboard.  If no keyboard input is available, this function waits
  768.           until  a keyboard  character  is available.   Returned  character
  769.           codes are the same as function 0Dh (IBM style scan codes). 
  770.  
  771.  
  772.  
  773.  
  774.  
  775.  
  776.  
  777.                                                                          13
  778.  
  779.  
  780.           Function 0Fh - Flow Control for serial I/O.
  781.  
  782.                Input:    AH = 0Fh
  783.                          AL = Bit defining the flow control to use
  784.                          DX = Port number
  785.  
  786.                Output:   Nothing
  787.  
  788.           Two kinds of basic flow control are supported.  One is  software,
  789.           called  Xon/Xoff  flow control.   The  other is  hardware, called
  790.           RTS/CTS flow  control.  Both  software and hardware  flow control
  791.           may be enabled at the same time.
  792.  
  793.           The bits in the parameter passed in AL are as follows:
  794.  
  795.                          Bit 0 = 1      Enable receiving of Xon/Xoff
  796.                          Bit 1 = 1      Enable RTS/CTS flow control
  797.  
  798.                          Bit 2          Reserved (should be zero)
  799.                          Bit 3 = 1      Enable transmitting of Xon/Xoff
  800.  
  801.           Setting  an appropriate bit to  zero will cause  the flow control
  802.           associated with that bit to be disabled.  
  803.  
  804.           Enabling  the  receiving  of  Xon/Xoff  will  cause  X00  to stop
  805.           transmitting   upon  receiving   an  Xoff.     X00   will  resume
  806.           transmitting when an Xon is received.
  807.  
  808.           Enabling the sending of  Xon/Xoff will cause X00 to send  an Xoff
  809.           when its buffers are 3/4  full.  When the buffers are  emptied to
  810.           1/4 full, X00 will send an Xon.
  811.  
  812.           X00  WILL ALWAYS CEASE  TRANSMITTING WHEN CTS  IS LOWERED (TURNED
  813.           OFF).  TRANSMISSION WILL RESUME WHEN CTS IS RAISED (TURNED ON).
  814.  
  815.           When  RTS/CTS flow control is  enabled, X00 will  drop (turn off)
  816.           RTS when  the receive buffer is  3/4 full.  X00  will raise (turn
  817.           on) RTS  when the  receive buffer empties  to 1/4 full.   RTS/CTS
  818.           flow control is almost  always used by modems that  operate above
  819.           2400  baud.    Some  2400  baud  modems  also  use/allow  RTS/CTS
  820.           handshaking
  821.  
  822.           If the  baud rate is locked  in the command line  that loads X00,
  823.           RTS/CTS  handshaking is  forced.   In this case,  the application
  824.           program can not disable RTS/CTS handshaking.
  825.  
  826.  
  827.  
  828.  
  829.  
  830.  
  831.  
  832.                                                                          14
  833.  
  834.  
  835.  
  836.           Function 10h - Control-C  /  Control-K  checking and  transmitter
  837.                          disable/enable.
  838.  
  839.                Input:    AH = 10h    
  840.                          AL = Control bits (defined below)
  841.                          DX = Port number
  842.  
  843.                Output:   AX = 0001h - A Control-C/K has been received
  844.                             = 0000h - A Control-C/K has not been received
  845.  
  846.           This is  used for BBS operation, primarily.  A bit mask is passed
  847.           in AL with the following flags:
  848.  
  849.                Bit 0     Enable/disable Control-C / Control-K checking
  850.                Bit 1     Disable/enable the transmitter
  851.  
  852.           To enable Control C/K checking set bit 0 = 1, to disable set  bit
  853.           0  = 0.    When checking  is  enabled,  a received  Control-C  or
  854.           Control-K will set  a flag  (internal to X00).   The  Control-C/K
  855.           character will not be stored  in the input buffer.  The  state of
  856.           the  internal Control-C/K flag will  be returned (then reset) the
  857.           next time  this function is  called.   The returned value  may be
  858.           used by the BBS software as it wishes.
  859.  
  860.           The  transmitter disable  (bit 1  =  1) and  Enable (bit  1 =  0)
  861.           function lets the application program to inhibit the transmitter.
  862.  
  863.           The disable of the transmitter is not absolute.  Several internal
  864.           functions can  cause the  transmitter to be  re-enabled, such  as
  865.           receiving an Xon when receiving of Xon/Xoff is enabled.
  866.  
  867.           -----------------------------------------------------------------
  868.  
  869.           Function 11h - Set current cursor location.
  870.  
  871.                Input:    AH = 11h
  872.                          DH = Row (line)
  873.                          DL = Column
  874.  
  875.                Output:   Nothing
  876.  
  877.           This function  is exactly like INT 10h, subfunction 2, on the IBM
  878.           PC.  The  desired cursor location is passed in DX,  row in DH and
  879.           column in DL.  The row and column are relative to zero.  That is,
  880.           the home position on the screen is row 0, column 0.
  881.  
  882.  
  883.  
  884.  
  885.  
  886.  
  887.  
  888.                                                                          15
  889.  
  890.  
  891.  
  892.  
  893.           Function 12h - Read current cursor location.
  894.  
  895.                Input:    AH = 12h
  896.  
  897.                Output:   DH = Row (line)
  898.                          DL = Column
  899.  
  900.           This function  is exactly like INT 10h, subfunction 3, on the IBM
  901.           PC.   The  current  cursor location  (using  the same  coordinate
  902.           system as function 16h) is returned in DX.
  903.  
  904.           -----------------------------------------------------------------
  905.  
  906.           Function 13h - Single character ANSI write to screen.
  907.  
  908.                Input:    AH = 13h
  909.                          AL = Character to display
  910.  
  911.                Output:   Nothing
  912.  
  913.           The character passed in AL is sent displayed on the screen at the
  914.           current cursor location.   ANSI.SYS type processing is performed.
  915.           This routine should  not be used  in such a  way that DOS  output
  916.           (which is not re-entrant)  can not be employed by  X00 to execute
  917.           the function.
  918.  
  919.           -----------------------------------------------------------------
  920.  
  921.           Function 14h - Enable or disable the DCD watchdog.
  922.  
  923.                Input:    AH = 14h
  924.                          AL = 01h - Enable watchdog
  925.                             = 00h - Disable watchdog
  926.                          DX = Port number
  927.  
  928.                Output:   Nothing
  929.  
  930.           This  function enables  and  disables the  monitoring of  carrier
  931.           detect.   When enabled, the state  of the carrier detect (DCD) is
  932.           constantly  monitored  during  timer  tick  processing.    Should
  933.           carrier  detect  be  lost  (turned  off),  the  system  will   be
  934.           re-booted.  Activate/Deactivate etc  have no effect on the  state
  935.           of the DCD watchdog.
  936.  
  937.  
  938.  
  939.  
  940.  
  941.  
  942.  
  943.                                                                          16
  944.  
  945.  
  946.  
  947.           Function 15h - Write character to screen using BIOS.
  948.  
  949.                Input:    AH = 15h
  950.                          AL = Character to display
  951.  
  952.                Output:   Nothing
  953.  
  954.           The character passed in AL is sent to the screen using BIOS-level
  955.           Input/Output routines.   This differs from  function 13h in  that
  956.           DOS I/O will not be used.
  957.  
  958.           -----------------------------------------------------------------
  959.  
  960.           Function 16h - Add or delete a routine from the timer tick chain.
  961.  
  962.                Input:    AH = 16h
  963.                          AL = 01h - Add a function
  964.                             = 00h - Delete a function
  965.                          ES = Segment of function
  966.                          DX = Offset of function
  967.  
  968.                Output:   AX = 0000h - Operation successful
  969.                             = 0FFFFh - Operation unsuccessful
  970.  
  971.           This  function is used to allow a central authority to manage the
  972.           timer interrupts, so that the integrity of the "timer tick chain"
  973.           is  not compromised.  Rather than using the traditional method of
  974.           saving  the old contents of the timer vector, storing the address
  975.           of your routine there, and calling the "old" routine, instead you
  976.           call this function.  X00 manages a list of such  entry points and
  977.           calls them on a timer tick (interrupt) using a FAR call.
  978.  
  979.           X00  will allow  up to  4 programs  to hook  into the  timer tick
  980.           processing.   Interrupts are enabled when the hooked routines are
  981.           called.
  982.  
  983.           CAUTION, when  this FOSSIL function was  implemented, it provided
  984.           the  best  means to  hook into  the  timer tick  on multi-tasking
  985.           systems at that  time.  However,  with the  386 and virtual  8086
  986.           mode  of  operation used  by  DESQview,  Windows V3.0  etc,  this
  987.           function can crash the  system.  The  reason is the virtual  8086
  988.           application (task/window)  that hooked in, may not  be the active
  989.           virtual 8086 (task/window) when the timer tick interrupt occurs.
  990.  
  991.           Due to popularity of the virtual 8086 type multi-tasking systems,
  992.           the  author  (who  originally  insisted  that  this  function  be
  993.           created) RECOMMENDS THAT THIS FUNCTION NOT BE USED.
  994.  
  995.  
  996.  
  997.  
  998.  
  999.  
  1000.  
  1001.                                                                          17
  1002.  
  1003.  
  1004.           Function 17h - Reboot system.
  1005.  
  1006.                Input:    AH = 17h
  1007.                          AL = 00h - "Cold boot"
  1008.                             = 01h - "Warm boot"
  1009.  
  1010.                Output:   Nothing
  1011.  
  1012.           This  function is intended primarily  as a security  feature.  It
  1013.           provides  the  application  with  a  last resort  escape  from  a
  1014.           situation that could allow a security breach.
  1015.  
  1016.           -----------------------------------------------------------------
  1017.  
  1018.           Function 18h - Block Read.
  1019.  
  1020.  
  1021.                Input:    AH = 18h
  1022.                          CX = Requested number of characters to transfer
  1023.                          DX = Port number
  1024.                          ES = Segment of the caller's buffer
  1025.                          DI = Offset of the caller's buffer
  1026.  
  1027.                Output:   AX = Number of characters actually transferred
  1028.  
  1029.           This function will transfer from 0 to 65534 characters from X00's
  1030.           inbound circular  buffer to  the caller's  buffer. ES:DI  are not
  1031.           changed by  this function.   The  number of  bytes placed  in the
  1032.           caller's buffer is  returned in AX.   The  number returned in  AX
  1033.           will be the lesser of the caller's requested amount or the entire
  1034.           contents (if any) of X00's receive buffer.
  1035.  
  1036.           -----------------------------------------------------------------
  1037.  
  1038.           Function 19h - Block Write.
  1039.  
  1040.                Input:    AH = 19h
  1041.                          CX = Requested number of characters to transfer
  1042.                          DX = Port number
  1043.                          ES = Segment of the caller's buffer
  1044.                          DI = Offset of the caller's buffer
  1045.  
  1046.                Output:   AX = Number of characters actually transferred
  1047.  
  1048.           This function will transfer  from 0 to 65534 characters  to X00's
  1049.           outbound  circular  buffer.    ES:DI  are  not  changed  by  this
  1050.           function.  The number of bytes placed in X00's buffer is returned
  1051.           in AX.   The  number returned  in AX  will be  the lesser  of the
  1052.           caller's requested amount or the amount (if any) required to fill
  1053.           X00's transmit buffer.
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.  
  1061.                                                                          18
  1062.  
  1063.  
  1064.  
  1065.  
  1066.  
  1067.  
  1068.  
  1069.  
  1070.  
  1071.  
  1072.  
  1073.  
  1074.  
  1075.           Function 1Ah - Break begin or end.
  1076.  
  1077.                Input:    AH = 1Ah
  1078.                          AL = 01h - Start sending 'break'
  1079.                             = 00h - Stop sending 'break'
  1080.                          DX = port number
  1081.  
  1082.                Output:   Nothing
  1083.  
  1084.           This function will  start or terminate a break signal.  If AL=01h
  1085.           X00 will start the transmission  of a break.  If AL=00h  X00 will
  1086.           terminate  any  break  signal.    This  function  is  useful  for
  1087.           activating command mode on some modems.  The  application program
  1088.           is responsible  for the timing  of the  BREAK.  If  X00 has  been
  1089.           restrained by an Xoff received  from the modem, the flag  will be
  1090.           cleared.   An  Activate or  Deavtivate will  stop an  in-progress
  1091.           BREAK.  
  1092.  
  1093.           It is the  experience of the author that the  duration of a break
  1094.           should be less than 0.1 seconds.
  1095.  
  1096.  
  1097.  
  1098.  
  1099.  
  1100.  
  1101.  
  1102.                                                                          19
  1103.  
  1104.  
  1105.           Function 1Bh - Return information about X00.
  1106.  
  1107.                Input:    AH = 1Bh
  1108.                          CX = Size of caller's info buffer in bytes
  1109.                          DX = Port number
  1110.                          ES = Segment of caller's info buffer
  1111.                          DI = Offset of caller's info buffer
  1112.  
  1113.                Output:   AX = Number of bytes actually transferred
  1114.                          CX = '0X'      First 2 bytes of 'X00 ' string
  1115.                          DX = ' 0'      Second 2 bytes of 'X00 ' string
  1116.  
  1117.           Note  that the  values returned  in CX  and DX  can be  stored in
  1118.           memory to form a  space terminated string 'X00 '.   Additionally,
  1119.           the values returned in CX and DX can be used to  determine if X00
  1120.           is installed.
  1121.  
  1122.           This function will transfer information about X00 and its current
  1123.           status  to the  caller.   This  function  is intended  to  assist
  1124.           "generic" applications to adjust to the current environment.
  1125.  
  1126.           The data structure  (assembly language style)  currently returned
  1127.           by X00 is as follows:
  1128.  
  1129.                INFO      EQU  $              ;DEFINE BEGIN OF STRUCTURE
  1130.                STRSIZ    DW   INFO_SIZE      ;SIZE OF THIS STRUC IN BYTES
  1131.                MAJVER    DB   CURR_FOSSIL    ;FOSSIL SPECIFICATION REV
  1132.                MINVER    DB   CURR_REV       ;REV OF THIS DRIVER.
  1133.                IDENT     DD   ID_STRING      ;"FAR" POINTER TO ASCIIZ
  1134.                                              ; DRIVER DESCRIPTION STRING.
  1135.                IBUFR     DW   IBSIZE         ;BYTE SIZE OF THE INPUT BUFFER
  1136.                IFREE     DW   ?              ;NUMBER OF BUFFERED RECV BYTES
  1137.                OBUFR     DW   OBSIZE         ;BYTE SIZE OF THE XMIT BUFFER
  1138.                OFREE     DW   ?              ;NUMBER OF BUFFERED XMIT BYTES
  1139.                SWIDTH    DB   SCREEN_WIDTH   ;WIDTH OF DISPLAY SCREEN
  1140.                SHEIGHT   DB   SCREEN_HEIGHT  ;HEIGHT OF DISPLAY SCREEN
  1141.                BAUD      DB   ?              ;BAUD RATE, COMPUTER TO MODEM
  1142.  
  1143.           The IDENT  string  is null-terminated,  and  does not  contain  a
  1144.           newline.  The baud rate byte contains  the bits that Function 00h
  1145.           would use to set the port to that speed.
  1146.  
  1147.           The  fields related to a particular port (buffer size, space left
  1148.           in the  buffer, baud rate) will  be undefined if port  0FFh or an
  1149.           invalid port is contained in DX.
  1150.  
  1151.           In some cases  X00 can  not accurately return  information.   For
  1152.           example, the user can  lock the baud rate at  115200 when loading
  1153.           X00.  There is no correct FOSSIL value that X00 can return in the
  1154.           BAUD  field.  X00 will set the  BAUD field equal to the last baud
  1155.           rate that the application attempted to set.
  1156.  
  1157.  
  1158.  
  1159.  
  1160.  
  1161.  
  1162.  
  1163.                                                                          20
  1164.  
  1165.  
  1166.  
  1167.  
  1168.  
  1169.  
  1170.  
  1171.  
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.           Superset Functions.
  1183.  
  1184.           Function  numbers above 1Bh and below 7Eh are X00 only functions.
  1185.           These functions will only  work with X00.  It is  the hope of the
  1186.           author that these functions will be added by other FOSSIL authors
  1187.           in  their  implementations  and  become  a  part  of  the  FOSSIL
  1188.           specification.
  1189.  
  1190.           Functions  1Ch and 1Dh are exact duplicated of FOSSIL functions 4
  1191.           and 5.
  1192.  
  1193.           Functions  1Eh and  1Fh are  intended to  be exact  duplicates of
  1194.           functions 4 and 5 of the PS/2's BIOS INT 14h.
  1195.  
  1196.           Function 20h is a destructive read with no wait.
  1197.  
  1198.           Function 21h is a Stuff/Poke character into the receive buffer.
  1199.  
  1200.  
  1201.  
  1202.  
  1203.  
  1204.  
  1205.  
  1206.                                                                          21
  1207.  
  1208.  
  1209.  
  1210.  
  1211.  
  1212.  
  1213.  
  1214.  
  1215.  
  1216.           Function  1Ch is  a  duplicate of  function 4.   The  function is
  1217.           duplicated so that at a future date, X00 functions 4 and 5 can be
  1218.           made compatible to the PS/2's function 4 and 5.
  1219.  
  1220.           Developers  are encouraged by the author to start using functions
  1221.           1Ch and  1Dh instead of functions  4 and 5.   See the application
  1222.           notes  section  for  instructions   on  a  compatible  method  of
  1223.           determining  if functions 1Ch and  1Dh should be  used instead of
  1224.           functions 4 and 5.
  1225.  
  1226.           Function 1Ch - Activate Port.
  1227.  
  1228.                Input:    AH = 1Ch
  1229.                          DX = port number
  1230.  
  1231.                Output:   AX = 1954h if successful
  1232.                          BL  =  maximum  function  number   supported  (not
  1233.                          counting functions 7Eh and above)
  1234.                          BH = rev of FOSSIL specification supported
  1235.  
  1236.           This function instructs X00  to use the FOSSIL  specification for
  1237.           the specified port.  Prior to issuing this function, any function
  1238.           that requires a port  number in DX will  be passed on to  BIOS or
  1239.           X00's  INT 14h BIOS emulator.  When this function  is called, all
  1240.           interrupts  involved   in  supporting  the   communications  port
  1241.           (specified in DX) are set up for  support by X00.  DTR is  turned
  1242.           on by this function.  The baud rate is NOT set or changed by this
  1243.           function.
  1244.  
  1245.           If an additional call  to this function occurs (2  Inits or Init,
  1246.           Read, Init, etc.) X00 will reset (clear) all buffers and all flow
  1247.           control is turned  off.  Values returned in the  registers upon a
  1248.           re-init are the same as an initial init (defined above).
  1249.  
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.                                                                          22
  1257.  
  1258.  
  1259.  
  1260.  
  1261.  
  1262.  
  1263.  
  1264.  
  1265.  
  1266.  
  1267.  
  1268.  
  1269.  
  1270.           Function  1Dh  is a  duplicate of  function 5.   The  function is
  1271.           duplicated so that at a future date, X00 functions 4 and 5 can be
  1272.           made compatible to the PS/2's functions 4 and 5.
  1273.  
  1274.           Developers  are encouraged by the author to start using functions
  1275.           1Ch and  1Dh instead of functions  4 and 5.   See the application
  1276.           notes  section  for  instructions  on  a  compatible  method   of
  1277.           determining  if functions 1Ch and  1Dh should be  used instead of
  1278.           functions 4 and 5.
  1279.  
  1280.           Function 1Dh - Deactivate Port.
  1281.  
  1282.                Input:    AH = 1Dh
  1283.                          DX = Port number
  1284.  
  1285.                Output:   Nothing
  1286.  
  1287.           This function instructs X00  that it should no longer  to process
  1288.           calls for  specified port (in DX) using the FOSSIL specification.
  1289.           If the port was never activated by function 4, then this function
  1290.           is ignored.  Any  subsequent function calls, that require  a port
  1291.           number  in  DX, will  be  passed  to BIOS  or  the  BIOS INT  14h
  1292.           emulator.
  1293.  
  1294.  
  1295.  
  1296.  
  1297.  
  1298.  
  1299.  
  1300.                                                                          23
  1301.  
  1302.  
  1303.  
  1304.           Function 1Eh - Extended line control initialization.
  1305.  
  1306.           This  function is intended to exactly emulate the PS/2's BIOS INT
  1307.           14 services, function 4.  Some  or all of the functions  provided
  1308.           here are duplicated by other X00 functions.
  1309.  
  1310.                Input:    AH = 1Eh
  1311.  
  1312.                          AL = Break, Where:
  1313.                             = 00h, No break and/or turn off break
  1314.                             = 01h, Start send of break.
  1315.  
  1316.                          BH = Parity, where:
  1317.                             = 00h, No parity
  1318.                             = 01h, Odd parity
  1319.                             = 02h, Even parity
  1320.                             = 03h, Mark parity (always 1)
  1321.                             = 04h, Space parity (always 0)
  1322.  
  1323.                          BL = Stop bits, where:
  1324.                             = 00h, One stop bit
  1325.                             = 01h, Two stop  bits for 6,  7 and 8  bit word
  1326.                                    length, 1  and 1/2  stop bits for  5 bit
  1327.                                    word length.
  1328.  
  1329.                          CH = Word length, where:
  1330.                             = 00h, 5 bits
  1331.                             = 01h, 6 bits
  1332.                             = 02h, 7 bits
  1333.                             = 03h, 8 bits
  1334.  
  1335.                          CL = Baud rate, where:
  1336.                             = 00h, 110 baud
  1337.                             = 01h, 150 baud
  1338.                             = 02h, 300 baud
  1339.                             = 03h, 600 baud
  1340.                             = 04h, 1200 baud
  1341.                             = 05h, 2400 baud
  1342.                             = 06h, 4800 baud
  1343.                             = 07h, 9600 baud
  1344.                             = 08h, 19200 baud
  1345.  
  1346.                          DX = Port number
  1347.  
  1348.                Output:   AX = Port status (see function 03h)
  1349.  
  1350.           If  locked at X00 load  time, the appropriate  parameters of this
  1351.           function are ignored.
  1352.  
  1353.  
  1354.  
  1355.  
  1356.  
  1357.  
  1358.  
  1359.                                                                          24
  1360.  
  1361.  
  1362.  
  1363.  
  1364.           Function 1Fh - Extended serial port status/control.
  1365.  
  1366.           This  function is intended to exactly emulate the PS/2's BIOS INT
  1367.           14 services, function  5.  Some or all of  the functions provided
  1368.           here are duplicated by other X00 functions.   This function has 2
  1369.           subfunctions specified by AL.
  1370.  
  1371.           Subfunction 00h - Read MCR
  1372.  
  1373.                Input:    AH = 1Fh
  1374.                          AL = 00h, Read modem control register (MCR)
  1375.                          DX = Port number
  1376.  
  1377.                Output:   AX = Port status (see function 03h)
  1378.                          BL = Modem control register, where:
  1379.                               Bits 7-5 = 0 (Reserved)
  1380.                               Bit 4    = 1 Loopback mode
  1381.                               Bit 3    = 1 OUT2 (interrupts) enabled
  1382.                               Bit 2    = 1 OUT1 active
  1383.                               Bit 1    = 1 Request to send active
  1384.                               Bit 0    = 1 Data terminal ready (DTR) active
  1385.  
  1386.           Subfunction 01h - Write MCR
  1387.  
  1388.                Input:    AH = 1Fh
  1389.                          AL = 01h, Write modem control register (MCR)
  1390.                          BL = Modem control register, where:
  1391.                               Bits 7-5 = 0 (Reserved)
  1392.                               Bit 4    = 1 Set loopback mode
  1393.                               Bit 3    = 1 Set OUT2 enable interrupts
  1394.                               Bit 2    = 1 Set OUT1 active (on)
  1395.                               Bit 1    = 1 Set Request to send active (on)
  1396.                               Bit 0    = 1 Set DTR active (on)
  1397.                          DX = Port number
  1398.  
  1399.                Output:   AX = Port status (see function 03h)
  1400.  
  1401.           In subfunction 01h (write  MCR) X00 will force bit 3  to 1.  That
  1402.           is,  X00  will not  allow  the  communications interrupts  to  be
  1403.           disabled.
  1404.  
  1405.           RTS may  be used  as a  flow  control signal  by X00.   When  the
  1406.           application program writes the MCR, the  RTS bit is treated as an
  1407.           RTS enable  bit.   This  means  that X00  will always  allow  the
  1408.           application program to turn RTS off.  However, X00 will  not turn
  1409.           on RTS unless it is safe to do so.
  1410.  
  1411.  
  1412.  
  1413.  
  1414.  
  1415.  
  1416.  
  1417.                                                                          25
  1418.  
  1419.  
  1420.  
  1421.           Function 20h - Read with no wait (destructive).
  1422.  
  1423.  
  1424.                Input:    AH = 20h
  1425.                          DX = Port number
  1426.  
  1427.                Output:   AH = 00h if character is available
  1428.                          AL = Next character if available
  1429.                          AX = 0FFFFh If no character is available
  1430.  
  1431.           This function returns the next character from the receive buffer.
  1432.           If the receive buffer is  empty, 0FFFFh is returned in AX.   This
  1433.           function  is the same as  function 0Ch except  that any character
  1434.           returned is removed from the receive buffer.
  1435.  
  1436.           ----------------------------------------------------------------
  1437.  
  1438.           Function 21h - Stuff/Poke the receive buffer.
  1439.  
  1440.  
  1441.                Input:    AH = 20h
  1442.                          AL = Character to place in the receive buffer
  1443.  
  1444.                Output:   Nothing
  1445.  
  1446.           This function will  insert the passed character  into the receive
  1447.           buffer (at the end).  Subsequent reading of the serial input will
  1448.           read the character.  The character is inserted at the  end of the
  1449.           buffer (as though it were just received).
  1450.  
  1451.           The  character is inserted into the receive buffer by calling the
  1452.           receive interrupt  routine.    All  normal  receive  checking  is
  1453.           preformed on the character.  Some things to note are:
  1454.  
  1455.                If  receiving  of  Xon/Xoff  is   enabled  and  an  Xoff  is
  1456.                stuffed/poked  into the  buffer,  the transmitter  will stop
  1457.                until a an Xon is received or stuffed/poked.
  1458.  
  1459.                If  Control C/K  checking is  enabled and  a Control  C/K is
  1460.                stuffed/poked, then the character  is not put in  the buffer
  1461.                and the internal flags is set.
  1462.  
  1463.           The above should give you a little to think about when using this
  1464.           function.
  1465.  
  1466.           This  function  is intended  to be  fully  re-entrant.   Thus, it
  1467.           should be callable from timer tick processing etc.
  1468.  
  1469.  
  1470.  
  1471.  
  1472.  
  1473.  
  1474.  
  1475.                                                                          26
  1476.  
  1477.  
  1478.  
  1479.  
  1480.           "Layered Application" services.
  1481.  
  1482.  
  1483.           The   functions   below  are   provided   to   meet  the   FOSSIL
  1484.           specification.   The following  functions  in effect  make X00  a
  1485.           dispatcher for other programs.
  1486.  
  1487.           To  operate  properly  on   a  multi-port  system,  any  "Layered
  1488.           Application" must be re-entrant.   The only "Layered Application"
  1489.           know  to the  author is  called a  Video FOSSIL.   The  one Video
  1490.           Fossil known to the author is not re-entrant and can  not be used
  1491.           on a multi-port system.
  1492.  
  1493.  
  1494.           Function 7Eh - Install an "external application" function.
  1495.  
  1496.                Input:    AH = 7Eh    
  1497.                          AL = Code assigned to external application
  1498.                          DX = Offset of application entry point
  1499.                          ES = Segment of application entry point
  1500.  
  1501.                Output:   AX = 1954h
  1502.                          BL = Code given to application (same as input AL)
  1503.                          BH = 01h - Installation was successful
  1504.                             = 00h - Installation failed
  1505.  
  1506.           This  function may be used by  external application code (special
  1507.           screen  drivers, modem code, database code, etc) to link into the
  1508.           INT 14h service  for use  by multiple applications.   The  "error
  1509.           return"  (BH=0   with  AX=1954h)   should  mean  that     another
  1510.           application layer  has already been installed  at that particular
  1511.           code. Codes 80h through 0BFh are be supported.  
  1512.  
  1513.           External   application  codes  80h-83h  are  reserved  by  FOSSIL
  1514.           developers  for  re-organizing  FOSSIL  services by  type  (comm,
  1515.           screen, keyboard, system).  
  1516.  
  1517.           Installed  application code will be entered, via a FAR call, from
  1518.           the  INT 14H  dispatcher  whenever  it  is  entered  (with  AH  =
  1519.           application code).
  1520.  
  1521.           If the value returned in AX  from this function is not 1954h, the
  1522.           service code that  is trying to be installed should  bring up its
  1523.           own  INT  14h code  that can  service  INT 14h  functions 7h-0BFh
  1524.           (80h-0BFh are "applications").
  1525.  
  1526.  
  1527.  
  1528.  
  1529.  
  1530.  
  1531.  
  1532.                                                                          27
  1533.  
  1534.  
  1535.  
  1536.  
  1537.  
  1538.  
  1539.  
  1540.  
  1541.  
  1542.  
  1543.  
  1544.  
  1545.  
  1546.  
  1547.  
  1548.  
  1549.           Function 7Fh - Remove an "external application" function.
  1550.  
  1551.                Input:    AH = 7Fh
  1552.                          AL = Code assigned to external application
  1553.                          DX = Offset of application entry point
  1554.                          ES = Segment of application entry point
  1555.  
  1556.                Output:   AX = 1954h
  1557.                          BL = Code given to application (same as input AL)
  1558.                          BH = 01h - Removal was successful
  1559.                             = 00h - Removal failed
  1560.  
  1561.           This  function removes an application's entry from the table.  If
  1562.           an error is returned, this means ES:DX did not match any entry at
  1563.           the  slot described by  AL.  An application  that wants to remove
  1564.           itself from memory  can issue  the 7F function  to remove  itself
  1565.           from  the  table,  then,  if it  is  successful,  un-install.  If
  1566.           installed with an INT  14h dispatcher it may  un-install provided
  1567.           no other application(s) have  been installed on top of  it (using
  1568.           its dispatcher).
  1569.  
  1570.  
  1571.  
  1572.  
  1573.  
  1574.  
  1575.  
  1576.                                                                          28
  1577.  
  1578.  
  1579.                                   Application Notes.
  1580.  
  1581.           Which Activate/Deactivate functions to use
  1582.  
  1583.           It is  the hope of  the author (after  a period of  time) to make
  1584.           X00's  functions 4  and  5 compatible  with  the PS/2's  INT  14h
  1585.           functions  4  and 5.    Currently, X00's  functions 4  and  5 are
  1586.           duplicated at functions 1Ch and 1Dh respectively.  I request that
  1587.           application  programmers start  using  functions 1Ch  and 1Dh  if
  1588.           those  functions are available.   That is, use  functions 1Ch and
  1589.           1Dh instead of functions 4 and 5 respectively.
  1590.  
  1591.           It is relatively simple to determine if the  functions at 1Ch and
  1592.           1Dh are available.   When your  program is ready to  activate X00
  1593.           for a given port, issue function 1Ch.  If 1954h is returned, then
  1594.           the port  is activated.   If 1954h  is not returned,  reissue the
  1595.           request to function 4.  Save the function number actually used to
  1596.           activate the port,  then increment  it by one  to deactivate  the
  1597.           port.
  1598.  
  1599.           Watch out for disk I/O
  1600.  
  1601.           Chris Irwin deserves  credit for discovering and  informing me of
  1602.           the following:  On  some (if not all) IBM/Clones,  interrupts are
  1603.           masked  for a long  period of  time during  DOS disk  I/O.   As a
  1604.           result, data  characters were  being lost  during  receive.   The
  1605.           problem is most noticeable on slower (4.77 meg) systems with 8250
  1606.           or 16450 type SIO chips installed using high speed modems.
  1607.  
  1608.           Remembering  that  all high  speed modems  (that  I know  of) use
  1609.           RTS/CTS  handshaking, I implemented a back door hook in some Beta
  1610.           X00s that  allowed Chris to turn  RTS off prior to  any disk I/O.
  1611.           Turning off  RTS while  a disk  write is  taking place fixed  the
  1612.           problem.   Also, turning off RTS  during disk I/O had  no adverse
  1613.           effect  on the transfer speed due to the modems internal buffers.
  1614.           While RTS is off,  the modem simply buffers the  data internally.
  1615.           When  RTS is  again  turned on,  the  modems internal  buffer  is
  1616.           emptied  because the transfer rate from the modem to the computer
  1617.           is faster than the line receive rate.
  1618.  
  1619.           X00  now has a front door (documented) function (1Fh) that allows
  1620.           application  programs to disable RTS.  Note that X00 function 1Fh
  1621.           is not a FOSSIL function.  I hope that it  will eventually become
  1622.           a FOSSIL function.  X00s function  1Fh is close to a duplicate of
  1623.           the PS/2's BIOS INT 14h, function 5.
  1624.  
  1625.           I strongly suggest that  application programmers consider turning
  1626.           off (disabling) RTS prior to any disk  I/O.  Even if the modem is
  1627.           not  using RTS/CTS handshaking, turning  off RTS will  not do any
  1628.           harm (that I know of).
  1629.  
  1630.  
  1631.  
  1632.  
  1633.  
  1634.  
  1635.  
  1636.                                                                          29
  1637.  
  1638.  
  1639.  
  1640.  
  1641.  
  1642.           Successive timer tick calls
  1643.  
  1644.           In some  environments,  the timer  tick chain  is called  several
  1645.           times in succession with  no delay between the calls.   I believe
  1646.           that one such environment is DESQview.  If a task has been asleep
  1647.           for 10  timer ticks, the timer tick chain will be called 10 times
  1648.           when the task is activated.
  1649.  
  1650.           X00 checks the DWORD at 46Ch.  If the  value at that location has
  1651.           not  changed,  X00  ignores  the  timer  tick.    Any  hooked  in
  1652.           application programs are not called.
  1653.  
  1654.           This  means  that the  timer tick  is  not reliable  for accurate
  1655.           timing.   All programs  (that I  know of)  that alter  the normal
  1656.           timer  tick  processing keeps  the DWORD  at  46Ch (time  of day)
  1657.           updated.  If not, your  time of day will be off.  If  you need to
  1658.           know elapsed  time, do not count  timer ticks.  Use  the DWORD at
  1659.           46Ch to calculate elapsed time.  The value stored in the DWORD at
  1660.           46Ch  is the number of timer ticks  since the computer was booted
  1661.           or the number of timer ticks past midnight.
  1662.  
  1663.  
  1664.  
  1665.  
  1666.  
  1667.  
  1668.  
  1669.                                                                          30
  1670.  
  1671.  
  1672.  
  1673.           Application Notes . . . . . . . . . . . . . . . . . . . . . .  28
  1674.           FOSSIL  . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
  1675.           Function 00h  . . . . . . . . . . . . . . . . . . . . . . . . . 5
  1676.           Function 01h  . . . . . . . . . . . . . . . . . . . . . . . . . 6
  1677.           Function 02h  . . . . . . . . . . . . . . . . . . . . . . . . . 6
  1678.           Function 03h  . . . . . . . . . . . . . . . . . . . . . . . . . 7
  1679.           Function 04h  . . . . . . . . . . . . . . . . . . . . . . . . . 8
  1680.           Function 05h  . . . . . . . . . . . . . . . . . . . . . . . . . 9
  1681.           Function 06h  . . . . . . . . . . . . . . . . . . . . . . . . . 9
  1682.           Function 07h  . . . . . . . . . . . . . . . . . . . . . . . .  10
  1683.           Function 08h  . . . . . . . . . . . . . . . . . . . . . . . .  10
  1684.           Function 09h  . . . . . . . . . . . . . . . . . . . . . . . .  10
  1685.           Function 0Ah  . . . . . . . . . . . . . . . . . . . . . . . .  11
  1686.           Function 0Bh  . . . . . . . . . . . . . . . . . . . . . . . .  11
  1687.           Function 0Ch  . . . . . . . . . . . . . . . . . . . . . . . .  11
  1688.           Function 0Dh  . . . . . . . . . . . . . . . . . . . . . . . .  12
  1689.           Function 0Eh  . . . . . . . . . . . . . . . . . . . . . . . .  12
  1690.           Function 0Fh  . . . . . . . . . . . . . . . . . . . . . . . .  13
  1691.           Function 10h  . . . . . . . . . . . . . . . . . . . . . . . .  14
  1692.           Function 11h  . . . . . . . . . . . . . . . . . . . . . . . .  14
  1693.           Function 12h  . . . . . . . . . . . . . . . . . . . . . . . .  15
  1694.           Function 13h  . . . . . . . . . . . . . . . . . . . . . . . .  15
  1695.           Function 14h  . . . . . . . . . . . . . . . . . . . . . . . .  15
  1696.           Function 15h  . . . . . . . . . . . . . . . . . . . . . . . .  16
  1697.           Function 16h  . . . . . . . . . . . . . . . . . . . . . . . .  16
  1698.           Function 17h  . . . . . . . . . . . . . . . . . . . . . . . .  17
  1699.           Function 18h  . . . . . . . . . . . . . . . . . . . . . . . .  17
  1700.           Function 19h  . . . . . . . . . . . . . . . . . . . . . . . .  17
  1701.           Function 1Ah  . . . . . . . . . . . . . . . . . . . . . . . .  18
  1702.           Function 1Bh  . . . . . . . . . . . . . . . . . . . . . . . .  19
  1703.           Function 1Ch  . . . . . . . . . . . . . . . . . . . . . . . .  21
  1704.           Function 1Dh  . . . . . . . . . . . . . . . . . . . . . . . .  22
  1705.           Function 1Eh  . . . . . . . . . . . . . . . . . . . . . . . .  23
  1706.           Function 1Fh  . . . . . . . . . . . . . . . . . . . . . . . .  24
  1707.           Function 20h  . . . . . . . . . . . . . . . . . . . . . . . .  25
  1708.           Function 21h  . . . . . . . . . . . . . . . . . . . . . . . .  25
  1709.           Function 7Eh  . . . . . . . . . . . . . . . . . . . . . . . .  26
  1710.           Function 7Fh  . . . . . . . . . . . . . . . . . . . . . . . .  27
  1711.           Licensing Information . . . . . . . . . . . . . . . . . . . . . 2
  1712.                Commercial License . . . . . . . . . . . . . . . . . . . . 2
  1713.                Non-Commercial License . . . . . . . . . . . . . . . . . . 2
  1714.           RTS/CTS flow control  . . . . . . . . . . . . . . . . . . . .  13
  1715.           SIO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
  1716.           Warranty  . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
  1717.           WHAT IS X00 . . . . . . . . . . . . . . . . . . . . . . . . . . 1
  1718.           Xon/Xoff flow control . . . . . . . . . . . . . . . . . . . .  13
  1719.