[net.micro.trs-80] DTR on MS-DOS

mikey@techsup (11/27/85)

There is a feature of MSDOS that may cause you some problems with older 
autoanswer modems.  Since there is no control in the DOS for DTR, CTS, and 
the OUT lines on the 8250, and since DTR is necessary for most modems to 
work, the DOS defaults to DTR asserted on booting.  This lets dumb 
terminal packages from BASIC or routing to the AUX port to function with 
minimal problems.  

However, if you have an older non-intellegent modem with autoanswer 
attached to the machine, it may try to answer your phone at inconvenient 
times.  This is because a lot of the older modems use DTR as an enable for 
operations and if it is asserted it assumes that it should answer the 
phone.

I wrote the following program to fix the problem.  It can be entered with 
DEBUG very easily.  On each execution it will toggle the DTR, so the same 
program can be used to turn DTR on as well as off.  I tried to write it as 
a tutorial so a 'non-programmer' could enter it without any problems.

The first step is to enter DEBUG by typing:

                   DEBUG<CR>

You will then enter the following code.  Do not type the comments after 
the ';' character, they are there to tell you what the program is doing.  
Do not type the numbers in the first column, they are there to double 
check your work.  Type only the second column, starting with 'mov' and end 
each line with a <CR> (an <ENTER> key).  Begin by typing:

                   a<CR>

This puts DEBUG into the assemble mode, starting with address 100.  Now 
enter the following program.  The <CR> at the end will get you out of the 
assemble mode.

        |<----Type this---->|
0100    MOV     DX,03FC<CR>     ; The address of control register
0103    IN      AL,DX<CR>       ; Get old DTR, CTS, OUTs, and LOOP
0104    MOV     AH,01<CR>       ; Mask DTR bit
0106    XOR     AL,AH<CR>       ; Toggle the DTR
0108    OUT     DX,AL<CR>       ; Write to control
0109    MOV     AH,4C<CR>       ; Return to MsDOS
010B    INT     21<CR>
010D    <CR>

Now it must be written to disk.  I chose to name the program 'DTR.COM', so 
type the following line to name it:

                   n dtr.com<CR>
                   
This tells debug what name to use to write it to disk.  The next step is 
to tell DEBUG how big the program is.  Since the program is 0Dh bytes 
long, type:

                   r cx<CR>
                   d<CR>
                   
We just told debug the size of the program.  Now write to disk with:

                   w<CR>
                   

DEBUG will respond with writing 000D bytes so just hit 'q' to quit back to 
dos.  If your modem has indicator lights, type:

			DTR<CR>
                   
And you should see the DTR light go on and off each time you run the the 
program.  DTR can be put in the autoexec.bat files for booting up without 
the modem autoanswering.  If you want to do the same thing for the 
secondary RS-232 card, just substitute 2fc for the address in the first 
line (in place of the 3fc).

This problem showed up when I lent my old Datacom 1200bps modem to
my brother for use on his 1000 until he got his regular modem back
from RV.  I'm assumimg this is a generic MSDOS problem.  

Finally, if you use this on an AT machine, you will have to add the 
line:
		jmp $+2

just before the out instruction and adjust the number of bytes you write
out.  The 80286 is too fast for the 8250 but you can make it work by 
flushing the prefetch que right before the out instruction.

mikey at bbimg