[net.micro.pc] Shutting up "echo off"

nather@utastro.UUCP (Ed Nather) (04/01/85)

We are indebted to Tom Brengle for the patch to "command.com" that
makes "echo off" the default condition, and to Bill Marsh for reposting
the patch.  It works as advertized, but there are a couple of complications
not mentioned.  To keep this to moderate (?) length I summarize the
patch procedure, then comment on the complications:
---------------------------------------------------------------------------
Procedure to modify command.com to default to the "echo off" condition:

1. Copy "command.com" and "debug.com" onto a work disk.
2. Execute "debug command.com" from that disk.  At the "-" prompt type
3. -s 0 7fff 01 00 00 01; write down found_address+3 as "flag."  Type
4. -s 0 7fff 61 6E 64 20 70; write down found_address as "patch".  Type
5. -s 0 7fff B9 0A 00 E8; write down found_address as "jmp". Type
6. -u "jmp" [substitute value found in step 5 for "jmp"].
7. First instr. is "MOV CX,000A", 2nd is "CALL yyyy" - record "yyyy" value.
8. -A "jmp+3"
           CALL "patch+1"
9. -A "patch"
           DB 24
           ES:
           MOV BYTE PTR ["flag"], 00
           JMP "yyyy"
10. -w
11. -q
________________________________________________________________________
Values found for different DOS versions:
          DOS 2.0     DOS 2.1     DOS 2.11          
flag        96E         96E         9B7
patch      364A        365D        3886
jmp        171D        1730        17E3
yyyy       1E6D        1E80        2A10
------------------------------------------------------------------------
Experience with the patched command.com:

The inserted code sets the location "flag" to 0 (off) when a .bat file
is interpreted by command.com.  The flag itself can be either "on" or
"off" by default when command.com starts up; having it "off" at startup
has some awkward consequences.  The echo process is used to provide the
prompt, so if you initialize the flag to "off" you don't get a prompt
printed until you've run a .bat file.  Leaving it "on" results in echo
being on during the execution of autoexec.bat, which is also not good.
The original posting suggested the initial flag setting should be "off."

I've compromised by leaving the flag itself "on" for the 1st invocation
of command.com -- it's turned off thereafter by the inserted patch --
and using a self-erasing "echo off" line as the first line in my
autoexec.bat file.  That line uses backspaces and spaces to erase the
silly "echo off" that is echoed; "echo off" flashes momentarily during
boot-up, but that is the only price paid.  A "push" from Kermit to a
new version of command.com therefore yields a prompt; with the flag
initialized to "off" in command.com, no prompt is generated when the
new copy is invoked, until a .bat file is executed -- a most confusing
result.

-- 
Ed Nather
Astronony Dept, U of Texas @ Austin
{allegra,ihnp4}!{noao,ut-sally}!utastro!nather