MANUAL FOR COMSW ~~~~~~~~~~~~~~~~ (version 0.4a, release date 28 Aug 1993) What is ComSw? ~~~~~~~~~~~~~ A DOS utility program which can do three things: Report on the settings of the Com ports. Alter the settings of the Com ports. Act as a simple terminal, mainly intended for debug of some com problems. Computer hardware required ~~~~~~~~~~~~~~~~~~~~~~~~~~ IBM compatable, DOS 3 or greater, 8088 or greater, standard serial ports only, for the monitor function a colour text monitor is recommended. How to use ComSw to report on the status of the ports. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Simply run the program without command line parameters. At the DOS prompt just type (without the quotes): 'comsw' The output of the program can, by using DOS, be redirected to a file or device and here are examples: to file comsw > myfile.rpt append to file comsw >> myfile.rpt to device prn comsw > prn to device lpt1 comsw > lpt1 And so on. This is what the status output looks like and an explanation follows. ADR DOS IRQ_E BAUD BPS FIFO_ON LOOP DTR RTS CTS DSR RI DCD COM1: 3F8H 3F8H 4 0 2400 8N1 NO - 0 0 0 0 0 0 0 COM2: 2F8H 2F8H 3 1 1200 7N1 NO - 0 1 1 0 0 0 0 COM3: 3E8H 3E8H 4 0 2400 8N1 YES 0 0 0 0 0 0 0 0 COM4: 2E8H 2E8H 3 0 2400 8N1 NO - 0 0 0 0 0 0 0 legend: 1=on 0=off -=n/a dtr/rts are outputs, cts..dcd are inputs for help invoke: comsw h ADR ~~~ These are the standard I/O address for the com port. ComSw makes no attempt to handle non-standard addresses. It looks at whatever device is at this address and reports what it finds. The addresses cannot be altered. DOS ~~~ Normally this I/O address will match the setting shown under ADR but DOS maintains a table in RAM of where it has found com ports. There are programs which attempt to hide a port from DOS and if this has been done or no com port was found by DOS on cold boot this field will be shown as 0H. ComSw flag 'T' can hide or unhide this field and it ignores what DOS says anyway. Invokation to hide com3: comsw /3t0 to unhide com1: comsw /1t1 IRQ ~~~ This is the hardware interrupt number. ComSw assumes standard IRQ numbers and if non standard ones are in use it will cause the program no problems. Attempting to auto-detect the true numbers would be very difficult and has not been attempted. Note: if as in the example shown there are more than two ports, then as standard the interrupt lines will have to be shared and this CANNOT be done without special software (comms programs etc.) This can cause all sorts of bizarre operational bugs in comms software. E ~ This is the ENABLE for the UART IRQ hardware interrupt line. As explained under IRQ you must not attempt to share IRQs. ComSw can enable or disable this connection. Invokation to disable com3: comsw /3e0 to enable com1: comsw /1e1 If you have a mouse on com1 and a modem on com3 you will probably find that a comms program for the modem won't work. This might be fixable by disabling com1 and enabling com3 before running the comm program. Unfortunately some of these programs will promptly undo the settings. You may find that shelling to DOS from within the comm program and running comsw will then make things work. Telix is like this. (that is not a criticism of Telix) BAUD ~~~~ This should be obvious. ComSw will allow setting of any possible integer (whole number) baud rate. The PC UART can manage between 2 and 115200. Invokation to set the baud rate of both com1 and com2 : ComSw /2b9600 /1b110 BPS ~~~ B is the number of data bits used for the serial link, valid numbers are 5 to 8 but only 7 or 8 are generally useful. ComSw /4w7 P is the parity setting for the serial link, ComSw only handles None, Even and Odd. Stick parity has not been implemented. n is None, e is Even, o is Odd ComSw /2pe S is the number of stop bits used for the serial link, either one or two. ComSw /3s1 The following example sets lot's of things on com2: comsw /2s2w7pnb19200 FIFO ~~~~ Some computers are fitted with an advanced type of UART and ComSw will say whether one is fitted. It is sometimes refered to as a 16550 ON This will be marked if a FIFO is present and enabled. ComSw does _not_ test the FIFO. (this is mentioned because there are chips of this type which are defective by design). To test for these defects use a FIFO test program. Invokation to turn on a FIFO: ComSw /3f1 LOOP ~~~~ The UART has internal logic which can be used to test the UART or a comms program. This is called loopback and connects the UART output directly to it's input, CTS to RTS and DTR to DSR. You can experiment with this using the monitor facility mentioned later. Invokation loopback on: ComSw /1l1 and all off: ComSw /1l0 /2L0 /3L0 /4l0 (that's an 'L') DTR ~~~ DTR (Data Terminal Ready) is an output from the UART to other equipment and is normally used to tell other equipment that the computer is switched on and ready for work. It is usually controlled by comms software. Invokations: ComSw /1d1 ComSw /3d0 RTS ~~~ RTS (Request To Send) is an output from the UART to other equipment. It is normally used as handshaking between the computer and eg. modem and is controlled by the comms software. Invokation: ComSw /1r1 ComSw /1r0 CTS ~~~ CTS (Clear To Send) is an input to the UART from other equipment. ComSw just shows the status of the control line. DSR ~~~ DSR (Data Set Ready) is an input to the UART from other equipment. ComSw just shows the status of the control line. The word 'dataset' is a name given to a modem or other equipment of that sort. It has the same meaning as DTR (see above) but in the opposite context. RI ~~ RI (Ring Indicator) is an input to the UART from other equipment. ComSw just shows the status of the control line. This line normally waggles when a modem 'hears' the phone ring. DCD ~~~ DCD (Data Carrier Detect) is an input to the UART from other equipment. ComSw just shows the status of the control line. It is normally used to indicate when a modem is fully connected to anouther modem. How to get help on the command line switches. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Run the program using a help flag: comsw /h OR comsw /? Here is the help screen and it is complicated. ComSw V0.3a (c)1992/3 T N Channon Usage: comsw {/} Flags are /fbwpsedrlqtmh? but most take numeric args. There may be none or more sets of flags separated by spaces. Invoked with no args just displays status. / where port is 1..4 eg. /3 is flags for COM3 f0|1 where 0 is disable and 1 is enable FIFO if present b where baud is a number eg. b38400 w5|6|7|8 number of databits in Word pE|O|N Even, Odd or No Parity s1|2 One or two stop bits. L0|1 sets Loopback state. e0|1 where 0 is disable and 1 is disable IRQ for port d0|1 sets DTR state. r0|1 sets RTS state q Quiet mode, no display. t0|1 Remove or add entry to DOS com port table. m Run monitor program h|? display this text! All flags are case insensitive. Errorlevel returned. Flags may be in any order and ports may be in any order. Example: comsw /1b9600w8pns1e1 /3e0 Command line flags. ~~~~~~~~~~~~~~~~~~ / Followed by 1 2 3 or 4 indicates to which comm port any immediately following flags apply. There may be one two three or four sets of flags on the command line and they can be in any order, the flags for com4 can preceed the flags for com1. f FIFO on or off. f0 or f1 b Baud rate. Anything valid, ranging from b2 to b115200 w Bits per word. Anything from w5 to w8 p Parity. pe po pn Even Odd or None. s Stop bits. s1 or s2 e Enable the IRQ. e0 or e1 d DTR on or off. d0 or d1 r RTS on or off. r0 or r1 l Loopback on or off. L0 or L1 q Quiet mode. Suppresses text output to the screen. Just q t Table for DOS. t0 table entry is removed, t1 table entry is inserted if a UART is found at the standard address. m Monitor. See below. h ? Invoke help screen. The Terminal or Monitor ~~~~~~~~~~~~~~~~~~~~~~~ If a valid command line flag set contains 'm' a monitor will be entered. Any flags which change port settings will be invoked before the monitor is entered. ~~~~~~ You can monitor one two three or four ports with the screen adjusting accordingly. The status of the UART control inputs is shown on a simple moving display. Any incoming characters are displayed and you can send characters from the keyboard to any one UART. Some of the UART settings can be altered from the keyboard. The program is very simple and polls the ports, it is NOT interrupt driven. This method was chosen to avoid disturbing any installed comm driver software which will do nothing because the hardware interrupts are switched off on all ports being monitored. When you run the monitor TO ACCESS ON LINE HELP JUST PRESS KEY The main keyboard does what you would expect, including the control keys and all special ComSw keys use the key. 1 keyboard connected to com1 2 keyboard connected to com2 3 keyboard connected to com3 4 keyboard connected to com4 5 5 data bits 6 6 data bits 7 7 data bits 8 8 data bits D toggle DTR L toggle loopback P toggle parity (rolls none, even, odd) R toggle RTS S toggle number if stop bits X exit monitor program toggle add linefeed to raise baud rate lower baud rate Release notes. ~~~~~~~~~~~~~ V0.4a Altered text output to use common ASCII so that redirected output prints and displays correctly on simple devices. Now uses '_' '0' and '1' Reports of malfunction in this software (ie. bugs) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ These are welcome and if you find one please take the trouble to tell me. There are known to be a few computers where the software does not work as intended, reason not known. Conditions of usage. ~~~~~~~~~~~~~~~~~~~ The program is (c)1992/3 Tim Channon. All rights reserved. The program may be freely distributed. The program is not for resale. (you may not sell it) Only private individuals, registered charities and companies employing less than 10 people may use the program without restriction. Others please contact the author for a licence in which case the author may at his discretion charge a small fee. Anyone may evaluate the program for a reasonable period. The author disclaims liability for any damage directly or indirectly caused by the use of this program the use of which is outside of the authors control. Contact details. ~~~~~~~~~~~~~~~ The author may be contacted by email: tchannon@black.demon.co.uk or tchannon@cix.compulink.co.uk Real mail: Mr T Channon 25 Stanley Road Newbury RG14 7PB United Kingdom The end is right here ==>