Dec 152017
 
Patch DTR for QBasic Libraries.
File DTRPTCH3.ZIP from The Programmer’s Corner in
Category BASIC Language
Patch DTR for QBasic Libraries.
File Name File Size Zip Size Zip Type
DTRPATCH.DOC 4992 1991 deflated
TPCREAD.ME 199 165 deflated

Download File DTRPTCH3.ZIP Here

Contents of the DTRPATCH.DOC file


DTR Fix for QuickBasic
Jeff Porter
1-5-86

As anyone who has tried to write any programs that use COM1: or
COM2: with MicroSoft QuickBasic knows, the DTR modem control line
is dropped everytime a a communication file is opened or closed.
I don't know why MicroSoft drops the DTR line all the time; all I
know is that it can be a serious problem with programs such as
RBBS-PC. Therefore, I present the following patch to fix the
problem.

This patch modifies the serial communication routines in the
BCOM10.LIB file so that the DTR line will be not be turned off.

Here is a transcript of a patch session. More detailed
instructions follow it.

C>copy bcom10.lib bcom10bk.lib
1 File(s) copied

C>debug bcom10.lib
-d540 L 10
xxxx:0540 0B D2 75 04 B5 FF EB 34-FA 83 C2 04 32 C0 EE EB ..u....4....2...
-d830 L 10
xxxx:0830 14 8B FA E8 00 00 83 C2-04 32 C0 EB 00 EE C7 47 .........2.....G
-a54c
xxxx:054C mov al, 1
xxxx:054E
-a839
xxxx:0839 mov al, 1
xxxx:083B
-w
Writing 25C00 bytes
-q


1. Make a backup copy of the BCOM10.LIB file, just in case.

2. Run debug and load BCOM10.LIB

C>debug bcom10.lib

3. Display the following sections of data and see that they
match. This is to insure that you are patching the correct
version of the library.

-d540 L 10
xxxx:0540 0B D2 75 04 B5 FF EB 34-FA 83 C2 04 32 C0 EE EB ..u....4....2...
-d830 L 10
xxxx:0830 14 8B FA E8 00 00 83 C2-04 32 C0 EB 00 EE C7 47 .........2.....G

4. If debug shows the same information as listed above, then
you may continue with the patching process. If not, go to
the section Patching other Library Files.

5. Do the following:

-a 54c
xxxx:054C mov al, 1
xxxx:054E
-a 839
xxxx:0839 mov al, 1
xxxx:083B

6. Now write the file back to disk and quit debug. The patch
is complete.

-w
Writing bytes
-q


Patching other Library Files

If you do not have MicroSoft QuickBasic or if you have a
different version than I, you can probably still perform this
patch. You will have to find the correct locations to patch.
The addresses 054C and 0839 were found with the following
procedure:

1. Search for the byte sequence 83 C2 04 32 C0 in the library
file. If you are lucky, debug will find it in exactly two
places.

(for example:)
-s 100 fff0 83 C2 04 32 C0

2. Unassemble the addresses you found. The first two
instructions will be

ADD DX, +04
XOR AL, AL

Within the next few instructions should be

OUT DX, AL

3. If everything has gone correctly so far, just change the

XOR AL, AL

to a

MOV AL, 1

4. Perform this change in both places where the

XOR AL, AL

instruction was found.


5. Write the updated file.

------------- Additional Information for QuickBasic Version 2.00 ------------

By Jeff Sumberg - 02/03/87

The above instructions were correct in finding these items in 'other'
versions. In fact the only difference I found was that the patches were
required in only one location rather than two. Additionally I have located
the patch in BRUN20.EXE as well as BCOM20.LIB

MAKE BACKUPS FIRST BEFORE PATCHING!

To Patch BCOM20.LIB

C>Debug Bcom20.Lib
-a D36B
xxxx:D36B Mov AL,1
xxxx:D36D
-w
Writing xxxxx Bytes
-q

To patch BRUN20.EXE

C>Ren Brun20.exe Brun20.x
C>Debug Brun20.x
-a 6459
xxxx:6459 Mov AL,1
xxxx:645B
-w
Writing xxxxx Bytes
-q
C>Ren Brun20.x Brun20.exe

These patches were tested by me and appear to work OK. These only work when
compiling to BCOM20.OBJ, BRUN20.OBJ, & EXE. If you use the in-memory
compilation method, DTR will still drop when you close the port or the program

terminates so dont get upset. Apparently the DTR code is somewhere in QB.EXE
also, but I was unable to find it. Besides you wont be using the compiler when
you have this problem, its the finished product that was the trouble.


Note: QuickBASIC version 2.01 had different values from the above shown, use
The proceedure above to find them.

------------- Additional Information for QuickBasic Version 3 ---------------

If you used the patches for version 2 then you are going to have to add them
to version 3 when you get it. Here are the addresses:

MAKE BACKUPS FIRST BEFORE PATCHING!

To Patch BCOM30.LIB

C>Debug Bcom30.Lib
-a DC0B
xxxx:DC0B Mov AL,1
xxxx:DC0D
-w
Writing xxxxx Bytes
-q

To patch BRUN30.EXE

C>Ren Brun30.exe Brun30.x
C>Debug Brun30.x
-a 6969
xxxx:6969 Mov AL,1
xxxx:696B
-w
Writing xxxxx Bytes
-q
C>Ren Brun30.x Brun30.exe


 December 15, 2017  Add comments

Leave a Reply