[comp.sys.ibm.pc] THE Patches for Echo-off

bobmon@iuvax.cs.indiana.edu (RAMontante) (05/29/88)

I am one of those who think the MS-DOS default for displaying lines in
a batch file is S-T-U-P-I-D.  (Well, that makes it consistent, anyway :-)
I understand they've compensated somewhat in v3.3, with a kludge that
requires changing each and every .BAT file....oh boy.

Anyway, for those of you who would rather correct the original mistake than
cover it with bandaids, here are two (simple) patches to COMMAND.COM to make
echo-off the default.  Use debug or something equivalent to find the following
byte strings, then change the bytes.  The strings I suggest are near the
important bytes, and have been unchanged in MS-DOS v2.11, v3.10, and v3.21
(as released by Zenith); as far as I know the PC-DOS versions are the same, but
the addresses involved change by quite a bit.  The disassembled context is
included so that you can be sure you've found the right places.

----
To make echo-off the default for all batch files _except_ AUTOEXEC.BAT,
	search for:  00 bb 03 00 b4 48 cd 21
	ten bytes later, change 03 to 02

----
To make echo-off the default for AUTOEXEC.BAT,
	search for:  24 01 50 e8 96 00
	change the second byte, 01, to 00
or
	search for: 81 c3 b8 00
	thirteen bytes previous, change 01 to 00

----------
enjoy and as always -- Caveat Hacker,
	Bob Montante


DOS Echo-Off Patches -- debug transcript
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\MISC debug c2.com		{ patch a _copy_ of command.com }
-
-
-{ ECHO OFF default for .BAT files, except AUTOEXEC.BAT }
-
-s cs:100 2000 00 bb 03 00 b4 48 cd 21	    { search for an 8-byte string }
5BE4:122D
-
-u 122d
5BE4:122D 00BB0300      ADD     [BP+DI+0003],BH      { the           }
5BE4:1231 B448          MOV     AH,48                {   search      }
5BE4:1233 CD21          INT     21                   {       string  }
5BE4:1235 7271          JB      12A8
5BE4:1237 A37B0B        MOV     [0B7B],AX
5BE4:123A C606D00B03    MOV     BYTE PTR [0BD0],03   <-- change to 02
5BE4:123F 8EC0          MOV     ES,AX                    ~~~~~~~~~~~~
5BE4:1241 33FF          XOR     DI,DI
5BE4:1243 B000          MOV     AL,00
5BE4:1245 AA            STOSB
5BE4:1246 33C0          XOR     AX,AX
5BE4:1248 AB            STOSW
5BE4:1249 AB            STOSW
5BE4:124A B8FFFF        MOV     AX,FFFF
-
-e 123e
5BE4:123E  03.02                             { make the change }
-
-
-
-{ ECHO OFF default for AUTOEXEC.BAT            }
-{ alternate search:  -scs:100 2000 81 c3 b8 00 }
-
-s cs:100 2000 24 01 50 e8 96 00
5BE4:1BBB
-
-u 1bb0
5BE4:1BB0 06            PUSH    ES
5BE4:1BB1 E88C1A        CALL    3640
5BE4:1BB4 E86AFF        CALL    1B21
5BE4:1BB7 26            ES:
5BE4:1BB8 A0D00B        MOV     AL,[0BD0]
5BE4:1BBB 2401          AND     AL,01        <-- change to 00
5BE4:1BBD 50            PUSH    AX               ~~~~~~~~~~~~
5BE4:1BBE E89600        CALL    1C57         { search string ends here }
5BE4:1BC1 BEAB3D        MOV     SI,3DAB
5BE4:1BC4 E8D415        CALL    319B
5BE4:1BC7 8BD9          MOV     BX,CX
5BE4:1BC9 81C3B800      ADD     BX,00B8      { alternate search string }
5BE4:1BCD 51            PUSH    CX
5BE4:1BCE B104          MOV     CL,04
-
-e 1bbc
5BE4:1BBC  01.00                             { make the change }
-
-w
-q
C:\MISC
__________________________________________________________________________

version           \AUTOEXEC.BAT   other.BAT   25-line CLS   echo<space>
~~~~~~~           ~~~~~~~~~~~~~   ~~~~~~~~~   ~~~~~~~~~~~   ~~~~~~~~~~~
      patches         01 -> 00     03 -> 02     19 -> 18    e8200074 -> 83f90172

Location Offsets (per John Wright)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
MSDOS 3.10
  IBM/Compaq/generic      105B         1967         263B           3878
  Zenith (early?)          ??          1987                         ??
  Zenith (IO.SYSv3.12)    112B         19C7         269B           38E8  *

MSDOS 3.20
  generic                 115E         1ABC                        3A18
  Compaq                  11A4         1B6C                        3AC8
  Zenith v3.21            1bbc         123e                         ??   *
  IBM (PCDOS 3.20)        115E         1B2C                        3A88

PCDOS 3.30 (IBM)          1304         1B6C                        3E29

--
* "echo ." is known to work for this version
_____________________________________________________________________________