Tandy 1000 DOS 2x 3x PDF

Download as pdf or txt
Download as pdf or txt
You are on page 1of 392


TERMS AND CONDITIONS OF SALE AND LICENSE OF TANDY COMPUTER EQUIPMENT AND
SOFTWARE PURCHASED FROM RADIO SHACK COMPANY-OWNED COMPUTER CENTERS. RETAIL
STORES AND RADIO SHACK FRANCHISEES OR DEALERS AT THEIR AUTHORIZED LOCATIONS
LIMITED WARRANTY
CUSTOMER OBLIGATIONS
A CUSTOMER assumes full responsibility that this computer hardware purchased (the Equipment) and any
copies of software Included with the Equipment or licensed separately (the 'Software) meefs fhe spec,t,cat,ons
capacity. capab",tles versatll:ty. and other requllements at CUSTOMER
CUSTOMER assumes full responsibility for the condition and effecf,veness of the operatmg environment 10 which
the Equipment and Software are to function. and for ItS msfallatlon
II. LIMITED WARRANTIES AND CONDITIONS OF SALE
A For a pellod of nmety (90) calendar days froID the date of the Radio Shack sales document received upon
purchase of the Equipment RADIO SHACK warrants to the ollglnal CUSTOMER that fhe Equipment and the
medium upon which fhe Software IS stored IS tree from manufactullng defects. This warranty is only applicable
to purchases of Tandy Equipment by the original customer from Radio Shack company-owned computer
centers. retail stores, and Radio Shack franchisees and dealers at their authorized locations. The warranty IS
vOid It the Equipment or Software has been sublected to Improper or abnormal If a manulactullng defect IS
discovered dUling the stated warranty pellod the defective Equlpmenl must returned to a Radio Shack
Computer Center. a Radio Shack retarl store. a partlClpatmg Radio Shack tranchlSee or a partlClpatmg Radio Shack
dealer for repall along with a copy of the sales document or lease agreement The oliglOal CUSTOMERS sale and
excluSive remedy In the event of a defect IS limited to the correction of the delect by repall replacement or
refund of the purchase pllce at RADIO SHACKS elecflon and sale expense RADIO SHACK has no obligation to
replace or repair expendable Items
RADIO SHACK makes no warranty as to the design capability. capacity or sUitability lor use of the Software
except as provided 10 thIS paragraph Software IS licensed on an AS IS baSis. wllhout warranty The ollglnar
CUSTOMERS excluSive remedy 10 the event of a Soltware manufactullng defect IS ItS repall or replacement
wlthm thllty (30) calendar days of the date of the Radio Shack sales document received upon license of the
Software. The defectIVe Software shall be returned to a Radio Shack Computer Center. a Radio Shack retarl store
a partlclpatiOg Radio Shack franchISee or Radio Shack dealer along with the sales document
Except as provided herem no employee. agent. franchisee, dealer or other person IS authorIZed to give any
warranties of any nature on behalf of RADIO SHACK
EXCEPT AS PROVIDED HEREIN. RADIO SHACK MAKES NO EXPRESS WARRANTIES. AND ANY tMPLIED
WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE IS LIMITED IN ITS DURATION
TO THE DURATION OF THE WRITIEN LIMITED WARRANTIES SET FORTH HEREIN.
Some states do not allow l'm!lallons on how long an Implied warranty lasts. so the above Ilmltatlon(s) may not
apply to CUSTOMER
III. LIMITATION OF LIABILITY
A EXCEPT AS PROVIDED HEREIN. RADIO SHACK SHALL HAVE NO LIABILITY OR RESPONSIBILITY TO CUSTOMER
DR ANY OTHER PERSON OR ENTITY WITH RESPECT TO ANY LIABILITY, LOSS OR DAMAGE CAUSED OR
ALLEGED TO BE CAUSED DIRECTLY OR INDIRECTLY BY "EQUIPMENT" OR "SOFTWARE" SOLD, LEASED.
LICENSED DR FURNISHED BY RADIO SHACK. INCLUDING, BUT NOT LIMITED TO, ANY INTERRUPTION OF
SERVICE, LOSS OF BUSINESS DR ANTICIPATORY PROFITS OR CONSEQUENTIAL DAMAGES RESULTING FROM
THE USE DR OPERATION OF THE "EQUIPMENT" OR "SOFTWARE." IN NO EVENT SHALL RADIO SHACK BE
LIABLE FOR LOSS OF PROFITS. DR ANY INDIRECT, SPECIAL. OR CONSEQUENTIAL DAMAGES ARISING OUT OF
ANY BREACH OF THIS WARRANTY DR IN ANY MANNER ARISING OUT OF OR CONNECTED WITH THE SALE.
LEASE. LICENSE, USE DR ANTICIPATED USE OF THE "EQUIPMENT" OR "SOFTWARE."
NOTWITHSTANDING THE ABOVE LIMITATIONS AND WARRANTIES, RADIO SHACK'S LIABILITY HEREUNDER FOR
DAMAGES INCURRED BY CUSTOMER OR OTHERS SHALL NOT EXCEED THE AMOUNT PAID BY CUSTOMER FOR
THE PARTICULAR "EQUIPMENT" OR "SOFTWARE" INVOLVED.
RADIO SHACK shall not be lrable for any damages caused by delay 10 dellvellng or furnIShing Equlpmenf and or
Software
No action allSing out of any clarmed breach of IhlS Warranfy or transactions under this Warranty may be brought
more than two (2) years after the cause 01 action has accrued or more than four (4) years after the date of the
Radio Shack sales document lor the EqUipment or Software whichever fllst occurs
Some states do not allow the limitation or exclUSion of Incidental or consequentral damages so the above
Ilmltatlon(s) or excluslon(s) may not apply to CUSTDMER
IV. SOFTWARE LICENSE
RADIO SHACK granfs to CUSTOMER a non-exclUSive. paid-up license to use the TANDY Software on one computer
subject to the follOWing proVIsions
A Except as otherwISe proVided 10 thiS Sottware License. applicable copyllghl laws shall apply to the Software
B Title to the medium on which the Software IS recorded (cassefte and or dISkette) or stored (ROM) IS transterred to
CUSTOMER. but not title to the Sottware
CUSTOMER may use Software on a multiuser or network system only If either. the Software IS expressly labeled
to be for use on a mulfluser or network sysfern or one copy of thIS software IS purchased lor each node or
terminal on which Software IS to be used SimUltaneously
CUSTOMER shall not use. make. manulacfure. or reproduce copies of Software except tor use on one computer
and as IS specifically proVided 10 thIS Software license Customer IS expressly prohlb!ted tram dlSassembllOg the
Software
CUSTOMER IS permlfted to make additional copies of the Software only for backup or archival purposes or If
additional copies are reqUired In the operation of one computer With the Software. but only to the exfent the
Software allows a backup copy to be made. However. for TRSDDS Software. CUSTOMER IS permlfted to make a
limited number of additional copies for CUSTDMERS own use
CUSTOMER may resell or dlStlibute unmodified copies of the Software provided CUSTDMER has purchased one
copy 01 the Software lor each one sold or dlStlibuted. The provISions of thIS Software license shall also be
applicable to third parties recelvlOg copies at the Software tram CUSTOMER
G. All copyllght notices shall be retarned on all copies of the Software
V. APPLICABILITY OF WARRANTY
A The terms and conditions of thIS Warranty are applicable as between RADID SHACK and CUSTOMER to either a
sale of fhe Equlpmenf and or Software license to CUSTOMER or fa a transaction whereby Radio Shack sells or
conveys such EqUipment to a thlld party for lease to CUSTOMER
The Ilmlfaflons at lrabilify and Warranty prOVISions herein shall mure to the benefit of RADIO SHACK. the author.
owner and or licensor of the Software and any manufacturer of the EqUipment sold by Radio Shack
VI. STATE LAW RIGHTS
The warranties granted herein give the original CUSTOMER specific legal rights. and the original CUSTOMER may
have other lights which vary from state to sfate 686
TANDY 1000
MS-DOS
REFERENCE
MANUAL
Tandy 1000 EX/SX BIOS Compatibility Software: © 1984,
1985, 1986 Tandy Corporation and Phoenix Software
Associates, Ltd. All Rights Reserved.

MS-DOS": Verso 2.11 Software: © 1981, 1982, 1983 Micro-


soft Corporation. Licensed to Tandy Corporation. All
Rights Reserved.

MS-DOS'" Verso 3.2 Software: @ 1981, 1986 Microsoft Cor-


poration. Licensed to Tandy Corporation. All Rights
Reserved.

GW'M-BASIC Verso 2.02 Software: © 1982, 1984 Microsoft


Corporation. Licensed to Tandy Corporation. All Rights
Reserved.

GW'M-BASIC Verso 3.20 Software: © 1983, 1984, 1985,


1986 Microsoft Corporation. Licensed to Tandy Corpora-
tion. All Rights Reserved.

All portions of this software are copyrighted and are the


proprietary and trade secret information of Tandy Corpo-
ration and/or its licensor. Use, reproduction, or publication
of any portion of this material without the prior written
authorization of Tandy Corporation is strictly prohibited.

Tandy 1000 MS -DOS Refereru:e Manual:


© 1986 Tandy Corporation.
All Rights Reserved.

Reproduction or use, without express written permission


from Tandy Corporation and/or its licensor, of any portion
of this manual is prohibited. While reasonable efforts have
been taken in the preparation of this manual to assure its
accuracy, Tandy Corporation assumes no liability result-
ing from any errors in or omissions from this manual, or
from the use of the information contained herein.

Tandy and Radio Shack are registered trademarks of


Tandy Corporation.
Microsoft, MS, and MS-DOS are registered trademarks of
Microsoft Corporation.
GW is a trademark of Microsoft Corporation.
IBM is a registered trademark of International Business
Machines Corporation.

10 9 8 7 6 5 4 3 2
ABOUT THIS MANUAL

MS-DOS® is an extremely powerful computer managing tool and


has numerous commands and options. If you are a beginner,
don't let this worry you. MS-DOS is not difficult to use.
This section provides information that greatly facilitates your
use of the MS-DOS commands listed in Part 1. Be sure to read
it before going on to Part 2.
This manual helps you make immediate use of MS-DOS's func-
tions. Part 1 describes how to begin using the operating system's
commands and editing features as well as the organization of
directories and files.
Part 2 begins by giving you specific instructions on how to inter-
pret and use command references. The command references
which follow provide the syntax, parameters, special instructions,
and examples of use for each of the MS-DOS commands.
The MS-DOS powerful line editor, EDLIN, is described in detail,
and with numerous examples, in Part 3. Your understanding of
the special features in this section will greatly increase the
advantages of MS-DOS and save you time.
Part 4 is for assembly language programmers. It describes the
functions of the MS-DOS Linker. LINK is used to produce
machine language code from assembler or compiler object
modules.
The MS-DOS DEBUG program provides for the testing of execut-
able object files and lets you alter the contents of a file or regis-
ter. The use of DEBUG functions and commands is described in
Part 5.
The use of MS-DOS is greatly facilitated by its descriptive error
messages. The error messages you might encounter when using
any of the MS-DOS functions are listed in Part 6.
The CONFIG.syS file, described in Appendix B, lets MS-DOS
install device-specific drivers as part of the system start-up.
With CONFIG.SYS you can establish the number of buffers and
files, install a printer driver and set other parameters as part of
the system boot process.
CONTENTS

Part 1. Introduction
1 How to Use MS-DOS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Entering a Command. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Executing a Program. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Editing and Special Keys 1
The Control Keys. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2 Organization of Information 5
The File System. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
The Root Directory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Filenames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Extensions 6
Examples of Filenames . . . . . . . . . . . . . . . . . . . . . . . . . 7
Wild Cards 8
Pathnames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Device Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Directories 9
Creating Directories , 12
Deleting Directories 13
The Current Drive 14
The Current Directory , 14
Home Directories , 16
Anonymous Directory Names , 17
3 Redirecting Commands............................ 19
Input And Output , 19
Filters 20
Command Piping , 20
4 Batch Files , 21
Executing Several Commands. . . . . . . . . . . . . . . . . . . . . .. 21
The Batch File , 21
Executing a Batch File 22
Summary of the Batch File Process , 23
The Autoexec.bat File. . . . . . . . . . . . . . . . . . . . . . . . .. 24
Batch Files With Replaceable Parameters. . . . . . .. 24
Creating a Batch File With Replaceable
Parameters 25
Executing a Batch File With Replaceable
Parameters 25
Sample Use of Replaceable Parameters. . . . . . . . . .. 26
Reminders about Batch Files , 27

III
Contents

Part 2. MS-DOS Commands


5 MS-DOS Commands 29
Quick Reference To MS-DOS Commands. . . . . . . . . . . . .. 30
How to Use the Command Reference 33
Command Structure and Syntax . . . . . . . . . . . . . . . . . . . .. 34
Organization of MS-DOS Commands " .. 35
The Use of Special Type 35
Synonymous Keywords . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 36
6 Command Reference............................... 37
Part 3. EDLIN
7 The Line Editor (EDLIN). . . . . . . . . . . . . . . . . . . . . . . . . .. 189
Function Keys 189
8 Editing Commands 191
The Template 191
Display and Change 191
Overtype and Insert 192
Saving in the Template 192
Deleting 193
9 Editing Files 195
Creating a File 195
Inserting Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 196
Saving Your Files 196
Editing an Existing File 197
Using the Special EDLIN Editing Keys 197
10 EDLIN Command Reference 205
Command Format and Rules 205
Command Summary 207
Command Parameters 207
Part 4. MS-LINK
11 Linking Object Modules 235
Basic Information 235
System Requirements 235
Linking Object Modules and Producing a Run File .. .. 236
Resolving External References 236
Producing a List File 236
The VM.TMP (Temporary) File 237
Definitions 237
Command Prompts 239

iv
Contents

Command Characters 241


Linker Switches 242
Starting the Linker 244
Sample Link Session. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 246
12 LINK Technical Reference. . . . . . . . . . . . . . . . . . . . . . . .. 249
Definitions 249
How the Linker Combines and Arranges Segments . . .. 250
How the Linker Assigns Addresses. . . . . . . . . . . . . . . . . . . 253
Relocation Fixups 254
MS-LIB The Library Manager 256
Order of Operations 256
Running MS-LIB 257
Command Characters 260
Part 5. DEBUG
13 The DEBUG Utility 263
DEBUG Commands 264
Command Summary 265
Command Parameters 265
Part 6. Messages
14 Problems and Error Messages 293
MS-DOS Error Messages 293
Device Error Messages. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
Command Error Messages 297
EDLIN Error Messages 305
Linker Error Messages 308
DEBUG Error Messages 310
Part 7. Appendices
A ASCII and Scan Codes , 311
B Configuring Your System 321
C Installable Device Drivers 331
D Hard Disk Setup 343

Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345
Index 351

v
Chapter 1

HOW TO USE MS-DOS

If an error occurs while your computer is under the control of


MS-DOS, the screen displays one of the error messages listed in
Part 6.
Other error messages come from application programs. Check
the instructions of those programs for explanations.

Entering a Command
You can enter a command whenever the screen displays the sys-
tem prompt. The command may have a maximum of 127 charac-
ters, including any combination of uppercase or lowercase letters.
End each command by pressing [ENTER I. For example, type:
cIs [ENTER I
and MS-DOS executes the CLS command, which clears the
screen and displays the system prompt.

Executing a Program
You can also execute a program (such as the BASIC language
application supplied on your system diskette) at the system
prompt. If an entry is not a recognized command, MS-DOS com-
pares it with the program names in the current directory. If it
finds a match, MS-DOS loads and runs the program. Otherwise,
the screen displays an error message. For example, type:
bas i c I ENTER 1

to load BASIC.

Editing and Special Keys


Although you must be exact when entering commands, MS-DOS
makes correcting mistyped entries easy. Rather than having to
retype an entire command due to one error, MS-DOS provides
several special editing functions.
You can also use these same editing functions to change a pre-
vious command and reuse it.

1
Chapter 1 / How to Use MS-DOS
_
-_._-------------_.. .._ - - - - - - - - - -

Before entering a command. If you catch a mistake before you


have pressed the I ENTER I key, you can use one of the following keys
to correct the mistake:
• I BACKSPACE I - moves the cursor one space to the left and
erases the last character. You can then retype the
character or characters.
• COO - voids the command line and lets you start
over.
After entering a command. If you type in your command
without errors, pressing [ENTER I causes the command to be exe-
cuted. After execution, or if you made an error, you have the fol-
lowing options:
• Reexecute the same command. To do so, type [IT]
I ENTER I·
• Edit the line and reexecute the command.
• Change the command or parameters and execute the
new line.
To edit or change a line, you can use the MS-DOS special edit
keys and functions. Some functions you 'can perform are:
• Insert letters or words
• Delete letters or words
• Copy to a specified character
• Delete to a specified character
• Replace a line
• Copy characters
• Void a line
These editing features are also available in the MS-DOS file
editing program, EDLIN. EDLIN also offers these features:
• Append lines
• List text
• Search text
• Transfer text
Information on editing both commands and files is presented in
Part 3. You should study Part 3 thoroughly.

2
Chapter 1 / How to Use MS-DOS

The Control Keys


In addition to editing functions, MS-DOS provides a number of
control keys. A control key affects a command or command line.
The keys are listed below.
Note: When you type a control character, press the
second key while holding down the first.

Keys Function
I CTRL I CIJ stops execution of a command.
I SHIFT I I PRINT I sends everything currently displayed on the
screen to the line printer.
I PRINT I, I CTRL I 1]], sends all output to the line printer, as well as
or [CTRL I [[) to the screen. Press again to stop the function.
I BACKSPACE I or removes the last character from the command
[ CTRL I [[] line and erases the character from the screen.
I CTRL I QJ causes a line end and carriage return but does
not send the line to be executed or processed.
You can continue to add to the command line
before pressing I ENTER I to terminate input.
I HOLD I or halts scrolling. Press I HOLD I or I CTRL I (]J to
[CTRL I []] resume scrolling.
(ESC I voids the current line and clears the command
line buffer. It then outputs a backslash (\),
carriage return, and line feed. The template, a
storage area that contains the last MS-DOS
command you used, is not affected. Although
the system prompt is not displayed, the system
is ready for a command.

3
Chapter 2

ORGANIZATION OF INFORMATION

The MS-DOS system for organizing information, text, and pro-


grams on disk is efficient and easy to use. You can rename, copy,
erase, filter, and edit files.

The File System


Groups of files can be collected into directories, much as you
would use a file cabinet drawer to collect all the file folders per-
taining to a particular subject. These directories, in turn, can be
collected into larger directories.
It is important to remember this multilevel organization when
working with MS-DOS files and directories. It lets you build
downward, branching out as you go. In effect, you create an
upside-down tree of files and directories.
Each user on the system can organize material into separate
groups that are easy to locate and manage.
Here is a simplified diagram of a typical MS-DOS disk.

ROOT (\)

rl- - - - r - I- - - - I - - - - , I - - - - - - r - - - . . "
USER PAYROLL ADS format.eom find.exe dlskeopy.eom

~
JAN MIKE
~
DEPT1 DEPT2
rh
tv radio news

MEMOS
r--1 job1
~ ~
a-m n-z a-m n-z

~
staff mgrs

Note: In this manual, directory names are in upper-


case and filenames are in lowercase. This is to help
you distinguish between directories and files. With
MS-DOS, you can type all names in uppercase, lower-
case, or any combination of the two.

5
Chapter 2 / Organization Of Infornwtion

The Root Directory


Originally your MS-DOS system disk has only one directory, the
root directory, which contains all external command files. This
directory is the root from which the rest of the disk's file system
grows. The shorthand notation for a root directory is a backward
slash (\). (Type 7 on the numeric keypad with the lJ'lliMi@{) key
off.)
In the sample disk diagram on the previous page, three directo-
ries (USER, PAYROLL, and ADS) have been created directly in
the root directory. (This root directory also contains the For-
mat.com, Find.exe, and Diskcopy.com files.) Further, the USER
and PAYROLL directories each contain subdirectories (MIKE,
DEPTl, and DEPT2). Finally, the MIKE subdirectory contains a
MEMOS subdirectory. All but one of the directories on the sam-
ple disk contain files.

Filenames
Each file has a name that can be a maximum of eight charac-
ters long. You can use letters, numbers and some symbols.
Allowable characters are:
• Uppercase letters: (A-Z)
• Lowercase letters: (a-z)
• Decimal digits: (0-9)
• Symbols: $ & # o/t:. ' ( ) - ((L ' { } , !
Do not include more than eight characters in a filename. MS-
DOS truncates the filename to the first eight characters. For
example, MS-DOS truncates both Accountsl and Accounts2 to
accounts. Because two files (that are in the same directory) can-
not have the same name, MS-DOS overwrites and destroys the
old file.

Extensions
You can use an extension to provide additional information on a
file. Always precede extensions with a period ( . ); they can be a
maximum of three characters long. Do not include more than
three characters. If you do, MS-DOS truncates the extension to
the first three characters.

6
Chapter 2 / Organization Of Information

Extensions such as .new, .irs, and .pay let you create files that
have the same name (but different extensions) or they can help
you divide files into categories.
You can also use an extension to indicate file type, such as the
following:

.bas for BASIC programs


.txt for ASCII text
.dat for Data files
.obj for Object code
.rel for Relocatable code
.src for Source code
If you add the extension .dat to a file named invntory, the file-
spec becomes:
invntory.dat

Note: Once you include an extension in a filename,


you must use it whenever you specify the file.

Examples of Filenames
Some legal filenames are:
rawdata2
REPORTS
X.x
proJect%.txt
PROG1 . ba5
SAMFILE
2AR.dat
The examples below are illegal filenames:
*' isn't a legal character for names
.DATA the period can be used only to separate the file-
name and extension
open ordr a name cannot contain a space

7
Chapter 2 / Organization Of Information

Wild Cards
MS-DOS lets you use these shorthand notations in filenames and
extensions:
? The question mark indicates that any character can
occupy that position.
* The asterisk indicates that any character can occupy
that position or the remaining positions in a filename
or extension.
Wild card examples and the results you can expect are given
below.
You type: MS-DOS finds: Examples:
test?run.exe All files in one directory that test1run.exe
begin with test, have any test3run.exe
character next, followed by
run with the extension .exe.
test*.exe The files above plus all files test.exe
in one directory that begin testall.exe
with test and have the test1.exe
extension .exe.
oldfile.* All files named oldfile (in one old f i 1 e . bas
directory), regardless of their old f i 1 e . ex e
extensions. old f i 1 e . txt

Pathnames
Because directories are organized in a multilevel fashion, MS-
DOS needs exact directions or pathnames to find files. A path-
name is a list of directories and filenames from the root direc-
tory down to the file you want to access. Each pathname can
have a maximum of 63 characters.
Refer to the previous MS-DOS disk diagram. To access the Radio
file, tell MS-DOS the path to follow from the root directory to
the file, separating the branches with backslashes. For instance,
to display the contents of the Radio file, type:
t y Pe \ ads \ r a d i 0 I ENTER I

8
Chapter 2 / Organization Of Information

MS-DOS reads the pathname from left to right to determine


that the file you want is in the ADS directory and that its name
is Radio. It then lists the contents of Radio to the screen.
MS-DOS's multilevel organization and pathname conventions
help you access files quickly. You can give two files the same
name as long as they are in separate directories. Under some
circumstances, you can take a shortcut to a file or directory. For
information on how to do this, see "Current Directory" later in
this chapter.

Device Names
Each input/output device the system supports has a unique
name. The device names are as follows:
• AUX (auxiliary) usually refers to the RS-232 serial port
but can be any device you specify using the CTTY
command.
• CON (console) refers to the screen or keyboard.
• PRN (printer) refers to Printer 1.
• LPTl, LPT2, LPT3 (line printer) refer to Printer 1,
Printer 2, and Printer 3, respectively.
• COMl, COM2 (communications) refer to serial Port 1
and Port 2.
• NUL (null) refers to a non-existent device.
Note: You cannot use any of the device
names above as file names.

Directories
MS-DOS directories are collections of files. Look at the following
example to understand how they are created and used.
Assume that the disk in Drive B is newly formatted and con-
tains only a root directory. You can use EDLIN to create the test
file on Drive B. To do so, type:
e d 1 i n b: \ f i 1 e 1 . t 5 t I ENTER I

9
Chapter 2 / Organization Of Inforrrw,tion

The screen shows:


New file

The asterisk indicates that EDLIN is ready for you to enter a
command. To enter the insert mode, type:
i (ENTER I
The screen shows the line number followed by a colon and an
asterisk. EDLIN places each line you create into the text file
until you type ill] [ ENTER I or [ CTRL I lIJ [ ENTER I to end the file. You do
not type line numbers; they are entered automatically by
EDLIN.
To create a file, type:
1 :*This is my test file.[ENTERI
2:*lt shows the use of directories.[ENTERJ
3 : ill] [ ENTER I

After you type ill] I ENTER I, EDLIN displays the asterisk to indi-
cate it's ready for another command. To exit EDLIN and return
to MS-DOS, type:
e [ ENTER I

The screen displays the system prompt again. Use the DIR com-
mand, which lists the files in a directory:
d i r b: \ [ENTER J

The listing now indicates the existence of the new file:


Volume in drive B has no label
Directory of B:\
FILE1 TST 58 8-24-86 9:~7a
1 File(s) nnnnnn bytes free

The number of free bytes available in your computer's memory is


represented as nnnnnn. Your directory listings may differ from
those shown in this manual.
You can use the TYPE command to display the text stored in the
file:
t YPe b: \ f i 1e 1 . t s t [ENTER J

10
Chapter 2 / Organization Of Information

The screen shows:


This 1S my test file.
It shows the use of directories.

Use EDLIN to create two more text files.


ed1i n b: \ f i 1 e 2 • t s t [ENTER)
The screen shows:
New file

Type:
* i I ENTER I
1 : *This ism y sec 0 n d f i 1e. I ENTER I
2:*It shows the use of directories. [ENTERI
3: *Cill (ENTER I
* e [ ENTER I
Create the third file:
e d 1 in b: \ f i 1 e 3 • t s t (ENTER I
The screen shows:
New file

Type:
* i [ENTER I
1 :*This is my third file. [ENTER I
2:*It shows the use of directories. [ENTERI
3: *Cill [ ENTER I
* e [ ENTER I
Now list the directory:
di r b: \ I ENTER I

11
Chapter 2 / Organization Of Information

The screen shows:


Volume in drive B has no label
Directory of B: \
FILE1 TST 58 8-24-86 9: ~7a

FILE2 TST 60 8-24-86 9: ~9a

FILE3 TST 59 8-24-86 9: ~9a

3 File(s) nnnnnn bytes free

Creating Directories
The MKDIR command creates a new directory on any drive. To
create a new directory called MYDIR in the Drive B root direc-
tory, type:
mkdi r b: \mydi r [ENTER I
MS-DOS automatically makes MYDIR a subdirectory of the
Drive B root directory. You can check it by using DIR:
di r b: \ [ENTER I
The screen shows:
Volume in drive B has no label
Directory of B:\
FILE1 TST 58 8-24-86 9: ~7a

FILE2 TST 6~ 8-24-86 9: ~9a

FILE3 TST 59 8-24-86 9: ~9a

MYDIR <DIR> 8-24-86 9: ~9a

4 Flle(s) nnnnnn bytes free

To copy File1.tst to the new directory, use the COPY command


as follows:
cop Y b: \ f i 1e 1 . t s t b : \ my d i r \ new f i 1e 1 . t s t [ENTE R I

12
Chapter 2 / Organization Of Infornwtion

Here's what the structure looks like now:

Drive B Root (\)


I
I I

MYDIR file1.tst file2.tst file3.tst


I
newfile1.tst
Use DIR to see the name of the file in the new directory:
dir b:\mydir [ENTERI
The screen shows:
Volume in drive B has no label
Directory of B:\MYDIR
<DIR> 1-01-80 12: 33a
<DIR> 1-01-80 12: 33a
NEWFILE1 TST 58 8-24-86 9: 07a

3 File(s) nnnnnn bytes free


You can use MKDIR to create a subdirectory of MYDIR, a sub-
directory of the new directory, and so on.
Note: See "Anonymous Directory Names" in this
chapter for an explanation of the. and .. symbols.

Deleting Directories
Before deleting a directory, first remove all files in that direc-
tory. Follow these steps:
1. Use the DIR command to see what files are in the
directory.
2. Use the COPY command to copy any files you may need
to another directory.
3. Use the ERASE command to remove all files from the
directory.
4. Use the RMDIR command to remove (delete) the
directory.
If there are subdirectories in the directory you wish to delete,
follow the previously described procedure for deleting these
directories.

13
Chapter 2 / Organization Of Information

The Current Drive


The disk you are using at any given time is your current disk or
current drive. Immediately after startup, MS-DOS places you in
the root directory of the Drive A disk; Drive A is your current
drive.
Knowing about the current drive lets you take shortcuts when
specifying pathnames. It also helps MS-DOS find what you want
more quickly.
When specifying a file or directory that is not in the current
drive, you must specify the entire pathname. However, when
specifying a file or directory that is in the current drive, you
need not include the drive specification in the pathname.
For example, suppose you are in A: \. To access B: \ PAYROLL,
specify the drive and the directory name. For example:
dlr b:\payroll

To access A: \ USER, specify only the directory name. For


example:
dir \user

Changing the current drive. You can change the current drive
quickly. To do so, enter the drive specification at the system
prompt. For example, at A>, type:
b: [ENTER I
The screen shows a new system prompt, B>, to indicate you are
now in Drive B.

The Current Directory


The directory you are using at any given time is your current
directory. Immediately after startup, MS-DOS assigns the root
directory of Drive A as your current directory.
Knowing about the current directory lets you take even more
shortcuts when specifying pathnames. For example, when speci-
fying a file or directory that is higher than the current direc-
tory, and on the same disk, you must give a complete pathname
(minus the drive specification).

14
Chapter 2 / Organization Of Information

However, when specifying a file or directory that is within or


below the current directory, and on the same disk, you may
begin the pathname immediately below your current directory.
The rest of the pathname is implied.
For example, suppose you are in the directory A: \ USER \ MIKE.
To access the \ USER directory on the same disk, give the com-
plete pathname (minus the drive specification). For example: '
dlr \user

If you want to access the \ USER \ MIKE \ MEMOS directory on


the same disk, begin the pathname below the current directory.
For example:
dir memos

Notice that you should not precede this pathname with a back-
slash. That is because the pathname \MEMOS specifies a direc-
tory that does not exist-one that would be an immediate
subdirectory of the root directory.
If you are still in \ USER \ MIKE, you can specify a file in that
directory by giving only the filename. For example, if you type:
dir Job1

the complete pathname \ USER \MIKE \job! is implied.


Again, if you are still in \ USER \ MIKE and you type
MEMOS \ mgrs, the complete pathname \ USER \ MIKE \
MEMOS \ mgrs is implied.
When you enter commands, MS-DOS automatically expands
pathnames as needed. For example, if you type:
copy Job1 memos\newJob1\ENTERI

MS-DOS interprets this as:


copy \user\mike\Job1 \user\mike\memos\newJob1
[ ENTER I

15
Chapter 2 / Organization Of Information

Changing the current directory. By using the CHDIR com-


mand, you can make any directory on the current drive the cur-
rent directory. To do so, enter the CHDIR command followed by
the pathname of the new current directory. For example, to
change the current directory from A: \ to A: \ USER \MIKE,
type:
c hdi r , use r 'm ike I ENTER I
To change to a directory on another drive, simply change drives
before using the CHDIR command. For example, to change your
current directory to B: \ PAYROLL, type:
b: I ENTER I
MS-DOS puts you in the root directory of Drive B. To change to
\PAYROLL, type either of the following:
chd i r , pay r 0 11 I ENTER) or
cd 'payroll

Home Directories
MS-DOS also remembers your previous current directory. If your
current directory is B: \ PAYROLL and then you change it to
A:USER \MIKE, MS-DOS remembers that you were using
B: \ PAYROLL. For your convenience, it makes \PAYROLL the
home directory of Drive B, until you change to another Drive B
directory.
Whenever you specify a file or directory within or below
B: \ PAYROLL, you need not include the directory name PAY-
ROLL. For example, suppose you are in Drive A. If you type:
type b:staff [ENTERI

MS-DOS assumes you mean B: \ PAYROLL \ staff. Similarly, if


you type:
di r b: [ENTER I
MS-DOS assumes you mean DIR B: \ PAYROLL; it shows a direc-
tory listing of all the files in the PAYROLL directory.
Note: It does not show a directory listing of the entire
disk. For this, you must type:
di r b:' [ENTER I

16
Chapter 2 / Organization Of Information

Knowing about home directories is particularly helpful when you


copy files. Suppose you must copy several files from
A: \ USER \MIKE to B: \ PAYROLL. Make B: \ PAYROLL the
home directory of Drive B; then make A: \ USER \MIKE your
current directory. Now you can copy each file, specifying only
the filenames.
If you type:
copy Job1 b:newJob1 [ENTERI
MS-DOS interprets this as:
copy a:\user\mike\Job1 b:\payroll\newJob1 [ENTERj

Anonymous Directory Names


If you need to refer to your current directory, or to a higher level
directory and do not know the full pathname or just want to save
typing time, you can use name substitutes. For example:
• The name "." refers to the current directory.
• The name ".. " refers to the parent of the current direc-
tory (the next highest-level directory in the path).
• The name" .. \ .. " refers to the directory two levels up.
You can use anonymous names in place of pathnames and/or as
the first names in pathnames. Some examples:
di r . [ENTER I
lists filenames in the current directory.

era s e .. \ t a xes 84 I ENTER I

deletes the Taxes84 file from the current directory's parent


directory.
Substitute names may refer to either the current directory or
the home directory of another drive, depending on whether or not
you include a drive specification. For example:
erase b: .. \taxes84 [ENTERI
deletes the Taxes84 file from the parent directory of the home
directory of Drive B.

17
Chapter 2 / Organization Of Information

If you want to copy several files from A: \ USER \ MIKE to


B: \ PAYROLL, make A: \ USER \MIKE the current directory of
Drive A and use CHDIR (CD) to change the Drive B directory to
B: \ PAYROLL. Then type:
b: IENTER J
copy a:job1 IENTERJ
This will be interpreted as: COPY A: \ USER \ MIKE \jobl
B: \ PAYROLL \jobl.

18
Chapter 3

REDIRECTING COMMANDS

MS-DOS assumes that command input comes from the keyboard


and output goes to the screen. However, you can redirect input so
it comes from a file and output so it goes to a file or a line
printer. In addition, you can create pipes that let one command's
output become another's input.

Input and Output


To redirect input so it comes from a file, use a less-than sign «)
in your command. For example:
s0 r t < n a me s (ENTER I

sorts the information in the file Names and displays the sorted
output.
To redirect the output of the DIR command so it goes to a file,
use a greater-than sign (» in your command. For example:
dir >myfiles [ENTERI

sends a directory listing to the file Myfiles in the current direc-


tory. If Myfiles does not already exist, MS-DOS creates it and
stores the listing in it. If Myfiles does exist, MS-DOS overwrites
the old information with the new information.
Append. To add your output to the end of an existing file, use
two greater-than signs. For example:
di r »myf lies I ENTER I
appends your directory listing to the file Myfiles in the current
directory. If Myfiles does not exist, MS-DOS creates it. Here is
an example in which both the input and output are redirected:
sort <names >list1 (ENTER)

This command sorts the information in the file Names and sends
the sorted output to the file Listl in the current directory.

19
Chapter 3 / Redirecting Commands

Filters
A filter is a command that operates on data in some way before
outputting it-usually to the screen or a file. The MS-DOS fil-
ters and functions are:
• FIND - Searches for occurrences of a requested string
of text in a file.
• MORE - Causes screen output to be displayed, one
screen at a time. To view the next screen, press any key.
• SORT - Sorts text from A-Z or from Z-A (reverse sort).
Note: By combining commands and filters, you
can replace several commands with a few filters,
as described below.

Command Piping
Piping lets you give more than one command at a time to the
system. It does this by making one command's output another
command's input.
To pipe commands, divide them with the pipe separator, the ver-
tical bar ( I ). (You produce the vertical bar by pressing 4 on the
keypad when the [NUM LOCK I key is off or by pressing [SHIFT I 4 on
the keypad when the [NUM LOCK) key is on.) All output generated
by the command to the left of the bar becomes input for the com-
mand to the right.
For example, you can sort your directory listing. Type:
di r I 5 0 r t [ENTER I
to display an alphabetically sorted listing of the current direc-
tory. This command:
di r I so r t > d irE' C • f i 1 [ENTER I
sends the same listing to the file Direc.fil in the current direc-
tory. If the file does not exist, MS-DOS creates it.
di r b: I >b : d irE' C • f i 1 [ENTER I
makes an alphabetically sorted listing of the current directory of
Drive B and sends the listing to the file Direc.fil in the home
directory on Drive B. MS-DOS creates the file, if necessary.

20
Chapter 4

BATCH FILES

Executing Several Commands


Some tasks require two or more commands. For example, when
preparing a disk for information storage, you must format the
disk so you can write to it (FORMAT command). In addition, it
is a good habit to immediately check the directory of the new
disk for errors (CHKDSK command).

The Batch File


You can put a command sequence into a special file called a
batch file. Then you can execute the entire sequence by entering
the name of the batch file.
To create a batch file, you can specify the complete pathname or
a filespec. In either case, give the file the extension .bat. When
you execute the file, however, enter the filename without the
extension.
Below is a description of how to use the COPY command to cre-
ate a batch file. (You can also use EDLIN; see Part 3.)
Creating a Batch File. To create a file to perform a command
sequence of FORMAT and CHKDSK, type this at the system
prompt:
copy con prepdisk .bat [ENTER I

This command tells MS-DOS to copy the information entered


from the keyboard (console) into a batch file called prepdisk.bat.
Because you do not specify otherwise, MS-DOS creates the file
in the current directory.
MS-DOS displays the cursor. Now you can type the commands to
be included in the file:
rem Thls prepares and checks new disks [ENTERI
rem i t i s calle d Pre p dis k . bat I ENTER I
for ma t B: I ENTER I
pause I ENTER I
c h k d s k B: I ENTER I

21
Chapter 4 / Batch Files

To save the commands in a file, type ffiJ I ENTER I or I CTRL I [IJ


[ENTER I. MS-DOS displays "Z to indicate you used the control
character. Then it displays:
1 File(s) Copied

At this time, you can type d i r [ENTER I to verify that the file is
created.
REM and PAUSE. You use REM and PAUSE only in batch files.
The REM command lets you include remarks in your batch file
that will not affect the operation of the command. The remarks
in the prepdisk.bat file are to remind you what the file does.
Should you forget, you can type:
type prepdisk.bat [ENTER I
and MS-DOS displays the contents of the file, including the
remarks.
The PAUSE command lets you control how much of the file you
want to execute. When it reaches a PAUSE command, MS-DOS
pauses and displays the message:
Strike a key when ready . . .
You may continue execution by pressing any key, or you can halt
it by pressing [ CTRL 1 cn
Executing a Batch File
To execute your batch file, you must be in the directory that con-
tains the file. (See "The Current Directory" in Chapter 2.) Then,
enter the filename without the extension. For example, to execute
prepdisk.bat, type this at the system prompt:
pre p dis k [ENTER I
Execution proceeds just as if you entered each command line at
the keyboard.

22
Chapter 4 / Batch Files
,-----

A word of advice about Batch Files. If you are not familiar


with MS-DOS, we recommend that you create all batch files in
the root directory of your disk. Later, when you better under-
stand MS-DOS, you may want to create batch files elsewhere.
You can do this by specifying a complete pathname for the file. If
you do so, however, keep in mind the following:
• To execute a batch file, you must be in the directory
that contains the file. (That directory becomes your
current directory and that drive becomes your current
drive.)
• MS-DOS searches only the current directory for exter-
nal commands. If you use any external commands in
your batch file, you need to do one of the following:
Use the PATH command to tell MS-DOS to
search for external commands in the directory
that contains the commands.
Use the COpy command to move your external
commands to the directory that contains your
batch file.
Use the CHDIR command within your batch file
to move from one directory to another as
necessary.

Summary of the Batch File Process


1. Create the file by typing:
copy con pathname.bat [ENTERj

2. Enter the command lines.


3. Save the file by typing either of the following:
1m I ENTER I or
(CTRL I mI ENTER j
4. When you are in the directory that contains the file,
execute the file by typing:
f i 1 ename I ENTER I

23
Chapter 4 / Batch Files

The Autoexec.bat File


An autoexec.bat file executes programs or commands automati-
cally when you start MS-DOS. By creating an appropriate batch
file, you can run an application program or execute a series of
commands each time you start the system.
When you start MS-DOS, the command processor searches the
MS-DOS disk for a file called autoe;;ec.bat. If MS-DOS finds the
file, it immediately executes it.

Note: If you use an autoexec.bat file, MS-DOS prompts


for a current date and time only if you include the
DATE and TIME commands in the file. Because MS-
DOS uses this information to keep the directory cur-
rent, you should always include these commands.

Creating an autoexec.bat file. The autoexec.bat file must be


created in the root directory of your MS-DOS disk. (You must be
in that directory when you create the file.) You create it the
same way as any other batch file, except that you name it
autoexec.bat.
To create and save a file that loads BASIC and runs a BASIC
program named MENU each time you start MS-DOS, type:
copy con autoexec.bat [ENTERI
d ate ( ENTER I
tim e i ENTER)
ba51c menu (ENTERI
1m [ENTER)
Batch Files With Replaceable Parameters
When creating a batch file, you may want to include replaceable
(dummy) parameters. In this way, you can use different sets of
data when you run the file. For example, the prepdisk.bat file
shown earlier is changed in the following listing to include the
dummy parameter %1.
cop y con pre p d 15k. bat I ENTER]
rem Thi5 prepare5 and check5 new d15k5 I ENTER I
rem in the drive you 5peclfy [ENTER)
rem I t 1 5 calle d Pre p d i 5 k . bat (ENTER)
format %1 ! ENTER)
c h k d 5 k %1 I ENTER i
1m I ENTER I

24
Chapter 4 / Batch Files

To use this file to format the Drive B disk, enter the batch file
name and the drive specification to replace %1, as shown here:
pre p dis k b: [ENTER I
The next two sections tell more about creating and executing
batch files that have dummy parameters.

Creating a Batch File With Replaceable Parameters


The dummy parameters are %0 through %9. MS-DOS always
replaces the %0 parameter with the filename of the batch file,
unless you use the SHIFT command. It replaces the other
dummy parameters, sequentially, with the parameters you spec-
ify when you execute the batch file. (See the SHIFT command in
Part 2 if you wish to specify more than ten dummy parameters.)
These parameters may be pathnames, drive specifications,
numeric values, or almost anything else. For example, if you
type:
copy con myfile.bat [ENTERI
copy %1.mac %2.mac [ENTERI
type %2. mac [ENTER I
t YPe %0 • bat I ENTER I
ill] [ ENTER I
MS-DOS creates the batch file myfile.bat in the current direc-
tory and stores the next three lines in that file.
When you execute the file, the parameters %1 and %2 are
replaced sequentially by the pathnames you supply.

Executing a Batch File With Replaceable Parameters


To execute a batch file that has replaceable parameters, enter
the batch filespec (without its extension), followed by the param-
eters to replace the dummy parameters. For example, to execute
myfile.bat, type:
myf i le a: prog1 b: prog2 [ENTER I
myfile is substituted for %0, A:prog1 for %1, and B:prog2 for %2.

25
Chapter 4 / Batch Files

The result is the same as if you had entered each command with
its parameters, as follows:
copy a: prog1 . mac b: prog2. mac [ENTER I
tyep b:prog2.mac [ENTER]
type myflle.bat [ENTERI

The COpy command copies the contents of one file to another


file. The TYPE command displays the contents of a file.

Sample Use Of Replaceable Parameters


Replaceable parameters can be useful with application programs.
Suppose you have a program that creates a client mailing list
and saves the list to the nwil.dat file in the root directory of
your system disk.
The information in nwil.dat might look like this:

Tom Cleo 2 8 t h 5t. Lincoln NE 68502

Ann King 9th Av. Rapid Cl1y 5D 57001

5am Beck 4 6 t h 5t. Ft. Worth TX 76133

As you can see, the information is in random order. Using a


batch file with replaceable parameters, however, you can organ-
ize the information in any way that is most convenient at any
given time. One time, you might organize it according to zip
code; another time, according to last name; and so on. To create
such a batch file, type the following:
copy con mailsort.bat [ENTER]
copy mail.dat %1 .dat [ENTER]
t YP e %1 . d at [ENTER I
so r t %2 < %1 . d at> %3 . d at I ENTER J
type %3.dat (ENTER]
[ill [ ENTER I
Execute the batch file by typing:
mailsort newmail /+5 sort [ENTERJ

26
Chapter 4 / Batch Files

The result is the same as if you had entered each command with
its parameters, as follows:
copy mail.dat newmall.dat IENTER]
type newmail.dat [ENTER]
50rt/+5 <newmall.dat >50rt.dat (ENTER]
type 50rt.dat [ENTERI

MS-DOS copies the information from Mail.dat into Newmail.dat


and then displays the contents. Starting at Column 5, it alpha-
betically sorts the file Newmail.dat and copies the sorted data to
the file Sort.dat. Then it displays Sort.dat.

Reminders About Batch Files


The following list summarizes information you should know
before you execute a batch process with MS-DOS.
• Do not enter the filename batch (unless the name of
the file you want to execute is batch.bat).
• To execute a batch file, enter the filename without the
extension.
• The commands In the file named filename.bat are
executed.
• If you press [CTRL] CO while In the batch mode, this
prompt appears:
Terminate batch Job (YIN)?

If you press Y, MS-DOS ignores the rest of the com-


mands in the batch file. The screen displays the sys-
tem prompt.
If you press N, the current command ends. Batch pro-
cessing continues with the next command in the file.
• Removing the disk that contains the batch file being
executed will cause an error.
• Immediately upon executing one batch file, you may
call another. To do so, put the second file's name
(without its extension) as the last command in the
first file.

---_._---_._--------
27
Chapter 4 Batch Files

• In a batch file, you may want to refer to a file whose


name contains a percent sign. For example, you may
want to include a command that copies a file called
Abco/c.exe. As you know, the batch file normally inter-
prets the percent sign as a replaceable parameter. To
indicate that this is not the case, you must include a
second percent sign. The batch file command, then,
might be this:
copya:\user\abc%%.exe b:\user

28
Chapter 5

MS-DOS COMMANDS

There are two types of MS-DOS commands, internal and exter-


nal. Internal commands are the simpler, more commonly used
commands. When you list a directory, you cannot see these com-
mands. When you enter them, they execute immediately.
External commands reside on disks as program files. Therefore,
MS-DOS must read them from disk before it can execute them.
If the disk containing the command is not in the drive, the sys-
tem cannot find and execute the command.

Note: Unless MS-DOS knows in which directory or


drive to search for external commands, it cannot exe-
cute them. (See the PATH command.)

Any filename that has an extension of .com, .exe, or .bat is con-


sidered an external command. For example, programs such as
FORMAT. COM and DISKCOPY.COM are external commands.
You may create external commands and add them to the system.
Programs that you create with most languages (including
assembly language) are .exe (executable) files.
When you enter an external command, do not include its file-
name extension.

29
Chapter 5 / MS-DOS Comnwnds

Quick Reference To MS-DOS Comlnands


COMMAND PURPOSE
APPEND Sets a data file path
ASSIGN Reassigns dri ve names
ATTRIB Sets or displays file attributes
BACKUP Copies disk files to floppy disk
BREAK Alters (CONTROL IiI] operation
CHDIR/CD Changes current or home directories
CHKDSK Checks MS-DOS diskettes
CLS Clears the video screen
COMMAND Starts a new command processor
COPY Copy, append or combine files
COPYDOS Copy system files to application diskettes
CTTY Switches input/output to device
DATE Enter or change system date
DEL Deletes files from specified directory
DIR Displays files from specified directory
DISKCOMP Compares two diskettes
DISKCOPY Makes copies of floppy diskettes
DISKTYPE Determines format of non-standard
diskettes
ECHO Controls display of lines in batch files
ERASE Deletes specified files
EXE2BIN Converts exe files to binary format
EXIT Exits from commands to previous level
FC Compares contents of two files
FDISK Partitions a hard disk
FIND Searches for specified text

30
Chapter 5/ MS-DOS Commands

COMMAND PURPOSE
FOR Executes several items with one
command
FORMAT Prepares disks for system use
GOTO Jumps to selected routine in batch files
GRAPHICS Copies screen graphics to printer
HFORMAT Prepares a hard disk for system use
HSECT Formats hard sectors on a hard disk
IF Allows conditional execution in batch
files
JOIN Joins a disk drive to a pathname
KEYTXX Replaces the current keyboard program
LABEL Modifies a volume label
LF Suppresses the line feed after a carriage
return
LPSETUP Enables a printer filter that allows
pagination
MKDIR/MD Creates a new directory
MLFORMAT Formats a hard disk partition
MLPART Creates a hard disk partition
MODE Sets video, printer, and communication
parameters
MORE Stops screen scroll - awaits key press
PATCH Modifies a disk file
PATH Specifies path to external commands
PAUSE Suspends batch execution, displays
message
PRINT Background printing of up to 10 files
PROMPT Creates a new system prompt
RECOVER Recovers bad sectors on a disk

31
Chapter 5 / MS -DOS Commands

COMMAND PURPOSE
REM Allows comments in a batch file
RENAME/REN Change (Rename) filenames
REPLACE Updates previous versions of a file
RESTORE Copies files from diskette to hard disk
RMDIR/RD Deletes a specified directory
SELECT Changes the curent country code
SET Establishes a common replacement
parameter
SHARE Installs file sharing and locking
SHIFT Moves replaceable parameters in batch
files
SHIPTRAK Parks hard disk heads
SORT Sorts input from keyboard or a file
SPOOLER Sends commands to the printer spooler
SUBST Substitutes a virtual drive name for a
pathname
SYS Transfers system files to disk
TIME Displays or sets system time
TREE Display all disk directories and files
TYPE Displays contents of specified file
VER Displays MS-DOS version number
VERIFY Verifies that files are intact
VOL Displays volume label of specified disk
XCOPY Copies files and directories

32
Chapter 5 / MS-DOS Commands

How to Use the Comnland Reference


Command lines can be divided into two parts, the command
name and the command parameters. Some parameters are
required; others are optional. If you omit an optional parameter,
the system provides a default parameter. For example, the sys-
tem defaults to the current drive whenever you omit the drive as
part of a pathname.
Required and optional parameters and default values vary with
different commands. Here is an example of how to interpret com-
mand lines:
COpy source pathname [target pathname] [/A][/BUIV]
• COPY is the command name you type to call up the
COPY function. Although you may enter a command
name in either uppercase or lowercase, for your conven-
ience command names are presented in uppercase in this
manual.
• source pathname is a required parameter. Parameters
not surrounded by brackets are essential to the operation
and must be included in the command line. In this case
source pathname is the name of the file you wish to copy.
Example: COpy myfile.
• [target pathname] is an optional parameter. Include
descriptions or values for parameters surrounded by
brackets only if you wish to change the default descrip-
tion or value. In this case if you omit target pathname,
MS-DOS will give the new copy the same filename as
the original file.
• [fA], [/B], and [IV] are optional switches. Again, include
them in the command line only if you wish to change the
default settings of these switches. In this case the
switches are used to copy files in ASCII format and to
add or delete EOF characters from the files.

33
Chapter 5 / MS -DOS Commands

Command Structure And Syntax


• The default system prompt is the current drive designation
followed by a greater-than sign. For example, A> tells you
that Drive A is your current drive and that MS-DOS is ready
to accept a command. You can use the PROMPT command to
change the default prompt.
• Commands are usually followed by one or more parameters.
• You can enter parameters in uppercase, lowercase, or any
combination.
• You must separate commands and parameters with delim-
iters. The space and comma are the easiest to use. Examples:
del myfile.old newfile.txt

rename,aflle bfile

• You may also use the semicolon, equal sign, or tab as


delimiters. This manual uses a space.
• Source specifies the disk from which you transfer information.
Target specifies the disk to which you transfer information.
Some error messages refer to the destination. This is the same
as the target.
• When typing commands, you may use the MS-DOS editing
and function keys. (See Chapters 1 and 8 for editing
information.)
• Commands execute only after you press [ENTER I.
• Pressing [CTRL I III halts a command when it is running.
• When a command produces more output than the screen can
display, the display begins to scroll up. To stop scrolling, press
[ HOLD I. To resume, press [ HOLD I again.

34
Chapter 5 / MS-DOS Commands

Organization of lVIS-DOS Commands


The MS-DOS commands in Part 2 are arranged in the following
order:
• The command name and type (external or internal).
• The command syntax: a guide for entering the command.
• Parameters: a list of all command parameters and their
functions.
• Notes and Suggestions: information and suggestions about
using the command.
• Examples: samples of how to use the command.

Note: Part 6 contains a complete listing of the error


messages associated with the MS-DOS commands.

The Use of Special Type


BOLD A command keyword. Unless noted otherwise,
UPPERCASE you can type an entire command in any com-
bination of uppercase and lowercase letters.
UPPERCASE Information you type exactly as it appears.
lowercase italics Variable words, letters, characters, or values.
[] An optional command parameter. (Do not type
the brackets.)
· .. (ellipsis) The preceding parameter can be repeated.
[ KEYNAME I A key on your keyboard.

Note: Type all other punctuation exactly as shown in


the syntax line of the command.

35
Chapter 5/ MS-DOS Commands

Also, certain commands listed in this manual are valid only for a
specific version of MS-DOS or apply only to hard disk systems.
These commands are indicated as follows:
~MS-DOS ~MS-DOS /#c~ MS-DOS
r 8 jV2.U [§o IV3.2 \~~
I ~J!) hard disk
o Command 'Command ~ Command
If you are not sure which version of the operating system your
computer uses, type VER I ENTER I.

SynonylIlous Keywords
Some commands give you a choice of keywords to accomplish the
same task. Fbr example, you can type either DEL or ERASE when
deleting files. You can also shorten MKDIR to MD, CHDIR to CD,
and RMDIR to RD.

36
Chapter 6

COMMAND REFERENCE

APPEND External
~~ APPEND [pathnameJ [;[pathnameJ ... J
Sets a search path for data files.

Parameters
pathlWme specifies the drives and/or directories that MS-DOS
searches for a data file.

Notes and Suggestions


• You can specify more than one path to search by separating
each path with a semicolon (;l.
• If you use the Append command with no options, MS-DOS
displays the current data path.
Append ;
sets no data path. MS-DOS searches only the working direc-
tory for data files.
• Append searches the data path for all files, regardless of their
file extensions, only with the following MS-DOS system calls:
Code Function
OFH Open File (FCB)
23H Get File Size
3DH Open Handle
• You can use the Append command across a network to locate
remote data files.
• If you are using both the MS-DOS Assign and Append com-
mands, you must type the Append command before Assign.

_ ._ _ •• o. •• _

37
Chapter 6 / Command Reference

Example
Suppose you want to access data files in a directory called LET-
TERS on drive B and in a directory called REPORTS on drive
A. To do this, type:
append b:letters;a:reports

38
Chapter 6 / Command Reference

ASSIGN External
I ~ 1 ASSIGN [drivel [=] drive2 [. ..]]
Reassigns drive names (letters). MS-DOS will route requests for
a disk drive to the reassigned drive.

Parameters
drivel is the drive letter you wish to reassign.
drive2 is the drive letter to be given drivel.

Notes and Suggestions


• ASSIGN lets you use application programs on drives other
than those for which they were specifically designed. A pro-
gram designed to only operate on Drives A and B could be
used on fixed Drive C.
• This command does not require a colon after the drive letter.
• If you enter ASSIGN without parameters, all drives are reas-
signed to their normal designation (drive letter).
• You should take care when reassigning drives used with MS-
DOS or an application program. Some functions will expect to
find data or information on a specific drive and ASSIGN could
make the data or information unaccessible.
• DO not use ASSIGN with JOIN, PRINT, or SUBST.
• DISKCOMP, DISKCOPY, and LABEL do not allow assigned
drives as parameters.

Example
assign a=c b=c

routes all requests for Drive A or Drive B to Drive C.

39
Chapter 6 / Command Referem;e

ATTRIB External
G-~l
',3.2) ! ATTRIB [read][archive] pathname
Sets or resets the read-only and archive attributes of a file; dis-
plays the attributes of a file.

Parameters
read can be either + R or - R. + R sets the read-only attribute
of a file to ON. - R sets the read-only attribute of a file to OFF.
archive can be either + A or - A. + A sets the archive attribute
of a file to ON. - A sets the archive attribute of a file to OFF.
path name is the path to the file you wish to reference.

Notes and Suggestions


• If an application opens a file with read and write permission,
ATTRIB can force a read-only condition to allow file sharing
over a network.
• To display the attribute of a specific file, type
at t r 1 b pa t h name [ ENTER I
• The wildcard characters "'. '" can be used to print the attri-
butes of all files on a specific drive.
• If you omit the optional parameters, ATTRIB displays the
attribute settings of the file specified by pathname.

Example
attrib +r myflle.txt

turns on the read-only attribute of Myfile.txt.


attrlb +a myflle.txt

turns on the archive attribute of Myfile.txt.

40
Chapter 6 / Command Referem;e

BACKUP External
I Q
Y
I
~=D~.~.~ BACKUP
I .~.~ [/D:date]
[pathname] drive: [IS] [1M] [fA]

Copies (backs up) one or more files from a hard disk to floppy
disks (diskettes). To use files that are on backup diskettes, you
must use the RESTORE command to copy them back to hard
disk. Do not try to use them otherwise.

Parameters
pathname specifies the file you want to back up.
drive: specifies the disk to receive the files.
IS causes BACKUP to copy all files in the specified directory
and all directories below it.
1M causes BACKUP to copy only those files that have been modi-
fied since the last backup.
IA tells BACKUP to add the files (to be backed up) to the
diskette already in the specified drive, rather than prompting
you to insert a new diskette.
If you omit the IA parameter, BACKUP asks you to insert a
diskette. Then, before backing up any hard disk files, it erases
any existing files on the diskette. When the diskette is filled,
BACKUP asks you to insert another. Be sure to label each
diskette so you know the proper order of the backups.
lD:date copies only those files created on or after the date speci-
fied (in the mm-dd-yy format).

Notes and Suggestions


• Loss of information stored on hard disk, although not likely,
can be disastrous-simply because of the amount of informa-
tion. Therefore, you should always keep and update floppy
diskette copies of all hard disk information.
• If you have several files to back up, you may want to create a
batch file consisting of the necessary backup commands. Then
you can do all the backups simply by running the batch file.
(See information on Batch Files in Chapter 4.)

41
Chapter 6 / Command Reference

• BACKUP works best if BUFFERS = 5 (or greater) in the


CONFIG.8YS file. (See Appendix B.)

Examples
b a c k up *. * a: (ENTER I

backs up all the files in the current directory. You must first use
the FORMAT command to prepare several diskettes for informa-
tion storage. Then insert the first formatted diskette into Drive
A and type the command as above. Whenever it fills a diskette,
BACKUP prompts you for another.
backup lnvntory.dat a: la (ENTERI

adds the hard disk file inuntory.dat to a backup diskette when


the file is in the current directory.
backup *.bat a: [ENTERI

backs up all batch Cbat) files from the current directory to Drive
A. This command erases any existing files on the diskette before
copying files to it.
b a c k up c: 5 tor e 1 \ 5 ale 5 • da t a: I a (ENTER I
backs up the file sales.dat that is in the STOREl directory in
Drive C to the diskette in Drive A, without erasing the
diskette's existing files.
backup *.* a:/m[ENTER]

backs up (to the diskette in Drive A) all files in the current


directory that have been modified since the last backup.
b a c k up c: \ a: I 5 [ENTER I

backs up (to the diskette in Drive A) all files in all directories


on Drive C.

42
Chapter 6 / Command Reference

BACKIJP External

I~~I
BACKUP [pathname]drive: [IS] [1M] [/A]
3.2
[lP] [lD:mm-dd-yy][lT:hh:mmx]
[/L:filename]
Backs up one or more files from a hard disk to a floppy disk.

Parameters
pathname is the path to the hard disk file you want to back up.
drive: the disk to receive the files.
/S produces a backup of subdirectories also.
/M backs up only those files that have been changed since the
last backup.
/A adds the specified files to those already on the backup floppy
disk. The existing files on the floppy diskette are not erased.
/P saves the file copies in a "packed" format that conserves
diskette space. It creates a subdirectory on the floppy diskette if
that is the only way to fill the floppy diskette. Warning: IBM'M
BACKUP/RESTORE compatibility can be lost if this switch is
used.
!D backs up only those files that were last modified at or after
the specified date.
/T backs up only those files that were last modified at or after
the specified time. hh can be 01-12. mm can be 00-59. x can be
a for a.m. or p for p.m.
/L creates a backup log entry in the file specified. If not speci-
fied, the file is given the name Backup.log, and is placed in the
root directory of the diskette. The first line of the file contains
the backup date and times. Each subsequent line contains the
filenames and the number of the floppy disk on which the files
are stored. This information is useful when restoring a particu-
lar file from a floppy diskette. By looking at Backup.log file, you
know which disk to specify for restore. On subsequent restore
operations, because Backup.log already exists, the current entry
is appended to the file.

43
Chapter 6 / Command Reference

Notes and Suggestions


• Unless otherwise specified, the old files on a backup floppy's
root directory are erased before new files are added.
• If more than one diskette is required, BACKUP prompts you
to exchange diskettes when the current diskette is full.
• If you try to backup a shared file that you do not have access
to, PATHNAME\FILENAME.EXT Not able to backup at
t his t 1 me is displayed.
• BACKUP files contain control data, and are not usable.
• BACKUP exits with ERRORLEVEL set as:
o - Normal completion
1 - No files found to backup
2 - Some files not backed up due to file sharing conflicts
3 - Terminated by {Ctrl-Break}
4 - Terminated by error
• If the target is a fixed disk, the backup files will be placed in
a subdirectory named \ BACKUP. If the target is a floppy,
the files are placed in the root directory.
• The source disk should not be write-protected.

Examples
backup c: a: Is

copies the files in the current directory of Drive C: to a diskette


in Drive A. This operation erases any existing files on the Drive
A diskette.
backup c: myfiles a: la

copies the files Myfile from the current directory of Drive C: to


the floppy diskette in Drive A. This operation adds the new file
to the files already on the Drive A diskette, without erasing any.
backup *.* a: Ip
copies all files in the current directory to the diskette in Drive
A. The files are packed on the diskette as economically as possi-
ble. Any existing files on the diskette in Drive A are erased.

44
Chapter 6 / Command Reference

backup c: store1 a: Ii Id

copies to Drive A only those files from the STOREI (this


assumes STOREI is a directory) directory on Drive C: that have
been updated (changed) since the last BACKUP operation. Cre-
ates a Backup.log file in the ROOT directory of Drive C:.

45
Chapter 6 / Command Reference

BREAK Internal
BREAK switch
Turns the [CTRL I [TI check on or off or displays the current set-
ting. The BREAK command affects only application programs. It
has no affect at the MS-DOS command level or to BASIC
programs.

Parameters
switch can be ON or OFF.
ON tells MS-DOS to check for I CTRL I [TI from the keyboard
whenever an application program makes any type of MS-
DOS function call.
OFF tells MS-DOS to check for a ! CTRL I [TI only when a
screen, keyboard, printer, or serial port function call is
made.
If you omit both ON and OFF, MS-DOS displays the current set-
ting of BREAK.

Examples
b rEa k 0 ff I ENTER I
turns off the MS-DOS [CTRL I [TI check. Use this command before
running an application program that uses the [CRTL] m
function
key. Pressing I CTRL I [TI will affect your program instead of the
operating system.
b rEa k 0n I ENTER I
turns the [CTRL I [TI check on. Use this command after you have
finished running your application program and are planning to
use MS-DOS.
b rEa k [ENTER I
displays the current setting of the I CTRL I [IJ check.

46
Chapter 6 / Command Reference

CHDIR Change Directory) Internal


CHDIR [pathname]
CD [pathname]
Changes the current, or home, directory of the specified drive to
the directory specified by pathname. CHDIR also verifies the
current directory.

Parameters
pathname specifies the directory that is to be the current direc-
tory. Pathname must be another directory on the current disk. If
you are changing the home directory of a disk other than the
current disk, you must specify the drive that contains the direc-
tory. Pathname must be another directory on that disk.
If you omit pathname, MS-DOS displays the pathname of your
current directory. This lets you verify a directory change or the
name of a directory should you forget.

Notes and Suggestions


• Changing directories before entering commands can save you
considerable time. When executing an application program,
you are likely to store your information in several data files in
the same directory. Therefore, it may be convenient to make
that directory your current directory.

Suppose you use a mailing list program to keep track of mag-


azine subscriptions. You might create 3 data files: one sorted
by your customers' last names, another by zip code, and
another by subscription expiration date.

You can store all three files in a directory called \ MAG-


MAIL. When running the program, make \ MAGMAIL your
current directory. Then you can quickly access and transfer
data between files.
• HARD DISK USERS: Because you are likely to store several
application programs on your hard disk, you may want to put
each in a separate directory (see MKDIR). For example, you
may want to store an accounts receivable program in a direc-
tory called \ AR. When you are ready to use the program, use
CHDIR to make \AR your current directory.

47
Chapter 6 / Command Referem:e

Examples
b: [ENTER I
c h d 1 r \ use r (ENTER I
changes the current drive to Drive B, then changes the current
directory to \ USER.
chd1 r " I ENTER]
puts you in (changes your current directory to) the parent direc-
tory of your current directory, if you are in a subdirectory.
chd i r \ I ENTER j

puts you in the root directory of the current disk.


chdir \bin\user [ENTERj

puts you in the directory \ BIN \ USER on the current disk.


c h d 1 r [ENTER j

displays the pathname of your current directory. If, for example,


you are in the directory \ BIN \ USER on the disk in Drive B,
MS-DOS displays B: \ BIN \ USER.
c h d 1 r b: \ use r [ENTER J

changes the current directory of Drive B to USER.


chdlr \user\letters [ENTER]
chdlr b:\user\memos [ENTERI

(1) changes the current directory on Drive A from the root direc-
tory to \ USER \ LETTERS and (2) changes the current directory
of Drive B from the root directory to \ USER \MEMOS. Now,
instead of typing:
copy b:\user\memos\filename
a:\user\letters\filename (ENTERJ

for every file you copy between the two directories, you need only
type:
copy b:filename filename

for each file you copy.

48
Chapter 6 I Command Reference

CHKDSK! hf'ck Disk! External


CHKDSK [pathnamel] [IF] [IV] [>pathname2]
Checks the directory of the disk in the current or specified drive
for errors. After checking the directory, CHKDSK displays the
proper error messages, if any, and then gives a status report. If
you wish, you may redirect the output from CHKDSK to a file.

Parameters
pathnamel specifies an entire disk or an individual file to check.
If you specify a file, CHKDSK displays information about both
the drive and the file.
IF tells CHKDSK to correct any errors it can and update the
disk. Do not use this parameter if you include a pathname.
IV causes CHKDSK to display messages while it is running and
gives detailed information about any errors it finds.
pathname2 specifies the file to which CHKDSK is to redirect its
output. Do not use this parameter if you use the IF parameter.

Notes and Suggestions


• CHKDSK does not wait for you to insert a diskette.
• Run CHKDSK occasionally for each disk, to ensure file
integrity.
• Here is a sample report produced by CHKDSK. The numbers
vary on different disks.
362496 byte5 total d i 5 k 5pace
23552 byte5 In 2 hidden file5
1024 byte5 in 2 directorIe5
331776 byte5 In 8 U5er file 5
6144 bytes avaIlable on dis k

114688 bytes total memory


88800 bytes free

The report includes two hidden files. These are the system
files. You cannot see these files when you use the DIR
command.

49
Chapter 6 / Command Reference

• The following errors are corrected automatically by the IF


parameter. For more information on these errors, see Part 6.
• Invalid sub-directory entry
• Cannot CHDIR to filename, tree past this point not
processed
• First cluster number is invalid, entry truncated
• Allocation error, size adjusted
• Has invalid cluster, file truncated

Examples
c h kd s k / f [ENTER I

checks the directory of the current disk, displays the errors, asks
if you want to fix them, and acts accordingly.
c h kd s k b: / v (ENTER I
checks the directory of the disk in Drive B, displaying
the name of every directory and file on the disk, and
reports on progress. CHKDSK asks if you want to fix
any errors. It cannot do so, however, until you specify
the IF switch.
chkdsk b:>\user\tom\errors [ENTERj

checks the directory of the disk in Drive B and outputs any


errors to the file Errors in the USER \ TOM directory that is on
the current disk. CHKDSK asks if you want to fix any errors. It
cannot do so, however, until you specify the IF switch.

50
Chapter 6 / Command Reference

CLS (('lear Screen) Internal


CLS
Clears the screen.

Notes and Suggestions


Use the CLS command to clear a cluttered, hard-to-read screen.

Examples
c 1 5 [ENTER I
clears the monitor screen and moves the prompt and cursor to
horne position (the top left corner of the screen).

51
Chapter 6 / Command Reference

COMMAND External

3.2 '
COMMAND [pathname] [device:] [IF] [IE: size]
[Ie string]

Starts the command processor.

Notes and Suggestions


• This command starts a new command processor (the MS-DOS
program that contains all internal commands),
• The command processor is loaded into memory in two parts:
the transient part and the resident part. Some application pro-
grams write over the transient part of COMMAND.COM
when they run. When this happens, the resident part of the
command processor looks for the COMMAND. COM file on
disk so it can reload the transient part.

Parameters
pathname tells the command processor where to look for the
COMMAND.COM file if it needs to reload the transient part into
memory.
device: lets you specify a different device (such as aux) for input
and output. See the CTTY command in this chapter for more
information.
IP tells COMMAND.COM not to exit to a higher level.
IE:size specifies the environment size, where size is the size in
bytes. The size may range between 128 and 32768 bytes. The
default value is 128 bytes.
If size is less than 128 bytes, MS-DOS defaults to 128 bytes and
gives the message:
Invalid environment size specified

If size is greater than 32768 bytes, MS-DOS gives the same


message, but defaults to 32768 bytes.
IC string tells COMMAND.COM to execute the command or
commands specified by string and return. IC can only be the last
parameter.

52
Chapter 6 / Command Reference

COpy Internal
COpy source pathname [target pathname]
[/~] [/13] [/'1]
Copies one or more files: (1) to the same directory (as the
source), giving the new file a different filename or (2) to another
directory on any disk, giving the new file the same or a different
filename.

Parameters
source pathname is the file to be copied.
target pathname is the name and destination to be given the
newly created file.
If you omit the filename from the target pathname, MS-DOS
assumes you want to give the new file the same filename as the
source file.
IA tells MS-DOS to treat the file as an ASCII file (also called a
text file) when used with a source file. MS-DOS copies only to
the first end-of-file (EOF) character.
IA tells MS-DOS to add an EOF character to the end of the file
when used with the target file.
IB tells MS-DOS to treat the file as a binary file, such as a pro-
gram file, when used with the source file. Therefore, MS-DOS
copies the entire file. When used with the target file, it tells MS-
DOS not to add an EOF character to the end of the file.
Each of these switches (fA and IB) affects the file immediately
preceding it in the command line and all files following, until
another IA or IB is encountered.
For example, if you type this:
copy thisfde fa thatfile I ENTER I
the I A parameter affects both files. If you type this:
copy thlsfile fa thatfile fb I ENTER I

the I A parameter affects only the file Thisfile.

53
Chapter 6 / Command Reference

If you omit the /A and!B switches, MS-DOS uses /B. Notice that
this default is the opposite of that for the COPY/APPEND and
COPY/COMBINE commands.
N tells MS-DOS to verify that the sectors written to the disk
are recorded properly. This parameter slows the process because
MS-DOS must check each entry recorded on the disk.

Notes and Suggestions


• By varying the syntax of COPY slightly, you can also use it
to:
• Append one or more files to the end of an existing file,
keeping the target file's filename.
• Combine files into a new file that has a unique filename.

(See COPY/APPEND and COPY/COMBINE for more informa-


tion on these uses of COPY.)
• Use the /B parameter with a target file to remove the EOF
character from the end of the file. Some application programs
require that the EOF character not be included.
• Use COpy to:
• Copy a file to another disk: COPY lets you make backup
copies of files to protect important information.
• Transfer external commands to another disk: When you
receive your system disk, all external commands are in the
root directory. (Some of the Version 3.2 external commands
and system utility files are on the Supplemental Programs
diskette.) Tailor your directory structure to your own needs
by moving some of these commands to their own directory.
• You cannot copy a file onto itself. (You cannot copy it to the
same directory, giving it the same name.)
copy b:memos b:memoslENTERI

will cause an error message. This command:


copy memos I ENTER I
will also cause an error message. You are trying to copy the
file Memos that is in the current directory to another file
Memos, also in the current directory.

54
Chapter 6 / Command Reference

i"'
I
• Remember, the target disk must be formatted and the
target directory must exist.
i"'
) .

Examples
r-' copy *. * / a b: I ENTER I
l ' copies all the files from A: \ to B: \.
r-- mk d 1 r \ bin I ENTER I
I
l
'
_I cop Y for mat . com \ bin I ENTER I
transfers external commands to another directory by first creat-
~
ing the directory \ BIN in the root directory of the system disk
i in Drive A and copying Format.com into it. You can now copy
'-
any other .com files you use regularly into the \BIN directory.
copy \per50nal.dat b: I ENTER I
copies the file personal.dat from the root directory of Drive A to

r the current directory of Drive B.


copy mem05.txt /a b:corr.txt I ENTER I
copies the file Memos.txt from the current directory to the' cur-
rent directory of the disk in Drive B, naming the new file
Corr.txt. MS-DOS copies information only up to the first EOF
character and adds an EOF character to the end of the new file.
copy b:taxe583.dat /a taxe584.dat I ENTER I
copies the file Taxes83.dat from the current directory in Drive B
to the current directory on the current disk, naming the new file
Taxes84.dat. MS-DOS copies information only up to the first
EOF character and adds an EOF character to the end of the new
r file.
I :
cop Y pro 9 . ex e b: pro 9 1 . ex e I ENTER I
,.., copies the file Prog.exe that is in the current directory to the
I current directory of Drive B. MS-DOS does not add an EOF
character to the end of the new file, Progl.exe.

55
Chapter 6 / Command Reference

, I
!-J
COPY/APPEND Internal
COpy target pathname + source pathnamel !
, ,
)
'---'
[+ source pathname2 .. , ] [IA] [lB] [IV]

Adds one or more files to the end of another existing file. The :'---'i
files are added in the order in which you list them. When you
append files, the original source files still exist separately. The
information from them is copied, not moved.
u
Parameters
I :
i
target pathname is the file to receive the appendages named in '---'
the source pathnames.
source pathname is the file(s) that will be added or appended to I 1
i I
target pathname.
IA tells MS-DOS to treat the file as an ASCII file when used , ~l

with the source file. MS-DOS copies only the information up to i I


'---'
the first EOF character.
IA when used with the target file, tells MS-DOS to add an EOF
character to the end of the file.
IB tells MS-DOS to treat the file as a binary file, such as a pro-
gram file when used with the source file. Therefore, MS-DOS
copies the entire file. When used with the target file this param-
eter tells MS-DOS not to add an EOF character to the end of the
file. , i
Each of these switches (fA and IB) affects the file immediately -'
preceding it in the command line and all files following, until
another I A or IE is encountered. I !
I
For example, if you type this:
copy oneflle.txt la + myfile.txt + samfile.txt I I
I ENTER I U

the IA parameter affects all three files. However, if you type


this:
copy onefile.txt la + myfile.txt Ib +
5 am f lIe . txt I ENTER I )
I I
---J
the IA parameter affects only the target file, Onefile.txt.

56
,i , Chapter 6 / Command Reference

If you omit the /A and /B switches, MS-DOS uses /A.

, ,
Notice that this default is the opposite of that for the regular
, COPY command.
IV tells MS-DOS to verify that the sectors written to the disk
are recorded properly. When you use this parameter the process
slows because MS-DOS must check each entry recorded on the
disk.

! Notes and Suggestions


• Use Copy/Append to append separate lists. Suppose you have
the following three separate files:
biglist listl list2
r- Jerry Day
iI
Bob Anthony Anne Barnes
,

Carol Apple Ted Erickson Karen Ellis


Curtis Kelly Mike McAdam Jennifer Peters
[
Susan Leonard Dave Shultz Larry Thomas
I If you type this command:
I.
cop Y b i 9 1 i 5 t + 1 1St 1 + 1 i 5 t 2 I ENTER I
r
!
the new contents of the file Biglist are:
Bob Anthony
Carol Apple
r! ' Curtis Kelly
Susan Leonard
Anne Barnes
n l '
Ted Erickson
Mike McAdam
Dave Shultz
Jerry Day
i ' Karen Ellis
Jennifer Peters
Larry Thomas
i"'
, '
l '

r-'
I

I' I

57
Chapter 6 / Command Reference

I ,
Examples
copy b:read.dat + write.dat + print.dat I ENTER I
appends the files Write.dat and Print.dat that are in the current
directory to the file Read.dat that is in the current directory of
Drive B. MS-DOS adds an EOF character to the end of Read.dat.
cop Y b 1 9 . t 5 t H • 1st I ENTER I
appends all files that have the extension .lst, and that are in the
current directory, the the file Big.tst, that also is in the current ; i
directory. MS-DOS adds an EOF character to the end of Big.tst.
cop y pro 91 . ex e I b + pro 92 . ex e I ENTER I i
'--J

appends the file Prog2.exe'that is in the current directory to the


file Progl.exe that also is in the current directory. MS-DOS cop-
ies all information in the file. MS-DOS does not add an EOF : I --J

character to the end of Progl.exe.


copy oldfile.dat +
i I
leaves the Oldfile.dat file intact, but updates the date and time
of the file to the current date and time.
, !
LJ

I !
I !

:I

,
I
I
I ,
---'

I I
~

I
----'
58
r-
I Chapter 6 / Command Reference

~
I

COPY/COMBINE Internal
I
I
:
~ COpy source pathnamel [+ source pathname2 ... ]
target pathname [lA] [lB] [IV]
Combines any number of source files into a target file. The files
are ~dded in the order in which you list them. When you com-
bine files, the original source files still exist separately. The
IL I information from them is copied, not moved.
_I

Parameters
IA tells MS-DOS to treat the file as an ASCII file when used
with the source file. MS-DOS copies only the information up to
the first EOF character.
IA tells MS-DOS to add an EOF character to the end of the file
when used with the target file.
IB tells MS-DOS to treat the file as a binary file, such as a pro-
gram file, when used with the source file. Therefore, MS-DOS
copies the entire file. When used with the target file, this
r parameter tells MS-DOS not to add an EOF character to the end
of the file.
"
Each of these switches (fA and IB) affects the file immediately
preceding it in the command line and all files follow~ng, until
another I A or IB is encountered.

1 1
For example, if you type this:
I
copy myflle.txt /a + salflle.txt onefile.txt
I ENTER I
the IA parameter affects all three files. If, however, you type
this:
r- copy myflle.txt /a + salfile.txt /b onefile.txt
i : I ENTER'
the IA parameter affects only Myfile.txt.

n If you omit the IA and IB switches, MS-DOS uses IA. Notice that
this default is the opposite of that for the regular COPY
command.
J'
II ' IV tells MS-DOS to verify that the sectors written to the disk
are recorded properly. This parameter slows the process because
MS-DOS must check each entry recorded on the disk.

59
I !
Chapter 6 / Command Reference L-:

Notes and Suggestions


• Warning: Never combine files into a target file that has the I :
same name as one of the source files. Instead, append other 1
u
files to the existing file. For example, suppose your current
directory contains the files A.lst, B.lst and All.lst. The
command:
copy *. ls t / bali. 1 s t I ENTER I
combines A.lst and B.lst into the All.lst target file, which i ,

replaces (destroys) the All.lst source file. The message, Con-


tent of dest1nat10n lost before copy. is displayed.
, I
i I
.• Use Copy/Combine to copy existing files into a new file, for '--.oJ
example:
oldlist1 oldl1st2
Anne Barnes Jerry Day
Ted Er1ckson Karen Ell1S
M1ke McAdam Jenn1fer Peters
Dave Shultz Larry Thomas
which can be combined with this command:
cop y old 1 i s t 1 + old 11 s t 2 new 1 i s t I ENTER I
MS-DOS creates the file Newlist in the current directory. The
file contains the names shown here:
newlist
Anne Barnes
Ted Er1ckson
Mike McAdam
I
Dave Shultz U
Jerry Day
Karen Ellis
Jennifer Peters
Larry Thomas
If you wish, you can now sort Newlist alphabetically, using
the SORT command (see SORT).

~ I
: I

, i
i
60
I, Chapter 6 / Command Reference

Ii
[ i
Examples
COPY B:mem05.txt + B:letter5.txt B:corr.txt
I I
I ENTER I
combines the files Memos.txt and Letters.txt that are in the cur-
r-""'
I ' rent directory on Drive B. COPY copies information only up to
[
the first EOF character in each source file. Then it places the
information in the file Corr.txt in the same directory and adds
I
I
', an EOF character to the end of that file.
I '
COPY A:\5tat51.dat + A:\5tat52.dat
B:\al15tat5.dat [ENTER I
combines the files Stats1.dat and Stats2.dat that are in the root
directory of Drive A. COPY copies information only up to the
first EOF character in each source file. Then COPY places the
information in the file Allstats.dat in the root directory of Drive
B. MS-DOS adds an EOF character to the end of Allstats.dat.
,..-, COpy a.com + b.com + B:c.com oneprog.com
l : IB I ENTER I
combines the files A.com and B.com that are in the current
directory, with the file C.com that is the currrent directory of
Drive B. COpy copies information only up to the first EOF char-
acter in each source file. Then it places the information in the
r:
l I
file Oneprog.com in the current directory. It does not add an
EOF character to the end of that file.

n
\ ;
,........,
l I

r:
l

.
~
,
, ,
: '

,--,
I I

61
Chapter 6 / Command Reference

I 1
LJ
COPYDOS External
I ~ 'COPYDOS ; i
L
Copies operating system files onto an application program
, ,
diskette. : '
LJ
Suggestions and Notes
• Some application programs do not include an operating system i I
L......i
on the program diskette. This means you cannot boot (initial-
ize) your computer with that diskette and must use a system
I :
diskette to boot your computer. To avoid needing two diskettes ! ;
-----'
when executing a program, transfer the startup system files
to your application diskette with COPYDOS.
, 1

• COPYDOS works with either protected diskettes (those you ! i


L.......!
cannot backup) or nonprotected diskettes, and with either sin-
gle- or dual-drive systems.
• Application program diskettes must have 61,000 free bytes of
space to store the system files transferred by COPYDOS.
• Make sure any write-protect tabs are removed from the desti-
nation diskette (the diskette to receive the system files) before
I I
using COPYDOS.
1
• If you have a single-drive system, MS-DOS will prompt you to I

'-'
insert the destination diskette in drive B. At this point,
remove the system diskette from drive A and insert the desti-
; 1
nation diskette in its place, then continue with the COPYDOS ,
---..J
I
procedure.
, !

, I
I---..J:

!I
,-- ,
I
~l

, 1
~
62
,-
I
Chapter 6 / Command Reference

Examples
COpyd05 I ENTER I
,
, ,
Formats and copies the necessary system boot files to a diskette.
The diskette is first formatted. Be sure you do not use the ver-
i sion of COPYDOS on a diskette containing data you do not wish
! ' to erase.
copyd05 P I ENTER I
Copies the necessary system files to a diskette to make it boota-
ble. Using COPYDOS in this manner will change the contents of
an application diskette but will not erase any data previously
contained on the diskette and will not affect its operation. The p
parameter must be in lowercase.

r
I :

,-.,
! .

63
"

Chapter 6 / Command Reference

CTTY (Change I/O Device) Internal


CTTY device
Changes the input/output (I/O) device to the device specified.
Normally, input comes from the keyboard and output goes to the
screen.

Parameters i i

device is a device which can be either of the following:


AUX - specifies an auxiliary device, normally the RS-232
serial port.
COMI or COM2 - specifies RS-232 serial Port 1 or Port 2.
CON - specifies the console (input from the keyboard and
output to the screen).
Any other character-oriented device capable of both input and
output.

Notes and Suggestions


• Because the printer is not capable of input, PRN is not a valid
CTTY device.
• CTTY affects only programs that are MS-DOS function calls.
Other programs, such as BASIC, ignore the CTTY command.

Examples
c tty aux I ENTER I
moves all command input/output (I/O) from the current device to
the auxiliary device.
c tty con I ENTER I

changes the input device to the keyboard and the output device
to the screen.

64
Chapter 6 / Command Reference

DATE Internal
DATE [mm-dd-yyyy]
Enters or changes the system date. This date is recorded in the
directory for any files you create or change. You can also use
this command to display the current date.
MS-DOS is programmed to change the months and years cor-
,,r-:. rectly, taking into account leap years and the number of days in
the months.

Parameters
mm-dd-yyyy specifies the date in numerical form. mm (month) is
a one- or two-digit number in the range 1-12. dd (day of month)
is a one- or two-digit number from 1-31. yyyy (year) is a two-
digit number in the range 80-99 (1980 is assumed) or a four-
digit number in the range 1980-2099.

Notes and Suggestions


• If the month or day is a number less than ten, it is not neces-
sary to include a leading zero (for example, 09/09/84). When
MS-DOS stores and displays the date, it includes a leading
zero in a one-digit day and excludes it from a one-digit month
i .
l ; (for example, it stores 9/09/1984).
• You can separate the date, month, and year with either
r-
I •
slashes, hyphens, or periods.
I

• If you omit the mm-dd-yyyy parameter, DATE displays the


current date and asks you to enter the new date. If you do not
want to change the date, press I ENTER I. If you do want to
change it, enter it in the mm-dd-yyyy format.

~
• You can change the date from the keyboard or from a batch
i . file. (Normally, MS-DOS displays a date prompt each time you
start up your system. It does not, however, if you use an auto-
exec.bat file. Therefore, you may want to include a DATE com-
,,,..----, mand in that file.)
• When you change the date known to the system, you also
change the date in any application program you use. This can
be very handy.

65
, i
Chapter 6 / Command Reference

• Suppose you have a program that keeps track of purchase


orders according to the date received. For some reason, you get
behind and can not enter the information on that date. Simply
enter it later, after turning back the calendar to the necessary : '
--........
date.
• You can also use DATE and TIME to include the date and
time on a printout. For example, press I PRINT 1 or I CTRL 1 W to
send all output to the line printer, as well as to the screen.
Then type:
date I ENTER I I ENTER I
t 1 me I ENTER I I ENTER I

Press I PRINT I again to turn off the print output function. Now
use I SHIFT I I PRINT I, I PRINT I, I CTRL I W, or the PRINT command as
necessary to make your printout.
• In Version 3.2 MS-DOS, you can change the format in which
the date is displayed and entered. The COUNTRY command
in the CONFIG.SYS file lets you change the date format to
the European standard, dd-mm-yy. Refer to Appendix B for
more information.
I
~
Examples
date I ENTER I : !
~
displays the current date and prompts you for the new date. For
example, if the date is July 16, 1986, MS-DOS displays:
Current date 15 Men 7-16-1986
Enter new date:
You can now change the date or press I ENTER I to bypass the
prompt.
da t e ~ 7/1 4/1986 I ENTER I
enters the current date as July 14, 1986.

, I

~
i
66
Chapter 6 / Command Reference

r
I :
DEL (Delete) Internal
~ See the ERASE command.
,

r--'
i i
,....,
·i i ,

·, ,'

,---,
,
I ,

I '

r-1
; i

· I

I
i
i I

,--'
i ;

,....-,
I '
, I

r--'
I
; ,

r
I

~
; \

r--'
i
67
Chapter 6 / Command Reference

DIR (Directory) Internal '-

DIR [pathname][lP][lW]
Displays: (1) information about all files or the specified files
that are in the current directory or in the directory specified by
pathname or (2) information about the file specified by
pathname.

Parameters
pathname indicates a specific file. If you omit the pathname,
MS-DOS lists the directory entries for all files that are in the
current directory. You can use the MS-DOS wild cards in the
pathname.
,I !'
IP selects the page mode. With IP, display of the directory pauses
when the screen is filled. It displays this message:
Strlke a key when ready ...
To resume display of output, press I SPACEBAR I.
IW selects a wide display. With IW, MS-DOS displays filenames
only; it does not display sizes or modification dates.

Notes and Suggestions


• DIR first causes MS-DOS to display the disk's volume label,
which was assigned during formatting. If you did not assign a
label, MS-DOS displays a message to that effect. Then MS-
DOS lists each file with its size (in bytes) and the time and
date of the last modification. It then gives the number of files
listed and the number of bytes remaining on the disk.
• If you do not include a filename extension, DIR assumes the .*
wildcard extension.
• If the filename does not include an extension, add a period to
the end of the filename in the DIR command.
• If the Version 3.2 COUNTRY command in the CONFIG.SYS
file is set to a country other than the U.S., the directory date
and time formats differ. Refer to Appendix B for more
information.

, .,
68
Chapter 6 / Command Reference

.--
., ,'
Examples
:- dlr b:\u5er\mai15rt.bat [ENTER I
, :
provides information on how much space B: \ USER \ mailsrt.bat
takes on the disk in Drive B and how much space remains.
di r b: \ I ENTER I
tells you the name of the files in Drive B. The backslash indi-
cates the root directory. If the file you want is not in the root
directory, use the DIR command as needed to check the
subdirectories.
I PRINT I di r I ENTER I
a listing of the directory goes to the printer, as well as to the
screen, until you again press I PRINT I.
; 1
di r b: I ENTER 1

displays a list of all files in the current directory of Drive B.


di r / w I ENTER 1

displays, in the wide mode, the names of all files in the current
directory.
di r \ U5 e r \ * • bat / p I ENTER I
displays a list of all batch files in the \ USER directory on the
current drive. MS-DOS halts (pauses) the display when the
.
r
'")
screen is full. Press I SPACEBAR I to continue.
dir a:\U5er\acct.* [ENTER 1

displays a list of files that have the name acct-regardless of


their extensions-and that are in the A: \ USER directory.

69
Chapter 6 / Command Reference

DISKCOMP External
DISKCOMP [drivel:] [drive2:] [11] [18] , I

Compares the contents of two diskettes.

Parameters
drivel: is the drive containing the source diskette for the
comparison.
drive2: is the drive containing the target diskette.
/l compares only the first side of the diskettes.
/8 compares only eight sectors per track.

Notes and Suggestions


• The main purpose of this command is to compare diskettes
after a DISKCOPY operation to ensure that the two diskettes
contain identical data.
• You cannot compare a floppy diskette with a hard disk.
i ,

• The /l parameter compares only one side of the diskettes, even


if they are double sided.
• When complete, DISKCOMP will prompt:
Compare more dlskettes (YIN)?
• I
If you press Y to do another DISKCOMP, the comparison will
be done on the drives you originally specified, but it will now
be based on the sides and sector configuration of the new
diskettes. For example, if the new diskettes are double-sided
and the previous diskettes were single-sided, a double-sided
comparison will be made. If you press N, the DISKCOMP
function will terminate.
• You can escape from the DISKCOMP command by typing
I CTRL I W or by pressing I BREAK I. The command will delay acting
on the I CTRL I W or I BREAK I request until it is performing a
diskette read.
• If you omit the drive2 parameter, DISKCOMP assumes the
current drive.

, I

70
, j Chapter 6 / Command Reference

r-:
i I
• If no parameters are specified, DISKCOMP will do a single
drive comparison using the current drive.
r, ~'
• During the DISKCOMP process, you will be informed of any
disk cylinders or tracks that do not match. DISKCOMP will
then continue with the comparison.
I '
• Copies of diskettes made using the COpy command will not
usually be identical. Data is not necessarily copied in the
r---, same position on the target diskette as it was located on the
, !
: \
source diskette. Use the DISKCOPY command for mirror-
image copies of diskettes.
.---,
,I i, • If a read error occurs on a track of one diskette, that track is
l _I reported as differing.
• You cannot compare a double-sided diskette with a single
I i' sided diskette. Trying to do so will cause an error message.
,
• Diskettes with a different number of sectors per track cannot
,--, be compared.
,,
• Drivel and drive2 cannot be virtual drives, such as those cre-
ated with the Version 3.2 SUBST command.
!
I ' Examples
.--, dlscomp [ENTERI
I '

l ' compares two diskettes for identical data on the current drive.
You will be prompted when to swap diskettes.
r , d 15k com p a: b: / 1 / 8 [ ENTER I
l ~

compares the diskette on Drive A with the diskette on Drive B.


r: Only one side is compared and only eight sectors of each track
i, i are compared.

,...--,
! '
l '

.....
,
l

71
Chapter 6 / Command Reference

DISKCOPY External
DISKCOPY [source drive:] [target drive:] [11]
Makes exact copies of the diskette in the source drive on the
diskette in the target drive.

Parameters
source drive: is the drive containing the diskette you want to '-...J
copy.
target drive: is the drive containing the diskette to receive the
copy.
/1 copies only the first side of a diskette.

Notes and Suggestions


• If the source and target drives are the same, DISKCOPY per-
forms a single-drive copy. It prompts you to insert the
diskettes at the appropriate times. Press the space bar to
continue.
• If you omit the target drive specification, DISKCOPY uses the
current drive.
If you omit both drive specifications, DISKCOPY does a sin- '---J
gle-drive copy on the current drive. (This assumes that the
DISKCOPY.COM file is in the current directory, so that MS-
DOS can find it, or that you use PATH beforehand to tell MS-
DOS where to look for the file.)
• After copying, DISKCOPY prompts:
Copy complete
Copy another (Y/N)?_

If you press Y, DISKCOPY prompts you to insert the diskettes.


Then it performs the next copy, using the drives you specified
earlier.
If you press N, DISKCOPY exits the COPY command.
• You can use DISKCOPY to duplicate your MS-DOS diskette.

72
Chapter 6 / Command Reference

• We suggest that you make copies of all your diskettes-espe-


cially your system diskette and application program
r; diskettes-and store your originals in a safe place.
I ,

• If the target diskette is not formatted, or if it is formatted dif-


ferently from the source diskette, DISKCOPY formats it in the
same configuration as the source diskette.
:... "

• DISKCOPY does not aid in making fragmented disk files


r-
I i
contiguous.
• You cannot DISKCOPY between different drive types. Use the
FORMAT and COPY· or FORMAT and XCOPY commands for
this purpose.

Examples
i l diskcopy IENTERJ

copies all information from a diskette in the current drive to


another diskette in the current drive. DISKCOPY prompts you to
: ' insert diskettes, as necessary.
diskcopy a: b: I ENTER I
copies all information from the diskette in Drive A to the
diskette in Drive B. Before starting, DISKCOPY prompts you to
insert the diskettes.

r-,
I

....
, .
; ,

I '

73
Chapter 6 / Command Reference

: '

DISKTYPE External
DISKTYPE [drive:] ,
, ;
'-"'~

Displays information on the size and capacity of the indicated


drive.

Parameters
drive: is the disk drive for which you wish to determine the type.
It can be either a floppy drive or a hard drive. If drive is not
specified, the default drive is used.

Notes and Suggestions


• Using DISKTYPE with floppy diskettes displays the number
of sides, tracks, and sectors-per-track of the diskette in the
specified drive. The screen also shows the MS-DOS command
line that must be typed to format a new diskette with the
same format.
• Using DISKTYPE with a hard disk displays the number of
heads, cylinders, and sectors-per-track.

Examples
DISKTYPE A:

displays the following message:


Dis ke t t e is for rna t ted wit h 2 sid e s, 4 il t r a c ks ,
9 sectors/
track ---=
FORMAT A:

DISKTYPE c:
displays the following message:
Fixed dISk contains 4 heads, 2ilil cylinders, 17
sectors/track

74
,
I- i
~ -"
Chapter 6 / Command Reference

! '
l .
ECHO Internal
)' ECHO [switch] [message]
Turns the batch ECHO feature on or off. Also lets you use mes-
I sages while the batch files are executing.
~ - I

Parameters
switch can be ON or OFF. ON tells MS-DOS to display batch file
commands. OFF tells MS-DOS not to display batch file
commands.
message is text the screen displays when ECHO is encountered.

I :
Notes and Suggestions
l '
• If you do not specify a switch or message, MS-DOS displays
the current setting of ECHO.
• Normally, the screen displays (echoes) commands in a batch
file as you run the file. ECHO OFF turns off this feature.
ECHO ON turns it on again. (Note: ECHO is automatically
restored to its previous setting after a batch file executes.)
• ECHO message displays the specified message, regardless of
n whether ECHO is on or off.
i 1
• Specifying ECHO OFF at the MS-DOS prompt turns off the
system prompt.
:-'
! I
I I
• Use ECHO OFF when you do not want to clutter the screen
with unnecessary information.
• You can turn off ECHO and insert your own messages to be
displayed while a batch file is executing.

; (

,i ;

75
Chapter 6 / Command Reference

Example
The following batch file formats a disk in Drive B and then
checks the disk. (The file uses some external commands, so it
must be created in a directory that contains the external
commands.)
copy con prepdisk.bat I ENTER I
ech0 0 f f I ENTER I
rem ThlS formats and checks dlsks In drive E IENTERj
rem i t i s cal led pre p dis k . bat I ENTER I
format b: I ENTER I
echo do you want to check drive b? I ENTER I
pause I ENTER I
c h k d s k b: I ENTER I
ech0 0 n I ENTER I
ffiJ I ENTER I
When you run the file, MS-DOS displays:
echo off
The FORMAT copyright is displayed, then the screen shows:
Insert new diskette for drive E: i !

and strlke any key when ready ...


Formattlng tracks

Format Complet'e
nnnnnn bytes total disk space
nnnnnn bytes available on dlsk
Format another (YIN)? Do you want to check
Drlve E?
Strike a key when ready ...
nnnnnn bytes total dlsk space
nnnnnn bytes available on dlsk
nnnnnn bytes total memory
nnnnnn bytes free
As you can see, the commands are not echoed. The screen does
display the prompt Do you want to check Drive E? This is
because the ECHO command used here includes the message
parameter.

76
Chapter 6 / Command Reference

I '
i
ERASE Internal
ERASE pathname
DEL pathname
Erases (deletes) one or more files from current directory or from
the directory specified by pathname. By erasing unnecessary
files, you can create more free space in a directory.
! I
Parameters
pathname specifies the file you want to delete.
l
,, -'
,i
Notes and Suggestions
I I
• If you omit the filename from the pathname, MS-DOS
assumes you want to erase all files in the directory. CUsing
the wild card *.* as. the filename is the same as omitting the
filename.)
• If you use the full wild card C*.*), ERASE prompts: Are you
5 u r e (Y / N )? If you type Y I ENTER I, MS-DOS erases the files. If
you type N [ENTER I, MS-DOS exits the command.
• If you omit thE! entire pathname, ERASE returns an error
II message.
I

• To avoid erasing important files, use the DIR command with


the appropriate wild card to check which files you need.
I, • Use ERASE to:
Erase or delete files in an old directory after copying
:
,: them to a new directory.
I _~

Delete all the files in a directory preparatory to deleting


the directory.
r
I
Erase a file for which you have no further need.
• You cannot erase hidden files or files marked read-only.
, '

77
Chapter 6 / Command Reference

Examples
ere s e *. 1 s t [ENTER I ,
; 'I
'
....,....\
I
would be used after you combine the files A.lst and B.lst from
the current directory into a new file All.lst on a different direc-
tory. It would erase all files with the extension .lst in the cur-
rent directory. You should make sure that there are no other
files you wish to keep that have the .lst extension.
Warning: If you include an extension, such as the .lst
used here, ERASE does not prompt you before erasing
the files, regardless of whether use a wildcard. It
prompts only when you use the full wildcard (*.*). , ,
--'

erase \bin\user\mary\text.txt [ENTERI

erases +he file Text.txt from the directory BIN \ USER \ MARY
on the current disk.
era s e b: \ use r \ J0 hn\ * .* I ENTER I I I

'-J
tells MS-DOS to delete all the files in the directory
\USER\JOHN on Drive B. MS-DOS asks: Are you sure? (VI
N)?
erase b: \bi n\user \mary I ENTER I
tells MS-DOS to erase all files in the \BIN\ USER\MARY
directory on Drive B. MS-DOS prompts: Are yo u sur e (V IN)?
era s e f i 1 e 2 I ENTER I , ,
I :

erases the file File2 from the current directory.

78
Chapter 6 / Command Reference

I ,
r I

EXE2BIN (Executable to Binary) External


n EXE2BIN source pathname [target pathname]
Converts an .exe (executable) file, specified by source pathname,
r--

I to .com file format (binary format). EXE2BIN is an advanced


command, recommended for experienced users only. The source
file must be in valid .exe format produced by the linker. The res-
ident, or actual code and data part of the file, must be less than
it i
_I 64K. There must be no STACK segment.

Parameters
source pathname specifies the file to be converted. If you do not
include an extension in the source pathname, the extension
defaults to .exe. .
target pathname specifies a file to receive the converted program
file. If you omit the drive, EXE2BIN uses the drive specified in
,~, the source pathname. If you omit the extension, it gives the new
file the extension .bin. If you omit the entire target pathname,
EXE2BN uses the source pathname.

Notes and Suggestions


• Converting executable files to binary format saves space and
I
, ,i speeds program loading. Two kinds of conversions are possible,
depending on whether the initial CS:IP (Code Seg-
,...., ment:Instruction Pointer) is specified in the .exe file.
; !
• If CS:IP is not specified, EXE2BIN assumes a pure binary
conversion. If segment fixups are necessary (the program con-
tains instructions requiring segment relocation), EXE2BIN
prompts for the fixup value. This value is the absolute seg-
ment at which the program is to be loaded.
I , In a pure binary conversion, the resulting program is usable
1
only when loaded at the absolute memory address specified by
a user application. The command processor cannot properly
load the program.
• If CS:IP is specified as OOOO:IOOR, EXE2BIN assumes the file
is to be run as a .com file with the location pointer set at
IOOR by the assembler statement ORG. It deletes the first
IOOR bytes of the file. It allows no segment fixups, as .com
files must be segment relocatable.

79
Chapter 6 / Command Reference

,I !,
When this kind of conversion is complete, you can rename the
resulting file, giving it a .com extension. Then the command
processor can load and execute the program in the same way
as it does the .com programs supplied on your MS-DOS disk.
• If CS:IP does not meet either criterion (discussed in the pre-
ceding Notes and Suggestions)-or if it meets the .com file cri-
terion but has segment fixups-EXE2BIN displays an error
message. EXE2BIN also displays an error message if the file
is not a valid executable file.

Examples
exe2bln testfile.exe b: [ENTERI I
'......J
converts the file Testfile.exe that is in the current directory to
binary format and places the new file, Testfile.bin, in the current
i :
directory of Drive B.
exe2bln e:\user\oldfile.exe e:newfile I ENTER]
i ,.
converts the file Oldfile.exe that is in A: \ USER to binary format !..-;
and places the new file, Newfile.bin in the current directory of
Drive A.
! :
-'

i I

, ,
: ~

: i
~
80
iJ Chapter 6 / Command Reference

n
!
EXIT
1

Internal
r:
: I EXIT
Returns control from a secondary command processor to the
n invoking program, if one exists. If you have entered a secondary
command processor from an application program, use EXIT to
return to the application.
n
I : Notes and Suggestions
• While running an application program, you may need to use
, ,
; I
an MS-DOS command. To do so, you must first invoke a sec-
ondary command processor from your program. Enter the
command you wish to use. When complete, enter EXIT to
I : return to your application program.
l :
Examples
Invoke a secondary command processor from your program, then
type your command.
d l r b: I ENTER I
ex 1 t I ENTER I

lists the directory of Drive B, then returns to your application


I iI
t l program.

!I
l J

G
I '

r-'
I, II
I J

81
Chapter 6 / Command Reference

f I

L...J
Fe (File Comparison) External
18: Fe
:
[/number] [lB] [Ie] [lW] pathnamel
pathname2 [>target pathname]

Compares the contents of two files, pathnamel and pathname2,


and sends the output to the screen or to the file specified by tar-
get pathname.
, i
I ,
--...J
Parameters
number specifies the number of lines that must match for the , '
file to be considered as matching again after FC finds a differ- ~
ence. It can be from 1 through 9. If you don't specify a number,
it defaults to 3. Use this parameter only in source comparisons.
IB forces a binary comparison of both files. The two files are
compared byte-by-byte, with no attempt to resynchronize after a
mismatch. FC displays the mismatches in the following format: I '
~
xxxxxxxx yy zz
where xxxxxxxx is the relative address of the pair of bytes from , .
the beginning of the file. Addresses start at 00000000. yy and ! i
~

z z are the mismatched bytes of pathnamel and pathname2,


respectively. If one file contains less data than the other, FC dis-
plays a message to that effect.
For example, if pathnamel ends before pathname2 ends, then FC
displays: : I
LJ
***Data left In pathname2***
IC causes FC to ignore the case of letters. All letters in the files
are considered uppercase letters. For example:
Much_MORE_data_IS_NOT_FOUND
matches

Use the IC parameter only in source comparisons.


IW compresses white spaces (tabs and spaces) for the comparison.
Thus, if several whites are toge-ther on one line, FC considers
them as one white space. FC ignores spaces that are at the
beginning and end of lines.

82
-
I

l ~
Chapter 6 I Command Reference

r:
, -
I I
For example:
...--,

! : matches

Ii
, I
and

but does not match

r;
I I
! '
(Each underscore represents a white space in these examples.)
Use the /W parameter only in source comparisons.
pathnamel pathname2 can be either source files (files that con-
tain source statements of a programming language) or binary
files (files output by the assembler, the linker, or a Microsoft
n
L_
high-level language compiler).

Notes and Suggestions


I '
I I
l I
• FC uses a large amount of memory as buffer (storage) space
to hold the source files. If the source files are larger than
f""[ available memory, FC compares what can be loaded into the
,I :: buffer. If no lines match in the portions of the files in the
buffer, FC displays only the message:
n
I '
*** Files are different ***
• I

and returns to the system prompt. For binary files larger than
available memory, FC compares both files completely, overlay-
n
l '
ing the portion in memory with the next portion from disk.
This does not affect the command output.
• The two kinds of comparisons are line-by-line and byte-by-
~
l ' byte.
In a line-by-line comparison, FC marks off blocks of lines and
:
I
' then compares the lines within each block. In a byte-by-byte
comparison, FC simply displays the bytes that are different.
• If FC finds many differences (involving many lines), it only
reports that the files are different. Then it stops.

,..,
J I

l l
83
Chapter 6 / Command Reference

• Use FC to determine which of two files is current and what


changes have been made since the old version.
Suppose your current directory contains these source files.
Each letter in the files represents a program line.
namel.src name2.src I I

A A J !
B B
M C
D L I i
o S
S W
W X
X Y
Y Z
Z P 1

R E -J
U N
N Q I

Q V ~
T
V
To compare the files line-by-line, type:
fc /1 I
name1.~rc name2.~rc ENTER I I

I
I
'--J

84
Chapter 6 / Command Reference

.----
i ! FC begins by marking off the blocks of lines. Whenever FC
encounters a match, it ends a block. Therefore, FC blocks off
the lines as follows:
name1.src name2.src
A A
B B
M C
D L
0 S
S
W W
X X
Y Y
Z Z

~I
.
R P
l j U E
N N
Q Q
T V
V
n
! FC ignores matching blocks that are before the first mis-
match. It also ignores blocks in which at least the specified
! number of lines match. In this case, the number is one. For
i each set of blocks that contains a mismatch, however, FC dis-
plays thf') following information:
,.., • -----------------NAME1.SRC
I
• The lines in the Namel.src block that differ from those in the
corresponding Name2.src block
• The line that is the same (the last line in the block)
• -----------------NAME2.SRC
r:
I
! , • The lines in the corresponding Name2.src block that differ
from those in the Namel.src block
.........,
i '

85
Chapter 6 / Command Refererwe

• The line that is the same (the last line in the block)
Therefore, for the files Name1.src and Name2.src, Fe displays:
-----------------NAME1.SRC
M
D
o
5

-----------------NAME2.SRC

C
; I
L ,~

----------------NAME1 .SRC

R
U
N

-----------------NAME2.SRC

P
E
N

-----------------NAME1 .SRC '--'

T
V

-----------------NAME2.SRC
V

You can print the differences on the line printer using the
same two source files. To do this, type: . ,
~

fc/1 name1.src name2.src >prn I ENTER I

86
Chapter 6 / Command Reference

,........
I '
I '
Examples
~

, i f e / B t est 1 . 5 r e t est 2 . 5 r c ) t est 3 . 5 rc I ENTER I


does a binary comparison of the files Testl.src and Test2.src that
are in the current directory and redirects output to the file
Test3.src that is also in the current directory.
fc /4/w/c b:\user\myflle.src
b:\user\myfile1.src I ENTER I
r:
, ' does a line-by-line comparison of B: \ USER \ Myfile.src and
B: \ USER \ Myfilel.src, compressing white spaces and ignoring
r-'
I I
case. After Fe finds a mismatch, at least four lines in a row
I i must match for the file to be considered matching.

n
1- \

,.......,
i \
i I

.........,
\ ;

r:
t i

n
! ;

I
,.,
I I
I '

n
, '
I '

,I '
'

87
Chapter 6 / Command Reference

,
l
,i
Fe (File Comparison)
rQl Fe [lA] [lB] [Ie] [lL] [lLBn] [IN] [IT] [lW]
~ [lnumber] pathnamel pathname2
o [> target pathname] i
i
.....-'
Compares the contents of two files or sets of files.

Parameters
pathnamel and pathname2 specify the files to compare.
IA abbreviates the output of an ASCII comparison. Normally, FC
displays only the matching lines that precede and follow each set
of differences. It uses an ellipsis (. ..) to represent the intermedi-
ate (non-matching) lines. (See "Notes and Suggestions," below,
for more information on how FC reports differences.)
IB forces a binary comparison of the files. FC compares the two
files byte-by-byte, and makes no attempt to resynchronize after
a mismatch. It displays mismatches in the following format:
xxxxxxxx yy zz )
!
--!
where xxxxxxxx is the relative address of the pair of bytes (from
the beginning of the file). Addresses start at 00000000. yy and
z z are the mismatched bytes from pathnamel and pathname2,
respectively. If one file contains less data than the other, Fe dis-
plays a message, telling you which is longer.
IB is the default when you compare .exe, .com, :sys, .obj, .lib, or
.bin files.
IC causes the matching process to ignore the case of letters,
interpreting them as all uppercase. For exmaple: , '
---'

Much MORE data IS NOT FOUND


matches: ,
'-'
I

much more data 15 not found.


Use IC in source file comparisons only.
IL compares the files in ASCII mode. This is the default when
you compare files that do not have the .exe, .com, .sys, .obj, .lib,
or .bin extension.

88
, ,
; I Chapter 6 / Command Reference

l ; ILBn sets the internal line buffer to the number of lines speci-
fied by n. Files that have more than this number of consecutive,
!"\ non-matching lines cause the comparison to cancel. If you omit
! '
this parameter, FC uses 100.
IN displays the line numbers in an ASCII comparison.
IT does not expand tabs to spaces. The default is to treat tabs as
spaces to eight column positions.

i i IW causes FC to compress white spaces (tabs and spaces) during


the comparison. When you use IW, FC interprets multiple contig-
uous white spaces as one white space. Note that although FC
,.-..,
compresses white spaces, it does not ignore them. (The two
L:
I '

exceptions are any beginning and ending white spaces on a line,


which FC does ignore.) For example (an underscore represents a
white space):
______More__data_to_be_found __

matches:

n and:
!, :
________Mo r e da t a_ t o_be f 0 un d _

I ' but does not match:


______Moredata_to_be_found
r-"i
i :
l , Use the IW parameter in source file comparisons only.
Inumber specifies the number of lines that must match for the
~ file to be considered as matching after FC finds a difference.
, I
number can be in the range 1 to 9. If you omit number, FC uses
2. Use this parameter in source file comparisons only.
.--
i !
l ' Notes and Suggestions
.---,
• The two kinds of comparisons are line-by-line and byte-by-
i \ byte.
t \

• In a line-by-line comparison, FC marks off blocks of non-


matching lines, beginning each block with the last matching
line, and ending it with the next matching line. Following is
an example.
n
I :
89
, I

Chapter 6 / Command Reference : !

i I
I •

Suppose your current directory contains these source files,


in which each letter represents a program line:
r '
File1.src File2.src
a a
b b
d g
e h
f k
k m
m 0
n p
0 ( ;
p ~

FC blocks the above files as follows: ,, '


,
File1.src File2.src U
a a
b b
d g
e h
f k
k
m m
, I
n 0
0

p p
I i
For each block that contains a mismatch, FC displays:
***** filenElme1
last line that matches in the two files
intermediate, non-matching lines in first file
L
next line that matches in the two files , ,.
***** filenElme2 ,
, .
last line that matches in the two files
intermediate, non-matching lines in second file
next line that matches in the two files i
***** L.

: i
90
c--"""'

t j Chapter 6 / Command Reference

n
~_ I
Therefore, for the above files, it displays the following. (The
notes do not appear.)
n i ***** Fl1e1.src
b
d
,..--,
, \ e
1 i
f
k Note: Filel contains bdefk
,..-- where File2 contains bghk.
***** Fl1e2.src
! i b
9
h
k
*****

***** File1.src
m
n
Note: Filel contains mno
nt J 0

***** File2.src where File2 contains mo.


m
0
r-->

l j *****

• In a byte-by-byte comparison, FC displays the bytes that


are different. The following is the output from a comparison
r
, J of the Filel.src and File2.src files (above). It is produced
with the command F C 18 f i 1 e 1 . 5 r e f 1 1e 2 . 5 r c .
.--,
, I ~HH"Hl fiHi) 6: 64 67
I I '" fiHl '" liHH19: 65 68
"'''''''''''''''''''C: 66 68
n
l I
"'''''''''''''''''''F:
"''''''''''''''''12:
686D
6D 6F
"'''''''''' '" '" 1 5: 6E 7'"
r--o
fc: Fl1e1.src longer than File2.src
I i
~ .'
• If FC produces too much output to appear on one screen,
use the MORE filter to display the output one screen at a
nt I
time. For example, type:
f c I b f 11 e 1 . 5 r e f i 1e 2 . 5 rei mo r e I ENTER I
I
I
i,
I I
I '

91
Chapter 6 / Command Reference

. I
• You can redirect FC-s output to a file by appending ) tar -
ge t pa t hname to the FC command. For example, to send
:.......J

the output of the above command to the file Differ.src in


the current directory, type:
f c / b f i 1 e 1 . s r e f 1 1 e 2 . s r c ) d iff e r . s r c I ENTER I
, 1
I
• If the number of lines in the internal buffer is smaller than
the number of consecutive, differing lines, FC stops. It
I
\....-.J

displays: I
resynch failed. Files are too different LJ
Then, it returns to the MS-DOS system prompt.

Examples
J
f c / b t est 1 . s r e t est 2 . s r c > t est 3 . s r c I ENTER I I
:
I
I
l-.I
does a binary comparison of the files Test1.src and Test2.src that
are in the current directory, and redirects output to the file
Test3.src that is also in the current directory.
fc /4/w/c b;\user\myfile.src
b : \ use r \ my f 1 1 e 1 • s r c I ENTER I I i
does a line-by-line comparison of B: \ USER \ Myfile.src and U
B: \ USER \ Myfile1.src, compressing white spaces and ignoring
case. After FC finds a mismatch, at least four lines in a row I
must match for the file to be considered matching. ~

: I
L.....J

J
J
J
I I
I I
L.....J
92
Chapter 6 / Command Reference

FDISK External
I'
I ~~
..
~/
FDISK
Creates, changes, deletes or displays hard disk partitions. Use
this command to initially install a hard disk drive, to change
the current partitions, or to check the current partitions. When
initializing a hard disk, FDISK is used in conjunction with
HSECT and HFORMAT or HSECT and FORMAT, depending on
the version of the operating system you are using.

Notes and Suggestions


• When FDISK is activated, the screen displays the following
menu:
1. Create DDS Partltion
2. Change ActlVe Partltlon
3. Delete DDS Partltion
4. Display Partition Data
5. Select Next Hard Disk Drive
6. Select Prevlous Hard Disk Drive

Enter selectlon--->
Press ESC to exit to MSDDS.
• A hard disk can be partitioned to install more than one oper-
ating system on it, or for other specialized applications. Using
FDISK you determine where and how much or the total disk to
allocate for separate DOS systems.
• Up to four partitions can be made on a hard disk. If you do not
.--
I intend on using more than one disk operating system, or if
I you are not sure what systems you may use in the future,
specify one partition.
~,

• If you have already installed Drive C, choose menu item 5 to


I verify the status of Drive D.
• When selecting partition parameters, the maximum available
1-' space in cylinders will be displayed and you will be requested
to enter the partition (number of cylinders) as well as the
starting cylinder number. .
~
I

93
I

Chapter 6 / Command Reference ~

• If you need to change a previously partitioned hard disk, use


J
the BACKUP command to backup your files in the DOS parti-
, \
tion to floppy diskettes. After re-partitioning your hard drive,
use RESTORE to replace the files on the hard drive. LJ

Example ,
,
I
I
LJ
f d1 S k I ENTER I
,
loads FDISK from the current drive and displays the FDISK r
menu. To partition Drive C, press 1. The screen displays: --.J

Do you wlsh to use the entire hard disk for DOS


CY/N)---)
To select one partition, press Y. If you have a specialized need for
u
selecting more than one partition, press N, then enter the parti-
tion size in number of cylinders and the beginning cylinder as I
!e..-J
prompted.
b: I ENTER I I

f dis k I ENTER I e..-J


"
establishes Drive B as the current drive, loads FDISK and dis- I I
plays the FDISK menu. To verify the status of Drive C, select
menu option 4. The screen display shows information such as:
U
Partitlon Status Type Start End Slze , 1
N DOS 0 49 50 U
The status column refers to Active or Nonactive. An active parti-
tion is booted directly from Drive C when the system is started. I

The other columns indicate that there is one partition beginning LJ


at Cylinder 0 and ending at Cylinder 49 for a total size of 50 cyl-
inders, and that the partition contains a disk operating system.

,
-..J
94
Chapter 6 / Command Reference

FIND External
~
,
1 '
FIND [IV] [Ie] [IN] "string" [pathname ...]
FIND is a filter that searches for the specified string of text in
r
I
one or more files which are specified by one or more pathnames.
Capitalization and punctuation in the string must be the same
as in the file.

Parameters
pathname is the file to search. If you omit the pathname option,
FIND uses text from the standard input device.
string is the text for which to search. Enclose the string in
quotes. For example, to search the Bookl.txt and Book2.txt files
in the current directory for all occurrences of this string:
The whiteness of the whale

type:
find "The whiteness of the whale" book1.txt
r boo k 2 . txt I ENTER I
[
MS-DOS displays the lines in the order in which the files are
specified. If the string contains quotations, enclose each quota-
n
I
tion in double quotes. For example, to find all occurrences of this
string:
Aye, "Moby D1Ck" is a whale of a story.
[ that are in the file Book1.txt in the current
directory, type:

find "aye, ""moby dlCk"" is a whale of a


s tor y . "b 0 0 k 1 . txt I ENTER I
IV causes FIND to display all lines that do not contain the
string. Do not use this with the IC parameter.
IC causes FIND to display only the number of lines (in each file)
I~ that contain the string.
IN causes each line to be preceded by its relative line number in
the file. Do not use this with the IC parameter.

I,
95
Chapter 6 / Command Reference '

I I
~
Notes and Suggestions
• Using FIND with the IN parameter, you can determine which i,
lines contain the specified string. Then, knowing the line '-'
numbers, you can easily enter the EDLIN Edit Line command
and change every occurrence of the string. (See Part 3,)
• Suppose one of your suppliers, Johnson Auto Parts, buys out
another, Samuel Parts. You need to change all occurrences of
u
Samuel Parts to Johnson Auto Parts, in your I
B: \ USER \ Invntory.dat file. To find the line number of each c..J
occurrence, type:
find In "samuel parts" b:\user\invntory.dat
I ENTER I
MS-DOS might display a list like this:
---------B:\user\invntory.dat J
[1lspark plugs
[5ldistributor caps
[9l14" rad hose
200 6-16-83 Samuel Parts
50 6-16-83 Samuel Parts
25 6-16-83 Samuel Parts
u
(2" dia.>

Now you can use EDLIN to edit Lines 1, 5, and 9 as needed. : 1


'-'

Examples
find Ie 11- ..
b:\user\profits.dat
J
displays the number of times a negative sign occurs in
B: \ USER \Profits.dat. In this way, you can see at a glance how
many negative numbers you have in the file. (Notice the space
J
after the negative sign. This is included so MS-DOS does not I
find hyphenated words.) !
'---'
dir b:1 find Iv "dat"
displays all names of the files in the home directory of the disk
in Drive B that do not contain the string DAT.
J
J

96
J
Chapter 6 / Command Reference

r
!
FOR Internal
FOR %C IN (set) DO command
(regular MS-DOS command)

!I FOR %%C IN (set) DO command


(batch file command)

I' Executes the specified command once for each item in set.
i
Parameters
n
, set is a list of items. Each item in the list is separated with a
space or comma. You can include wildcards in the list. Files,
directories, and disk drives are only a few of the items you can
I~.
I
list.
%C is anyone-character variable except 0-9 that MS-DOS uses
to represent the items in set. DO tells MS-DOS to do the
I'
I '
command.
%%C is the same as %C, except the second percent sign is
required when the command is in a batch file.
~
I '
command is the command you are executing.

Notes and Suggestions


• Append %C (or %%C for a batch file) to the command to exe-
cute it sequentially for each item in set, substituting that
item into the command. For example:
for roB in (*.dat *.dta) do dir roB
I
I This first displays a directory of all .dat files, then displays a
directory of all .dta files. However, if you omit the %g at the
end of command, FOR executes the command one time for
rI each item in set, but does not substitute each item into the
!
command.
for roB in (*.dat *.dta) do dir
This displays a directory of the entire disk twice (once for
each item in set).
I'
I • Use FOR whenever you want to execute a command for several
items, so you do not repeat the command unnecessarily.

97
Chapter 6 / Command Refereru:e

Examples
for io fin (a: \ b: \ b : \ use r) dod 1 r io f I ENTER!
MS-DOS displays the listing for each of the three directories ~J
A: \, B: \, and B: \ USER, in order.
copy con 3dir.bat I ENTER I
rem This file displays directory listings for
io 1, io 2, and io 3 I ENTER I
rem it is called 3dlr.bat [ENTERI
for io io fin (i. 1 io 2 io 3) dod i r io io f I ENTER!
[ill [ ENTER I
, I

substitutes other directories for those in the previous command U


by creating a batch file using replaceable parameters. (See "Cre-
ating a Batch File With Replaceable Parameters" in Part 1.) To I
execute the batch file and see the listings for A: \ BIN,
A: \ GAMES, and A: \ ACCTS, type: -.-J
3dlr a:\bln a:\games a:\accts [ENTER!
MS-DOS first substitutes the directory names, in order, for the
replaceable parameters %1, %2, and %3. Then it does a DIR
command for each directory. ~ i
L..J
for iof In (*.asm) do type iof I ENTER I
displays all files in the current directory that have the extension , )

.asm. :-.J
for iof in (taxfile autofile homefi"le) do del iof
[ ENTER I J
deletes the three files, in order, from the current directory.

:..---l
I

J
i !

98
e-J
r---
, I
Chapter 6 / Command Reference

~
I '
FORMAT External
r
i
I ~ I FORMAT [drive] [IV] [11] [18] [lB] [IS]
Prepares the blank floppy diskette in the specified drive for use
by defining the tracks and sectors and writing system informa-
tion onto the diskette. You can format either a blank diskette or
a diskette already formatted. If the diskette is already formatted
r-' and you reformat it, you lose whatever programs or data are on
I ' it.
This command applies to floppy diskette only. To prepare a hard
r
I
disk, you must use the HFORMAT command.

Parameters
I:
I drive is either Drive A or Drive B. For example, if you specify
Drive A, FORMAT prompts:
r-'
I ,' Insert new diskette for drive A:
(
and strike any key when ready
Insert into Drive A the diskette to be formatted. Press the space
bar.
If you omit the drive specification, MS-DOS formats the diskette
in the current drive.
,
r-'
I ,
:
IV causes FORMAT to prompt for a volume label after the
diskette is formatted. If you use this parameter, you can enter a
r
i
label of a maximum of 11 characters, or you can press I ENTER I to
bypass the prompt. Entering a volume label helps keep track of
your diskettes.
11 performs a single-sided format of a diskette. If you omit 11,
FORMAT performs a double-sided format.
i
I
'' 18 causes a format of eight sectors per track. If you omit 18,
I FORMAT uses nine sectors per track.
IB formats eight sectors per track and allocates space for the
~'
l
hidden system files. Use the IB parameter to create a diskette on
which you can place any version of MS-DOS using that version's
SYS command. Do not use IB with IS or IV.
r! IS causes FORMAT to copy the hidden system files and COM-
MAND.COM to the diskette after it is formatted. This makes
r-.
the newly formatted diskette a system diskette.
i
99
Chapter 6 / Command Reference I
e-..J

I ,

---..J
Notes and Suggestions
• Use FORMAT to prepare a new disk to receive data. Before
you can store information on a new disk, you must prepare it
using FORMAT. After formatting, record the volume label and
date of creation. Store this information in a safe place. It helps
you estimate how long a diskette has been in use.
While formatting the diskette, FORMAT displays:
, :
Insert new diskette for drive A: U
and strike any key when ready
Note that FORMAT prompts you to insert the disk. If the disk
is already in the drive, press the space bar. FORMAT
displays:
For ma t tin 9 ... 1 I
.~

When the format is complete, MS-DOS displays this


message:
i
~
r
nnnnn bytes total disk space
nnnnnn bytes available on disk
Format another (YIN)? :L..Ji
Type Y I ENTER I to format another diskette in the same drive.
Type N I ENTER I if you do not want to format another diskette. , i
'---'
!
• Use FORMAT to clear an old disk to receive new data. First
do a DIR command and make sure you don't need any files on
I
the disk. Then use FORMAT to erase all old information and ,
:----..:
lock out any flawed sectors that have developed. FORMAT
puts the system information back on the disk and leaves the
good sectors available for information storage. .i
• The switches /1, /8, and IB are not valid for use with 3lf2-inch
diskettes.
, i

100
Chapter 6 / Command Reference

r-'
II ''
Examples
I for rna t I ENTER I
I

formats the disk in the current drive.


for rna t a: I ENTER I
formats the disk in Drive A.
~ for rna t b: /5/ v I ENTER I
formats the disk in Drive B, makes it a system disk, and asks
r you for a volume label. You can enter a label that is a maximum
I of 11 characters (for example, DISKONE), or press I ENTER I if you
don't want to label the disk.

,----,
i
I

,----,
I

,----,
i

r-'
I

101
Chapter 6 / Command Reference

, I

FORMAT External
I ~ 1 FORMAT drive: [lB] [IV] [11] [18] [IS] : )
~

Prepares the disk in the specified drive for use by defining the
tracks and sectors and writing system information onto the disk.

Parameters
drive: is the disk drive to format.
IB formats a diskette with eight sectors per track and allocates
space for the hidden system files. If you use this switch, you can , i
place any version of MS-DOS on the diskette using that version's e-.J

SYS command. If you do not use IB, you can place only MS-DOS
version 3.2 on the diskette with the SYS command. Do not use I
IB with IS or IV. ----.J

IV prompts for a volume label after the disk is formatted. A vol- , ,


ume label can be as many as 11 characters long. A volume label
identifies the disk. .-.J
11 performs a single-sided diskette format. (If the drive in which
you are formatting is double-sided, and you do not specify this !
~
I
switch, you cannot use the newly formatted diskette in a single-
sided drive.) If you omit 11, FORMAT performs a double-sided
format. \ !
LJ
18 formats eight sectors per track on a diskette if you do not
specify 18, FORMAT defaults to nine sectors per track. (You ,
,
I
I
should note that FORMAT always creates nine sectors per ,
'--'
'
track; the 18 switch tells MS-DOS to use only eight of those
sectors.)
\ i
i I
IS copies the hidden system files and the COMMAND file to the '--'
disk after it is formatted. The newly formatted disk becomes a
system disk. IS must be the last switch in the FORMAT , I
command. U
Notes and Suggestions
• This command initializes the directory and file allocation
tables on a disk. You must use this command to format all
new disks before MS-DOS can use them. , I
~
• Only the IV and IS switches are valid for a hard disk format.

102
r--
i
I ' Chapter 6 / Command Reference

r-
I '
t
• You must specify the drive that you want to format.
• FORMAT uses the drive type to determine the default format
r
( for a disk.
• When you format a hard disk, FORMAT prompts you with the
It following:
_
Enter current Volume Label for drive (x:)
~
I
Press I ENTER I if your hard disk does not have a volume label. (If
,- your hard disk has never been formatted, or if it has a bad
boot sector, FORMAT will not prompt you for a volume label.)
r If the volume label that you enter does not match the label on
I the hard disk, FORMAT displays the message:
Invalid Volume ID Format fallure
Otherwise, FORMAT continues:
WARNING, ALL DATA ON NON-REMOVABLE DISK DRIVE
"
I
t
x WILL BE LOST! Proceed with Format (YIN)?
If you want to format your hard disk, type Y I ENTER I. If you do
r not want to FORMAT your hard disk, type N I ENTER I.
• If the operating system isn't on the default drive, FORMAT
prompts you to insert a system disk in the default drive (or in
Drive A if the default drive is a hard disk drive).
• When formatting is complete, FORMAT displays a message
r--"1 showing the total disk space, any space marked as defective,
!: the total space used by the operating system (when you use
the /S switch), and the space available for your files.
• Formatting destroys any previously existing data on a disk.
• FORMAT ignores drive assignments created with the
ASSIGN command.
• You should not use FORMAT with drives used in the
ASSIGN, JOINT or SUBST commands.

,.,
I
:
103
Chapter 6 / Command Reference

\
,
.:
• You cannot format drives over the network. FORMAT returns L....J
the following errorlevel codes:
! )
a= Successful completion ~
3 = Terminated by user (Control-C)
4 = Fatal error
(any error other than 0, 3, or 5)
5 = "N" response to hard disk prompt, "Proceed with
format (YIN)?"
You can check these exit codes by using the errorlevel option
with the IF batch processing command.
• Use FORMAT to prepare a new disk to receive data. Before , ,
I
you can store information on a new disk, you must prepare it :~

using FORMAT. After formatting, record the volume label and


date of creation. Store this information in a safe place. It helps \ ;
you estimate how long a diskette has been in use. l...j
• While formatting a diskette, FORMAT displays:
I ,
Formatting ... --..J
!

When the format is complete, FORMAT displays this message:


Format complete
nnnnn bytes total disk space
nnnnnn bytes available on disk
Format another (YIN)?
Type Y I ENTER I to format another disk in the same drive. Type
N I ENTER I if you do not want to format another disk. 1 !
Examples
, i
for ma t a: I ENTER I '-1
I

formats the disk in Drive A.


for ma t b: I v I s I ENTER I
formats the disk in Drive B, makes it a system disk, and asks
you for a volume label. You can enter a label that is a maximum , i
of 11 characters (for example, DISKONE), or ,press I ENTER I if you
don't want to label the disk.

104
Chapter 6 / Command Reference

r GOTO Internal
r- GOTO label
A batch file command that transfers control to the line (in the
I batch file) following the one specified by label.
I

Parameters
:-
I
I
label is a character string. MS-DOS considers only the first 8
characters; it ignores the rest. When a batch file executes, the
r
I
l .
screen does not display its labels. Therefore, you can use labels
to include comments in a batch file.
~

iI Notes and Suggestions


• Use GOTO with the IF command to direct execution to partic-
ular subroutines when particular conditions exist. (See the IF
command.)
• Using GOTO and IF, you can create a batch file that copies a
r specified source file to a specified target file only if the target
! does not already exist. If the target exists, the file pauses so
you can halt the copy.

Examples
copy can chekdest.bat [ENTERI
rem When executing, substltute the drive for %1
and the d ire et a r y for %2 I ENTER I
rem When executing, substitute the source file
for %3, the tar get for %4 I ENTER I
I
%1 ENTER I
c h d l r %2 I ENTER I
i f nat ex 1 s t %4 got a 9 I ENTER I
t Y P e i. 4 I ENTER I
p a use I ENTER I
: 9 I ENTER I
cap y i.3 i. 4 I ENTER I
: end I ENTER I
mJ [ENTER I

105
Chapter 6 / Command Reference

1 ;
1
1 1
l.-J
This batch file checks to see if a file exists before copying it.
Suppose Newfile.asm exists in the root directory of Drive B, and
you execute the batch file by typing: ; )
u
Chekdest B: \ oldfile.asm newfile.asm I ENTER I
As instructed in the command line, the batch file replaces %1 1
1
J
I

with B:, making Drive B the current 'drive. It then replaces %2 LJ


with \, making the root directory the current directory. Finally,
it replaces %3 with Oldfile.asm and %4 with Newfile.asm. \ )
1 1
U
The batch file checks to see if Newfile.asm exists in the current
directory. If it does, the batch file uses the TYPE command to
display Newfile.asm. Then it pauses. If you want to copy over 1

:
I

en
Newfile.asm, press the space bar. If not, press I CIRL I
I
L.-....J'

If Newfile.asm does not exist in the directory, the batch file goes
I i
to the line following :G. Therefore, it does the copy automatically, I
e-J
1

without pausing.

I I
U

i.J
I '

J
1 I
---'

106
Chapter 6 / Command Reference

n GRAPHICS External
i: GRAPHICS ptype [lR] [lB] [leR] [lLF]
Reproduces a graphics screen on a printer
I
I
Parameters
ptype is one of the following printers:

Code Printer
CGP220 The Tandy CGP-220 color ink jet printer
STANDARD Any Tandy printer (other than the CGP-220
or the DMP-llO) without DIP switch set-

r tings for
compatibility
Tandy and PC printer

PCMODE Tandy printers with a DIP switch set for PC


r compatibility. Also use PCMODE for other
PC compatible printers.
TMODE Tandy printers with a DIP switch set for
r--'
I Tandy compatibility
I
DMPllO The Tandy DMP-110 printer

/R causes black to be printed as black, and white to be printed


as white. If /R is not specified, GRAPHICS prints black as
white and white as black.
l"'
I
! . /B causes the background color to be printed when the CGP-
220 printer type is selected. If /B is not selected, the back-
ground is not printed.
G
I. i
/CR causes an end-of-line character to be executed as a carriage
return.
f'
I •
/LF causes an end-of-line character to be executed as a line
feed.
~ If neither /LF nor /CR are selected, both a carriage return
!
( and a line feed are executed.

r
I

,.....,
,i
107
Chapter 6 / Command Reference

, .
i I
~
Notes and Suggestions
• The fCR and fLF switches only affect printers that are Tandy ! I
DMP standard, or are PC compatible. If you find that a line
feed is not performed when required, or that an unwanted
blank line is printed between text, use the appropriate fCR or
fLF switch to correct the problem.
:Lji
• Once GRAPHICS is initialized, reset the computer to turn off
this function. If GRAPHICS is not initialized, pressing I SHIFT I
[ PRINT I causes a text screen to be printed. When GRAPHICS is
initialized, I SHIFT II PRINT I causes the image of a graphics screen
to be printed. Pressing I SHIFT I I PRINT I a second time terminates
. i
a current print operation. u
• Graphics images are printed in a maximum of 8 shades of
gray on a black and white printer, or in 16 colors on a CGP- I
I
!
I
220 printer. On black and white printers, the image is printed ~

sideways when the video mode is 640x200.


• Once initialized, screen printing can be invoked using assem-
bly instruction INT 6. The GRAPHICS command can be
J
invoked any number of times with different parameters. If the
, I
printer type remains the same, only one copy of the program I I
.---.J
remains in memory.
• If you omit ptype in the command line, GRAPHICS displays I
this menu: ,
W
I

Tandy Graphics Screen Dump Utility


Version 3.fHl.'l'l I I
Copyrlght 1985 Tandy Corp., :.....J
All rights reserved.
Enter type of printer I
[Al For TANDY CGP-22'l printer --'

[Bl For TANDY DMP Standard printer


[Cl For PC compatible printer I
, !
[Dl For PC compatible printer in TANDY MODE ---.J
[El For TANDY DMP-11'l printer
Type the letter that corresponds to your type of printer. ,
!I
~

J
I I
----'
108
,
~

1 .
Chapter 6 / Command Reference

I
I
'
'.
HFORMAT External
r
I
1
8o 1 ~ HFORMAT [drive][lS][lV][lB]
~

Prepares a hard disk for use and, optionally, makes it an operat-


,...-,
i ing system disk by writing the system files to it. The hard disk
l can be either blank or already formatted when you enter the
HFORMAT command. If the disk is already formatted, all infor-
r- mation on it is erased when you reformat.
I '
I

Parameters
drive is a drive specification of C: or greater. If you omit the
drive, HFORMAT uses Drive C.
IS causes HFORMAT to copy the hidden system files and
I COMMAND.COM from the MS-DOS system disk in Drive A to
L _
the hard disk after it is formatted. This makes the newly format-
r---,
ted disk a system disk.
I
I IV causes HFORMAT to prompt for a volume label after the disk
is formatted. If you use this parameter, you can enter a label of
a maximum of 11 characters, or you can press [ENTER I to bypass
the prompt.
IB causes HFORMAT to prompt for information it needs to lock

r out flawed areas on the hard disk so that MS-DOS never writes
to them. (Having a small number of flawed areas is not
uncommon.)
,...,
I
L Notes and Suggestions
• Appendix D outlines the entire hard disk setup procedure.
I : Refer to this appendix as necessary when setting up your
hard disk.
r-' • Before you can store information on a hard disk, you must
I
I
prepare it using HFORMAT. During formatting, you have the
option of transferring the system files to the hard disk, mak-
ing it a system disk. System files can only be transferred
r--'
I ' using HFORMAT IS. Type cOP Y A: * . * c: I ENTER I to copy all
other files from your system diskette to your hard disk.
• Immediately after you enter the HFORMAT command, HFOR-
r
t MAT displays a message such as:
Press any key to begin formatting drive
r
I
109
Chapter 6 / Command Reference
J
Press the space bar. HFORMAT displays:
Formatting cylinders
I :

o
i I
, !
L,..J

When the format is done without error, each dash, which rep- \ :
resents an area on the disk, becomes a period. A question
mark in place of a period indicates that a portion of the disk
contains flawed areas. HFORMAT locks out these areas so
that MS-DOS never writes to them.
When the format is complete, MS-DOS displays this message:
, I
nnnnnnnn bytes total disk space U
nnnnnnnn bytes in bad sectors
nnnnnnnn bytes available on disk
J
Examples
)
hfor ma t / s [ENTER I
U
formats Drive C and transfers the system files to it. After
removing the Drive A diskette and resetting your computer, you
can start up your system under hard disk control.

, I
, !
'---'

, I
, I
---'

L
: I
~

I
--.J

, I
I I
'----'
110
Chapter 6 / Command Reference

I'
,
-HSECT External
..-
I
I
I~ Ilei HSECT [drive:]
Formats hard sectors on a hard disk. Use FDISK and HFORMAT
I to complete the hard disk format process.
l ~

Parameters
..-
l drive is the hard disk to be formatted. Your primary hard disk is
Drive C, a secondary hard disk is designated Drive D. If you
omit drive, HSECT uses Drive C.
I
I
l _.
Notes and Suggestions

Ir . • Appendix D outlines the entire hard disk setup procedure.


Refer to this appendix as necessary when setting up your
hard disk.
,.--,
l • To begin the hard disk format process, power up your com-
puter and insert an MS-DOS diskette into Drive A. Insert the
Hard Disk Utilities diskette into Drive B, and boot your sys-
tem. (If you only have one floppy drive, replace the MS-DOS
diskette with the Hard Disk Utilities diskette after booting.)
• Warning: if you want to format Drive D, be sure to specify
D:. Otherwise, HSECT uses the default, Drive C, destroying
all data on that drive.

r • To cancel the HSECT operation, press [@ or I CTRL I [Q].


• At the end of the process, the screen displays:
r
I • Format completed!
)

Example
r-
I . h:oect c:
loads HSECT from the current drive, and formats the hard sec-
tors of Drive C. The prompt, Format completed!, appears
when the process is finished.

r
!

i"
111
I I
Chapter 6 / Command Reference U

HSECT External
~B HSECT i
,
~
I
I

Hard formats track and sector information on the hard disk. Use
FDISK and FORMAT to complete the hard disk format process. i I
~

Notes and Suggestions


• Appendix D outlines the entire hard disk setup procedure. : i
~
Refer to this appendix as necessary when setting up your
hard disk.
I
• To begin the hard disk format process, power up your com- U
puter and insert an MS-DOS diskette into Drive A. Insert the
Supplemental Programs diskette into Drive B, and boot your , I
system. :......J
• After you enter the HSECT command, the following prompt
appears: ) }

LJ
Which hard drive do you
want to format (C/O)
? : '
w
To format the primary hard disk drive, type c\ ENTER I. To for-
mat a secondary hard disk drive, type d I ENTER I.
• After you select the disk to format, the screen displays the fol-
lowing warning:
All data on drlve x wlll be DESTROYED!!
Do you want to contlnue (YIN)
J
? )
I !
If you continue, HSECT erases all data from the hard disk. '-
Use HSECT only when you are installing an operating
system on your hard disk for the first time.
I ;
L..-J
Type n [ENTER 1 to exit the formatting procedure and return to
the Main Menu, or type y [ ENTER I to continue.

112
Chapter 6 / Command Reference

• After you verify the hard disk information, HSECT prompts:


Do you want to flag defective tracks (YIN)
?

If your hard disk's Media Error Map shows no defective


tracks, type n I ENTER I to begin the formatting procedure.
rL.
If the map shows one or more defective tracks, type y I ENTER I.
The following prompt appears on the screen:
En t ern ext he ad, c y lin d e r p air 0 r pre s s [ENTER I
to qult.
?
I
I As an example, if your Media Error Map lists Head 4, Cylin-
der 100 and Head 5, Cylinder 100 as defective, type:
4 , 1 "" "" [ENTER I
5 , 1 "" "" I ENTER I
r- After you enter all the defective heads and tracks listed on the
I map, press IENTER I to begin the formatting procedure.
• To cancel the HSECT operation, press ffiD or I GTRL I []J.
• Do not interrupt the program while it is formatting the drive.
When the format is complete, HSECT displays For ma t
completed!
r Examples
h s e et I ENTER I
loads HSECT from the current drive. HSECT prompts for the
drive to format.
I. b : h sec t I ENTER I
loads HSECT from the diskette in Drive B. HSECT prompts for
1 the drive to format.

I
I

113
Chapter 6 / Command Reference . i
U

I
I
i
I

IF Internal '--'

IF [NOT] condition command : )


U
Allows conditional execution of commands in batch file process-
. I
ing. When the condition is true, the command is executed. When !L.JI
it is false, the command is ignored.

Parameters
NOT changes the IF command so that the command executes
only when the condition is false.
condition is one of the following:
ERRORLEVEL number indicates that the command is to
execute only if the program previously executed by COM-
MAND has an exit code of number or higher.
stringl = = string2 indicates that the command is to exe-
cute only if stringl and string2 are identical after parame- i I
t--1
ter substitution. Strings may not have embedded
separators.
, I
EXIST pathname indicates that the command is to execute '---.!
only if the file specified by pathname exists.
I •

Notes and Suggestions :'---'I


• Use IF with the GOTO command to direct execution to partic-
ular subroutines when particular conditions exist. (See the
L....1
I
GOTO command.)
i
e-J
I
I I
L...J

: I
U

I
.--1

,I I,
~
114
Chapter 6 / Command Reference

Suppose you have three programs (Myprog, Samprog, and Sal:


prog). Each requires you to be in a separate directory. To create
r a batch file to put you in the proper directory, type:
copy con progdir.bat I ENTER I
rem ThlS file changes the dir for myprog,
samprog, or salprog I ENTER I
rem When executlng, substitute the drive for
:-:1, the program name for :-:2 I ENTER I
I' :-: 1 I ENTER'
l if :-:2==myprog goto w I ENTER I
if :-:2==samprog goto x [ENTER'
i f :-: 2 = =sal pro 9 got 0 y I ENTER'
r goto end
1
: w I ENTER'
chd 1 r \user \myprog I ENTER I
got 0 : z I ENTER'
:x I ENTER I
chdir \user\samprog I ENTER I
got 0 : z I ENTER I
: y [ ENTER I
c h d i r \ use r \ sal pro 9 [ ENTER I
: z I ENTER I
c h d i r I ENTER I
: end I ENTER I
[ill [ ENTER'
Execute the batch file by entering its filename, followed by the
drive and program name. For example, to change to the correct
directory for Myprog, type:
progdir B: myprog I ENTER I
The batch file substitutes B: for %1, making Drive B your cur-
I' rent drive. Then it substitutes Myprog for %2. It goes to label
l '
:W and changes the directory to \ USER\MYPROG. Then it
goes to :Z. The line following :Z causes CHDIR to display the
current directory to verify that it is correct.

I:
I'
!

I'
i
115
Chapter 6 / Command Reference I
.
I
I
LJ

Examples
if not exist myfile echo can't find flle I ENTER I
displays Can' t fin d f i 1e if the file Myfile doesn't exist.
if exist all.lst goto g
sends program execution to the line after :G if all.lst exists. LJ
:! ~

I I
~

I I
I

I I
I

I
.-..1

\ I

LJ
\ I
L.J

116
i
i : Chapter 6 / Command Reference

JOIN
I (ifJ 1 JOIN [drive:] [pathname] [lD]

Joins a disk drive to a specific pathname.

Parameters
drive: is the drive to be joined.
pathname is the drive and directory to which drive is joined.
/D turns off the effects of a previous JOIN command. You cannot
use /D with the pathname parameter.

Notes and Suggestions:


• JOIN links the root of a specified drive to a different path-
name. If the path already exists, it must be empty.
• If the pathname does not exist, JOIN tries to make a directory
with that pathname. After you issue the JOIN command, the
first drive name becomes invalid. If you try to use that drive
name, MS-DOS displays the error message, Invalid drive.
• You can only join a drive to a first level subdirectory, such as
join d: c:\memos. However, jOln d: c:\memos\june is
incorrect.
• To undo the effects of a JOIN command, use this format:
r-"l
join drive: /d
I •
drive: represents the drive you wish to deselect. The /D switch
turns off the effects of the JOIN command.
• To display the current JOIN status, type:
,..,
I ,
j 0 i n I ENTER I
i
Examples:
jOln b: a:\hardware

Joms the root directory of B: to the directory name


A:\HARDWARE. Now, when you type a: \hardware, MS-DOS
assumes you mean the root directory of Drive B.

~
I
117
Chapter 6 / Comnwnd Reference J
i
KEYTXX External e.-J

I ~ 1 KEYTXX [IUS]
Replaces the current ROM BIOS keyboard program with an
international keyboard program. i f
U
Parameters
IUS tells KEYTxx to convert character scan codes to US scan : I
LJ
codes.

Notes and Suggestions i i


~
• The available keyboard programs are:
KEYTFR France KEYTSP Spain i I
U
KEYTGR Germany KEYTUK United Kingdom
KEYTIT Italy
: 1
• The IUS parameter is required to operate some application U
programs that are configured for a US keyboard.
• To return to the U.S. keyboard layout from a KEYTXX pro- I I

gram, press I CTRL I I SHIFT I [ill. (Use the shift key on the left side U
of the keyboard.) To select the resident KEYTXX program
with true scan codes, press I CTRL II SHIFT I [ill. To select the resi-
dent KEYTXX program with US scan codes, press I CTRL II SHIFT I J
[ill.
• Although you can have more than one KEYTXX program res- : I
ident in memory at one time, you can operate only in the last U
loaded version.
: [
• You can use the SELECT command to create a DOS diskette I
L...J
,

that loads whichever KEYTXX program you specify. Refer to


the SELECT command for information on how to do this.
• To select the characters marked on the front of the key caps,
press [ CTRL I (SHIFT I and the appropriate character key.
LJ
• MS-DOS lets you produce an accented character. To do so
press and release the appropriate dead key (an accent key that J
does not produce a character unless it is used in combination
with another key). Then press the appropriate letter key. You i I
can use the accent character by itself by pressing the accent U
key and then pressing the space bar.
, \
.-.J
118
i Chapter 6 / Command Reference
I '

Allowable Key Combinations


r--"'
France: aAei:60uUyaelou
) Germany: aeEi6uaelou
Italy: aAei:60uUyaelou
Spain: aeiouEaeiouaAei:60uUyaefou
UK: no dead keys

I"'
I

~'
[ :

I:
n
I ~

r-'
I :

\:
r
[

I
i
'
119
Chapter 6 / Command Reference
J
I
LABEL External U

1 Ci? 1 LABEL [drive:][label] U


Lets you create, change, or delete a volume label.
I I
Parameters U
drive is the letter designation of the disk drive for the label you
I I
want to modify.
LJ
label is the volume name.
I ;
Notes and Suggestions U
• label can have a maximum of 11 characters. If you do not
, I
include a new volume name in the command line, the program
displays the following prompt: LJ
Volume label (11 characters, ENTER for none)?
Add a volume label or change the current volume label by typing
a new label consisting of 11 characters or less.
Delete the current label by pressing I ENTER I without typing a
label name.
J
Example
label a:mydisk I ENTER I
u
, I
gives the diskette in Drive A the label MYDISK. U

I
~

I I

LJ

I
U

120 J
Chapter 6 / Command Reference

LF External
~ LF
! '

Supresses line feed after a carriage return in output to printers


n 1,2, or 3.
I ;
Notes and Suggestions
• Some printers automatically generate a line feed after they
receive a carriage return. With some programs this causes an
extra line to print between each line of characters. LF sup-
presses the line feed sent to the printer by the software.
• Line feed codes are suppressed only if they are immediately
preceded by a carriage return.
• LF supports the MODE LFOFF, MODE LFON, MODE DMP,
and MODE DWP commands. LPDRVRSYS also supports
11 these MODE commands.
I

n
I

,--,

I
,--;
I ~
I

I'
I '

I'
,
121
Chapter 6 / Command Reference

LPSETUP External
LPSETUP switch, ptype, port [,page] : I
'-

Enables a printer filter that allows pagination. The text for the
page header and footer are entered into this filter with special , I
Escape Code Sequences. LJ
Parameters , I
i
,........)
switch is the filter status:
ON causes the printer pagination filter to become resident
and to take control. J
OFF temporarily disables this filter.
ptype is the printer type:
TANDY is a Tandy printer that is not in IBM mode.
: I
IBM is a Tandy or other printer that is set in IBM emulation U
mode. (See your printer manual for more information.)
port is the parallel printer port this pagination printer filter
uses. port can be 1, 2, or 3. u
page is the starting page number, in the range 1-65535, of the , I
, I
printout. The default page number is 1. '---.J

Notes and Suggestions


i
• You can insert the current date, page number, or time any- '---.J
where within the page header or footer. LPSETUP will insert
the date, page, and time wherever you place a D + =, p + =, or
T + = (respectively) in the header or footer text. Note that the
page number will always be substituted for P + =, whether
automatic page numbering (on the first line of each page) is I
turned on or off. ---.J
I

• Remember that D + = and T + = will be replaced by ten and eight


characters, respectively. Be careful not to exceed the maxi-
mum number of characters per line for your printer when typ- J
ing in header or footer text.

122
Chapter 6 / Command Reference

I~
• The first three parameters must all be included on the com-
mand line when ON is specified. OFF should be specified
r
I
alone. For example, LPSETUP ON, 18M, 1 and LPSETUP OFF
are valid commands, but LPSETUP ON, IBM is not.
• Each time LPSETUP is turned on, any previous escape codes
I'
sent to a printer in IBM mode (or to LPDRVRSYS) that deal
i ' with page length or perforation skip are cancelled. Otherwise,
there would be conflicts between the pagination attempted by
LPSETUP and that by the IBM printer or LPDRVRSYS. If
your printer is not IBM-compatible, and has been issued
escape codes an IBM printer would not understand, consult
r: your printer manual and cancel those codes to prevent the
I same printer/LPSETUP pagination conflicts mentioned above.
In particular, use whatever code it takes to cancel skip
perforation.
• Each time you invoke LPSETUP with the ON parameter, the
line number is set to 1, and the page number is either set to
the page number value in the command line, or to 1 if you
r j , omit that parameter. All other pagination settings (number of
lines per page, number of lines to skip over page perforation,
,..--. etc.) are not changed until a new escape code is issued for
I . that particular pagination setting.
I

• You must re-type the LPSETUP command each time the clock
inside your computer rolls over to a new 24-hour period (day)
to insure LPSETUP has the current date.
• If the parallel port number you specify is not available
..... (because the appropriate parallel board is not installed in
! your machine), you will be told so, and the entire command
will be aborted!

r:
I

,--,
I :

~
I

123
Chapter 6/ Command Reference

I i
~
• The characters I CNTL I II) (form feed) and I CNTL I IT] (end-of-file
marker) are trapped by LPSETUP, and are never actually
sent to the printer. A I CNTL III) will cause LPSETUP to auto-
matically print a footer on the current page, skip perforation,
and print the header on the next page, in that order. A I CNTL I
[I] will also cause LPSETUP to print the current page footer i
and issue perforation skip, but the new page number is set LJ
back to 1, and the header on this new page is not printed until
the first character to be printed on that page is sent. Hence, , I
issue a I CNTL I II) (by the LPRINT CHR$(&HC); command in ~
BASIC, or by using the PRINT utility) after each printed file
when you want to print your next file at the beginning of a
new page, but you do not want the page number of that next
page set back to 1; Issue a I CNTL I IT] (by the LPRINT J
CHR$(&H1A); command in BASIC) when you want the same
results, but with the page number set back to 1. Note, how- , I
ever, that a I CNTL I IT] has no effect if issued immediately l-i
after a I CNTL I II); at least one line of text must be printed
beyond the page header before a I CNTL I IT] will be heeded! I I
L ....I
• Each time you change the pagination format of LPSETUP
using one or more escape code sequences, be sure to set your
printer to top of form on a new page, and re-invoke the , I
I
LPSETUP command. L...J

• The maximum page number is 65535. , I

• The page header and footer may contain up to 1320 charac- :~


ters, each. If you try to exceed this limit, you will get a warn-
ing message.
• You may invoke LPSETUP with or without LPDRVRSYS in
the CONFIG.SYS bootup file.
Escape Code Sequences recognized by LPSETUP:
ESC 99(Hex) first clwr second clwr ... last clwr 0
, 1
Input for new header string composed of each separate I !
~I
character.
ESC 9A(Hex) first clwr second clwr ... last clwr 0 I I
Input for new footer string composed of each separate LJ
character.

124
i
I
I
' Chapter 6 / Command Refereru::e

r:
I " ESC 9B(Hex) 0 or 1
Input to toggle automatic page numbering on and off,
respectively, Note that embedded page numbering by the
"P + =" delimiter will always print the page number at
the designated location.
r-' ESC 9C(Hex), 0 or 1
i ' Input to specify the end-of-line character for each line
printed: 0 = line feed after each carriage return (ASCII
......
I
OD hex); 1 = line feed only after each line feed character
i ' (ASCII OA hex). Whether AUTOMATIC page numbering
is on or off.
ESC 'C' 1 to 255
Input to select number of lines per page.
...... ESC 'N' 1 to 255
i ' Input to set number of lines to skip over perforation per
page.
ESC '0'
Input to turn off page perforation skip.

n
L ;
Examples
lpsetup on,tandy,1 ,65fil

makes resident a portion of LPSETUP, and tells the resident


portion that the computer is online to a Tandy printer on parallel
port number 1, and that you want page numbering to begin at
650.
rI
I '•
lpsetup off

r--. turns off pagination by LPSETUP.


j

,r-"'
I

I
I
'•
!

I"'
,I
125
, J
Chapter 6 / Command Reference ~

I I
LJ
To send escape code sequences in formatting your printed page,
refer to this BASIC example.
I •
~
10 LPRINT CHR$(&H1B);CHR$(&H99); 'PRINT :
l---i
ESC,99,<HEADER TEXT>,0
20 LET HEAD$="*** THIS IS THE HEADER
i i
***"+CHR$(&HD)+CHR$(&HA)+"SECoND LINE"
30 LPRINT HEAD$;CHR$(&HD);CHR$(&HA);
LJ
40 LPR I NT "ON TH I S 3RD LI NE OF THE HEADER, DATE:
, I
D+=; TIME: T+=; PAGE: P+="; I I
50 LPRINT CHR$(&HD);CHR$(&HA); l.-!
60 LPRINT CHR$(0);
70 LPRINT CHR$(&H1B);CHR$(&H9A); 'PRINT I •

ESC,9A,<FooTER TEXT>,0 U
80 LET FooT$="*** THIS IS THE FOOTER
***"+CHR$(&HD)+CHR$(&HA)+"LINE 2" , )

90 LPRINT FooT$;CHR$(&HD);CHR$(&HA); ~
100 LPRINT CHR$(0);
110 LPRINT CHR$(&H1B);CHR$(&H9B); 'PRINT ESC,9B,0
, I
OR 1
120 LPRINT CHR$(1); 'TURN ON AUTOMATIC PAGE U
NUMBERING.
130 LPRINT CHR$(&H1B);CHR$(&H43); 'PRINT ESC, , I
'C',<# LINES PER PAGE> U
140 LPRINT CHR$(66); '(66 LINES/PAGE
IN THIS EXAMPLE).
150 LPRINT CHR$(&H1B);CHR$(&H4E); 'PRINT ESC,
'N',<# LINES TO SKIP PERF
160 LPRINT CHR$(2); '(SKIP ON, SKIP
2 LINES IN THIS EXAMPLE). ,I
L-J
170 LPRINT CHR$(&H1B);CHR$(&H9C); 'PRINT ESC,9C,<0
OR 1> TO SET END-oF-LINE
180 LPRINT CHR$(O); 'CHARACTER ,, .i
(CARRIAGE RET, IN THIS EXAMPLE). --..J

190 PRINT" "


200 PRINT "OK ... NoW WHEN YOU RETURN TO DOS, SET , I
YOUR PRINTER TO TOP OF FORM, AND ISSUE" U
210 PRINT "THE 'LPSETUP' COMMAND AGAIN TO INSURE
LINE AND PAGE COUNTS ARE RESET!" , I
220 PRINT " ... AFTER THAT, YOU MAY BEGIN PRINTING." !
''''''''';
230 PRINT "PRESS <ENTER> WHEN YOU ARE FINISHED
READING THIS MESSAGE."
, !
240 LINE INPUT" ";A$
250 SYSTEM ~

j
126
r---'

I Chapter 6 / Command Reference

r
i
MKDIR (Make Directory) Internal
r-
,, MKDIR pathname
MD pathname
Makes a new directory. You use the MKDIR command to create
a hierarchical directory structure.

Parameters
pathname tells MS-DOS under which directory to create the new
directory and specifies the name to give it. The pathname can
i! ' be either relative or absolute.

Notes and Suggestions


• Using MKDIR, you can better organize your files. For exam-
ple, you can group files according to user or use.
~
I ' • You can also use MKDIR to create a directory in which to put
your external commands.

I"'
I '
I

I"'
i
I
~

I"'
I
(

[ \

r-
i
I

,--..
i
I

127
Chapter 6 / Command Reference

Examples
mk d i r \ bin I ENTER I I '

~
creates a directory that you can use to contain your external
commands. Use COpy to copy your command files into this
( ~
directory, then use PATH to tell MS-DOS where to search for the I •

commands. W

mkd i r \ use r [ENTER I


I
--1
creates the subdirectory \ USER in your root directory.
md \user\joe I ENTER I
creates the subdirectory \ USER \ JOE in your \ USER directory.
mdIe t t e r s I ENTER I . !
creates the subdirectory LETTERS under the current directory. ~
If the current directory is \ USER \ JOE, MS-DOS creates the
directory USER \ JOE \ LETTERS.. i
k-J
md b:letters [ENTERI
creates the subdirectory LETTERS under the current directory 'i
of Drive B. If the current directory is \ USER \JAN, MS-DOS ~
creates the directory \ USER \ JAN \ LETTERS.

, I

\ 1

. I
I I
----J

r
~

!
-1
128
~

I\ Chapter 6 / Command Reference

r
I \
MLFORMAT External
I ~ 1~ MLFORMAT drive:
Formats a DOS2 partition created previously using
!
I
MLPART.COM (and accessed via the installable MLPART.SYS
device driver). You must format the partition to use it.
r-'
I Parameters
i '
drive: is the logical drive letter that refers to the DOS2 parti-
tion to format. MS-DOS assigns and displays the letter when it
r installs the MLPART.SYS device driver (loads it from disk into
memory). It displays the letter in the following format:
Tandy MLPART version xx.xx.xx
split disk drive
Installing additional drive on

r physical drive letter as Drive


logical drive letter
--INSTALLED--

!
I ' Notes and Suggestions
• Appendix D outlines the entire hard disk setup procedure.
r1 ' Appendices Band C include information on installing
MLPART.SYS. Refer to these appendices as necessary when
setting up your hard disk.
rI
t '
Examples
r--; rn 1 for rna t e: [ENTER I
I
r \
I
formats logical drive E.
r
I '

r-'
l '
r
I

129
:I '
Chapter 6 / Command Reference L-!

MLPART External
~/#-
! @ I ~D~ MLPART
,
I
,
,
i (

LD ~ L..-.J

Lets you create multiple non-bootable (DOS2) partitions on a


hard disk, after you create a DOS partition. The DOS2 parti- i i
i \
tions cannot be active (bootable). '--'

The MLPART command is used in conjunction with the MLFOR- )


MAT command and the MLPART.8YS device driver. It is I
'---'
:

intended for use with hard disks that have a capacity of 35 or


more megabytes. The MS-DOS partition must start in the first
32 megabytes of a hard disk, but DOS2 partitions enable you to I

make use of the remainder of the hard disk's space. G

Notes and Suggestions ,


I
I
!
• Appendix D outlines the entire hard disk setup procedure.
Refer to this appendix as necessary when setting up your , )
hard disk. ~
• When you enter the MLPART command, the screen displays
the following menu: , i
U
1. Create DDS2 Partitlon
2. Delete DDS2 Partitlon
3. Display Partition Data
4. Select Next Hard Disk Drive
5. Select PreVlOUS Hard D1Sk Drive
Enter Selection --) i
'--I
I
Press ESC to eXlt to MSDDS
I J
• You can place DOS2 partitions in any order on the disk. When :

you select the Create DOS2 Partition option, MLPART dis-


plays the number of cylinders available on the disk and the
I I
starting cylinder of the available space. It asks you to enter
the partition size (in cylinders) and the starting cylinder U
number.
J

You can have a maximum of four partitions (including the e-J


MS-DOS partition) on a disk, and each can be a maximum of
32 megabytes.
I I
• The remaining options are similar to their FDISK counter-
parts. See the FDISK command for more information.
I
-.J
130
r-
I
[ i Chapter 6 / Command Reference

r
l
Examples
m1 par t I ENTER I
loads mlpart from the current drive, and displays the MLPART
menu. To create one or more DOS2 partitions (assuming you
....- have a DOS partition), press OJ. The screen displays the status
I '
l of Drive C in this format:

,..--,
Partltion Status Type Start End Size
I 1 N DOS ~ 49 5~
! \

The status column refers to active or rwnactive. An active parti-


r--' tion is booted directly from the drive when you start the system.
l, The other columns indicate that there is one partition, beginning
at Cylinder 0 and ending at Cylinder 49, for a total size of 50
cylinders, and that the partition contains a disk operating
r system.
The screen asks for the information MLPART needs to create
, n I
your first DOS2 partition. After MLPART creates the partition,
you can select Menu Option 1 again to create more DOS2
partitions.
You can choose Next Hard Disk Drive if you want to create
multiple partitions on Drive D. After creating the pattitions, you
can select Display Partition Data to verify the size and loca-
r--' tion of each partition.
l '
,..,
I I

ri
,..,
I !,
I

,-.,
i :
\'
i
I
131
Chapter 6 / Command RefereW)e

I i

MODE External
Sets video monitor, line printer and communication interface I :I
L-.."
parameters.
MODE [characters][shiftf1j]
I I
Shifts the video screen left or right. characters is the desired
character width (40 or 80). shift can be R (right) or L (left). T
produces a video test screen for evaluating the shift. A prompt
asks if you wish another shift. Answer Y (yes) or N (no).
MODE linefeed
Sets printer linefeed off or on. linefeed can be LFOFF or LFON.
MODE printer
Sets printer type. printer can be DMP (dot matrix), DWP (daisy
wheel), or NL (reset).
MODE scan iL-....J:
Sets video scan lines. scan can be either 200 or 225.
MODE [video][characters] iu i
Sets video mode and characters-per-line. video can be BW (black
and white) or CO (color). clw,racters can be 40 or 80. I 1
MODE COLORMAP [old color new color] ~

Changes the video palette color to be displayed in text or graph- I j


ics modes from old color to new color. That is anytime a program I
L.....C
'

tries to display something on the screen in old color, it is


changed to new color. If both the old color and new color parame-
ters are omitted, all colors are reset to their original colors. If
old color and new color are the same, then that color is reset to
its original color and all other colors retain their settings. The
following colors are availabe for COLORMAP: i

LJ
Black Blue Green Cyan
Red Magenta Yellow Gray
Dark Gray Light Blue Light Green Light Cyan
Light Red Light Magenta Light Yellow White

: i
---l

132
Chapter 6 / Command Reference

l _
MODE COMnumber: [baud][parity][databits][stopbits][P]
Sets the RS232 communication parameters:
number is the RS232 port to set, either 1 or 2.
baud can be a baud rate of 110, 150, 300, 600, 1200, 2400,
r
I
parity
4800, or 960. The default is 300.
can be N (no parity), 0 (odd parity), or E (even par-
ity). The default is E.
,....-. databits can be either 7 or 8. The default is 7.
i . stopits can be either 1 or 2 stopbits. The default is 1.
l ~
P tells the printer to continuously retry to output on
timeout errors.
l : To reset a RS232 port to the default values, type: MODE COM
number I ENTER I, where number is the RS232 port number. The
default values are set and displaved on the screen.
MODE FAST
Sets the CPU speed to 7.16 MHz (the default).
MODE LPTl:characters [ltype][,P]
,..,
I ,
Sets printer characters-per-line. characters can be 80, or 132.
L~ type is the printer type: DMP for dot matrix printers or PC for
PC-compatibles. The default is DMP. IP causes continuous retry
on timeout errors.
MODE LPTl: timeout
Sets the line printer timeout delay. timeout can be LONG (2
I'
l
minutes) or SHORT (45 seconds).
M<j)DE LPTl: = COMnumber:
r-:
I Redirects parallel printer output to the specified RS232 channel.
1- '
number can be 1 or 2. Initialize the selected RS232 channel
using MODE COMnumber: before redirecting printer output.

r
I .
I
133
! !
Chapter 6 / Command Reference ,
i.-J
I

: I
MODE MONO [switch] ~

Sets the computer to use color-oriented software with a mono-


chrome monitor. Software color requests are translated to black,
white, and intense white. If you omit the switch MODE MONO
asks if you have a 350 or 200 scan line monitor (Choose 350 only
if your computer supports an optional video board and you : i
install a Mono/Text video baud.) w
switch can be: : I
I
L--J
!
ON turns on MODE MONO.
OFF turns off MODE MONO.
200 turns on MODE MONO.
350 turns on MODE MONO and changes the active
video adapter to Mono/Text.
\ 1
MODE SLOW I i
L...J
Sets the CPU speed to 4.77 MHz. (The default is 7.16 MHz.)
MODE TV I I
U
Sets the computer to use a color TV. (Sets 200 video scan lines,
color video mode, and 40 characters per line.) I I
LJ
Examples:
mode H t I ENTER I i 1
I
--.J
shifts the video display one character left and produces test
characters.
\ i
mod e If 0 f f I ENTER I .-J
causes the line printer to suppress line feeds following a carriage
return.
mode dwp I ENTER I
sets printer parameters to use a Tandy daisy wheel printer. i i
U
mode 225 I ENTER I
sets 225 video scan lines.
mod e co 80 I ENTER I
sets the color video mode with 80 characters per line. : I
~

: I
L...J
134
!
l Chapter 6 / Command Reference

mode colormap black blue [ENTERI

~ sets blue as the color to display when an application program


J requests black.

,.........,
mode com1: 3fHl n 8 1 [ENTER I
I
: sets the Number 1 RS232 interface to 300 baud, no parity, 8
databits, and 1 stop bit.
" mode fa5t I ENTER I
L
sets the CPU speed to 7.16 MHz.
mode lpt1 : 132/pc I ENTER I
specifies a line printer column width of 132 for a PC-compatible
printer.
mod e 1 p t 1: 1 on 9 I ENTER I
sets a two-minute line printer timeout delay.
mode lpt1: =com1 I ENTER I
redirects printer output to serial Port 1.
~
L.. mode mono on I ENTER I
sets the computer to use color-oriented software with a mono-
r-'
I : chrome monitor.
mode 51 ow I ENTER I
,--,
i sets the CPU speed to 4.77 MHz.
l
mod e t v [ ENTER I
sets 200 video scan lines, color video mode, and 40 characters
per line.

-,
,I '

,--.
I
C ,

135
I, II
Chapter 6 / Command Reference

MORE External
MORE L.\
I

MORE is a filter that reads from standard input and displays


one screen of information at a time. It then pauses and displays \ i
the message _MORE_ at the bottom of your screen. U
Press I ENTER I to display another screen of information. This pro-
cess continues until all the input data has been read.

Examples , '
~
type myfdes.comlmore I ENTER I
displays the file Myfiles.com one screen at a time. MS-DOS dis- I

plays the message _MORE_ at the bottom of each screen. Press i I


'--'

IENTER I to continue.
type b:acetspay.datlmore I ENTER J
LJ
displays the file Acctspay.dat from the home directory of Drive
B, one screen at a time. MS-DOS displays the message _MORE_ i '
at the bottom of each screen. Press IENTER I to continue. L.J
;

U
i
,
i;
L...l

, i
~

: i
"--"

J
!
,~
I
136
:-
L_~ Chapter 6 / Command Reference

PATCH External
PATCH pathname,address,datal,data2
Lets you make minor corrections in any disk file, provided that:
• You know the location of the bytes you want to change.
• You want to replace one list of hexadecimal values
with another list of the same length.

........, Parameters
L pathname is the file you want to change.
address is the starting address of the data to be changed (in
hexadecimal) .
datal is the list of the hexadecimal values to be changed.
~

I I
I data2 is a list of the hexadecimal data values to replace datal.

Notes and Suggestions


• In addition to using PATCH to change your own programs,
you can use it to implement minor program changes from
I Tandy. If a Tandy program ever requires such a change,
I" : ~ Tandy will distribute a document that specifies the param-
eters you need for the patch.
• If datal is not at address, PATCH generates an error mes-
sage and quits.
~
i ' Example
! ~-

patch b:filex.exe,1A23,4462A3,436~B2
IENTERJ
patches the file FILEX.EXE, located on Drive B. The command
changes bytes lA23 through lA25 to the hexadecimal values 43,
60, and B2 (assuming that they are originally 44, 62, and A3).

........,
i

:-
I

137
Chapter 6 / Command Reference I
I
I
,
~

PATH Internal
PATH [;][pathname[;pathname ... ] I,

I '
L..-!
I'

Sets a command path, which tells MS-DOS the directories or


drives in which to search for external commands. MS-DOS
always searches the current directory before it searches the
paths set by PATH. You can also use the PATH command to
u
remind you of the current path.
Unless you reset the path or turn off the system, MS-DOS
searches the specified path(s) each time you use an external
command.

Parameters ,
, I

pathname specifies the drives and/or directories in which MS- : I


'~

DOS searches for external commands. If you don't include a


pathname, PATH displays the current path setting. This serves I i
to remind you which path MS-DOS is searching. If no path is set U
(MS-DOS is searching only the current directory), PATH displays
the message No path.
, I
, I
If you specify PATH; (PATH followed by a semi-colon), MS-DOS LJ
resets the search path to null (no path set).
, i
I I
L-J

I ;
I '
~

I I
I '
~

u
\ I
:--J

138
J
Chapter 6 / Comrnand Reference

[
Notes and Suggestions
• PATH gives you the option of using commands that are not in
the current directory. Suppose the root directory in Drive A
contains so many files it is difficult to use efficiently. To save
space, create the directory A: \ BIN (using MKDIR) and put
your commands there (using COPY). Then remove your com-
mands from the root (\) of Drive A (using DEL).
Now, suppose you start up MS-DOS and immediately format a
disk in Drive B. Because FORMAT is an external command,
you must do either of the following:
• Use CHDIR to make A: \ BIN your current directory.
• Use PATH to make MS-DOS search A: \ BIN for external
commands. You can specify A: \ BIN only, or you can specify
all directories on Drive A, separating them with semi-
colons. To specify A: \ BIN only, type:
I' path a:\bin I ENTER J
I
Type PATH I ENTER I to verify the path setting.

Examples

path \bin\user\joe I ENTER I


tells MS-DOS to search \BIN\ USER \ JOE in the current drive
for external commands (after it searches the current directory).
path bin\user\joe;\bln\user\sue;\bln\dev IENTERJ
tells MS-DOS to search the directories specified by the above
pathnames for external commands. MS-DOS searches the
[: current directory and then those in the path, in the order in
which they are listed.

I" pat h ;I ENTER J


tells MS-DOS to search the current directory only.
pat h I ENTER I
displays the current path setting.
I~

r-
L._
139
I I
Chapter 6 / Command Reference L;

, i
-J
PAUSE Internal
PAUSE [message] I i
~
Suspends execution of the batch file and lets you exit the batch
file or continue. I I
~

Parameters
message specifies a message to display. The message and s t r ike
a key when ready . . . appear on the screen if echo is on.
, I

Notes and Suggestions i I


'-..J

• When MS-DOS encounters the PAUSE command, while run-


ning a batch file, it stops and displays the message: I !
I I
Strike a key when ready ...

At this time, you can press the space bar to continue execu- I
tion, or you can press I CTRL I (]J to display: --'
Terminate batch job (YIN)?
\
, I
If you press Y, execution ceases and control returns to MS- L.J
DOS. If you press N, execution continues.
,I
• During the execution of the batch file, you might need to per- ,

form some action before executing the next command (change '-.-J
diskettes or ready the printer, for example).
:
Whenever this is the case, include a PAUSE command where ~
necessary. For example, suppose you want to list two files that
are on different diskettes. Create a batch file by typing: \

cop y con t y p file s . bat I ENTER I


f
'--'
rem this file types the files rental.dat and
sales.dat I ENTER I
rem i t i s cal led t y p f i 1 e s . bat I ENTER I
t y p e b: r e n tal . d a t I ENTER I
pause I ENTER I .
t y p e b: sal e s . d a t I ENTER I
ill] I ENTER I

, I
~
140
Chapter 6 / Command Reference

Typfiles.bat displays the file Rental.dat, then pauses and dis-


plays the message: -
I"
I Strike a key when ready ...
Change disks and press I SPACEBAR I to display Sales.dat.
• Use pAUSE whenever you want an option to cease execution of
the batch file.
Suppose you create a batch file that combines all current
directory files that have the extension .lst into the file All.lst.
If the file All.lst already exists the copy will destroy the origi-
nal contents of All.lst.
To avoid destroying All.lst, create this batch file:
copy con comblist.bat [ENTERJ
I I
I ' REM This file combines *.lst files into
all . 1 s t I ENTER I
ECHO OFF I ENTER I
r IF EXIST all.lst ECHO all.lst already exists.
Pre s s [C TRL- C1 toe nd, 0 r [ENTER I
PAUSE I ENTER I
;- ECHO ON [ENTER I
I COP Y *. 1 s tal 1. 1 s t I ENTER I
[ill I ENTER J
If All.lst exists and you execute the batch file, MS-DOS
pauses and displays the message:
all.lst already exists. Press [CTRL-Cl to end
or Strike a key when ready ...
If All.lst does not exist, MS-DOS pauses and displays only:
Strike a key when ready ...

r
I '

,
i
\ '

r,
141
Chapter 6 / Command Reference

l
I
'---'
I
Examples
echo pre55 ctrl-c If un5ure or [ENTER I
pau5e [ENTER I J
pauses execution and displays the message:
,
Pre55 CTRL-C if un5ure or Strike a key when I
~
I
ready

e c hoi n 5e r t d 15k toe he c kin d r 1ve b - - [ENTER I


pa u 5 e I ENTER I
,pauses execution and displays the message:
In5ert di5k to check In Drive B--
Strike a key when ready ...

I I
I
'---'

I l

~
!
I )
I I
LJ

; I
'--'

i I,
----J

142
Chapter 6 / Command Reference

PRINT External
I ~ I PRINT [pathname [Ie] [lP]. ..] [IT]
Lets you put a maximum of ten files in the print queue, so that
MS-DOS prints them automatically while you process other MS-
DOS commands. This is called background printing. The printer
must be connected and ready.

Parameters
pathname is the name of the file you want to print. The path-
name can include a drive reference but cannot include direc-
tories. The file must be in the current directory of the drive
specified.
~
l IC deletes (cancels) from the print queue the file that immedi-
ately precedes and all files that follow IC in the command line.
IP adds to the print queue (prints) the file that immediately pre-
cedes and all files that follow IP in the command line.
IT deletes (terminates) from the print queue all files that are
[ there, waiting to be printed.
Regardless of the number of IC and IP parameters your com-
mand includes, each switch always affects the file immediately
I, : preceding it. For example, if you type this:
pr 1 nt bud 9 e t /P 5 ale 5 r en tal 5 / C I ENTER)
MS-DOS adds the files Budget and Sales, but cancels the file
Rentals.
If you omit all parameters, PRINT displays the contents of the
print queue.

r-'
I .
i

I1
143
Chapter 6 / Command Reference 1 I
U

Notes and Suggestions


• Whenever you wish to print and use your computer at the I \
same time, use PRINT. The Ie and IP parameters let you I
L..J
!

revise the print queue whenever doing so is most convenient.


For example, you can queue these ten files:
Jan May Aug :i '--'

Feb June Sept


. i
March July Oct LJ
April ,
by typing: LJ
prlnt Jan feb march aprll may June July aug
5e p t 0 c t I ENTER I I ,
l...J
Use your computer while the Jan and Feb files are printing.
Then, because these are no longer in the queue, there is room
to add the Nov and Dec files. If you have changed your mind ,i
'----'
about printing Aug, update the print queue by typing:
p r i n t nov I p dec aug I c I ENTER I i
1-
The file March is being printed, and the queue contains these
files:
1 I
April July Nov '----'
i

May Sept Dec


I I
June Oct ...J
• J

: I
U

, ,
~

: I
--J

144
J
Chapter 6 / Command Reference

oI
Examples
pr i n t / t I ENTER I
empties the print queue.
prlnt a:\temp1 .tst/c a:\temp2.tst a:\temp3.tst
I ENTER I
removes the files A: \ Templ.tst, A: \ Temp2. tst, and
A: \ Temp3.tst from the print queue.
p r 1 n t t em p 1 . t s t / c t em p 2 . t s t / pte mp 3 . t s t I ENTER I
removes the file Templ.tst from the queue and adds the files
Temp2.tst and Temp3.tst. PRINT can output either of the follow-
ing messages to the printer. They serve only to remind you that
the printout is incomplete.
All flIes Canceled by operator
You used the IT parameter to cancel the printing of all files in
the print queue.
drive:filenBme.ext Canceled by operator

I You used the Ie parameter to cancel the current file in the print
queue.

r---:
[ .

145
Chapter 6 I Command Reference ,
LJ

PRINT External
I a 1 PRINT [pathname [lD:device] [/B:size] ,
,
1
r

y [lQ:value] [Ie] [lP] ...] [IT] LJ

Prints a file on a line printer while you are processing other MS-
DOS commands (background printing). J
Parameters
pathname is the name of the file you wish to print. The path-
name is a complete path, including drive and directories.
ID:device specifies the print device. If not specified, the default LJ
device is LPT1 (printer numberl). If you do not use ID:device, the
first time you use PRINT, it qisplays a prompt that asks for the r !
print device. ~

IB:size sets the size in bytes of the internal buffer. Increasing


the value of the print buffers using IB speeds up PRINT opera- ; 1
tions. You only use this switch once, the first time you run LJ
PRINT.
IQ:value selects the number of files allowed in the print queue.
The number of files can be in the range 4 to 32, the default is
u
10. You only use this switch once, the first time
, you run PRINT.
IC turns on the cancel mode. This switch cancels the file imme-
diately preceding IC, and all files following IC and removes them
from the print queue. , I
IP turns on print mode. This switch adds the file you type imme- ~
diately preceding IP, and all files you list following IP, to the
print queue.
IT deletes all files in the print queue (those waiting to print).
J
i I
Notes and Suggestions LJ
• Wildcards (* and ?) can be used in the filename parameter.
I I
• When used without options, PRINT displays the contents of e.-J
the print queue on the screen without affecting the queue.
• Use PRINT only if you have a line printer attached and ready. I

~
• The disk containing the files to be printed must remain in the
specified drive until all printing is complete.

146
J
Chapter 6 / Command Reference

• The printer cannot be used for any other purpose while


PRINT has data to print. Any attempt to use the printer will
result in an Ou t of paper message.

Examples
r-
I . print temp1.tst temp2.tst temp3.tst
I

stores the three files indicated in the print queue. If your printer
is connected and ready, background printing begins.
print It
empties the print queue.
print a:temp1.tst Ie a:temp2.tst a:temp3.tst
removes the three files indicated from the print queue.
prlnt temp1.tst Ie temp2.tst Ip temp3.tst
removes Temp1.tst from the queue, and adds Temp2.tst and
Temp3.tst to the queue.

I
I

I
I

,!
I

r-'
!
147
Chapter 6 / Command Reference J
. I
PROMPT Internal ~

PROMPT [prompt-text]

Changes the MS-DOS system prompt to prompt-text.

w
I
Parameters
prompt-text is a string of characters to set as the prompt. It can
be any of the following: i I
LJ
• A string of characters, such as your name.
• A special prompt in the format $character, in which character
is one of those in the chart below.
J
• A combination of characters, strings, and special prompt(s).
In the prompt text you must precede the following symbols
J
with the $ character.
, I
I
Character Prompt L..J

t The current time


d The current date
p The current directory
v The MS-DOS version number
n The current drive specification
I
g The> symbol ~
1 The < symbol
I

b The I symbol cJ
A carriage return and line feed
q The = symbol J
h A backspace
e The escape sequence J
If you omit prompt-text, MS-DOS sets the current drive speci-
fication as the prompt.

148
J
Chapter 6 / Command Reference

Notes and Suggestions


• By setting the current directory as the prompt, you need not
enter the CHDIR command to remind you which directory you
are in. To set the directory as the prompt, type:
pro mp t $ P I ENTER J

• By setting the time as the prompt, you can check the time
without entering the TIME command. In this way, you can
also time the execution of commands and programs. To set the
time as the prompt, type:
p romp t $ t I ENTER I
• You can use $_ to insert a carriage return and line feed in
your prompt:
r:
I '
prompt TIME $q $t$_DATE $q $d I ENTER I
In this case, the new system prompt is similar to the
n
I I
following:
TIME = ~:~7:~4.~7
DATE = Thu 11-15-1984
n
I ' • Because your computer has an ANSI escape sequence driver
(ANSLSYS), you can use escape sequences in your prompts, if
the ANSI device driver is configured into your system. (See
I'
I ' Appendix B.) For example:
prompt $e[7m$n:$e[m I ENTER I
sets the prompts in reverse video mode and returns to normal
video mode for other text.

r:
I
Examples
pro mp t $n $ 9 I ENTER J

sets the current drive, followed by a greater-than sign (» as the


prompt. For example, when you change to Drive B, the prompt
changes to B>. When you receive your system, prompt is set to
rI ' $n$g.
i
prompt a$g I ENTER J

sets the prompt A>. Regardless of which drive you are in, this is
the prompt.

149
Chapter 6 / Command Reference . I
L...J

prompt $p I ENTER I
sets the current directory, including the current drive, as the
prompt.
Note: As you can see from the A$g example, some
prompts hinder rather than help. Use PROMPT
carefully.

: j
U

LJ

J
!
LJ
I

J
! I
~

I
. I
LJ

: I
~
150
I: Chapter 6 / Command Reference

RECOVER External
,---,
,I RECOVER pathname
RECOVER drive:
Recovers (1) a file that contains bad sectors, or (2) all files on a
disk that contains bad sectors in its directory.
,--' Parameters
j \
pathname specifies the file to recover.
,---, drive: specifies the disk to recover.
! :
Notes and Suggestions
~

1
I
'
I
• If you perform the RECOVER procedure on an entire disk, it
changes all filenames to the format, filennnn.rec, where nnnn
is a four digit number unique to each file.
~
[ I • In recovering files that contain bad sectors, MS-DOS reads the
file sector by sector. It marks the bad sectors in a system
table so that the data is never again allocated to them.
~
I • In recovering disks that contain bad sectors, MS-DOS scans
the disk File Allocation Table (FAT) for chains of allocation
units. It creates a new root directory for each chain. Use the
RECOVER drive: command only if the disk's directory is
unusable.
• If there is not enough room in the root directory, RECOVER
displays a message to this effect. It then stores information
about the extra files in the File Allocation Table. When there
is enough room, you can use RECOVER again to regain the
I"
I files.
• If you have trouble storing and manipulating information, the
~ disk may have a flawed sector. Running CHKDSK (check
I I
disk) should indicate whether this is the case. If the file that
contains the flawed sector is a text file, recover the file. This
saves all information except that in the flawed sector. Reenter
Ir . the lost information. If the file is a data file, recovering the
file mayor may not help.
r, • If you are a beginner, you may prefer reentering all informa-
I ' tion rather than trying to recover a file.

r
I '
151
Chapter 6 / Command Reference !
u

:L..Ji
Examples
recover \user\sam\pamphlet.txt I ENTER J
i .;
recovers the file \ USER \ SAM \ Pamphlet.txt that is on the cur- "--"
rent disk.
recover oldbook.txt I ENTER I : I
'---!

recovers the file Oldbook.txt that is in the current directory.


\ .
recover b :1 ENTER J
o
I

recovers the disk in Drive B if the bad sectors are in the


directory. I
~

i j

I I
• I
'-,

; i
L.J

,
I i
'--.!

152
I Chapter 6 / Command Reference
l

rI ' REM (REMARK) Internal


~ REM [remark]
I

Lets you include the specified remark in a batch file.

Parameters
remark is a message tl;lat a batch file displays during execution
if ECHO is on.

Notes and Suggestions


~
I • You can use REM to remind you of the file's name and use,
keep track of what a particular command is doing, or include
warnings in the file.

Examples
r--'
rem Thi5 flle i5 called billfile.bat I ENTER I
l
The REM statement is displayed if ECHO is on.
r
! .
rem pathname1
r,2
replace5 r,1, pathname2 replace5

displays the REM statement as a message if ECHO is on.


~
i ' cop y con 3 d i r . bat I ENTER I
rem Thi5'file di5plaY5 directory l15ting5 for
n'
i
r, 1, r, 2, and r, 3 I ENTER I
rem it i5 called 3dlr.bat I ENTER J
for r, H I N 0 1 r, 2 B) DOD I R r, r, f I ENTER I,
r! m:::J [ENTER J

:
The above command creates a batch file that, when executed,
first reminds you to replace parameters %1, %2, and %3 when
executing the file. The second remark simply reminds you of the
file's name.

rI '
I
153
Chapter 6 / Command ReferelWe ! !
~

, I
RENAME Internal LJ

REN[AME] pathname filename I


i
)
,
i-.",)

Changes the name of the file specified by pathname to filename.


,I I,
Parameters L.J

pathname is the file to be renamed.


I "
,
I
I,
filename is the new name for the file. L.J

Notes and Suggestions , r


" I
---J
• If you include a wild card in the filename, MS-DOS leaves the
corresponding characters as they were. For example, if you
type the following: i
~
i
ren newfile old???? I ENTER J

MS-DOS replaces the ? wild cards with the characters that I

occupied the same position in the original name. Newfile is U


changed to .oldfile.
• If you also include a wild card in the pathname, MS-DOS
renames all files in the specified directory that match the
pathname. For example, if you type the following:
, I
: I
RENAME *.19t *.prn I ENTER I ~

MS-DOS changes only the extension of all .lst files that are in
I I
the current directory. The new extension is .prn. The file Sue-
file.lst, for example, becomes Suefile.prn. ~

Examples I

_! I
r en b: \ u 9 e r \ 9 11 . da t 9 12 . da t I ENTER I
changes the name of the Gll.dat file that is in B: \ USER to : 1
g12.dat. U

ren b:mufile ?y???? I ENTER I , i


, I
changes the name of Mufile, a file in the current directory in ~

Drive B, to Myfile.
I !
, !
'---'

154 J
Chapter 6 / Command Reference

r
I
REPLACE External
r--'
I : [a 1 REPLACE source pathname [target pathname]
y [lA] [lD] [lP] [lR] [IS] [lW]

Updates previous versions of files.

Parameters
i
L _ IA adds new files to the target directory instead of replacing
existing ones. Do not use this switch with ID or IS.
ID replaces files in the target directory only if the source files are
newer than the corresponding target files. Do not use this switch
with IA.
IP prompts you before replacing a target file or adding a source
file.
Replace (filename) ? (YIN) _

IR replaces read-only files as well as unprotected files. If you do


not specify this switch, any attempt to replace a read-only file
r
I
causes an error and stops the replace process.
IS searches all subdirectories of the target directory while
I' replacing matching files. This switch is incompatible with the IA
I switch. REPLACE never searches subdirectories in the source
path.
!W waits for the user to press a key before replacing files. If you
do not specify this switch, REPLACE begins replacing or adding
files immediately.
rI
Notes and Suggestions
• The REPLACE command lets you easily update files on your
hard disk with new versions of software.
• The REPLACE command replaces files in the target directory
with files from the source directory that have the same name.
You may use wildcards in source filenames.
• When you specify the IA switch, REPLACE adds to the target
r
!
directory all files that exist in the source directory but not in
the target directory.

r
!
155
Chapter 6 / Command Reference

I I

• As files are replaced or added, REPLACE displays the file- L.J


names on the screen; when the replace operation is complete,
the screen shows: ,
I
,-=--'
NNN flle(s) added/repaced
or
No files added/replaced : ,
• You cannot use the REPLACE command to update hidden
files or system files. \ )

'-..J
I
• If REPLACE encounters an error, it returns one of the follow-
ing errorlevel codes:
, I
1 Command line error I
~
I

2 File Not Found


3 Path Not Found
5 Access Denied I

8 Insufficient Memory ....J


15 Invalid Drive '
Other Standard MS-DOS error I
U
You can test for these codes by using the errorlevel option
with the batch processing If command.
I I
LJ
Examples
Suppose your hard disk, Drive C, contains several files of elient
names and phone numbers. To replace these files with the latest
version of this file that exists on the disk in drive A, you would
type:
replace a:\phones.cli c:\ /5

This command replaces every file on Drive C that is named , ,


Phones.eli (in different directories) with the file Phones.cli from LJ
the root directory on Drive A.
Suppose you want to add some new printer device drivers to a I
:
I
I
directory called C:\MSTOOLS, which already contains several '-..-J
printer driver files for a word processor. To do this, you would
type:
replace a:*.prd c:\mstools /a

This command. adds any files from the default directory of drive , :I
,
A with an extension of PRD (that do not currently exist in the '--.J
\MSTOOLS directory on drive C) to C:\MSTOOLS.

156
r-

I ' Chapter 6 / Command Reference

.....
I '
RESTORE External
I"
I@I~~
i
RESTORE source drive: [target drive:]
o ....... pathname[lS][lP]

r:, Restores one or more files from diskettes to a hard disk.


RESTORE copies only files that were stored on diskettes using
the BACKUP command.
r, '
Parameters

r source drive: specifies the drive that contains the backup


diskette.
pathname specifies the hard directories and/or files you want to
r-'
I
restore.
L '
target drive: specifies the hard disk drive to which you want to
restore.
/S restores all files in the directory specified by pathname as
well as its subdirectories.
/P prompts before restoring read only files and files that have
been changed since the last backup.
l
I
' Notes and Suggestions
!
• RESTORE works best if BUFFERS = 5 (or greater) in the
CONFIG.SYS file (See Appendix B).
• As long as you have a complete library of backup diskettes,
restoring your hard disk should be straightforward. Suppose
you want to restore all the files that were backed up from all
directories on Drive C. Insert the first backup diskette into
Drive A, then type:
l'
,I restore A: C:\/S [ENTERI

• If you wish to restore several files but not the entire disk, as
in the previous example, you may want to create a batch file
r
I consisting of the necessary backup commands. Then you can
do all the backups by simply running the batch file.

r'
I
I

157
i
Chapter 6 / Command Reference L--l
,I

Examples
res tor e i3: c: * . d i3 t / P I ENTER I I I
,""":fvI
restores all files from Drive A that have the extension .dat and
that were backed up from the current directory of drive C.
, I
res tor e i3: c: \ use r \ 5 tor e 1 • d i3 t I ENTER I ~
restores from Drive A the file Storel.dat that was backed up
from the USER directory of Drive C.

I I
---.J

I :
~

i I
U

I i
L.J

I
L..J
I

I )
L!
i
I I
'---'

\ i
I '
C-.J

158
r-
I ,

I : Chapter 6 / Command Reference

!l
RESTORE External
\'
i RESTORE source drive: [target drive:]
pathname [IS] [lP] [lB:date] [lA:date]
[/~:time] [/~:time] [/1V1] [/~]

Restores one or more files previously stored with the BACKUP


r- command.
I :
Parameters
f' source drive: is the hard disk drive or floppy diskette containing
l the previously backed up files.
target drive: is the hard disk drive or floppy diskette on which you
r wish to restore the files.
pathname is the directory or file you wish to restore.
IS restores all files in the directory specified by pathname as well
as its subdirectories.

r IP matches the files specification of any hidden or read-only files.


Prompts for permission to restore them.
!B restores only those files that were last modified on or before
r the given date.
IA restores only those files that were last modified on or after the
r-"
given date.
I .
i .
IE restores only those files that were last modified at or earlier
than the given time.

r !L restores only those files that were last modified at or later than
the given time.

r
r
1M restores only those files that have been modified since the last
backup.
IN restores only those files that no longer exist on the target drive.
n
,-...,
l
ri
159
Chapter 6 / Command Reference

Examples
restore a: c:\ Is
i
V
I
restores all files backed up from all directories on Drive C.
restore a: c:*.dat/p I I
~
restores all files from Drive A that have the extension .dat, pre-
viously backed up from the current directory of Drive C.
I '
U
\ :
U
, I
: I
--.J

I )

LJ

LJ

J
~
I
160
Chapter 6 / Command Reference

RMDIR (Remove Directory) Internal


,--.
j : RMDIR pathname
RD pathname
~ Removes specified subdirectories from a disk.

Parameters
pathname is the name of the subdirectory to be removed.

Suggestions and Notes


• Whenever you delete or copy all of a directory's files, you can
remove the directory to save disk space.
! , • You can only delete an empty directory (one that does not con-
tain any subdirectories or files).
r= • You cannot remove the root directory.
Examples
,--.
I . r md i r \ bin \ u :; e r \ j 1 m I ENTER I
removes the subdirectory \ BIN \ USER \ JIM from the current
disk.
r md i r me m 0:; I ENTER I
I removes the subdirectory MEMOS from the current directory.
rmdlr b:memo:;

r: removes the subdirectory MEMOS from the current directory of


I : Drive B.

! '
r-'

r
l

161
Chapter 6 / Command Reference J
I I

chdlr\user\ann\accts :..J
copy drugstor.dat b:\user\sue [ENTERI
erase drugstor.dat (ENTER I : I
c h d i r .. [ ENTER I u
rmdir\user\ann\accts [ENTERJ

These commands remove the current directory


\ USER \ ANN \ ACCTS, which contains the file Drugstor.dat,
:I
~

from Drive B. If you wish to keep the file, Drugstor.dat, copy it


to another directory and then use ERASE to delete it from the
Drive B current directory. As MS-DOS doesn't allow you to
remove the current directory, you use CHDIR to change directo-
u
ries. Then, remove the \ USER \ANN\ACCTS directory.

\ '
U
i I
I I
~

I
,
II
C-.--.!

I I
I I
U

\ I
~

J
I
I
----.I
I
162
Chapter 6 / Command Reference

SELECT External
I,
I .
I ~ 1 SELECT country [keyboard[lUS]]
Changes the current country code or creates an internationally
configured backup MS-DOS diskette.

Parameters
country is the country code that MS-DOS uses to select the date
and time format, the currency symbol and the decimal separa-
tor. If you only specify country in the SELECT command, the
r
l .
current configuration is changed to the new country code. If you
also specify keyboard with or without IUS, a new MS-DOS
diskette is created. The IUS switch can only be used with a key-
board parameter. The following table shows the valid country
codes:
Country Country Keyboard
[ Code Code

Belgium 032 FR
~
I '
France 033 FR
Germany 049 GR
Italy 039 IT
Portugal 351 SP
Spain 034 SP
Netherlands 031 UK
United Kingdom 044 UK
Australia 061 US
French Canada 002 US
Israel 972 US
Middle East 785 US
United States 001 US
Denmark 045 *
r-' Finland 358 *
I i Norway 047 *
Sweden 046 *
Switzerland 041 *
*Indicates keyboard driver can be obtained separately.

r
I
163
Chapter 6 / Command Reference J
\ 1

keyboard specifies a two-character identifier of the keyboard lay- L.J


out. You can choose any of the keyboard codes from the previous
table or examine the directory of your MS-DOS diskette for addi- I I
tional KEYTxx.COM commands. Be sure that your MS-DOS sys- U
tem diskette is in Drive A and that it contains the
KEYTxx.COM file that matches your selection when using this
parameter.
IUS specifies US scan codes. You may need to set this parameter
to operate some application programs that are configured for a
US keyboard.

Notes and Suggestions


e...-
I
• When SELECT is used to make an international backup MS-
DOS diskette, the MS-DOS system diskette must be in Drive
A.
• You must reboot the computer with the newly created MS-
DOS diskette for the new keyboard layout and country code to \ '
change. ~
• SELECT creates new AUTOEXEC.BAT and CONFIG.SYS
files on the backup diskette. The versions of these files on the i I
original diskette are not copied. L.J

Examples I '
I I
L-!
5elect ftl44 uk

selects the United Kingdom date, time, currency symbol and , I

decimal separator and the US keyboard layout. A new MS-DOS LJ


system diskette is created with these new settings.
5elect 49 gr IU5

selects the German date, time, currency symbol and decimal


separator and causes character scan codes to convert to US scan
codes as required by some keyboard layout and application pro-
grams. A new MS-DOS system diskette is created with these
new settings.
5elect 33

causes the current date and time format, currency symbol and
decimal separator to change to French formats. " I
c.J

164
iL ;
Chapter 6 / Command Reference

SET Internal
r SET [name = [string]]
I
Sets an environmental variable equal to a string.

Parameters
name is the environment variable to assign to, string. name
cannot be numeric.
string is the string you are naming in the environment. If you
omit the string parameter, SET removes the variable name from
the environment. string cannot be numeric.
If you omit all parameters, SET displays the current environ-
ment variables and their settings.

Notes and Suggestions


L • This command is useful only in programs you have written.
• MS-DOS reserves a part of memory for environment variables.
If you use a name that already exists in the environment, SET
replaces the old value of name with the new string.
• You use SET to its greatest advantage if you have several
batch files that use the same string. For example, suppose you
have several batch files that contain %filename%. One might
contain the command:
~
I : type 7.filename7.IENTERI
Another might contain the command:
r-,

l . cop y a: 7. f i 1 e n a me 7. b: I ENTER I
Note: Within the batch file commands, the string is
r enclosed by percent signs. Within the SET com-
mand, it is not.

!"""
The first time you run all the batch files, you may want to
[ , substitute Myfile for filename. To do this, use the SET com-
mand before you begin. Type:

I' set filename=myflle I ENTER I


l

I'
I

165
I \
Chapter 6 / Command Reference
U
I J

MS-DOS automatically substitutes each occurrence of file- ~


name-in all batch files-with Myfile. Now suppose you want
to substitute Samfile for filename. Reset filename by typing:
set fllename=samflle I ENTER!
To void the setting, type:
set filename= [ENTER!
:I L-J

• The SET command lets you write versatile batch files. An I )

example is to use the SET and the PROMPT commands : I


L-J
together to set up a series of easy-to-change system prompts.
Suppose you have four system prompts, all of which you use
often. Rather than repeatedly entering the PROMPT com-
mand with parameters, use batch files to do the work for you.
First, assign each prompt a unique parameter that is to repre- I i
sent it in a batch file. LJ
I promptd = default prompt (current drive)
promptl = time and date I I

• prompt2 current directory LJ


I prompt3 = version number and a greater-than symbol
j
Then set a name for each string (the codes required by the
PROMPT command). For example:
set promptd=$n$g I ENTER I
, I
~

set prompt1=The tlme is $t$ __The date is $d


I ENTER I , I

set prompt2=$p IENTER!


set prompt3=$v$g I ENTER I )

---l

I
~

166
r-
l Chapter 6 / Command Reference

Now create four batch files, each containing a PROMPT


command, as follows:
copy con promptd.bat I ENTER J
rem Thi5 flle change5 the 5Y5tem prompt to
the default (current directory> [ENTERI
~ pro mp t %pro mp t d %I ENTER J
I
[ill I ENTER I
r---' copy con prompt1.bat I ENTER I
I: rem Thi5 flle change5 the 5Y5tem prompt to
the current time and date [ENTERJ
pro mp t %pro mp t 1 % [ENTER I
I' [ill I ENTER J
I
copy con prompt2.bat [ENTER I
rem Thi5 file change5 the 5Y5tem prompt to
the current directory [ENTER I
prompt %prompt2% I ENTER I
[ill I ENTER I
[ copy con prompt3.bat I ENTER I
rem-Th19 file change5 the 5Y5tem prompt to
the ver5ion number and greater-than 5ymbol
I ENTER I
promp~ %prompt3% I ENTER I
[ill [ ENTER I
Now you can quickly change your prompt to any of these four
simply by executing the appropriate batch file. For example,
I' execute promptd.bat by typing:
I !
pro mp t d I ENTER I
\ The file replaces the promptd name with the $n$g string and
I\ -. changes the system prompt accordingly.
If you want to use prompts other than those set, you can
either set them or change an existing setting. Remember, the
settings continue to affect these files and other batch files
until you change them or reset or turn off the computer.
• Note to Experienced Users: You can use SET to affect applica-
tion programs, as well as batch files. Refer to the documenta-
tion on "Program Segment Prefixes" in your computer's
i'
i . Programmer's Reference Manual for more information.

167
Chapter 6 / Command Reference . I
.--1

1 I

Examples ~

I ENTER I
5 et d rive = b:

assigns the environment variable name, drive, to the B: string. u


5 et d r i ve I ENTER I , i
L..J
voids the current setting for the variable name drive.
5 et tty = v t 2 [ENTER I I :
~
sets your TTY (console) value to VT52 until you use another
SET command to change it.
5 et [ENTER I
displays the current environment variables and their settings.
1 I
U

I '
LJ

LJ

i J
e...-..J

J
J
168
r-
I Chapter 6 / Command Reference

SHARE External
I ~ 1 SHARE [IF:space] [lL:locks]

Installs file sharing and locking for active networking.

Parameters
[' /F:space allocates file space (in bytes) for recording file sharing
i information. Each open file needs the length of the full filename
plus 11 bytes. The average pathname is 20 bytes. The default
value is 2048 bytes.
L:locks specifies the number of locks allowed. The default is 20.

r
, .
Notes and Suggestions
• Once you use SHARE in an MS-DOS session, SHARE checks
all read and write requests.
I'
I • MS-DOS uses SHARE only when networking is active.
Include the SHARE command in the AUTOEXEC.BAT file if
you wish to install shared files at startup.

Example
share /f:4096 /1:30

doubles the default number of bytes for the storage of file sharing
information, and increases the number of allowable locks to 30.

I'
I

169
Chapter 6 / Command Reference

: I
U
SHIFT Internal
SHIFT
Lets you use more than the usual ten replaceable parameters
I I
(0%-9%) in batch file processing. c...J
Notes and Suggestions
• To see how SHIFT works, suppose a batch file, Money.bat,
contains replaceable parameters, defined on the left in the fol-
lowing chart. When you enter the SHIFT command, each defi-
nition shifts one place. Instead of replacing %n, it replaces
%n-l.
Definitions Before Definitions After I I
Shift Shift I.-;

%0 = Money %0 = Pharm.dat
, I
%1 = Pharm.dat %1 = Autodeal.dat LJ
%2 = Autodeal.dat %2 =. Hardware.dat
%3 = Hardware.dat %3 = Grocery.dat
%4 = Grocery.dat %4 = Dimestor.dat
%5 = Dimestor.dat %5 = Theater.dat
: I
L...J

%6 = Theater.dat %6 = Cafe.dat
%7 = Cafe.dat %7 = Photo.dat J
%8 = Photo.dat %8 = Beauty.dat
I
%9 = Beauty.dat %9 = Undefined LJ
As you can see, %9 is now open to be redefined. Money, on the
I
other hand, no longer replaces any parameter. If you must U
refer to Money again, you must· set an environment variable
equal to %0 before you use the SHIFT command.
• You can execute as many shifts as needed. If you do, however,
include ECHO %n in your file as needed to keep track of each
replaceable parameter's current definition.
, I
U

:----'!
I '

170
Chapter 6 / Command Reference

Examples
shi f t I ENTER I
shifts all parameters that replace the parameters %0 through
%9 down one. Suppose that, before the shift, %1 equals Den-
r-. file.dat and %2 equals Myfile.dat. After the shift, %0 equals
I ' Denfile.dat and %1 equals Myfile.dat.
copy con shiftcop.bat I ENTER)
rem Stop execution at pause after all files are
cop i e d I ENTER I
I
: p a use ENTER I
p a use I ENTER I
cop y a: \ use r \ X 1 b: \ use r \ X 1 I ENTER I
s h i f t I ENTER I
got 0 p a use I ENTER I
I'
I rm I ENTER I
is a batch file that lets you copy as many files as you wish from
A: \ USER to B: \ USER. It substitutes the first given file for %1
and copies it. Then it substitutes the next file, copies it, and so
on. This way you can use SHIFT to gain access to more than ten
replaceable parameters. Even if you don't need that many
iI parameters, however, you can use SHIFT to save typing time.
To copy the files Find.exe, Name 1. asm, and Name2.asm from
A: \ USER to B: \ USER, enter the name of the batch file, followed
by the files to copy, as shown here:
shiftcop find.exe name1.asm name2.asm I ENTER I
r
I ' The batch file pauses before each copy, giving you the option to
stop. After it copies all files, press I CTRL I @] at the PAUSE prompt
r
I
(Stnke a key when ready ••• ).

r
I

171
Chapter 6 / Command Reference J
I I

~
SHIPTRAK External
lei SHIPTRAK i
1-.1
j

Parks the heads of a hard disk at the innermost tracks in prepa-


, !
ration for moving the drive unit.
--J
Notes aJ;ld Suggestions
• Jarring your hard disk can cause its recording heads to bump
against the highly polished surface of the recording media,
destroying stored data. Such jarring can easily happen when
you move your hard disk drive.
SHIPTRAK moves all your hard disk's recording heads onto
the innermost tracks where information is not stored, and
where such inadvertent bumping cannot destroy data.
• Always use SHIPTRAK before relocating your hard disk or
anytime you think it might be bumped or jiggled. i I
L.....J
• After running SHIPTRAK, immediately turn off the system.
Wait at least 15 seconds before turning on the power again.
• Your hard disk is a precision instrument, built to extremely
close tolerances. Always handle it very carefully, even after
parking its heads with SHIPTRAK. I

--J
Example
5 hip t r a k I ENTER I
J
parks your hard disk heads at the innermost tracks.

, f

i
L.....J
I

172
I ' Chapter 6 / Command Refere17£e

SORT External
SORT [lR] [I + n] [<input pathname]
[>output pathname]

SORT is a filter that reads input from the standard input device,
sorts the data, and writes it to the standard output device.

I'
I
Parameters
<input pathname specifies the file to be sorted. If you omit this
r-' parameter, SORT sorts keyboard input.
I >output pathname specifies the file to receive the sorted infor-
mation. If you omit this parameter, SORT sends the output to
the display.
/R reverses the sort (sorts from Z to A). If you omit this parame-
ter, the sort is from A to Z.
r:
L ' / + n begins the sort at Column n. If you omit this parameter,
the sort begins at Column 1.
r--;

,I Notes and Suggestions


• Use SORT to alphabetize a file by a certain column. Suppose
you have this information in a file, Mail.dat, on the current
drive.
Janet King 28th St. Li'ncoln NE 68502
Samuel Beck 46th St. Rapid City SD 57001
Sal Cleo 79th St. Ft. Worth TX 76133
To sort the file alphabetically, according to last name, and
then store the sorted output in another file, type:
f'
I
sort /+2 <mail.dat>sortmail.dat I ENTER I
SORT sorts the contents of Mail.dat, starting at Column 2,
r and outputs the sorted data into the file Sortmail.dat.
I '

r
i
173
Chapter 6 / Command Reference , I
LJ

! I
L..J
Examples
sort /r <unsort.txt >sort.txt I ENTER I ,
i ,
I
~....J
reads the file Unsort.txt, sorts the information in reverse alpha-
betical order, and writes the output to a file named Sort.txt.
di r Iso r t / +14 I ENTER I
, i
'--I

pipes the output of the DIR command to the SORT filter, which
sorts the directory listing, starting at Column 14, and displays , 1
the output. '-.J
d 1 r Iso r t / +14 I m0 r e [ENTER I
: I
is the same as the previous command, except that the MORE fil- LJ
ter displays the directory one screen at a time.

, I
LJ
: I
, I
,----'

1
: I

'U
, I
I I
L...J

I I
-.J
I
I I
LJ

J
l I
~
174
r-

I: Chapter 6 / Command Reference

I: SPOOLER External
II SPOOLER [lprinter] [lP] [IS] [Ie] [lG]
,
Lets you send commands to and get the status of the print
spooler, assuming the SPOOLERSYS device driver exists in
your CONFIG.SYS file.

Parameters
printer is the number of the printer you want to use. It can be
either 1 or 2. If you omit the number, the system assumes 1.
Notice that you must precede the number with a slash (I). You
can install two spoolers if you have two printers connected.
/P pauses the spooler. Using the /P switch is similar to toggling
r; the off-line switch on the printer. Using /P a second time turns
I '
off the pause. The pause goes off automatically when the printer
buffer is full to prevent the computer from locking up.
r
l ' /S interrupts the spooler's buffering so that your computer imme-
diately stops printing data in the buffer. All printer data goes
directly to the printer. This feature enables you to print data
r""'" without waiting until the buffer is empty. LIse /S again to
I '
restart the buffering.
I' /C clears the spooler. Any data remaining in the buffer is not
I ' printed.
/G returns the status of the spooler (installed, pause on/off, buff-
ering on/off, size of buffer, percentage of buffer full).

Notes and Suggestions


• The spooler slows any programs that disable the spooler idle
interrupt, such as programs written in BASIC.
• The spooler might slow the CPU clock slightly.
• Refer to Appendices Band C for information on installing the
SPOOLERSYS device driver.
r
! :
Examples
r:\
!
5 poole r [ENTER I
starts print spooling for Printer 1.
I"'
I ,
I
175
Chapter 6 / Command Reference

spooler 12 Ip I ENTER J
pauses print spooling for Printer 2.
I )

s p 0 0 1e r 12 1 P I ENTER I -.J

restarts print spooling for Printer 2.

\ J

, J
I
~

i i
LJ

, I
i I
L.J

, I
-J

, I

\, I
I
--!

, I
~

I I
I
-.i
176
Chapter 6 / Command Reference

SUBST External
I ~ 1 SUBST [drive:] [pathname] [lD]

Substitutes a virtual drive name for pathname.


!,
Parameters
drive: is the virtual drive name.
pathname is the pathname you want to refer to as drive:.
/D deletes the association between drive: and pathname.
rI '
MS-DOS displays the names of the current virtual drives if you
omit all parameters.
r-
I '
I Notes and Suggestions:
• The virtual drive: must be in the range A: to LASTDRIVE:.
G
~- \
If the LASTDRIVE command is not in your CONFIG.SYS file,
SUBST defaults to E: as the virtual drive: name. (Refer to
Appendix B for more information on LASTDRIVE.)
r
t ' • The virtual drive: cannot be the same as the current drive.
• The virtual drive: cannot be the same as a drive reference
rI included in pathname.
• SUBST creates or deletes a virtual drive by associating a
pathname with a drive letter.
r
1 i • When MS-DOS sees a drive that was created with SUBST, it
replaces the reference with the new pathname.

Examples:
subst d: b:\usr\fred\forms
r-

! creates virtual drive D for the pathname B:\USER\FRED\


forms. Now, instead of typing the full pathname, type D: to go to
I' this directory.
,I :

I"'
I .
I •

177
Chapter 6 / Command Reference i
L...J

, I
I :
SYS (System) External L...J

SYS drive: I ,I
....J
Transfers two hidden system files from the current disk to a for-
matted diskette in the specified drive. I i

Parameters
\ }
drive: is the drive containing the diskette to receive the files. ii'
L...J

Notes and Suggestions , I


\ I
• The two hidden system files must be the first two files on the L...J
target diskette. If there is no room on the diskette or in the
diskette's directory, the SYS program does not work. , I
; I
L...J
• If the target diskette is blank, SYS converts it to a system
diskette. If the target diskette contains old system files, SYS
updates the system.
• COMMAND.COM (the command processor) is not transferred.
LJ
You must use the COPY command to transfer
COMMAND.COM. u
Examples \ )
i
5 Y5 b: I ENTER I :-J

transfers the system files from the current diskette to the


diskette in Drive B.

I I
I I
U

I )
, I
I .
'--J

i I
I

I I
I i
LJ

I I
~
178
Chapter 6 / Command Reference

TIME Internal
TIME [time]
Displays or sets the time. You can change the time from the key-
r! board or from a batch file. (Normally, MS-DOS displays a time
prompt each time you start up your system. It does not, however,
if you use an AUTOEXEC.BAT file. Therefore, you may want to
r--' include a TIME command in that file.)
I
Parameters
r: time specifies-the time to set in the hh:mm:ss.cc format.
hh = 0-23 (hours)
mm = 0-59 (minutes)
ss = 0-59 (seconds)
r
I I
cc = 0-99 (hundredths of a second)
If you include only part of the information (such as the hours)
rI and press I ENTER I, the fields that follow default to zero.
.
I '
If you omit the entire time parameter, TIME displays the cur-
rent time and prompts you to enter the new time. Enter it in the
~ 24-hour format, or press I ENTER I if you do not want to change the
I time displayed.

Notes and Suggestions


• You can omit any part of the time parameter. However, if you
include a part of the time parameter, you must include all pre-
r-'
I
J
vious parts. For example, if you include the seconds (ss), you
must also include hours and minutes.
• When you change the time known to the system, you also
change the time in any application program you use. This can
be very handy.
r--' Suppose you have a program that keeps track of customer
! calls according to the date and time received. For some rea-
son, you get behind and can not enter the information at the
correct time. Simply enter it later, after turning back the
clock to the necessary time.

,r
I

179
Chapter 6 I Command Reference i
-1

, I
, I

• You can also use DATE and TIME to include the date and --.J
time on a printout. (See the DATE command.)
I
• TIME lets you keep track of the time and can give you an L-l
idea of how long it takes to run a particular ·program.
• You can change the time format by adding the COUNTRY , :
I
command to your CONFIG.SYS file. Refer to Appendix B for ~

more information.

Examples '--
I

tim e 1 4 I ENTER I
sets the time to 2:00 p.m.
TIM E 2: 32 I ENTER I
, /

sets the time to 2:32 a.m. :' - -I

tim e 0: 0 : 0 • 5 I ENTER I
I i
I
sets the time to one-half (50/100) second past midnight. L-J

:'-.Ji

: I~

, !
I I
L-...J

, I
i I
L.J

i I
.........J

180
Chapter 6 / Command Reference

r TREE Internal
TREE [drive:][lF]
,,
\

Displays all directories, subdirectories, and (optionally) all files


on the disk in the specified drive.

Parameters
I' drive: is the drive that contains the diskette you wish to exam-
1
ine. If you do not specify drive, the current drive is assumed.
IF displays all files in all levels of subdirectories.
\'
i
Examples
I""' t r e e b: I ENTER I
l
displays all the directories at all levels contained on the diskette
in Drive B.
t r e e a: If> P r n I ENTER I
lists to the printer all subdirectories and filenames on the
diskette in Drive A.
tree a:/f>adir.filIENTER!

writes all the subdirectories and files on Drive A to be placed in


the disk file Adir.fil on the current directory of Drive A.

I""'
I
! '

r'"""""'
I
,..--,
j

rI
181
, I
Chapter 6 / Command Reference I I
LJ

i
TYPE Internal \.......J
I

TYPE pathname I I
w
Displays the contents of the specified file. TYPE makes only one I
, !
change to the file's format. It expands tabs to spaces consistent '---'
with a tab stop at every eighth column.

Parameters
pathname is the name of the file to list.
,
\ I
L-J
Notes and Suggestions
• A display of binary files sends control characters (such as I I
bells, form feeds, and escape sequences) to the standard out- I
L-J
I

put device.
• Use TYPE to see if you need to change a file. If so, you can
use EDLIN to make the change. (See Part 3 for information
on EDLIN).
\ i
I I
Examples U

type \user\taxflle.dat [ENTER I


I )
, I

displays the file Taxfile.dat that is in the USER directory in the ~


current drive.
type b:carfile I ENTER I !
~
displays the file Carfile that is in the current directory of Drive
B. I I
, I

type b:\budget\clothes [ENTER I LJ


displays the file Clothes that is in B: \ BUDGET.

;
r
e...-i

182
J
Chapter 6 / Command Reference

\'
I VER (Version) Internal
VER
Displays the number of the MS-DOS version that you are using.

Notes and Suggestions


r--"
• If you have a question or comment about your system, you
i need to know the MS-DOS version number when you contact
the Radio Shack Customer Service Department.

Example
ve r I ENTER I
r
t _
displays the version number.

r
r
! '
r--"
I
/

[""'

l \
,---,
I t

r.
,
183
,
Chapter 6 / Command Reference i
~

VERIFY Internal
VERIFY [switch]
J
Turns the verify' switch on or off, or displays the current setting
of VERIFY. VERIFY has the same purpose as the IV switch in I
I i
i

the COpy command. When it is on, it tells MS-DOS to verify e.--J


that the data written to disk can be read without error.
! I
Parameters ~

switch can be ON or OFF.


I
. i•
ON/OFF remain in effect until a program executes a SET VER- .--.J
IFY system call or until you use the VERIFY command again.
When VERIFY is on, it verifies all writes to disk. I i

If you omit all parameters, MS-DOS returns the current setting LJ


of VERIFY.
iL...Ji
Notes and Suggestions
• By keeping VERIFY on, you always know that data written I ;
to disk can be read back. Note, however, that this slows I
--.J
I
operation.

Examples :~!
ve r i f yon I ENTER I
, ,I
tells MS-DOS to verify all writes to disk. ,
I........!

ve r i f Y 0 f f I ENTER I
I
tells MS-DOS to stop verifying writes to disk. I I
l-l

i I
~

. ,
L-J

I !
~
184
r-
I Chapter 6 / Command Reference

,.,
!
VOL (Volume) Internal
1 VOL [drive:]
Displays the volume label of the disk in the specified drive. (You
r can assign a label by using the IV parameter in the FORMAT
!- command.) If the disk does not have a volume label, VOL
displays:
~ Volume in drive n has no label

Parameters
drive: indicates the disk for which you wish to display the label.
If you omit the drive, MS-DOS displays the volume label of the
current disk.

Notes and Suggestions


r
L.
• Enter the VOL command whenever you forget a volume label.

Example
r, vol b: I ENTER I
MS-DOS displays a message similar to this:
Volume in drive B is DISKONE

vo 1 I ENTER I
rL
displays the volume label of the current disk.

...
l
~

185
, I
Chapter 6 / Command Reference I
e--.J
I

I I
XCOpy External :....J

XCOpy source pathname [target pathname] [lA]


[lD:date][lE] [1M] [lP] [IS] [IV] [lW] J
i
Copies either a file or a directory and (optionally) the directory's I !
~
subdirectories. Unlike DISKCOPY, XCOPY does not require that
the source and target disks have the same format. You can
XCOPY between different disk drive types or different media
types.

Parameters
source pathname is the name of the drive, directories, andlor file
you want to copy. If you omit the directory part of source path-
, I
name, XCOPY copies the file from the current directory. If you
omit the filename part of source pathname, XCOPY uses the LJ
wildcard *.*, and copies all files in the directory.
target pathname is the name of the drive, directories, or file to :
LJ
:
which you are copying. If you omit the directory part of target
pathname, XCOPY copies to the current directory. The default , I
filename is *.* U
IA copies only source files that have their archive bit set. It does
not change the archive bit of the source file. (See ATTRIB for , I
information on how to set the archive bit.) \, ,j
L....J

ID:date copies only those source files modified on or after date.


The date format varies, depending on the country code that you
are using.
IE copies all empty directories of the specified directory. You
must use IS if you use IE. I j
U
1M copies only source files that have their archive bit set, and
turns off the archive bit in the source files. (See ATTRIB for
information on how to set the archive bit.) L..-:
i
IP prompts you to confirm that you want to copy each source file.
I

IS copies the specified directory and its subdirectories (as long as -.J
i
the subdirectories are not empty). When used with IE, IS copies
the empty subdirectories, as well. If you omit IS, XCOPY works
within one directory.

: I
~
186
Chapter 6 / Command Reference

IV verifies each target file as it is written to be sure it is identi-


cal to the source file. .
/W waits to begin copying the files. XCOPY displays the
message:
Press any key when ready to start copying files
Press any key to continue, or press I CTRL J W to cancel XCOPY.

n Notes and Suggestions


• XCOPY uses the following rules for copying files:
• If the source is a directory, the target is a directory.
• If the source includes multiple files, the target is a direc-
tory. For example, if the source is A:, and Drive A con-
tains more than one file, the target is a directory.
• If you append a backslash (\) to a target name, that tar-
get is a directory. For example:
xcopy payroll a:\workers\ I ENTER I
creates the directory A: \ WORKERS if the directory does
not already exist, and copies the file Payroll to it.
• If you are using Version 3.2 MS-DOS, the XCOPY command
rI
l I might prompt you to specify whether the target is a file or a
directory. If you don't want to receive this prompt, type:

n
! \
copy Ib xcopy.exe
mcopy.exe I ENTER I

,.--,
This creates a new command called MCOPY.EXE. Now, you
can use the MCOPY command the same way you use XCOPY,
l : except that you won't receive the prompt.

Examples
xcopy a: b: Is Ie IENTERJ

copies all the files, directories, and subdirectories (including


empty subdirectories) on Drive A to Drive B.

r
t '

187
Chapter 6 / Command Reference ! ~

xcopy jobstat b:\status\ /vIENTERJ

copies the file Jobstat from the current directory to the STATUS
directory of Drive B, and verifies that the source and target files
are identical.
xc 0 pya: b: / a I ENTER I
copies all read-only files in the current directory of Drive A to
Drive B.
xcopy a: b:\modfiles\ /d:11/15/86IENTERI

copies from the current directory of Drive A all files modified on


or after November 15, 1986, and places them in the \ MOD- , ,
FILES directory on Drive B.

I :
, !

........J

I
:-.1

188
r--'
I !

r--'
l. ,1

I :
t. J

n
n
l ;

--,

i !

n
I'
l j

--,
I I
l J

n
Chapter 7

r
i
THE LINE EDITOR (EDLIN)

r-'
I
Although the line editor EDLIN and the MS-DOS Commands
editing function are separate utilities, many of their operation
keys are identical. This chapter provides a quick reference for
these keys. Chapter 8 provides sample sessions and instructions
for command-line editing. Understanding the command editing
features will greatly assist you in learning the full editing fea-
I'
i tures of EDLIN, described in Chapter 9.

Function Keys
You can accomplish many editing functions by using special
keys. Following is a chart that illustrates each key and its
function.
Function Key(s) Description

Copy char copies a character from the


template to the command
line and displays it.
Delete char deletes a character from the
template. The character is
skipped and not copied to
the command line.
Copy to char ill] char copies all characters up to
I'
I
the specified character and
displays them.
Delete to char em char deletes all characters up to
the specified character from
the template. They are
skipped and not copied to
the command line.
Copy all copies all remaining charac-
ters and displays the entire
command line.
Insert enters the insert mode.
,..., Press [ill to exit.
I

189
: I
Chapter 7 / The Line Editor (EDLIN) ~

Replace makes the new line the new


template template, but does not exe-
cute the command (accepts
the line for more editing).
Void line voids the current input.
Leaves the template I I
u
unchanged. Type and enter
a new line, or press I ENTER I to , ,
display the system prompt.
LJ
Enter line makes the new line the new
template and sends it to the , i
requesting program. U
End-of-file @or puts an end-of-file character
I CTRL 1m in the tempIate.
J
i
, !
'-.-I

I I
U

: I
'---'

190
Chapter 8

EDITING COMMANDS

I
'-
MS-DOS has several special editing features to help you change
commands. Learning to use these features can save you time.
I,
The Template
i'
! . You edit commands in MS-DOS through a special storage area,
the template. When you press I ENTER I after typing a command,
MS-DOS sends the command to the cpmmand processor (COM-
MAND.COM) for execution. It also sdnds the command to the
template. Only one command at a time is stored-the last com-
mand entered. You can then recall the command from the tem-
r plate for editing or reexecution.
I

Display and Change


Assume you have two files, Prog.com and Prog.asm, in the root
directory of your MS-DOS diskette. If you type the following
command:
dir prog.com I ENTER J

MS-DOS displays information about the file Prog.com. At the


same time, it saves the command line (DIR Prog.com) in the
template.
I'
I : Press em to display the command line. (The underscore is used
here to represent the blinking cursor.) The screen displays:
di.r prog.com _
I'
f
Execute the command again by pressing I ENTER I
To display information about the file Prog.asm, edit the com-
mand line DIR Prog.com. Type:
mJc
MS-DOS displays all characters of the command line up to but
not including the letter C, as shown.
dir prog._

r-,
I

191
j i
Chapter 8 / Editing Commands U

I ;
, I
i I
Now type: '--J

asm_
i
L.-i
I
The letters asm replace the letters com, resulting in:
dir prog.csm_
!
L...J
I
This new command line is now in the template. To execute it,
press [ ENTER I.
I
I I
i
L....)
Overtype and Insert
Replace DIR with the TYPE command by typing: iI I
,
L.-i
TYPE_
The characters TYPE automatically replace the characters DIR ,
I I
1

and the space that followed. L..J

Now press [INSERT I, press the space bar, then press ffiJ. The result
I 1
is: LJ
TYPE prog.asm_
To execute the new command, press [ ENTER I. : i .........J

Saving in the Template I


LJ
Suppose you misspelled TYPE as BYTE, but had not entered the
command. (Set up this situation by typing BYTE and pressing
ffiJ again.) Your screen displays: I J
U
BYTE prog.asm_
To avoid retyping the entire command, press mJ. The symbol @ r I
appears at the end of the line. This indicates that MS-DOS has '----'

put the new line in the template, although it has not sent it to
be executed. , ,
;L..JI
Now edit the line BYTE prog.asm so it becomes TYPE prog.asm.
To do so, type:
ITl80ffiJ J
The 8 copies a single character Y from the template to the
command line. The resulting command line is:
,TYPE prog.asm_
-,
I
--J
192
I'
i Chapter 8 / Editing Commands

Deleting
n
, I
You can make the same change another way. To edit the line
BYTE prog.asm, press [ill again. Then type:
I DELETE I I DELETE I G I INSERT I [YJ (I) [ill
Pressing I DELETE I twice deletes the first two characters (B and n.
The G key copies the third letter T. I INSERT I enters the insert
mode so that you can insert the letters Y and P. [ill copies the
rest of the template.
I DELETE I does not affect the command line. It affects the template
by deleting the first character. lliJ deletes characters in the tem-
plate, up to but not including a given character.

n
r---
I :

r-'
I
l '

n
: '

I'
t '

r-'
I :
t '

I~' t
, '

\"',
,I
193
I I

---.J
I I

U
i l
,-I

,
, I

----J

i I
'---.J

I
'---.J

,
! ,
L....J

!
LJ
I
---J
,-
Chapter 9

EDITING FILES

I '
The techniques for editing command lines also apply to editing
files. In addition, there are several other special features avail-
able for creating, changing, and manipulating blocks of text.
!
L '
Files created with EDLIN are divided into lines of a maximum
of 254 characters. During editing, EDLIN generates and displays
I a number for each line. If you insert or delete lines, it automati-
I '
cally renumbers any following lines to maintain consecutive
numbering. The line numbers are only to aid in editing; they
r; are not actually in the file.
I :

Creating a File
n You can create your own file with EDLIN by typing:
,.., edll n pa thname I ENTER I
, I '
'
where pathname refers to either an existing file (that you wish
to edit) or one that you wish to create. In this case, create a
r-: sample file for editing by typing:
I '
edlin sampfile [ENTER I
r-'
I '
Note: If you wish to have the file reside in.a directory
I other than the home directory, you would give a path-
name to the desired directory. This command, for
example, tells EDLIN to create the file in the current
directory of Drive B:
edlin b: sampfl1e I ENTER I
,.......,
!
In either case, EDLIN displays the message and prompt:
i '
New fl1e
r-'
I ' *
~ ,
to indicate it has created the sample file. You are now in the
EDLIN command mode and can enter any of the commands out-
i lined in Chapter 10.
I

r! '
I

195
Chapter 9 / Editing Files iL...Ji

Inserting Text
1. Type I (ENTER I to begin inserting text. The screen displays: I
I
'
I
U
New file
*I
; j
1 :*_ l----..J

2. On Line 1, type:
i I
This 1 s a sam p 1 e f i 1 e I ENTER I <.-J

EDLIN displays the number for the next line:


I
\ I
2:*_ '---'

3. Type:
! I
The edlting keys are easy to use \ ENTER I U
4. When EDLIN displays the next line number, type I CTRL I @].
This exits the insert mode and returns the EDLIN prompt
(* ).
5. Type 1 I ENTER I to tell EDLIN to display Line 1. The screen I I

loolcs lilce this: LJ


*1
1 :*This is a sample file I I
!
1:*_

You can enter no more than 254 characters into each line. To end ,
one line and start another, press I ENTER I. EDLIN places the cur-
~
I I
i--.J
rent line in the template and displays the next line number.

Saving Your File


Now save your newly created file by typing I CTRL I @] to exit the
insert mode and then typing £ I ENTER I to save the file and return
to the MS-DOS command prompt. When you save a newly cre- , i
'--'
ated file, EDLIN gives it the filename and extension (if any) you
specified when you created it.
!
LJ

f I

I I
---J
196
~

! Chapter 9 / Editing Files


I '

Editing an Existing File


~ Your newly created file, or any EDLIN file, can now be recalled.
i
If you specify a file that already exists when you use the EDLIN
command, EDLIN loads it into memory and then displays the
message:
End of input file
*
Note: If the file is large, EDLIN loads text until mem-
ory is 75% full. When it displays the * prompt, you
can edit those lines. To edit more of the file, first free
some memory by writing the edited lines to disk (see
the Write Lines command in this section). Then load
more of the file for editing (see the Append Lines
r: '
command).
When you have completed editing, save both the edited version of
,--, the file and the original file by typing E [ENTER I. However, the
I ' original file is now saved with the extension .bah and the edited
I !
version is saved with the original name and extension.
I""' Note: You cannot further edit a file that has a .bah
Ir , extension. To overcome this system restriction, rename
the file, giving it another extension. (See the
r- RENAME command in Part 2.)
I '
I '
Using the Special EDLIN Editing Keys
n You can now use the special edit keys to change the file you cre-
ated. Recall your EDLIN file by typing:
I: edlin sampfile I ENTER J

EDLIN displays:

~ End of input file


I
*
r-
To display Line 1 of the file, type:
Ir , 1 I ENTER I
You are now ready to begin editing.
;
I ,

~
l

197
,
Chapter 9/ Editing Files L.J

i, I
I
LJ
Example 1: Copy Char (G)
Using the Copy Char function, G, copy characters from the tem-
plate to the new line.
1. Press G once. The screen looks like this:
i j
1 :*This is a sample file '--..J

1 :*T_

2. Press G three times. The screen looks like this:


1 :*This is a sample file
1: *Thi s_
,!
Each time you press G, EDLIN copies another character
~

from the template to the new line.


,\ I'
3. To continue to the next example, type I CTRL I This exits[n 1-
the insert mode, voids any changes you have made to the
line, and returns the EDLIN prompt (*). \ '
: I
l.-J
Example 2: Copy to Char «(ill)
,I ,I
Using the Copy to char function, (ill, copy all characters from
the template, up to-but not including-the specified character.
1. At the EDLIN prompt, type 2 I ENTER I. The screen looks like , )

this:
2:*The editing keys are easy to use
\ !
2:*_
2. Type ill] a . The screen looks like this:
2:* The editing keys are easy to use 1 !
2:* The editing keys_ ~

3. Now copy the rest of the template, using the Copy All func- \ !
tion, [TI]. The screen looks like this: '.-.J
I

2:*The editing keys are easy to use


2:*The editing keys are easy to use
'---l
4. Type I CTRL I @] to continue to the next example.
Note: If the template does not contain the specified
character, nothing is copied.

198
,
i
I ' Chapter 9 / Editing Files
,I :
, I

Example 3: Copy All ([ill)


Using the Copy All function, [ill, copy the entire contents of the
template to the new line.
1. Type 1 I ENTER 1 at the EDLIN prompt (*). The screen looks
Ii
1_'
like this:
1 :*This lS e semple file
1:*_
"!
I !

2. Press the Copy All editing key, [ill. The screen looks like
this:
i" : 1 :*This is e semple file
1 :*This is e semple file_

n 3. Type I CTRL IlTI to continue to the next example.


Note: The Copy All function copies all characters in
the template to the new line. However, if you changed
part of the template, the Copy All function copies only
the remaining characters-those that have not been
edited.
n
Example 4: Delete Char ([ DELETE I)
I
I ,
Using the Delete Char function, delete some characters from the
template.
,...., 1. At the EDLIN prompt, type 2 I ENTER I. The screen looks like
I
this:
2:*The editing keys ere eesy to use
2:*_
"
,
I
I
I
'
;
2. Press [ DELETE 1 four times to delete the first 4 characters from
the template. Then press the Copy All function key, [ill.
r, The screen looks like this:
2:*The editing keys ere eesy to use
..-, 2:*editing keys ere eesy to use _
I \ 3. Type I CTRL I lTI to void any changes to Line 2 and continue
to the next example.
r;
, ,

c--1
! \
I

199
Chapter 9 / Editing Files

I !
1 !
'---1
Example 5: Delete to Char (Cill)
Using the Delete to Char function, Un delete a number of char- I
,
l
,
acters up to-but not including-the specified character.
1. At the EDLIN prompt, type 1 I ENTER ,. The screen looks like
, !
this: , :

1 :*This is a sample file


1:*_

2. Type Cill a. The cursor remains in the same position even


though the characters before the first a have been deleted.
,
To see this, press the Copy All key, ffiJ. The screen looks i !
'

like this: . '----'

1 :*This is a sample file


I '
1 :*a sample file_ LJ
3. Type I CTRL III] to void any changes and continue to the next
example.

Example 6: Void Line ([@)


I
,I !,'
In this example, first make a change to Line 1 and then, using
the Void Line function, [ESC I, cancel that change. This leaves the
template unchanged and lets you continue making changes to
the same line. ,
---1
I

1. At the EDLIN prompt, type 1 [ENTER I. The screen looks like


this: I
I
:

L-J

1 :*This is a sample file


1:*_
I I

2. Type: LJ
Names and addresseslESCj
i i
The screen looks like this: ~

1 :*This is a sample flle


1: *Names and addresses\

When you press [@, a backslash (\) appears right after


any change you may have made and the cursor appears
again on another line.

200
l I Chapter 9/ Editing Files

r
I '
3. Press the Copy All key, [ill. The screen looks like this:

~
1 :*This is a sample file
i i 1 :*Names and ad,dresses\
Th1S is a sample file __

r'
, '
4. Type [CTRL I [I) to continue to the next example.

j'
Example 7: Insert (I INSERT I)
,I
The 'INSERT I key acts as a switch to turn the insert mode on and
off. Use this key to insert a word in Line 1 of the sample file.
n 1. At the EDLIN prompt, type
this:
1 [ENTER I. The screen looks like

r
! I
1 :*This
1: *__
is a sample fl1e

,---,
2. Press the Copy to char key, 1m and press f. The screen
Il 'i looks like this:
1 :*This is a sample file

n 3.
1: *Th1S is a sample __

Now press I INSERT 1 to turn on the insert mode. Type edit


followed by a single space. Then press 'INSERT I again to turn
off the insert mode. The screen looks like this:

1 :*This is a sample file

n
t _:
1 :*This 1S a sample edit __

4. To copy the rest of the characters in the template, press the


Copy All key, [ill. The screen "looks like this:
r:
l ! 1 :*This is a sample file
1 :*This is a sample edit file __

i'1 5. Type 'CTRL 1 [I) to continue to the next example.


! '
Example 8: Replace Template ([ill)
n Using the Replace Template function, [ill, replace the template
with whatever characters are displayed in the new line.
r:
,
l
\
'

,...,
I i

201
Chapter 9 / Editing File$

I '
I i
'----'
1. At the EDLIN prompt, type 2 I ENTER I. The screen looks like
this:
r 1
2:*The edlting keys are easy to use W
2:*_

2. Type:
Replacing the template
Then press em. Notice that the @ symbol appears after the ,
,
......J
)
I

last character and the cursor moves to the next line:


2:*The edlting keys are easy to use I .
2:*Replacing the template@ U
After you press em, all the characters displayed in the new , I
line replace those in the template. This is similar to press- ~
ing I ENTER I. However, there is one important difference. With
em, the displayed characters go only to the template for
further editing; they do not go to the requesting program. L.:
3. Press the Copy All function key, [ill. The screen looks like
this:
2:*The editing keys are easy to use
2:*Replaclng the template@
I :
Replacing the template __
LJ
As you can see, the new sentence is now the template.
4. Type I GTRL I W to void any changes and continue to the next I
I
i '
'---'
example.
Note: Pressing I ENTER I immediately after pressing em : ,
empties the template. I
L...J
'

Example 9: Enter Line (I ENTER I)


Whenever you press [ENTER I, the displayed characters become the
template and are sent to the requesting program.
I I
, I
1. At the EDLIN prompt, type 2 1ENTER I. The screen looks like L...J

this:
I I
2:*The editing keys are easy to use
2:* __
, ,
i i
'------.J
202
l !
Chapter 9/ Editing Files

n
I ' 2. Press the Copy to char key, [ill, and then type a. The
screen shows:
n
! ' 2:*The editing keys are easy to use
2:*The editing keys_
3. Then type:
simplify editing tasks I ENTER I
The screen looks like this:
2:*The edlting keys are easy to use
2:*The edlting keys simplify editing tasks
*
Notice that after you press I ENTER' the EDLIN prompt
returns to the screen.
"
! : 4. Type 2 [ENTER ,. The screen looks like this:
2:*The editing keys simplify editing tasks
2:_

As you can see, Line 2 now contains the new sentence you
entered.

r;
I :

,.,
i :
I '

~
, !
i '

n
I
I
iI
l '

....,
I( :,
203
, I
I I
l...-J

i 1
~

i
I ,
'--"

: :
U

i i
LJ

u
\I i•
L.J

I i
LJ

I ,
. I
L...

I
I
l---!

I
LJ

I
I
~
.----
IJ Chapter 10

1"1
I '
EDLIN COMMAND REFERENCE
1 __ ;

I'
I :
In addition to the editing keys, EDLIN also supports many pow-
erful commands that let you manipulate an entire file or several
lines at a time.
Ii,
;

Command Format And Rules


l ; Most EDLIN commands follow a certain format and conform to
certain rules. Following is a brief review:
..., • Except for End, Edit, and Quit, EDLIN commands are
I '
'- preceded and/or followed by parameters. The function of
parameters is discussed later.
• You may enter EDLIN commands in uppercase or lower-
case, or a combination of characters.
• Except for the Edit Line command, EDLIN commands
are a single letter.
• You can indicate line numbers relative to the current
line. A minus sign (-) indicates lines that precede the
current line. A plus sign (+) indicates lines that follow it.
For example: - 1 3, + 1 3 L I ENTER I lists the ten lines
fi immediately preceding the current line, the current line,
L' and the ten lines immediately following the current line.
• You can enter multiple commands in the same line with-
out any special delimiting characters. The exceptions
are:
• when you use the Edit Line command for a single
rI : line
• when you use the Search and Replace command
iI I
'

n
l )

.----
!, ,'
205
Chapter 10 / EDLIN Command Reference

I I
In the first case, you must use a semicolon to sepa- --.J

rate the commands. For example, the multiple com-


mand: 15; - 5, + 5L I ENTER I edits Line 15 and , ;
I I
I '
displays Lines 10-20. '-<---J

In the second case, type I CTRL 1m (instead of I ENTER I)


I
after the string to be replaced. For instance, the I

multiple command: W
5 T his s t r i n9 I CTRL 1m - 5, + 5L I ENTER I
searches for the string, This string, and then dis-
plays the 5 lines that immediately precede the
matched string and the 5 lines that immediately
follow it. If the search fails then EDLIN displays
the numbers of the relative lines.
, I
• You can enter EDLIN commands with or without a space I
~
I

between the line number and the command. For example,


the delete command 6D is the same as 6 D.
I

• Control characters (such as I CTRL I[TI and I CTRL 1m) can be '--'
inserted into text and even used for the Search and
Replace commands. To do this, first type I CTRL 10 and
, I
then the desired control character. I--J
• Delimiters (spaces or commas) are required only
between adjacent line numbers. You may want to use i '
them, however, to separate commands and parameters LJ
for better readability.
• Commands become effective after you press I ENTER I. .LJ
I :'

• For commands that produce a large amount of display


output, press C8QbQJ. This halts the display so you can
read it. Press [SPACEBAR I again to continue display output. I ;
U
• You may stop EDLIN commands by typing I CTRL I [TI.
I

, ,,
'--'

I ,
I I
LJ

I ,
, i

206
r--.
i : Chapter 10/ EDLIN Command Reference
t. _~

Command Summary
I ' The EDLIN commands are summarized in the following table.
r :
Command Purpose
I""' line Edits the specified lines
I I

A Appends lines
C Copies lines
D Deletes lines
E Ends editing
I Inserts lines
L Lists text
M Moves lines
P Pages text
Q Quits editing
R Replaces lines
S Searches text
T Transfers lines
W Writes lines

Command Parameters
,..--,
Most EDLIN commands require you to specify a line number, a
string, or a range of lines to be affected by the command. These
l ; are the command parameters. Command parameters may vary
according to the EDLIN' command, but, generally, they are as
r--:
I '
follows.
i

,...,
II !
'

! \

;:
I
l
207
I :
Chapter 10 / EDLIN Command Reference

i
line (line number) !.........:

This parameter denotes that you must indicate a line number


(not always a numeral). Separate line numbers from commands, I, 'I
~

parameters, and other line numbers with a comma or a space.


You may specify a line in three ways: ,
,
I
I

~
• A number less than 65534. If you specify a number
larger than the number of existing lines, EDLIN adds a
line to the file.

• A period (.), which indicates the current line. This is the


last line edited, not necessarily the last line displayed. ; I
, '
The current line is always marked on your screen by an L...-1
asterisk (*) between the line number and the first
character. i I

LJ
• A pound sign (N), indicates the last line of a program.
For example, the command # I will begin an insert at the
end of your program.
string (a group of characters)
i i
This parameter represents a portion of text EDLIN is to find, LJ
replace, delete, or use to replace other text. Use this parameter
only with the Search and Replace commands. End each string 1 )
with I CIRL I [I). Do not include spaces between strings or between , I
---.J
a string and the command letter (unless you want those spaces
to be part of the string).
, I
L.....J

II :
I
L.....J

,
L

:i
~

I II
L..J

208
r-
I
l :
I
Chapter 10 / EDLIN Command Reference

,.....,
I I
Append Lines (A)
I' [number]A
Adds the specified number of lines from disk to the file being
edited in memory. The lines are added at the end of the file.
This command is meaningful only if the file being edited is too
large to fit into memory. Before using this command, you must
write the portion of the file that was loaded into memory (and
which has been edited) to disk. Refer to the Write Lines
command.
Ii
l ' When the Append command reads the last line of the file into
memory, EDLIN displays the message:

r:
L !
End of input file
If you omit the number of lines, EDLIN appends lines until
available memory is 75% full. However, if memory is already
[J 75% full, EDLIN does nothing.
Example:
I]
I !
1 ~ ~ A (ENTER I
appends 100 lines from the disk to the file in memory.
[!
n
! :

r:
I, i

~
I '

209
Chapter 10 I EDLIN Command Reference i i
L...;

· 1
I I
Copy Lines (C) LJ

[linel][,line2],line3[, count]C f I
U
Copies all lines rangIng from line1 to line2, placing them imme-
diately ahead of line3. Using the count parameter, you can copy
the lines as many times as you want.
If you omit linel or line2, EDLIN copies the current line. If you
omit the count, EDLIN copies the line(s) only once. I· ]I
LJ
Note: If you omit the linel parameter, your command
must include a comma immediately preceding the I I

line2 parameter. LJ
The file is renumbered automatically after the copy, and the I 1

first line copied becomes the current line. For example: IL - I


3 , 9 , 1 2 C I ENTER I
· i
copies Lines 3-9 to Line 12. Line 12 becomes the current line. I

U
I

Note: Line numbers must not overlap. If they do,


EDLIN displays an error message. Also, you must not !I
L...J
use the plus and minus signs.

Examples: I, !I
~
Assume that the following file exists and is ready to be edited. If
you want to create the file, see the Insert command.
1: This sample file
2: shows what happens
3: when you use ! i
4: the Copy command u
5: to copy text in your file.
, I
To copy this entire block of text, at the EDLIN prompt type:
U
1 , 5 , 6 C I ENTER I

I i
LJ

I II
210
Chapter 10/ EDLIN Command Reference

Almost instantly the prompt reappears to indicate that the com-


mand was executed. If you wish to see the result, type L I ENTER I.
The screen shows:
1: Thi5 5ample file
2: 5how5 what happen5
,
r-,
' 3: when you U5e
4: the Copy command
5: to copy text in your file.
6:* Thi5 5ample file
! i 7: 5how5 what happen5
8: when you U5e
r---"1 9: the Copy command
i ' 10: to copy text in your file.

Notice that the first line copied becomes the current line.
-,
I i If you want to insert lines between other lines, use line3 to spec-
ify the line before which you want the text copied. For example,
assume that you want to insert Lines 5-8 before Line 3 in the
following file:
1: Thi5 5ample file
....,
i '
2: 5how5 what happen5
3: when you U5e the Copy command
4: to copy text in your file.
5: If you 50 cho05e,
6: you may a150 in5ert
7: a group of line5 withln
8: other part5 of the file.
9: The copy command
10: i5 ver5atile.

i '
I

r-,
! I

1';
l I

211
Chapter 10 / EDLIN Command Reference

;
I I
The command 5,8, 3C IENTER Iresults in the following file: L...J

1: This sample file


rI ;I
2: shows what happens L...J
3:*If you so choose,
4: you may also lnsert
5: a group of lines within
6: other parts of the flle.
7: when you use the Copy command
8: to copy text in your file.
9: If you so choose,
10: you may also insert
11: a group of lines within
12: other parts of the file. ! I
L...J
13: The copy command
14: is versatile. , ,
! '

L
I '

LJ

iLJ'

, I
L-...:

I !
L...J

J
,-
I

212
: ' Chapter 10 / EDLIN Command Reference

r-',
Delete Lines (D)
[linel] [,line2]D

Deletes linel or all lines within the range linel to line2 from a
file.
EDLIN automatically renumbers the lines to maintain consecu-
tive numbering in the file.

Parameters
You can omit the linel parameter:
,line2D I ENTER I
If you do, EDLIN starts deleting at the current line and ends at
line2. Your command line must include the comma before line2
to indicate you are omitting linel.
You can omit the line2 parameter:
,...., line 1D I ENTER I or
,
I
I
'
linel,D I ENTER I
If you do, EDLIN deletes only linel.
If you omit linel and line2, EDLIN deletes only the current line.
D I ENTER I

. 1,
,

• I

213
Chapter 10 / EDLIN Command Reference

Examples:
Assume that the following file exists and is ready to be edited.
Line 30 is the current line:
1: This sample file
2: shows how
3: the Delete command functions.
4: All that is requlred
5: ln most cases

26: is to specify
27: a number of lines
28: to be deleted;
29: deleting can often help
30:*to clean up your files.

Type:
5,25D [ENTERI

The result is:


1: Thls sample file
2: shows how
3: the Delete command functions.
4: All that is required
5:*is to specify
6: a number of lines
7: to be deleted;
8: deleting can often help
9: to clean up your files.
To delete line 4 in the above file, type:
4D I ENTER I

'-
214
Chapter 10 / EDLIN Command Reference

The result is:


1: This sample flle
2: shows how
3: the Delete command functions.
4:*is to specify
5: a number of lines
6: to be deleted;
7~ deletlng can often help
8: to clean up your files.
To delete the current line and the following two lines, type:
,
~

,6D I ENTER I
!

The result is:


1: This sample file
2: shows how
3: the Delete command functlons.
4:*deleting can often help
5: to clean up your files.

,.----, To delete only the current line, type:


I '
t D I ENTER I
The result is:
1: This sample file
2: shows how
3: the Delete command functlons.
4:*to clean up your files.

215
: ,
Chapter 10 / EDLIN Command Reference

Edit Line (line) ~


[line]

Lets you load the specified line for editing.


EDLIN displays the specified line and - on the next line - the
line's number (without text) to indicate the line is ready for
editing. You can then use the editing keys, control keys; and the
EDLIN commands.

Notes
, ,
• If you omit the line (you only press I ENTER I), EDLIN loads the ~

line that immediately follows the current line.


• If you don't need to change the line, and the cursor is at the
beginning or end of the line, press I ENTER I to accept the line as
is.
• If you press I ENTER I while the cursor is in the middle of a line,
EDLIN erases the rest of the line.
• Finally, if you wish to cancel any changes made to a line,
press I ESC ,.

Example
Assume the following file exists and you wish to edit Line 4:
1: This is a sample file.
2: used to show
3: the editing of line
4:*four.
Type 4 I ENTER I at the EDLIN prompt. The screen looks like this:

4: *four
4:

216
Chapter 10 / EDLIN Command Reference

l 1
Press I INSERT), type the word number, followed by a single space,
and press I INSERT ) again. Then, to copy the rest of the line, press
, '
the Copy All editing key, [ill. The screen shows:

4:*four
4:*number four __

At this point you can:


• Save the changed line by pressing IENTER I.
• Type more text at the end of the line (the insert mode is
in effect whenever the cursor is at the end of the line).
• Press ffiJ (Replace Template) to further edit the line.
• Press [1KJ to cancel the changes made to the line.
1 '

r--
I; ,

!
,, I

i'
;
, '
217
Chapter 10 / EDLIN Command Reference

End Edit (E)


Ends the EDLIN program and saves the edited file.
When EDLIN saves the edited file, it uses the drive specifica-
tion, filename, and extension you specified when you started
EDLIN. (If you want, you can use Copy to transfer the file to
another drive.)
If you edited an existing file (rather than a newly created one),
EDLIN also saves the original file (unedited file). The original
file is given the extension .bak (for backup).
When you enter the End Edit command, EDLIN appends a I GIRL I
m character to serve as the end of file mark.
After you enter the End Command, control returns to MS-DOS.
The screen displays the system prompt (such as A».

Warning: Be sure the disk contains enough free space


to save the entire file. If it does not, EDLIN saves only ! :
part of the file; the rest is lost. If this occurs, the por-
tion saved has the file extension of .$$$.

218
Chapter 10 / EDLIN Command Reference

Insert (I)
[line] I

Inserts lines of text immediately before the specified line. Also,


when you create a new file, you must enter the I command to
begin writing text.
Text begins with Line 1. Successive line numbers appear auto-
matically each time you press I ENTER I.
EDLIN remains in the Insert mode until you type I CTRL I enThe
line immediately following the insertion becomes the current line
and EDLIN automatically increments all line numbers that fol-
low the insertion as necessary.

Notes

, , • If you use a period (.) to specify the line-or if you omit


the line parameter-EDLIN uses the current line.

;--.
• If you use a pound sign (#) to specify the line, or if the line
you specify is any number larger than the number of the
last line-EDLIN appends the lines to the end of the file.
In this case, the last line inserted becomes the current
line.

Examples
,---.,
;
Assume that the following file exists and is ready to be edited:
1: This is a sample file
2: to show what happens
3: when using the Insert command
4: in your files
To insert text before a specific line that is not the current line,
type the line number and I, then press I ENTER I. For example, type
3 I I ENTER 1
.....-.,
i The result is:
3:*_

Now, type the new text for Line 3:


3: to the line numbers

219
Chapter 10 / EDLIN Command Reference

To continue text insertion, press I ENTER I. EDLIN displays a new


line number. Type: I.

<how they are renumbered) I ENTER I


Then return to the EDLIN prompt by typing [CTRL I en Type L
IENTER' display the result:
1: This is a sample file
2: to show what happens
3: to the line numbers
4: <how they are renumbered)
5:*when using the Insert command
6: in your files

To insert a line immediately before the current line, type I


[ ENTER I at the EDLIN prompt. The screen shows:

5:*_
Now type:
eve r y tim e you ins e r t new 1 i n e s I ENTER I
When EDLIN displays the number for the next line, type I CTRL I
W to return to the EDLIN prompt (*). Type L I ENTER I to list the
file. The screen looks like this:
1: This is a sample flle
2: to show what happens
3: to the line numbers
4: <how they are renumbered)
5:*every time you insert new llnes
6: when using the Insert command
7: in your files
To add lines to the end of the file, type:
8 I I ENTER I
The screen shows:
8:*_

Enter the following new lines:


8: The Insert command
9: can be used
1~: to add new lines
11: to the end of your file

220
Chapter 10 / EDLIN Command Reference

,, ,
,
Type ICTRL \ @] when the number for Line 12 is displayed. Then,
at the EDLIN prompt, type LI ENTER I to list the file. The screen
~,
looks like this:
1: This is a sample file
2: to show what happens
3: to the line numbers
4: (how they are renumbered)
5: every time you insert new lines
6: when using the Insert command
7: in your files
8: The Insert command
9: can be used
10: to add new lines
11: to the end of your file.

~,

~
;
I

r--.
; ,

221
Chapter 10 / EDLIN Command Reference

·List (L)
[linel][,line2jL

Displays all lines within the range line1 and line2.

Notes
• You can omit linel:
, line2L I ENTER I
If you do, the display begins before the current line and ends
with line2. The comma is required to indicate that you omit-
ted linel.
• You can omit line2:
linel L I ENTER I
If you do, EDLIN displays 23 lines, starting with linel.
• If you omit both parameters, EDLIN displays 23 lines-the 11
lines immediately preceding the current line, the current line,
and the 11 lines immediately following the current line. If
fewer than 11 lines precede the current line, EDLIN displays
more lines that follow the current line to make a total of 23
lines.
• If some of your lines are longer than the screen width (require
more than 1 display line) they will still be counted as a single
line by EDLIN. In other words, if the List command requires
more text than the screen can display, the excess will scroll
off the top.

222
Chapter 10/ EDLIN Command Reference

Examples
Assume that the following file exists and is ready to be edited:
1: Thi5 i5 a 5ample file
2: u5ed to 5how the li5t command.
3: See what happen5 when you U5e
4: li5t Cll with different parameter5
5: or without any

15:*The current line contain5 an a5teri5k.


I ,

26: to edit text


27: in your file.
To list a range of lines without reference to the current line,
type the command in this format: line1 ,line2L
For example, type:
,..........
I 2 , 5l I ENTER I
to produce the following display:
2: u5ed to 5how the li5t command.
3: See what happen5 when you U5e
4: li5t Cll with different parameter5
5: or without any
To list a range of lines beginning with the current line, type the
command in this format: . , lineL
For example, type:
. ,26l I ENTER I
to produce this display:
15:*The current line contain5 an a5teri5k.
,
,,

26: to edit text

223
Chapter 10 / EDLIN Command Reference

To list a range of 23 lines centered around the current line, you


need only type l I ENTER I. The screen shows:
r '
4: list Cl) with different parameters
5: or without any

15:*The current Ilne contains an asterisk.

26: to edit text.

224
Chapter 10 / EDLIN Command Reference

Move Lines (M)


i [linel][,line2],line3M
f ~I

Moves all lines within the range line1 to line2 to a position


immediately preceding line3. linel becomes the current line.
Use the Move command to move a block of lines from one place
in the file to another.
, '
Notes
. , • If you omit the line1 parameter or the line2 parameter,
I ,
EDLIN uses the current line.
• EDLIN renumbers the lines according to the direction of the
move. For example:
, + 25, 1 0 0M I ENTER I
moves the text from the current line + 25 to Line 100. If the
line numbers overlap, EDLIN displays the message
Entry error

Example
, ;

To move Lines 20-30 to Line 100, type:


20 , 30 , 1 0 0 M [ ENTER I

. ,

225
Chapter 10 / EDLIN Command Reference

Page (P)
[line 1][, line2] P : ;
!..j
Pages through a file 23 lines at a time or lists the specified
block of lines. ,I '
'
'--..J
Notes
I
• You may omit the linel parameter, as in ,line2P I ENTER ,. --.-J
If you do, EDLIN uses the current line number plus 1, unless
the current line is Line 1. The comma is required to indicate
that you omitted the linel parameter.
• You may omit the line2 parameter, as in ,linelP I ENTER I. If you
do, EDLIN lists 23 lines.
• The last line displayed becomes the current line. This com-
mand differs from the List command in that the Page com- ,
,I ,r
mand changes the current line to the last line displayed. '----

Example , ,I

To display Lines 10-15, type:


1 '" , 1 5 P I ENTER I : !
'-
To display Lines 20-42, type:
2'" P I ENTER I
EDLIN displays the specified line (Line 20) and the next 22
lines. LIne 42 becomes the current line.
Then, to display Lines 43-65, type:
I
P ENTER I \
I I
EDLIN displays the current line plus 1 (Line 43) and the next 22 LJ
lines. Line 65 becomes the current line.

,
iI
~
226
Chapter 10 / EDLIN Command Reference

r-
i
Quit (Q)
r-'
I Quits the editing session without saving any changes you may
i
have made to the file.
EDLIN prompts you to make sure you don't want to save the
changes. Press Y if you want to quit the editing session without
saving any changes. Press N to continue editing.

Example
* Q I ENTER I
Abort edit (Y/N) __

r--
I
!

,..,
I
I. .'

227
I
Chapter 10 / EDLIN Command Reference I i

Replace String (R)


[linel][,line2][?]R[stringl] [ CTRL 1m [string2] I
i
...-J
l
:

Replace all occurrences of stringl with string2. The


replacement is limited to the lines between linel and line2. ! !
Notice that you must terminate stringl by typing I GTRL I []],
then begin string2 immediately followjng the I GTRL I []] char-
acter. Terminate string2 by typing another I GTRL I []] or
I ENTER I.
J
Each time Replace finds stringl, it replaces the stringl I I
with string2. It displays the line in which it has made a LJ
replacement. If a line contains more than one replacement,
Replace displays it once for each occurrence. I i
\ I
When all occurrences of stringl in the specified range are L..-'
replaced with string2, the Replace command terminates,
and the EDLIN prompt (*) reappears.
I i
'-----'
? tells Replace to prompt you with o. K. ? each time it mod-
ifies a line. Press y to accept the change. Press N to reject
it. In either case, the search continues, starting at the next , 1

occurrence. U

Notes:
J
• If you omit linel, Replace starts the search at the line
immediately following the current line; it stops at line2.
I

• If you omit line2, Replace continues the search to the end of


the file.
L-

• If you omit both linel and line2, searching begins at the


line that immediately follows the current line and ends at
the end of the file.
• If you omit string2, EDLIN deletes all occurrences of
stringl in the specified line range.
L....:
i

\ 1
i
• If you omit stringl and string2, EDLIN uses the most
recent string specified with a Search (or Replace) command
i
L.-..

as stringl, and the most recent string specified in a


Replace command as string2.

228
J
Chapter 10 / EDLIN Command Reference

Examples:
,..--
,I Assume that the following file exists and is ready for editing:
1: This sample file
2: shows how the Replace command works and how
3: when you use Replace
4: certain words and phrases
5: may be exchanged for
6: other words and phrases
7: in your file.
To replace all occurrences of and with or in the above file, type:
L 1 ,7Rand ICTRLJIIJ or [ENTER]
The result is:
2: shows how the Replace commor works or how
4: certaln words or phrases
6: other words or phrases
Note that Lines 1, 3, 5, and 7 are not displayed because they are
not changed:
To avoid unwanted changes, you can include the? parameter, for
example, type:
2, 7?RandlcTRLIIIJ or IENTER J

,... Now, whenever Replace finds the and string, you have the oppor-
tunity to accept or reject the change.
I
Note that in the first Replace Command line a space was typed
;---'
after and and or. In the second command with ?R, spaces were
I
I
not typed.

229
, ,
Chapter 10 / EDLIN Command Reference -.-J

Search Text (S) ~i

[line 1] [,line2] [?]S[string] I


J
'
~)

Searches all lines within the range linel to line2 for each occur-
rence of the text string. I '

L.J
Notes
• You must terminate the string by pressing I ENTER \.
• If you omit the question mark (?), Search displays the first
line (in the specified range) that matches the string. That
line becomes the current line, and the Search command
terminates.
,
• If the string does not occur between linel and line2, Search , I
'---.J
displays the message:
Not found
, I
'--.J
• If you include the question mark, Search displays the first
line that contains the string. It then prompts you with the
message:
O.K.?
If you press either Y orl ENTER I, the line becomes the current I I
I
line, and the search terminates. If you press any other key, '---'
the search continues until it finds another match or searches
all lines.
• You can omit the linel parameter, by typing the command in
this format: ,line2Sstring I ENTER I.
If you do, the search begins at the line that immediately fol-
lows the current line.
• You can omit the line2 parameter, by typing the command in
this format: linel Sstring I ENTER I or linel, Sstring I ENTER I
• If you omit the string, Search uses the last search string that
was used in a Replace or Search command. If there is no
search string (no previous search or replace has been done),
the command terminates immediately.
, I
I
• Search looks for the string exactly as you specify it in the ~
command. Therefore, enter the string in the same combination
of upper and lowercase characters as it appears in the text. I I
,I
'------'
230
Chapter 10 / EDLIN Command Reference

• Begin the search string immediately after the S in the com-


mand line. End it by pressing I ENTER I. Any spaces you include
are considered part of the search string.
• In multiple line commands, terminate the string with
I CTRL 1m, instead of I ENTER I. You may then follow the string with
another command, in the next character position.

Examples
Assume that the following file exists and is ready to be edited.
Line 5 is the current line.
1: This sample file
2: shows how the Search command functions
3: to locate and point out
4: a specified string
5:*in a range of lines
6: of your file.
7: The Search command
8: may include the optional parameter? and
9: 2 line parameters for the range.

r 1 ~: You the n t y pet hest r i ng and pre s s I ENTER I


To search for the first occurrence of the string and, type:
1 , 1 ~ San dI ENTER I
The screen shows:
2: shows how the Search command functions
*
because the string and is part of the word command, Line 2 then
I becomes the current line.
!
I ~

This is probably not the and you are looking for. To find the next
r-- occurrence of and, at the EDLIN prompt, type:
I
S (ENTER I

i
I

I
!
231
Chapter 10 / EDLIN Command Reference

I )

The screen looks like this: LJ


*1,10Sand
2: shows how the Search command functions I ,
'--....-
*S
3: to locate and pOlnt out I l

~
Line 3 becomes the current line.
To search through several occurrences of a string until you find : ;
the correct one, type:
1, ? Sand
i ,
i !
The result is: '---'

2: shows how the Search command functlons


O.K.? N
3: to locate and pOlnt out
O.K.? N
7: The Search command
O.K.? N
8: may lnclude the optional parameter? and I
.........J

O.K.? Y
I I
The search continues until you press Y or the file runs out of ~
lines. At that time, Search displays the message:
Not found

j
\ }
: [
'-...J

I t
--J

,I !,
L.-.i

232
Chapter 10 / EDLIN Command Reference

I ;
Transfer Lines (T)
,,
~
'
[line]T[ drive] filename

Inserts (merges) the contents of a specified file into the file being
edited. The transferred file is inserted just ahead of the specified
line or current line.
After the file is inserted, the merged file is renumbered
I
L_ automatically.

Notes
• If you omit line, the file contents are inserted ahead of the
current line.
• The file to be transferred is read from the current directory of
the specified drive or the default drive. If you issued a path
when EDLIN was started, that path serves as the current
directory. All subsequent Transfer Lines commands use that
directory.

Example
1 HE: myf i 1 e I ENTER I
inserts the contents of B:Myfile into the file being edited.
B:Myfile is inserted just before Line 10.

l! ',

i, '

I""'
I :
233
Chapter 10 / EDLIN Command Reference

, )

~
Write Lines (W)
[number]W

Writes a specified number of edited lines from memory to disk.


Writing begins with Line 1.
This command is meaningful only if the file you are editing is
too large to fit into memory. When you start EDLIN, files are
loaded until memory is 75% full. To edit the rest of your file, you
must first write edited lines in memory to disk. Then you can
load the unedited lines from disk into memory, using the , ,
Append command. ! '

Note
If you omit the number, EDLIN writes lines until 25% of mem-
ory is freed. If at least 25% already is freed, EDLIN takes no
action. All lines remaining in memory (not written to disk) are
renumbered starting with Line 1.

Example
1 "" wI ENTER I
writes Lines 1 through 100 to disk and renumbers the file in
memory, starting with Line 101 as Line 1.

, I

i-.J

i
L..1

I ,
'---'

234
n
I ;

........,
,t l

n
! ,
c_ ,

1~
! i
\ __J

n
LJ
I
l ~
Chapter 11

LINKING OBJECT MODULES

MS®-LINK is an MS-DOS utility program designed to produce


ready-to-run machine language code. You should read all of this
chapter before you use the linker. Chapter 12 contains technical
information for experienced users. LINK error messages are in
Part 6.
I If you are not going to compile and link programs, you do not
I
need to read this section.

,
I"'
' Basic Information
Programs are written in source code. Passing the source code
through a compiler or an assembler produces an object module.
This object module, however, cannot be understood by the com-
puter directly.
To produce machine language code that the computer can under-
stand, you must pass the object module through the link process.
Following is a summary of the linker requirements and
functions.

System Requirements
The linker requires the following:

I
• At least 50K bytes of memory. 40K bytes are for code
I and data; the remaining 10K bytes are for run space.
• One disk drive, if output is sent to the same diskette
from w4ich input was taken.
• Two disk drives, if output is sent to a different
diskette.
Because the linker does not allow time to swap
diskettes during operation on a one-drive configura-
tion, the use of two disk drives is more practical.
I'
l

I"'
!
,...,
I
235
Chapter II/Linking Object Modules

Linking Object Modules and Producing a


Run File .
The linker lets you link (combine) several separately produced
object modules and run them as one program. It produces one
relocatable load module, or run file (also called an .exe or execut- :'-..:I
able file).

Resolving External References ~


I

In addition to containing internal references, modules to be


linked may contain "external references" (references to symbols
that are defined in the other modules). As it combines modules, ui
I

the linker resolves all external references (makes sure they are
defined). If any external reference is not defined in the object ,,
modules, the linker searches up to eight library files for the
definition. U

Producing a List File


The linker also produces a list file, which shows external refer-
ences resolved and displays any error messages. j
l..-'
The following diagram illustrates the various parts of the link-
er's operation:
. \

Linker U
libraries listing
.lib map I
I
--..J
Up to 8 libraries
can be searched
r-------l.----,
. I
Used only if run VM.TMP Run file ~
file is larger .exe
than memory
!
~
236
Chapter ii/Linking Object Modules

The VM.TMP (Temporary) File


I' If the files to be linked create an output file that exceeds avail-
I : able memory, the linker creates a temporary file, names it
VM.TMP, and puts it on the disk in the current drive. It
displays:
VM.TMP has been created.
Do not change dlskette in drive x:
where x is the current drive.
Once this message is displayed, you should not remove the disk
from the current drive until the link session ends. If you do
remove the disk, the operation of the linker is unpredictable and
the following error message can occur:
Unexpected end of file on VM.TMP
The contents of VM.TMP are written to the file you name at the
Run F i 1e: prompt (see "Command Prompts" in this chapter).
VM.TMP is a working file only; the linker deletes it automati-
cally at the end of the linking session.
Do not use VM. TMP as a filename. If you have a file named
VM.TMP on the current drive, the linker will overwrite (destroy
it) should it create its own VM.TMP file.

Definitions
r The following explanations of the terms used in this section will
! help you understand how the linker works. Generally, if you are
linking object modules compiled from BASIC, Pascal, or another
high level language, you do not need this information. If you are
writing and compiling programs in assembly language, however,
you must understand the linker and the following definitions.
,---, (Chapter 12 also contains useful information on how the linker
I ,
works.)
! '

,I '
! -'

237
Chapter 11 I Linking Object Modules

In MS-DOS, memory can be divided into segments, classes, and


groups. The following diagram illustrates these concepts.
i
e-J
Segment Segment Segment
I I
3 4 5 I I
----'

Segment Segment Segment 1


L...J
8 9 10

Memory

Segment Segment Segment Segment


J
11 14 15 16

Segment Segment Segment Segment Segment Segment


17 18 . 19 20 21 22 I 1
LJ

shaded area = group (64K bytes addressable)

Example
Segment Class ,I
L-J
Name Name
Segment 1 PROG.1 CODE
Segment 2
Segment 12
PROG.2
PROG.3
CODE
DATA J
I
Note that segments must have different segment names but may
~
or may not have the same class name. Segments 1, 2, and 12
form a group; the group address is the lowest address of Segment
1 (the lowest address in memory).
J
Segment
A segment is a contiguous area of memory up to 64K bytes long.
It can be located anywhere in memory on a paragraph (16-byte)
boundary. The contents of a segment are addressed by a segment
address and an offset within that segment. Segments can I i
L-..J

overlap.
I
----'
238
Chapter II/Linking Object Modules

! I

Group
.--, A group is a collection of segments that fit within a 64K byte
I
area of memory. The segments do not need to be contiguous. The
group address is the lowest address of the lowest segment in that
group. At link time, the linker analyzes the groups and then ref-
erences the segments by the group address. A program can con-
sist of one or more groups.
~ When writing in assembly language, you can assign the names
: I
! of groups in your program. In high-level languages, the compiler
automatically assigns the names. The linker checks to see that
the object modules of a group meet the 64K-byte constraint.

Class
A class is a collection of segments. The naming of segments to a
class controls the order and relative placement of segments in
memory. In an assembly language program, you assign names to
r-'
the classes. In high-level language programs, the compiler auto-
!
i '
matically assigns the names.
All segments assigned to the same class are loaded into memory
, , contiguously. The segments are ordered within a class, in the
i I order they are encountered by the linker in the object files. One
class precedes another in memory only if a segment for the first
class precedes all segments for the second class in the input to
the linker. Classes can be any size, and groups can span classes.
Refer to Chapter 12 for information on how to assign group and
class names and on how the linker combines and arranges seg-
ments in memory.

Command Prompts
r-, When the linker is started (see "Starting the Linker" later in
I
I
this chapter), a series of four prompts appears on your display.
When you type a response to a prompt and press I ENTER I, the next
prompt appears.
After the last prompt, the linker begins linking. If it finishes
successfully, the linker exits, and the screen displays the MS-
DOS system prompt. If an error occurs, the linker displays the
appropriate error message.

239
Chapter 11 / Linking Object Modules ~
,

The linker prompts for the names of the object, run, and list files
and for libraries. Use a standard MS-DOS pathname to reference
each file.
The prompts are discussed below in the order they appear.
Defaults are shown in square brackets ([]) following the prompt.
To select a default, press I ENTER I in response to a prompt. The
Db j e c t Mod u 1 e 5: prompt is the only one that requires you to
type a pathname.

Object Modules [.OBJ]:

• Enter a list (one or more) of the object modules to be


linked. If an object module has an extension other than
.obj, specify it. If you do not, the linker assumes it is .obj.

• Separate module names from one another with a blank


space or a plus sign (+).

• Remember, the linker loads segments into classes in the


order encountered. You can use this information to set the
order in which the linker reads the object modules. Refer to
Chapter 12 for more information on this process.
I
L.....J
Run File [first object pathname.EXE]:
• Enter a pathname. The linker creates a file of that name to
store the run file that results from the link session. It
. ,

assigns the run file the extension .exe, even if you specify
an extension other than .exe. ,
~
• If you do not enter a pathname in response to this prompt,
the linker uses the first pathname typed in response to the
Object Modules: prompt. For example, if your first object I
,
, ,,
.

module to be linked is Progl.exe, the screen shows:


Run File [progl.exel:
, !

To name the run file B:Payroll, type:


B:payroll/P I ENTER I

This response directs the linker to create the run file


Payroll.exe on Drive B. Because the /P switch is included,
the linker pauses to let you insert a new disk to receive the
run file.

240
Chapter 11 I Linking Object Modules

List File [NUL.MAP]:


,---,
I ;
• Enter a pathname. If you do not specify an extension, the
linker assigns the extension .map. The list file contains an
entry for each segment in the object modules. Each entry
shows the offset for that segment in the rup. file.
I
I : • If you do not enter a response, the linker uses the default
value (NUL.MAP) and thus does not produce a list file.
~,
i Libraries [.LIB]:
• Enter a maximum of eight library filenames or press
I ENTER 1.(Only pressing I ENTER I tells the linker to search for
I" i
default libraries in the object modules.) Library files must
have been created by a library utility. Where no extension
.--
I I
is given, the linker assumes an extension of .lib.
t \
• Separate library pathnames with blank spaces or plus
signs (+).
rl I
• The linker searches library files in the order listed when
resolving external references. When it finds the module
.-- that defines the external symbol, the linker processes that
I i module as another object module.
• If the linker cannot find a library file on the disks in the
disk drives, it displays:
~
f '
Cannot find library filename
Enter new drive letter:
"
I
I : Press the letter for the drive designation (for example, B).

r:
! ;
The linker provides three command characters.
I'
,I . • Plus Sign (+). Use the plus sign to separate entries
and extend lines as needed. (A blank space can be
used instead to separate entries.)
n
l ! If the response to the 0 b j e c t Mod u 1e 5: 0 r L 1 bra r -
i e 5: prompt is too long to fit on a line, type 81 ENTER I
at the end of the line. The prompt appears again, and
r:,
t you can continue typing the response. After listing all
the modules, press I ENTER I.

241
Chapter 11 / Linking Object Modules

• Semicolon (;). At any time after the first prompt


(0 b j e et Mod u 1 e:; : ), you can select default responses
to the remaining prompts. To do so, type; I ENTER I. This I, Ii
eliminates the need to press I ENTER 1 repeatedly. c........

Once you enter the semicolon, you can no longer , I


, I
respond to any of the remaining prompts for that link ,
~
I

session. Therefore, do not use the semicolon to skip


only a few prompts. To skip prompts, use I ENTER I.
, I

• I CTRL 1[g. Use I CTRL I [g to terminate the link session at


any time. If you enter an erroneous response-such as
! :
L..J

the wrong pathname or an incorrectly spelled path- , i


name-type I CTRL I [g to exit the linker. Then you can I '
,--'
restart the linker.
If you made an error but have not pressed I ENTER I, use \ I
I BACKSPACE I to delete characters in that line. :.-i

\ I
u
You use the seven linker switches to control various linker func-
. tions. Switches can be grouped at the end of any response or dis-
tributed at the ends of several. To specify a switch, type a slash ',u
(;) followed by the switch name (that you can abbreviate to the
first letter). : I

~ I
• IDSALLOCATE - The ID switch tells the linker to
load all data at the high end of the data segment. If
L.....J

you omit ID, all data is loaded at the low end. : I


I I
L.J
At runtime, the DS' pointer is set to the lowest possi-
ble address to allow the entire DS segment to be used.
Using ID and omitting IH allows any available mem- I '

ory, below the area specifically allocated within LJ


DGroup, to be allocated dynamically by the user pro-
gram. It thus remains addressable by the same DS
pointer. This dynamic allocation is needed for Pascal
and FORTRAN programs.
I
Note: Your application program can dynam- ,, ,'
I

ically allocate up to 64K bytes (or the '--'

actual amount of memory available) less the


amount allocated within DGroup. I
I
:
I
L..J

,
i
.
i
I
------J

242
~

i Chapter 11 / Linking Object Modules

rI ' ~
I
• IHIGH - The IH switch causes the linker to place the
run file as high as possible in memory. If you omit IH,
the linker places the run file as low as possible in
memory.
Important: Do not use IH with Pascal or FORTRAN
I'
I '
programs.

• ILINENUMBERS - The IL switch tells the linker to


include in the list file the line numbers and addresses
from the source statements in the input modules. If
you omit IL, the linker does not include the line num-
bers. (If the object modules do not contain line number
information, the linker cannot include line numbers.)

• IMAP - The 1M switch directs the linker to list all


public (global) symbols defined in the input modules.
Ii
'. I
If you omit 1M, the linker lists only errors (including
undefined globals).
The symbols are listed alphabetically at the end of the
list file. For each symbol, the linker lists its value and
its segment:offset location in the run file.
,---..
i : • IPAUSE - The IP switch causes the linker to pause
in the link session. This lets you swap disks before the
linker outputs the run file. If you omit IP, the linker
does the link without stopping.
When the linker encounters the IP switch, it displays
the message:
About to generate .EXE file
Change dlSks <hit ENTER>
~ Press the space bar to resume processing.
I '
Warning: Do not remove the disk that is to
receive the list file or the disk used for the
VM. TMP file, if one has been created.

n
• ISTACK:size - The IS switch lets you specify the
stack size. If you omit IS, the linker calculates the
1 ' required stack size from information in the object
modules provided by the compiler or assembler.

r:
I
,
243
Chapter 11 / Linking Object Modules

I \
i ;
L..J
size can be any positive value (in decimal) up to
65535 bytes. If you enter a value in the range 1-511,
the linker uses 512. I '
:-:
At least one object (input) module must contain a
stack allocation statement. If it does not, the linker
displays the error message: , I
1--,
Warning: No STACK Segment
.
• INO - the IN switch tells the linker not to search the
default (product) libraries in the object modules. For
:
W

example, if you are linking object modules in Pascal


and specify IN, the linker does not search the library
named Pascal.lib to resolve external references.
, ,
I !
'--'

You can start the linker by:


i :
• entering responses to the individual prompts as they I
>_1
I

are displayed.
• including all responses on the command line. \, )
I
, I
'---
• creating a file to automatically respond to the
prompts.
, I
I ,

L.!
Method 1: Keyboard Responses
'"
To load the linker into memory and display the four prompts, one
at a time, type:
LI NK I ENTER I
I
, I
These prompts and possible responses are described under "Com- LJ
mand Prompts."

Method 2: Responses on Command Line


Type all prompt responses on the LINK command line. Separate
the responses with commas. Use the following format: \ :
G
LINK objlist, runfile, listfile, liblist [/switch ... ] I ENTER I
objlist is a list of object modules. Use a blank space or a
plus sign to separate the module names.

I i
I

244
i : Chapter 11 / Linking Object Modules

runfile is the name of the file to receive the executable


output.
~
I .
i listfile is the name of the file to receive the listing.
liblist is a list of library modules to be searched. Use a
,---, blank space or plus sign to separate the module names.
I :
Iswitch refers to optional switches. Switches can follow any
response list. (They can immediately precede any comma or
immediately follow liblist.)
To select the default for a field, type a second comma with no
r-' spaces between the two commas. For example:
I '
l :
LINK fun + text + table + care/Pcombine/M"
fun lis t, cob lib. lib I ENTER I
~ loads the linker. Then the object modules Fun.obj, Text. obj ,
I '
Table.obj, and Care.obj are loaded. The linker then pauses
because of the IP switch. When you press the space bar, the
linker links the object modules and produces a global symbol
map (because of the 1M switch). It then creates a run file with
the default name Fun.exe, creates a list file named Funlist.map,
~. and searches the library file Coblib.lib.
\

Method 3: Response File


r-;
I : Type:
LIN K @ f i 1 e 5 pee I ENTER I
r-;
I '
filespec is the name of an automatic response file that contains
answers to the linker prompts. An extension is optional. There is
no default extension.
This method permits the command that starts the linker to be
entered from the keyboard or from within a batch file without
requiring you to take any further action.
Before using this option, create an automatic response file. This
file should contain several lines of text, each of which is the
r-;
response to a linker prompt. The responses must be in the same
Ii order as the linker prompts discussed earlier. If desired, a long
response to the 0 b j e c t Mod u 1 e 5: or Li bra r i e 5: prompt can
r! be typed on several lines. Use a plus sign (+) at the end of a line
I to continue the response on the next line.

r-;

,!
245
I ;
Chapter 11 / Linking Object Modules , I
'----'

I, 'I
Use switches and command characters in the response file the U
same way as they are used for responses typed from the
keyboard. i )
L-.'_)
When the link session begins, each prompt is displayed, in order,
with the responses from the file. If the file does not contain a , ,
I ,
response for a prompt, the linker displays the prompt and waits I
LJ
for a valid response.

Example [
l---l
fun text table care
IP 1M
funlist i
L..J
coblib.li.b
The first line in this file tells the linker to load four object mod- , I
ules: Fun, Text, Table, and Care. L.J

The second line omits a name for the run file, thus the linker
will use the name Fun.exe. When the linker encounters the \ j
/P switch, it pauses to let you swap disks. After doing so, press
the space bar to continue. Because the line includes the 1M
switch, the linker produces a public symbol map (see \ \

"Switches"). LJ
The third line tells the linker to name the list file Funlist.map.
\ I
, I
The fourth line tells it to search the library file Coblib.lib. U

Sample Link Session


This sample shows the kind of information that is displayed dur-
ing a link session. I

I I
..-l
In response to the MS-DOS prompt, type:
1 1 n k 1 ENTER I I
\
I
U

I '
--..J

I
I ,
c......J

, I
I
--..J
246
I I Chapter 11 / Linking Object Modules

r"'
I ,
l I

The system displays the following messages and prompts, with


n
! i
your responses:
Microsoft Object Linker V2.01 (Large)
r-. (C) Copyright 1982, 1983 by Microsoft Inc.
I '
I '
Object Modules [.OBJ1: fun text table care IENTERJ
Run F i 1 e [F UN. EX E 1: / m I ENTER I
r"' Li s t F i 1 e [N UL • MAP 1: p r n / 1 [ENTER I
j : Li bra r i e s [. LIB 1 : I ENTER I

\"' Notes
I '
I.
• Because you specify 1M, the linker displays an alphabetical
and a chronological listing of public symbols.
G
i ' • By responding PRN to the List File: prompt, you redirect your
output to the printer.
• Because you specify the IL switch, the linker lists all line
numbers for all modules. (The IL switch can generate a large
amount of output.)
Ii
i ' • Because you press I ENTER I in response to the Lib r a r i e s :
prompt, the linker performs an automatic library search.
r> Once the linker locates all libraries, the linker map displays' a
I ) list of segments in the order of their appearance within the load
\ '
module. The list might look like this:
n
l I
Start Stop Length Name
00000H 009ECH 09EDH CODE
f"/ 009F0H 01166H 0777H FUNSEG
! :
The information in the start and stop columns shows the 20-bit

n hex address of each segment relative to location zero. Location


zero is the beginning of the load module.
The addresses displayed are not the absolute addresses where

n these segments are loaded. See Chapter 12 for information on


how to determine where relative zero is actually located and how
to determine the absolute address of a segment.

r-:
I '
L

247
Chapter 11 / Linking Object Modules

Because you used the 1M switch, the linker displays the public
symbols by name and value. For example:
ADDRESS PUBLICS_BY_NAME
1
~J
!
009F:0012 BUFFERS
009F:0005 CURRENT_DDS_LOCATION
i !
009F:0011 DEFAULT_DRIVE
009F:000B DEV I CE_LI ST
009F:0013 FILES
009F:0009 FINAL_DDS_LOCATION j •
L.J
009F:000F MEMORY_SIZE
009F:0000 FUN
" I
ADDRESS PUBLICS_BY_VALUE LJ
009F:0000 FUN
009F:0005 CURRENT_DDS_LOCATION
FINAL_DDS_LOCATION , I
009F:0009
'---'
009F:000B DEVICE_LIST
009F:000F MEMORY_SIZE
009F:0011 DEFAULT_DRIVE i I
009F:0012 BUFFERS LJ
009F:0013 FILES
I ;
L....J

LJ

I. !I
L.-J

I '
f~

,
I~

, I
i........JI

I .
I '
L-J

i I
• I
~
248
Chapter 12

LINK TECHNICAL REFERENCE

r-,
l :
I :
You can link files totaling one megabyte. The output file from
the linker (a run file) is not bound to specific memory addresses
and, therefore, can be loaded and executed at any convenient
address. The relocation information is a list of long addresses
that must change when the executable image is relocated in
---, memory. See "Long References" later in this chapter for an
: ' explanation.
L '

.-- Definitions
I ~
I '

The following terms describe some of the functions of the linker.


--. For definitions of segment, group, and class, see the "Basic Infor-
I ' mation" section in Chapter 11.
I '

• Alignment refers to byte, word or paragraph segment


r-' boundaries. You specify the alignment in an assembly'
I :
I , language program.
The byte alignment tells the linker it can start a seg-
;--"1
I '
ment on any byte boundary (one segment can immedi-
l ' ately follow another). Word alignment tells the linker to
start segments only on even addresses. Paragraph align-
ment tells the linker to start segments only on 16-byte
boundaries.
• Combine Type is an attribute of a segment. It tells the
r- linker how to combine segments that have the same
! I
1 1
name or it relays other information about the properties
of a segment. Combine types are: stack, public, private,
and common (see "How the Linker Combines and
Arranges Segments").
• Canonical Frame is the starting address of the first
r
,- " segment in a group of segments. Offsets are calculated
I :
from this address.

n
i ;

249
Chapter 12 / Link Technical Reference

! ;
'--l
How the Linker Combines and Arranges
Segments
The linker works with four combine types, which are declared in
the source module for the assembler or compiler. The types are:
private, public, stack, and common. The memory combine type ,
!
I
:
(available in Microsoft's Macro Assembler) is synonymous with U
the public combine type. The linker does not automatically place
memory combine type as the highest segment (as defined in the
Intel standard). ! '

The linker arranges these combine types as follows:


Private
Ii)

0Bj A' Ii)


Private segments are loaded separately
and remain separate. They may be
physically (but not logically) J~
, I

~ contiguous, even if the segments have


the same name. Each private segment has its
own canonical frame.
Public and Stack
Ii) \ ,
0E!j Public and stack segments of the U
same name and class name are loaded
contiguously. Offset is from the
~ beginning of the first segment
loaded through the last segment
loaded. There is only one canonical
, I
frame for all public segments of the I I

same name and class name. Stack and U


memory combine types are treated the
same as public. However, the stack
pointer is set to the last address of
the first stack segment.
, \

, !
~

I i
I I
U

i =

250
I
l
'
' Chapter 12 / Link Technical Reference

.--.
I I
I
Common
0
00 Common segments of the same

~O
~
, , name and class name are loaded
overlapping one another. There
is only one canonical frame for
r
I
all common segments of the same
name. The length of the common
area is the length of the longest
r--"
, , segment.
L ..
Placing segments in a group in the assembler provides offset
addressing of items from a single canonical frame for all seg-
ments in that group.
DS:DGROUP XXXXOH 0 - relative offset
Any number of other An operand of

~
segments can intervene DGROUP ZOO in
between segments of a assembly language
group.
Thus, the offset of ZOO
I zool returns the offset of
ZOO from the
can be greater than beginning of the first
r-", the size of segments in segment
l ) the group combined, (Segment A here).
but no larger than
1'1
64K.
I ,
I i
Segments are partitioned by declared class names. The linker
loads the segments belonging to the first class name encoun-
tered, then loads all the segments of the next class name encoun-
tered, and so on until all classes are loaded.
If your program contains:
,-,
I !
l _ A SEGMENT 'ZOO'
B SEGMENT 'BAZ'
C SEGMENT 'BAZ'
~ D SEGMENT 'NEW'
I '
E SEGMENT 'ZOO'

"
I
I
L
I
,
,

r
l '

251
Chapter 12 / Link Technical Reference

,
l.......J
the Linker loads the segments as:
'ZOO' ; I

A
E
'BAZ' ..
, I
B ~

C
'NEW'
D ,---'

If you are writing assembly language programs, you can control


the order of classes in memory by writing a dummy module and
listing it first after the linker's Obj eet Modules: prompt. The
dummy module declares segments into classes in the order you
want the classes loaded.
Warning: Do not use this method with BASIC,
COBOL, FORTRAN, or Pascal programs. Allow the
compiler and the linker to perform their tasks in the
normal way. u
Example
A SEGMENT 'CODE' i
.-J
!

A ENDS
B SEGMENT 'CONST'
B ENDS , ]
I '
C SEGMENT 'DATA' :.-J

C ENDS
1 :

D SEGMENT STACK 'STACK' u


D ENDS
E SEGMENT 'MEMORY'
E ENDS
Make sure you declare all classes to be used in your program in I'--'I
this module. If you do not, you lose absolute control over the
ordering of classes.
,, I
'----"

I i
U
252
r-
I : Chapter 12 I Link Technical Reference

,.---
I !
I _
If you want memory Combine Type to be loaded as the last seg-
ment of your program, you can use this method. Add MEMORY
between SEGMENT and 'MEMORY' in the E segment line
above. Note, however, that these segments are loaded last only
because you imposed this control on them, not because of any
inherent capability in the linker or assembler operations.
r, ,
I '

Segment Addresses
,....,
I
The 8088 must be able to address all segments in memory. Any
'...- - 20-bit number can be addressed. The 8088 represents these
numbers as two 16-bit numbers (for example, hex F:12). The F is
l !
a canonical frame address, and the 12 is the offset.
L'
The canonical frame address is the largest frame address or seg-
ment address that can contain the segment. An offset is the seg-
I I ment's location, offset from the beginning of the canonical frame.
L ~
The linker recognizes a segment by its canonical frame address
.---. and its offset within the frame .
I ,
I I
To convert the address F:12 to a 20-bit number, shift the frame
address left four bits and add the offset as shown in this
example:
FO
+ 12
1',
I, I F:12= 102 (20-bit address)

How the Linker Assigns Addresses


To assign addresses to segments, the linker orders each segment
by segment and class name. On the basis of the alignment and
r-
I I size of each segment (assuming the segments are contiguous),
!
the linker assigns a frame address and an offset to each seg-
ment. This information is used for resolving relocatable refer-
r-,
I ences. The addresses start at 0:0.
" I

.---.
l :

,l.

I,
253
Chapter 12 / Link Technical Reference

Relocation Fixups
The linker performs relocation fixups (or resolves) on four types
of references in object modules: Short, Near self-relative, Near
segment-relative, and Long.

• Short References: Short references are all self-relative.


The implication is that the frame address of the target
I i
w
and source frames are the same. The linker generates
the fixup error message: I :
! '
F1XUP off5et exceed5 fleld wldth
under either of the following conditions: I :
LJ
The target and source frame addresses are
different.
The target is more than 128 bytes before or after I~i
the source frame address.
, .
The resulting value of the short reference must fit into
one signed byte. U
• Near Self-Relative References: When near self-relative
references are used, the frame address of the target
I
i
U
)
I

and source frames are the same. The linker generates


the fixup error message under either of the following
conditions:
The target and source frame addresses are
different. , 1

The target is more than 32K before or after the


LJ
source frame address.
i )
The resulting value of the near self-relative reference I :
must fit into one signed word (16 bits).
I
i
\.....-.J

, I

I
---.J
I

I i
~
254
,--,
[ ,
Chapter 12 / Link Technical Reference

r--
I ,
! '
• Near Segment-Relative References: Given the target's
canonical frame, another frame is specified (via an
G
, , ASSUME directive or the: operator in assembly lan-
f , guage or via a high-level language convention). The
target must be addressable through the canonical
frame specified. The linker generates the fixup error
r message under either of the following conditions:
The offset of the target within the specified
i :
frame is greater than 64K or less than zero.
I ;
The beginning of the canonical frame of the tar-
get is not addressable by the specified frame.
The resulting value of a near segment-relative refer-
ence must be an unsigned word (16 bits).
I
L '
• Long References: Long references have a target and
another frame (specified by an ASSUME or by a high-
level language). The target must be addressable
through the canonical frame specified. The linker gen-
L_~ erates the fixup error message under either of the fol-
lowing conditions:

n The offset of the target within the specified


frame is greater than 64K or less than zero.

r The beginning of the canonical frame of the tar-


I, I get is not addressable by the specified frame.
The resulting value of a long reference must be a
n
I I
frame address and an offset.

,---,
j :
l '

r-:
I :

255
Chapter 12 / Link Technical Reference

! ~
L.J
MS-LIB The Library Manager
This utility is provided for advanced programmers. If you are not j I
an advanced user, you have no need for this utility. LJ

With the MS-LIB library manager, you can create library files i i
to use with MS-LINK. You can also modify library files by: ----J
• Deleting modules from a library.
, I:
\
• Adding object files (as modules) to a library. '---'

• Replacing modules. To do this, first use the delete


function and then the add function. , ,

In addition, you can extract a module from a library file and


place it in a separate object file. Extraction does not delete the
, I
module from the library; it copies it.
U
MS-LIB requires at least 38K bytes of memory (28K bytes for
code and 10K bytes for run space).

Order of Operations
During each library session, MS-LIB first deletes or extracts
modules; then it appends new modules to the end of the file.
During those operations, MS-LIB reads each module into mem-
ory and checks it fQr consistency. It then writes back to the file I
all modules you wish to retain. While doing so, it closes up the U
disk space to keep the library file as small as possible.
After appending all new modules, MS-LIB creates the index that
MS-LINK uses to find modules and symbols in the library file.
If you wish, you can instruct MS-LIB to store the index in a list-
ing file. The file contains two lists. The first is an alphabetical
list of all PUBLIC symbols, each followed by the name of the
module that contains it. The second is a cross-reference list -
an alphabetical list of the modules, each followed by a list of the , I
PUBLIC symbols in the module. , I
L-1

I, :I
-----J

: I
U

i I
LJ
256
rI : Chapter 12 / Link Technical Reference

Running MS-LIB
To start MS-LIB, you can do any of the following:
f'
!
• Enter the LIB command without options; then respond
to the three prompts.

n • Enter the LIB command with options, thus avoiding


the prompts.
• Enter the LIB command, specifying a response file (a
file that contains answers to the prompts).
Several command characters help simplify the task of using MS-
r---
I i
LIB. They are discussed later in the "Command Characters" sec-
tion. You may want to refer to that section when reading about
the different methods for starting MS-LIB.
I I
Method 1: The Keyboard Responses
To use this method, type:
LI B I ENTER I
This command loads MS-LIB into memory and displays three
~
I
prompts, one at a time. The prompts are discussed in detail
below.

n Library File:
Enter the name of the library you want to create or modify. If
you omit an extension, MS-LIB assumes .LIB. For example, to
n specify the library SAMPLE.LIB, at the prompt type:
SAMPLE I ENTER I

,n \
If you specify a library that does not exist, MS-LIB displays:
Library file does not exist. Create?
r-' Type YES I ENTER I to create the file or NO I ENTER I to stop the
I : session.

I'
i
257
Chapter 12 / Link Technical Reference .~
:

I II
Operation: l......J

List, in any order, any modules you want to delete or extract and I '
any object files you want to append. Precede each name with the
command character that specifies the type of operation you want
L
to perform on that module or file. The command characters that
apply are: I '
LJ
• Minus sign (-), which deletes
• Asterisk (*), which extracts i ;
L....:
• Plus sign (+), which appends
For example, to delete the module LESS and append the object I I

file MORE, at the prompt type: LJ


+ M0 RE - L E5 5 I ENTER I
, i
Default drive specifications and extensions for the 0 per at 10 n : LJ
prompt vary with the type of operation. See "Command Charac-
ters" for a detailed explanation of the command characters and
defaults.

List file: ,
I !
~
Enter the filename of the listing file you want to create. For
example, to create the listing file CROSSLST, at the prompt,
type: ,
: t
'
L.....J
CRDSSLST I ENTER I
If you press only I ENTER I at the prompt, MS-LIB uses NUL and
thus does not create a listing file. LJ
Method 2: Responses on Command Line I I
I I
~
To use this method, enter the command in this format: LIB
library operations, listing I ENTER I
i
The command line option, defined under "Method 1: Keyboard LJ
Responses," accomplish the same purposes outlined in that sec-
tion. For example, the following command deletes the module , I

HEAP from the library PASCAL.LIB and then appends the I I


'----'
object file HEAP.OBJ to that library:
LI B PAS CAL - HE AP + HE AP I ENTER I

i
------I
I
258
r-
I
: I
Chapter 12 / Link Technical Reference

n Notice that there is no space between library and the first com-
mand character.
n
, ,
I ' If you type only a library name followed by a semicolon (;) MS-
LIB reads the library file and checks it for consistency. It per-
forms no other operations. For example, to perform a consistency
check on the PASCAL library file, type:
LIB PASCAL; [ENTERI

rj
I
If you type only a library name followed by a comma (,) and a
listing filename, MS-LIB checks the library file for consistency
and produces the listing file. It performs no other operations. For
n
I '
example, to perform a consistency check on the library file PAS-
CAL and then create the listing file PASCROSS.PUB, type:
LIB PAS CAL, PAS CR0 S S . PUB I ENTER I

Method 3: Response File

n To use this method, enter the command in the form:


LIB @filespec I ENTER I

'.
filespec is the name of a previously created file that contains
i i responses to the MS-LIB command prompts.
A response file has one line of text for each response. Be sure
r-1
, I your responses are in order so that they apply to the appropriate
[
prompts.
Use the command characters in the response file the same as
n you use command characters on the keyboard.
When the library session begins, MS-LIB displays each prompt
with its response. Whenever you have not specified a response,
Ii MS-LIB uses the default.
If you type a library filename followed by a semicolon, MS-LIB
I" I reads the file and checks it for consistency but performs no other
I
operations.
If you enter a library filename and then a comma, and then a
listing filename, MS-LIB performs the consistency check and
produces the listing file.

r-;
I I

259
Chapter 12 / Link Technical Reference

I I
Here are two sample response files: U

PASCAL I ENTER I
, CROSSLST I ENTER I
The above file causes MS-LIB to read the library file PAS-
CAL.LIB, perform a consistency check, and create the listing file ,
I
I
.
I
,
CROSSLST. L.J

PASCAL I ENTER I
+MORE-LESS I ENTER I ,
i I
]
l......J

The above file causes MS-LIB to delete the module LESS from
the library file PASCAL.LIB and add the object file MORE.OBJ. I I
MS-LIB does not create a listing file. LJ
Command Characters
! I
Several command characters help simplify the task of using MS- ~
LIB. Four of these specify particular operations. They are:
, \

• Plus sign (+) append I


,
~
I
I

• Minus sign (-) delete


• Asterisk (*) extract I r
"--'

• Ampersand (&) extend line


The other command characters are the semicolon (;), which I l
LJ
selects default responses, and [CTRL I[]], which stops the session.
Plus Sign ( +)
I ,
..........:
A plus sign preceding an object filename instructs MS-LIB to
append that object file as a module in the specified library.
When MS-LIB does this, it removes the drive specification and I
L..J
!
extension from the object file specification. For example, the
object file B:CURSOR.OBJ becomes module CURSOR. I I

Minus Sign ( - ) L.J


A minus sign preceding a module name instructs MS-LIB to
I :
delete that module. U

: j
L..J

260
Chapter 12/ Link Technical Reference

Asterisk (*)
An asterisk preceding a module name instructs MS-LIB to
extract (copy) that module from the library into an object file.
MS-LIB assigns the object file specification, using this format
r
I ,
current drive:module name.OBJ
I '
For example, if the current drive is Drive A and the mod-
ule name is CURSOR, the object file specification is
n A: CURSOROBJ. If you do not want to use the current drive,
copy the file to another. If you want to use the current drive but
not the .OBJ extension, rename the file .
.--
I I
l I Ampersand (&)
The ampersand extends the current line when you specify the
r-1
I ' operations to perform. When you place an ampersand at the end
i l
of a line, MS-LIB displays the Opera t ion: prompt again so that
you can type more responses:
Operation: +CURSOR-HEAP+ HEAP*FOIBLES&
Operation: *INT+ASSUME+RIDEj I ENTER I
..., Use the ampersand as many times as necessary. Only disk space
i 1 limits the number of modules you can append or extract. You can
delete as many modules as exist.
n
I i
Semicolon (;)
At any time after the first prompt (Li bra r y Fi 1e :), you can
select default responses to the remaining prompt(s). To do so
type [JI ENTER I
Caution: Once you have entered the semicolon, you can no longer
respond to any of the remaining prompts. Therefore, do not use
the semicolon to skip only the 0per at ion: prompt. To skip one
p~ompt, use the I ENTER I key.

Ii I GTRL J[]]
! '
Typing I CTRL J[]] stops the library session at any time. If you
j; enter an incorrect response, such as an incorrect filename or
I ! module name, type I CTRL I[]] to exit MS-LIB. Then restart the
session.
Ii If you make an error before you press I ENTER I use I BACKSPACE I to
! ' delete characters in that line.

~
I

261
J
1
I j
L-..I

! I
LJ

i
u

i
U

\ i
~

, ]
'--'

, I
LJ

,
U

, I
I '
U

I
I I
'--'

J
,"---'
I

"
I
c }
I

1------'
i, II

Il
I
J

"
I
L _.
:

I
i
'

,---'
I i

1--'
L J

11
L :

1---'
!
I"'
! Chapter 13

THE DEBUG UTILITY

!,
The MS-DOS DEBUG is a utility program to aid you in testing,
changing, and observing the operation of executable object files.
You can use DEBUG to alter the contents of a file or register and
then immediately execute the program to see if the changes are
valid without reassembling the program.
r--
To enter the DEBUG program, type:
I
DEBUG [pathname] [parameters] I ENTER I

• pathname specifies the program file to be loaded into memory.


DEBUG loads the file, starting at lOOR in the lowest available
segment. The BX:CX registers are loaded with the number of
~ bytes placed into memory.
I
Omitting the pathname lets you work with the current regis-
r: ter contents. To load a file into memory, you must use the
,, ' Name and Load commands.

("""'
Note: When DEBUG is initialized, it sets a program
I : segment prefix (PSP) at Offset 0 in the program work
area. If you don't specify a pathname, you may over-
write the default PSP. If you are debugging a .com or
("""'
I .exe file, however, tampering with the PSP below rela-
I '
tive address 5CR will cause DEBUG to terminate.

• parameters is a list of pathname parameters and switches


that are to be passed to the program when it is loaded.
Include parameters only if you included a pathname.
I DEBUG displays a hyphen ( - ) to indicate that it is ready to
! ' accept a command.
~
At initialization, the DEBUG segment registers (CS, DS, DX,
I ' and SS) are set to the bottom of free memory, and the' instruc-
i
tion pointer (IP) is set to OlOOR. All flags are cleare,d, and the
remaining registers are set to zero.
r! Do not restart a program after DEBUG displays the message
Program terminated normally. To reload the program use
r--' the Name and Load commands. Otherwise, it does not run
! ' properly.

263
Chapter 13/ The DEBUG Utility LJ

DEBUG Commands
i )
A DEBUG command consists of one letter followed by one or , J
S--l
more parameters. You can use any combination of uppercase and
lowercase letters in commands and parameters. While using
DEBUG, you can also use the control keys (described in Chapter , i
1) and the MS-DOS editing functions (described in Part 3.) ---1

Notes
• You can terminate any DEBUG command by typing I CTRL I en
• To stop the screen from scrolling, type I CTRL I en to continue , I

scrolling, press the space bar. U


• If a syntax error occurs in a DEBUG command, DEBUG dis-
plays the command line with the error indicated by an t and i I
L.....-I
the word err 0 r. For example:

i i
D CS:g00 CS:110 LJ
tError

All DEBUG commands except QUIT accept parameters.


Parameters can be separated with spaces or commas. This is
required only between two consecutive hexadecimal Nalues.
Thus, the following commands are the same. I
~
DCS:100110
D CS:100 110
D,CS:100,110 , I
U

i
LJ

I
I I
'--'

: I
u

I II
'-----'
264
I ' Chapter 13 I The DEBUG Utility

r
I
Command Summary
Command Syntax
Assemble A [address]
r-
I . Compare C range address
!

Dump D [range address]


1"'
1 Enter E address [list]
'-
Fill F range list
r:
i Go G [= addressl [address2 .. .]]
Hex H valuel value2
r:
I

i_

'
Input I portaddress
Load L [address [drive sector sectorcount]]
Move M range address
Name N filespec1 [filespec2]
r
I '
Output o portaddress byte
Proceed P[ = address][ualue]
r
I '
Quit Q
Register R [registername]
8earch 8 range list
Trace T [= address] [value]
I""'
Unassemble U [range address]
i '
Write W [address [drive sector sectorcount]]
n
I '
Command Parameters
address is a one- or two-part designation in one of the following
formats.

t~
• An alphabetic segment register designation and an
offset value. Example: C8:0100
l \

r:
i i

265
\ !
Chapter 13/ The DEBUG Utility LJ

1
U
• A segment address and an offset value. Example:
04BA:OIOO
i I
• An offset only, in which case the default segment is
used. DS is the default segment for all commands
L..i
except G, L, T, U, and W, for which the default seg-
ment is es.

All numeric values are hexadecimal. A colon is


required to separate a segment designation and an
offset. u
byte is a one- or two-character hexadecimal value placed in or
read from an address or register. \ :
'......J
drive is a one-digit value indicating which drive is to be used for
accessing or writing data.
o Drive A
1 Drive B
2 Drive C : I

3 Drlve D
U

filespec is a file specification consisting of a drive specification,


filename, and filename extension. (The three fields are optional,
but at least the drive specification or filename should be
specified.) I
,,
, I
list is a series of strings or byte values. List must be the last '--!

command line parameter. For example:


i :
CS:1~Hl FF 42 "XXX" 1A 3 LJ
portaddress is a hexadecimal value that specifies a port number.
It can have a maximum of four characters. , !

range is an area of memory, specified by either of these formats:

• addressl address2 . i )
L.J
Example: C5 : 1 13 13 1 1 13
\ ,
address2 must be an offset value. L-:
i

i
"--'
I

266
Chapter 13/ The DEBUG Utility

I'
I
• addressLvalue
value is the number of bytes on which a command
operates. If you omit Lvalue, DEBUG assumes a value
of 80 bytes. Do not use this format if another hex
value follows the range.
r
r _~ Example: CS: 100 L 10
cs: 1 00
~ The limit for range is 10000 hex. To specify a value of 10000 hex
L within four digits, enter 0000 (or 0).
registername (See the explanation of the Register command for a
list of valid register names.)
sector sectorcount is a one- to three-character hexadecimal value
indicating the relative sector number on the disk and the num-
ber of disk sectors to be written or loaded.
The first sector of Track 0 on Head 0 is Sector O. The remaining
r:
I
sectors of Head 0, Track 0 are numbered consecutively. Number-
ing continues with the first sector of the Head 1 track that is of
the same radius as Track O. When all sectors on all heads of the
ic track (that is of the same radius as Track 0) are numbered,
; numbering continues with' the first sector of Head 0 of the next
track.
r---'
!
I '
string is any number of characters enclosed in quotation marks,
either single (,) or double ("). The ASCII values of the charac-
ters in the string are used as a list of byte values.
r
( , If quotation marks are to be used within a string, they must be
either the opposite set or they must be doubled.
Examples of the correct uses of quotation marks:
\Thi5 1 5 tring" i5 correct.'
r--' \Thi5 \ \5tring' , i5 correct.'
! "Thi5 \5tring' i5 correct."
:
"Thi5 II 1 5 tring" II i5 correct."
i Examples of incorrect uses of quotation marks:
I ;
\Thi5 \5trlng' i5 not correct.'
"Thi5 1 5 trlng" i5 not correct."
value is a hexadecimal value that is a maximum of four
characters.

267
Chapter 13 / The DEBUG Utility 1
L.J
!

I ,
: l

~
ASSEMBLE
A [address] I
J
I
,

'-'
Assembles Macro Assembler statements directly into memory.

Parameters
address is the starting address for the instructions to be assem-
bled in memory.
If you omit the address, the Assemble command begins at the
next address following the last assembled program. If no Assem-
ble statement was used previously, assembly starts at CS:0100.
All numeric values are hexadecimal and can be entered as 1-4
characters.

Notes
• If a statement contains a syntax error, DEBUG displays:
tError
: I
and redisplays the current assembly address.
G
• The segment override mnemonics are CS:, DS:, ES:, and SS:.
The mnemonic for the far return is RETF. String manipula- I

I
tion mnemonics must explicitly state the string size. For c...-J
example, use MOVSW to move word strings and MOVSB to
move byte strings.
I !
• Prefix mnemonics must be specified in front of the opcode to
which they refer.
I '
Examples
Near/Far
i I
0100: 0500 JMP 502 a 2-byte short jump ~
0100:0502 JMP NEAR 505 a 3-byte near Jump
0100:0505 JMP FAR 50A a 5-byte far Jump I I
'--.J
The assembler automatically assembles short, near, or far jumps
and calls, depending on byte displacement, to the destination
address. These may be overridden with the NEAR or FAR prefix. ,
I I
i
The NEAR prefix can be abbreviated to NE. L..-J

i )
~
268
r--
!I Chapter 13 / The DEBUG Utility

r-'
1 ' Word Ptr/Byte Ptr
NEG BYTE PTR [128]
DEC WO [S 1 ]

DEBUG cannot tell whether some operands refer to a word mem-


r-'
I .
ory location or to a byte memory location. In such a case, the
, ' data type must be explicitly stated with the prefix WORD PTR or
BYTE PTR. These can be abbreviated wo and BY.
r-,
i ' Memory Location/Immediate Operand
MoV AX,21 ;Load AX with 21H
......, AX,[21] ;Load AX wlth the contents of
I, '' MoV
;memory locatlon 21H

You use square brackets to tell DEBUG that an operand refers to


i ~ a memory location rather than to an immediate operand.
L '
DEBUG uses the convention that operands enclosed in square
brackets refer to memory.
r-'
I
I. '
DB/DW Opcodes
DB 1 ,2,3,4,"THIS AN EXAMPLE"
DB 'THIS IS A QUOTE:'"
DB "THIS IS A QUoTE:'"
DW 1fiHl0,2000,3'HHl, "BACH"
r-'
I '
I Two popular pseudo-instructions are available with the Assemble
command. The DB opcode assembles byte values directly into
n memory. The DW opcode assembles word values directly into
l ! memory.

r;
Register Indirect Commands
, i
ADD BX,34[BP+2]. [SI-1]
POP [BP+DI]
rJ PUSH [SI]
I I

All forms of register indirect commands are supported.

it '\

-,
I
[ I

r-'
i :
269
Chapter 13/ The DEBUG Utility

Opcode Synonyms
LDDPZ HH'J i .
LDDPE Hllil ~
JA 100
JNBE 100
, I
All opcode synonyms are also supported. ~

WAIT/FWAIT
FWAIT FADD ST,ST(3) ; This line will
assemble
; FWAlT prefiX I
~
FLD TBYTE PTR [BX] ; This line will not
The WAIT or FWAIT must be explicitly specified for 8087 ,
opcodes. i
L..J

, I

COMPARE
C range address \
,
.-
I
L....-i
Compares memory specified by range to a memory block of the
same size beginning at address. )
I
'-J

Parameters
range is the beginning location and the number of bytes of ~h:,
first block of memory to be compared.
address is the beginning address of the block of memory to
which range will be compared.
If the two areas of memory are different, DEBUG displays the
differences in this format:
addressl bytel byte2 address2
addressl bytel refers to the address and contents of a location in I
, ,I
the specified range. w
byte2 address2 refers to the corresponding address and contents
in the block starting at address.

270
,-
I
l Chapter 13/ The DEBUG Utility

Notes and Suggestions


• If the two areas of memory are identical, DEBUG only dis-
plays its prompt C).
• If you enter only an offset for the starting address of range,
the segment indicated by Register DS is used.

Example

C 1 0 0 , 1FF 30 0 I ENTER I
C 100L100 300 I ENTER I
--
It . are two commands that have the same effect. Each command
compares the block of memory from DS:l00 to DS:1FF with the
,---,
block of memory from DS:300 to DS:3FF.
I I
I

,--, DUMP
I '
D [address]
r--- D [range]
I I
! ,

Displays the contents of the specified address or range in


, '
; memory.

Parameters
address is the beginning memory location for DUMP.
range is the number of bytes to be displayed.
I :
Notes and Suggestions
• The dump is displayed in two portions:
• A hexadecimal portion where each byte is displayed in
hexadecimal.
• An ASCII portion. Each byte is displayed as an ASCII
character. Characters that cannot be displayed are
shown as a period (.)

271
Chapter 13 I The DEBUG Utility

, : I

• Each displayed line begins on a 16-byte boundary and shows


16 bytes. A hyphen appears between the eighth and ninth
bytes. ! .

• If only a starting address is specified with the D command,


the contents of memory are displayed starting at the address.
I !
• If neither parameter is specified with the D command, 128
bytes are displayed beginning immediately after the last
address displayed by a previous D command. I, i
I
J-J
• If only an offset for the starting address is given, the segment
indicated by register DB is used.
I
I-..J

Example
Des: 1 0 0 1 09 I ENTER I , i

L'
DEBUG displays the contents of the range C:100 109 in the fol-
lowing format:
04BA:0100 54 4F 4D 20 53 41 57 59-45 52 TOM u
SAWYER
! ;
L.J

ENTER
E address [list] , ,
!
~
I

Enters byte values into memory at the specified address.

Parameters
address is the beginning location of the memory block to receive
new values.
I '
'---'
list is the new values to be entered.
, i
'~I

, I
I I
1----1

272
\
i ' Chapter 13/ The DEBUG Utility

Notes
• If you type the optional list of values, DEBUG replaces the
contents of memory, beginning at address, with the new val-
ues. For example:
I""' E DS: 1liHl 45 A1 "abc" I!lF
I '
I I

places the six bytes in the list into memory beginning at


,--.
DS:I00.
I ' • If you omit the list, DEBUG displays the address and its con-
tents and then waits for your input. You can do any of the
following:
I
! '
• Enter a hexadecimal byte value to replace the dis-
played value. (Illegal or extra characters are ignored.)
• Press the space bar to advance to the next byte. To
change this value, type the new value as described
above. Each press of the space bar advances to the
I next byte without changing the current byte.
~ -;
If you space beyond an eight-byte boundary, DEBUG
,.-... starts a new display line.
I
• Press the hyphen to back up to the preceding byte.
The preceding address and its contents are displayed
on the next line. If you want to change this byte, type
the new value as described above. Each time you press
the hyphen, the DEBUG Enter command backs up one
more byte without changing the current byte.
• Press [ ENTER I to end the Enter command.
If you enter only an offset for the address, the segment indicated
by register DS is used.

Example
E C5 : 1 I!ll!l [ENTER I
...-, causes DEBUG to enter byte values into memory beginning at
: i
,_ I DS:I00. DEBUG displays the address and its contents (EB) as
shown here.
I
, ' \
1!l4BA:I!lUI!l EB.

~
I ,
273
;
Chapter 13/ The DEBUG Utility \

To change the value from EB to 41, type 41 (at the present cur-
sor position) and press the space bar. DEBUG stores the value 41
and displays the contents of the next byte:
~4BA:~1~~ EB.41 1~.

To display the contents of the next two bytes, press the space bar
II ''
twice more. You might see ~

~4BA:~10~ EB.41 1~. ~~. BC.

To change Be to 42, type 42 as shown:


~4BA:~10~ EB.41 1~. ~~. BC.42

If you want to go back and change 10 to 6F, press the hyphen


twice to return to value 10, and then type 6F:
~4BA:~10~ EB.41 10. ~~. BC.42-
~4BA:~1~2 ~~.-
~4BA:~101 U.6F

press I ENTER I to end the Enter command. , .


L-i

\ !
FILL ! •

F range list
- Fills the memory locations in the specified range with the values
in the list. i .
: I
--.J
Parameters
range is the area of memory to receive the new values.
list is the data values to be placed in range.

Notes
• If the list contains fewer bytes than the range, DEBUG uses
the list until all locations in the range are filled. \ :
~
• If the list contains more bytes than the range, DEBUG
ignores the extra values in the list.
• If you enter only an offset for the starting address of the
range, DEBUG uses the segment indicated by Register DS.

274
l ,
Chapter 13/ The DEBUG Utility

,.......,
I
Example
F 04BA:100 L 100 42 45 52 54 41 IENTERJ
causes DEBUG to fill memory locations 04BA:IOO through
04BA:IFF with the bytes specified. The five values are repeated
," '
until alllOOH bytes are filled.

i"" GO
G [=addressl[address2 ... ]]
Executes a program currently in memory. Execution stops at
specified breakpoints, and the registers, flags, and instruction
line for the next instruction to be executed are displayed.

Parameters
addressl is the start location of the program to be executed.
address2 ... gives the addresses for optional breakpoints.
,, ,
Notes
• If you include addressl, execution begins at addressl in the
CS segment. The equal sign ( = ) is required.
• If addressl is omitted, the program execution starts at the
current instruction. The address of the current instruction is
determined from the contents of the CS and IP registers.

---,
i
, \

275
, I
Chapter 13/ The DEBUG Utility I
L-'
:

• address2 is used to set breakpoints. These allow you to exam-


ine the register contents and flag settings in effect when a
specified address is reached during program execution. ! i
~l

After execution halts at a breakpoint, you can enter the Go


command again. The program resumes execution at the
instruction after the breakpoint. , ,
h.-o

• An interrupt code (OCCH) is placed at the specified break-


point addressees). When an instruction with the breakpoint
code is reached, DEBUG restores all breakpoint addresses to
their original instructions. If no breakpoint is reached, the
original instructions are not restored.
L...J
• A maximum of ten addresses can be set, in any order. If you
enter only an offset for a breakpoint address, the segment
indicated by register CS is used. Breakpoints can be set only i I
at addresses that contain the first byte of an 8088 opcode. L
Execution stops when any breakpoint is reached.
• The user stack pointer must be valid and have 6 bytes avail- I
~
i
able for the Go command. This command uses an IRET
instruction to cause a jump to the program under test. The
user stack pointer is set and the user flags, CS register, and I
Instruction Pointer are pushed on the user stack. L

Example
G CS : 7 5 5 il I ENTER I
causes the program currently in memory to execute up to j, :I
address 7550 in the CS segment. DEBUG restores the original
instructions, displays the register contents and the flags, and the
Go command ends.

, I
L

, I
, 1
I-..J

276
Chapter 13/ The DEBUG Utility

HEX
\ , ''
H valuel value2
Performs hexadecimal arithmetic on valuel and value2.

Parameters
I '
i
valuel value2
DEBUG first adds valuel and value2 and then subtracts value2
from valuel. The sum and difference are displayed on one line.

Example
I ,
H 19F 1 QJ A I ENTER I
causes DEBUG to perform the arithmetic and displays the
results:

QJ2A9 QJQJ95

The sum of 19F and lOA is 02A9, and the difference is 0095.
,--;

[ I

INPUT
,...,
I I portaddress

..--l Inputs and displays one byte from the specified port.
i :
Parameters
l_ ; porta<jdress is a 16-bit port address in hexadecimal.

Example
I 2F8 I ENTER I
causes DEBUG to input the byte at Port 2F8 and display it. If
, the byte is 42, DEBUG displays:
I \

42

277
I :

Chapter 13/ The DEBUG Utility

LOAD
L [address[drive sector sectorcount]]
,
Loads a file into memory. , ;
j :

Parameters
address is the beginning memory location for a file load.
drive sector is the absolute disk sectors that contain the file to
be loaded. I '

LJ
sectorcount is the number of disk sectors to be loaded.
I i
Notes
• Before a file can be loaded, it must have been named either
when DEBUG was started or with the Name command. Both
procedures format a filespec properly in the File Control Block
at CS:5C.
• If you omit all parameters, DEBUG loads the file into memory
at address CS:I00 and sets BX:CX to the number of bytes
loaded. If you specify address, DEBUG loads the file beginning
at the specified address in memory. In both cases, the file is , ,
,I
read from the drive specified in the filespec or from the
default drive if no drive was specified.
• When all parameters are specified, absolute disk sectors are 1
~
:

loaded. The sectors are loaded from the specified drive (0 =


Drive A, 1 = Drive B, and so on). DEBUG begins loading
with the specified sector and continues until the number of
sectors indicated by sectorcount have been loaded.
• When an offset is used for the starting address, the segment
indicated by register CS is used. , I
LJ

\ :

I i
c.-..J

278
Chapter 13/ The DEBUG Utility

• When you load a file with an .exe extension, DEBUG relocates


the file to the load address specified in the header of the .exe
r-,
I '
file and ignores any address you may have specified. The
header is stripped from the .exe file before it is loaded. Thus
the size of an .exe file on disk differs from its size in memory.
I If the file indicated by the Name command, or specified when
: I
I
DEBUG is started, is a .hex file, then entering the L command
without parameters causes DEBUG to load the file at the
address specified in the .hex file. If the L command includes the
i : address option, DEBUG adds the specified address to the address
found in the .hex file to determine the start address for loading
the file.

Example
DEBUG I ENTER I
N f i 1 e • com I ENTER I
L I ENTER I
DEBUG loads the file called File.com from the default disk. To
load only portions of a file or certain sectors from a d~sk, type a
command similar' to the following:
L 04BA:100 2 0F 6D I ENTER I
DEBUG loads 6DH (109) consecutive sectors into memory from
Drive C, beginning with absolute sector number OF (15). The
data is placed beginning at address 04BA:0100.

MOVE
i; M range address
Moves the block of memory specified by range to the location
:.: beginning at address.

Parameters
i
l ' range is the beginning location and number of bytes of memory
to be moved.

", '
I I address is the beginning address location to receive the moved
data.

279
Chapter 13/ The DEBUG Utility

Notes
• Overlapping moves (where some locations in the range are i I
also in the block beginning at address) are performed without : I
loss of data. The addresses in the range remain unchanged
unless new data is written to them by the move.
. i
• If only an offset is used for the starting address of range or for L
address, the segment indicated by register DS is used. To
specify an ending address for the range, enter only an offset
value. !L.;'

Example )
I

M CS:100 110 CS:500 I ENTER I ~

causes DEBUG to move the data that is between CS:l00 and )

CS:110 to the memory area beginning at CS:500 I


L..;
I

NAME L.J

N filespecl [filespec2 ... J


, i
I
L....'
Assigns filespecs or program names for later Load or Write com-
mands. If DEBUG is entered without naming any file, then you
must use the N filespec command before a file can be loaded. The I I
L
Name command also assigns filespec parameters to the file
being debugged.
i
I ,
Parameters ~

filespec1 filespec2 are names assigned to the files you will be


using with DEBUG. .i ,i

280
r-
I

L! Chapter 13 / The DEBUG Utility


~

I,_ I

Notes
• Four areas of memory can be affected by the Name command:
DS:5C File Control Block for filel
DS:6C File Control Block for file2
DS:80 Count of characters
DS:81 All characters typed

I '
• A File Control Block (FCB) for the first filespec parameter
I , given to the Name command is set up at DS:5C. If you include
filespec2, an FCB is set up for it at DS:6C. DS:80 contains the
number of characters typed after the letter N in the Name
command line. All characters typed after the N are stored
beginning at DS:81.

n
I '
Examples
N f i 1e 1 . ex e I ENTER I
,..---.,:' L I ENTER I
I
L~ N flle2.dat flle3.dat I ENTER I
G I ENTER I
The Name command sets Filel.exe as the filespec for the Load
command that follows. After Filel.exe is loaded into memory, the
Name command is used again this time to specify the parame-
ters to be used by Filel.exe. When the Go command is executed,
Filel.exe is executed as if file1 file2.dat fl1e3.dat had
been entered at the MS-DOS command level.
DEBUG prog.com [ENTER I
N param1 param2/c t ENTER I
G I ENTER I

i : The Go command executes the file in memory as if PRO G


param1 param2/C had been typed at the MS-DOS command
level.

i I
I I

n
I '
~ ;

281
Chapter 13/ The DEBUG Utility

OUTPUT
o portaddress byte :
:'-..J'
\

Sends the byte to the specified portaddress.


, I
I, !l
'-
Parameters
portaddress byte allows a 16-bit port address.

Example
, I
o 2FB 4F ; :
causes DEBUG to output the byte value 4F to Port 2F8.
! 1

LJ
PROCEED
1 (ijJ 1 p [= address] [value]

Executes one or more instructions and displays the register con-


tents, flags, and the next instruction after each. Proceed is very
similar to Trace, except for the following functions:
• It automatically executes. iI
---J
I
,

• It returns from any call or software interrupt


instructions. I ~
I I

• It executes loop and repeat string instructions. L--!

Parameters

address is the address of the instruction where Proceed is to , .


begin. ,, ;

value is the number of instructions to execute, beginning with


address.

:I
L.-i

I ;

~
282
r-
II
Chapter 13/ The DEBUG Utility
r-
i
Examples

displays the registers and flags for the current instruction.


n
l : P =0 1 1 A 1 0 I ENTER I
executes 16 (10 hex) instructions beginning at OHA in the cur-
r- rent segment and displays the registers and flags after each
I :
L __,
execution.

,Ii '
!
'
QUIT
n'
I
Q
Ends the DEBUG program. The Quit command exits DEBUG
n without saving the file you are debugging and returns to the
MS-DOS command level.

r-.
I '
Example
l !
Q I ENTER I
r- ends DEBUG and returns to the MS-DOS system prompt.
i '
! :

I i
I '
, I
REGISTER
R [registernameJ
r-,
I ,
I :
Performs these functions:

• Displays the contents of all registers and flag settings

• Displays the contents of a single register and lets you


change the contents

• Displays the flag settings and lets you change the


settings

i!
\
]Parameters
registername is the name of the register to be displayed.
n
I \
283
! j
Chapter 13/ The DEBUG Utility L..J

Notes
LJ
• If you enter R with no registername, DEBUG displays the con- i ~
! I
tents of all registers and flags, together with the next instruc- L--

tion to be executed.
• If you include a registername, DEBUG displays the 16-bit r, !I
value of that register in hexadecimal, and then displays a '--'

colon prompt. Change the contents of the register by entering


a one- to four-character hexadecimal value, or leave the con-
tents unchanged by pressing I ENTER I. The valid registernames
are:
AX BP SS 1
I
:
I
'---'

BX SI CS
CX DI IP
DX DS PC
SP ES F i i
L.1

Both IP and PC refer to the Instruction Pointer.


i
• Entering F as the registername causes DEBUG to display a L:
two-letter status code for each flag, showing whether it is set
or clear. To change any flag, enter the opposite code. , I
LJ
I I
LJ

, I
U

, I
I i
'--'

i i
284
Chapter 13 / The DEBUG Utility

r-'
I I
I I
I . The flags are listed below with their codes for set and clear:
Flag Name Set Clear
n
I '.
I
Overflow (yes/no) OV NV
Direction (decrement/increment) DN UP
Interrupt(enable/disable) EI DI
Sign (negative/positive) NG PL
n Zero (yes/no) ZR NZ
Auxiliary carry (yes/no) AC NA
r-'
, I
! , Parity (even/odd) PE PO

.--,
Carry (yes/no) CY NC
I I
l ! At the RF command, DEBUG displays the flags in the order
shown above at the beginning of a line. The hyphen prompt ( - )
appears at the end of the line. Now you can change any of the
flag values by typing alphabetic pairs, in any order. You need
not leave spaces between the flag entries. Press [ENTER I to make
r-,
the changes and exit the command. Flags for which you did not
I ; type a new value remain unchanged.

Examples
n
[ .
RW!@]
causes DEBUG to display all registers, flags, and the next
n instruction to be executed. For example, if the location is
CS:llA, the display looks similar to this:
AX=0E00 BX=00FF CX=0007 DX=01FF
SP=039D BP=0000 SI=005C DI=0000
DS=04BA ES=04BA SS=04BA CS=04BA
IP=011A NV UP DI NG NZ AC PE NC
[
r:I
04BA:011A CD21 INT 21

r:
I . RF I ENTER I
DEBUG displays. the flags
n
I :
NV UP DI NG NZ AC PE NC-
;-'
I
285
Chapter 13/ The DEBUG Utility

Type one or more flag designations, in any order, with or with-


out intervening spaces. For example:
r 1
NV UP DI NG NZ AC PE NC - PLEICY [ENTER I I

~
r

DEBUG makes the requested changes.


I I
R AX I ENTER I LJ
DEBUG displays the contents of the single register AX:
I, 1I
AX elEelel I •
'--'

to change the contents to OOFF, enter FF after the colon prompt.


i j
l..-J

SEARCH
LJ
S range list
Searches specified memory for a list of bytes. LJ
Parameters 1- 1

!
L...J
range is the start and end address in memory where search will
be conducted.
list are the byte values to find. i !
'---'

Notes ,
~ I

• The list can contain one or more bytes, each separated by a U


space or comma. DEBUG displays the starting address for
each match found.
• If no addresses are displayed, the list was not found.
• If you enter only an offset for the starting address of range, I i
the segment indicated by register DS is used. '---'

,i
LJ

i ,
~
286
Chapter 13/ The DEBUG Utility

! ' Example
S C5 : 1 'l 'l 1 1 'l 4 1 I ENTER I
causes DEBUG to search,the addresses from C8:100 to C8:110
for 41H. If two matches are found, DEBUG displays a response
,-' similar to this:
!
'l4BA:'l1'l4
'l4BA:'lUD
I '

TRACE
II T [= address] [ value]
Executes one or more instructions and displays the register con-
tents, flags, and next instruction after each.

Parameters
=address is the address of the instruction where trace is to
begin.
value is the number of instructions to be traced (beginning with
, I address).

Notes
: I
• If you enter T with no parameters, DEBUG executes the
instruction at C8:IP (the current instruction) and displays the
i
registers and flags. If you enter the optional = address, trac-
" ' ing begins at the specified address. The optional value causes
DEBUG to execute and trace the number of instructions speci-
fied by value.
i :
: i
• When tracing more than one instruction, you can suspend the
display by pressing I CTRL I m
in order to study the registers
and flags for any instruction. Press the space bar to continue
scrolling.

', <I
,

287
i I
Chapter 13/ The DEBUG Utility I
LJ
I

Examples
T [ENTER I
i J
causes DEBUG to display the registers and flags for the current ~

instruction. If the current instruction is 04BA:OllA, DEBUG


might display: I 1

AX=0E00 BX=00FF CX=007 DX=0177


SP=039D BP=0000 SI=005C DI=0000
, I
DS=04BA ES=04BA SS=04BA CS=04BA I I
LJ
IP=011A NV UP DI NG NZ AC PO NC
04BA:011A CD21 INT 21

T=011A 1 0 [ENTER I
, !
DEBUG executes 16 (10 hex) instructions beginning at OllA in
the current segment and displays the registers and flags after LJ
each instruction.
\ !
l..J
UNASSEMBLE i i
:-.J
U [address]
U [range]
Disassembles instructions and displays their addresses, their
hexadecimal values, and the source statements that correspond
to them. I I
LJ
Parameters
~I l,
address is the address of instructions to be disassembled.
range is the number of bytes to disassemble.
i !
~
Notes
• The display of disassembled code looks like a listing for an ! I
assembly language source file. The U command, without : I

parameters, starts immediately following the end of the last


disassembled memory. If you specify address, instructions are
disassembled beginning with address. I I
L...,

288
J
l ; Chapter 13 / The DEBUG Utility

I'
i i
• If you enter the U command with the range specified, DEBUG
disassembles all bytes in the range.
• In all cases, DEBUG may disassemble and display slightly
more bytes than the default amount or the number you
requested. This is because instructions are of varying lengths,
and the last instruction disassembled may include more bytes
than expected.
• When only an offset is used for the starting address, the seg-
lf! I ment indicated by register CS is used.
• If you have altered some locations using DEBUG, you can
~
I : enter the U command for the changed locations, view the new
I i instructions, and use the disassembled code to edit the source
file.
I i
I ~
Example
U~4BA:1~~ L1 ~ I ENTER I
I'
I
causes DEBUG to disassemble 16 bytes beginning at address
04BA:0100 and displays information similar to the following:
.,.......,
,I :, ~4BA:~10~ 2~6472 AND [51 + 72] ,AH
" '
~4BA: 69 DB 69
Ii ~4BA:~104 7665 JBE ~16B
i :
~4BA:~1~6 2~737~ AND [BP + D1 + 70] ,DH

o
I
~4BA:~1~9 65 DB 65
~4BA:~1~A 63 DB 63

n
, '
~4BA:~1~B 69 DB 69

~4BA:~1~C 66 DB 66

~4BA:~10D 69 DB 69

~4BA:~10E 63 DB 63
1;
I: ~4BA:~1~F 61 DB 61

"
i, i
I

289
Chapter 13/ The DEBUG Utility

I )
i
I..-!
WRITE
, I
W [address[drive sector sectorcountJJ ! :

Writes the data being debugged to a disk file. , I


~
Parameters
address is the memory location of the data to be saved. i
I
'
I
!
-..J

drive sector designates the disk drive to be used for the save.
sector designates the starting diskette sector for the save.
sectorcount indicates the number of sectors to be used in the
save.
i, f
I
'--..J
Notes
• If no parameters ~re given, the file save begins at CS:I00. If I l
only the address parameter is given, the W command writes ~
the file beginning at that address. In either case, you must be
certain that BX:CX contains the number of bytes to write.
This value may have been set correctly by the DEBUG or Load
commands, but later altered by a Go or Trace command. (Note
that if you load and modify a file, the name, length, and start-
ing address are already set correctly as long as the length has ,
!
I
-....-l
not changed.)
• The file must have been named either with the DEBUG start-
up command or with the Name command. Both commands for-
mat a filespec properly in the File Control Block at CS:5C.
DEBUG writes the file to the drive specified in the filespec or
to the default drive if none is specified. I
\ '
'

L..-.

: '
i ,

I I
~
290
I ' Chapter 13/ The DEBUG Utility

rr
l I
• When all parameters are specified, the write begins from the
~
memory address specified. The file is written to the specified
,I '
' drive (0 = Drive A, 1 = Drive B, and so on). DEBUG writes
'-~
the file beginning at the sector specified by sector, until the
number of sectors specified by sectorcount have been written.
• If only an offset is entered for the starting address, the seg-
ment indicated by register CS is used.
,.--.
i : • If a disk write error occurs, DEBUG displays a message. Press
, I
[ill to redisplay the Write command, and then press I ENTER I.
• Be very careful when you write to absolute sectors on the
disk. Data that was previously in these sectors is destroyed.

Example
n
'_I w CS:1~~ 1 37 2E I ENTER J

writes the contents of memory to the disk in Drive B, beginning


J , with memory address CS:100. The data is written beginning at
relative sector 37H and consists of 2BH sectors. The DEBUG
prompt is displayed when the write is complete.

..--,
I
I ;

,r-1,
! .~

,.-.
I
i

--1
, I

:I '
(

,...,
i \
I i

r:
i i
291
, ,
~
n
! j

n
i . j

r-:
, !

;---J
i !

I
I ':
I I

~
i '

I'
I '

i
i

;-]
l j

n
r:
I
r--
l ' Chapter 14

I PROBLEMS AND ERROR MESSAGES

It is important that you understand error messages. They inform


you of difficulties the computer is having in accomplishing the
rl task it has been given. Knowing what the problem is will assist
you in solving it most efficiently.

r MS-DOS Error Messages


The two sources of error messages are MS-DOS and an applica-
tion program. If you receive an error message other than a sys-
tem error, it comes from an application program. Refer to that
program's documentation for help.
System errors consist of two types: those that occur while MS-
DOS is writing to a disk or to another system device (such as a
printer) and command errors. As well, MS-DOS special pro-
grams (such as LINK, DEBUG, or EDLIN) have their own error
l : structure. The errors that can be displayed by MS-DOS or its
functions are described in the following order:
• Device Error Messages
• Command Error Messages
• EDLIN Error Messages
I, •

Linker Error Messages
DEBUG Error Messages

r
l I Device Error Messages
Device errors refer to problems with your computer and its
peripherals, such as disk drives, modems and printers. If a
Device Error occurs at any time during a command or program,
MS-DOS returns an error message in the following format:
rI '
type error action device name
Abort, Ignore, Retry:

r
293
Chapter 14 / Problems and Error Messages

type refers to one of the following types of errors:


Bad call format No paper i
I !
Bad command Non-DOS disk '--.,..J

Bad unit Not ready


Data
Disk
FCB unavailable
Read fault
Sector not found
Seek
u
General failure Sharing violation , '
Invalid disk change Write fault
Lock violation Write protect
action is either reading or writing. I iI
i
'----'
device is the equipment that is experiencing the difficulty, such
as drive (disk drive) or PRN (printer).
! i
name is the letter of the drive (if device is a drive) in which the U
error occurred.
For example, if MS-DOS finds data on the diskette in Drive B I
that it is unable ~o read, it displays: ~

Data error readlng drive B


I
Abort, Retry, Ignore? , !'
c.......!

After displaying the error message, MS-DOS waits for you to


enter one of the following responses: I I

A Abort. Terminate the program that was in process


U
and return to the MS-DOS system prompt.
\ !
Ignore. Ignore the error and continue the program or ~
command. If continuing requires further reads to the
same disk area, the error message is likely to recur. ,
,I
R Retry. Repeat the disk read. Give this response if you ~
have been able to correct the error.
To recover, press R to try again. If that fails, press A to cancel ; I
~
the operation. Then, you can take steps to discover the cause of
the error.
.
Following are descriptions of the device error types MS-DOS can J
display.
, '
Bad call format ~
The device driver was passed an incorrect length request header.
Contact the dealer from whom you purchased the device driver. \ I
~J
294
i
I Chapter 14/ Problems and Error Messages
l _

,.--,
l Bad command
MS-DOS issued an invalid command for the device driver. Try
the command again. If it continues to fail, contact the dealer
from whom you bought the device driver.

Bad unit
A device driver passed an invalid sub-unit number. Contact the
dealer from whom you purchased the device driver.

Data
The data cannot be read or written correctly. You probably have
a flawed disk.

Disk
r MS-DOS has found an error it does not recognize.

FeB unavailable
L__ FCB's might not be high enough.

General failure
,...,
I A hardware error or the disk is not formatted.
l _
Invalid disk change
A diskette was removed while files were open.

Lock violation
r-'
I : All or part of a source file is locked and cannot be read. Wait a
few moments and try again.

No paper
The printer is out of paper.
.....-,
l ' Non-DOS disk
The disk is not in a format recognizable by MS-DOS.

Not ready
The device is not ready. Check to see that the drive latches are
closed and that all devices are on and ready.
Ir-'.

r
!
295
Chapter 14 / Problems and Error Messages

I i
Read fault G
The device cannot successfully read the data. You may have a
flawed disk. Try to copy all files to another disk. If this fails, you
probably have a hardware problem. Contact your dealer. J
Sector not found I !
MS-DOS is requesting a sector number higher than the highest ~
number on the disk.
I I
I I
Seek o
The disk drive or hard disk cannot locate the proper track on the
disk.

Sharing violatlon
A file is open in a sharing mode that does not allow the com- - I
mand to write to the file. LJ

Write Fault , I
I I
~
The device cannot successfully write the data. You may have a
flawed disk. Try to copy all files to another disk. If this fails, you
probably have a hardware problem. Contact your dealer.

Write protect
You tried to write to a write-protected diskette. Remove the i i
write-protect tab and try again. L.-I

One other error message might be related to faulty disk read or I I


write: i~

File allocation table bad for drlve drive


I I
This message means that the copy in memory of one of the allo- l.J
cation tables has pointers to nonexistent blocks. Possibly the disk
was incorrectly formatted or not formatted before use. If this , I
error persists, the disk is currently unusable and must be for- I
k.-J
'

matted prior to use.


I !

I
'--'
I
1

296
.J
Chapter 14/ Problems and Error Messages

rI
Command Error Messages
r The following errors can occur while using MS-DOS commands.

Acce55 denied
You tried to replace or copy to a write-protected, read-only, or
locked file.

After format, one of 5Y5tem 5ector5 could not be


read
Errors were found on the system sectors of the disk. The disk
might be unusable.
r
! '
All file5 canceled by operator
This is a reminder only. You used the IT parameter with PRINT
to cancel the printing of all files in the print queue.
Allocatlon error, 51ze adju5ted
A filename is displayed with this message. The File Allocation
Table (FAT) contains an invalid sector number. CHKDSK auto-
,........, matically truncates the file at the end of the last valid sector
I : number.

Bad command or file name


The command you typed is not valid. Check spelling and reenter
the command. If the command is an external command, be sure
it is in the directory that MS-DOS is searching for commands. If
you are trying to execute a batch file, be sure you are in the
directory which contains that file.

n Bad or mi55ing Command Interpreter


I
MS-DOS cannot find the COMMAND.COM file on the disk.
Either the file is missing from the ROOT directory, or the file is
,........,
! ' invalid. Restart the system, or copy the COMMAND.COM file
from your master MS-DOS system disk to your working system
disk. You also receive this message if COMMAND.COM is not in
11 the same directory it was in when you started MS-DOS.
, l
Bad or mi55ing (filename)
,..,
I I
You specified an invalid device in the CONFIG.SYS file. Check
, I
the accuracy of the DEVICE command in CONFIG.SYS.

297
Chapter 14/ Problems and Error Messages

Bad Partition Table


iL....Ji
There is no DOS partition on the hard disk. Use FDISK to cre-
ate a DOS partition so you can use the disk. I
--'
i
Bad switch syntax
You used an invalid switch syntax with a command. Check the
command reference for valid switches.

Cannot CHDIR to filename I ;


I !
Tree past this poinl not processed ~

CHKDSK is traveling the tree structure of the directory and is


unable to go to the specified directory. No subdirectories below ,
.
I
I
this directory are verified. LJ

Cannot CHDIR to root


Processlng cannot continue :
L..J
;
The disk you are checking is bad. Restart the system and try
using RECOVER command. I J
I I
L..J
Cannot perform a cYC11C copy
When using the /S switch, you cannot specify a target that is a
subdirectory of the source. --'
i
Compare error(s) on
I I
Track t, side 5 I
~
f

Your source and target diskettes are not identical. DISKCOMP


found that the data on the track indicated by t and the sector I
indicated by s does not match between the two diskettes. . I
-----J

Content of destlnation lost before copy


I
A file to be used as a source file in the COpy command was ~
overwritten prior to completion of the copy. The following is an
example of a command that gives such an error:
: I
COP Y f i 1 e 1 + f i 1 e 2 f i 1 e 2 [ ENTER I U
Convert lost chains to flIes (YIN)? I

If you press [Y] (for yes) in response to this prompt, CHKDSK ---J
recovers the lost blocks it found' when checking the disk.
CHKDSK creates a directory entry and a file for you with the
filename FILEnnnn.CHK. If you press []] (for no) in response to
this prompt, CHKDSK frees the lost blocks so they can be
reallocated.

298
r-
I I Chapter 14/ Problems and Error Messages

I:
!
Destinatlon disk format error
An error occurred during formatting. The disk may be flawed, or
you may have inserted it in the drive incorrectly.

Dlrectory is joined

n CHKDSK cannot process directories that are joined.

Disk error reading FAT


n
l i
One of your file allocation tables has a defective sector in it. MS-
DOS auto'matically uses the other FAT. To ensure that you do not
lose data, use the COPY command to copy all files to another
disk.

Disk error writing FAT

n One of your file allocation tables has a defective sector in it. MS-
DOS automatically uses the other FAT. To ensure that you do not
lose data, use the COPY command to copy all files to another
disk.

Divide overflow

n The processor has set the divide overflow flag. This is usually
caused by a program attempting to divide by zero.

Does name specify a file name


or directory name on the target
(F = file D = directory)?
The target directory does not exist.

Drive not ready


r The drive was not ready when PRINT attempted a disk access.
I PRINT keeps trying until the drive is ready. Be sure the disk
that contains the file you are printing is in the disk drive.

n Errors found, F parameter not specified.


Correctlons will not be written to disk.
CHKDSK does not write its corrections to disk unless you spec-
ify the IF switch. Specify the IF switch to correct the errors.

n
, '

,-..
I
299
I
Chapter 14/ Problems and Error Messages U

Error writing boot sector to destination u


All floppy disks-both data and system disks-must have a boot , I
sector so that they may be used by the system. The disk is i i
'---'
either defective or needs to be reformatted.

Errors writing to the system cannot continue


Make sure you have a diskette in the drive specified by FOR-
MAT and the drive door is closed. Make sure any write-protect
tab is removed from the diskette to FORMAT. If the error per-
sists, your diskette is unusable. u
EXEC failure I
,
I
!
LJ
MS-DOS either found an error when reading a command, or the
FILES command in the CONFIG.SYS file has the number of
files set too low. Increase the value and restart MS-DOS. , :

U
file canceled by operator
This is a reminder only. You used the IC parameter with PRINT ,
: I
I

to cancel the current file in the print queue. LJ

File cannot be converted ,


The source file is not in the correct format. CS:IP does not meet LJ
either criterion discussed in the EXE2BIN command. CS:IP
meets the .com file criterion but has segment fixups. The file is I i
not a valid executable file. L..:

File cannot be copied onto itself i I


I I
You tried to copy a file to a file that has the same name. Either '--...!
change the -name of your copy, or put it in a different directory
or on a different disk. ,I i
LJ
File creation error
You tried unsuccessfully to add a file to the directory. You either I I
exceeded the files per directory, or the file already exists and is LJ
perhaps a read-only file. Run CHKDSK to determine if some
other condition caused the error.
!
, I
--.J
File not found
The specified file does not exist in the specified directory or the
current directory. Use the DIR command to see which directory
the file is in. Also check the spelling of the filename.

j
300
,-
iI ) Chapter 14/ Problems and Error Messages

,..,
i
filename is cross-linked on cluster
~
This CHKDSK message names each of the two files in error.
,
I
I
. Copy both files, and delete both cross-linked files (the original
files).
n First cluster number is invalid
r entry truncated
This error is corrected automatically by CHKDSK.

Fixups needed - base segment (hex):

,- The source (.exe) file contains information which indicates that a


I load segment is required for the file. Specify the absolute seg-
ment address at which the finished module is to be located.
,.. Has invalid cluster, file truncated
l ' The file contains an invalid pointer to the data area. CHKDSK
corrects this error automatically by truncating the file to the
last valid data block.

Incompatible system size


r: The hidden system files do not take up the same amount of space
\ i on the target disk as the new system requires.

Incorrect DOS version


Many Version 2.x and 3.x utilities cannot run on earlier versions
of MS-DOS. Some utilities run only under the exact version of
MS-DOS for which they were configured.

Insufficient memory

,~ There is not enough available memory to run the command. If


, . you can eliminate some files from memory, try again.

Insufficient room in root dlrectory


II
I . Erase files in root and repeat CHKDSK
The command cannot process until you delete files in the root
r-1
I
directory.
: '

Insufficient disk space


The diskette in the specified drive does not have sufficient room
to complete the operation. Replace the diskette with one having
the required storage space.

301
Chapter 14/ Problems and Error Messages

. I
L;
Intermediate file error during pipe
The pipe operation makes use of temporary files on the disk that
MS-DOS automatically deletes after the piping operation is com-
plete. An error occurred in one of these files.
f •
Invali~ COMMAND.COM I
'-.J
I
Insert COMMAND.COM disk in default drive
and strike any key when ready
The program you just ran uses almost all of memory. MS-DOS
must now reload the COMMAND.COM file from disk. However,
MS-DOS cannot find COMMAND.COM on the disk, or the copy
found is invalid. Insert a disk that contains a copy of COM- I i
MAND.COM similar to the version that is on the disk you used L
to start MS-DOS.
! I
Invalid country code i l
~

The country number you specified in CONFIG.SYS is not valid.


,
,
,I
Invalid current dlrectory L
Processing cannot continue. Restart the system and rerun
CHKDSK.
I
'-'
Invalid date
Enter new date: , ,
Enter a valid date, making sure you use hyphens (-) or slashes !L...-I
(I) to separate the parts of the date.
i !
Invalid dlrectory l.J
The specified directory does not exist on the current or specified
diskette or you have specified an illegal directory name. ,
,
I
I
L~
Invalid drive specificatlon
Use a valid drive specification, making sure you include the I :
colon (:). i I
~

Invalid number of parameters . I


I j
Reenter the command, including the correct number of
parameters.
.
I
,
I
Invalid parameter , !

You specified a parameter that does not exist. Check the com-
mand syntax in this manual. , 1
, f

302
Chapter 14/ Problems and Error Messages

Invalid path, not dlrectory,


or directory not empty
,--:
An attempt to remove a directory failed. The directory might not
exist, or it might not be empty. A directory must be empty
before you can remove it.
l'
Invalid time
Enter new time:
Check the command syntax and parameters in this manual.
Then enter a valid time, making sure you use a colon (:) to sep-
arate hours, minutes, and seconds and a period (.) to separate
hundredths of a second.

Label not found


---. The specified label does not exist in the batch file.

List output is not assigned to a device


Jhe device specified as the PRINT output device is invalid.

x lost clusters found in y chains


;-, Convert lost chains to files (YIN)?
If you type Y I ENTER I, CHKDSK creates a directory entry and a
file in which you can resolve this problem (files created by
CHKDSK are named FILEnnnn.CHK). CHKDSK displays: X
bytes disk space freed. If you have not specified the IF switch,
CHKDSK frees the clusters and displays: X by t e s d 1 S k spa c e
would be freed.

Memory allocation error.


Cannot load MS-DOS, system halted
Restart MS-DOS. If the error persists, use a new copy of the MS-
DOS system diskette.

No files match pathname


The files you tried to add to the queue do not exist.

No free file handles.


Cannot start COMMAND.COM, eXlting
Restart MS-DOS. If the message persists, increase the value
given for FILES in the CONFIG.SYS file.

r-'
,
303
Chapter 14/ Problems and Error Messages

No room for system on destination disk


If the target disk contains files you don't need, use the ERASE
command to delete as many as necessary to make room for the
system. Otherwise, use a different disk as the target.

Out of environment space


There is not enough room in the program environment to accept
more data. You can use COMMAND with the IE switch to
increase the size of the environment.

Path too long


The pathname you specified is too long. You might have to
change to a lower subdirectory to replace files in deep
subdirectories.

PRINT gueue is empty


There are no files in the print queue.

PRINT gueue is full


The queue can contain no more than ten files.
I •

Probable non-DOS disk


Continue (YIN)?
You are not using an MS-DOS disk. Type Y (ENTER I to continue
processing or N I ENTER I to stop processing.

Read error in pathname


FC could not read the entire file.

Sector size too large in file (filename)


The specified device driver loaded by CONFIG.SYS uses a sector
size larger than that of any other device driver on the system.
You cannot run this device driver.

Specified MS-DOS search directory bad


The SHELL command in the CONFIG.SYS file is incorrect.
Either COMMAND.COM is not in the place you indicated, or
that place does not exist.

Syntax error
Reenter the command, using the proper syntax.
I !
304
Chapter 14/ Problems and Error Messages

Unable to create a directory


MS-DOS cannot create the directory you specified. There might
be a name conflict (you have another file with the same name),
or the disk might be full.

Unrecoverable error in directory


Convert directory to file (YIN)?
If you type Y I ENTER I, CHKDSK converts the bad directory into a
file. You can then fix the directory or delete it. If you type N
I ENTER I, the directory becomes unusable, and you can neither fix
nor delete it. You should always type Y I ENTER I.

Use HFORMAT to format hard disks


You are trying to use the 2.11 FORMAT command to format a
hard disk. Use HFORMAT instead.

Warning-directory full
The disk does not contain enough directory space to recover more
files. Copy some files to another disk, then erase the originals.
Run RECOVER again.

WARNING -Read error on EXE flle


The amount read was less than size in header. This is a warning
message only.

EDLIN Error Messages


When you enter an invalid EDLIN command or fail to follow the
proper syntax, EDLIN displays one of the following error
messages:
Cannot edlt .BAK flle rename file
You are trying to edit a file with an extension of .bak. You can-
not do so because EDLIN reserves the .bak extension for backup
copies.
If you need the .bak file for editing purposes, you must either
RENAME the file with a different extension or COpy it, giving
it a different extension.

305
Chapter 14/ Problems and Error Messages

Disk full _ write not completed


You entered the End command, but the disk does not contain
enough free space for the whole file. EDLIN terminated the End
command and returned you to the operating system. Some of the
file may have been written to the disk.
, .
Only part (if any) of the file is saved. Delete that part of the file
and restart the editing session. The file is not available after
this error. Before you begin any editing session, be sure the disk 1 ;
has sufficient free space for the file.

Entry Error
The last command typed contained a syntax error. Reenter the
command, using the correct syntax.

File Creation Error


The EDLIN temporary file cannot be created.
Verify that the directory has enough space to create the tempo- I

rary file. Also be sure that the file does not have the same name I~

as a subdirectory in the directory where the file to be edited is


located.

File name must be specified


You did not specify a filename when you started EDLIN. Specify
a filename whenever you start EDLIN.

File not found


The filename specified during a Transfer command was not
found. Specify a valid filename when issuing a Transfer
command.

Insufficlent memory
There is not enough memory to run EDLIN.
Free some memory by writing files to disk or by deleting files
before restarting EDLIN. Use the Write command and then the
Append command.

Invalid drive name or file


You specified an illegal drive or filename when you started ,
EDLIN. Specify a legal drive or filename. '--

306
Chapter 14/ Problems and Error Messages

Invalid Parameter
You specified a switch other than /B when starting EDLIN.
Specify the /B switch when you start EDLIN.

Line too long


During a Replace command, the string given as the replacement
caused the line to expand beyond the limit of 253 characters.
EDLIN terminated the Replace command.
Divide the long line into two lines, and then try the Replace
command again.

, , MU5t 5pecify de5tlnation number


You did not specify a line number in a Copy or a Move command.
Renter the command, including a destination line number.

Not enough room to merge the entire flle


There is not enough room in memory to hold the file during a
Transfer c9mmand.
Free some memory by writing some files to disk or by deleting
some files before you can transfer the file.

No room in dlrectory for flle


You are trying to create a file, but either the file directory is full
or you are specifying and illegal disk drive or filename.
Check the command line that started EDLIN for either an ille-
gal filename or an illegal drive specification. If the command is
no longer on the screen, and if you have not yet typed a new
command, you can recover the command by pressing the Copy
All key, [ill.
If the command line contains no illegal entries, run the
CHKDSK program for the specified disk drive. If the status
report shows that the disk directory is full, remove the disk.
Insert and format a new disk.

307
Chapter 14/ Problems and Error Messages

Linker Error Messages


All messages, except for the warning messages, cause the link
session to end. After you locate and correct a problem, you must -'
restart the linker.
Messages appear in the list file and are displayed, unless you
direct the list file to CON. If you direct the file to CON, the
error messages are suppressed.

Attempt to access data outside of segment bounds,


possibly bad object module
This usually indicates that a bad object file exists.

Bad numerlC parameter


A numeric value is not given as digits.

Cannot open temporary flle


The linker cannot create the file VM. TMP because the disk L.J
directory is full. Insert a new disk. Do not remove the disk that
is to receive the List map file.

Error: dup record too complex


A DUP record in an assembly language module is too complex.
Simplify the DUP record.

Error: fixup offset exceeds field width


An assembly language instruction refers to an address with a
short instruction instead of a long instruction. Edit the assembly
language source and reassemble.

Input flle read error


This usually indicates that a bad object file exists.

Invalld object module


An object module or modules are incorrectly formed or incom-
plete (as when assembly is stopped in the middle).

Symbol defined more than once


The linker found two or more modules that define one symbol
name.

308
Chapter 14/ Problems and Error Messages

Program size or number of segments exceeds capacity


of linker
The total size cannot exceed 384K bytes, and the number of seg-
ments cannot exceed 255.

Requested stack size exceeds 64K


Specify a size less than or equal to 64K bytes with the /STACK
switch.

Segment size exceeds 64K


The addressing system limit is 64K bytes.

Symbol table capacity exceeded


The number or length of the names caused them to exceed the
limit of approximately 25K bytes.

Too many external symbols ln one module


The limit is 256 external symbols per module.

Too many groups


The limit is ten groups.

Too many libraries specified


The limit is eight libraries.

Too many publiC symbols


The limit is 1024 public symbols.

Too many segments or classes


The limit is 21?6 (segments and classes taken together).

Unresolved externals: llst


The external symbols listed have no defining module among the
modules or library files specified.

VM read error
This is a disk error; it is not caused by the linker.

309
Chapter 14/ Problems and Error Messages

Warning: no stack segment


None of the object modules specified contains a statement allo-
cating stack space, but you typed the /STACK switch.

Warning: segment of absolute or unknown type


A bad object module exists or an attempt has been made to link
modules that the linker cannot handle (for example, an absolute
object module).

Write error in tmp file


No disk space remains in which to-expand the VM.TMP file.

Write error on run file


This usually indicates there is not enough disk space for the run
file.

DEBUG Error Messages


---.J •
DEBUG can display any of the following error messages. Each
error ends the DEBUG command under which it occurred, but
does not end DEBUG itself.

BF Error (Bad flag)


The characters entered to alter flag were not allowable flag val-
ues. See the explanation of the Register command for the list of
valid flag entries. .

BP Error (Too many breakpoints)


More than ten breakpoints were included in the Go command.
Retype the Go command again with ten or fewer breakpoints.

BR Error (Bad register)


The Register command has been given an invalid register name.
See the Register command for the list of valid register names.

DF Error (Double flag)


Two values were entered for one flag when using the Register -'
command. You may specify a flag value only once per RF
command.

310
....----,

I !
c ~

'I

---,
I
I
J

........,
I
I
Appendix A

ASCII AND SCAN CODES

The following table lists the keys, in scan code order, and the
ASCII codes generated by each (which depends on the shift sta-
! tus). The entries in the table are:
• SCAN CODE - a value in the range 01H-5AH (hexadec-
imal) that uniquely describes which key is pressed.
• KEYBOARD LEGEND - the physical marking(s) on
the key. If multiple markings exist, they are listed from
top to bottom.
• NORMAL - the normal (unshifted) ASCII value
(returned when only the indicated key is pressed).
~

i • SHIFT - the shifted ASCII value (returned when I SHIFT I


is also pressed).
• CTRL - the control ASCII value (returned when CTRL
is also pressed).
• ALT - the alternate ASCII value (returned when I ALT I is
also pressed).
• REMARK - any remarks or special functions.
All numeric values in the table are expressed in hexadecimal.
Those values preceded by an x are extended ASCII codes (they
are preceded by an ASCII NUL [= 00]).
A marking of - indicates that no ASCII code is generated. Dou-
ble asterisks (**) indicate that no ASCII code is generated and
that, instead, the special function described in the REMARK
l _ column is performed.

311
, !
Appendix A / ASCII and Scan Codes
., Appendix A / ASCII and Scan Codes

,.......,
;
SCAN KEYBOARD ASCII CODES
CODE LEGEND NORMAL SHIFT CTRL ALT REMARK

35 / ? 02F 03F
36 RIGHT * SHIFT
SHIFT
37 PRINT * * X072 X046 print screen
~

i SCREEN
! 38 ALT * alternate mode
39 SPACE BAR 020 020 020 x020
3A CAPS LOCK * caps lock
3B Fl X03B X054 X05E X068
3C F2 X03C X055 X05F X069
3D F3 X03D X056 X060 X06A
3E F4 X03E X057 X061 X06B
3F F5 X03F X058 X062 X06C
40 F6 X040 X059 X063 X06D
41 F7 X041 X05A X064 X06E
42 F8 X042 X05B X065 X06F
43 F9 X043 X05C X066 X070
44 FlO X044 X05D X067 X071
45 NUMLOCK * number lock
46 HOLD * * * * freeze display
-, 47 7 \ 037 05C X093 t
48 8 - 038 07E X094 t
~
49 9 pGUP 039 X049 X084 I

4A X050 X086 X096 X097


.--. 034 X095
I 4B 41 07C
I 4C 5 035 t
4D 6 036 t
4E X04D X088 074
~
I 4F END 1 031 X04F X075
! 50 2 032 060 X09A t
51 3 PGDN 033 X051 X076 t
52 0 030 X09B X09C t
I" 53 - DELTE 02D X053 X09D X09E
I
54 BREAK 000 000 * X400 control break
routine (lNT
lBH)
I' 55 + INSERT 02B 052 X09F XOAO
" -'
56 02E XOAI XOA4 XOA5 (numeric
keypad)
57 ENTER OOD OOD OOA X08F (numeric
r- keypad)
58 HOME X047 X04A X077 XOA6
59 Fll X098 XOA2 XOAC XOB6
5A F12 X099 XOA3 XOAD XOB7
r-
I
, .
* Indicates special functions performed

r-

313
Appendix A / ASCII and Scan Codes I i
~

,
, '
means this key combination is suppressed in the keyboard
driver
X values preceded by X are extended ASCII codes (codes pre-
ceded by an ASCII NUL)
t The I ALI I key provides a way to generate the ASCII codes of
decimal numbers between 1 and 255. Hold down the I ALI I ~
i

key while you type on the numeric keypad any decimal


number between 1 and 255. When you release ALT, the
ASCII code of the number typed is generated and displayed.

Note: When the NUM LOCK light is off, the Normal


: J
and SHIFT columns for these keys should be reversed.

ASCII Character Codes I ,

The ASCII and Scan Codes table listed the ASCII codes (in
hexadecimal) generated by each key. This table lists the charac-
,
ters generated by those ASCII codes. , '

Note: All ASCII codes in this table are expressed in


decimal form.

You can display the characters listed by doing either of the


following:
• Using the BASIC statement PRINT CHR$(code), where code is
the ASCII code.
• Pressing I ALI I and, without releasing it, typing the ASCII code
on the numeric keypad.
For Codes 0-31, the table also lists the standard interpreta- , \,
tions. The interpretations are usually used for control func-
tions or communications.

Note: The BASIC program editor has its own special


interpretation of some codes and may not display the
character listed.
1
I '
I

, ,I

314
- - - - - - ---- - - - ~ -

r--"'

Appendix A / ASCII and Scan Codes

ASCIII CHARACTER CODES


Chr Dec Hex Chr Dec Hex
NUL 000 OOH Space 032 20H
OH 001 OlH ! 033 2lH
~
STX 002 02H " 034 22H
ETX 003 03H # 035 ' 23H
EOT 004 04H $ 036 24H
ENQ 005 05H % 037 25H
- ACK 006 06H & 038 26H
BEL 007 07H 039 27H
BS 008 08H ( 040 28H
HT 009 09H ) 041 29H
LF 010 OAH * 042 2A
VT 011 OBH + 043 2B
FF 012 OCH 044 2C
CR 013 ODH 045 2D
SO 014 OEH 046 J2E
81 015 OFH / 047 2F
-
;
. I
DLE 016 10H 0 048 30H
DCl 017 llH 1 049 31H
DC2 018 12H 2 050 32H
r--
DC3 019 l3H 3 051 33H
DC4 020 14H 4 052 34H
NAK 021 15H 5 053 35H
SYN 022 16H 6 054 36H
ETB 023 17H 7 055 37H
CAN 024 18 8 056 38H
EM 025 H19H 9 057 39H
SUB 026 1AH 058 3AH
ESCAPE 027 lBH , 059 3BH
---,
FS 028 1CH < 060 3CH
GS 029 1DH 061 3DH
RS 030 1EH > 062 3EH
US 031 1FH ? 063 3FH
~

~-

( -

315
Appendix A / ASCII and Scan Codes

Chr Dec Hex Chr Dec Hex I

@ 064 40H 096 60H ,


A 065 41H a 097 61H
"

i
~\
B 066 42H b 098 62H
C 067 43H c 099 63H
D 068 44H d 100 64H
E 069 45H e 101 65H ~

F 070 46H f 102 66H


G 071 47H g 103 67H
H 072 48H h 104 68H ---.,;
I 073 49H 105 69H
J 074 41H j 106 6AH
!
K 075 4BH k 107 6BH
---'
L 076 4CH 1 108 6CH
M 077 4DH m 109 6DH
N 078 4EH n 110 6EH
0 079 4FH a 111 6FH '--'"
P 080 50H p 112 70H
Q 081 51H q 113 71H
R 082 52H r 114 72H ~

S 083 53H s 115 73H


T 084 54H t 116 74H
U 085 55H u 117 75H ~
V 086 56H v 118 76H
W 087 57H w 119 77H
X 088 58H x 120 78H
Y 089 59H y 121 79H ~

Z 090 5AH z 122 7AH


[ 091 5BH { 123 7BH
\ 092 5CH I 124 7CH L.-.

.
] 093
094
5DH
5EH
} 125
126
7DH
7EH
095 5FH DEL 127 7FH i I

'--'
DEC = decimal, HexadecimalCH), CHR = character,
LF = Line Feed, FF = Form Feed, CR = Carriage Return,
DEL = Rub out

, ,
I
~

-----:

316
-- - -- - - - - - --

,-,
Appendix A / ASCII and Scan Codes

ASCII CHARACTER CODES


ASCII Control
Code Character Character

000 (null) NUL


,...-.
, 001 © SOH
002 e STX

,
,
003
004
•• ETX
EaT

••
005 ENQ
006 ACK
007 (beep) BEL
008 a BS
009 (tab) HT
010 (line feed) LF
011 (home) VT
012 (form feed) FF
013 (carriage return) CR
014 n SO
015
016
017
.
p-

....
SI
DLE
DC1
018 DC2
-~
, 019
020
021
,
!!

§
DC3
DC4
NAK
022 SYN
023 -.1. ETB
024 t CAN
;--;
025 ~ EM
i
026 SUB
027 ESC
028 (cursor right) FS
029 (cursor left) GS
030 (cursor up) RS
031 (cursor down) US

317
Appendix A / ASCII and Scan Codes

,
~

ASCII CHARACTER CODES


ASCII ASCII
Code Character Code Character '---'

032 (space) 069 E


033 I 070 F
034 071 G
035 #= 072 H
036 $ 073 I
L....
037 % 074 J
038 & 075 K
039 076 L
~

040 077 M
041 078 N
042 079 0
043 + 080 P
044 081 Q
045 082 R
~

046 083 S
047 / 084 T
048 0 085 U
049 1 086 V
050 2 087 W
051 3 088 X
052 4 089 Y
053 5 090 'z
054 6 091 [
055 7 092 \ -
056 8 093 1
057 9 094 II :
,-J
058 095
059 096
060 < 097 a
061 = 098 b
062 > 099 c
063' ? 100 d
064 @ 101 e
065 A 102 f
066 B 103 9 ~

067 C 104 h
068 D 105

318
Appendix A / ASCII and Scan Codes

ASCII CHARACTER CODES


ASCII ASCII
Code Character Code Character

106 j 143 A
, 107 k 144 E
~ -
108 I 145 ill
109 m 146 ~
110 n 147 0
111 0 148 0
112 P 149 0
113 q 150 A
u
'.
114 151 U
115 s 152 y
116 153 0
117 u 154 0
118 v 155 4:
119 w 156 £
120 x 157 l
,.-.>.
121 Y 158 Pt
122 z 159 f
123 160 a
124 161
125 162 6
126 163 U
127 0 164 n
128 C 165 N
129 U 166 ~
130 e 167 Q
~

.'
131 a 168 i
132 a 169 r-
133 a 170 --,
134 a• 171 V2
135 lf 172 V~
136 e" 173 i
137 e 174 «
)
138 e 175
139
140 I
I 176
177
.,.~~
141 178 ~
142 A 179 I

319
Appendix A / ASCII and Scan Codes

:~
ASCII CHARACTER CODES
ASCII ASCII
Code Character Code Character <....-J

180 ---1 218

-•
r
181 9 219
182 -11 220
183 -" 221 I

- I
184 ={
222
185 ~I 223
186 224 a
187 =;] 225 (3
188 ,:) 226 r
189 ...lJ 227 n
190 :d 228 r
191 ...., 229 a
192 L 230 1.1
193 -L 231 T

194 I 232 ~ ~

195 233 Q
~
196 234 fl
197 + 235 cl LJ
198 f= 236 00

199 I~ 237 0 I
I
200 lh 238 ( ----'

201 rr= 239 n


202 db 240 -
203 'if 241 ± ----'
204 I~ 242 ~
205 243 ~
.JL :
206 ,r 244 r ~

207 d: 245 J
208 .JL 246
209 =;= 247 ::::

210 -rr 248 0

211 lL 249 e
,
212 b 250 • ---"
213 F 251 V
214 rr 252 '1
215
. 253 2

216
217
*=F
...J
254
255

(blank 'FF)
!
320
-
Appendix B

CONFIGURING YOUR SYSTEM

To configure your system to accommodate various peripheral


devices, you can create a file named CONFIG.SYS. This is an
,.-,
,, ASCII file of commands that you want MS-DOS to execute on
,
startup. If CONFIG.SYS is present in the root directory of your
system disk, MS-DOS automatically reads the file during start-
up and executes the commands it finds there.
If there is no CONFIG.SYS file on your MS-DOS system disk,
you can use EDLIN to create the file. (See Part 3 for information
I
on creating files with EDLIN.) You can also create a CON-
! \ FIG.SYS file with the COPY command:
copy con conflg.5y5[ENTER!

The cursor blinks as the system waits for you to enter text-in
this case, the CONFIG.SYS commands. Regardless of how you
create the file, press (l[] to end input and to save on disk the
lines you typed. Again, be sure to save CONFIG.SYS in your
system root directory so that MS-DOS can execute it on startup.
Because MS-DOS executes CONFIG.SYS only at startup, MS-
DOS does not recognize new commands in CONFIG.SYS until
you reboot. Therefore, always reboot the computer each time you
add commands to the file.

I
, '

,
, '

321
Appendix B / Configuring YOur System

:-..J
CONFIG.SYS Commands
Here is a summary of the commands you can use in your CON-
FIG.SYS file. Following the summary is 'a detailed explanation of
each command. (See Appendix C for information about the var-
ious device drivers you can install using the DEVICE command.)
Command Purpose

BREAK Sets the I CTRL I []] check.


BUFFERS Sets the number of disk buffers.
COUNTRY Allows for international time, date, and cur-
rency format and characters.
DEVICE Installs a device driver into the system.
Include one DEVICE command for each
driver you install.
DRIVPARM Defines parameters for block devices. , ,

FCBS Specifies the number of FCBs (file control


blocks) that you can open at one time.
FILES Sets the number of open files that can
access certain MS-DOS system calls.
LASTDRIVE Sets the maximum number of drives you
can access.
SHELL Causes MS-DOS to start a command pro-
cessor other than the standard COM-
MAND.COM processor.

322
Appendix B / Configuring Thur System

BREAK
BREAK [switch]
Sets the I GIRL I W check. Switch can be ON or OFF.
,, ,
Normally, MS-DOS checks for [GIRL I W only while writing to the
screen or printer, reading from the keyboard, or performing
asynchronous communications. Therefore, you cannot stop execu-
tion of a program unless it is performing one of those functions.
Setting BREAK to ON lets you extend the I GIRL I W check to
other functions, such as disk reads and writes. Setting BREAK
,I '
, to OFF re-establishes the system default (OFF).

Example:
break=on
extends the I GTRL I W check.
, ,
,

BUFFERS
BUFFERS = number
Lets you set the number of disk buffers that MS-DOS allocates
in memory at the time you start the system.
A disk buffer is a block of memory in which MS-DOS temporar-
ily stores data during disk input/output operations whenever the
amount of data read or written is not an exact multiple of the
sector size. Buffers are 512 bytes long, and the default number of
buffers is two.
Increasing the number of buffers can increase the speed of oper-
ations, as data still resident in the buffers can be read without
additional disk drive access. (The greater the number of buffers,
the greater the block of data available in memory.) If you cl'eate
many subdirectories, you can increase efficiency by using a num-
ber in the range 20 to 30. For application programs such as word
processors, you might find that a number in the range 10 to 20
provides the best performance. Experiment to find the ideal num-
ber to use, or consult your application program manual for the
requirements of a specific program. The maximum number of
buffers allowed is 99.

323
Appendix B / Configuring YOur System

Example:
buffers=10
sets the number of disk buffers to 10.

COUNTRY
I ~ 1 COUNTRY = country code
Enables MS-DOS to use the date and time format and to pro-
duce the currency symmbols for any of several countries.
The following table lists the valid country codes. The default is
001 (for the United States). ,
!
.
I

~
Country Code Country Code
Australia 061 Middle East 785
Belgium 032 Netherlands 031
French Canada 002 Norway 047
Denmark 045 Portugal 351
Finland 358 Spain 034 ,
.-J
France 033 Sweden 046
Germany 049 Switzerland 041
Italy 039 United Kingdom 044
Israel 972 United States 001

Example:
country=033
sets the country code to 033 (France).

DEVICE
DEVICE = pathname
: I

Installs the device driver specified by pathname into the system


list of drivers.

324
Appendix B I Configuring Your System

Your system is designed to provide a number of standard screen,


keyboard, printer, and disk drive functions without special
instructions. By specifying device drivers, you can also enable it
to perform a wide range of non-standard functions with various
peripheral devices (including printers, modems, and monitors).
For example, you can enable it to use external drives by install-
ing the DRIVERSYS device driver.
DRIVERSYS is only one of several device drivers already writ-
I : ten for you and provided on your MS-DOS system diskette or
Supplemental Programs diskette.
The DEVICE command tells MS-DOS to load a particular device
I
! I driver automatically whenever you start the system. For each
driver you want to install, you need to include one DEVICE com-
mand in your CONFIG.SYS file. See Appendix C. for more infor-
i ' mation on the device driver commands. If you have written your
own device drivers, you can include DEVICE commands for
them, also.

Example:
device=b:hdrive.5Y5
~
! ,
installs HDRIVE.8YS (the driver that lets you use non-standard
hard disks with your system) from the root directory of the
diskette in Drive B.
Note: Because MS-DOS installs the driver each time
you start up the system, place the driver on the cur-
.
I
, rent system disk. Then, you don't have to specify (in
the DEVICE command) where to look for the driver.

!
! ,

DRIVPARM
;-'.
: '
~ 1 DRIVPARM = ID:n [Ie] [IF:n] [lH:n] [IN] [lS:n]
9 [IT]

Lets you define parameters for block devices when you start MS-
DOS, overriding the original MS-DOS device driver settings.

,
I I
'
ID:n specifies a logical drive number. n can be in the range
255. Drive A == 0, Drive B == 1, Drive C == 2, and so on.
°to

IC specified that changeline (doorlock) support is required.

325
Appendix B / Configuring Thur System

• I

IF:n specifies the form factor index. n can be:


o= 320/360K floppy
1 = 1.2 M floppy
2 = 720K floppy (3lf2-inch drive)
3 = 8-inch single-density floppy
4 = 8-inch double-density floppy
5 = hard disk
6 = tape drive
7 = other
If you omit IF, DRIVPARM uses a default of 2 (720K).
IH:n specifies the maximum head number. n is a value in the
range 1 to 99.
IN tells MS-DOS that the device is non-removable.
IS:n specifies the number of sectors per track. n is a value in the
range 1 to 99.
IT:n specifies the number of tracks per side. n is a value in the
range 1 to 999.

Example:
You might have a computer with an internal tape drive unit on
Drive D that is configured at boot time to write 20 tracks of 40 , -,
sectors per track. If you want to reconfigure this tape drive to
write 10 tracks of 99 sectors each, you can put the following line
in your CONFIG.SYS file:
drivparm=/d:3 /f:6 /h:1 /5:99 /t:10

This overrides the default device driver settings, and supports a


tape drive as Drive D. (In this case, the logical and physical
drive numbers are identical.) This tape drive has one head, and
supports a format of 10 tracks and 99 sectors per track (assum-
ing that the device driver for the tape drive also supports this
configuration). You might want to use this method to create a
tape that you can read on another computer that reads only this
format. I I

DRIVPARM=/D:1 /F:2
or ! '

DRIVPARM=/D:1

326
,---.
I
Appendix B / Configuring }Our System

Defines Drive B as a 3lfz-inch floppy disk drive. Note that you


can omit the IF parameter, which defaults to 2 for a 3lfz-inch
drive.

.-
I FCBS
I ~ 1 FeBS nl,n2
Sets the number of files opened by file control blocks that can be
opened at anyone time, and lets you specify a number of these
to protect from inadvertent closure.
nl specifies the number of files opened by FCBs that can be
opened at anyone time. nl can be in the range 0 to 255. The
r,---,
, default value is 4.
n2 specifies the number of files opened by FCBs that MS-DOS I
cannot close automatically if an application tries to open morE(
than nl files by FCB. This option protects the first n2 files
opened by FCBs from being closed. n2 can be in the range 0 to
255. The default value is O.
i I
Example:
fcbs=4,2
specifies that four files can be open, and protects two files.

! !
t ,
FILES
,
,'--'
FILES = number
\ '

Sets the maximum number of files that MS-DOS can access at


one time. The default is ten files. Allocating more files than
required by your system or application decreases available
memory.
r--"'
i, :! number is the number of open files that the system calls can
access. (System calls in the range 2FH to 60H are compatible
with the XENIX operating system,) The maximum number is
99.

327
Appendix B / Configuring }bur System

Example:
r '
! :
sets the number of accessible open file handles to 20.

LASTDRIVE
I CifJ 1 LASTDRIVE = drive
Sets the last valid drive designation that MS-DOS accepts. This
command is only useful in a network environment.
drive is the logical drive specification of the last valid drive. It is
a letter in the range A to Z. Note that you do not place a colon
following the drive letter. The default value is E.
At startup, MS-DOS recognizes five drive letters, A-E, regard-
less of the number of physical drives you have on your system. A
network redirection must occur to make any of the extra drives
defined by LASTDRIVE valid.
MS-DOS allocates a data structure for each drive you specify.
Therefore, do not specify more than necessary.

Example: \ :

lastdrive=m
, '
sets the last drive to Drive M, unless you have added an exter- I •

nal logical device with the device driver DRIVER.SYS. MS-DOS


now recognizes Drives A through M. (See Appendix C, "Installa-
ble Device Drivers," for more information on DRIVER.SYS.)

SHELL
SHELL = pathname
Causes MS-DOS to start a command processor other than the
standard COMMAND.COM processor.
This command is intended for system programmers who write , ,
'-..-J
their own top-level command processor.

328
iI _ : Appendix B / Configuring YOur System

pathname specifies the command processor to substitute as the


top-level processor.

Example:
5hell=\bln\command.com /e:3~~~ a:\bin /p
f !
uses the COMMAND.COM shell in the \ BIN directory with an
environment size of 3000 bytes.
I i
I
Sample CONFIG.SYS File
A typical CONFIG.8YS file might look like this:
buffer5=1~
file5=12
device=\bin\network.5Y5
break=on
5hell=a:\bln\command.com /e:3~~~ a:\bin /p
la5tdrive=e

This file sets the number of disk buffers to 10 and the maximum
number of open files to 12. It also tells MS-DOS to search for the
pathname \ BIN \ NETWORK to find the device you are adding
to the system. The file is usually supplied on disk with your
device. Be sure you save the device file in the directory that you
specify with the DEVICE command.
The file also sets the MS-DOS command EXEC to the COM-
MAND.COM file located on disk in Drive A in the \BIN direc-
r-
,
I
I
, tory. The IE switch sets the size of the environment to 3000
I
bytes. The A:\BIN tells COMMAND.COM where to look for
itself when it needs to be reread from disk. The IP switch tells
I i
COMMAND.COM that it is the first program running on the
system so that it can process the MS-DOS EXIT command. (See
COMMAND in Part 2 for more information on the command
processor.)
The last logical drive on the system is Drive E, unless you have
added an external logical device, using DRIVER.SYS. (See
Appendix C for more information on DRIVERSYS.)

i .

329
Appendix B / Configuring }Our System

Changing CONFIG.SYS
If CONFIG.8YS is already on your diskette, before creating a
new file be sure it does not contain data you want. To read an
existing file, type:
t y P e con fig. s Ys I ENTER I i I

CONFIG.SYS is listed to the screen. If you wish to create a new


CONFIG.8YS file, but want to be able to re-establish the same
configuration later, rename the existing CONFIG.8YS file. For
example, type:
ren config.sys config.old [ENTER I
You now have a file named CONFIG.OLD on your diskette. You
can later change the name back to CONFIG.SYS to re-establish
the same configuration. To do so, first delete or rename the cur-
rent CONFIG.8YS file, then type:
r e nco n fig. old t 0 con fig. s Ys I ENTER I
To expand an existing CONFIG.8YS file to add a new device
driver, you might type:
cop y con fig . s Y s + con I ENTER I
device=myprint .prt I ENTER I
IT[] I ENTER I
The command DEVICE = MYPRINT is appended to the current
CONFIG.SYS file.
To create a totally new CONFIG.SYS file with 20 buffers, ! .
L......J
BREAK set to ON, and a new printer driver, you might type:
cop y con con fig . s Ys I ENTER I
buff e r s = 2 0 [ENTER I
b rea k = 0 n [ ENTER I
devlce = myprint .prt I ENTER I
IT[] I ENTER I
You can create a new CONFIG.8YS file at anytime with such a
procedure. The new file you create overwrites any old CON-
FIG.SYS file. Be sure the CONFIG.8YS file you create is in the
root directory.
, .
See the COPY command in Chapter 6 and Chapter 4, "Batch
Files," for more information on using COPY and CON.

'---"
330
Appendix C

INSTALLABLE DEVICE DRIVERS


i :

n
. , Your MS-DOS system can use several device drivers. A device
driver is a program that controls external devices or executes
other programs. The Version 2.11 MS-DOS device drivers are
included on the MS-DOS/BASIC system diskette. Version 2.11
drivers are: ANSI.SYS, KEYCNVRT.SYS, LPDRVR.SYS,
.--
, , SPOOLERSYS, and VDISKSYS. In Version 3.2 MS-DOS, both
the MS-DOS/BASIC system diskette and the Supplemental Pro-
grams diskette contain device drivers. Version 3.2 drivers are:
ANSI.SYS, DRIVERSYS, KEYCNVRT.SYS, LPDRVRSYS,
,r:
l I
MLPART.SYS, SPOOLERSYS, and VDISKSYS.
Device Driver Purpose
~
ANSI.SYS Provides programmers with many extended
I ! screen and keyboard features, such as the
ability to change graphics functions.
n
, >
DRIVERSYS Enables your system to support more than
two floppy disk drives and more than two
hard disk drives. Also, DRIVERSYS lets
you assign more than one logical drive let-
ter to a single drive.
r--"1
KEYCNVRT.SYS Converts certain keyboard characters for
i
I
;
_'
application software compatibility.
LPDRVRSYS Lets you configure your system to take full
,-, advantage of your printer's capabilities.
i ;
MLPART.8YS Lets you access multiple MS-DOS partitions
on a hard disk drive.
SPOOLERSYS Lets you continue processing data while
printing.
VDISK.SYS Lets you establish a virtual disk drive in
RAM.
,.,
, I

331
Appendix C / Installable Device Drivers

, ,
LJ
ANSI.SYS
(For Extended Screen and Keyboard Control)
ANSI.SYS is a loadable driver that provides programmers with
many extended screen and keyboard features. With it installed,
you can change graphics functions, move the cursor, and f 1
reassign the meaning of any key on the keyboard by issuing spe- U
cial character sequences from within your program. These
sequences are valid only when issued through MS-DOS function
calls 1, 2, 6, and 9. For more information, see your MS-DOS Pro-
grammer's Reference Manual.
Include the following command in your CONFIG.SYS file to
install the ANSI.SYS driver:
DEVICE =ANSI.SYS
I !

I @o j (For
DRIVER.SYS
Additional Disk Drives)
DRIVERSYS is an installable device driver that enables your
system to support more than two floppy disk drives and more
than two hard disk drives.
In addition, DRIVERSYS lets you assign more than one logical
drive letter to a single drive.
i I
To install the DRIVERSYS driver, include a DEVICE command
in your CONFIG.SYS file, using this format:
DEVICE =DRIVER.SYS /D:n [lC] [/F:n] [lH:n] [IN] [lS:n]
[/T:n]
where: f '
! I

/D:n specifies the physical drive number in the range 0 to 255.


Floppy drives are numbered starting at 0, and hard disk drives
are numbered starting at hexadecimal 80. For example, if you i

have a computer with two floppy disk drives, the drives are num- ~
bered 0 and 1. If you add another floppy disk drive, its physical
drive number is hexadecimal 02. (The first external floppy drive .- ,
is always hexadecimal 02.) ~
If you have one floppy disk drive and one hard disk drive, the
floppy disk drive is hexadecimal 00, and the hard disk drive is i'
hexadecimal 80. '--J

I ,
1
'--J

332
Appendix C / Installable Device Drivers

IC specifies that changeline (doorlock) support is required. This


is a hardware feature that lets the software know if the drive
!' door is open.
IF:n specifies the form factor index, where n can be:
o= 320/360K floppy
1 = 1.2M floppy
2 = 720K floppy (3lfz-inch drive)
3 = 8-inch single-density floppy
4 = 8-inch double-density floppy
5 = hard disk
6 = tape drive
7 = other
If you omit IF, DRIVER.SYS uses a default of 2 (720K).
IH:n specifies the maximum head number. n is a value in the
range 1 to 99.
IN tells MS-DOS that the device is non-removable.
IS:n specifies the number of sectors per track. n is a value in the
range 1 to 99.
IT:n specifies the number of tracks per side. n is a value in the
range 1 to 999.

KEYCNVRT.SYS
(For Key Conversion)
KEYCNVRT.8YS lets you generate keyboard characters other
than Tandy scan codes. This driver is for application software
compatibility.
Include the following DEVICE command in your CONFIG.SYS
file to install the KEYCNVRT.SYS driver:
DEVICE = KEYCNVRT.SYS

333
Appendix C I Installable Device Drivers

Whenever you boot the system, KEYCNVRT.SYS converts the


following keyboard codes:
) i
Tandy Scan
Key ASCII Code Converted Te
Slash (I) 475C 2B5C . ,
Vert. Line (I) 4B7C 2B7C '----'
I

Tilde n 487E 297E


Single Left quote (') 5060 2960
minus ( - ) (DELETE NUMLOCK) 532D 4A2D
plus ( + ) (INSERT NUMLOCK) 552B 4E2B

i '
LPDRVR.SYS
(For Extended Printer Capabilities)
The loadable printer driver extends the useable capabilities of a
Tandy printer. The functions of LPDRVR are:
• Set the number of lines per page
• Set vertical tabs
• Set the form feed function
• Set horizontal tabs
• Tab horizontally
• Set the skip perforation function
• Cancel the skip perforation function
• Ignore the next n codes
• Reset the printer driver
• Convert a single code into a series of printer codes
• Repeat n characters ,
• Suppress the line feed function '--

Include this DEVICE command in your CONFIG.8YS file to


install the printer driver:
DEVICE =LPDRVR.SYS
Next, look up the function's control code sequence in the Printer
Control Codes table in this section. Then find the equivalent
ASCII code(s) in the ASCII Character Code table in Appendix A.
For example, the control code needed to set lines per page is
ESCAPE C;n. The ASCII equivalent of ESCAPE is 27. The
ASCII equivalent of C is 67. n is the number of lines. ! '

Finally, send the control code sequence, in ASCII form, to the


printer driver. You can do this in any of three ways.

334
Appendix C / Installable Device Drivers

• Use BASIC's LPRINT statement with the CHR$ func-


tion, as described in the BASIC Reference Manual.
• Make an MS-DOS function call, as described in the
MS-DOS Programmer's Reference Manual.
• Make a BIOS call, as described in the MS-DOS Pro-
grammer's Reference Manual.

Example:
This example uses BASIC to set the number of lines per page to
55:
Iprint chr${27>;chr${67>;chr${SS> I ENTER I
CHR$(27) sends the ESCAPE, CHR$(67) sends the C, and
;- CHR$(55) sends the number of lines.
. !

Printer Control Codes


:-1
, Function Code Result
,
Set lines per page ESCAPE C;n; Sets the page length to n
lines. n is a number in
the range 1-127. Issue
this command before
, . setting vertical tabs or
i form feed.
Set horizontal ESCAPE D;nI;n2 Sets horizontal tab stops
tabs n3;... nk;NUL; at nI, n2, n3 and so on.
i : The numbers can be in
the range 1-80 in regular
print mode or the range
1-132 in compressed print
mode. When the printer
is turned on, the tab
stops are automatically
set to every eight
columns. Use ESCAPE D
to change them.

335
Appendix C / Installable Device Drivers

Function Code Result


Set vertical tabs ESCAPE Sets vertical tab stops to,
,...:...---..
B;ni;n2; ni, n2, n3, and so on.
n3;... nk;NUL; The numbers can be in
the range 1-64. When the ,
printer is turned on, no ~

tab stops are set, and the


printer advances
according to line feeds. ~

Use ESCAPE B to set the


tabs.
Horizontal Tab HT Tabs to the next ~

horizontal tab stop.


Vertical Tab VT Tabs down to the next
vertical tab stop.
Advance to top of FF Advances paper to the
:
page (form feed) next top of page. When '~

the printer is turned on,


the top of page is
automatically set to 66
lines from the printer
position. To change the
number of lines per page
use ESCAPE C.
Skip perforation ESCAPE N;n; Sets the number of lines
to skip after printing
each page to n. n is the
number each time you
change page length.
~

Cancel skip ESCAPE 0 Cancels ESCAPE N.


perforation
Set 132 S1 Turns on the compressed
characters per character mode.
line
Set 80 characters DC2 Turns off the compressed -
per line character mode.
'---.i

336
Appendix C I Installable Device Drivers

r--"

Function Code Result


Pass n codes ESCAPE Yin;
directly to the
printer
Reset (cancel) CAN or DEL Resets all counters and
driver tab stops to their default
values.
: '
Suppress line feed ESCAPE Y:n If n is 0, the line feed
after carriage suppression is turned off.
return If n is any number
greater than 0, the line
feed suppression is turned
on.

Converting Printer Code


LPDRVR also lets you convert any printer code to any other code
before it is sent to the printer. It does this by maintaining a 256-
byte table called a character translation table.
Initially code is translated to its original form but, by making
changes to the table, you can set any code to be converted. To
obtain the memory address of the code in the table, make the
necessary BIOS call from an assembly-language program as
follows:
1. Set the AH register to 3.
2. Execute an INT 17H instruction.
The pointer at the beginning of the character translation table is
r -,
returned in the ES:BX registers. Each code is offset from the
memory location pointed to by ES:BX by its ASCII value. OFFH
in the table indicates printer code OFFH or indicates that a
string translation is defined for that character. OFFH can then
be changed to redefine the character.
LPDRVR also lets you convert any printer code into a string of
as many as eight codes before it is sent to the printer. You can
define as many as 50 different replacement strings. This is done
by sending the following escape code and code sequence to the
printer driver:
esc wn code; string

337
Appendix C / Installable Device Drivers

where n is the length of the string that replaces the original


code plus one. code is the original code. string is the list of
replacement characters.
The MODE command supports some commonly used character
set translations. For example, to enter the code to translate a
175 code to the characters "»," type the following from BASIC:
1Pr in t c h r $( 27> ; "W" ; c h r $( 3 >; c h r $( 175> ; ,,) )" ;
Now, whenever you type:
lprint chr$(175);
the characters » are printed. If the printed replacement string
is wider than one character, horizontal tabs on the remainder of
the printed line will be incorrect.

1
8o 1 MLPART.SYS
(For Multiple DOS Partitions)
MLPART.SYS is an installable device driver that lets your com-
puter access multiple, non-bootable (DOS2) partitions on a hard
disk drive. To create these partitions, you use the MLPART.COM
command. (See "MLPART" in Part 2 of this manual.) ,
~
,

The purpose of MLPART.SYS is to let you take advantage of all


the space on a hard disk that has 32 or more megabytes of stor-
age. The bootable (DOS) partition must begin and end in the
first 32 megabytes of the hard disk.
Before installing the device driver, create the DOS2 partitions,
using the MLPART command.
To install the MLPART.SYS device driver, include a DEVICE
command in your CONFIG.SYS file, using this format:
=
DEVICE MLPART.SYS drive specifications
where drive specifications is a list of the physical drive letters of
the hard disks containing DOS partitions.
For example, if you have only one DOS2 partition on Drive C,
you use the line:
deVice=mlpart.sys c:

338
Appendix C / Installable Device Drivers

If you have three DOS2 partitions on Drive C and one on Drive


D, you can use:
device=mlpart.sys c: c: d: c:

MLPART assigns each DOS2 partition a logical drive letter, and


tells you the letters. In doing this, it adheres to the order in
which you created the DOS2 partitions. Therefore, in the pre-
vious example, if no other block devices exist, the DOS2 logical
drives are E, F, and H on Drive C and G on Drive D.
Install the device driver only once. After you do so, use MLFOR-
MAT to format the partitions according to their logical drive
letters.
J '

SPOOLER.SYS
(For Buffering Data to the Printer)
SPOOLERSYS is a loadable driver that buffers data to the
printer by temporarily placing the data in memory. SPOOLER
spools the data to the printer whenever the printer is available.
In this way, you can continue to use your computer to process
data while printing other data.
To install the printer buffer driver, include a DEVICE command
in your CONFIG.SYS file, using this format:
DEVICE = SPOOLER [lprinter] [size]
where:
...-,
J: /printer is the number of the printer you want to use (lor 2). If
you omit the number, the system assumes you want to use
Printer 1. Notice that you must precede the number with a slash
(I). You can install two spoolers if you have two printers
connected.
size is the size of the buffer in kilobytes. If you omit size, the
system uses 20K.

! ,
;c _

339
Appendix C / Installable Device Drivers

VDISK.SYS '.........J

(For the Virtual Disk)


Accessing information from floppy or hard disk is slow compared
to accessing information from your computer's memory. This is
because of the time it takes for the disk to get up to speed and
for the disk's read/write head to locate the data. Using VDISK,
you can set aside portions of your computers random access mem-
ory (RAM) that simulate disk storage. These areas are called
virtual disks.
The features of VDISK are:
• When you create a virtual disk, the system automatically
assigns it a drive name. If you have only two disk drives -
floppy drives A and B - and you install a virtual disk, the
system gives the virtual disk the name C.
• You can assign volume labels to virtual disks.
• You can select the amount of memory for each virtual disk
to use.
Warning: If you turn off or reset the computer, you
lose the contents of virtual disks. Copy the data to
floppy or hard disk before turning off or resetting your
computer.
To install the virtual disk driver, include a DEVICE command
in your CONFIG.8YS file, using this format:
DEVICE =VDISK.SYS [storage sector-size dir]
storage specifies the size (in kilobytes) for the virtual disk. stor-
age can be in the range of 1 to the capacity of your computer's
memory. The default value is 64K.
If the installation of VDISK leaves fewer than 64 kilobytes free,
VDISK reduces the amount of storage it sets aside.
sector-size is the sector size (in bytes) of the virtual disk's for-
mat. You can select 15, 256, or 512 bytes. If you omit sector-size,
or if the size you specify is not valid, VDISK sets the size to 128.

340
I ' Appendix C / Installable Device Drivers

dir specifies the number of entries allowed in a virtual disk's


directory. You can select a value in the range 2 to 512. The
default value is 64. VDISK might adjust the dir value up to the
nearest sector size boundary. If the virtual disk is too small to
hold the FAT (file allocation table), the directory, and at least two
sectors, VDISK reduces the directory size. The volume label
resides in one of the directory entries.

I \

r;
I :

: I

I '

I '
~ )

\'
I

I: \

I ,
! ~

;-,
I I
: 1,

341
i
Appendix D

HARD DISK SETUP

The procedure for setting up your hard disk varies according to


which version of the MS-DOS operating system you are using.
Follow the steps outlined below to set up your hard disk for the
version of the MS-DOS operating system you are using:

; , MS-DOS Version 2.11


All of the MS-DOS 2.11 hard disk setup programs are provided
on the Hard Disk Utilities diskette that comes with the Hard
Disk Controller.
1. Use the HSECT program to hard format the hard disk.
2. Use the FDISK program to partition the hard disk for MS-
DOS. (Note that multiple MS-DOS partitions are not
allowed.)
I .
3. Use the HFORMAT program to soft format the MS-DOS
partition and make it bootable. Use the IE switch to enter
bad track information.
, ,

MS-DOS Version 3.2


, :
Most of the MS-DOS 3.2 hard disk setup programs are provided
on the Supplemental Programs diskette. The FORMAT program
is provided on the MS-DOS/BASIC system diskette.
Note: Do not use the hard disk setup programs on the
Hard Disk Utilities diskette with Version 3.2 MS-
DOS. You do not need the Hard Disk Utilities diskette
.' J at all if you are using the MS-DOS Version 3.2 operat-
ing system.
1. Use the HSECT program to hard format the hard disk.
HSECT prompts for the drive to be formatted.
2. Use the FDISK program to partition the hard disk for MS-
DOS. Multiple MS-DOS partitions are allowed.
3. Use the FORMAT program to soft format the DOS partition
, '
and make it bootable. (Use the IS switch to copy the hidden
system files to the hard disk.)

343
Appendix D / Hard Disk Setup

4. Copy all the files from your MS-DOS system diskette to


your hard disk drive. If you are setting up only one hard
disk partition, this is the final step.
5. Use the MLPART command (MLPART.COM) to create one
or more non-bootable, DOS2 partitions on your hard disk.
6. Copy MLPART.SYS from the Supplemental Programs
diskette to your hard disk drive. (Be sure to include a
DEVICE = MLPART.SYS command in your hard disk's
CQNFIG.SYS file.)
7. Reboot the computer from the hard disk drive to install the
MLPART.SYS device driver (load it into memory).
8. Use MLFORMAT to format any DOS2 partitions you cre-
ated. (This is an optional step. Do this only if you use
MLPART to create one or more DOS2 partitions.)

.
~
'

I •

I •

L......J

344
, ,
GLOSSARY

,--..
) ,
-0 Following is a list of terms, used in this manual, that may not
be familiar to you.

application A computer program used to perform a


program specified task such as word processing or
file handling.
{ -'
argument A required command variable that defines
or directs that command in accomplishing
its task.
ASCII American Standard Code for Information
Interchange. A universal numeric code for
alphanumeric and punctuation characters
that allows the exchange of information
between computers that are equipped for
~ communication.
I

assemble The operation of a program on assembly


language source code to create a machine
language or binary file. Binary files are
given the extension .exe in MS-DOS and you
can execute them by typing the program
name and pressing I ENTER I.
Assembler A program to create binary files from
assembly language source code (see
) i assemble).
background A multitask operation such as printing files
(in the background) while entering data.
i __
batch files A method of combining several commands
into 1 file that, when called, will automati-
I :
cally execute- all the commands in series.
binary Numbers or code to the base of 2. Your com-
puter's central processing unit (CPU)
requires binary code for all of its opera-
tions; thus, a binary file is often referred to
as a machine language program.
I '
I "

345
Glossary

BIOS Basic Input/Output System. A low level


interface between application programs and
MS-DOS and your computer hardware (the
keyboard, video screen, printer, disks, etc.). ~
BIOS services are available only through
machine language programming.
-......J
buffer A temporary storage area, usually in the-
computer's memory or on disk. Your com-
puter has buffer areas for such tasks as
reading and writing to disk and for storing --"

text being sent to a printer.


command Instructions you give to your computer. .-J
Type the command name, any parameters,
and press the I ENTER I key.
CON A device name in MS-DOS referring to the L.....
console (screen or keyboard).
current The directory in which you are currently
~
directory operating. Check Commands (Section II) for
ways to change the current directory.
current The operating drive (the drive that contains
drive the disk you are using). Check the Com-
mands (Section II) for ways to change the
current drive.
cursor The screen prompt symbol. In MS-DOS it is ----
a flashing underscore symbol.
~
default An argument or parameter that is built into
a command. It is automatically selected if
you do not specify another argument or
parameter. ~

delimiter A symbol that separates commands and/or


parameters from one another. When used 1---:
with MS-DOS commands, a delimiter is a
space, comma, semicolon, equal sign, verti-
cal bar, or tab. \ ,
~
device A peripheral piece of equipment attached to
your computer, such as a printer, disk drive,
or monitor. \
'--'

346
[ \
Glossary

1 ,
directory A disk area that keeps track of your files.
Each disk may have several directories,
each of which may contain several subdirec-
tories or files or both.
disk file A disk area in which you store information.
display Text or graphics that appears on the video
screen of your computer.
drive The mechanical portion of your computer's
magnetic storage device.
dummy A command parameter that is to be
argument replaced before the command can execute
successfully. The replacement parameter or
value can come from a program or from
operator input.
dump Send data or information to a device. You
, could dump a screen (text on the monitor)
, , to a disk or dump a buffer to a printer.
error Text on the screen that indicates a problem.
I ,
See Section VI for a description of error
messages.
ext or An appendage to a filename, 1-3 characters
extension long, that provides further identification.
Extensions often indicate a type of file such
as maillist.bas where .bas is the extension
and indicates a BASIC file.
external Procedures or utilities not resident in mem-
commands ory. External commands must be loaded
from disk into the computer before they can
be executed.
filename The name given to a file. It may be 1-8
characters long.
filespec A filename plus its extension, such as
1-..-_-
MEMOS.bas.
filter A function that performs a specific opera-
tion on data (such as sorting or searching)
as it flows between 2 devices (such as disk
and a printer), or between files.

347
: i
Glossary ~

I
:......J
format The process of dividing a disk into tracks
and sectors and writing on it the system
information used to store data. : !
"---'
input Information or data being received by a
device. I

internal An MS-DOS utility or procedure that, when U


the system is loaded, resides in memory. An
internal command can be executed even
after you remove the system disk from the
drive.
LPT A device name in MS-DOS that refers to the I
I
I

:
--.J
printer.
output Information or data being sent to a device.
parameter A variable item of information appended to
a command that defines or customizes the
command.
I i
path The route through directories and subdirec-
tories to a specific file.
, i
pathname The direction the operating system takes to ~
get to a file's location on disk. MS-DOS
pathnames have the general form
drive: \path \filename.ext.
peripheral An external device attached to your com-
puter such as a printer, monitor, keyboard,
or disk drive.
piping A method of making one command's output
another command's input, allowing the i
~
chaining of commands.
program See "application program." I
I

PRN A device name in MS-DOS that refers to the


printer.
replaceable Information appended to a command, usu-
parameters ally represented by a symbol such as %, that
will be replaced by user input when a com-
mand is called. See "dummy argument."

348
Glossary

root The first directory level on any disk. All


other directories are subdirectories of the
root.
string A specified group of characters, for example,
"Hello."
system Usually refers to your DOS (disk operating
system). By context, it can also refer to your
computer system, including monitor, CPU,
drives, and peripheral equipment.
system Display on the video screen ( A>, B>, C>,
prompt or D» that indicates which drive is the
current drive and that MS-DOS is waiting
for a command.
switch A command parameter that activates a spe-
cial function. The command DIR /W will
cause the directory listing to be displayed
;' on the screen in the wide mode.
I
i

syntax The rules governing the structure of a com-


mand, such as spelling, the order in which
commands and parameters are to be given,
or which characters are legal delimiters.
I template A storage area that contains the last MS-
t __ DOS command used. The command can
thus be called up for editing and
r-. reexecution.
J
toggle Switch a function on or off. Pressing I PRINT I
once sends screen input to the printer.
~

i Pressing I PRINT I again turns off this


I function.
track A concentric circle on a disk on which data
is stored. Each track is divided into several
sectors.

r verify A function that checks data to make sure


I that it has been copied or stored correctly.
wild card One or more symbols that are used to rep-
~,
I
I .
resent 1 or more variable characters. The
wild card ? can be used in a filename to
stand in place of a legal filename character.

349
i~:

I
i
I
'---'

,
.---....C

,
I
'--'

i
: I
'----'

~
I
;
i
'--'
INDEX

/CR 107
/LF 107
3 1I2-inch drive, configuring in system 325-327

active partition 94, 129


adding lines to a file in memory 209
alignment 249
ampersand, used to extend lines with library manager 261
APPEND 37-38
appending to library modules 260
application program 345
archive attribute, displaying and setting 40
r-
I
I
argument 345
ASCII 345
ASCII and scan codes 311-320
~
ASCII file 53, 56, 59
!
assemble 345
assembler 236, 345
ASSIGN 37,39, 103
asterisk, used to extract library modules 261
ATTRIB 40
AUTOEXEC.BAT 24, 164, 169
i
I
AUX 9,64

background 345
background printing 143-147
BACKUP 41-45
backup file, created with EDLIN 197
r- backup log entry 43
I ' BACKUP/RESTORE compatibility 43
backups, where BACKUP places files 44
r- BASIC 252
I batch file 345
calling one from another 27
conditional execution of commands 114-116
r creating 21-22
i . displaying message 140-142
executing 22
,.-, including remarks 22, 153
,J ,' pausing 22
percent sign 28
replaceable parameters 24-27

351
Index

,
i
~
suspending execution 140-142
transferring control to another line 105-106
where to create 23 i:-...,J!
batch file process, summary 23
baud rates 133
binary 345
binary file 53, 56, 59
displaying 182
J
BIOS 346
. i
black and white printer 108 LJ
block device, defining parameters for 325-327
BREAK 46
buffer 346
BUFFERS, CONFIG.SYS command 323-324
byte alignment 249
I :
I I
canonical frame 249 '---'
canonical frame address 253
carriage return 107
CGP-220 printer 107 I
'---'
I
character scan codes, converting to US scan codes 118
characters-per-line, setting 132
CHDIR 47-48
CHKDSK 49-50
class 238-239
CLS 51
COBOL 252
color TV 134
C01il, C01i2 9, 64 , )
! t
combine types 249 L...-J
command 346
editing 189-193
entering 1 : !
~
entering more than one at a time see batch files and
command piping
I
executing for several items in a set 97-98 I

maximum number of characters 1 W


C01i1iAND 52
command error messages 297-305 ,
i
command path, setting or displaying 138-139 ~
command piping 20
command processor 52 I
specifying a string to execute 52 !~I
telling not to exit to higher level 52
command types 29

352
Index

DATE 65-66
date ,
changing 65-66 I ;
changing format 66 ~

displaying 65-66
format for entering 65 ,
,
;

format in which date is stored 65 ~


DEBUG command parameters 265-267
DEBUG commands
ASSEMBLE 268-270
COMPARE 270-271
DUMP 271-272
ENTER 272-274 , '
'-..i
FILL 274-275
GO 275-276
HEX 277 i
INPUT 277 ----J

LOAD 278-279
MOVE 279-280
NAME 280-281
OUTPUT 282
PROCEED 282-283
QUIT 283 I ;
L.J
REGISTER 283-286
SEARCH 286-287
TRACE 287-288
UNASSEMBLE 288-289
WRITE 290-291
DEBUG command summary 265
DEBUG error messages 310
DEBUG, starting 263
default 33, 346 I I
DEL see ERASE , ,
~

deleting
from the template 193
library modules 260
lines with EDLIN 213-215
strings with EDLIN 228-229
delimiter 34, 346 , :
destination 34
device 346
device drivers see installable device drivers , I

device error messages 293-296 . ~


device names 9
DIR 13, 68-69
: I
----J
354
! ' Index

directories 5, 347
backing up 43
r changing 47-48
i
checking 49-50
checking, sending output to a file 49-50
copying 186-188
creating 12-13, 127-128
current see current directory
deleting 13, 161-162
displaying 10-12, 68-69
parent see parent directory 17
root see root directory 6
wide display 68-69
directory names, anonymous 17-18
disk buffers, setting number 323-324
disk file 347
disk, bootable 99, 102, 109
DISKCOMP 39,70-71
DISKCOPY 39, 72-73
diskettes
comparing 70-71
copying 72-73
I
I '
formatting 99-104
DISKTYPE 74
display 347
displaying a command line 191-192
displaying lines with EDLIN 222-224
DMP 132
1"""1
I
DMP-110 printer 107
I ' DOS partition see FDISK
DOS2 partition
accessing see CONFIG.8YS commands, MLPART.SYS
,\ l, creating 130-131
I '
formatting 129
double-sided diskette, formatting as single-sided 99, 102
r drive 347
current see current drive
joining to a pathname 117
size and capacity 74
support of additional drives 332-333
type 74
II drive letter, reassigning 39
, dummy argument 347
dump 347
,... DWP 132
!
355
Index

\ ;

ECHO 75-76
editing a file in parts 234
editing functions :
I
I
I
EDLIN 2 ~

MS-DOS 2
editing keys 1-2
EDLIN command format and rules 205-206
EDLIN command parameters 207-208
EDLIN commands
Append Lines 209
Copy Lines 210-212
Delete Lines 213-215
i
Edit Line 216-217
U
End Edit 218 ,
Insert 219-221
List 222-224 , !
I
Move Lines 225 ----'

Page 226
Quit 227
Replace'String 228-229
Search Text 230-232
Transfer Lines 233
Write Lines 234 i
~
EDLIN command summary 207
EDLIN editing keys
copy all 199
copy character 198
copy to character 198
delete character 199
delete to character 200
enter line 202-203
replace template 201-202 I
,
.
I

void line 200 ~'


EDLIN error messages 305-307
empty subdirectories, copying 186-188
end-of-line character 107
L.-.-
i
environment size 51
environment variable settings, displaying 165
environment variable, setting equal to a string 165-168 ,
,
EOF character 53, 56, 59 '--'
ERASE 13, 77-78
error 347
ERRORLEVEL 114 ~
i
error messages 293-310
commands 297-305

356
Index

"........,

I
\
I
'
DEBUG 310
EDLIN 305-307
linker 308-310
errors that CHKDSK corrects 50
Escape Code Sequences 124-125
EXE2BIN 79-80
executable file, converting to binary file format 79-80
EXIST 114
EXIT 81
extended printer capabilities 334-338
extended screen and keyboard features 332
extending lines in library manager command 261
Ii '
'
extension 6-7, 347
external commands 29,347
order of search 138
transferring to another disk 54
extracting library modules 261

FC 82-92
FDISK 93-94, 111, 112, 343
File Allocation Table 151
file control blocks 327-328
file editing 195-203
file handles 327-328
filename extension see extension
filenames 6-7, 347
files
adding to backup 43-44
appending to existing files 56-58
checking 49
combining 59-61
comparing 82-92
copying 53-55, 186-188
creating with EDLIN 9-12, 195-196
deleting 77-78
n displaying contents 10-11, 181, 182
! :
displaying date and time modified 68
editing with EDLIN 197
inserting text with EDLIN 196
making minor changes to files 137
merging with EDLIN 233
r packing on backup diskette 43-44
! ' paging through with EDLIN 226
patching 137
recovering 151-152

357
I
Index L:

i :

renaming 154
restoring backed up files 157-160
saving with EDLIN 196 : I
updating 155-156 '--'"
verifying 184
file sharing 169 , ,
allowing over a network 40 i :

filespec 347
file system 5
filter 20, 347
FIND 20,95-96
floppy diskette see diskette
FOR 97-98
FORMAT 112, 343
format 348
FORMAT 73, 93, 99-104 , I
FORTRAN 242,243,252 L--

function keys 189-190


copy all 189
copy character 189
copy to character 189
delete character 189
delete to character 189
end-of-file 190
enter line 190
insert 189 I '
replace template 190 L...".,

void line 190

global symbols 243


GOTO 105-106
GRAPHICS 107-108
groups 238-239

hard disk backup 41-45


hard disk formatting 102 see also FORMAT, hard disk setup,
HFORMAT, and MLFORMAT
formatting track and sector information see HSECT
locking out flawed areas 109, 113
using entire disk for MS-DOS 94
using multiple operating systems 93
hard disk heads 113
parking 172

358
! _i Index

hard disk partitions


accessing DOS2 partitions see CONFIG.8YS commands,
MLPART.SYS
creating see FDISK, hard disk setup, and MLPART
formatting see FORMAT, hard disk setup, HFORMAT, and
MLFORMAT
maximum number 93
status 94, 129
hard disk setup 343-344
,r-' HFORMAT 93, 109-110, 111, 343
: home directories 16-17
changing 47--48
HSECT 93, 111-113, 343

IF 114-116
input 348
input/output device, changing 64
input/output, redirecting 19
inserting text
n
! I
in a command line 192
with EDLIN 219-221
installable device drivers
r-',
I\ ANSLSYS 332
configuring in system 324-325
DRIVERSYS 332-333
I ' KEYCNVRT.SYS 333-334
t ' LPDRVRSYS 334-338
MLPART.SYS 338-339
SPOOLERSYS 339
I
I
' summary of drivers 331
VDISKSYS 340-341
internal 348
r , internal commands 29
internationally configured MS-DOS diskette 163-164

r JOIN 39, 103, 117


I

key conversion 333-334


r keyboard device 9
I
keyboard layout code, selecting 163-164
keyboard program, replacing with an international program
r-,, 118 -119
}

i keys
backspace 3
control-c 3, 34, 70, 242, 261, 264
!
I
359
,I :
,
Index e.-i

\ I

~
control-h 3
control-j 3
control-n 3
control-p 3
control-s 3, 264
escape 3
hold 3,34
print 3
shift-print 3
KEYTXX 118-119 . !
o
keywords 35
synonymous 36 , ;

LABEL 39, 120 U


LASTDRIVE 177
less-than sign 19 : i
LF 121 U
libraries 241
library manager 256-261
command characters 260-261
order of operations 256
starting with a command line 258-259
starting with a response file 259-260
starting with the prompt method 257-258
line feed 107
suppressing after carriage return 121
line printer 9
linefeed, setting for printer 132
lines, specifying in EDLIN commands 208
linker J~
alignment 249
assigning addresses 253
command characters 241-242
command prompts 239-241
error messages 308-310
loading segments 251-253 1
I
L-J
relocation fixups 254-255
sample session 246-248
starting with a command line 244-245
starting with a response file 245-246
starting with prompts 244
types of references 254-255 , i
linker combine types ~
common 251
private 250

360
J
Index

r--'
I

public 250
stack 250
,i : linker switches
, \'
I IDSALLOCATE 242
IHIGH 243
ILINENUMBERS 243
IMAP 243
INO 244
r--',
IPAUSE 243
ISTACK 243-244
! list file 236, 241
loading a line for editing with EDLIN 216-217
long references 255
LPDRVRSYS 123, 124
LPSETUP 122-126
Escape Code Sequences 124-125
LPT 9,348
machine language code 235
MCOPY.EXE 187
Media Error Map 113
media types, backing up between different types 43-45
r memory combine type 253
I merging files with EDLIN 233
messages, displaying during batch file execution 75-76
minus sign, used to delete library modules 260
MKDIR 12-13, 127-128
MLFORMAT 129,344
MLPART (MLPART.COM) 130-131, 344
r MLPART.SYS 129,130,344
MODE 132-135
modified files
backing up 41-43, 45
copying 186-188
monochrome monitor, using color-oriented software 134, 135
n MORE 20,136
moving lines with EDLIN 225
MS-DOS commands, quick reference 30-32
MS-DOS version, displaying 182
~
I
MS-LIB see library manager 256-261
multiple DOS2 partitions, accessing 338-339

near segment-relative references 255


near self-relative references 254
networking 169
I
!
361
Index

,
1
~
NL 132
non-active partition 94, 129
notation 35-36
NUL 9

object modules 240 i


operating system files see system files ~
output 348
overtyping in a command line 192

pagination 122-126
paging through a file with EDLIN 226
paragraph alignment 249 :w i
parameter 348
parameters 33
parent directory 17 I
i
parity 133 L-J

partitions see hard disk partitions


Pascal 242, 243, 244, 252
PATCH 137
PATH 138-139
path 348
pathname 8-9, 348
substituting a virtual drive name for a pathname 177
PAUSE 22, 140-142
period I
to indicate current directory 17 L.....J
to indicate current line 208
periods, to indicate parent directory 17
peripheral 348
piping 348
plus sign
used to append to library modules 260
used to extend lines in linker command 241
pound sign, used to indicate last line of program 208
PRINT 39, 143-147
print queue 143-147
print spooler 175-176
printer
characters-per-Iine 133, 135 ~
I

compatibility 107-108
control codes 335-337 , I
driver 334-338 ~
linefeed 132, 134
parameters 134

362
Index

timeout delay 133, 135


type 107, 132
printer data, buffering 339
printer output, redirecting to serial port 135
PRN 9,348
~, program 348
executing 1
PROMPT 148-150
public symbols 243

quitting EDLIN 227

I '
I
read-only attribute 40
RECOVER 151-152
relative line numbers in EDLIN 205
REM 22,153
RENAME 154
REPLACE 155-156
replaceable parameters 348
using more than ten 170-171
replacing strings with EDLIN 228-229
RESTORE 157-160
finding which disk to restore 43
RMDIR 13, 161-162
root directory 6,349
joining to a different pathname 117
RS-232 ports 9,64
RS232 communication parameters, setting 133, 135
run file 240

~
saving a file after editing with EDLIN 218
i saving in the template 192
screen scroll 34
screen
I' clearing 52
i
displaying 20, 136
shifting left and right 132
,,..... searching for strings with EDLIN 230-232
I sector 151-152
sectors, verifying after copy 54, 57, 59
segment addresses 253
segments 238
how the linker loads segments 251-253
SELECT 163-164
j
I

363
Index

I
semicolon U
in linker 242
in library manager 261 I I

serial port 9 u
I

SET 165-168
SHARE 169
SHIFT 25,170-171
~
I
SHIPTRAK 172
short references 254
SORT 20, 173-174
source 34 J
source code 235
special keys 1-2
special type 35-36 L.:
SPOOLER.SYS 175-176
stopbits 133
strings 208, 349 L....i
deleting with EDLIN 228-229
replacing with EDLIN 228-229
searching for with EDLIN 230-232
subdirectories '--'

copying 186-188
displaying 181 i
restoring 157, 159 ~

SUBST 39, 103, 177


switches 33,349
syntax 35, 349 ,j
:--.J
SYS 178
system 349
system disk, creating 178 ,
system files, copying 62 L.....-J

system prompt 349


changing 148-150

target 34
template 191, 349 I
temporary file 237 L--
text file see ASCIr file
text
finding 20, 95-96
l..-J
sorting 20
TIME 179-180
toggle 349
track 349 ~
TREE 181

364 '--!
I
Index

TYPE 182

us scan codes 164

VER 183
VERIFY 184
verify 349
verifying sectors after copy 54, 57, 59
video display, shifting left and right 134
G
I
video mode, setting 132, 134
video palette color, changing 132, 135
video scan lines, setting 132, 134
virtual disks 340-341
virtual drive name 177
VM.TMP 237
r- VOL 185
. i
volume label 68, 99, 102, 109, 126-127, 185

wild card 8, 154, 349


word alignment 249
writing edited lines to disk 234

XCOPY 73, 186-188

,---,
, '
i
~_.
,

,-
I I
~ \

~
, 1
• I

,-,
I '

~l
' ....

,-
I 1
t,.,_\

365
'-..J

'---

You might also like