home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS 1992 June / SIMTEL_0692.cdr / msdos / sysutl / superv22.arc / SUPER.DOC < prev    next >
Encoding:
Text File  |  1986-12-18  |  21.2 KB  |  551 lines

  1.                 SUPERCOM resident Int 14 driver
  2.                            Version 2.0
  3.                     (C) Copyright 1986, 1987
  4.                           Doctor Debug
  5.                          Pittsburgh, Pa
  6.                        All Rights Reserved
  7.  
  8.          As  with all the Doctor's software,  SUPERCOM    
  9.          has  been tested and by all indications  works as 
  10.          described under all reasonable  conditions. 
  11.          However, the good doctor cannot be responsible 
  12.          for damages,  heartbreak,  outbreaks of war or 
  13.          acts  of  God  caused  by  the  use  of   this 
  14.          software.    As it   is Shareware, distribution  
  15.          of this package is  encouraged  so long  as  the 
  16.          programs  and  documentation  are   unaltered. 
  17.          Please  read  the contribution information  at       
  18.          the end of this document.
  19.  
  20.  
  21.      This document will give the command syntax and function 
  22. descriptions for SUPERCOM version 2.0. It will also highlight the 
  23. differences between Version 1 and Version 2.
  24.  
  25. WHAT IS SUPERCOM AND WHAT IS IT DOING ON  MY COMPUTER?
  26.  
  27. SUPERCOM is a replacement for the normal BIOS interrupt 14, which 
  28. handles asynchronous communications.  The support through BIOS is 
  29. so pitifully inadequate that it is almost impossible to write 
  30. secure, reliable communications software using the four functions 
  31. they give you. SUPERCOM gives you 16 useful functions and a 
  32. variable length receive buffer. It has been designed with 
  33. interface to high level languages in mind, and in fact includes 
  34. Turbo Pascal procedures to utilize all of SUPERCOM's functions.
  35.  
  36. HOW DO I RUN SUPERCOM?
  37.  
  38. SUPER.COM must be run before any applications program can use it, 
  39. for it attaches itself to BIOS.
  40. .pa
  41. COMMAND SYNTAX:
  42.           SUPER [/I] [/Cnn] [/X]
  43. WHERE:
  44.           /I indicates that SUPERCOM is to function in Interrupt 
  45.           Mode. The default is Polling Mode, which was the only 
  46.           method available in version 1. (See below for a 
  47.           description of these modes).
  48.          
  49.           /Cnn sets the size, in K,  of SUPERCOM's receive 
  50.           buffer. (Default = 4K). SuperCom will accept anything 
  51.           from 1 to 99, but buffer sizes above 60K will cause 
  52.           unpredictable results.
  53.  
  54.           /X enables XON/XOFF processing. If SUPERCOM receives an 
  55.           XOFF (^S) over the active COM port, all transmits are 
  56.           suspended until an XON (^Q) is received. This is an 
  57.           extremely useful device as well as an extremely 
  58.           dangerous one. If no XON is received, your system is 
  59.           hung. Typing an Alt Q from the keyboard will clear this 
  60.           condition. NOTE: The XON and XOFF characters are not 
  61.           placed in the receive buffer.
  62.  
  63.     Note that simply typing SUPER and pressing Enter will load 
  64. SUPERCOM in exactly the same configuration as Version 1.
  65.  
  66.      You will be given a message which indicates that SUPERCOM is 
  67. loaded and your system prompt will return. At this point your 
  68. computer will behave entirely normal. It is like a big car with a 
  69. Turbocharger in it - the extra power isn't used until you 
  70. activate it. 
  71.            
  72.      You activate SUPERCOM and utilize its many features via 
  73. normal INT 14 calls. Below is a lit of the functions available 
  74. and what they do.
  75.  
  76. Function 0 - Set Communications Parameters
  77.      Entry:    AH = 0
  78.                AL = Initialization parameters
  79.                     (Same as original INT 14)
  80.  
  81.      Return:   Status returned in AX 
  82.  
  83.      Notes:    This works exactly like the old INT 14 function 0, 
  84.                and in fact is called by SUPERCOM function 12. Do 
  85.                not use this function to initialize the port; use 
  86.                function 12. However, if you wish to change the 
  87.                line parameters (baud rate, parity, etc) after the 
  88.                SUPERCOM port has been opened, use this function 
  89.                to prevent disconnection.
  90. .pa               
  91. Function 1 - Send Character 
  92.      Entry:    AH = 1
  93.                AL = Character to Send
  94.               
  95.      Return:   High bit of AL set if error occurred
  96.  
  97.      Notes:    There is no fundamental difference between this 
  98.                function and the original INT 14 Function 1.
  99.  
  100.     
  101. Function 2 - Receive Character
  102.      Entry:    AH = 2
  103.      
  104.      Return:   AL has character.
  105.                AH is zero unless error occurred.
  106.      
  107.      Notes:    This will timeout after about 6 seconds.
  108.  
  109. Function 3 -   Port Status
  110.      Entry:    AH = 3
  111.  
  112.      Return:   Status returns in AH and AL as in old INT 14.
  113.  
  114. Function 4 -   Clear Buffer
  115.      Entry:    AH = 4
  116.  
  117.      Return:   None
  118.      
  119.      Note:     Empties the receive buffer.
  120.  
  121. Function 5 - Block Receive
  122.      Entry:    AH = 5
  123.                DX = Port (0 or 1)
  124.                CX = Size of desired block
  125.                ES:BX  = address for data
  126.      
  127.      Return:   Specified number of characters placed in [ES:BX]
  128.                AH nonzero if error occurred.
  129.  
  130.      Note:     Will time out as in Function 2. The Checksum 
  131.                calculation (formerly returned in CX) is no longer 
  132.                supported.
  133.  
  134. Function 6 -   Block Send
  135.      Entry:    DX = port (0 or 1)
  136.                CX = size of block
  137.                ES:BX = Address of data to send
  138.                
  139.      Return:   AX will have status codes
  140. .pa
  141. Function 7 -   Buffer status
  142.      Entry:    AH = 7
  143.      
  144.      Return:   BX = number of characters waiting in receive 
  145.                buffer
  146.  
  147. Function 8 - Get Character
  148.      Entry:    AH = 8
  149.                DX = Port (0 or 1)
  150.  
  151.      Return:   If character is available in buffer, it is 
  152.                returned in AL. If no characters are waiting, AL 
  153.                returns as 0 (nul). 
  154.  
  155.      Note:     Character is removed from the receive buffer. If 
  156.                there is a chance there will be nuls in the 
  157.                receive data, use function 7 to determine whether 
  158.                a character is available. This is the equivalent 
  159.                of INKEY$ for the Com port.
  160.  
  161. Function 9 - Set Port
  162.      Entry:    AH = 9
  163.                DX = Port (0 or 1) to buffer
  164.  
  165.      Return:   none
  166.  
  167.      Note:     Use this to switch ports in mid-stream. Use 
  168.                Function 12 to set the port initially.
  169.  
  170. Function 10 (0AH) - Enable/Disable SUPERCOM
  171.      Entry:    AH = 0A
  172.      
  173.      Return:   None
  174.  
  175.      Note:     Used internally - use Functions 12 and 13 to 
  176.                accomplish this function. This function toggles 
  177.                whether SUPERCOM is active or inactive. If 
  178.                inactive, all INT14 calls go to original BIOS 
  179.                interrupt.
  180.  
  181. Function 11 (0BH) - SUPERCOM Active Status
  182.      Entry:    AH = 0B
  183.     
  184.      Return:   AH = 1 if SUPERCOM Active
  185.                AH = 0 if SUPERCOM Inactive (passing calls to 
  186.                BIOS)
  187.  
  188.      Note:     Again, mainly for internal use, but if you need a 
  189.                quick check use this.
  190. .pa
  191. Function 12 (0CH) - Open SUPERCOM port
  192.      Entry:    AH = 0C
  193.                AL = Initialization Parameters (as in Function 0)
  194.                DX = Port (0 or 1)
  195.  
  196.      Return:   AX will have status codes
  197.  
  198.      Notes:    This is how you activate SUPERCOM and enable all 
  199.                the features. If you need to change some line 
  200.                parameters (baud rate, parity, etc.) while the 
  201.                SUPERCOM port is open, use Function 0.
  202.  
  203. Function 13 (0DH) - Close SUPERCOM port
  204.      Entry:    AH = 0DH
  205.                DX = Port (0 or 1)
  206.      
  207.      Return:   None
  208.  
  209.      Notes:    This disables buffering of incoming characters and 
  210. removes either the timer interrupt or the Comm interrupt from the 
  211. system interrupt chain. Be sure your program performs a Close 
  212. before exiting, especially if you are using Receive Polling.
  213.  
  214. Function 14 (0EH) - Peek Buffer
  215.      Entry:    AH = 0E
  216.  
  217.      Return:   If a character is available in the buffer it is 
  218.                returned in AL, but IS NOT removed from the 
  219.                buffer. If no character is available, AL returns 
  220.                as a nul.
  221.  
  222.      Note:     This allows you to look ahead at the next 
  223.                character and decide what to do before removing 
  224.                that character from the buffer.
  225.  
  226. Function 15 (0FH) - Hello            (*NEW*)
  227.      Entry:    AH = 0F
  228.      
  229.      Return:   AX = 0AAAH
  230.  
  231.      Note:     Why? If 0AAA doesn't come back, SUPERCOM isn't 
  232.                loaded. Handy to prevent sudden departures for the 
  233.                Twilight Zone.
  234. .pa
  235. Function 16 (10H) - Kill SUPERCOM     (*NEW*)
  236.      Entry:    AH = 10
  237.                
  238.      Return:   None
  239.  
  240.      Note:     This is the equivalent of Close Port (Function 13) 
  241.                with a twist. Not only is the port closed, 
  242.                SUPERCOM is removed entirely from the interrupt 
  243.                chain and the memory which was used is deallocated 
  244.                (returned to DOS). This function is ONLY for use 
  245.                if SUPERCOM is loaded by the application (as 
  246.                opposed to being loaded before the application) 
  247.                and no other resident programs were loaded after 
  248.                it. Improper use of this function will wear out 
  249.                your on/off switch. (The technique of post-loading 
  250.                is discussed below). If used properly, this 
  251.                function will make the system as it was before 
  252.                SUPERCOM was loaded.
  253.  
  254.  
  255. GENERAL NOTES:
  256.      I have attempted to keep with the general philosophy of the 
  257. other BIOS interrupts, thus error returns and such will be in 
  258. line with the original INT 14 and the other interrupts. The 
  259. buffering is done much like the BIOS keyboard interrupt does it. 
  260.  
  261.      SUPERCOM  returns error codes in AH and AL (unless they are 
  262. returning other information).  These error codes will be the same 
  263. as  those returned by the standard Input/Output routines  of  the 
  264. old Interrupt 14. 
  265.  
  266.      All this is pretty complicated, which is why I have included 
  267. the file SUPERCOM.PAS, which contains turbo Pascal routines which 
  268. access  these functions.  DUMBTERM.PAS is a demonstration program 
  269. which  is  essentially a plain vanilla  comm  program.  Examining 
  270. these  programs  will  provide some insight  into  how  SUPERCOM 
  271. works. Be sure to compile any Turbo programs using SUPERCOM to a 
  272. .COM file before using!  DUMBTERM.COM has been included for those 
  273. out  there  without  a Turbo Pascal Compiler.  Also  included  is 
  274. DUMB.ASM  and DUMB.COM,  which are essentially the same thing  as 
  275. DUMBTERM.PAS only in 8086 assembler.
  276.  
  277. .pa
  278. ADVANCED TOPICS I - WHATS WITH THE /I?
  279.  
  280.      There are two methods fpr SUPERCOM to detect and buffer 
  281. incoming characters. The default method, and the one used 
  282. exclusively in version 1, I call Receive Polling. Instead of 
  283. relying on the system interrupt structure to notify SUPERCOM of 
  284. an incoming character, SUPERCOM itself checks for incoming 
  285. characters at a rate of almost 5000 times per second (plenty fast 
  286. for 9600 baud, and even fast enough for 19.2). This single 
  287. technique (which is used in no other package that I am aware of) 
  288. accounts for the high reliability of SUPERCOM. Alas, this also 
  289. accounts for nearly all the problems users have had with 
  290. SUPERCOM. This method can cause problems in the following ways:
  291.  
  292.      1) If the SUPERCOM port is not closed before a return to the 
  293.         operating system, the system will behave very 
  294.         unpredictably. Some PCs have been known to spout Poe and 
  295.         Longfellow when this happens; others just break down and 
  296.         start crying from the tension. Make damn sure there is no 
  297.         way short of re-booting that the user can end the program 
  298.         without a ClosePort.
  299.  
  300.      2) Non-standard hardware such as screen blankers and turbo 
  301.         boards can cause compatibility problems. 
  302.  
  303.      3) Not quite IBM compatible systems can also see 
  304.         compatibility problems as well as psychological trauma.
  305.  
  306.      If SUPERCOM will run in default mode without problems, I 
  307. suggest that you let it run that way. It is so much more reliable 
  308. and less prone to character drops that it is indeed worth the 
  309. precautions.
  310.  
  311.      If however you wish to trade gee-whiz for same-old-stuff run 
  312. SUPER with the /I switch. This enables Receive Interrupt mode 
  313. which sets up the interrupt structure as described above. It will 
  314. work fine except you will find 9600 baud communications strained 
  315. to the limit if you are on a network or have a bunch of memory 
  316. resident time wasters loaded. It will not mess with the system 
  317. clock or interval timer. 
  318.  
  319. ADVANCED TOPICS II - HOW DO I POST_LOAD SUPERCOM?
  320.  
  321.      SUPERCOM was designed to be a resident program which could 
  322. be placed in an AUTOEXEC.BAT file and thus be Pre-Loaded. There 
  323. has been great public outcry (from at least 3 people) for a 
  324. method of allowing an application to load SUPERCOM, use the 
  325. functions, and then remove SUPERCOM when the program was 
  326. finished. This version of SUPERCOM will allow you to do this, but 
  327. please follow the steps outlined below and be very careful. This 
  328. procedure has been tested and works well.
  329.  
  330.      1) Your application program must load SUPER.COM with the DOS 
  331.         EXEC function call. If you are using a high level 
  332.         language such as Compiled Basic which cannot do this 
  333.         sorry, you cannot post-load SUPERCOM.      
  334.  
  335.      2) When control passes back to your application, you will 
  336.         have full use of SUPERCOM's features. You must not load 
  337.         any other programs during this time. SUPERCOM will be 
  338.         sitting in memory above your application and will be 
  339.         perfectly safe until you harass it. 
  340.  
  341.      3) When the communications are finished, execute SUPERCOM 
  342.         function 16 to Kill SUPERCOM and remove all vestiges of 
  343.         it from DOS's knowledge. 
  344.      
  345.      It is recommended that you keep SUPERCOM post-loaded for 
  346. only as long as you need it. There is no danger or penalty from 
  347. doing multiple loads and kills of SUPERCOM as long as it is done 
  348. in the above manner.
  349.  
  350.      Another drawback is that your compiler or system gets to 
  351. muck about with the system timers, etc. before SUPERCOM gets 
  352. there, therefore you may have to use the Receive Interrupt mode 
  353. when postloading. The only way to know is to try it. If SUPERCOM 
  354. drops characters by the handful in Receive Polling mode, you will 
  355. have to use the /I when loading SUPERCOM.
  356.  
  357.      I have included the Turbo Pascal source file POSTLOAD.PAS to 
  358. demonstrate how to use this feature.
  359. .pa
  360.       ADVANCED TOPICS III - SUPERCOM Pascal Routines
  361.  
  362.      The routines discussed below are found in the file 
  363. SuperCom.Pas. Please reference that file for more 
  364. information.
  365.  
  366.      These routines are meant to be called by user 
  367. programs. The SUPER.COM Interrupt 14 driver must have been 
  368. installed to use any of these routines. Use of these 
  369. routines without proper installation of SUPER.COM will 
  370. produce unpredictable results. It should be relatively 
  371. simple to translate these turbo routines into C or most 
  372. any other language.
  373.  
  374.      The integers InError and OutError will always contain 
  375. the error conditions after every receive or transmit. The 
  376. bits of these values are defined as:
  377.  
  378.      Bit 7 (128)        Timeout
  379.      Bit 3   (8)        Framing Error
  380.      Bit 2   (4)        Parity Error
  381.      Bit 1   (2)        Overrun Error
  382.  
  383. If the value of InError[port] is 0, then you can be sure that the
  384. last character was received without error.
  385.  
  386. The value or Port is always 1 or 2.
  387.  
  388.      Procedure InitPort(port,Baud,Parity,data_bits,stop_bits)
  389.           Baud: integer 300-9600
  390.           Parity: char, E(ven),O(dd),N(one)
  391.           Data_bits: integer, 7 or 8
  392.           Stop_bits: integer, 1 or 2
  393.  
  394.           This routine initializes the communications port
  395.           to the parameters specified and activates SUPERCOM
  396.           for that port. All of the following functions will
  397.           use the port specified here.
  398. .pa
  399.      Function PortStatus(port)
  400.  
  401.           This function returns the line status and modem control
  402.           status of the comm port specified. The bits returned are
  403.           defined as:
  404.  
  405.           Bit 15 (negative)  Time out (no device connected)
  406.           Bit 14 (16384)     Transmission shift register empty
  407.           Bit 13 (8192)      Transmission holding register empty
  408.           Bit 12 (4096)      Break detect
  409.           Bit 11 (2048)      Framing error
  410.           Bit 10 (1024)      Parity error
  411.           Bit 9  (512)       Overrun error
  412.           Bit 8  (256)       Data ready
  413.           Bit 7  (128)       Received line signal detect
  414.           Bit 6  (64)        Ring indicator
  415.           Bit 5  (32)        Data set ready
  416.           Bit 4  (16)        Clear to send
  417.           Bit 3  (8)         Delta receive line signal detect
  418.           Bit 2  (4)         Trailing edge ring detector
  419.           Bit 1  (2)         Delta data set ready
  420.           Bit 0  (1)         Delta clear to send
  421.  
  422.      Procedure XmitCh(ch)
  423.  
  424.           This Procedure sends the character in ch out the port
  425.           specified.
  426.  
  427.      Procedure XmitBlk(string)
  428.  
  429.           This procedure sends the entire string out the comm port.
  430.  
  431.      Procedure XmitLn(string)
  432.  
  433.           This is identical to XmitBlk, but adds a CR/LF to the
  434.           end of the block.
  435.  
  436.       Procedure RecCh(ch)
  437.  
  438.           This procedure waits until a character is available over
  439.           the comm line and then returns it in ch. If the system times
  440.           out ch will contain a nul (Ascii 0).
  441.  
  442.      Procedure RecLn(string)
  443.  
  444.           This is the equivalent of ReadLn over the comm port.
  445.           Be sure to check the InError variable to make sure the
  446.           operation did not time out (no CR was received.)
  447. .pa
  448.      Procedure RecBlk(number,String)
  449.  
  450.           The number of characters specified by number will be
  451.           placed into the string. Be sure to check the InError
  452.           variable to assure that the operation did not time out
  453.           before sufficient characters were received.
  454.  
  455.      Procedure GrabCh(ch)
  456.  
  457.           If a character is waiting in the receive buffer it will
  458.           be returned in ch otherwise ch will contain a nul character.
  459.  
  460.      Procedure PeekBuff(ch)
  461.  
  462.           Identical to GrabCh but the character is not removed
  463.           from the buffer.
  464.  
  465.      Procedure ClearBuff
  466.  
  467.           Empties the receive buffer
  468.  
  469.      Procedure ClosePort
  470.  
  471.           Closes the comm port and deactivates SUPERCOM until the
  472.           next InitPort.
  473.  
  474.      Function Rlen
  475.  
  476.           Returns the number of characters currently available in the
  477.           receive buffer.
  478.  
  479.      Function SupercomPresent
  480.      
  481.           Returns true if SUPERCOM has been loaded, false 
  482.           otherwise.
  483.  
  484.      Procedure KillPort
  485.  
  486.           Closes the comm port and removes SUPERCOM 
  487.           completely. Use this function only if you have 
  488.           performed a post-load.
  489.      
  490. .pa
  491.                              Summary
  492.          (How to use SUPERCOM in a few semi-easy steps)
  493.  
  494. 1)  Make  sure that SUPER.COM has been run so that  SUPERCOM  is 
  495. resident. It is very difficult for software to work properly when 
  496. in is not in the computer's memory.
  497.  
  498. 2)   Your program should first issue an Interrupt 14 with AH  set 
  499. to 12 (opens the port with SUPERCOM) and the other registers set 
  500. as  in the old BIOS Interrupt 14 Function 0.  This  assures  that 
  501. SUPERCOM is humming away,  busily checking comm activity on  the 
  502. port specified.
  503.  
  504. 3)    Now  you can use the SUPERCOM functions to input  or  
  505. output all the happy data over that comm port. 
  506. .pa
  507. 4)   Before exiting the program,  issue an Interrupt 14 
  508. with AH set to  13 (close SUPERCOM port).  This assures 
  509. that all is back  to normal for any programs which you run 
  510. later. (If you have performed a Post-Load, use function 
  511. 16 instead of 13 to remove SUPER.COM from memory).
  512.  
  513.                   *** THE COMMERCIAL ***
  514.  
  515.      A great deal of time and effort has gone into the writing of 
  516. this program, so if you find it useful, please send a 
  517. contribution of $25.00 (yes its gone up) or whatever you feel it 
  518. is worth to:
  519.                Steel City Software
  520.                1 Windsor Road B-6 
  521.                Pittsburgh, PA  15239
  522.  
  523.      If you are going to use SUPERCOM in your own program which 
  524. you intend to market, this $25.00 is NOT optional, and if you do 
  525. not pay it, the spirit of disk crashes and chip burnouts will 
  526. follow you for the rest of your days. Aside from this, paying the 
  527. fee will make sure that you will be notified of product 
  528. enhancements, and also any new shareware products being 
  529. distributed by Steel City Software.
  530.  
  531.      Oh yes, a brief mention in the documentation of your 
  532. product wouldn't hurt either.
  533.  
  534.      The source code for SUPER.COM is available for 
  535. $40.00. It contains a wealth of information about 
  536. communications, interrupts, and the 8088 in general and is 
  537. well worth the expenditure.
  538.  
  539.      You can contact the doctor at either of the following 
  540. two BBS's:
  541.  
  542.      NeverBoard Fido     (412) 733-4842
  543.      SoundingBoard Fido  (412) 681-9464
  544.  
  545.      The doctor checks these board daily, so you will get a 
  546. prompt reply to comments, complaints, and suggestions. The 
  547. most current version of the Doctor's software can be found 
  548. on these boards at all times.
  549.  
  550.  
  551.