Dec 222017
 
Patch QB4 not to drop dtr.
File QBDTRPCH.ZIP from The Programmer’s Corner in
Category BASIC Language
Patch QB4 not to drop dtr.
File Name File Size Zip Size Zip Type
DTRPATCH.DOC 6767 2415 deflated
TPCREAD.ME 199 165 deflated

Download File QBDTRPCH.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 ---------------

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>Rename Brun20.exe Brun20.x
C>Debug Brun20.x
-a 6459
xxxx:6459 Mov AL,1
xxxx:645B
-w
Writing xxxxx Bytes
-q
C>Rename 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.

------------- Additional Information for QuickBasic Version 3.0 -------------

By Clint Labarthe - 05/17/87 (305) 260-6397

The above instructions were correct in finding these items in version 2.0

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>Rename Brun30.exe Brun30.x
C>Debug Brun30.x
-a 6969
xxxx:6969 Mov AL,1
xxxx:696B
-w
Writing xxxxx Bytes
-q
C>Rename Brun30.x Brun30.exe

These patches were tested by me and appear to work OK. These only work when
compiling to BCOM30.OBJ, BRUN30.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.


------------- Additional Information for QuickBasic Version 4.0 -------------

By Clint Labarthe - 12/23/87 (305) 260-6397

The above instructions were correct in finding these items in version 3.0
The instructions below are different for patching BCOM40.LIB. I found
the BCOM40.LIB info in a file: QBASIC40.PAT. I thank the author for it.

MAKE BACKUPS FIRST BEFORE PATCHING!

To Patch BCOM40.LIB

DEBUG BCOM40.LIB
-D 100 L 5
xxxx:0100

Take the first <3> numbers of 'xxxx' and add 85. Example: if you had
something like 114F:0100 then you would add 85 to 114 and get 199.
The new number you come up with will be 'yyy'. Remember this is HEX.

-S yyy0:0 FFFF 83 C2 04 32 C0

DEBUG will now give TWO locations where these bytes are located. Lets
call the first address is xxxx:yyyy

-U xxxx:yyyy L 6

You should see three lines. the 'xxxx:yyyy' should be represented by
a 'XOR AL AL'

-A xxxx:yyyy
xxxx:yyyy MOV AL, 1 (assemble MOV AL, 1 at the xxxx:yyyy)
xxxx:yyyy (hit enter here)

Now repeat the process with the other number. (starting at the U
command)
After you have done that, be sure to save the file:

-W
Writing xxxx bytes
-Q

To patch BRUN40.EXE

C>Rename Brun40.exe Brun40.x
C>Debug Brun40.x
-a 6D13
xxxx:6D13 Mov AL,1
xxxx:6D15
-a 6FDD
xxxx:6FDD Mov AL,1
xxxx:6FDF
-w
Writing xxxxx Bytes
-q
C>Rename Brun40.x Brun40.exe

Thats it !



 December 22, 2017  Add comments

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)