![]() Scalar's GP-TRICKS Homepage
How To Patch Borland Pascal 7.0 To Use 32-Bit DPMIBorland kept consistent with their heap architecture and used the Runtime Manager (RTM.EXE) and the DPMI driver (DPMI16BI.OVL) as a mean to extend the heap beyond the 1Mb realm of memory for mortal DOS programs. When using DPMI in your programs, most likely you will not even notice it and the Protected Mode that accompanies it. Most likely you will know this already and have used DPMI for years already. Recently, however, a problem has come up: Due to plummetting RAM prices, more and more PCs are equipped with more memory than the Intel 286 could cope, more than 16Mb of RAM. In some cases, the use of Borland's DPMI16BI.OVL driver on machines with this much memory can cause crashes ("a permanent loss of system control"). Fortunately, Borland had already recognized this ages ago and written a 32-bit DPMI driver called DPMI32VM.OVL that made use of the advanced features of the Intel 386 Protected Mode. Unfortunately, they never got around to distribute it in their Pascal languages. I have found this driver in an older distribution of Borland C++, and all it takes is to rename the 32-bit driver to DPMI16BI.OVL and to use it instead. It is not included on this web pabe, due to an unknown legal situation and space limitations on this website. This is a messy solution, though, since you will end up with different file versions having the same name. A cleaner way is to patch the EXE files to use the DPMI32VM.OVL file instead. A program to do this is published in Listing 1. If you do not want having to patch all EXE files by hand, you can also use the patcher on your BP.EXE (remember to make a backup, though), and it will automatically generate programs that use the 32-bit driver. This is what I have done. The patch program listed below simply searches a file for the string "dpmi16bi.ovl". If it is found, it is replaced with "DPMI32VM.OVL". Searching the file is a necessary evil since the file name is not found at a constant offset in every file. I do not want to get any comments about the patch program itself. It is bad, and I know it. It uses a completely stubborn search algorithm, but at least it does work. And, using the /U parameter, it can also patch back to 16-bit. I have used the 32-bit DPMI driver since July 1995, and I have not encountered any problems (contrary to with the 16-bit driver). If your local nuclear power plant blows up, though, do not blame me.
| |||||||||