[comp.sys.ibm.pc] patches to DOS v 3.1

keeshu@nikhefk.UUCP (01/28/87)

[Replace this line with a beautiful thought]

Some days ago someone asked for the known patches to PC-DOS v 3.1.
Yesterday the following file was uploaded to my BBS (Opus_SAGA, +3120924442),
and I thought more people would appreciate the contents, so here it is :

Enjoy,

-- Kees

===========================<cut here>======================================

                  The CompuServe IBMPC SIG Users Group
                  ------------------------------------
                        PATCHES FOR IBM DOS 3.1
                        -----------------------


   ************************************************************************

     Note: In the patches which follow, it is assumed the user is familiar
     with the use of DEBUG.  The notation "xxxx" means "anything is ok".
     The notation <cr> means press Enter.

   ************************************************************************



   FIXED DISK CLUSTER SIZE

     If you have a 10 Meg hard disk, the following information collated by
   Bill Higgins, provides for 2K clusters instead of the standard 4K
   clusters.  Typically, you will free up about 10% of the disk space you
   are currently using.

           2K Cluster Size for 10MB Fixed Disks under DOS 3.1

      Standard 10mb fixed disks formatted under DOS 3.1 utilize 4k clusters
   (i.e., the minimum space allocated to any file is 4096 bytes), while
   drives 20mb and larger utilize 2k clusters.  I use a PC with twin 10mb
   drives under DOS 3.1.  Since I have a multitude of small files on these
   disks, the smaller allocation unit's space saving advantage far outweighs
   any theoretical disadvantage of additional overhead for DOS to handle the
   added allocation units.

     With the help of Bob Morse, SysOps Jim Gainsley, and Conrad Kageyama,
   and the DOS Technical Reference, I was able to make the changes necessary
   to use 2k clusters on both of my 10mb drives.  By following the
   step-by-step instructions below, you will be able to make the switch to
   2k clusters yourself.

    NOTE: THE FOLLOWING PROCEDURE WILL DESTROY ALL DATA ON THE FIXED DISK!!!

   You will need the following:

   (1) IBM PC-DOS version 3.1 (3.0 appears NOT to work).

   (2) A disk utility such as DISK REPAIR (a part of the IBM PROFESSIONAL
       DEBUG FACILITY), or DISMOD (a USS program, available on many BBS's),
       or equivalent.  Note: You will not need this, if you use the
       Alternate Method in #4a below.
   Most critical to the process is the sequence in which this procedure is
   attempted.  Here is the 4k to 2k cluster procedure:

   (1)  Do a complete backup of the fixed disk, using your current version
        of DOS.

   (2)  Cold boot DOS 3.1, run FDISK to create or be sure that a DOS
        partition exists on the Fixed Disk.

   (3)  Format the fixed disk using the DOS 3.1 FORMAT.COM program.  Do NOT
        use any parameters (no /s or /v).

   (4)  Using your disk utility, select the boot sector and view it.
        See below for an explanation of the pertinent info in this sector.
        At location AA below, you should see a value of 08 which is the
        number of sectors per cluster.  Change this to 04.

        At location BB below, you should see a value of 0800 which is the
        number of sectors per fat (in hex Word format).  Change this to 1500.
        The results should appear as in CC and DD below.

        All changes to the fat sectors required for 2k clusters will be
        accomplished by the subsequent format in instruction 6 below.  No
        other manual changes are required.

                            --------------------

        Example of first few bytes in the Boot Sector of the fixed disk,
        displayed in hex format, after formatting with DOS 3.1, and prior
        to 2k cluster size changes:  (The bytes of interest are located at
        Boot sector Offsets 0Dh = Sectors per cluster, and 16h = Sectors
        per FAT.)

             EB299049 424D2020 332E3100 02080100 020002F3 50F80800
                                          ^^                  ^^^^
                                          AA                   BB

          After the 2k cluster size changes:

             EB299049 424D2020 332E3100 02040100 020002F3 50F81500
                                          ^^                  ^^^^
                                          CC                   DD

        Where the data elements directly above AA are sectors per cluster,
        and above BB are sectors per FAT.

        (4a) Alternate Method:

             If you would rather, and if you are familiar with the operation
             of Debug, the following method can be used.

                Under DOS 3.1, do:

                  DEBUG
                  -L 0 n 0 1 <cr>
                  -E 0D <cr>
                  xxxx:0D  08.04 <cr>
                  -E 16 <cr>
                  xxxx:16  08.15 <cr>
                  -W 0 n 0 1 <cr>
                  -Q

                  where, n = the fixed disk drive as follows:
                             If fixed disk is drive  B  then  n=1
                                        "            C   "    n=2
                                        "            D   "    n=3
                                        "            E   "    n=4

              NOTE: Be *really* careful when you do the L and W commands in
                    the foregoing sequence.  Would be best to check your
                    work by doing DEBUG, then

                             -L 0 n 0 1 <cr>   then doing
                             -D 0D L1 <cr>     and
                             -D 16 L1 <cr>     making sure that the results
                                               are 04 & 15 respectively.
                                               Then exit by doing
                             -Q

                            -------------------

      A more detailed explanation of these two changes:

        The number of sectors per cluster would change from 08 to 04, since
        that's what this is all about.  The sectors per FAT will change, in
        order to accomodate (1) the increased number of possible FAT
        entries, and (2) the increased size of each fat entry which will be
        in 16-bit format instead of the former 12-bits.  The value to use for
        a 10 meg & 2k clusters would be 21 sectors, or 1500 in hex word
        format. (In this case the 15 is all that counts. 15 hex = 21 decimal.)


   (5)  Exit the disk utility and do a cold boot with DOS 3.1.  This is
        critical, since the boot sector is read by DOS only once, at boot
        time, in order to build the BIOS  Parameter Block.  Having different
        info in the boot sector than what's in the memory-resident BPB will
        give UNPREDICTABLE RESULTS.
  The following is safest way to preceed.  Please use it.

   (6)  Reformat the drive using the DOS 3.1 FORMAT.COM,

             FORMAT C: /S

        (You may also include  /V, if you wish to include a volume label.)

             DOS 3.1 FORMAT will NOT affect your changes to the boot
             sector.  (This a change from DOS 3.0 FORMAT, which re-writes
             the boot sector.)

   (7)  Restore your files, BEING SURE TO USE the RESTORE parameter, /P
        which prompts before restoring system files.

        **** WARNING ****

        YOU MUST NOT ALLOW THE TWO SYSTEM FILES, IBMBIO.COM AND IBMDOS.COM
        TO BE RESTORED, EVEN IF THEY ARE DOS 3.1 !!!  IF YOU DO, THEY WILL
        NOT BE PUT IN THE PROPER LOCATIONS AND YOUR FIXED DISK WILL NOT BE
        BOOTABLE AND YOU WILL HAVE TO REFORMAT !!!

        Avoid restoring an earlier version of COMMAND.COM, but if you do
        restore an earlier version, nothing is lost, just be sure to copy
        a 3.1 version over it afterwards.  You should now be operational
        again, with 2k clusters.


   Further info on the entries in the boot sector entries used to build
   the BIOS Parameter Block can be found in the DOS 3.1 Technical
   Reference, Page 2-28.  Of course, I cannot warrant that this change
   will work for all controller/disk combinations, particularly for
   controllers and drives which are not 'XT clones' though it 'should
   work' for all drives compatible enough to work under DOS 3.1.

        Comments to:  -- Bill Higgins  [70575,307]  CIS, IBMPC SIG --


   **********************************************************


   ENVIRONMENT SIZE

     Thanks to Bob Morse, the environment size can be patched as follows:

   DEBUG COMMAND.COM
   -E 0D11<cr>
   xxxx:0D11  0A.1E<cr>
   -W<cr>
   -Q<cr>

   (1E is for a 544 byte nominal size. Use 3C for a 1K size.)

   *********************************************************
   SCREEN SCROLLING

     From Ward Christensen, the ANSI.SYS scrolling patches to disable the
   wait for retrace and the screen blanking have new addresses but they
   work just fine.  Using DEBUG, proceed as follows:

   DEBUG ANSI.SYS
   -E 02E3<cr>
   xxxx:02E3   74.90  FB.90<cr>
   -E 02EA<cr>
   xxxx:02EA   EE.90<cr>
   -W<cr>
   -Q<cr>

   **********************************************************

   DISABLE EDLIN AUTOMATIC .BAK FILE CREATION

     On a BBS I found the patch from an unknown author to disable the
   automatic .BAK file when using EDLIN.  Using DEBUG proceed as follows:

   DEBUG EDLIN.COM
   -E 0CD5<cr>
   xxxx:0CD5   56.41<cr>
   -W<cr>
   -Q<cr>

   **********************************************************

   AUTOMATIC INSTALLATION OF PRINTER FOR DOS PRINT

     Also on a BBS I found the patch by an unidentified author to PRINT.COM
   to obviate the need to type the desired printer port.   If the printer
   port is LPT1, then using DEBUG proceed as follows:

   DEBUG PRINT.COM
   -E 1788<cr>
   xxxx:1788   E8.90  CB.90  02.90<cr>
   -E 179A<cr>
   xxxx:179A   CD.90  21.90<cr>
   -W<cr>
   -Q<cr>

   If the printer port is LPT2 then the following address must ALSO be
   modified as follows:

   -E 10CA 4 "LPT2"

   *********************************************************
   DISABLE AUTOMATIC HEADER IN FIND.EXE OUTPUT

    The FIND program puts an automatic header  ---------- filename  in the
   output listing.  To disable this header, patch FIND.EXE as follows:

   REN FIND.EXE FIND.TMP

   DEBUG FIND.TMP
   -E 0424<cr>
   xxxx:0424   03.2C<cr>
   -W<cr>
   -Q<cr>

   REN FIND.TMP FIND.EXE

   **********************************************************

   PERMIT MORE THEN 10 MISMATCHES IN COMP.COM

     I have patched COMP.COM to permit 50 mismatches as follows:

   DEBUG COMP.COM
   -E 08E2<cr>
   xxxx:08E2   0A.32<cr>
   -E 0BF8<cr>
   xxxx:0BF8   31.35<cr>
   -W<cr>
   -Q<cr>

   **********************************************************

   ECHO OFF

     I have patched COMMAND.COM to set the default to echo off to
   to obviate the need for the ECHO OFF and CLS statements at the beginning
   of a batch file.

   DEBUG COMMAND.COM
   -E 1967<cr>
   xxxx:1967  01.00<cr>
   -W<cr>
   -Q<cr>

     Note 1: The default for AUTOEXEC.BAT files will still be ECHO OFF.
     Note 2: If the last thing done in a .BAT file is to do ECHO ON, then
             you will get two prompts at exit.

   **********************************************************
   FORMAT: Add BEEP at completion of formatting

   Stephen Berg provided a patch to FORMAT.COM in DOS 2.1 to produce a
   BEEP when FORMAT completes. The patch adapted to DOS 3.1 is shown
   below. The patch is most easily made with a disk editor. Using a disk
   editor look for the exact string:

        Format another (Y/N)?

   It begins at offset 142Fh (Note: This NOT a Debug address!)  If you
   are using DISMOD, the address is record 0014 byte 2Fh

   Enter the following exact string (omit quotes), ^G means Ctrl-G:

       "Do another  (Y/N) ?^G "    (Note that one blank space follows ^G)

   If you wish to use Debug then:

     DEBUG FORMAT.COM
     -D 152F L20<cr>                            ;Displays "Format another..."
     -E 152F  "Do another  (Y/N) ?",07," "<cr>  ;Quotes must be included
     -D 152F L20<cr>                            ;Displays your entry.
     -w
     -q

   The 07h (^G) does the BEEP.

Below is what you should see after the first D command above.

DEBUG FORMAT.COM
-D 152F L20
xxxx:1520                                               46                  F
xxxx:1530  6F 72 6D 61 74 20 61 6E-6F 74 68 65 72 20 28 59   ormat another (Y
xxxx:1540  2F 4E 29 3F 00 AF 0E 0D-0A 00 C7 0E 49 6E 76      /N)?........Inv
                       ^^                                        ^
                          NOTE: THE 00H MUST NOT BE DISTURBED!!!

   *********************************************************

   COMMAND.COM -- SOME UNDOCUMENTED FEATURES

   The following is from Bob Smith, author of 'Tall Screen'.
   EXPANDING THE PCDOS ENVIRONMENT AREA:

     A recent forage into DOS 3.1 COMMAND.COM uncovered the following
     seemingly supported, but undocumented feature:


        /E:NN        Set size of Environment area to NN paragraphs. Range
                     is 10 to 62  Numbers outside that range are ignored.
                     The default is /E:10.

     This feature is most useful when used in conjunction with the
     SHELL= OPTION in CONFIG.SYS.  In particular, my usage is as follows:

       SHELL=C:\DOS\COMMAND.COM C:\DOS /P /E:20

     Other options include:

       /D       Don't execute AUTOEXEC.BAT

       /F       Skip response to ABORT, RETRY, IGNORE question in the System
                default INT 24h handler.  (Quite likely this feature is
                named /F for 'FLAKY'.)

     A NOTE ON THE 'SHELL' COMMAND, ABOVE...

       The sample 'SHELL=' CONFIG.SYS command, above, shows several
       undocumented options available.  In particular, the first parameter
       shows where the initial copy of COMMAND.COM is to be found (in the
       above example, on the '/DOS' subdirectory on the 'C:' disk).  This is
       as documented by IBM. The second parameter indicates the drive and
       subdirectory from which COMMAND.COM is to be reloaded.  Here again,
       the '/DOS' subdirectory on 'C:'.

       The '/P' parameter indicates that the substitution should be permanent.
       Note that in the DOS 3.10 REFERENCE MANUAL, the above two parameters
       are described for the 'COMMAND' command.  What IBM doesn't tell you is
       that they also work on the 'SHELL=' command in CONFIG.SYS


                        -----------------------

             My thanks to Bob, Ward, and others for their patches.

         Comments to:  --  Ted Eyrick  [72446,317] CIS, IBMPC SIG --


   Edited by:
   Jim Gainsley [76703,1007]
   (SysOp) IBMPC SIG
   CompuServe
   8-9-85
   9-2-85


==========================<end of DOS31.PAT>=========================



|  UUCP	  : keeshu@nikhefk.uucp  or : {[wherever]!seismo}!mcvax!nikhefk!keeshu
|  FIDO   : kees huyser at 28/9 or 500/11
|  BITNET : u00212@hasara5.bitnet
|  SNAIL  : kees huyser, NIKHEF-K, PO Box 4395, 1009 AJ Amsterdam, Netherlands

jimb@tekigm2.UUCP (02/04/87)

In article <108@nikhefk.UUCP> keeshu@nikhefk.UUCP (Kees Huyser) writes:

 >   COMMAND.COM -- SOME UNDOCUMENTED FEATURES

 >        /E:NN        Set size of Environment area to NN paragraphs. Range
 >                     is 10 to 62  Numbers outside that range are ignored.
 >                     The default is /E:10.
I believe the number is really the number of bytes to set for the 
environment. I use the number 512 and it works fine.  I believe the correct
range is 160 - 32768.  The default is 127 (that which you get without 
setting the size).  

 >     This feature is most useful when used in conjunction with the
 >     SHELL= OPTION in CONFIG.SYS.  In particular, my usage is as follows:

 >       SHELL=C:\DOS\COMMAND.COM C:\DOS /P /E:20

>       The '/P' parameter indicates that the substitution should be permanent.
No.  the '/P' tells command.com to execute your autoexec.bat file once
command.com gets loaded.  If you put the above shell  statement in your
config.sys file without the /P, your autoexec.bat file will not get executed.
The reason is that you may not want to use command.com.  Perhaps you wrote
your own processor that you want to use in lieu of command.com.  You would
use the shell command to load it.  You may not want to execute autoexec.bat.
The /P gives you the option or ignoring it.

dick@zaphod.UUCP (02/04/87)

Has anyone run across the patches required under IBM's flavor of PC-DOS
3.1 to specify which disk drive MORE and SORT will use for their scratch
files?
-- 
Dick Flanagan, W6OLD
...!ucbvax!decwrl!sun!plx!dick
(The usual disclaimers apply)

pinkas@mipos3.UUCP (02/05/87)

In article <1438@tekigm2.TEK.COM> jimb@tekigm2.UUCP (Jim Boland) writes:
>In article <108@nikhefk.UUCP> keeshu@nikhefk.UUCP (Kees Huyser) writes:
> >   COMMAND.COM -- SOME UNDOCUMENTED FEATURES
> >        /E:NN        Set size of Environment area to NN paragraphs. Range
> >                     is 10 to 62  Numbers outside that range are ignored.
> >                     The default is /E:10.
>I believe the number is really the number of bytes to set for the 
>environment. I use the number 512 and it works fine.  I believe the correct
>range is 160 - 32768.  The default is 127 (that which you get without 
>setting the size).  
>
> >     This feature is most useful when used in conjunction with the
> >     SHELL= OPTION in CONFIG.SYS.  In particular, my usage is as follows:
>
> >       SHELL=C:\DOS\COMMAND.COM C:\DOS /P /E:20
>
>>       The '/P' parameter indicates that the substitution should be permanent.
>No.  the '/P' tells command.com to execute your autoexec.bat file once
>command.com gets loaded.  If you put the above shell  statement in your
>config.sys file without the /P, your autoexec.bat file will not get executed.
>The reason is that you may not want to use command.com.  Perhaps you wrote
>your own processor that you want to use in lieu of command.com.  You would
>use the shell command to load it.  You may not want to execute autoexec.bat.
>The /P gives you the option or ignoring it.

No, no, no.  First of all, you might both be correct.  The environment size
in versions of dos 3.1 and below was specified in paragraphs.  Thut the
correct range was 10 to 62.  The default was 10.  In version 3.2 Microsoft
decided to be incompatible and to make people specify the size in bytes.
So the valid range became 160 to ~32000.  However, after tracking down the
internals, it appears to me that specifying a size that is not a multiple
of 16 results in wasted memory.  i.e. the number is rounded up to the
nearest multiple of 16, but the difference might be unreachable.  So much
for improvement.

As far as the second item, Jim is correct.  The /P parameter tells DOS to
make the invoked COMMAND.COM remain resident permanently.  Thus, it will
enter the read/execute loop.  See the documentation on config.sys' shell
command and on the exec function.

-Israel
-- 
----------------------------------------------------------------------
UUCP:	{amdcad,decwrl,hplabs,oliveb,pur-ee,qantel}!intelca!mipos3!pinkas
ARPA:	pinkas%mipos3.intel.com@relay.cs.net
CSNET:	pinkas%mipos3.intel.com