0% found this document useful (0 votes)
19 views

IBM DOS 1.1 May82

Uploaded by

Legends Biraj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

IBM DOS 1.1 May82

Uploaded by

Legends Biraj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 362

---

----
-- ---
- ----
--- Personal Computer
-
--_.-
------ --- Computer Language
Series

Disk
Operating
System
Second Edition (May 1982)
Version 1.10
Changes are periodically made to the information herein; these
changes will be incorporated in new editions of this
publication.

Products are not stocked at the address below. Requests for


copies of this product and for technical information about the
system should be made to your authorized IBM Personal
Computer Dealer.

A Product Comment Form is provided at the back of this


publication. If this form has been removed, address comment
to: IBM Corp., Personal Computer, P.O. Box 1328-C, Boca Raton,
Florida 33432. IBM may use or distribute any of the information you
supply in any way it believes appropriate without incurring any
obligations whatever.

© Copyright International Business Machines Corporation 1981


Preface

This reference manual explains how to use the IBM


Personal Computer Disk Operating System (DOS).
It provides information on how to issue commands to
DOS to create, edit, link, debug, and execute programs.

Prerequisite Publication
Regardless of your background or previous programming
experience, you should look at the Guide to Operations
before reading this manual. The chapter on "Using
DOS" should be especially helpful to you before you
approach the more detailed information that appears in
this manual.

Organization of this manual


This manual has six chapters and six appendixes.

Chapter I has some introductory information about DOS


and files.

Chapter 2 contains information about starting DOS, as


well as directions on how to use the control keys and
DOS editing keys.

Chapter 3 contains detailed descriptions of the


commands you can issue to DOS. These commands
enable you to manage files, maintain diskettes, and
create and execute programs.

Chapter4 describes how to use the Line Editor (EDLIN)


program to create , alter, and display source language
files and text files.

Chapter 5 describes how to use the linker (LINK)


program to link programs together before execution.

Chapter 6 describes how the DEBUG program provides


a controlled test environment so you can monitor and
.cnntrol the execution of a program to be debugged; by
altering, displaying., and.executing6bject files.
iii
Appendix A lists messages generated by the programs
described in this manual.

Appendix B contains general technical information, and


introduces the technical information in Appendixes
C-E.

Appendix C describes allocation of space on diskettes.

Appendix D describes the system interrupts and


fun cti on calls.

Appendix E describes control blocks and work areas,


including a Memory Map, Program Segment, and File
Control Block.

Appendix F contains detailed information about .EXE


file structure and loading.

Data Security
The IBM Personal Computer is a powerful and useful
tool to help you with your personal and business
information processing needs. (As with any information
system, inadvertent errors may occur and information
may be misused.) We suggest that when processing
sensitive or highly valuable information, you take steps
to ensure your data and programs are protected from
accidental or unauthorized disclosure, modification,
destruction, or misuse. Simple measures, such as:
removing diskettes when not in use, keeping backup
copies of valuable information, or installing the
equipment in a secure facility, can go a long way to
maintain the integrity and privacy of your information.

iv
Summary of Changes

This manual includes the following DOS Release 1.10


enhancemen ts:

• Revisions to the linker (LINK) program


(Chapter 5).

• Support for an intermix of single sided and dual


sided diskette drives (Chapter 2 and wherever
applicable in Chapter 3 and Appendixes B and C).
Commands of special interest include:
- FORMAT
- DISKCOMP
- DISKCOPY

• DEBUG can now load files longer than 64K and


includes a command to com pare two blocks of
memory (Chapter 6).

• A new command, EXE2BIN, converts .EXE files


to .COM format programs (Chapter 3).

• The MODE command now includes the capability


to set the speed and protocol for the Asynchronous
Communications Adapter, as well as redirecting
parallel printer output to an Asynchronous
Communications Adapter (Chapter 3).

• Several new messages have been added (Appendix


A), as well as new prompts or screens for:
- DATE
- TIME
- FORMAT
- CHKDSK
- ERASE

v
• Tables of values for single sided and dual sided
diskette maps are included (Appendix C).

• The COpy command provides support for


concatenation (that is, combining) of files
(Chapter 3).

• Directory entries include the time, as well as the


date, when each file was last written to (Chapter
3).

CAUTION
The DOS 1.10 commands should never be executed
when you are running DOS 1.00, and the DOS 1.00
commands should never be executed under DOS 1.10.
Because of the internal changes required for DOS 1.10,
any attempt to run Level 1.00 commands on a 1.10
system (or vice versa) may result in the loss of data.

vi
CONTENTS

Preface . . . . . . . . . . . . . iii
Prerequisite Publication . . iii
Organization of this manual iii
Data Security . iv
Summary of Changes . . . . . . v

CHAPTER 1. INTRODUCTION 1-1


What is DOS? . . . . . . . . . . 1-3
What Are the Parts of DOS? . 1-3
A Few Words about Files . . . . 1-5
What Is a File? . . . . . . . 1-5
What Can I Name My Files? 1-5
How Many Files Can I Have? 1-6
How Does DOS Keep Track of My Files? . 1-6
Why Is This Information Important to Me? 1-6
Formatting Your Diskettes . . . . . . . . 1-7
Why You Should Back Up Your Diskettes 1-7

CHAPTER 2. STARTING DOS . . . 2-1


How to Start DOS . . . . . . . . . 2-3
If Your Computer Power Is Off 2-3
If Your Computer Power Is Already On 2-4
What Happens When You Start DOS? 2-4
How to Enter the Date and Time . 2-5
Specifying the Defaul t Drive . 2-6
Automatic Program Execution . . . . . . 2-7
Important Notes about Diskette and Drive
Compatibility . . . 2-8
Single-Drive Systems . . . . . . . . . . . 2-9
Control Keys . . . . . . . . . . . . . . . 2-11
DOS Editing Keys . . . . . . . . . . . . 2-16
Examples of Ways to Use DOS Editing
Keys . . . . . 2-20
To Start EDLIN 2-20
Example 1 2-22
Example 2 2-23
Example 3 2-24
Example 4 2-25
Example 5 2-26
vii
Example 6 . . . . . . . . . 2-27
Example 7 . . . . . . . . . 2-28
To Stop the Editing Session 2-30

CHAPTER 3. DOS COMMANDS 3-1


Introduction . . . . . . . 3-3
Types of DOS Commands 3-4
Format Notation . . . . . 3-5
DOS Command Parameters 3-6
Reserved Device Names 3-8
Global Filename Characters 3-9
Detailed Descriptions of the DOS Commands 3-12
Information Common to All DOS
Commands . . . . . . . . 3-1 2
Batch Processing . . . . . . . . . . . 3-14
The AUTOEXEC.BAT File . . . 3-15
Creating a .BAT File With Replaceable
Parameters . . . . . . . . . . . . . . 3-17
Executing a .BAT File With Replaceable
Parameters . . . . . . . . . 3-18
CHKDSK (Check Disk) Command 3-19
COMP (Compare Files) Command 3-21
COpy Command 3-23
DATE Command . . . . . 3-32
DEL Command . . . . . . 3-34
DIR (Directory) Command 3-35
DISKCOMP (Compare Diskette) Command 3-39
DISKCOPY (Copy Diskette) Command 3-42
ERASE Command 3-45
EXE2BIN Command 3-47
FORMAT Command 3-50
MODE Command . . 3-53
PAUSE Command 3-58
REM (Remark) Command 3-59
RENAME (or REN) Command 3-60
SYS (System) Command . . 3-61
TIME Command . . . . . . 3-62
TYPE Command . . . . . . 3-64
Summary of DOS Commands 3-65

CHAPTER 4. THE LINE EDITOR (EDLIN) 4-1


Introduction . . . . . . . . . . . 4-3
How to Start the ED LIN Program 4-4
The ED LIN Command Parameters 4-6
The ED LIN Commands . . . . . . 4-9
Information Common to All EDLIN
Commands . . . . . . . . . . . . . 4-9
viii
Append Lines Command 4-11
Delete Lines Command 4-1 2
Edit Line Command 4-16
End Edit Command . . 4-18
Insert Lines Command 4-19
List Lines Command . 4-22
Quit Edit Command 4-26
Replace Text Command 4-27
Search Text Command . 4-30
Write Lines Command 4-33
Summary of EDLIN Commands 4-34

CHAPTER 5. THE LINKER (LINK) PROGRAM 5-1


Introduction 5-3
Files . . . . . . 5-4
Input Files . 5-4
Output Files 5-4
YM.TMP (Temporary File) 5-5
Definitions . 5-6
Segment 5-6
Group . 5-7
Class . . 5-7
Comlnand Prompts 5-8
Detailed Descriptions of the Comlnand
Prompts . . . . . . . . . . . 5-10
Object Modules [.OBJ]: . 5-10
Run File [filespec.EXE] : 5-11
List File [NUL.MAP)]: 5-11
Libraries [.LIB] : 5-12
Linker Parameters . . . . 5-13
How to Start the Linker Program 5-1 7
Before You Begin . . . . . 5-17
Option 1 - Console Responses 5-17
Option 2 - Command Line . . 5-18
Option 3 - Automatic Responses 5-20
Example Linker Session . . . . . . . 5-22
Load Module Memory Map . . . 5-26
How to Determine the Absolute Address
of a Segment 5-27
Messages . . . . . . . . . . . . . . 5-28

CHAPTER 6. THE DEBUG PROGRAM 6-1


fu troduction . . . . . . . . . . . 6-3
How to Start the DEBUG Program 6-4
The OEBUG Command Parameters 6-6

ix
The DEBUG Commands . . . . . . . . . 6-11
Information Common to All DEBUG
Commands . 6-11
Compare Command . 6-13
Dump Command . 6-14
Enter Command . 6-17
Fill Command 6-20
Go Command .. 6-21
Hexarithmetic Command 6-24
Input Command 6-25
Load Command . 6-26
Move Command 6-29
Name Command 6-30
Output Command 6-32
Quit Command . . 6-33
Register Command 6-34
Search Command . 6-39
Trace Command 6-40
Un assemble Command 6-42
Write Command 6-45
Summary of DEBUG Commands 6-49

APPENDIX A. MESSAGES . . . A-3

APPENDIX B. DOS TECHNICAL


INFORMATION B-1
DOS Structure . . . . . . B-1
DOS Initialization . . . . B-2
The Command Processor B-3
Replacing the Command Processor B-4
Available DOS Functions . . . . B-5
Diskette/File Management Notes B-6
The Disk Transfer Area (DTA) B-7
Error Trapping . . . . . . . . . B-7
General Guidelines . . . . . . . B-8
Example of Using DOS Functions B-9

APPENDIX C. DOS DISKETTE ALLOCATION C-l


DOS Diskette Directory . . . . . . . . . C-3
DOS File Allocation Table . . . . . . . . C-6
How to Use the File Allocation Table C-8
Diskette Maps . . . . . . . . . . . . C-8

APPENDIX D. DOS INTERRUPTS AND


FUNCTION CALLS D-I
Interrupts .. D-I
Function Calls . D-7
x
APPENDIX E. DOS CONTROL BLOCKS AND
WORK AREAS . . . . . . E-l
DOS Memory Map . . . E-l
DOS Program Segment E-3
File Control Block . . . E-7

APPENDIX F. EXE FILE STRUCTURE AND


LOADING. F-l

INDEX . . . . . . . . . . . . . . . . . . .. .X-I

xi
Figures

Figure 1. DOS Commands . . . . . . . 3-65


Figure 2. EDLIN Commands . . . . . . 4-34
Figure 3. Input Files Used by the Linker 5-4
Figure 4. Output Files Used by the Linker 5-4
Figure 5. Alphabetic Flag Settings 6-37
Figure 6. DEBUG Commands . . . . 6-49
Figure 7. Single Sided Diskette Map C-9
Figure 8. Dual Sided Diskette Map . . C-13

xii
CHAPTER 1. INTRODUCTION

Contents
What is DOS? . . . . . . . . . . 1-3
What Are the Parts of DOS? 1-3

A Few Words about Files . . . . 1-5


What Is a File? . . . . . . . . 1-5
What Can I Name My Files? 1-5
How Many Files Can I Have? 1-6
How Does DOS Keep Track of My Files? 1-6
Why Is This Information Important to Me? 1-6
Formatting Your Diskettes . . . . . . . . 1-7
Why You Should Back Up Your Diskettes 1-7

1-1
1-2
What Is DOS?

The IBM Personal Computer Disk Operating System •


(DOS) is a collection of programs designed to make it
easy for you to create and manage files, run programs,
and use the system devices (for example, the printer
and the disk drives) attached to your computer.

What Are the Parts of DOS?


Your DOS diskette contains four programs, which are
the "heart" of your DOS:

1. The boot record. This program resides at the


beginning of your diskette. It is automatically
loaded in to memory each time you start DOS.
The boot record is responsible for loading the
rest of DOS. It is placed on all diskettes by the
FORMAT program. FORMAT is a program that
is supplied with DOS. (FORMAT is discussed
later in this chapter and also in Chapter 3.)

2. The fBMBfO.COM program. IBMBIO.COM is an


I/O (input/output) device handler program that
reads and writes data to and from the computer
memory and the devices attached to the computer.
This program is on your DOS diskette, but it is
not listed when you list the files on the diskette.
IBMBIO.COM is also put on your diskette by the
FORMAT program and occupies a specific
location on the diskette.

3. The fBMDOS.COM program. This program also


resides on your DOS diskette. Like IBMBIO.COM,
its filename does not appear when you list the files
in the directory.

1-3
IBMDOS.COM contains a file manager and a series
of service functions that can be used by programs
which are designed to run under DOS's control.

All the programs on your DOS diskette are


designed to run under DOS's control.

4. The COMMAND. COM program.


COMMAND.COM is a command processor that
accepts commands you enter and runs the
appropriate programs.

1-4
A Few Words about Files

What Is a File?
A file is a collection of related information. A file on
your diskette is like a folder in a file cabinet.

Nearly every business office has one or more filing


cabinets containing folders of information. Usually all
the information in a given folder is related. For
example, one folder might contain the names and
addresses of all em ployees. You might name this file
the Employee Master File. A file on your diskette
could also contain this information and could also be
named the Employee Master File.

All the programs on your diskette reside in files, each


with a unique name. You create a file whenever you
enter and save data.

You keep track of your files by their names.

What Can I Name My Files?


With few exceptions, you can give your files any names
you want. Your diskette filenames can be 1-8 characters
in length and can be followed by a filename extension.
Filename extensions start with a period and can be 1-3
characters in length. For example, the Employee Master
File could be named EMPMSTR.FLE.

Filenames and filename extensions are discussed in


Chapter 3, in the section called "DOS Command
Parameters. "

1-5
How Many Files Can I Have?
Single sided diskettes may contain up to 64 files;
double sided diskettes may contain up to'112 files.
Files on your diskette vary in size just like files in a
file cabinet. If your files contain a lot of information,
your diskette fills up with fewer than 64 (or 112)
files.

How Does DOS Keep Track of My Files?


The names of your files are kept on your diskette in a
system area known as the directory. The directory also
contains pertinent information concerning the size of
your files, their location on the diskette, and the dates
and times when they were created or last updated.

The single sided diskette directory occupies four sectors


at a specific location on each diskette. Double sided
diskette directories occupy seven sectors. For
information concerning sectors, refer to the "Using
DOS" chapter in your Guide to Operations.

Next to the directory is a system area known as a File


A llocation Table. Its jo b is to keep track of which
sectors belong to which files. The File Allocation Table
also keeps track of all available space on the diskette 'so
that you can create new files.

Each diskette has one directory and two copies of the


File Allocation Table. If the system has a problem
reading the first copy of the File Allocation Table, it
reads the second.

Why Is This Information Important to Me?


How DOS keeps track of your files is important to you
because these system areas are required on all diskettes
that DOS is expected to recognize (not just your DOS
diskette, but your other diskettes as well). The only
way to get this information on a diskette is to use the
FORMAT program-it comes on the DOS diskette.

1-6
Formatting Your Diskettes
You must format every diskette before it can be used
by DOS. You do not need to use FORMAT every time
you want to put information on a diskette-only the •
first time you use a diskette.

FORMAT writes on every sector of your diskette, sets


up the directory and File Allocation Table, and puts the
boot record program at the beginning of your diskette.

FORMAT also creates a copy of DOS on a new diskette


if you specify it in your command. This way, you can
create a diskette containing DOS and have plenty of
space for your own data on the same diskette. Keep in
mind that only DOS system files are copied when you
run FORMAT -none of the other files you may have
on your DOS diskette are copied.

For more information about FORMAT, refer to


Chapter 3.

Why You Should Back Up Your Diskettes


We strongly recommend that you make back-up copies
of all your diskettes. If a diskette someh.ow becomes
damaged, or if files are accidentally erased, you will still
have all your information.

REMINDER: Make a back-up copy of your DOS


diskette and put it in a safe place, too.

There are two ways to create a backup diskette:

1-7
• Use the DISKCOPY command. DISKCOPY
creates an exact image of an entire diskette on
another diskette. You can use this command to
copy either the DOS diskette or your own
diskette. DISKCOPY is the fastest way of copying
a diskette because it copies everything, including
DOS if it exists, in one operation.

In addition, DISKCOPY automatically formats a


new diskette, if necessary. Because the formatting
and copying are done in one operation, you do not
need to use the FORMAT command before you use
DISKCOPY.

• Use the COPY command. This is a slower method


than DISKCOPY, but it produces the same end
result with one difference-your files are written
. sequentially (one right after the other) on the new
diskette.

If you use COPY and you want the new diskette


to contain a copy of DOS, you must first use
FORMAT to format the diskette with the
appropriate option; then use COpy. Unlike
DISKCOPY, COPY does not copy the system files
for you and does not automatically format a new
diskette.

Note: If either diskette involved in the copy


has defective tracks, or if the diskette you
want to copy from has had a large amount of
file creation/erasure activity, the COpy
method is recommended. COpy compensates
for the random placement of data caused by
the creation/erasure activity and results in
better performance.

The dates and times stored in the directory for each


file are unaffected by copying, whether you use COpy
or 0 ISKCOPY.

For more information about the COpy and DISKCOPY


commands, refer to Chapter 3.

Now that you are more familiar with DOS and files,
let's start up DOS.

1-8
CHAPTER 2. STARTING DOS

Contents
How to Start DOS . . . . . . . . . . . . . 2-3
If Your Computer Power Is Off . . . . 2-3
If Your Computer Power Is Already On 2-4
What Happens When You Start DOS? . 2-4
How to Enter the Date and Time .2-5
Specifying the Default Drive . 2-6

Automatic Program Execution . . .2-7


Important Notes about Diskette and Drive
Compatibility . . . . 2-8

Single-Drive Systems . 2-9

Control Keys . . . . 2-11

DOS Editing Keys 2-16


Examples of Ways to Use DOS Editing Keys. 2-20
To Start EDLIN 2-20
Example 1 2-22
Example 2 2-23
Example 3 2-24
Example 4 2-25
Example 5 2-26
Example 6 2-27
Example 7 2-28
To Stop the Editing Session 2-30

2-1
2-2
How to Start DOS

There are two ways to start DOS:

• If your computer power is off

• If your computer power is already on

If Your Computer Power Is Off

1. Insert your DOS diskette in drive A.

2. Close the drive door.

3. If you have a printer, place the power switch


in the on position.

4. If your monitor has a separate power switch,


place the power switch in the on position.

5. Place the system unit power switch in the on


position.

2-3
If Your Computer Power Is Already On

1. Insert your DOS diskette in drive A.

2. Close the drive door.

3. Press and hold both the Ctrl and Alt keys;


then, press the Del key. Release the three
keys. This procedure is known as a system
reset.

What Happens When You Start DOS?


Either of these procedures automatically loads DOS into
memory. Loading DOS takes from 3 to 45 seconds,
depending on the memory size.

Once DOS is loaded, DOS searches your DOS diskette


for the COMMAND.COM program and loads it into
memory. Remember, the COMMAND program is a
command processor that accepts commands you enter
and runs the appropriate programs.

Now you must enter the date.

2-4
How to Enter the Date and Time
When the command processor is loaded, the following
message and prompt are displayed:

Current date is Tue 1-01-1980


Enter new date:

Enter today's date (mm-dd-yy), where:

mm is a one- or two-digit number from 1-12


dd is a one- or two-digit number from 1-31
yy is a two-digit number from 80-99 (the 19 is
assumed), or a four-digit number from 1980-2099.

Any date is acceptable as today's date, as long as the


digits are in the correct ranges and the delimiters
(separators) between the numbers are either slashes (/)
or hyphens (-). For example:

4-1-82 or 04/01/1982

If you enter an invalid date or delimiter, the system


repeats the date prompt.

After you enter a valid date, you see a message similar


to this:

Current time is 0:00: 16.42


Enter new time:

Enter the current time (hh:mm:ss.xx), where:

hh is a one- or two-digit number from 0-23


(representing hours)
mm is a one- or two-digit number from 0-59
(representing minutes)
ss is a one- or two-digit number from 0-59
(representing seconds)
xx is a one- or two-digit number from 0-99
(representing hundredths of a second)

Valid delimiters are the colon and the period, as shown.


If you enter an invalid time or delimiter, the system·
repeats the time prompt. .

2-5
After you enter a valid time, you see this:

The I BM Personal Computer 0 OS


Version 1.10 {C)Copyright IBM Corp 1981, 1982

A>

The command processor is now ready to accept your


commands. The date you enter is recorded in the
directory entry for any files that you create or change.

A> is the DOS prompt from the command processor.


Whenever you see A>, the system is waiting for you to
enter a command.

You have now completed the steps for starting DOS.

Note: If you did not receive the system messages


described, repeat the steps for starting DOS.

Specifying the Default Drive


The A in the prompt designates the default drive. DOS
searches the diskette located in the default drive to find
any filenames that you enter unless you specify another
drive.

You can change the default drive in the prompt by


entering the new designation letter followed by a colon.
For example:

A> (original prom pt)


A>B: (new drive designation)
B> (new prompt)

Now, B is the default drive. DOS searches the diskette


located in drive B to find any filenames that you enter,
unless you specify a drive.

Remember, if you do not specify a drive when you enter


a filename, the system automatically searches the
diskette located in the default drive.

2-6
Automatic Program Execution

You may want to start a specific program every time


you start DOS. You can do this with the DOS command
processor by using automatic program execution.

Every time you start up DOS, the command processor


searches for a file named AUTOEXEC.BAT on the DOS
diskette. This filename is special because it refers to a
batch file that is automatically executed whenever you
start the system. With this facility, you can execute
programs or commands immediately every time you
start DOS.

If the system finds the AUTOEXEC.BAT file, the file


is immediately executed by the command processor.
The date and time prompts are bypassed.

If DOS does not find the AUTOEXEC.BAT file, DOS


issues the date and time prompts. Refer to "Batch
Processing" in Chapter 3 for details on how to create
an AUTOEXEC.BAT file.

2-7
Important Notes about Diskette
and Drive Compatibility

DOS supports both single and dual sided diskette drives


in any combination-your drives do not need to be of
the same type.

Diskettes formatted for single sided use (see


"FORMAT Command" in Chapter 3) can be used in
either single or dual sided drives. However, diskettes
formatted for dual sided use are usable only in dual
sided drives, because data is recorded on both surfaces,
and the method of allocating space is different.
Therefore, you should never attempt to use a dual
sided diskette in a single sided drive.

2-8
Single-Drive Systems

On a single-drive system, Y0U enter the commands the


same way you would on a multi-drive system.

You should think of the single-drive system as having


two drives (drive A and drive B). But, instead of A and
B represen ting two physical drives as on a multi-drive
system, the A and B represent diskettes.

If you specify drive B when the "drive A diskette" was


last used, you are prompted to insert the diskette for
drive B. For example:

A>COPY COMMAND.COM B:
Insert diskette for drive B:
and strike any key when ready
1 File(s) copied
A>_

If you specify drive A when the "drive B diskette" was


last used, you are again prompted to change diskettes.
This time, the system prompts you to insert the "drive
A diskette."

The same procedure is used if a command is executed


from a batch file. The system waits for you to insert
the appropriate diskette and press any key before it
continues.

Note: Remember that the letter displayed in the


system prompt represents the default drive where
DOS looks to find a file whose name is entered
without a drive specifier. The letter in the system
prompt does not represent the last diskette used.

For example, assume that A: is the default drive.


If the last operation performed was DIR B:, DOS
believes the "drive B diskette" is still in the drive;
however, the system prompt is still A>, because A
is still the default drive. If you issue DIR, DOS
prompts you for the "drive A diskette", because
drive A is the default drive, and you did not
specify another drive in the DIR command.

2-9
Now that you know how to start the system and specify
drives, you should learn about the keys on your
keyboard that you can use with DOS.

2-10
Control Keys

Use the control keys when you are entering commands


or input lines to any program. Where two keys are
specified, for example Ctrl-Break, you must press and
hold down the first key and then press the second key.

Here is a summary of the control keys, their function,


and their location on the keyboard:

Control Key Function

This is the Enter key. Once you press the


Enter key, the displayed line is sent to the
req uesting program.

Ctrl-Break Ends (cancels) the current operation.

2-11
Control Key Function

Ctrl-Enter Allows you to go to the next display line


on the screen to continue entering the
line being typed.

rrl y.,yo .
'. l:,r", ...:..
.~uJ' J,e.
J
G H J I( l
, • J> • • ' •

•V, •

Ctrl-NumLock Suspends system operation. You must press


any character key to resume operation. This
is useful when a large amount of screen
output is being generated. You can press
Ctrl-NumLock to temporarily suspend the
display of your output so you can review
it. You can then press any other character
key to restart the display.

2-12
Control Key Function

Ctrl-PrtSc These keys serve as an on/off switch for


sending display output to the printer as
well as to the screen.

You can press these keys to print display


output on the printer and press them
again to stop printing display output on
the printer.

Although this allows the printer to function


as a system log, it slows down some
operations because the computer waits
during the printing.

Note: This function is disabled when


you run Disk and Advanced BASIC.

2-13
Control Key Function

Esc Cancels the current line and moves to the


next display line. A back slash (\) is
displayed to indicate the cancelled line.

"I'
,'" ""
~~------------~--~~~~

Shift-PrtSc Sends a copy of what is currently displayed


on the screen to the printer. This, in
effect, prints a "snapshot" of the screen.

2-14
Control Key Function

Backspaces and removes a character from


the screen. This is the key to the left of
NumLock, not key 4 on the numeric
keypad.

2-15
DOS Editing Keys

Use the DOS editing keys to make corrections to


commands and input lines as they are being entered.

The DOS editing keys are used to edit within a line.


The Line Editor (EDLIN) program op~rates on complete
lines within a file or document. When you are working
with EDLIN and want to edit within a line, however,
use the DOS editing keys. For more information about
EDLIN, refer to Chapter 4.

Note: Some word processing programs define


special editing rules: therefore, the DOS editing
keys may not work as described in this chapter.
You can also define special editing rules when
using the BASIC Program Editor while program-
ming in BASIC.

Any line you enter from the keyboard is retained in an


input buffer when you press Enter. The line is then
made available to your program for processing.

Since the line remains in the input buffer, you can use
that line as a template for editing purposes. The DOS
editing keys operate on that copy of the line. You
can repeat or change the line by using the DOS editing
keys, or you can enter an entirely new line.

Here is a summary of the DOS editing keys, their


function, and their location on the keyboard:

2-16
DOS Editing Key Function

Del Skips over one character in the template.


The cursor does not move.

.)
W
",~
", ""i
~~----------~--~--

Esc Cancels the line currently being displayed.


The template remains unchanged.

FI or~ Copies one character from the template


and displays it.

2-17
DOS Editing Key Function

F2 Copies all characters up to a specified


character.

F3 Copies all remaining characters from the


template to the screen.

F4 Skips over all characters up to a specified


character. (F4 is the opposite of F2.)

2-18
DOS Editing Key Function

F5 Accepts an edited line for continued


editing-the currently displayed line
becomes the template, but it is not sent
to the requesting program.

Ins Allows you to insert characters within a


line.

2-19
Examples of Ways to Use DOS Editing Keys
The following examples show how you use the DOS
editing keys with the Line Editor (EDLIN) program.

If you want to try these examples, you must use the


EDLIN program. The EDLIN program is on your DOS
diskette and is discussed in Chapter 4. You do not need
to review the EDLIN chapter to complete these
examples-just follow the steps provided.

Notes:

1. Because the DOS diskette shipped with your


IBM Personal Computer is write protected,
you cannot create the file used in the
following examples on that diskette. You
must use a copy of your DOS diskette to
complete these examples. Refer to the
section called "Write Protect Notch" in the
DOS section of your Guide to Operations for
more information about write protected
diskettes.

2. In the following examples, to enter something


means that you should type the information
and then press the Enter key.

3. If you finish one or more of the following


examples and you do not want to try the rest
of the examples, go to "To Stop the Editing
Session" at the end of this chapter.

To Start EDLIN
1. Insert your DOS diskette into drive A.

2. Create a file named EXAMPLES.

2-20
If you want the EXAMPLES file to reside on the
diskette in your default drive, enter:

EDLIN EXAMPLES

or

If you want the EXAMPLES file to reside on the


diskette in another drive, you must specify the
drive, as in:

EDLIN B:EXAMPLES

This command tells DOS to load the ED LIN


program and create a file called EXAMPLES.

The following message and prompt will be


displayed:

New file
*
Notice that the prompt for EDLIN is an asterisk
(*).

3. Now, enter the letter I.

This tells EDLIN that you want to begin inserting


lines in the file named EXAMPLES.

The screen looks like· this:

New file
*1
1:*

4. Type This is a mailorder file. on line I and press


Enter.

2-21
5. Type Editing is easy. on line 2 and press Enter.

You now have two lines of text in your


EXAMPLES file.

6. Press the Ctrl-Break keys.

Pressing Ctrl-Break will end the insert mode of


operation and return you to the EDLIN prompt.

7. Enter the number 1.

This tells EDLIN that you want to display line 1


on the screen.

The screen should look like this:

1:*This is a rnailorder file.


1:*

You are now ready to begin the examples.

Note: If you encounter any problems while trying


these examples, press the Ctrl-Break keys. The
EDLIN prompt will be displayed and you can start
over.

Example 1
Let's delete the first two characters in the word This and
then copy the remainder of the line.

1. Press the Del key twice to delete the first two


characters.

2. Press F3 to copy the remainder of the line to the


screen. The screen looks like this:

l:*This is a mail order file.


1: *is is a rna il order file.

2-22
If you want to continue with the next example:

l. Press Ctrl-Break to return to the EDLIN prompt.


(The changes you made to line I will not be
saved.)

2. Enter the number 1.

Example 2
Now we'll change line I; then, using Esc, we will cancel
the change. A back slash (\) will be displayed to
indicate that the displayed line has been cancelled.

Note: If the insert mode is on, the system


automatically turns it off when you use Esc.

The screen looks like this:

1:*This is a mailorder file.


1:* _

To change line I to Sample file:

1. Type Sample file, but do not press Enter.

1:*This is a mailorder file.


1:*Sample file_

2. To cancel the line we just entered, press the Esc


key.

1:*This is a mail order file.


1: *Sam pie file\

Now we can continue to edit the original line


This is a mailorder file.

3. Press F3 to copy the original line to the screen.

2-23
The screen looks like this:

1:*This is a mailorder file.


1:*Sample file\
This is a mailorder file.

If you want to continue with the next example:

I. Press Ctrl-Break to return to the EDLIN prompt.

2. Enter the number 2.

Example 3
Now let's copy one character by using F I or ~. (F I or
~ is the opposite of Del. Del skips over one character
in the template.)

The screen looks like this:

2:*Editing is easy.
2:*

I. Press the F I or ~ key three times.

The screen looks like this:

2:*Editing is easy.
2:*Edi

Each time you press the F I or ~ key, one more


character appears.

If you want to continue with the next example:

I. Press Ctrl-Break to return to the EDLIN prompt.

2. Enter the number 2.

2-24
Example 4
Now let's use the F2 key. Remember, the F2 key copies
all characters from the template to the screen up to, but
not including, the first occurrence of a specified
character.

You must always specify a character when using this


key. If the specified character is not present in the
template, nothing is copied.

The screen looks like this:

2:*Editing is easy.
2:*

1. Press the F2 key and enter the letter g.

The screen looks like this:

2:*Editing is easy.
2:*Editin

Now we'll copy all the remaining characters in the


template to the screen by using the F3 key.

(If you pressed Enter now, only Editin would be


saved in the EXAMPLES file as line 2.)

2. Press the F3 key.

The screen looks like this:

2:*Editing is easy.
2:*Editing is easy._

If you want to continue with the next example:

1. Press Ctrl-Break to return to the EDLIN prompt.

2. Enter the number 1.

2-25
Example 5
Now let's scan and locate specific characters within the
template by using the F 4 key. This is a way to skip
over characters. The cursor does not move when you
use this key and no characters are ~splayed.

You must always specify a character after you press the


F4 key. If the specified character is not present in the
template, no characters in the template will be skipped.

We will also use the F3 key to copy the remaining


characters in the template to the screen.

The screen looks like this:

1:*This is a mailorder file.


1:*

1. Press the F4 key and enter the letter o. (No


characters are displayed.)

2. Press the F3 key to copy the remainder of the line.

The screen looks like this:

1:*This is a mailorder file.


1:*order file.

If you want to continue with the next example:

1. Press Ctrl-Break to return to the EDLIN prompt.

2. Enter the number 1.

2-26
Example 6
Now we'll move the currently displayed line into the
template by using the F5 key. Pressing F5 is the same
as pressing Enter, except that the line is not sent to your
progra~An @ character is displayed to indicate that
the new fIne is now the template.

Note: If the insert mode is on, the system


automatically turns it off when you use F5.

Once you press F5, you can continue to make changes


to a line. When you are finished, press Enter to send
the line to your program.

The screen looks like this:

1:*This is a mailorder file.


1:*

1. Type This is not a sample file.

The screen looks like this:

1:*This is a mailorder file.


1:*This is not a sample file._

2. Press F5.

The result is:

1:*This is a mail order file.


1:*This is not a sample file.@

The replacement line This is not a sample file. is


now in the template. The replacement line is
acceptable, but let's con tinue to edit it.

2-27
3. To remove the word not from the replacement
line, press F 1 eight times:

1:*This is a mail order file.


1:*This is not a sample file.@

4. Press Del four times to remove one blank space


and the word not.

S. Press F3 to copy the remaining characters to the


screen.

The screen looks like this:

1: *This is a mailorder file.


1:*This is not a sample file.@
This is a sample file._

6. Press Enter to make the replacement line This is a


sample file. the template in place of the original
line and to send the line to your program.

(If you want to do more editing without sending th(


line to your program, press FS again to put the
displayed line into the template.)

Note: Pressing Enter immediately after


pressing FS empties the template.

If you want to continue with the next example:

1. Press Ctrl-Break to return to the EDLIN prompt.

2. Enter the number 1.

Example 7
Let's look at an example using the Ins key. The Ins
key serves as an on/off switch for entering and leaving
insert mode. You can press the Ins key to enter insert
mode, and press the Ins key again to leave the insert
mode.

2-28
While in the insert mode of operation, any characters
that you enter are inserted in the line being displayed.
The characters do not replace characters in the
template.

When you are not in the insert mode of operation, any


characters that you enter replace characters in the
template. If you are entering characters at the end of a
line, the characters will be added to the line.

The screen looks like this:

1:*This is a sample file.


1:*

Let'-s change the word sample to salary.

1. Press the F2 key and enter the letter m.

The screen looks like this:

1:*This is a sample file.


1:*This is a sa

2. Press the Ins key and enter the characters lary.

The screen looks like this:

1:*This is a sample file.


l:*This is a salary_

Notice that the characters lary were inserted, but


no characters from the template were replaced.

3. Now, press Ins again to leave the insert mode.

2-29
4. Enter one blank space and the three characters
tax.

1: *This is a sample file.


1: *This is a salary tax_

5. Press F3 to copy the remaining characters in the


template to the screen.

1:*This is a sample file.


1: *This is a salary tax file._

Notice that we inserted lary and we replaced


mple with tax.

6. Now press Enter to make the replacement line


the template in place of the original line and send
the line to the requesting program.

To Stop the Editing Session


You have now completed the examples.

To return to the A> prompt:

1. Press Ctrl-Break.

2. Enter the letter Q.

Q tells EDLIN that you don't want to save the


EXAMPLES file and that you want to quit the
editing session. EDLIN will prompt you with this
message:

Abort edit (YIN)?

to make sure you don't want to save the file.

3. En ter the letter Y.

The next chapter contains detailed information about


the DOS commands.

2-30
CHAPTER 3. DOS COMMANDS

Contents
Introduction 3-3

Types of DOS Commands 3-4

Format Notation . . . . . 3-5

DOS Command Parameters 3-6


Reserved Device Names 3-8
Global Filename Characters 3-9
The ? Character 3-9
The * Character 3-9
Examples of Ways to Use? and * 3-10 -

Detailed Descriptions of the DOS Commands 3-12


Information Common to All DOS
Commands 3-12

Batch Processing 3-14


The AUTOEXEC.BAT File 3-15
Creating a .BAT File With Replaceable
Parameters . . . . . . . . . . . . . . 3-17
Executing a .BAT File With Replaceable
Parameters . . . . . . . . . 3-18

CHKDSK (Check Disk) Command 3-19

COMP (Compare Files) Command 3-21

COPY Command 3-23

DATE Command 3-32

DEL Command . 3-34

DIR (Directory) Command 3-35

DISKCOMP (Compare Diskette) Command . 3-39


3-1
DISKCOPY (Copy Diskette) Comlnand 3-42

ERASE Command 3-45

EXE2BIN Command 3-47

FORMAT Command · 3-50

MODE Command . · 3-53

PAUSE Command · 3-58

REM (Remark) Command · 3-59

RENAME (or REN) Command · 3-60

SYS (System) Command · 3-61

TIME Command · 3-62

TYPE Command .3-64

Summary of DOS Commands · 3-65

3-2
Introduction

This chapter explains how to use the DOS commands.

You can use DOS commands to:

• Compare, copy, display, erase, and rename files.

• Compare, copy, and format diskettes.

• Execute system programs such as EDLIN and


DEBUG, plus your own programs.

• Analyze and list directories.

• Enter date, time, and remarks.

• Set various printer and screen options.

• Transfer DOS to another diskette.

• Request the system to wait.

• Set options for the Asynchronous Communications


Adapter.

• Cause printer output to be directed to the


Asynchronous Communications Adapter.

• Convert .EXE files to .COM type files.

3-3
Types of DOS Commands

There are two types of DOS commands:

• Internal

• External

Internal commands execute immediately because they


are built-in to the command processor.

External commands reside on diskette as program files;


therefore, they must be read from diskette before they
execute. This means that the diskette containing the
command must already be in a drive, or DOS is unable
to find the command.

Any file with a filename extension of .COM or .EXE


is considered an external command. This allows you to
develop your own unique commands and add them to
the system. (For example, programs such as
FORMAT.COM and COMP.COM are external
commands.) When you enter an external command, do
not include the filename extension.

3-4
Format Notation

We will use the following notation to indicate how the


DOS commands should be formatted:

• You must enter any words shown in capital letters.


These words are called keywords and must be
entered exactly as shown. You can, however,
enter keywords in any combination of upper/
lowercase. DOS will automatically convert
keywords to uppercase.

• You must supply any items shown in lowercase


italic letters. For example, you should enter the
name of your file when filename is shown in the
format.

• Items in square brackets ([ ]) are optional. If you


want to include optional information, you do not
need to type the brackets, only the information
inside the brackets.

• An ellipsis (. .. ) indicates that you can repeat an


item as many times as you want.

• You must include all punctuation (except square


brackets) such as commas, equal signs, question
marks, colons, or slashes where shown.

3-5
DOS Command Parameters

Parameters are items that can be included in your DOS


command statements. They are used to specify
additional information to the system. Some parameters
are required in your commands, others are optional.
If you do not include some parameters, DOS provides
a default value. Default values that DOS provides are
discussed in the detailed descriptions of the DOS
commands. Use the following parameters in your
DOS command statements:

Parameter Definition

d: Denotes when you should specify a drive. Enter


a drive letter followed by a colon to specify the
drive. For example, A: represents the first drive
on your system, B: represents the second. If
you omit this parameter, DOS assumes the
default drive.

filename Diskette filenames are 1-8 characters in length,


and can be followed by a filename extension.

The following characters can be used for


filenames:

A-Z 0-9 $ & # @


% ( )
< > { }
\ 1\

Any other characters are invalid. An invalid


character is assumed to be a delimiter, in which
case the filename is truncated.

Refer also to "Reserved Device Names" in this


chapter for more information about filenames.

3-6
Parameter Definition

.ext The optional filename extension consists of a


period and 1-3 characters. When used, filename
extensions immediately follow filenames.

The following characters can be used for


filename extensions:

A-Z 0-9 $ & # @


% ( )
< > { }
\ 1\

Any other characters are invalid.

Remem ber to include the extension when you


refer to a file that has a filename extension;
otherwise, DOS will be una ble to locate the file.

filespec [d:] filename [.ext]

Examples:

B:myprog.COB
A:yourprog
DAT A FI L E. pas
cobfile

3-7
Reserved Device Names
Certain names have special meaning to DOS. DOS
reserves the following names as system devices:

Reserved Nmne Device

CON: Console keyboard/screen. If used as an


input device, you can press the F6 key;
then press the Enter key to generate an
end-of-file indication, which ends CON:
as an input device.
AUX: First Asynchronous Communications
or Adapter port.
COMI:
LPTI: Parallel printer (as an output device
or only).
PRN:
NUL: Nonexistent (dummy) device for testing
applications. As an input device,
immediate end-of-file is generated. As
an output device, the write operations
are simulated, but no data is actually
written.

Notes:

1. The reserved device names can be used in


place of a filename.

2. Any drive specifier or filename extension


entered with these device names will be
ignored.

3. The colon following the reserved device word


is optional.

3-8
Global Filename Characters
Two special characters? and * can be used within a
filename and its extension. These special characters give
you greater flexibility with the DOS commands.

The ? Character

A ? in a filename or in a filename extension indicates


that any character can occupy that position. For
example,

[] IR J~B?D E<XYZ

lists all directory entries on the default drive with


filenames that have five characters, begin with AB, have
any next character, are followed by DE, and have an
extension of XYZ.

Here are some examples of the files that might be


listed by the DIR command:

ABCDE .XYZ
ABIDE .XVZ
ABODE .XYZ

The * Character

An * in a filename or in a filename extension indicates


that any character can occupy that position and all the
remaining positions in the filename or extension. For
example,

DIR AB*.XYZ

lists all directory en tries on the default drive with


filenames that begin with AB and have an extension of
XYZ. In this case, the filenames may be from 2-8
characters in length.

3-9
Here are some example files that might be listed by the
DIR command:

ABCDE .XYZ
ABC357 .XYZ
ABIDE .XYZ
ABIIOU .XYZ
ABO$$$ .XYZ
AB .XYZ

Examples of Ways to Use? and *

Example 1

To list the directory entries for all files named INPUT


on drive A (regardless of their filename extension),
enter:

DIR A:INPUT.???
or
DIR A:INPUT.*

Example 2

To list the directory entries for all files on drive A


(regardless of their filenames) with a filename extension
of XYZ, enter:

DIR A:????????XYZ
or
DIR A:*.XYZ

3-10
Exmnple 3

To list the directory entries for all files on drive A with


filenames beginning with ABC and extensions beginning
with E, enter:

DIR A:ABC?????E??
or
DIR A:ABC*.E*

3-11
Detailed Descriptions of the DOS Commands

This section presents a detailed description of how to


use the DOS commands. The commands appear in
alphabetical order; each with its purpose, format, and
type. Examples are provided where appropriate.

Information Common to All DOS Commands


The following information applies to all DOS commands:

• Commands are usually followed by one or more


parameters.

• Commands and parameters may be entered in


uppercase or lowercase, or a combination of both.

• Commands and parameters must be separated by


delimiters (space, comma, semicolon, equal sign, or
the tab key). The delimiters can be different
within one command. For example, you could
enter:

COpy oldfile.rel;newfile.rel
RENAME,thisfile thatfile

• The three parts of filespec (d:filename.ext) must


not be separated by delimiters. The (:) and (.)
already serve as delimiters.

• In this book, we will usually use a space as the


delimiter in the commands for readability.

• Also in this book, when we say "Press any key,"


we mean "Press any character key."

3-12
• Files are not required to have filename
extensions when you create or rename them;
however, you must include the filename extension
when referring to a file that has a filename
extension.

• You can end commands while they are running by


pressing Ctrl-Break. Ctrl-Break is recognized only
while the system is reading from the key board or
printing characters on the screen. Thus, the
command may not end immediately when you
press Ctrl-Break.

• Commands become effective only after you press


the Enter key.

• Global filename characters and device names are


not allowed in a command name. You may only
use them in command parameters.

• For commands producing a large amount of


output, you can press Ctrl-NumLock to suspend
the display of the output. You can then press any
other key to restart the display.

• You can use the control keys and the DOS editing
keys described in Chapter I while entering DOS
commands.

• The prompt from the command processor is the


default drive designation letter plus>, such as A>.

• Drives will be referred to as source drives and


targe t drives. A source drive is the drive you will
be transferring information from. A target drive is
the drive you will be transferring information to.

3-13
Batch Processing

Purpose: Executes the commands contained in the specified file


from the designated or default drive.

Format: [d: ] filename [parameters]

Type: In ternal External


***

Remarks: A batch file is a file containing one or more commands


that DOS executes one at a time. All batch files must
have a filename extension of .BAT.

You can pass parameters to the filename.BAT file when


the file executes. Therefore, the file can do similar
work with different data during each execution.

You create a batch file by using the Line Editor


(EDLIN), or by using the COPY command directly
from the keyboard.

Notes:

1. Do not enter the name BATCH (unless the


name of the file you want to execute is
BATCH.BAT).

2. Only the filename must be entered. Do not


enter an extension.

3. The commands in the file named


filename.BAT are executed.

3-14
Batch Processing

4. If you press Ctt'l-Break while in batch mode,


this prompt appears:

Terminate batch job (YIN)?

If you press Y, the remainder of the commands


in the batch file are ignored and the system
prompt appears.

If you press N, only the current command


ends and batch processing continues with the
next command in the file.

5. If you remove the diskette containing a batch


file being processed, DOS prompts you to
insert it again before the next command can
be read.

6. The last command in a batch file may be the nam~


of another batch file. This allows you to invoke
one batch file from another when the first is
finished.

The AUTOEXEC.BAT File


The AUTOEXEC.BAT file is a special batch file, When
you start or restart DOS, the command processor
searches for the AUTOEXEC.BAT file, If this file is
present on the DOS diskette, DOS automatically
executes the file whenever you start DOS.

3-15
Batch Processing

For example, if you want to automatically load BASIC


and run a program called MENU, create an
AUTOEXEC.BAT file as follows:

1. Enter:

COpy CON: AUTOEXEC.BAT

This statement tells DOS to copy the information


from the console (keyboard) into the
AUTOEXEC.BAT file.

2. Now, enter:

BASIC MENU

This statement goes into the AUTOEXEC.BAT


file. It tells DOS to load BASIC and to run the
MENU program whenever DOS is started.

3. Press the F6 key; then press the Enter key to put


the command BASIC MENU in the
AUTOEXEC.BAT file.

The MENU program will now run automatically


whenever you start DOS.

To run your own BASIC program, enter the name of


your program in place of MENU in the second line
of the example. Remember, you can enter any DOS
command, or series of commands, in the
AUTOEXEC.BAT file.

Note: If you use AUTOEXEC, DOS does not


prompt you for the current date and time unless
you include DATE and TIME commands in the
AUTOEXEC.BAT file.

3-16
Batch Processing

Creating a .BAT File With Replaceable Parameters


Within a batch file you may include dummy
parameters that can be replaced by values supplied
when the batch file executes.

For example, enter:

A>Copy con: ASMFILE.BAT


Copy %1.MAC %2.MAC
Type %2.PRN
Type %O.BAT

Now, press F6; then press Enter.

The system responds with this message:

1 File(s) copied
A>_
The file ASMFILE.BAT, which consists of three
commands, now resides on the diskette in the default
drive.

The dummy parameters %0, % I, and %2 are replaced


sequentially by the parameters you supply when you
execute the file. The dummy parameter %0 is always
replaced by the drive designator, if specified, and the
filename of the batch file.

Notes:

1. Up to 10 dummy parameters (%0-%9) can be


specified.

2. If you want to use % as part of a filename


within a batch file, you must specify it twice.
For example, to specify the file ABC%.EXE
you must enter it as ABC%%.EXE in the
batch file. 3-17
Batch Processing

Executing a .BAT File With Replaceable Parameters


To execute the ASMFILE.BAT file and pass
parameters, enter the batch filename followed by the
parameters you want sequentially substituted for %1,
%2, etc.

For example, you can enter:

ASMFILE A:PROG1 B:PROG2

ASMFILE is substituted for %0, A:PROG 1 for %1,


and B:PROG2 for %2.

The result is the same as if you entered each of the


three commands (in the ASMFILE.BAT file) from the
console with their parameters, as follows:

Copy A:PROG1.MAC B:PROG2.MAC


Type B:PROG2.PRN
Type ASMFILE.BAT

Remember that the dummy parameter %0 is always


replaced by the drive designator, if specified, and the
filename of the batch file.

3-18
CHKDSK (Check Disk)
Command

Purpose: Analyzes the directory and the File Allocation Table on


the designated or default drive and produces a diskette
and memory status report.

Format: CHKDSK [d:]

Type: Internal External


***

Remarks: CHKDSK temporarily makes the drive specified in d:


the default drive. If CHKDSK ends prematurely, the
default drive changes to the drive that CHKDSK was
checking. CHKDSK might end prematurely if you
replied A to a diskette error message.

After checking the diskette, any error messages are


displayed, followed by a status report. A complete
listing of error messages can be found in Appendix A.

The following is an example of the status report that


is displayed:

160256 bytes total disk space


8192 bytes in 2 hidden files
4608 bytes in 1 user files
4096 bytes in bad sectors
143360 bytes available on disk

65536 bytes total memory


53104 bytes free

Note that in the above status report, two hidden files


were reported. These are the DOS system files
IBMBIO.COM and IBMDOS.COM, which are hidden
from the normal directory searches.
3-19
CHKDSK (Check Disk)
Command

The system does not wait for you to insert a diskette.


CHKDSK assumes that the diskette to be checked is
in the specified drive. Therefore, on a single-drive
system, it is especially important that the specified
drive is different from the default drive, unless you
are checking the DOS diskette itself.

You should run CHKDSK occasionally for each diskette


to ensure the integrity of the file structures.

CAUTION
The DOS 1.10 commands should never be executed
when you are running DOS 1.00, and the DOS 1.00
commands should never be executed under DOS 1.10.
Because of the internal changes required for DOS 1.10,
any attempt to run Level 1.00 commands on a 1.10
system (or vice versa) may result in the loss of data.

3-20
COMP (Compare Files)
Command

Purpose: Compares the contents of one file to the contents of


another file.

Note: ThIs command compares two files; the


DISKCOMP command compares two entire
diskettes.

Format: COMP [filespec] [d:] [filename [.ext] ]

Type: Internal External


***

Remarks: The files that you compare may be on the same drive or
on different drives. Both filenames are optional, but if
you omit them, DOS prompts you for them. You are
also prompted to insert the appropriate diskettes.
COMP waits for you to press a key before it starts
comparing the files.

COMP compares the files byte-for-byte. Unequal bytes


result in error messages that give the hexadecimal offset
of the unequal comparison and the bytes that were
compared, as follows:

Compare error at offset xxxxxxxx


File 1 XX
File 2 = XX

In this example, File I is the first filename entered; File


2 is the second.

After ten unequal comparisons, COMP concludes that


further com paring would be useless; processing ends;
and the following message is displayed:

10 Mismatches - aborting compare


3-21
COMP (Compare Files)
Command

After a successful comparison, COMP displays:

Files compare ok

After a comparison ends, COMP displays:

Compare more files (V /N)?_

You now have the option to compare two more files or


to end the comparison. If you want to compare two
more files, enter Y.

If you want to end COMP processing, enter N.

Notes:

1. The two files you want to compare can have


the same name-provided they are on different
diskettes. In this case the specified drives must
be different.

2. If you only specify a drive for the second file,


it is assumed that the second filename is the
same as the first filename. In this case the
specified drives must be different.

3. Use of the global characters? and * in the


filenames do not cause multiple file
comparisons. Only the first file matching
each name is compared. For more information
on the global characters, refer to "Global
Filename Characters" in this chapter.

4. A comparison does not take place if the


file sizes are different. DOS prompts you to
compare other files.

3-22
COpy
Command

Purpose: Copies one or more files to another diskette and


optionally, gives the copy a different name if you
specify it in the COpy command.

COpy also copies files to the same diskette. In this case,


you must give the copies different names; otherwise,
the COpy is not permitted.

Concatenation (combining of files) can be performed


during the copying process.

You can also use COpy to transfer data between any


of the system devices. (An example of how to copy
information that you enter at the keyboard to a
diskette file is provided at the end of the description
of COPY.)

Format: COPY[/AI/B] filespec[/A] [/B]


[d:] [filename [.ex t] ] [j A] [jB] [jV]

or

COpy [jAI/B] filespec[jA] [jB] [+filespec[jA] [jB]


[d:] [filename [.ext] ] [jA] [jB] [jV]

Type: Internal External


***

Remarks: The parameter filespec is the source file. The parameter


[d:] [filename [.ext] ] is the target file.

3-23
COpy
Command

The parameter IV causes DOS to verify that the sectors


written on the target diskette are recorded properly.
Although errors in recording data are very rare, this
option has been provided for those of you who wish to
_verify that critical data has been correctly recorded.
This option causes the COPY command to run more
slowly, due to the additional overhead of verification.

The parameters IA and IB indicate the amount of data


to be processed by the COpy command. Each applies
to the filespec preceding it and to all remaining
filespecs on the command line until another IA or IB
is encountered. These parameters have the following
meanings:

When used with a source filespec:

IA Causes the file to be treated as an ASCII (text)


file. The file's data is copied up to, but not
including, the first end-of-file character (Ctrl-Z,
which is X' I A') found in the file; the remainder
of the file is not copied.

/B Causes the en tire file (based on the directory file


size) to be copied.

When used with a target filespec:

IA Causes a Ctrl-Z character to be added as the last


character of the file.

IB Causes no end-of-file character (Ctrl-Z) to be


added.

The default values are I A when concatenation is being


performed (see Option 3 below), and IB when
concatenation is not being performed (Options I and
2).

3-24
COpy
Command

You can use the global characters? and * in the


filename and in the extension parameters of both the
original and duplicate files. If you enter a ? or * in the
source filespec, the names of the files will be displayed
as the files are being copied. For more information
about global characters, refer to "Global Filename
Characters" in this chapter.

The COpy command has three format options:

Option 1

Use this option to copy a file with the copied file having
the same filename and extension. For example:

COPY filespec

or

COPY filespec d:

In the first example, we want to copy a file to the


default drive. In the second example, we specified the
target drive. In both examples, because we did not
specify the second filename, the copied file will have
the same filename as the source file. Because we did
not specify a name for the second file, the source drive
and the target drive must be different; otherwise, the
copy is not permitted.

3-25
COpy
Command

For example, assume the default drive is A:. The


command:

COpy B:MYPROG

copies the file MYPROG from the diskette in drive B,


to the diskette in default drive A, with no change in the
filename. The command:

COpy *.* B:
copies all the files from the diskette in default drive A
to the diskette in drive B, with no change in the
filenames or in the extensions. The filenames are
displayed as the files are copied. This method is very
useful if the files on the diskette in drive A are
fragmented.

Option 2

Use this option when you want the copied file to have a
different name from the file that is being copied. For
example:

COpy filespec filename [.ex t]

or

COpy filespec d:filename[ .ext]

In the first example, we copied a file, filespec, and


renamed the copy, filename [.ext]. We did not
specify a drive, so the default drive was used. In the
second example, we copied a file and renamed the copy
also. In this example, we did specify the target drive.
Because we changed the name of the file, the source
drive and the target drive do not have to be different.

3-26
COpy
Command

For example:

COpy MYPROG.ABC B:*.XXX

copies the file MYPROG .ABC from the diskette in


default drive A to the diskette in drive B, naming the.
copy MYPROG.XXX.

You can also use reserved device names for the copy
operation. For example:

COpy CON: fileA


COpy CON: AUX:
COpy CON: LPT1:
COpy fileA CON:
COpy fileB AUX:
COpy fileC LPT1:
COpy AUX: LPT1:
COpy AUX: CON:

Also, NUL: can be used in any variation.

Refer to "Reserved Device Names" for information


about system devices.

This example shows how to use COpy to put what you


enter from the keyboard into a diskette file:

3-27
COpy
Command

A>COPY CON: fileA


Type a line and press Enter.
Type your next line and press Enter.



Type your last line and press Enter.
Now, press F6 and then press Enter.

When you press F6, and then press Enter, the COpy
operation ends and saves the infonnation you entered.
In this example, the information is saved in a file named
fileA.

Option 3

Use this option when you want to concatenate files


while copying. That is, you can combine two or more
files into one file by adding the additional files to the
end of the first. The date and time recorded in the
result file directory are the current date and time. The
message indicating the number of files copied refers
to the number of result files created.

To concatenate files, list any number of source files,


separated by plus (+) signs in the COpy command.
Use the following format:

COPY[jA] [jB] filespec[/A] [/B] [+filespec[jA] [/B]]


[d:] [filename [.ext] ] [/ A] [/B] [/V]

For example:

COpy A.XYZ+B.COM+B:C.TXT BIGFllE.TXT

This command creates a new file called BIGFILE.TXT


on the default drive. The concatenation of A.XYZ,
B.COM, and B:C.TXT is put into BIGFILE.TXT.

3-28
COpy
Command

If you do not specify a result filename, the additional


files are added to the end of the first file, leaving the
result in the first file. For example,

COpy A.COM+B.COM

In this case, COpy appends B.COM to the end of


A.COM and leaves the result in A.COM.

Concatenation is normally performed in text (or


ASCII) mode. That is, the first Ctrl-Z (X' I A')
character in the file is interpreted as an end-of-file
mark. To combine binary files, use the /B parameter
to force COpy to use the physical end-of-file (the file
length shown in the DIR command). You can also
combine ASCII and binary files by using the following
parameters:

• ASCII - /A

• Binary - /B

For example,

COpy A.XYZ+B.COM/B+B:C.TXT/A BIGFllE.TXT

A /A or /B takes effect on the file it is placed after, and


it applies to all subsequent files on the command line
until another /A or /B is found. A /A or /B on the result
file causes a Ctrl-Z to be added (/ A), or not t6 be added
(/B), as the last character in the result file.

You can use the global characters? and * in the


filenames of both the files to be concatenated and the
result file. For example,

COpy *.lST COMBIN.PRN

3-29
COpy
Command

In this example, all files matching * .LST are combined


into one file called COMBIN.PRN. Also,

COPY *.LST+*.REF COMBIN.PRN

This example combines all files matching *.LST and


then all files matching *.REF into one file called
COMBIN.PRN.

COpy *.LST+*.REF *.PRN

In this example, each file matching * .LST is combined


with the corresponding .REF file, with the result
having the same name but with extension .PRN. Thus,
a file FILEl.LST would be combined with FILE 1. REF
to form FILEl.PRN; XYZ.LST would be combined
with XYZ.REF to form XYZ.PRN; etc. Note that in
this case (when multiple files are to be created), only
one file from each of the source filespecs is used to
create a given target file.

For more information about global characters, refer


to "Global Filename Characters" in this chapter.

It is easy to enter a COpy command with concatena-


tion where one of the source files is the same as the
target, yet this often cannot be detected. For
example,

COpy *.LST ALl.LST

This would produce an error if ALL.LST already exists.


The error is not detected, however, until it is time for
ALL.LST to be appended; by this time, ALL.LST
could already have been altered.

3-30
COpy
Command

COpy handles this situation as follows: As each input


file is found, its name is compared with the target
filename. If the names are the same, that one input
file is skipped, and the message Content of destination
lost before copy is displayed. Further concatenation
proceeds normally. This allows summing files, with a
command like:

COpy ALL.LST + *.LST

This command appends all * .LST files, except


ALL.LST itself, to ALL.LST. In this case, the error
message is suppressed, because this is a true physical
append to ALL.LST.

The following are special cases. (Remember to


include the /B parameter whenever you use the plus
(+) sign with non-ASCII files.)

COpy B:XYZ.ASM+

This command copies the file XYZ.ASM to the default


drive and gives it a new date and time. To simply
change the date and time, leaving the file in place, you
can use the following command:

COpy B:XYZ.ASM+" B:

Note that the two commas are necessary to define the


end of the source filename, because COpy normally
expects to see another filename after the plus (+) sign.

Note: When concatenating, COpy considers the


copying process to be successful if at least one,
but not necessarily all, of the named source files is
found. If none of the source files can be found,
you receive the message 0 file(s) copied.

3-31
DATE
Command

Purpose: Permits you to enter a date or change the date known


to the system. The date is recorded in the directory
entry for any files you create or alter.

Format: DATE [rnrn-dd-yy]

Type: Internal External


***

Remarks: If you enter a valid date with the DATE command


the new date is accepted, and the system prompt
appears. Otherwise, the DATE command issues the
following prompt:

Current date is day mm-dd-yy


Enter new date:

The system displays the day of the week in the day


location.

Enter a new date in the form mm-dd-yy or mm/dd/yy,


where:

mm is a one- or two-digit number from 1-12


dd is a one- or two-digit number from 1-31
yy is a two-digit number from 80-99 (the 19 is assume(
or a four-digit number from 1980-2099

You can change the date from the console or from a


batch file. Remember, when you start the system, it
does not prompt you for the date if you use an
AUTOEXEC.BAT file. You may want to include a
DATE command in that file. For more information
about the AUTOEXEC.BAT file, refer to "Batch
Processing" in this chapter.
3-32
DATE
Command

Notes:

1. To leave the date as is, press Enter.

2. The valid delimiters within the date are


hyphens (-) and slashes (/).

3. Any date is acceptable as today's date, as long


as the digits are in the correct ranges.

4. If you enter an invalid date or delimiter, you


receive an Invalid date message.

Example: In this example, once you press Enter, the date known
to the system is 7/24/82.

A>DATE
Current date is Mon 1-18-1982
Enter new date: 7/24/82

3-33
DEL
Command

See "ERASE Command" in this chapter.

3-34
DIR (Directory)
Command

Purpose: Lists either all the directory entries, or only lists those
for specified files. The information provided in the
display for each file includes its size in decimal bytes
and the date the file was last written to.

Note: Directory entries for system files


IBMBIO.COM and IBMDOS.COM are not listed,
even if present.

Format: DIR [d:] [filename [.ext] ] UP] UW]

Type: Internal External


***

Remarks: The IP parameter causes the display to pause when the


screen is full. When you are ready to continue with the
directory listing, press any key.

The IW parameter produces a wide display of the


directory, which lists only the filenames. Each line
displayed contains five filenames. (This parameter is
only recommended for SO-column displays.)

You can use the global characters? and * in the filename


and extension parameters. For more information about
the global characters, refer to "Global Filename
Characters" in this chapter.

The DIR command has two format options (the IP and


IW parameters may be used with either option):

3-35
DIR (Directory)
Command

Option 1

Use this option to list all the files in a directory. For


example:

DIR

or

DIR d:

In the first example, we want to list all directory


entries on the default drive. In the second example,
we want to list all directory entries on the specified
drive.

The directory listing might look like this:

A>DIR
FILEl A 100 11-17-81 9:56a
FILE3 A 104755 12-01-82 4:13p
9X 2600 2-28-92 10:04p
FILEl 1104 2-27-82 12:13p
4 File(s)

Option 2

Use this option to list selected files from a directory.


For example:

DIR filename .ext

or

DIR d:filename.ext

If either filename or .ext is omitted, an * is assumed.


3-36
DIR (Directory)
Command

In the first example, we want to list all the files in the


directory of the default drive that have the specified
filename.ext. In the second example, we want to list
all the files in the directory of the specified drive that
have the specified filename.ext.

Using the previous example, if you enter:

DIR FllE3.A

the screen might look like this:

A>DIR FllE3.A
FIlE3 A 104755 12-01-82 4:13p
1 File(s}

If you enter:

DIR *.A

or

DIR.A (omission of filename defaults to *)

the screen might look like this:

A>DIR *.A
FllEl A 100 11-17-81 9:56a
FIlE3 A 104755 12-01-82 4:13p
2 File(s}

3-37
DIR (Directory)
Command

If you enter:

DIR FILE1

the screen might look like this (omission of .ext defaults


to *):

A>DIR FILE1
FILE1 A 100 11-17-81 9:56a
FILE1 1104 2-27-82 12: 13p

To display only the entry for a file that has no


extension, enter the filename followed by a period. In
this case, the. ext does not default to *. For example,

DIR FILEt

displays the entry for FILE I, but not for FILE I.A.

3-38
DISKCOMP (Compare Diskette)
Command

Purpose: Compares the contents of the diskette in the first


specified drive to the contents of the diskette in the
second specified drive. Usually, you would run
DISKCOMP after a DISKCOPY operation to ensure
that the two diskettes are iden tical.

Note: This command compares two entire


diskettes; the COMP command compares two
files.

Format: DISKCOMP [d:] [d:] [j I]

Type: Internal External


***

Remarks: You can specify the same drive or different drives in


this command. If you specify the same drives, a
single-drive comparison is performed. You are
prompted to insert the diskettes at the appropriate
time. DISKCOMP waits for you to press any key
before it continues.

The /1 parameter forces DISKCOMP to compare only


the first side of the diskettes, even if the diskettes and
drives are dual sided.

DISKCOMP compares all 40 tracks on a track-for-track


basis and issues a message if the tracks are not equal.
The message indicates the track number (0-39) and the
side (0 or I) where the mismatch was found.

After completing the comparison, DISKCOMP prompts:

Compare more diskettes (V IN)1_

3-39
DISKCOMP (Compare Diskette)
Command

If you press Y, the next comparison is done on the same


drives that you originally specified, after you receive
prompts to insert the proper diskettes.

To end the command, press N.

Notes:

1. If you omit both parameters, a single-drive


comparison is performed on the default drive.

2. If you omit the second parameter, the default


drive is used as the secondary drive. If you
specify the default drive in the first parameter,
this also resul ts in a single-drive comparison.

3. On a single-drive system, all prompts are for


drive A, regardless of any drive specifiers
entered.

4. DISKCOMP usually does not issue a Diskettes


compare OK message if you try to compare a
backup diskette created by the COpy
command with the diskette you copied from.
The COpy operation produces a copy that
contains the same information, but places the
information at different locations on the target
diskette from those locations used on the
source diskette. In this case, you should use
the COMP command to compare individual
files on the diskettes.

3-40
DISKCOMP (Compare Diskette)
Command

5. If a disk error occurs while DISKCOMP is


reading the diskette, a message is produced
which indicates where (track and side) the
error occurred. Then DISKCOMP continues
to compare the rest of the diskette. Because
the remainder of the data to be compared
cannot be read correctly from the indicated
track and side, you can expect to receive a
COMPARE ERROR message.

6. DISKCOMP automatically determines the


number of sides to be compared, based on the
diskette that is to be read first (the first drive
parameter entered). If the first diskette or
drive can be read on only one side, or if the
/1 parameter is used, only the first side is read
from both diskettes. If the first drive and
diskette are dual sided, a two-sided comparison
is done. An error message is produced if
either the second drive or diskette is single
sided.

3-41
DISKCOPY (Copy Diskette)
Command

Purpose: Copies the contents of the diskette in the source drive


to the diskette in the target drive.

Format: DISKCOPY [d:] [d:] [/1]

Type: Internal External


***

Remarks: The first parameter you specify is the source drive. The
second parameter is the target drive.

The /1 parameter causes DISKCOPY to copy only the


first side of the diskette, regardless of the diskette or
drive type.

You can specify the same drives or you may specify


different drives. If the drives are the same, a single-drive
copy operation is performed. You are prompted to
insert the diskettes at the appropriate times. DISKCOPY
waits for you to press any key before continuing.

After copying, DISKCOPY prompts:

Copy another (V IN)?_

If you press Y, the next copy is done o~ the same drives


that you originally specified, after you are prompted
to insert the proper diskettes.

To end the command, press N.

3-42
DISKCOPY (Copy Diskette)
Command

Notes:

1. If you omit both parameters, a single-drive


copy operation is performed on the default
drive.

If you omit the second parameter. the default


drive is used as the target drive.

3. If you omit the second parameter and you


specify the default drive as the source drive,
a single-drive copy operation is performed.

4. On a single-drive system, all prompts will be


for drive A, regardless of any drive specifiers
you may en ter.

5. Diskettes that have had a lot of file creation


and deletion activity become fragmented,
because diskette space is not allocated
sequentially. The first free sector found is
the next sector allocated, regardless of its
loca tion on the diskette.

A fragmented diskette can cause degraded


performance due to excessive head movement
and rotational delays involved in finding,
reading, or writing a file.

If this is the case, it is recommended that you


use the COpy command, instead of
DISKCOPY, to eliminate the fragmentation.

For example:

COPY A:*.* B:

copies all the files from the diskette in drive A


to the diskette in drive B.
3-43
DISKCOPY (Copy Diskette)
Command

6. You should run DISKCOMP after a successful


DISKCOPY to ensure that the diskettes are
identical.

7. If disk errors are encountered on either


diskette, DISKCOPY indicates the drive, track
and side in error and proceeds with the copy.
In this case, the target diskette (copy) mayor
may not be usable, depending on whether the
affected diskette location was to contain
valid data.

8. DISKCOPY automatically determines the


number of sides to copy, based on the source
drive and diskette. If only the first side of the
source diskette can be read, then only the first
side can be copied. If the source drive and
diskette are dual sided, both sides can be
copied (unless you override it with the II
parameter). If the target drive is single
sided, an error message will indicate that the
drives are incompatible.

3-44
ERASE
Command

~rpose: Deletes the file with the specified filename from the
designated drive, or deletes the file from the default
drive if no drive was specified.

Format: ERASE filespec

or

DEL filespec

fype: Internal External


***

~emarks: The shortened form, DEL, is a valid abbreviation for


ERASE.

You can use the global characters? and * in the filename


and in the extension. Global characters should be used
with caution, however, because multiple files can be
erased with a single command. For more information
about global characters, refer to "Global Filename
Characters" in this chapter.

To erase all files on a diskette, enter:

ERASE [d:] *.*

Notes:

1. The system files IBMBIO.COM and


IBMDOS.COM cannot be erased.

3-45
ERASE
Command

2. If you use the filespec *. * to erase all of the


files on a diskette, DOS issues the following
message to verify that you actually want to
erase all files:

Are you sure (YIN)?

If you do want to erase all of the files on


the diskette, enter Y. Otherwise, enter N.

Example: In this example, the file rnyprog.l will be erased from


the diskette in drive A.

A>ERASE A:myprog.l

3-46
EXE2BIN
Command

>urpose: Converts .EXE files which have no segment fixup to a


form that is compatible with .COM programs. This
results in a saving of diskette space and faster program
loading.

Fonnat: EXE2BIN filespec [d:] [filename [.ext] ]

rype: In ternal External


***

~emarks: The file named by filespec is the input file. If no


extension is specified, it defaults to .EXE. The input
file is converted to .COM file format (memory image
of the program) and placed in the output file,
[d:]filename[.ext]. If you do not specify a drive,
the drive of the input file is used. If you do not
specify an output filename, the input filename is
used. If you do not specify a filename extension in
the output filename, the new file is given an extension
of .BIN.

The input must be in valid .EXE format as produced by


the linker. The resident, or actual code and data, part
of the file must be less than 64K. There must be no
STACK segment.

Two kinds of conversions are possible, depending on


the specified initial CS:IP:

• If CS: IP is not specified iIi the .EXE file, a pure


binary conversion is assumed. If segment fixups
are necessary (the program contains instructions
requiring segment relocation), you are prompted
for the fixup value. This value is the absolute
segment at which the program is to be loaded.

3-47
EXE2BIN
Command

In this case, the resultant program will be usable


only when loaded at the absolute memory address
specified, by a user application. The DOS
command processor will not be capable of
properly loading the program.

• If cs: IP is specified as 0000: 1OaR, it is assumed


that the file is to be run as a COM file, with the
location pointer set at 100R by the assembler
statement ORG; the first 1OaR bytes of the file
are deleted. No segment fixups are allowed, as
COM files must be segment relocatable; that is,
they must assume the entry conditions
explained in Appendixes B-F. In this case, once
the conversion is complete, you may rename
the result file to a .COM extension. Then, the
command processor will be capable of loading
and executing the program in the same manner
as the .COM programs supplied on your DOS
diskette.

If CS: IP does not meet one of these criteria, or if it


meets the COM file criterium but has segment fixups,
the following message is displayed:

File cannot be converted

348
EXE2BIN
Command

This message is also displayed if the file is not a valid


.EXE file.

Note: To produce standard COM files with the


assembler, you must both use the assembler
statement ORG to set the location pointer of the
file at IOOH and specify the first location as the
start address. (This is done in the END
statement.) For example, with the IBM Personal
Computer MACRO Assembler:

ORG 100H
START:



END START

3-49
FORMAT
Command

Purpose: Initializes the diskette in the designated or default driVE


to a recording format acceptable to DOS; analyzes the
entire diskette for any defective tracks; and prepares th
diskette to accept DOS files by initializing the directoq
File Allocation Table, and system loader.

Format: FORMAT [d:] [/S] [/1]

Type: Internal External


***

Remarks: You must format all new diskettes (by using either the
FORMAT or DISKCOPY command) before the
diskettes can be used by DOS.

If you specify /S in the FORMAT command, the


operating system files are also copied from the
diskette in the default drive to the new diskette in the
following order:

IBMBIO.COM
IBMDOS.COM
COMMAND.COM

If you specify /1, the target diskette is formatted for


single sided use, regardless of the drive type.

Notes:

1. Formatting destroys any previously existing


data on the diskette.

2. During the formatting process, any defective


tracks are marked as reserved to prevent the
tracks from being allocated to a data file.
3-50
FORMAT
Command

3. Directory entries for IBMBIO.COM and


IBMDOS.COM are marked as hidden files,
and therefore, they do not appear in any
directory searches-including the DIR
command.

4. FORMAT produces a status report, which


indicates:

• Total disk space

• Space marked as defective

• Space currently allocated to files (when


IS is used)
• Amount of space available for your files

5. FORMAT determines the target drive type and


formats the diskette accordingly. If the
diskette can be successfully read and written
on only one side, the diskette is formatted for
single sided use; it can be used in either type
of drive. If the target drive is dual sided and
you do not use the I I parameter, the diskette
is formatted for dual sided use; it will not be
usable in a single sided drive.

Example: By issuing the following command, the diskette in drive


B will be formatted and the operating system files will
also be copied:

A>FORMAT B:/S

The system issues the following message:

Insert new diskette for drive B:


and strike any key when ready

3-51
FORMAT
Command

After you insert the appropriate diskette and strike any


key, the system issues this message:

Formatting ...

while the diskette formatting is taking place.

Once the formatting is complete, the system issues this


message:

Formatting ... Format complete


System transferred

160256 bytes total disk space


12800 bytes used by system
4096 bytes in bad sectors
143360 bytes available on disk

Format another (V IN)?_

Enter Y to format another diskette.

Enter N to end the FORMAT program.

3-52
MODE
Command

Purpose: Sets the mode of operation on a printer or on a


display connected to the Color jGraphics Monitor
Adapter, sets options for the Asynchronous
Communications Adapter, or causes printer output
to be routed to the Asynchronous Communications
Adapter.

Technical Note: When used in Option 1, 3, or 4,


the MODE command causes printer and
Asynchronous Communications Adapter
intercept code to be placed in the DOS
communications area in low memory.

Format: MODE [LPT#:] [n] [,m] [,T]

or

MODE COMn :baud [,parity [,databits [,stopbits [,P] ] ] ]

or

MODE LPT#:=COMn

Type: Internal External


***

Remarks: A missing or invalid n or m parameter means that the


mode of operation for that parameter is not changed.

The MODE command has four format options:

3-53
MODE
Command

Option 1 (For the printer)

MODE LPT#: [n] [,m]

where:

# is 1, 2, or 3 (the printer number)


n is 80 or 132 (characters per line)
m is 6 or 8 (lines per inch vertical spacing)

For example:

MODE lPT1:132,8

sets the mode of operation of printer 1 to 132 characters


per line and 8 lines per inch vertical spacing.

The power-on default options for the printer are 80


characters per line and 6 lines per inch.

Option 2 (For display connected to


Color jGraphics Monitor Adapter)

Note: This command has no effect on a display


connected to the IBM Monochrome Display and
Printer Adapter.

MODE [n] [,m] [,T]

where:

n is 40 or 80 (characters per line)


m is R or L (shift display right or left)
T requests a test pattern used to align the display

3-54
MODE
Command

For readability, you can shift the display one character


(for 40-column) or two characters (for 80-column) in
either direction. If you specify T in the MODE
command, a prompt will ask you if the screen is aligned
properly. If you enter Y the command ends. If you
enter N the shift is repeated followed by the same
prompt. For example,

MODE 80,R,T

sets the mode of operation to 80 characters per line and


shifts the display two character positions to the right.
The test pattern is displayed to give you the opportunity
to further shift the display without having to enter the
command again.

Option 3 (For Asynchronous Communications


Adapter)

MODE COMn :baud[,parity [,da ta bits [,stopbits [,P] ]]]

where:

n Either 1 or 2 (Asynchronous Communica-


tions Adapter number)

baud 110,150,300,600, 1200, 2400,4800, or


9600

Note: Only the first two characters are


required; subsequent characters are
ignored.

parity Either N (none), 0 (odd), or E (even)-


(default = E)

3-55
MODE
Command

databits Either 7 or 8 (default = 7)


stopbits Either 1 or 2 (if baud equals 110, default = 2;
if baud does not equal 110, default = 1)

These are the protocol parameters. They are used to


initialize the Asynchronous Communications Adapter.
When you specify the protocol, you must specify at
least the baud rate. The other parameters can be
omitted, with the defaults accepted, by entering
only commas.

For example,

MODE COM1:12,N,8,1,P

sets the mode of operation to 1200 baud rate, no


parity, eight databits, and one stopbit. To use the
defaults listed in the definitions above, you enter:

MODE COM1:12""P

The parity defaults to even, the databits defaults to


seven, and the stop bits defaults to one.

The P option indicates that the asynchronous adapter


is being used for a serial interface printer. It can be
specified only for the serial protocol.

If you enter the P, timeout errors will be continuously


retried. You can stop the retry loop by pressing
Ctrl-Break.

To stop the timeout errors from being con tinuously


retried when you have entered P, you must
reinitialize the asynchronous adapter without
entering the P.

3-56
MODE
Command

Option 4 (To redirect parallel printer output to an


Asynchronous Communications Adapter)

MODE LPT#:=COMn

where:

# Either 1, 2, or 3 (printer number)

nEither 1 or 2 (Asynchronous Communications


Adapter number)

All output directed to printer LPT# is redirected to


the asynchronous adapter n.

Notes:

1. Before you can use MODE to redirect parallel


printer output to a serial device, you must
initialize the Asynchronous Communications
Adapter by using Option 3 (see above). If
that serial device is a printer, your serial
initialization command must also include
the P parameter.

2. MODE LPT#: [n] [,m] disables the redirection


for the printer designated by the #.

3-57
PAUSE
Command

Purpose: Suspends system processing and issues the message


Strike a key when ready ....

Format: PAUSE [remark]

Type: In ternal External


***

Remarks: You can insert PAUSE commands within a batch file to


display messages and to give you the opportunity to
change diskettes between commands. To resume
execution of the batch file, press any key except
Ctrl-Break. (Ctrl-Break ends processing.)

If you include the optional remark, the remark is also


displayed. The optional remark can be any string of
characters up to 121 bytes long.

You can control how much of a batch file you want to


execute by placing PAUSE commands at strategic
points in the file. At each PAUSE command, the
system stops and gives you time to decide whether to
end processing. To end processing, press Ctrl-Break.
To continue processing, press any other key.

Example: If you enter this PAUSE command in a batch file, the


following message is displayed:

A>PAUSE Change diskette in drive A


Strike a key when ready" '_

This PAUSE enables you to change diskettes between


commands.

3-58
REM (Remark)
Command

>Urpose: Displays remarks from within a batch file.

~ormat: REM [remark]

rype: Internal External


***

lemarks: The remarks are displayed when the batch execution


reaches the remark.

Remarks can be any string of characters up to 123 bytes


long.

You can use REM commands without remarks for


spacing within your batch file, for readability.

~xample: If the following REM command is issued in a batch file,


this remark is displayed:

REM This is the daily checkout program.

3-59
RENAME (or REN)
Command

Purpose: Changes the name of the file specified in the first


parameter to the name and extension given in the
second parameter. If a valid drive is specified in the
second parameter, the drive is ignored.

Format: REN [AME] filespec filename [ .ex t]

Type: Internal External


***

Remarks: You can use the abbreviated form REN for the
RENAME command. You can also use the global
characters? and * in the parameters. For more
information about global characters, refer to "Global
Filename Characters" in this chapter.

Example: The command:

RENAME B:ABODE HOME

renames the file ABODE on drive B to HOME.

The command:

REN B:ABODE *.XY

renames the file ABODE on drive B to ABODE.XY.

3-60
SYS (System)
Command

~rpose: Transfers the operating system files from the default


drive to the specified drive, in the following order:

IBMBIO.COM
IBMDOS.COM

format: SYS d:

~ype: In ternal External


***

temarks: The diskette in the specified drive must already be


formatted by a FORMAT d:jS command to contain a
copy of DOS. If you did not format the diskette with
the jSoption, the system cannot be transferred because
the specific diskette locations required for the system
files have not been allocated.

Note: SYS lets you transfer a copy of DOS to an


application program diskette designed to use DOS,
but sold without it. In this case, the specific
diskette locations required for the DOS files have
already been allocated, although the DOS files are
not actually present. The SYS command will
transfer the files to the allocated space.

3-61
TIME
Command

Purpose: Permits you to enter or change the time known to the


system. Whenever you create or add to a file, the time
is recorded in the directory. You can change the time
from the console or from a batch file.

Format: TIME [hh:mm:ss.xx]

Type: Internal External


***

Remarks: If you enter a valid time with the TIME command, the
time is accepted, and the system prompt appears.
Otherwise, the TIME command issues the following
prompt:

Current time is hh:mm:ss.xx


Enter new time:

where:

hh is a one- or two-digit number from 0-23


(representing hours)
mm is a one- or two-digit number from 0-59
(representing minutes)
ss is a one- or two-digit number from 0-59
(representing seconds)
xx is a one- or two-digit number from 0-99
(representing hundredths of a second)

Notes:

l. To leave the time as is, press Enter.

3-62
TIME
Command

2. If you enter any information (for example,


just the hours, and press Enter), the remaining
fields are set to zero.

3. Any time is acceptable as long as the digits


are within the defined ranges.

4. The valid delimiters within the time are the


colon (:) separating the hours, minutes, and
seconds, and the period (.) separating the
seconds and the hundredths of a second.

5. If you specify an invalid time or delimiter,


you receive an Invalid time message.

Example: In this example, once you press Enter, the time known
to the system is changed to 13:55:00.00.

A>TIME
Current time is 00:25: 16.65
Enter new time: 13:55

3-63
TYPE
Command

Purpose: Displays the contents of the specified file on the


screen.

Format: TYPE filespec

Type: Internal External


***

Remarks: The data is unformatted except that tab characters are


expanded to an eight-character boundary; that is,
columns 8, 16, 24, etc.

Notes:

1. Press Ctrl-PrtSc if you want the contents of a


file to be printed as they are being displayed.

2. Text files appear in a legible format; however,


other files, such as object program files, may
appear unreadable due to the presence of
non-alphabetic or non-numeric characters.

Example: In this example, the file myprog.one on the diskette in


drive B is displayed on the screen.

TYPE B:myprog.one

3-64
Summary of DOS Commands

The following chart is provided for quick reference.


The section called "Format Notation" at the beginning
of this chapter explains the notation used in the format
of the commands.

Note: In the column labeled Type, the I stands for


Internal and the E stands for External.

Command Type Purpose Format

(Batch) I Executes batch [d: ] filename


file [parameters]

CHKDSK E Checks disk and CHKDSK [d:]


reports status

COMP E Com pares files COMP [filespec]


[d:] [filename [.ext] ]

COPY I Copies files COPY[/A] [/B]


filespec[jA] [jB]
[d:] [filename
[. ext] ] [fA] [jB] [jV]
or
COPY[/A] [jB]
filespec [/A] [/B]
[ +filespec [j A] [jB]
[d:] [filename
[.ext] ] [fA] [jB] [jV]

DATE I Enter date DATE [mm-dd-yy]

Figure 1 (Part 1 of 3). DOS Commands

3-65
Command Type Purpose Format

DIR I Lists filenames DIR [d:]


[filename [.ex t] ]
[/P] [/W]

DISKCOMP E Compares DISKCOMP [d:] [d: ]


diskettes [/1]

DISKCOPY E Copies DISKCOPY [d:] [d: ]


diskettes [/1]

ERASE I Deletes files ERASE filespec


or
DEL filespec

EXE2BIN E Converts .EXE EXE2BIN filespec


files to .COM [d:] [filename [.ext]
format

FORMAT E Formats FORMAT


diskette [d:] [/S] [/1]

MODE E Sets mode on MODE [LPT#:] [n]


printer/display [,m] [,T]
or
MODE COMn:baud
[,parity] [,databits
[,stopbits [,P] ] ]
or
MODE LPT#:=COMn

PAUSE I Provides a PAUSE [remark]


system wait

Figure 1 (part 2 of 3). DOS Commands

3-66
Command Type Purpose Format

REM I Displays REM [remark]


remarks

RENAME I Renames files REN[AME] filespec


filename [ .ex t]

SYS E Transfers DOS SYS d:

TIME I Enter time TIME [hh:mm:ss.xx]

TYPE I Displays file TYPE filespec


contents

Figure 1 (Part 3 of 3). DOS Commands

3-67
3-68
CHAPTER 4. THE LINE EDITOR (EDLIN)

Contents
Introduction 4-3

How to Start the ED LIN Program 4-4

The ED LIN Command Parameters 4-6

The ED LIN Commands . . . . . . 4-9


Information Common to All EDLIN
Commands . . . . 4-9

Append Lines Command 4-11

Delete Lines Command 4-12

Edit Line Command 4-16

End Edit Command . 4-18

Insert Lines Command 4-19

List Lines Command 4-22

Quit Edit Command 4-26

Replace Text Command 4-27

Search Text Command 4-30

Write Lines Command 4-33

Summary of EDLIN Commands 4-34

4-1
4-2
Introduction

In this chapter, you will learn how to use the Line


Ed itor (ED LIN) program.

You can use the Line Editor (EDLIN) to create,


change, and display source files or tex t files. Source
files are unassem bled programs in source language
format. Text files appear in a legible format.

EDLIN is a line text editor which can be used to:

• Create new source files and save them.

• Update existing files and save both the updated


and original files.

• Delete, edit, insert, and display lines.

• Search for, delete, or replace text within one or


more lines.

The text of files created or edited by EDLIN is divided


into lines of varying length, up to 253 characters per
line.

Line numbers are dynamically generated and displayed


by EDLIN during the editing process, but are not
actually present in the saved file.

When you insert lines, all line numbers following the


inserted text advance automatically by the number of
lines inserted. When you delete lines, all line numbers
following the deleted text decrease automatically by
the number of lines deleted. Consequently, line
numbers always go consecutively from I through the
last line number.

4-3
How to Start the EDLIN Progrnm

To start EDLIN, enter:

EDLIN filespec

CAUTION
When you start EDLIN, EDLIN erases the backup
copy (.BAK) of the file, if one exists, to ensure
adequate space on the diskette for the updated file.
EDLIN then allocates a new file with the filename
that you specify in the EDLIN command and an
extension of .$$$. The file with an extension of
.$$$ contains the updated file, and is ultimately
renamed to the specified filespec by the End Edit
command.

• If the specified file exists on the designated or


default drive, the file is loaded into memory
until memory is 75% full. If the entire file is
loaded, the following message and prompt are
displayed:

End of input file


*
You can then edit a file.

Notice that the prompt for EDLIN is an asterisk


(*).

• If the entire file cannot be loaded into memory,


EDLIN loads lines until memory is 75% full, then
displays the * prompt. You can then edit the
portion of the file that is in memory.

To edit the remainder of the file, you must write


some of the edited lines to diskette in order to free
memory so that you can load unedited lines from
diskette into memory. Refer to the Write Lines
and Append Lines commands in this chapter for
the procedure you will use.

4-4
• If the specified file does not exist on the drive, a
new file is created with the specified name. The
following message and prompt is displayed:

New file
*
You can now create a new file by entering the
desired lines of text. To begin entering text, you
must enter an I command to insert lines.

When you have-completed the editing session, you can


save the original and updated (new) files by using the
End Edit command. The End Edit command is
discussed in this chapter in the section called "The
EDLIN Commands." The original file is renamed to
an extension of .BAK, and the new file has the filename
and extension you specified in the EDLIN command.

Note: You cannot edit a file with a filename


extension of .BAK with EDLIN because the
system assumes it is a backup file. If you find it
necessary to edit such a file, rename the file to
another extension; then start EDLIN and
specify the new name.

4-5
The ED LIN Command Parameters

Parameter Definition

line Denotes when you must specify a line number.

There are three possible entries that you can


make using this parameter:

1. Enter a decimal integer from 1-65529. If


you specify a number greater than the
number of lines that are in memory, the
line will be added after the last line that
exists.

Line numbers must be separated from each


other by a comma or a space.

OR

2. Enter a pound sign (#) to specify the line


after the last line in memory. Entering
a # has the same effect as specifying a
number greater than the number of lines
in memory.

4-6
Parameter Definition

line OR

3. Enter a period (.) to specify the current


line.

The current line indicates the location


of the last change to the file, but is not
necessarily the last line displayed. The
current line is marked by an asterisk (*)
between the line number and the first
character of text in the line. For
example:

10: *FIRST CHARACTER OF TEXT

n Denotes when you must specify lines.

Enter the number of lines that you want to


write to diskette or load from diskette.

You only use this parameter with the Write


Lines and Append Lines commands. These
commands are meaningful only if the file to
be edited is too large to fit in memory.
-

4-7
Parameter Definition

string Denotes when you must enter one or more


characters to represent text to be found,
replaced, deleted; or to replace other text.

You only use this parameter with the Search


Text and Replace Text commands.

4-8
The EDLIN Commands

This section describes the EDLIN commands and tells


how to use them. The commands are in alphabetical
order; each with its purpose and format. Examples
are provided where appropriate.

Information Common to All EDLIN Commands


The following information applies to all EDLIN
commands:

• With the exception of the Edit Line command, all


commands are a single letter.

• With the exception of the End Edit and Quit Edit


commands, commands are usually preceded and/or
followed by parameters.

• Enter commands and string parameters in uppercase


or lowercase, or a combination of both.

• Separate commands and parameters by delimiters


for readability; however, a delimiter is only
required between two adjacent line numbers.
Remember, delimiters are spaces or commas.

• Commands become effective only after you press


the Enter key.

• End commands by pressing the Ctrl-Break keys.

• For commands producing a large amount of


output, press Ctrl-NumLock to suspend the display
so that you can read it before it scrolls away. Press
any other character to restart the display.

4-9
• Use the control keys and DOS editing keys,
described in Chapter I, while using EDLIN. They
are very useful for editing within a line, while the
ED LIN commands can be used for editing
operations on entire lines.

• The prompt from ED LIN is an asterisk (*).

4-10
Append Lines
Command

Purpose: Adds the specified number of lines from diskette to


the file being edited in memory. The lines are added at
the end of the current lines in memory.

Format: [n] A

Remarks: This command is only meaningful if the file being edited


is too large to fit in memory. As many lines as possible
are read into memory for editing when you start EDLIN.

To edit the remainder of the file that will not fit into
memory, you must write edited lines in memory to
diskette before you can load unedited lines from diskette
into memory by using the Append Lines command.
Refer to the Write Lines command for information on
how to write edited lines to diskette.
,.
Notes:

1. If you do not specify the number of lines,


lines are appended to memory until available
memory is 75% full. No action is taken if
available memory is already 75% full.

2. The message End of input file is displayed


when the Append Lines command has read
the last line of the file into memory.

4-11
Delete Lines
Command

Purpose: Deletes a specified range of lines.

Format: [line] [,line] D

Remarks: The line following the deleted range becomes the


current line, even if the deleted range includes the last
line in memory. The current line and all the following
lines are renumbered.

Default values are supplied if either one or both of the


parameters are omitted.

If you omit the first parameter, as in:

,lineD

deletion starts with the current line and ends with the
line specified by the second parameter. The beginning
comma is required to indicate the omitted first
parameter.

If you omit the second parameter, as in:

lineD

or

line,D

only the one specified line is deleted.

4-12
Delete Lines
Command

If you omit both parameters, as in:

only the current line is deleted, and the line that


follows becomes the current line.

Example: Assume that you want to edit the following file. The
current line is line 29.

1: This is a sample file


2: used to demonstrate
3: line deletion
4: and dynamic
5: line number generation.



25: See what happens
26: to the lines
27: and line numbers
28: when lines are
29:*deleted.

If you want to delete a range of lines, from 5-25, enter:

5,25 D

The result is:

1: This is a sample file


2: used to demonstrate
3: line deletion
4: and dynamic
5:*to the lines
6: and line numbers
7: when lines are
8: deleted.

4-13
Delete Lines
Command

Lines 5-25 are deleted from the file. Lines 26-29 are
renumbered to 5-8. Line 5 becomes the current line.

If you want to delete the current and the following line,


enter:

,6 0

The result is:

1: This is a sample file


2: used to demonstrate
3: line deletion
4: and dynamic
5:*when lines are
6: deleted.

Lines 5-6 are deleted from the file. Lines 7-8 are
renumbered to 5-6. Line 5 is still the current line, but
now it has different text.

If you want to delete a single line, say line 2, enter:

2 0

The result is:

1: This is a sample file


2:*line deletion
3: and dynamic
4: when lines are
5: deleted.

Line 2 is deleted. Lines 3-6 are renumbered to 2-5.


The new line 2 becomes the current line.

If you want to delete only the current line, enter:

o
4-14
Delete Lines
Command

The result is:

1: This is a sample file


2:*and dynamic
3: when lines are
4: deleted.

The current line, line 2, is deleted. Lines 3-5 are


renumbered to 2-4. The new line 2 becomes the current
line.

4-15
Edit Line
Command

Purpose: Allows you to edit a line of text. You must enter the
line number of the line to be edited, or enter a period
(.) to indicate the current line.

Format: [line]

Remarks: If you just press Enter, you specify that the line after
the current line is to be edited.

The line number and its text are displayed and the line
number is repeated on the line below.

You can use the control keys and the editing keys,
described in Chapter 1, to edit the line, or you can
replace the en tire line by typing new text.

When you press the Enter key, the edited line is placed
in the file and becomes the current line.

If you decide not to save the changed line, either press


Esc or press Ctrl-Break. The original line remains
unchanged. Pressing the Enter key with the cursor at
the beginning of the line has the same effect as
pressing Esc or Ctrl-Break.

If the cursor is in any position other than the beginning


or the end of a line, pressing Enter truncates the rest of
the line.

Example: Assume that you want to edit line 6. The following


display would appear on the screen:

*6
6: This is a sample unedited line.
6:*
4-16
Edit Line
Command

The first line is your request to edit line 6, followed by


the two-line display response.

If you want to move the cursor to the letter u, press F2


and enter:

The result is:

*6
6: This is a sample unedited line.
6: This is a sample_

If you want to delete the next two characters and keep


the remainder of the line, press Del twice; then press
F3.

The result is:

*6
6: This is a sample unedited line.
6: This is a sample edited line._

Now you can take one of the following actions:

• Press Enter to save the changed line.

• Extend the changed line by typing more te'xt. You


are automatically in insert mode when the cursor
is at the end of a line.

• Press F5 to do additional editing to the changed


line without changing the origInal line.

• Press Esc or Ctrl-Break to cancel the changes you


made to the line. The original contents of the line
will be preserved.

4-17
End Edit
Command

Purpose: Ends EDLIN and saves the edited file.

Format: E

Remarks: The edited file is saved by writing it to the drive and


filename specified when you started EDLIN.

The original file, the one specified when EDLIN was


started, is renamed by giving it a .BAK filename
extension. A .BAK file will not be created if there is
no original file; that is, if you created a new file instead
of updating an old file during the editing session.

EDLIN returns to the DOS command processor, which


issues the command prompt.

Note: Be sure your diskette has enough free space


to save the entire file. If your diskette does not
have enough free space, only a portion of the file
is saved. The portion in memory that is not
written to diskette is lost.

4-18
Insert Lines
Command

Purpose: Inserts lines of text immediately before the specified


line.

Format: [line] I

Remarks: If you do not specify a line, or if you specify line as a


period (.), the insert is made immediately before the
current line.

If the line number you specify is greater than the


highest existing line number, or if you specify # as the
line number, the insertion is made after the last line in
memory.

EDLIN displays the appropriate line number so that


you can enter more lines, endin,g each line by pressing
Enter. During the insert mode of operation,
successive line numbers appear automatically each time
Enter is pressed.

You must press Ctrl-Break to discontinue the insert


mode of operation.

The line that follows the inserted lines becomes the


current line, even if the inserted lines are added to the
end of the lines in memory. The current line and all
the remaining lines are renumbered.

When you create a new file, you must enter the Insert
Lines command before text can be inserted.

4-19
Insert Lines
Command

Example: Assume that you want to edit the following file. Line 3
is the current line.

1: This is a sample file


2: used to demonstrate
3:*line deletion
4: and dynamic
5: line number generation.

If you want to insert text before line 4, the entry and


immediate response looks like this:

*41
4:*

Now, if you want to insert two new lines of text, enter:

*4
4:*First new line of text
5:*Second new line of text
6:*

and press Ctrl-Break.

The original lines 4 and 5 are now renumbered to lines


6 and 7.

If you display the file with a List Lines command, the


file looks like this:

1: This is a sample file


2: used to demonstrate
3: line deletion
4: First new line of text
5: Second new line of text
6:*and dynamic
7: line number generation.

4-20
Insert Lines
Command

If the two lines that were inserted had been placed at


the beginning of the file, the screen would look like this:

1: First new line of text


2: Second new line of text
3:*This is a sample file
4: used to demonstrate
5: line deletion
6: and dynamic
7: line number generation.

If the two lines that were inserted had been placed


immediately before the current line (3 I or . I or I), the
screen would look like this:

1: This is a sample file


2: used to demonstrate
3: First new line of text
4: Second new line of text
5:*line deletion
6: and dynamic
7: line number generation.

If the two inserted lines had been placed at the end of


the file (6 I or # I), the screen would look like this:

1: This is a sample file


2: used to demonstrate
3: line deletion
4: and dynamic
5: line number generation.
6: First new line of text
7: Second new line of text

4-21
List Lines
Command

Purpose: Displays a specified range of lines.

The current line remains unchanged.

Format: [line] [,line] L

Remarks: Default values are provided if either one or both of the


parameters are omitted.

If you omit the first parameter, as in:

,line L

the display starts 11 lines before the current line and


ends with the specified line. The beginning comma is
required to indicate the omitted first parameter.

Note: If the specified line is more than 11 lines


before the current line, the display is the same as
if you omitted both parameters. (An example
is provided in this section showing both
parameters omitted.)

If you omit the second parameter, as in:

line L

or

line, L

a total of 23 lines are displayed, starting with the


specified line.

4-22
List Lines
Command

If you omit both parameters, as in:

a total of 23 lines are displayed-the 11 lines before the


current line, the current line, and the 11 lines after the
current line. If there aren't 11 lines before the current
line, the extra lines after the current line are displayed
to make a total of 23 lines.

Example: Assume that you want to edit the following file. Line 15
is the current line.

1: This is a sample file


2: used to demonstrate
3: line deletion
4: and dynamic
5: line number generation.



15:*This is the current line (note the asterisk)



25: See what happens
26: to the lines
27: and line numbers
28: when lines are
29: deleted.

If you want to display a range of lines, from 5-25, enter:

5,25 l

4-23
List Lines
Command

The screen looks like this:

5: line number generation.





15:*This is the current line (note the asterisk)



25: See what happens

If you want to display the first three lines, enter:

1,3 L

The screen looks like this:

1: This is a sample file


2: used to demonstrate
3: line deletion

If you want to display 23 lines of the file, starting with


line 3, enter:

3 L

The screen looks like this:

3: line deletion
4: and dynamic
5: line number generation.



15:*This is the current line (note the asterisk)



25: See what happens

4-24
List lines
Command

If you want to display 23 lines centered around the


current line, enter:

The screen looks like this:

4: and dynamic
5: line number generation.



15:*This is the current line (note the asterisk)



25: See what happens
26: to the lines

4-25
Quit Edit
Command

Purpose: Quits the editing session without saving any changes


you may have entered.

Format: Q

Remarks: EDLIN prompts you to make sure you really don't


want to save the changes.

Enter Y if you want to quit the editing session. No


editing changes are saved and no .BAK file is created.
Refer to the End Edit command for information about
the .BAK file.

Enter N, or any other character, if you want to


continue the editing session.

Note: When started, EDLIN erases any previous


backup copy of the file (filename .BAK) to make
room for saving the new copy. Therefore, if you
reply Y to the Abort edit (YIN)? message, your
previous backup copy will no longer exist.

Example: Q
Abort edit (V IN)?_

4-26
Replace Text
Command

Purpose: Replaces all occurrences of the first string in the


specified range of lines with the second string.

Note: If you omit the second string, Replace


Text deletes all occurrences of the first string
within the specified range of lines.

Displays the changed lines each time they are changed.


The last line changed becomes the current line.

Format: [line] [,line] [?] Rstring[<F6>string]

Remarks: You can specify the optional parameter? to request a


prompt (O.K.?) after each display of a modified line.
Press the Y, or the Enter key if you want to keep the
modification.

Enter any other character if you don't want the


modification. In either case, the search continues for
further occurrences of the first string within the range
of lines, including multiple occurrences within the
same line.

Defaults occur if either one or both of the parameters


is missing.

If you omit the first line, the search begins with line 1.
If you omit the second line, the search ends with the
last line in memory. If you omit both line parameters,
the system will search all the lines in memory for
occurrences of the first string.

4-27
Replace Text
Command

Note: The first string begins with the character in


the position immediately following the R, and
continues until you press F6 or Ctrl-Z (or by
pressing the Enter key if the second string is
omitted). If you omit the first string, no search
can be made, so the command ends immediately
and the Not found message is displayed.

The second string begins immediately after you


press F6 or Ctrl-Z and continues until you press
Enter.

Example: Assume that you want to edit the following file. Line 7
is the current line.

1: This is a sample file


2: used to demonstrate
3: the Replace and Search Text commands.
4: This includes the
5: optional parameter ?
6: and required string
7:*parameter.

To replace all occurrences of and with or in the file,


enter:

1,7 Rand

Then press F 6, type or, and press Enter.

The result is:

3: The Replace or Search Text commors.


6: or required string

Line 6 becomes the current line in the file because line b


was the last line changed. Notice that lines 1,2,4,5,
and 7 are not displayed because they were not changed.
4-28
Replace Text
Command

Greater selectivity can be achieved by requesting a


prompt (by using the? parameter) after each display of
a modified line. If you request a prompt, the screen
100 ks like this:

*1,7?Rand (Press F6, type Of, and press Enter)


3: the Replace or Search Text commands.
O.K.? V
3: the Replace or Search Text commors.
O.K.? N
6: or required string
O.K.? V
*
Lines 3 and ~ are displayed like this:

3: the Replace or Search Text commands.


6: or required string

4-29
Search Text
Command

Purpose: Searches a specified range of lines in order to locate a


specified string.

Format: [line] [,line] [?] Sstring

Remarks: The first line to contain the specified string is displayed


and the search ends (unless you use the? parameter).
The first line found that matches the specified string
becomes the current line.

Note: The SEARCH command always searches


for the exact same character in text. That is, it
searches for UPPERCASE if you enter
UPPERCASE, and lowercase if you enter
lowercase.

You should specify the optional parameter? if you


would like a prompt (O.K.?) after each display of a
line containing the specified string.

If the specified string is not found, the search ends and


the message Not found is displayed. The current line
remains unchanged.

If you enter Y or press the En ter key, the line that


matches the specified string becomes the current line
and the search ends. Enter any other character to
continue the search until another string is found, or
until all lines within the range are searched. Once all
the lines within the range are searched, the Not found
message is displayed.

4-30
Search Text
Command

The system provides default values if you omit the first,


second, or both line parameters. If you omit the first
line parameter, the system defaults to line 1. If you
omit the second line parameter, the system defaults to
the last line in your file. If you omit both line
parameters, the system searches all lines in memory.

Note: The string begins with the character in the


position immediately following the S, and continues
until you end the search by pressing the Enter key.
If the string parameter is omitted, no search can
be made so the command ends immediately with
the Not found message.

Example: Assume that you want to edit the following file. Line 7
is the current line.

1: This is a sample file


2: used to demonstrate
3: the Search Text command.
4: This includes the
5: optional parameter ?
6: and required string
7:*parameter.

If you want to search for the first occurrence of and in


the file, enter:

1,7 Sand
or
1, Sand
or
,7 Sand
or
Sand

4-31
Search Text
Command

The result is:

3: the Search Text command.


*
The and is part of the word command. Notice that line
3 becomes the current line in the file.

Perhaps this is not the and you were looking for. To


continue the search; enter a new starting line num ber
(4); press F3 to copy the remainder of the previous S
command to the screen; then press Enter to execute
the S command starting at line 4.

The screen looks like this:

*1,7 Sand
3: the Search Text command.
*4,7 Sand
6: and required string
*
Line 6 now becomes the current line in the file.

You can also search for strings by requesting a prompt


(by means of the? parameter) after each display of a
matching line. In this case, the screen looks like this:

*1,7 ? Sand
3: the Search Text command.
O.K.? N
6: and required string
O.K.? Y
*

4-32
Write Lines
Command

Purpose: Writes a specified number of lines to diskette from the


lines that are being edited in memory. Lines are written
beginning with line number 1.

Format: [n] W

Remarks: This command is only meaningful if the file you are


editing is too large to fit in memory. When you start
EDLIN, EDLIN reads lines into memory untiL memory
is 75% full.

To edit the remainder of your file, you must write


edited lines in memory to diskette before you can load
additional unedited lines from diskette into memory by
using the Append Lines command.

Note: If you do not specify the number of lines,


lines are written until 25% of available memory is
used. No action is taken if available memory is
already less than 25% used. All lines are
renumbered so that the first remaining line
becomes number 1.

4-33
Summary of EDLIN Commands

The following chart is provided for quick reference.

Note: The section called "Format Notation" in


Chapter 3 explains the notation used in the
format of the following commands.

Command Fonnat

Append Lines [n] A

Delete Lines [line] [,line] D

Edit Line [line]

End Edit E

Insert Lines [line] I

List Lines [line] [,line] L

Quit Edit Q

Replace Text [line] [,line] [?] Rstring [<F6>string]

Search Text [line] [,line] [?] Sstring

Write Lines [n] W

Figure 2. EDLIN Commands

4-34
CHAPTER 5. THE LINKER (LINK)
PROGRAM

Contents
Introduction 5-3

Files 5-4
Input Files 5-4
Output Files 5-4
VM.TMP (Temporary File) 5-5

Definitions . 5-6
Segment 5-6
Group . 5-7
Class . . 5-7

Command Prompts 5-8

Detailed Descriptions of the Command


Prompts . . . . . . . . . . . 5-10
Object Modules [.OB]]: . 5-10
Run File [filespec.EXE] : 5-11
List File [NUL.MAP] : 5-11
Libraries [.LIB] : 5-12
Linker Parameters . . 5-13

How to Start the Linker Program 5-17


Before You Begin . . . . . 5-17
Option 1 - Console Responses 5-17
Option 2 - Command Line . . 5-18
Option 3 - Automatic Responses 5-20

Example Linker Session . . . . . . . 5-22


Load Module Memory Map . . . 5-26
How to Determine the Absolute Address
of a Segment 5-27
Messages . . . . . . . . . . . . . . . .. 5-28

5-1
5-2
mtroduction

The linker (LINK) program is a program that:

• Combines separately produced object modules

• Searches library files for definitions of unresolved


external references

• Resolves external cross-references

• Produces a printable listing that shows the


resolution of external references and error messages

• Produces a relocatable load module

In this chapter, we show you how to use LINK. You


should read all of this chapter before you start LINK.

5-3
Files

The linker processes the following input, output, and


tern porary files:

Input Files

Default Override Produced


Type .ext .ext by

Object .OB] Yes Com piler! or


MACRO Assembler

Library .LIB Yes Compiler

Automatic (None) NjA* User


Response

Figure 3. Input Files Used by the Linker

*Nj A-Not applicable.

Output Files

Default Override
Type .ext .ext Used by

Listing .MAP Yes User

Run .EXE No Relocatable loader


(COMMAND.COM)

Figure 4. Output Files Used by the Linker

lOne of the optional compiler packages available for use with the IBM
Personal Computer DOS.

5-4
VM.TMP (Temporary File)
LINK uses as much memory as is available to hold the
data that defines the load module being created. If the
module is too large to be processed with the available
amount of memory, the linker may need additional
memory space. If this happens, a temporary diskette
file called VM.TMP is created on the DOS default
drive.

When the overflow to diskette has begun, the linker


displays the following message:

VM.TMP has been created


Do not change diskette in drive z

Once this temporary file is created, you should not


remove the diskette until LINK ends. When LINK
ends, it erases the VM.TMP file.

If the DOS default drive already has a file by the name


of VM.TMP, it will be deleted by LINK and a new file
will be allocated; the contents of the previous file are
destroyed. Therefore, you should avoid using VM.TMP
as one of your own filenames.

5-5
Definitions

Segment, group, and class are terms that appear in this


chapter and in some of the messages in Appendix A.
These terms describe the underlying function of LINK.
An understanding of the concepts that define these
terms provides a basic understanding of the way LINK
works.

Segment
A segment is a contiguous area of memory up to
64K-bytes in length. A segment may be located
anywhere in memory on a paragraph (16-byte)
boundary. Each of the four segment registers defines
a segment. The segments can overlap. Each 16-bit
address is an offset from the beginning of a segment.
The contents of a segment are addressed by a
segment register/offset pair.

The contents of various portions of the segment are


determined when machine language is generated.

Neither size nor location is necessarily fixed by the


machine language generator because this portion of the
segment may be combined at link time with other
portions forming a single segment.

A program's ultimate location in memory is determined


at load time by the relocation loader facility provided
in COMMAND.COM, based on whether you specified
the /HIGH parameter. The /HIGH parameter is
discussed later in this chapter.

5-6
Group
A group is a collection of segments that fit together
within a 64K-byte segment of memory. The segments
are named to the group by the assembler or compiler.
A program may consist of one or more groups.

The group is used for addressing segments in memory.


The various portions of segments within the group are
addressed by a segment base pointer plus an offset.
The linker checks 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 affects the order and relative
placement of segments in memory. The class name is
specified by the assembler or compiler. All portions
assigned to the same class name are loaded into
memory contiguously.

The segments are ordered within a class in the order


that the linker encounters the segments 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 LINK. Classes are not
restricted in size. The classes are divided into groups
for addressing.

5-7
Command Prompts

After you start the linker session, you receive a series


of four prompts. You can respond to these prompts
from the keyboard, respond to these prompts on the
command line, or you can use a special diskette file
called an automatic response file to respond to the
prompts. An example of an automatic response file is
provided in this chapter. Refer to the section called
"How to Start the Linker Program" in this chapter for
information on how to start the linker session.

LINK prompts you for the names of the object, run,


list, and library files. When the session is finished,
LINK returns to DOS and the DOS prompt is
displayed. If linking is unsuccessful, LINK displays a
message.

The prompts are described in order of their appearance


on the screen. Defaults are shown in square brackets
([ ] ) after the prompt. In the response column of the
table, square brackets indicate optional entries. Object
Modules is the only prompt that requires a response
from you.

Prompt Responses

Object Modules [.OBJ] : filespec [+filespec] ...

Run File [filespec.EXE] : [filespec] UP]

List File [NUL.MAP] : [filespec]

Libraries [.LIB] : [filespec [+filespec] ... ]

5-8
Notes:

1. If you enter a file specification without


specifying the drive, the default drive is
assumed. The libraries prompt is an
exception - the default drive for the libraries
is determined by the compiler.

2. You can end the linker session prior to its


normal end by pressing CtrI-Break.

5-9
Detailed Descriptions of the
Command Prompts

The following detailed descriptions contain information


about the responses that you can enter to the prompts.

Object Modules [.OBJ] :


Enter one or more file specifications for the object
modules to be linked. Multiple file specifications must
be separated by single plus (+) signs or blanks. If the
extension is omitted from any filename, LINK
assumes the filename extension .OBJ. If an object
module has a different filename extension, the
extension must be specified. Object filenames may
not begin with the @ symbol (@ is reserved for using
an automatic response file).

LINK loads segments into classes in the order


encountered.

If you specify an object module, but LINK cannot


locate the file, it displays the following prompt:

Cannot find file filespec


change diskette <hit ENTER>

You should insert the diskette containing the requested


module. This permits .OBJ files from several diskettes
to be included. On a single-drive system, diskette
exchanging can be done safely only if VM.TMP has not
been opened. As explained in the discussion of the
VM.TMP file earlier in this chapter, a message will
indicate if VM.TMP has been opened.

IMPORTANT: If a VM.TMP file has been opened, you


should not remove the diskette containing the VM.TMP
file. Remember, once a VM.TMP file is opened, the
diskette it resides on cannot be removed.

5-10
After a VM.TMP file has been opened, if you specified
an object module on the same drive that VM.TMP
is on and LINK cannot find it, the linker session ends
with the message:

Fatal error
Cannot find file filespec

Run File [filespec.EXE] :


The file specification you enter is created to store the
run (executable) file that results from the LINK
session. All run files receive the filename extension
.EXE, even if you specify another extension. If you
specify another extension, your specified extension
is ignored.

The default filename for the run file prompt is the first
filename specified on the object module prompt.

List File [NUL.MAP] :


The linker list file is sometimes called the linker map.

The list file is not created unless you specifically


request it. You can request it by overriding the default
with a file specification or a device name. If you do
not include a filename extension, the default
extension .MAP is used. If you do not enter a file
specification, the DOS reserved filename NUL
specifies that no list file will be created.

The list file contains an entry for each segment in the


input (object) modules. Each entry also shows the
offset (addressing) in the run file.

5-11
Note: If the list file is allocated to a file on
diskette, that diskette must not be removed until
the LINK has ended.

If you specify an object module on the same drive as


the drive to which the list file is allocated, and LINK
cannot find it, the linker session ends with the message:

Fatal error
Cannot find file filespec

To avoid generating the list file on a diskette, you can


specify the display or printer as the list file device.
For example:

List File [NUL.MAP]: CON

If you direct the output to your display, you can also


print a copy of the output by pressing Ctrl-PrtSc.

Libraries [. LIB] :
You may either list the file specifications for your
libraries, or just press the Enter key. If you press the
Enter key, LINK defaults to the library provided as part
of the Compiler package. The Compiler package also
provides the location of the library. For linking
objects from just the MACRO Assembler, there is
no automatic default library search.

If you answer the library prompt, you specify a list of


drive IDs and file specifications separated by plus signs
(+) or spaces. You can enter from one to eight library
file specifications. A drive ID tells the linker where to
look for all subsequen t libraries on the library prompt.
The automatically searched library file specifications
are conceptually placed at the end of the response to
the library prompt.

5-12
LINK searches the library files in the order in which
they are listed to resolve external references. When
LINK finds the module that defines the external
symbol, the module is processed as another object
module.

If two or more libraries have the same filename,


regardless of the location, only the first library in the
list is searched.

When LINK cannot find a library file, it displays a


message like this:

Cannot find library A:library.LlB


Enter new dtive letter:

The drive that the indicated library is located on must


be entered.

The following library prompt responses may be used:

libraries [.LlB]: B:

Look for compiler.LIB on drive B.

libraries [.LlB]: B:USERLIB

Look for USERLIB on drive Band


com piler. LIB on drive A.

libraries l.LI B]: A: LlB1+LlB2+B: LlB3+A:

Look for LIB I.LIB and LIB2.LIB on drive


A, LIB3.LIB on drive B, and
compiler.LIB on drive A.

Linker Parameters
At the end of any of the four linker prompts, you may
specify one or more parameters that instruct the linker
to do something differently. Only the / and first letter
of any parameter are required.

5-13
/DSALLOCATION

The /DSALLOCATION (jD) parameter directs LINK


to load all data defined to be in DGROUP at the high
end of the group. If the /HIGH parameter is specified,
(module loaded high), this allows any available storage
below the specifically allocated area within DGROUP
to be allocated dynamically by your application and
still be addressable by the same data space pointer.

Note: The maximum amount of storage which


can be dynamically allocated by the application
is 64K (or the amount actually available) minus
the allocated portion of DGROUP.

If the /DSALLOCATION parameter is not specified,


LINK loads all data defined to be in the group whose
group name is DGROUP at the low end of the group,
beginning at an offset of O. The only storage thus
referenced by the data space pointer should be that
specifically defined as residing in the group.

All other segments of any type in any GROUP other


than DGROUP are loaded at the low end of their
respective groups, as if the /DSALLOCATION
parameter were not specified.

For certain compiler packages, /DSALLOCATION is


automatically used.

/HIGH

The /HIGH (jH) parameter causes the loader to place


the run image as high as possible in storage. If you
specify the /HIGH parameter, you tell the linker to
cause the loader to place the run file as high as possible
without overlaying the transient portion of
COMMAND.COM, which occupies the highest area
of storage when loaded. If you do not specify the
/HIGH parameter, the linker directs the loader to place
the run file as low in memory as possible.

5-14
The /HIGH parameter is used with the
/DSALLOCATION parameter.

/LINE

For certain IBM Personal Computer language processors,


the /LINE (jL) parameter directs LINK to include the
line numbers and addresses of the source statements in
the input modules in the list file.

/MAP

The /MAP (jM) parameter directs LINK to list all


public (global) symbols defined in the input modules.
For each symbol, LINK lists its value and segment-
offset location in the run file. The symbols are listed
at the end of the list file.

/PAUSE

The /PAUSE (jP) parameter tells LINK to display a


message to you as follows:

. About to generate .EXE file


Change disks <hit ENTE R>

This message allows you to insert the diskette that is to


con tain the run file.

5-15
ISTACK:size

The size entry is any positive decimal value up to


65536 bytes. This value is used to override the size of
the stack that the MACRO Assembler or compiler has
provided for the load module being created. If you
specify a value greater than 0 but less than 512, the
value 512 is used.

If you do not specify 1ST ACK (/S), the original stack


size provided by the MACRO Assembler or com piler
is used.

If the size of the stack is too small, the results of


executing the resulting load module are unpredictable.

At least one input (object) module must contain a


stack allocation statement. This is automatically
provided by compilers. For the MACRO Assembler,
the source must contain a SEGMENT command that
has the combine type of STACK. If a stack allocation
statement was not provided, LINK returns a Warning:
No Stack statement message.

5-16
How to S tart the Linker Program

Before You Begin


• Make sure the files you will be using for linking
are on the appropriate diskettes.

• Make sure you have enough free space on your


diskettes to contain your files and any generated
data.

You can start the linker program by using one of three


options:

Option I-Console Responses


From your keyboard, enter:

LINK

The linker is loaded into memory and displays a series


of four prompts, one at a time, to which you must
enter the requested responses. (Detailed descriptions
of the responses that you can make to the prompts
are discussed in this chapter in the section called
"Command Prompts.")

If you enter an erroneous response, such as an


incorrectly spelled file specification, you must press
Ctrl-Break to exit LINK, then restart LINK. If the
response in error has been typed but you haven't
pressed Enter yet, you may delete the erroneous
characters (on that line only). ;.,j

An example of a linker session using the console


response option is provided in this chapter in the
section called "Example Linker Session."

5-17
As soon as you have entered the last filename, the linker
begins to run. If the linker finds any errors, it displays
the errors on the screen as well as in the listing file.

Note: After any of these responses, before pressing


Enter, you may continue the response with a
comma and the answer to what would be the next
prompt, without having to wait for that prompt.
If you end any with the semicolon (;), the
remaining responses are all assumed to be the
default. Processing begins immediately with no
further prompting.

Option 2-Command Line


From your keyboard, enter:

LINK objlist,runfile,mapfile,liblist [parm] ... ;

objlist is a list of object modules separated by spaces


or plus signs (+).

runfile is the name you want to give the run file.

mapfile is the name you want to give the linker map.

lib lis t is a list of the libraries to be used, separated


by plus signs (+) or spaces.

parm is an optional linker parameter. Each


parameter must begin with a slash (j).

The linker is loaded and immediately performs the tasks


indicated by the command line.

5-18
When you use this command line, the prom pts
described in Option I are not displayed if you specified
an entry for all four files or if the command line ends
with a semicolon.

If an incomplete list is given and no semicolon is used,


the linker prompts for the remaining unspecified files.
The parms are never prompted for, but may be added
to the end of the command line or to any file
specification given in response to a prompt. Each
prompt displays its default, which may be accepted by
pressing the Enter key, or overridden with an explicit
filename or device name. However, if an incomplete
list is given and the command line is terminated with a
final semicolon, the unspecified files default without
further prompting.

Certain variations of this command line are permitted.

Examples:

LINK module
The object module is MODULE.OB]. A
prompt is given, showing the default of
MODULE.EXE. After the response is
entered, a prompt is given showing the
default of NUL.MAP. After the response
is given, a prompt is displayed showing
the default extension of .LIB.

LINK module;
If the semicolon is added, no further
prompts are displayed. The object
module of MODULE.OB] is linked, the
run file is put into MODULE.EXE, and no
list file is produced.

5-19
LINK module,,;
This is similar to the preceding example,
except the list file is produced in
MODULE.MAP.

LINK module"
Using the same example, but without the
semicolon, MODULE.OBJ is linked, and the
run file is produced in MODULE.EXE, but
a prompt is given with the default of
MODULE.MAP.

LINK module"NUL;
No list file is produced. The run file is in
MODULE.EXE. No further prompts are
displayed.

Option 3-Automatic Responses


It is often convenient to save responses to the linker
for use at a later time. This is especially useful when
long lists of object modules need to be specified.

Before using this option, you must create the


automatic response file. It contains several lines of
text, each of which is the response to a linker prompt.
These responses must be in the same order as the
linker prompts that were discussed earlier in this
chapter. If desired, a long response to the object
module or libraries prompt may be contained on
several lines by using a plus sign (+) to continue the
same response onto the next line.

To specify an automatic response file, you enter a file


specification preceded by an @ symbol in place of a
prompt response or part of a prompt response. The
prompt is answered by the contents of the diskette file.
The file specification may not be a reserved DOS
filename.

5-20
From your keyboard, enter:

LIN K @filespec

Use of the filename extension is optional and may be


any name. There is no default extension.

Use of this option permits the command that starts


LINK to be entered from the keyboard or within a
batch file without requiring any response from you.

Example

Automatic Response File-RESP 1

MO DA+MO DB+MO DC+


MODB+MODE+MODF

Automatic Response File-RESP2

runfile/p
printout

Command line

LINK @RESP1+mymod,@RESP2;

Notes:

1. The plus sign at the end of the first lines in


RESP 1 causes the modules listed in the first
two lines to be considered as the input object
modules. After reading RESPl, the linker
returns to the command line and sees +mymod,
so it includes MYMOD.OBJ in the list of
object modules as well.

2. Each of the above lines ends when you press


the Enter key.

5-21
Example Linker Session

This example shows you the type of information that is


displayed during- a linker session.

Once we enter:

b:link

in response to the DOS prompt, the system responds


with the following messages and prompts, which we
answer as shown:

IBM Personal Computer Linker


Version 1.10 (C) Copyright IBM Corp 1982
Object Modules [.OBJ]: example
Run File [EXAMPLE.EXE]: Imap
List File [N UL.MAP]: pm/line
Libraries (.LI B] :

Notes:

1. By specifying /map, we get both an alphabetic


listing and a chronological listing of public
symbols.

2. By responding prn to the list file prompt,


we send our output to the printer.

3. By specifying the /LINE parameter, LINK


gives us a listing of all line numbers for all
modules. (The /LINE parameter can generate
a large amount of output.)

4. By just pressing Enter in response to the


Libraries prompt, an automatic library search
is performed.

5-22
Once LINK locates all libraries, the linker map displays
a list of segments in the relative order of their
appearance within the load module. The list looks like
this:

Start Stop Length Name Class

OOOOOH 00028H 0029H MAINnO CODE


00030H 000F6H 00C7H ENTXnn CODE
00100H 00100H OOOOH INIXOn CODE
00100H 038D3H 37D4H FILVOO_CODE CODE
038D4H 04921 H 104EH FILUOn_CODE CODE



074AOH 074AOH OOOOH HEAP MEMORY
074AOH 074AOH OOOOH MEMORY MEMORY
074AOH 0759FH 0100H STACK STACK
075AOH 07925H 0386H DATA DATA
07930H 082A9H 097AH CONST CONST

The information in the Start and Stop columns shows a


20-bit 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
of where these segments are loaded. To find the absolute
address of where a segment is actually loaded, you must
determine where the segment listed as being at
relative zero is actually loaded; then add the absolute
address to the relative address shown in the linker map.
The procedure you use to determine where relative zero
is actually located is discussed in this chapter, in the
section called "How to Determine the Absolute Address
of a Segment."

5-23
Now, because we specified the IMAP parameter, the
public symbols are displayed by name and by value.
For example:

Address Publics by Name

0492:0003H ABSNnn
06CD:029FH ABSRnn
0492:00A3H ADDNnn
06CD:0087H ADDRnn
0602:000FH ALLHnn



0010:1BCEH WT4Vnn
0010:1D7EH WTFVnn
0010:1887H WTIVnn
0010:19E2H WTNVnn
0010:11B2H WTRVnn

Address Publics by Value

OOOO:OOO1H MAIN
OOOO:OO10H ENTGnn
OOOO:OO10H MAINnn
0OO3:0000H BEGXnn
0OO3:0095H ENDXnn



F82B: F31 CH CRCXnn
F82B:F31 EH CRDXnn
F82B: F322H CESXnn
F82B:F5B8H FNSUnn
F82B:F5EOH OUTUnn

5-24
The addresses of the public symbols are in the
segment:o!!set format, showing the location relative
to zero as the beginning of the load module. In some
cases, an entry may look like this:

F8CC:EBE2H

This entry appears to be the address of a load module


that is almost one megabyte in size. Actually, the
area being referenced is relative to a segment base that
is pointing to a segment below the relative zero
beginning of the load module. This condition
produces a pointer that has'effectively gone negative.
The memory map which follows illustrates this point.

When LINK has completed, the following message is


displayed:

Program entry point at 0003: 0000

5-25
Load Module Memory Map

Low Memory

Relat ive to the load


Data Segment
~modu Ie, this
Base ~
~- -- - - location is below
zero, or negative

64K Segment

Data elements have


large offsets from
the data segment
.. Data Area
.. Relative Zero

bases
Load Module
Code

I.)

High Memory

5-26
How to Determine the Absolute Address of a Segment
The linker map displays a list of segments in the relative
order of their appearance within the load module: The
information displayed shows a 20-bit hex address of
each segment relative to location zero. The addresses
that are displayed are not the absolute addresses of
where these segments are actually located. To
determine where relative zero is actually located, we
must use DEBUG. DEBUG is described in detail in
Chapter 6.

Using DEBUG,

1. Load the application.

Note the segment value in CS and the offset


within that segment to the entry point as shown
in IP. The last line of the linker map also
describes this entry point, but uses relative
values, not the absolute values shown by CS and
IP.

2. Subtract the relative entry as shown at the end of


the map listing from the CS:IP value. For
example, let's say CS is at 05DC and IP is at zero.

The linker map shows the entry point at


0100:0000. (0100 is a segment ID or paragraph
number; 0000 is the offset into that segment.)

In this example, relative zero is located at


04DC:0000, which is 04DCO absolute.

If a program is loaded low, the relative zero location is


located at the end of the Program Segment Prefix, in
the location DS plus 100R.

5-27
Messages
All messages, except for the warning messages, cause
the LINK session to end. Therefore, after you locate
and correct a problem, you must rerun LINK.

Messages appear both in the list file and on the display


unless you direct the list file to CON, in which case
the display messages are suppressed.

All of the linker messages are included in Appendix A.

5-28
CHAPTER 6. THE DEBUG PROGRAM

Contents
Introduction 6-3

How to Start the DEBUG Program 6-4

The DEBUG Command Parameters 6-6

The DEBUG Commands . . . . . 6-11


Information Common to All DEBUG
Commands. 6-11

Compare Command 6-13

Dump Command 6-14

. Enter Command 6-17

Fill Command 6-20

Go Command. 6-21

Hexarithmetic Command 6-24

Input Command 6-25

Load Command . 6-26

Move Command 6-29

Name Command 6-30

Ou tput Command · 6-32

Quit Command . . · 6-33

Register Command · 6-34

Search Command · 6-39

Trace Command · 6-40


6-1
Unassemble Command 6-42

Write Command 6-45

Summary of DEBUG Commands 6-49

6-2
Introduction

This chapter explains how to use the DEBUG program.

The DEBUG program can be used to:

• Provide a controlled test environment so you can


monitor and control the execution of a program
to be debugged. You can fix problems in your
program directly, and then execute the program
immediately to determine if the problems have
been resolved. You do not need to reassem ble a
program to find out if your changes worked.

• Load, alter, or display any file.

• Execute object files. Object files are executable


programs in machine language format.

6-3
How to Start the DEBUG Program

To start DEBUG, enter:

DEBUG [filespec] [parm 1] [parm 2]

If you enter filespec, the DEBUG program loads the


specified file into memory. You may now enter
commands to alter, display, or execute the contents
of the specified file.

If you do not enter a filespec, you must either work with


the present memory contents, or load the required file
into memory by using the Name and Load commands.
Then you can enter commands to alter, display, or
execute the memory contents.

The optional parameters, parm 1 and parm 2, represent


the optional parameters for the named filespec. For
example,

DEBUG DISKCOMP.COM A: B:

In this command, the A: and B: are the parameters that


DEBUG prepares for the DISKCOMP program.

When the DEBUG program starts, the registers and flags


are set to the following values for the program being
debugged:

• The segment registers (CS, DS, ES, and SS) are set
to the bottom of free memory; that is, the first
segment after the end of the DEBUG program.

• The Instruction Pointer (IP) is set to X'D 100'.

• The Stack Pointer (SP) is set to the end of the


segment, or the bottom of the transient portion of
COMMAND.COM, whichever is lower. The segment
size at offset 6 is reduced by X' 100' to allow for a
stack of that size.

6-4
• The remaining registers (AX, BX, ex, DX, BP, SI,
and DI) are set to zero. However, if you start the
DEBUG program with a filespec, the ex register
contains the length of the file in bytes. If the file
is greater than 64K, the length is con tained in
registers BX and ex (the high portion in BX).

• The flags are set to their~ cleared values. (Refer to


the Register command.)

• The default disk transfer address is set to X' 80' in


the code segment.

Notes:

1. If a file loaded by DEBUG has an


extension of .EXE, DEBUG does the
necessary relocation and sets the segment
registers, stack pointer, and Instruction
Pointer to the values defined in the file.
The DS and ES registers, however, point to
the Program Segment Prefix at the lowest
available segment. The BX and ex registers
contain the size of the program (smaller than
the file size).

The program is loaded at the high end of


memory if the appropriate parameter
was specified when the linker created the
file. Refer to ".EXE File Structure and
Loading" in Appendix F for more
information about loading .EXE files.

2. If a file loaded by DEBUG has an


extension of .HEX, the file is assumed
to contain ASeII representation of
hexadecimal characters, and is converted
to binary while being loaded.

6-5
The DEBUG Command Parameters

Parameter Definition

address Enter a one- or two-part designation in one of


the following formats:

• An alphabetic segmen t register designation,


plus an offset value, such as:

CS:OIOO

• A segment address, plus an offset value,


such as:

4BA:OIOO

• An offset value only, such as:

100

(In this case, each command uses a default


segment.)

Notes:

1. In the first two formats, the colon is


required to separate the values.

2. All numeric values are hexadecimal


and may be entered as 1-4 characters.

3. The memory locations specified in


address must be valid; that is, they
must actually exist. Unpredictable
results will occur if an attempt is
made to access a nonexistent memory
location.

byte Enter a one or two character hexadecimal value.

6-6
Parameter Definition

drive Enter a single digit (for example, a for drive A


or 1 for drive B) to indicate which drive data is
to be loaded from or written to.

(Refer to the Load and Write commands.)

filespec Enter a one- to three-part file specification


consisting of a drive designation, filename, and
filename extension. All three fields are optional.
However, for the Name command to be
meaningful, you should at least specify a drive
designator or a filename.

(Refer to the Name command.)

list Enter one or more byte and/or string values.


For example:

E CS: 100 F3 'XYZ' 8D 4 "abed"

has five items in the list (that is, three byte


entries and two string entries having a total of
10 bytes).

portaddress Enter a 1-4 character hexadecimal value to


specify an 8- or l6-bit port address.

(Refer to the Input and Output commands.)

range Enter either of the following formats to specify


the lower and upper addresses of a range:

• address address

For example:

CS: 100 110

Note: Only an offset value is allowed in


the second address. The addresses must
-
be separated by a space or a comma.

-
6-7
Parameter Definition

range • address L value

where value is the number of bytes in


hexadecimal to be processed by the
command. For example:

CS:I00 L 11

Notes:

1. The limit for range is X' 10000'. To


specify that value within four
hexadecimal characters, enter 0000
(or 0).

2. The memory locations specified in


range must be valid; that is, they must
actually exist. Unpredictable results
will occur if an attempt is made to
access a non-existent memory location.

registername Refer to the Register command.

sector sector Enter 1-3 character hexadecimal values to


specify:

1. The starting relative sector number

2. The number of sector numbers

to be loaded or written.

In DEBUG, relative sectors are sequentially


numbered from 0-13F, beginning at track
0, sector 1, side O. Relative sectors
140-27F refer to the sectors on side 1 of a
dual sided diskette, beginning at track 0,
sector 1.

6-8
Parameter Definition

sector sector The maximum number of sectors that can be


loaded or written with a single command is
X'80'. A sector contains 512 bytes.

(Refer to the Load and Write commands.)

string Enter characters enclosed in quotation marks.


The quotation marks can be either single (') or
double (").

The ASCII values of the characters in the string


are used as a list of byte values.

Within a string, the opposite set of quotation


marks can be used freely as characters. However,
if the same set of quotation marks (as the
delimiters) must be used within the string, then
the quotation marks must be doubled. The
doubling does not appear in memory. For
example:

1. 'This "literal" is correct'

2. 'This' 'literal' ' is correct'

3. 'This 'literal' is not correct'

4. 'This" "literal" " is not correct'

5. "This 'literal' is correct"

6. "This" "literal" " is correct"

7. "This "literal" is not correct"

8. "This' 'literal' ' is not correct"

In the second and sixth cases above, the word


literal is enclosed in one set of quotation marks
in memory. In the fourth and eighth cases
above, the word literal is not correct unless you
really want it enclosed in two sets of quotation
marks in memory.

6-9
Parameter Definition

value Enter a 1-4 character hexadecimal value to


specify:

• The numbers to be added and subtracted


(refer to the Hexarithmetic command), or

• The number of instructions to be executed


by the Trace command, or

• The number of bytes a command should


operate on. (Refer to the Dump, Fill,
Move, Search, and Unassemble commands.)

6-10
The DEBUG Commands

This section presents a detailed description of how to


use the commands to the DEBUG program. The
commands appear in alphabetical order; each with its
format and purpose. Examples are provided where
appropriate.

Information Common to All DEBUG Commands


The following information applies to the DEBUG
commands:

• A command is a single letter, usually followed by


one or more parameters.

• Commands and parameters can be entered in


uppercase or lowercase, or a com bination of
both.

• Commands and parameters may be separated


by delimiters. Delimiters are only required,
however, between two consecutive hexadecimal
values. Thus, these commands are equivalent:

des: 100 110


des: 100 110
d,es: 100,110

• Press Ctrl-Break to end commands.

• Commands become effective only after you press


the Enter key.

• For commands producing a large amount of


output, you can press Ctrl-NumLock to suspend
the display to read it before it scrolls away. Press
any other character to restart the display.

6-11
• You can use the control keys and the DOS editing
keys, described in Chapter I, while using the
DEBUG program.

• If a syntax error is encountered, the line is


displayed with the error pointed out as follows:

des: 100 CS: 11 0


;\ error

In this case, the Dump command is expecting the


second address to contain only a hexadecimal
offset value. It finds the S, which is not a valid
hexadecimal character.

• The prompt from the DEBUG program is a


hyphen (-).

6-12
Compare
Command

Purpose: Compares the contents of two blocks of memory.

Format: C range address

Remarks: The contents of the two blocks of memory are


compared; the length of the comparison is
determined from the range. If unequal bytes are
found, their addresses and contents are displayed, in
the fonn:

addr I byte I byte2 addr2

where, the first half (addr I byte I) refers to the location


and contents of the mismatching locations in range, and
the second half (byte 2 addr2) refers to the byte found
in address.

If you enter only an offset for the beginning address of


range, the C command assumes the segment contained
in the DS register. To specify an ending address for
range, enter it with only an offset value.

Example: C 100120 200


The 32 bytes of memory beginning at DS: 100 are
compared with the 32 bytes beginning at DS:200.

6-13
Dump
Command

Purpose: Displays the contents of a portion of memory.

Format: D [address]

or

D [range]

Remarks: The dump is displayed in two parts:

1. A hexadecimal portion. Each byte is displayed in


hexadecimal.

2. An ASCII portion. The bytes are displayed as


ASCII characters. Unprintable characters are
indicated by a period (.).

With a 40-column system display format, each line


begins on an 8-byte boundary and shows 8 bytes.

With an 80-column system display format, each line


begins on a 16-byte boundary and shows 16 bytes.
There is a hyphen between the 8th and 9th bytes.

Note: The first line may have fewer than 8 or 16


bytes if the starting address of the dump is not
on a boundary. In this case, the second line of the
dump begins on a boundary.

6-14
Dump
Command

The Dump command has two format options:

Option 1

Use this option to display the contents of X'40' bytes


(40-column mode) or X'80' bytes (80-column mode).
For example:

D address

or

The contents are dumped starting with the specified


address.

If you do not specify an address, the D command


assumes the starting address is the location following
the last location displayed by a previous D command.
Thus, it is possible to dump consecutive 40-byte or
80-byte areas by entering consecutive D commands
without parameters.

If no previous D command was entered, the location is


offset X'O I 00' into the segment originally initialized
in the segment registers by DEBUG.

Note: If you enter only an offset for the starting


address, the D command assumes the segment
contained in the DS register.

6-15
Dump
Command

Option 2

Use this option to display the contents of the specified


address range. For example:

D range

Note: If you enter only an offset for the starting


address, the D command assumes the segment
contained in the DS register. If you specify an
ending address, enter it with only an offset value.

For example:

Des: 100 10C

A 40-column display format might look like this:

04BA:0100 42 45 52 54 41 20 54 00
BERTA T.

04BA:0108 20 42 4F 52 47
BORG

6-16
Enter
Command

Purpose: The Enter command has two modes of operation:

• Replaces the contents of one or more bytes,


starting at the specified address, with the values
contained in the list. (See Option 1.)

• Displays and allows modification of bytes in a


sequential manner. (See Option 2.)

Fonnat: E address [list]

Remarks: If you enter only an offset for the address, the E


command assumes the segment contained in the DS
register.

The Enter command has two format options:

Option 1

Use this option to place the list in memory beginning


at the specified address.

E address list

For example:

E ds: 100 F3 "xyz" 80

Memory locations ds: 100 through ds: 104 are filled with
the five bytes specified in the list.

Option 2

Use this option to display the address and the byte of a


location, then the system waits for your input.
6-17
Enter
Command

For example:

E address

Now you can take one of the following actions:

1. Enter a one or two character hexadecimal value


to replace the contents of the byte; then take any
of the next three actions:

2. Press the space bar to advance to the next address.


Its contents are displayed. If you want to change
the contents take action I, above.

To advance to the next byte without changing the


current byte, press the space bar again.

3. Enter a hyphen (-) to back up to the preceding


address. A new line is displayed with the preceding
address and its contents. If you want to change the
contents take action 1, above.

To back up one more byte without changing the


current byte, enter another hyphen.

4. Press the Enter key to end the Enter command.

Note: Display lines can have 4 or 8 bytes of data,


depending on whether the system display format
is 40- or 80-column. Spacing beyond an 8-byte
boundary causes a new display line, with the
beginning address, to be started.

6-18
Enter
Command

For example:

E cs: 100

might cause this display:

04BA:0100 EB.

To change the contents of 04BA:OIOO from X'EB' to


X'41', enter 41.

04BA:0100 EB.41

To see the contents of the next three locations, press


the space bar three times. The screen might look like
this:

04BA:0100 EB.41 10. 00. BC.

To change the contents of the current location


(04BA:Ol03) from X'BC' to X'42', enter 42.

04BA:0100 EB.41 10. 00. BC.42

Now, suppose you want to back up and change the


X' 10' to X'6F'. This is what the screen would look like
after entering two hyphens and the replacement byte:

04BA:0100 EB.41 10. 00. BC.42-


04BA:0102 00.-
04BA.0101 10.6F

Press the Enter key to end the Enter command. You


will see the hyphen (-) prompt.

6-19
Fill
Command

Purpose: Fills the memory locations in the range with the values
in the list.

Format: F range list

Remarks: If the list contains fewer bytes than the address range,
the list is used repeatedly until all the designated
memory locations are filled.

If the list contains more bytes than the address range,


the extra list items are ignored.

Note: If you enter only an offset for the starting


address of the range, the Fill command assumes
the segment contained in the DS register.

Example: F 4BA:100 L 5 F3 "XYZ" 80

Memory locations 04BA: 100 through 04BA: 104 are


filled with the 5 bytes specified. Remember that the
ASCII values of the list characters are stored. Thus,
locations 100-104 will contain F3 58 59 5A 8D.

6-20
Go
Command

>Urpose: Executes the program you are debugging.

Stops the execution when the instruction at a specified


address is reached (breakpoint), and displays the
registers, flags, and the next instruction to be executed.

Format: G [=address] [address [address . .. ]]

Remarks: Program execution begins with the current instruction,


whose address is determined by the contents of the CS
and IP registers, unless overridden by the =address
parameter (the = must be entered). If =address is
specified, program execution begins with CS:=address.

The Go command has two format options:

Option 1

Use this option to execute the program you are


debugging without breakpoints. For example:

G [=address]

This option is useful when testing program execution


with different parameters each time. (Refer to the
Name command.) Be certain the CS:IP values are set
properly before issuing the G command, if not using
=address.

6-21
Go
Command

Option 2

This option performs the same function as Option 1


but, in addition, allows breakpoints to be set at the
specified addresses. For example:

G [=addressJ address
[address . .. J

This method causes execution to stop at a specified


location so the system/program environment can be
examined.

You can specify up to ten breakpoints in any order.


You may wish to take advantage of this if your program
has many paths, and you want to stop the execution
no matter which path the program takes.

The DEBUG program replaces the instruction codes at


the breakpoint addresses with an interrupt code
(X'CC'). If anyone breakpoint is reached during
execution, the execution is stopped, the registers and
flags are displayed, and all the breakpoint addresses are
restored to their original instruction codes. If no
breakpoint is reached, the instructions are not restored.

Notes:

1. Make sure that the address parameters refer to


locations that contain valid 8088 instruction
codes. If you specify an address that does
not contain the first byte valid instruction,
unpredictable results will occur.

2. The stack pointer must be valid and have 6


bytes available for the Go command;
otherwise, unpredictable results will occur.

6-22
Go
Command

3. If only an offset is entered for a breakpoint,


the G command assumes the segment
contained in the CS register.

For exam pie:

G 102 1EF 208

Execution begins with the current instruction,


whose address is the current values of CS:IP. The
=address parameter was not used.

Three breakpoints are specified; assume that the


second is reached. Execution stops before the
instruction at location CS: I EF is executed, the
original instruction codes are restored, all three
breakpoints are removed, the display occurs, and
the Go command ends.

Refer to the Register command for a description of


the display.

6-23
Hexarithmetic
Command

Purpose: Adds the two hexadecimal values, then subtracts the


second from the first.

Displays the sum and difference on one line.

Format: H value value

Example: H OF 8
17 07

The hexadecimal sum of OOOF and 0008 is 001 7, and


their difference is 0007.

6-24
Input
Command

Purpose: Inputs and displays (in hexadecimal) one byte from the
specified port.

Format: I portaddress

Example: I 2F8
68

The single hexadecimal byte read from port 02F8 is


displayed (6B).

6-25
Load
Command

Purpose: Loads a file or absolute diskette sectors into memory.

Format: L [address [drive sector sector] ]

Remarks: The maximum number of sectors that can be loaded


with a single Load command is X'80'.

Note: DEBUG displays a message if a diskette


read error occurs. The read operation can be
retried by pressing F3 to re-display the Load
command, then press the Enter key.

The Load command has two format options:

Option 1

Use this option to load data from the diskette specified


by drive, and place the data in memory beginning at the
specified address. For example:

L address drive sector sector

The data is read from the specified starting relative


sector (first sector) and continues until the requested
number of sectors is read (second sector).

Note: If you only enter an offset for the


beginning address, the L command assumes the
segment contained in the CS register.

For example, to load data, you might enter:

L 4BA: 100 1 OF .6D

6-26
Load
Command

The data is loaded from the diskette in drive Band


placed in memory beginning at 4BA: 100. X'6D' (109)
consecutive sectors of data are transferred, starting with
relative sector X'OF' (15) (the 16th sector on the
diskette ).

Option 2

When issued without parameters, or with only the


address parameter, use this option to load the file whose
filespec is properly formatted in the file control block
at CS:5C. For example:

or

L address

This condition is met by specifying the filespec when


starting the DEBUG program, or by using the Name
command.

Note: If DEBUG was started with a fHespec and


subsequent Name commands were used, a new
Name command may have to be entered for the
proper filespec before issuing the Load command.

The file is loaded into memory beginning at CS: 100 (or


the location specified by address), and is read from the
drive specified in the filespec (or from the default drive,
if none was specified).

6-27
Load
Command

The BX and ex registers are set to the number of bytes


read; however, if the file being loaded has an extension
of .EXE, BX and ex are set to the actual program size,
and the file may be loaded at the high end of memory.
Refer to the notes in "How to Start the DEBUG
Program" at the beginning of this chapter for the
conditions that are in effect when .EXE or .HEX files
are loaded.

For example:

DEBUG
-N myprog
-L

The file named myprog is loaded from the default


diskette and placed in memory beginning at location
eS:OIOO.

6-28
Move
Command

Purpose: Moves the contents of the memory locations specified


by range to the locations beginning at the address
specified.

Format: M range address

Remarks: Overlapping moves are always performed without loss of


data during the transfer. (The source and destination
areas share some of the same memory locations.)

The data in the source area remains unchanged unless


overwritten by the move.

Notes:

1. If you only enter an offset for the beginning


address of the range, the M command
assumes the segment contained in the DS
register. If you specify an ending address for
the range, enter it with only an offset value.

2. If you only enter an offset for the address of


the destination area, the M command assumes
the segment contained in the DS register.

Example: M CS:100 110 500

The 17 bytes of data from CS: 100 through CS: 110 are
moved to the area of memory beginning at DS:500.

6-29
Name
Command

Purpose: The Name command has two functions:

• Formats file control blocks for the first two


filespecs, at CS:5C and CS:6C. (Starting DEBUG
with a filespec also formats a file control block at
CS:5C.)

The file control blocks are set up for the use of the
Load and Write commands, and to supply required
filenames for the program being debugged.

• All specified filespecs and other parameters are


placed exactly as entered, including delimiters, in a
parameter save area at CS:81, with CS:80
containing the number of characters entered.

Format: N filespec [filespec ... J

Remarks: If you start the DEBUG program without a filespec,


you must use the Name command before a file can be
loaded with the L command.

Example: DEBUG
-N myprog
-L

To define filespecs or other parameters required by the


program being debugged, enter:

DEBUG myprog
-N filel file2

6-30
Name
Command

In this example, DEBUG loads the file myprog at


CS: 100, and leaves the file control block at CS:5C
formatted with the same filespec. Then, the Name
command formats file control blocks for filel and file2
at CS:5C and CS:6C, respectively. The file control
block for myprog is overwritten.

The parameter area at CS:81 contains all characters


entered after the N, induding all delimiters, and CS:80
contains the count of those characters (X'OC').

-
6-31
Output
Command

Purpose: Sends the byte to the specified output port.

Format: 0 portaddress byte

Example: To send the byte value 4F to output port 2F8, enter:


o 2F8 4F

6-32
Quit
Command

Purpose: Ends the DEBUG program.

Format: Q

Remarks: The file that you are working on in memory is not saved
by the Quit command. You must use the Write
command to save the file.

DEBUG returns to the command processor which then


issues the normal command prompt.

Example: -0
A>

6-33
Register
Command

Purpose: The Register command has three functions:

• It displays the hexadecimal contents of a single


register, with the option of changing those
contents.

• It displays the hexadecimal con ten ts of all the


registers, plus the alphabetic flag settings, and the
next instruction to be executed.

• It displays the eight 2-letter alphabetic flag settings,


with the option of changing any or all of them.

Format: R [registername]

Remarks: When the DEBUG program starts, the registers and


flags are set to certain values for the program being
debugged. (Refer to "How to Start the DEBUG
Program" at the beginning of this chapter.)

Display a Single Register

The valid registemames are:

AX BP SS
BX SI CS
CX DI IP
DX DS PC
SP ES F

Both IP and PC refer to the instruction pointer.

6-34
Register
Command

For example, to display the contents of a single


register, you might enter:

R AX

The system might respond with:

AX F1E4

Now you may take one of two actions:

• Press Enter to leave the contents unchanged.

or

• Change the contents of the AX register by entering


a 1-4 character hexadecimal value, such as
X'FFF'.

AX F1E4
:FFF

Now pressing Enter changes the contents of the AX


register to X'OFFF'.

Display All Registers and Flags

To display the contents of all registers and flags (and


the next instruction to be executed), enter:

6-35
Register
Command

The system might respond with:

AX=OEOO BX=OOFF CX=0007 DX=Ol FF


SP=039D BP=OOOO SI=005C D1=0000
DS=04BA ES=04BA SS=04BA CS=04BA
IP=OllA NV UP DI NG NZ AC PE NC
04BA:011A CD21 INT 21

The first four lines display the hexadecimal contents of


the registers and the eight alphabetic flag settings. The
last line indicates the location of the next instruction to
be executed, and its hexadecimal and unassembled
formats. This is the instruction pointed to by CS:IP.

Note: A system with an 80-column display shows:

1st line - 8 registers


2nd line - 5 registers and 8 flag settings
3rd line - next instruction information

A system with a 40-column display shows:

I st line - 4 registers
2nd line - 4 registers
3rd line - 4 registers
4th line - I register and 8 flag settings
5th line - next instruction information

Display All Flags

There are eight flags, each with 2-letter codes to indicate


either a set condition or a clear condition.

The flags appear in displays in the same order as


presented in the following table:

6-36
Register
Command

Flag Name Set Clear

Overflow (yes/no) OV NV

Direction (decrement/increment) DN UP

Interrupt (enable/disable) EI DI

Sign (negative/positive) NG PL

Zero (yes/no) ZR NZ

Auxiliary carry (yes/no) AC NA

Parity (even/odd) PE PO

Carry (yes/no) CY NC

Figure 5. Alphabetic Flag Settings

To display all flags, enter:

RF
If all the flags are in a set condition, the response is:

OV DN EI NG ZR AC PE CV -

Now you can take one of two actions:

I. Press Enter to leave the settings unchanged.

2. Change any or all of the settings.

6-37
Register
Command

To change a flag, just enter its opposite code. The


opposite codes can be entered in any order-with or
without intervening spaces. For example, to change the
first, third, fifth, and seventh flags, enter:

OV ON EI NG ZR AC PE CV - PONZOINV

They are entered in reverse order in this example.

Press Enter and the flags are modified as specified, the


prompt appears, and you can enter the next command.

If you want to see if the new codes are in effect, enter:

RF
The response will be:

NV ON 01 NG NZ AC PO CV -

The first, third, fifth, and seventh flags are changed as


requested. The second, fourth, sixth, and eighth flags
are unchanged.

Note: A single flag can be changed only once per


R F command.

6-38
Search
Command

t>urpose: Searches the range for the character(s) in the list.

Format: S range list

R.emarks: All matches are indicated by displaying the addresses


where matches are found.

A display of the prompt (-) without an address means


that no match was found.

Note: If you enter only an offset for the starting


address of the range, the S command assumes the
segment contained in the DS register.

~xample: If you want to search the range of addresses from


CS: 100 through CS: 110 for X'41', enter: '

S CS: 100 110 41

If two matches are found the response might be:

04BA:0104
04BA:010D

If you want to search the same range of addresses as in


the previous example for a match with the 4-byte-long
list, enter:

S CS:100 L 11 41 "AB" E

The starting addresses of all matches are listed. If no


match is found, no address is displayed.

6-39
Trace
Command

Purpose: Executes one or more instructions starting with the


instruction at CS:IP, or at =address if it is specified. The
= must be entered. One instruction is assumed, but you
can specify more than one with value.

Displays the contents of all registers and flags after each


instruction executes. For a description of the display
format, refer to the Register command.

Format: T [=address] [value]

Remarks: The display caused by the Trace command continues


until value instructions are executed. Therefore, when
tracing multiple instructions, remem ber you can
suspend the scrolling at any time by pressing
Ctrl-NumLock. Resume scrolling by entering any other
character.

Example: T

If the IP register contains 0 llA, and that location


contains B40E (MOV AH,OEH), this might b~ displayed:

AX=OEOO BX=OOFF CX=0007 OX=Ol FF


SP=0390 BP=OOOO SI=005C 01=0000
OS=04BA ES=04BA SS=04BA CS=04BA
IP=Oll C NV UP 01 NG NZ AC PE NC
04BA:OllC C021 INT 21

This displays the results after the instruction at 011 A is


executed, and indicates the next instruction to be
executed is the INT 21 at location 04BA:OllC.

T 10

6-40
Trace
Command

Sixteen instructions are executed (starting at CS: IP).


The contents of all registers and flags are displayed
after each instruction. The display stops after the 16th
instruction has been executed. Displays may scroll off
the screen unless you suspend the display by pressing
the Ctrl-NumLock keys.

-
-
6-41
Unassemble
Command

Purpose: Unassembles instructions (translates the contents of


memory into assembler-like statements) and displays
their addresses and hexadecimal values, together with
assem bIer-like statements. For example, a display
migh t look like this:

04BA:0100 206472 AND [SI+72] ,AH


04BA:0103 FC CLD
04BA:0104 7665 JBE 0168

Format: U [address]

or

U [range]

Remarks: The number of bytes unassembled depends on your


system display format (whether 40 or 80 columns), and
which option you use with the Unassemble command.

Notes:

1. In all cases, the number of bytes unassembled


and displayed may be slightly more than
either the amount requested or the default
amount. This happens because the instructions
are of variable lengths; therefore, to
unassemble the last instruction may include
more bytes than expected.

2. Make sure that the address parameters refer to


locations containing valid 8088 instruction
codes. If you specify an address that does not
contain the first byte of a valid instruction,
the display will be erroneous.

6-42
Unassemble
Command

3. If you enter only an offset for the starting


address, the U command assumes the segment
contained in the CS register.

The Unassemble command has two format options:

Option 1

Use this option to either unassemble instructions


without specifying an address, or to unassemble
instructions beginning with a specified address. For
example:

or

U address

16 bytes are unassembled with a 40-column display. 32


bytes are unassembled with an 80-column display.

Instructions are unassem bled beginning with the


specified address.

If you do not specify an address, the U command


assumes the starting address is the location following the
last instruction unassembled by a previous U command:
Thus, it is possible to unassemble consecutive locations,
producing continuous unassembled displays, by entering
consecutive U commands without parameters.

If no previous U command is entered, the location is


offset X'O 100' into the segment originally initialized in
the segment registers by DEBUG.
-

6-43
Unassemble
Command

Option 2

Use this option to unassemble instructions in a specified


address range. For example:

U range

All instructions in the specified address range are


unassembled, regardless of the system display format.

Note: If you specify an ending address, enter it


with only an offset value.

For example:

U 04ba: 0100 108

The display response might be:

04BA:0100 206472 AND [SI+72],AH


04BA:0103 FC CLD
04BA:0104 7665 JBE 016B
04BA:0106 207370 AND [BP+DI+70],DH

The same display appears if you enter:

U 04BA:100 L 7

or

U 04BA:100 L 8

or

U 04BA:100 L 9

6-44
Write
Command

Purpose: Writes the data being debugged to diskette.

Format: W [address [drive sector sector]]

Remarks: The maximum number of sectors that can be written


with a single Write command is X'80'.

DEBUG displays a message if a diskette write error


occurs. The write operation can be retried by pressing
F3 to re-display the Write command, then press the
Enter key.

The Write command has two format options:

Option 1 .

Use this option to write data to diskette beginning at a


specified address. For example:

W address drive sector sector

The data beginning at the specified address is written to


the diskette in the indicated drive. The data is written
starting at the specified starting relative sector (first
sector) and continues until the requested number of
sectors are filled (second sector).

Notes:

1. Be extremely careful when you write data to


absolute sectors because an erroneous sector
specification will destroy whatever was on
the diskette at that location.

6-45
Write
Command

2. If only an offset is ent~red for the beginning


address, the W command assumes the segment
contained in the CS register.

3. Remem ber, the starting sector and the sector


count are both specified in hexadecimal.

For exam pIe:

W lFD 1 100 A

The data beginning at CS:O 1FD is written to the


1
diskette in drive B, starting at relative sector X' 100
(256) and continuing for X'OA' (10) sectors.

Option 2

This option allows you to use the Write command


wi thou t specifying parameters or only specifying the
address parameter. For example:

or

W address

When issued without parameters (or when issued with


only the address parameter), the Write command writes
the file (whose filespec is properly formatted in the file
control block at CS: 5C) to diskette.

6-46
Write
Command

This condition is met by specifying the filespec when


starting the DEBUG program, or by using the Name
command.

Note: If DEBUG was started with a filespec and


subsequent Name commands were used, you may
need to enter a new Name command for the proper
filespec before issuing the Write command.

In addition, the BX and CX registers must be set to the


number of bytes to be written. They may have been
set properly by the DEBUG or Load commands, but
might have been changed by a Go or Trace command.
You must be certain the BX and CX registers contain
the correct values.

The file beginning at CS: 100, or at the location specified


by address, is written to the diskette in the drive
specified in filespec or the default drive if none was
specified.

The debugged file is written over the original file that


was loaded into memory, or into a new file if the
filename in the FCB didn't previously exist.

Note: An error message is issued if you try to


write a file with an extension of .EXE or .HEX.
These files .must be written in a specific format
that DEBUG cannot support.

If you find it necessary to modify a file with an


extension of .EXE or .HEX, and the exact
locations to be modified are known, use the
following procedure:
-

6-47
Write
Command

1. RENAME the file to an extension other than


.EXE or .HEX.

2. Load the file into memory using the DEBUG


or Load command.

3. Modify the file as needed in memory, but do


not try to execute it with the Go or Trace
commands. Unpredictable results would
occur.

4. Write the file back using the Write command.

5. RENAME the file back to its correct name.

6-48
Summary of DEBUG Commands

The following chart is provided for quick reference.

The section called "Format Notation" in Chapter 3


explains the notation used in the format of the
following commands.

Command Purpose Format

Compare Compares memory C range address

Dump Displays memory D [address]


or
D [range]

Enter Changes memory E address [list]

Fill Changes memory F range list


blocks

Go Executes with G [=address]


optional breakpoints [address
[address . .. ] ]

Hexarithmetic Hexadecimal H value value


add-subtract

Input Reads/displays I portaddress


input byte

Load Loads file or absolute L [address [drive


diskette sectors sector sector]]

Move Moves memory block M range address

Name Defines files and N filespec


parameters [filespec . .. ]

Output Sends output byte 0 portaddress byte

Figure 6 (part 1 of 2). DEBUG Commands

6-49
Command Purpose Fonnat

Quit Ends DEBUG Q


program

Register Displays R [registername]


registers/ flags

Search Searches f')r . S range list


characters

Trace Executes and T [=address] [value]


displays

Unassemble Unassembles U [address]


instructions or
U [range]

Write Writes file or W [address [drive


absolute diskette sector sector]]
sectors

Figure 6 (Part 2 of 2). DEBUG Commands

6-50
MlPENDlXES

Contents

APPENDIX A. MESSAGES ........ A-3

APPENDIX B. DOS TECHNICAL


INFORMATION B-1
DOS Structure . . . . . . B-1
DOS Initialization . . . . B-2
The Command Processor B-3
Replacing the Command Processor B-4
Available DOS Functions . . . . B-S
Diskette/File Management Notes B-6
The Disk Transfer Area (DTA) B-7
Error Trapping . . . . . . . . . B-7
General Guidelines . . . . . . . B-8
Example of Using DOS Functions B-9

APPENDIX C. DOS DISKETTE


ALLOCATION . . . . . C-I
DOS Diskette Directory C-3
DOS File Allocation Table . . . C-6
How to Use the File Allocation Table C-8
Diske tte Maps . . . . . . . . . . . . C-8

APPENDIX D. DOS INTERRUPTS AND


FUNCTION CALLS D-l
Interrupts . . . . . . . . . . . . . . D-I
Function Calls . . . . . . . . . . . . D-7

APPENDIX E. DOS CONTROL BLOCKS


AND WORK AREAS . . . E-l
DOS Memory Map . . . E-l
DOS Program Segment E-3
File Control Block . . . E-7

APPENDIX F. EXE FILE STRUCTURE


AND LOADING . . . . . . . . . . . . F-l

A-I
A-2
APPENDIX A. MESSAGES

This appendix lists, in alphabetic order, the messages


produced by DOS. The message is indicated here by
bold type, and the description follows the message.

The first word of the description of each message is


the name of the program or command that generated
the message.

Abou t to generate .EXE file


Change disks <hit ~NTER>

LINK~ This message is displayed when you specify the


/PAUSE parameter. Insert your Runfile diskette into
the appropriate drive and press Enter.

Allocation error for file filename

CHKDSK. An invalid sector number was found in the


file allocation table. The file was truncated at the end
of the last valid sector.

Ambiguous switch: z

LINK. The characters specified by z do not uniquely


identify a linker parameter. Use more characters from
the parameter name.

An internal failure has occurred

LINK. An error has occurred in the linker program.


Report the conditions under which the message
appeared to your Authorized IBM Personal Computer
Dealer.

A-3
Attempt to access data outside of segment bounds

LINK. An object file is probably invalid.

Attempted write-protect violation

FORMAT. The diskette being formatted cannot be


written on because it is write-protected. You are
prompted to insert a new diskette and press a key to
restart formatting.

Aux I/O error

DOS. An input or output error occurred while trying


to use the Asynchronous Communications Adapter.

Bad command or file name

DOS. The command just entered is not a valid internal


command, and a file called command-name .COM or
command-name .EXE could not be found on the
specified (or default) drive.

Bad numeric parameter

LINK. The value you specified with the /STACK


parameter is not a valid numeric constant.

Bad or missing Command Interpreter

STARTUP. The diskette in drive A does not contain a


copy of COMMAND .COM, or an error occurred while
the diskette was being loaded. If System' Reset fails to
solve the problem, copy COMMAND.COM from a
backup diskette to the diskette that failed.

BF
DEBUG. Bad flag. An invalid flag code setting was
specified. Try the Register (R F) command again with
the correct code.
A-4
BP

DEBUG. Breakpoints. More than ten breakpoints were


specified for the Go command. Try the Go (G)
command again with ten or fewer breakpoints.

BR

DEBUG. Bad register. An invalid register name was


specified. Try the Register (R) command again -.vith a
correct register name.

XXXXXXXXXX bytes disk space freed

CHKDSK. Diskette space marked as allocated was not


allocated. Therefore, the space was freed and made
available.

Cannot compare file to itself

CaMP. The two filenames entered refer to the same


file on the same diskette. CaMP assumes an error was
made in entering one of the filenames.

Cannot edit .BAK file-rename file

EDLIN. .BAK files are considered to be backup files,


with more up-to-date versions of the files assumed to
exist. Therefore, .BAK files usually shouldn't be edited.

If it is necessary to edit the .BAK file, either rename the


file, or copy it and give the copy a different name.

Cannot find file filespec


Change diskette <hit ENTER>

LINK. The linker could not locate the specified object


module on the drive. Insert the diskette with the
specified module on it and press Enter.

A-5
Canno t find library libname
Enter new drive letter

LINK. The specified library could not be found on the


drive. Enter the letter for the drive the library is on.

Cannot nest response file

LINK. You used @/ilespec within an automatic


response file. Automatic response files cannot be
nested.

Cannot open list file

LINK. The directory is full.

Cannot open overlay

LINK. The directory is full.

Cannot open response file

LINK. The automatic response file could not be


found.

Cannot open temporary file

LINK. The directory is full.

A-6
COMn: bbbb,p,d,s,t initialized

MODE. The Asynchronous Communications Adapter


has been initialized. The values represent:

n adapter (COM I or COM2)


bbbb baud rate
p parity
e even
o odd
n none
s stop bits (1 or 2)
t type of serial device
p serial printer (serial timeouts will be retried)
other serial device (serial timeouts will
not be retried)

Compare error at offset xxxxxxxx


COMPo The files being compared contain different
values at the displayed offset (in hexadecimal) into the
file. The differing values are also displayed in
hexadecimal.

Compare error(s) on
Track xx, side xx

DISKCOMP. One or more locations on the indicated


track and side contain differing information between
the diskettes being compared.

Compare more diskettes (YIN)?

DISKCOMP. If you wish to compare another pair of


diskettes, enter Y, and DISKCOMP will prompt you to
insert the required diskettes. If you do not want to
com pare any more diskettes, enter N.

A-7
Compare more files (YIN)?

COMPo If you wish to compare the contents of two


more files, enter Y, and COMP will prompt you to
insert the required diskette. If you do not wish to
compare more files, enter N.

Comparing n side(s)

D ISKCOMP. The n will be either I or 2, indicating


the number of sides that DISKCOMP will compare
on the two diskettes. This number is determined by
the number of sides DISKCOMP was able to successfully
read from the first track of the first diskette.

Copy another (Y IN)?

DISKCOPY. If you wish to copy another entire


diskette, enter Y; DISKCOPY will prompt you to
insert the required diskette. If you do not wish to
make another copy, enter N.

Copy complete

DISKCOPY. The source diskette contents have been


successfully copied to the target diskette.

Copying n side(s)

DISKCOPY. The n will be either 1 or 2, indicating the


number of sides that DISKCOPY has successfully read
from the first track of the source diskette.

Data error reading drive x


Abort, Retry, Ignore?

DOS. See the message Disk error reading drive x.

A-8
Data error writing drive x
Abort, Retry, Ignore?

DOS. See the message Disk error reading drive x.

DF
DEBUG. Double flag. Conflicting codes were specified
for a single flag. A flag can be changed only once per
Register (R F) command.

Directory error-file: filename

CHKDSK. No valid sectors were allocated to the file.


The filename is removed from the directory.

Disk boot failure

DOS. An error occurred while trying to load DOS into


memory. If subsequent attempts to start the system
also fail, use a backup DOS diskette.

A-9
Disk error reading drive x
Abort, Retry, Ignore?

DOS. A disk read or disk write error has occurred.


The operation was repeated three times without success.
When this message appears on the screen, do not
change diskettes.

The system now waits until one of the following


responses is made.

• Enter A for Abort. The system ends the program


that requested the disk read or write.

• Enter R for Retry. The system tries the disk read


or write operation again.

• Enter I for Ignore. The system pretends the error


did not occur and contiJ1ues the program.

To recover from an error condition, the responses are


generally made in the following order:

R to retry the operation because the error may not


occur again.

A to abort the program.

I to ignore the error condition and continue the


program. (This response is not recommended
because data is lost when you use it.)

Notes:

1. This message will appear if you attempt to


use a dual sided diskette in a single sided
drive.

2. When executing DEBUG, the second line of


the message does not appear. To retry the
disk operation, press F3 to re-display the
Load or Write command, and then press the
Enter key.

A-tO
Disk error writing drive x
Abort, Retry, Ignore?

DOS. See the message Disk error reading drive x.


When this message appears on the screen, do not
change diskettes.

Disk full-file write not completed

EDLIN. An End Edit command ended abnormally


because the diskette does not have enough free space
to save the entire file.

Some of the file may be saved on diskette, but the


portion in memory not saved is lost.

Disk unsuitable for system disk

FORMAT. A defective track was detected where the


DOS files were to reside. The diskette can be used only
for data.

Diskette not initialized

CHKDSK. During its analysis of the diskette, CHKDSK


could not recognize the directory or file allocation table.
The diskette should be formatted again before further
use (it may be possible first to copy files to another
diskette in order to preserve as much data as possible).

Diskettes compare OK

DISKCOMP. The two diskettes just compared contain


identical information.

Divide overflow

DOS. A program attempted to divide a number by


zero, or the program had a logic error that caused an
internal malfunction. The system simulates
CTRL-BREAK processing.

A-11
Do you see the leftmost 9? (Yin)

MODE. ,R,T was specified. Respond Y or N. This


prompt is repeated until you respond Y.

Do you see the rightmost 9? (Yin)

MODE. ,L,T was specified. Respond Y or N. This


prompt is repeated until you respond Y.

Dup record too complex

LINK. Problem resides in object module created from


an assembler source program. A single DUP requires
1024 bytes before expansion. Debug machine language
processor source program; then rerun LINK.

Duplicate filename or file not found

RENAME. You tried to rename a file to a filename that


already exists on the diskette, or the file to be renamed
could not be found on the specified (or default) drive.

En ter primary file name

COMP. Enter the filespec of the first of two files to


be compared.

En ter 2nd file name or drive id

COMPo Enter the filespec of the second of two files to


be compared, or just enter the drive designator if the
filename is the same as the primary filename.

Entry error

EDLIN. Correct the syntax error on the last command.

A-12
EOF mark not found

COMPo An unsuccessful attempt was made to locate the


end of valid data in the last block of the files being
compared. This message usually occurs when comparing
nontext files; it should not occur when comparing text
files.

Error in EXE file

DOS. An error was detected in the relocation


information placed in the file by the LIN-K program.

Error in EXE/HEX file

DEBUG. The file contained invalid records or


characters.

EXE/HEX file cannot be written

DEBUG. The data would require a backwards


conversion that DEBUG doesn't support.

File allocation table bad, drive x


Abort, Retry, Ignore?

DOS. See the message Disk error reading drive x. If this


error persists, the disk is unusable and should be
formatted again.

File cannot be copied onto itself

DOS. A request is made to COpy a file and place the


copy (with the same name) on the same diskette as the
original. Either change the name given to the copy or
put it on another diskette.

A-I3
File creation error

DOS and commands. An unsuccessful attempt was


made to add a new filename to the directory. Run
CHKDSK to determine if the directory is full, or if
some other condition caused the error.

File n empty

COMPo File n can represent either the first or second


filename entered. In either case, the file contains no
valid data.

File n not found

COMPo The first or second file specified does not exist


on the specified (or default) drive.

File not found

DOS and commands. A file named in a command or


command parameter does not exist on the diskette in
the specified (or default) drive.

File size error for file filename

CHKDSK. The file size shown in the directory is


different from the actual size allocated for the file. The
size in the directory is adjusted, up or down, to show
the actual size (rounded to a 5 12-byte boundary).

Files are different sizes

COMPo The sizes of the files to be compared do not


match. The comparison cannot be done because one of
the files contains data which the other does not.

Files compare OK

COMPo The two files just compared contain identical


information.
A-14
Files cross-linked: filename and filename

CHKDSK. The same data block is allocated to both files.


No corrective action is taken automatically, so you must
correct the problem. For example, you can:

• Make copies of both files (use COPY command).

• Delete the original files (use ERASE command).

• Review the files for validity and edit as necessary.

Fixup offset exceeds field width

LINK. A machine language processor instruction refers


to an address with a NEAR attribute instead of aFAR
attribute. Edit assembler source program and process
again.

Fixups needed-base segment (hex):

EXE2BIN. The source (.EXE) file contained


information indicating that a load segment is required
for the file. Specify the absolute segment address at
which the finished module is to be loaded.

Format failure

FORMAT. A disk error was encountered while creating


the target diskette. The diskette is unusable.

Forma tting while copying

DISKCOPY. The target diskette was found to contain


unformatted tracks. DISKCOPY will format the
remainder of the target diskette as it copies data. If this
message is followed by the message Incompatible drive
types, you have tried to copy a dual sided diskette to a
drive that does not have dual sided capability; processing
will end, and the target diskette will not contain any
useful data.

A-IS
lliegal Device Name

MODE. The specified printer must be LPTl:, LPT2:,


or LPT3: ; the specified Asynchronous Communications
Adapter must be COMl: or COM2:; and there must be no
more than one blank between MODE and its parameters.

Incompatible diskette or drive types

DISKCOMP. The first diskette was successfully read


on both sides, but the second diskette could only be
read on the first side. Either the second drive or
diskette is single sided.

Incompatible drive types

DISKCOMP. The source diskette and drive are dual


sided, but the target drive has only single sided
capability. The target diskette contains no useful data.

Incompatible system size

SYS. The target diskette contained a copy of DOS that


is smaller than the one being copied. The system
transfer does not take place. A possible solution might
be to format a blank diskette (use the FORMAT IS
command) and then copy any files to the new diskette.

Insert disk with batch file and strike any key when ready

DOS. The diskette that contained the batch file being


processed was removed. The batch processor is trying
to find the next command in the file. Processing will
continue when you insert the diskette in the appropriate
drive and press a key.

A-16
Insert diskette(s) with files to compare
and strike any key when ready

COMPo Insert the requested diskettes and press any


key for the comparison to continue. In a single drive
system, insert the first of the two diskettes and press
a key.

Insert DOS disk in xxxxx


and strike any key when ready

DOS, SYS, and FORMAT. Either DOS is trying to


reload the command processor, or FORMAT or SYS
is trying to load the DOS files, but the indicated drive
(xxxxx) does not contain the DOS diskette.

Insert first diskette in drive x


Insert second diskette in drive x

DISKCOMP. Insert the first (or second) diskette of the


two diskettes to be compared into the indicated drive.
One or both of these messages will be followed by the
message Strike any key when ready. When you press a
key, the comparison will continue.

Insert source diskette in drive x


Insert target diskette in drive x

DISKCOPY. Insert the appropriate diskette into the


indicated drive, and press any key when prompted. The
copying process will continue.

Insufficien t disk space

DOS and commands. The diskette does not contain


enough free space to contain the file being written. If
you suspect this condition is invalid, run CHKDSK to
determine the status of the diskette.

A-17
Insufficient memory

Commands. The amount of available memory is too


small to allow these commands to function.

Insufficient space on disk

DEBUG. A Write command was issued to a diskette


that doesn't have enough free space to hold the data
being written.

Invalid baud rate specified

MODE. The baud rate you specify must be 110, 150,


300, 600, 1200, 2400, 4800, or 9600 (or the first two
characters of the number).

Invalid COMMAND.COM in drive n

DOS. While trying to reload the command processor, the


copy of COMMAND.COM on the diskette was found to
be an incorrect version. You are prompted to insert a
correct DOS diskette and press a key to continue.

Invalid date

DATE. An invalid date or delimiter was entered. The


only valid delimiters in a date entry are hyphens (-) and
slashes (/).

Invalid drive specification

DOS and commands. An invalid drive specification was


just entered in a command or one of its parameters.

Invalid format file

LINK. A library is in error.

A-I8
Invalid numeric parameter

LINK. Numeric value not in digits.

Invalid object module

LINK. Object module(s) incorrectly formed or


incomplete (as when the language processor was
stopped in the middle).

Invalid parameter

CHKDSK, DISKCOMP, DISKCOPY, FORMAT, and


SYS. The parameter entered for these commands was
not a drive specifier. Be sure to en ter a valid drive
specifier, followed by a colon.

Invalid parameters

MODE. No parameters were entered, or the first


parameter character was other than L or C, or the first
parameter was other than 80, 40, ,L, or ,R.

Invalid switch: z

LINK. The characters indicated by z do not form a


valid linker parameter.

Invalid time

TIME. An invalid time or delimiter was entered. The


only valid delimiters are the colon between the hours
and minutes, and the minutes and seconds; and a period
between the seconds and hundredths of a second.

Invalid YIN parameter

LINK. Response to a prompt did not begin with Y, N,


or simply the Enter key.

A-19
Line too long

EDLIN. Upon replacing a string, the replacement


causes the line to expand beyond the 253-character
limit. The Replace Text command is ended abnormally.

Split the long line into shorter lines; then issue the
Replace Text command again.

LPT#: not redirected.

MODE. The parallel printer will now receive its own


output, even if this printer's output had previously
been redirected to a serial device. This indicates
cancellation of any previous redirection which may have
been in effect, because you have set the printer width
or vertical spacing.

LPT#: redirected to COMn:

MODE. Any request that would normally have gone


to the parallel printer LPT# (# = 1, 2, or 3) is sent
instead to the serial device COMn (n= 1 or 2).

LPT#: set for 80

MODE. An attempt was made to set the printer line


length to 80 characters by requesting standard type
formaL If the attempt was unsuccessful, an error
message will follow this message on the screen.

LPT#: set for 132

MODE. An attempt was made to set the printer line


length to 132 characters by requesting compressed type
format. If the attempt was unsuccessful, an error
message will follow this message on the screen.

Missing file name

RENAME. The second of the two required filenames


is not specified.
A-20
No object modules specified

LINK. You did not name any object modules in the


command line or in response to the prompt. The
linker needs some files to link.

No room for system on destination disk

SYS. The destination diskette did not already contain


the required reserved space for DOS; therefore, the
system cannot be transferred. A possible solution would
be to format a blank diskette (use the FORMAT IS
command), and then copy any other files to the new
diskette.

No room in directory for file

EDLIN. The specified diskette already contains the


maximum of 64 (or 11 2) files.

No rOOln in disk directory

DEBUG. The diskette in the drive specified by the


Write command already contains the maximum of 64
(or 112) files.

Non-Systeln disk or disk error


Replace and strike any key when ready

STARTUP. There is no entry for IBMBIO.COM or


IBMDOS.COM in the directory; or a disk read error
occurred while starting up the system. Insert a DOS
diskette in the drive.

Not found

EDLIN. Either the specified range of lines does not


contain the string being searched for by the Replace
Text or Search Text commands; or if a search is
resumed by replying N to the OK? prompt, no further
occurrences of the string were found.

A-21
Not ready error reading drive x
Abort, Retry, Ignore?

~OS. See the message Disk error reading drive x. In


this case, the operation is only performed once.

Not ready error reading drive x, or


Not ready error writing drive x
Correct, then strike any key

OISKCOMP and OISKCOPY. The diskette in the


indicated drive could not be read (or written), because
the drive is not ready. Insert the appropriate
diskette, close the drive door, and press any key for
the program to con tin ue.

Not ready error writing drive x


Abort, Retry, Ignore?

DOS. See the message Disk error reading drive x. In


this case, the operation is only performed once.

Out of paper

~OS. Either the printer is out of paper or the printer is


not powered ON.

Out of space on list file

LINK. This error usually occurs when there is not


enough disk space for the List file.

Ou t of space on run file

LINK. This error usually occurs when there is not


enough disk space for the Run file (.EXE).

Out of space on VM.TMP

LINK. No more disk space remained to expand the


VM.TMP file.
A-22
Printer error

MODE. The MODE command (option I) was unable


to set the printer mode because of an I/O error, out
of paper (or POWER OFF), or time out (not ready)
condition. Or, an error return code was passed back
from the INT 17H used to send a control character to
the printer. In this case, the control character did not
take effect.

Printer fault

DOS. The printer cannot accept data because the


printer is offline.

Printer lines per inch set

MODE. An attempt has been made to set the printer


vertical spacing to the specified 6 or 8 lines per inch.
If the attempt was unsuccessful, an error message will
follow this message on the screen.

Program size exceeds capacity of LINK

LINK. Load module is too large for processing.

Program too big to fit in memory

DOS. The file containing the external command cannot


be loaded because it is larger than the available memory.

Requested stack size exceeds 64K

LINK. Specify a size ~ 64K bytes when the Stack Size:


prompt appears.

A-23
Resident portion of MODE loaded

MODE. The first time MODE is invoked for a nonscreen-


setting function, a portion of code is loaded and made
permanently resident at location O:580-0:5FF. The
interrupt vectors for INT 14H (RS232) and for INT
17H (printer) are modified to pass control to this new
code.

Sector not found error reading drive x


Abort, Retry, Ignore?

DOS. See the message Disk error reading drive x.

Note: This error may indicate an attempt to use


a dual sided diskette in a single sided drive.

Sector not found error writing drive x


Abort, Retry, Ignore?

DOS. See the message Disk error reading drive x.

Note: This error may indicate an attempt to use


a dual sided diskette in a single sided drive.

Seek error reading drive x


Abort, Retry, Ignore?

DOS. See the message Disk error reading drive x.

Seek error writing drive x


Abort, Retry, Ignore?

DOS. See the message Disk error reading drive x.

Segment size exceeds 64K

LINK. Attempted to combine identically named


segments which resulted in a segment requirement of
greater than 64K bytes. The addressing limit is 64K
bytes.

A-24
Stack size exceeds 65535 bytes

LINK. The size specified for the stack must be less


than or equal to 65535.

Symbol defined more than once

LINK. The Linker found two or more modules that


define a single symbol name.

Symbol table capacity exceeded

LINK. Very many, very long names were entered. The


names exceeded approximately 50K bytes. Use shorter
and/or fewer names.

Terminate batch job (Y /N)?

DOS. This message appears when you press Ctrl-Break


while DOS is processing a batch file. Press Y to stop
processing the batch file. Pressing N only ends the
command that was executing when Ctrl-Break was
pressed; processing resumes with the next command in
the batch file.

Target diskette may be unusable

DISKCOPY. This message follows an unrecoverable


read, write, or verify error message. The copy on the
target diskette may be incomplete because of the
unrecoverable I/O error.

Target diskette write protected


Correct, then strike any key

DISKCOPY. You are trying to produce a copy on a


diskette that is write-protected.

A-25
There was/were number errors detected

LINK. This message is displayed for your information


at the end of the link session.

Too many external symbols in one module

LINK. The limit is 256 external symbols per module.

Too many groups

LINK. The limit is la, including DGROUP.

Too many libraries specified

LINK. The limit is eight libraries.

Too many overlays

LINK. The limit is 64.

Too many public symbols in one module

LINK. The limit is 1024 public symbols.

Too lTIany segments or classes

LINK. The limit is 256 (segments and classes taken


together).

Track 0 bad-disk unusable

FORMAT. Track 0 is where the boot record, file


allocation table, and directory must reside.

Unable to write BOOT

WRITE. The first track of the diskette is bad; the


BOOT record could not be written on it.
A-26
Unexpected end-of-file on library

LINK. This is probably caused by an error in the file.

Unexpected end of file on YM. TMP

LINK. The diskette containing VM.TMP has been


removed.

Unrecoverable format error on target


Target diskette unusable

DISKCOPY. An unrecoverable error was encountered


while formatting the target diskette. The diskette
contains no usable data.

Unrecoverable read error on drive x


Track xx, side x

DISKCOMP. Four attempts were made to read the


data from the diskette in the specified drive. The data
could not be read from the indicated track and side.

Unrecoverable read error on source


Track xx, side x

DISKCOPY. Four attempts were made to read the data


from the source diskette. DISKCOPY continues copying,
but the copy may contain incomplete data.

Unrecoverable verify error on target


Track xx, side x

DISKCOPY. Four attempts were made to verify the


write operation to the target diskette. DISKCOPY
continues copying, but the copy may contain
incomplete data.

A-27
Unrecoverable write error on target
Track xx, side x

DISKCOPY. Four attempts were made to write the


data to the target diskette. DISKCOPY continues
copying, but the copy may contain incomplete data.

Unresolved externals: list

LINK. The external sym boIs listed were not defined


in the modules or library files that you specified. If
this error occurs, do not attempt to run the executable
file created by the linker.

VM.TMP is an illegal file name and has been ignored

LINK.VM.TMP cannot be used for an object filename.


This message is only a warning.

Warning: no stack segment

LINK. None of the object modules specified contain


a statement allocating stack space, but you responded
with a non-zero entry to the STACK SPACE: prompt.

Write fault error writing drive x


Abort, Retry, Ignore?

DOS. See the message Disk error reading drive x.

Write protect error writing drive x


Abort, Retry, Ignore?

DOS. See the message Disk error reading drive x.

10 Mismatches-aborting compare

COMP. Ten mismatched locations were detected in the


files being compared. COMP assumes that the files are
so different that further comparisons would serve no
purpose.
A-28
APPENDIX B. DOS TECHNICAL
IN FORMAnON

Appendixes B-F are intended to supply technically


oriented users with information about the structure,
facilities, and program interfaces of DOS. It is assumed
that .the reader is familiar with the 8088 architecture,
interrupt mechanism, and instruction set.

DOS Structure
DOS consists of the following three components:

1. The boot record resides on track 0, sector 1, side


o of every diskette formatted by the FORMAT
command. It is put on all diskettes in order to
produce an error message if you try to start up the
system with a non-DOS diskette in drive A.

2. The Read-Only Memory (ROM) BIOS interface


module (file IBMBIO.COM) provides a low-level
interface to the ROM BIOS device routines. It also
contains routines to trap and report, via console
messages, divide-by-zero, printer out-of-paper, and
Asynchronous Communications Adapter error
situations.

3. The DOS program itself (file IBMDOS.COM)


provides a high-level interface for user programs.
It consists of file management routines, data
blocking/deblocking for the disk routines, and a
variety of built-in functions easily accessible by
user programs. (Refer to Appendix D.)

B-1
When these function routines are invoked by a
user program, they accept high-level information
(for device input/output) via register and control
block contents, then (for device operations)
translate the requirement into one or more calls
to IBMBIO to complete the request.

DOS InitiaIization
When the system is started (either System Reset or
power ON with the DOS diskette in drive A), the boot
record is read into memory and given control. It checks
the directory to assure that the first two files listed are
IBMBIO.COM and IBMDOS.COM, in that order. (An
error message is issued if not.) The boot record then
reads these two files into memory from absolute diskette
sectors (the file allocation table is not used to locate the
sectors for these files), starting at segment X'60', offset
o (absolute memory address X'600'), and jumps to that
location (the first byte of IBMBIO.COM).

The beginning of IBMBIO.COM contains a jump to its


initialization code, which is located at the high-address
end of the program. This area will later be used as stack
space by IBMBIO.COM. The initialization code
determines equipment status, resets the diskette system,
initializes the attached devices, and sets the low-
numbered interrupt vectors. It then relocates
IBMDOS.COM downward and calls the first byte of
DOS.

As in IBMBIO.COM, offset 0 in DOS contains a jump to


its initialization code, which will later be overlaid by a
data area and the command processor. DOS initializes
its internal working tables, determines the correct
memory locations for file allocation table (1 per drive),
directory and data buffers, initializes interrupt vectors
for interrupts X'20' through X'27' and builds a
Program Segment Prefix (see Appendix E) for
COMMAND.COM at the lowest available segment, then
returns to IBMBIO.COM.

B-2
The last remaining task of initialization is for
IBMBIO.COM to load COMMAND.COM at the
location set up by DOS initialization. IBMBIO.COM
then passes control to the first byte of COMMAND.

The Command Processor


The command processor supplied with DOS (file
COMMAND .COM) consists of three distinctly separate
parts:

1. A resident portion resides in memory immediately


following IBMDOS.COM and its data area. This
portion contains routines to process interrupt types
X'22' (terminate address), X'23' (CTRL-BREAK
handler), X'24' (critical error handling) and X'27'
(terminate but stay resident), as well as a routine to
reload the transient portion if needed. (When a
program terminates, a checksum methodology
determines if the program had caused the transient
portion to be overlaid. If so, it is reloaded.) Note
that all standard DOS disk error handling is done
within this portion of COMMAND. This includes
displaying error messages and interpreting the
reply of Abort, Retry, or Ignore. (See message
Disk error reading drive x in Appendix A.)

2. An initialization portion follows the resident


portion and is given control during startup. This
section contains the AUTOEXEC file processor
setup routine. The initialization portion
determines the segment address at which programs
can be loaded. It is overlaid by the first program
COMMAND loads because it's no longer needed.

B-3
3. A transient portion is loaded at the highest end of
memory. This is the command processor itself,
containing all of the internal command processors,
the batch file processor, and a routine to load and
execute external commands (files with filename
extensions of .COM or .EXE). This portion of
COMMAND produces the system prompt (such as
A> ), reads the command from the keyboard (or
batch file) and causes it to be executed. For
external commands, it builds a Program Segment
Prefix control block immediately following the
resident portion of COMMAND, loads the program
named in the command into the segment just
created, sets the terminate and CTRL-BREAK exit
address (interrupt vectors X'22' and X'23 ') to
point to the resident portion of COMMAND, then
gives control to the loaded program.

Note: Files with an extension of .EXE which


are designated to load into high memory are
loaded immediately below the transient
portion of COMMAND to prevent the loading
process from overlaying COMMAND itself.

Appendix E contains detailed information describing the


conditions in effect when a program is given control by
COMMAND.

Replacing the Command Processor

Though the command processor is an important part of


DOS, its functions may not be needed in certain
environments. Therefore, it has been designed as a user
program to allow its replacement.

B-4
Note: COMMAND.COM should only be replaced
by experienced programmers because of the
significant amount of function in the DOS
command processor.

If you decide to replace it with your own command


processor:

1. Name your program file COMMAND.COM.

2. The entry conditions are the same as for all .COM


programs.

3. Be sure to set the terminate and CTRL-BREAK exit


addresses in the interrupt vectors and in your own
Program Segment Prefix to transfer control to your
own code.

4. You must provide code to handle (and set the


interrupt vectors for) interrupt types X'22'
(terminate address), X'23' (CTRL-BREAK handler),
X'24' (critical error handling) and if needed X'27'
(terminate but stay resident). Your
COMMAND.COM is also responsible for reading
commands from the keyboard and loading and
executing programs, if needed.

Available DOS Functions


DOS provides a number of functions to user programs,
all available through issuance of a set of interrupt codes.
There are routines for keyboard input (with and without
echo and CTRL-BREAK detection), console and printer
output, constructing file control blocks, memory
management, date and time functions, and a variety of
diskette and file handling functions. See "DOS Interrupts
and Function Calls" in Appendix D for detailed
information.

B-5
Diskette/File Management Notes
Through the INT 21 (function call) mechanism, DOS
provides methods to create, read, write, rename, and
erase files. Files are not necessarily written sequentially
on diskette-space is allocated as it is needed, and the
first location available on the diskette is allocated as
the next location for a file being written. Therefore,
if considerable file creation and erasure activity has
taken place, newly created files will probably not be
written in sequential sectors.

However, due to the mapping (chaining) of file space


via the File Allocation Table, and the fields defined in
the File Control Block, any file can be used in either a
sequential or random manner. By using the current
block and current record fields of the FCB, and the
sequential disk read or write functions, you can make
the file appear sequential-DOS will do the calculations
necessary to locate the proper sectors on the diskette.
On the other hand, by using the random record field,
and random disk functions, you can cause any record
in the file to be accessed directly-again, DOS will
locate the correct sectors on the diskette for you.
Among the most powerful functions are the random
block read and write functions, which allow reading or
writing a large amount of data with one function caII-
this is how DOS loads programs. As above, DOS will
handle locating the correct sectors on diskette to
provide the image of sequential processing-you need
not be concerned about the physical location of data
on diskette.

Space is allocated in increments called clusters. For


single sided diskettes, this unit of allocation is one
sector; for dual sided diskettes, each cluster is two
consecutive sectors in length.

B-6
The Disk Transfer Area (DTA)
The Disk Transfer Area (also commonly called buffer)
is the memory area DOS will use to contain the data for
a\l disk reads and writes. This area can be at any
location within memory, and should be set by your
program. (See function call X"l A'.)

Only one DT A can be in effect at a time, so it is the


program's responsibility to inform DOS what memory
location to use before using any disk read or write
functions. Once set, DOS continues to use that area
for all disk operations until another function call X'IA'
is issued to define a new DT A. When a program is given
control by COMMAND, a default DTA has already been
established at X'80' into the program's Program Segment
Prefix, large enough to hold 128 bytes.

Error Trapping
DOS provides a method by which a program can receive
control whenever a disk read/write error occurs, or when
a bad memory image of the file allocation table is
detected. When these events occur, DOS executes an
INT X'24' to pass control to the error handler. The
default error handler resides in COMMAND.COM, but
any program can establish its own by setting the INT
X'24' vector to point to the new error handler. DOS
provides error information via the registers and provides
Abort, Retry, or Ignore support via return codes.
(Refer to "DOS Interrupts and Function Calls" in
Appendix D.)

B-7
General Guidelines
The following guidelines and tips should assist in
developing applications using the DOS disk read and
write functions:

1. All disk operations require a properly constructed


FCB that the program must supply.

2. Remember to set the Disk Transfer Area address


(function X' 1A') before performing any reads or
writes to a file.

3. All files must be opened (or created, in the case


of a new file) before being read from or written to.
Files which have been written to must also be
closed to ensure accurate directory information.

4. A program may define its own logical record size


by placing the desired size into the FCB. DOS
then uses that value to determine a record's
location within the file. If using the file size
function call, this field must be set by the calling
program prior to the function call. If using the
disk read and write routines, the field should be
set after opening (or creating) the file but before
any read or write functions are used. (Open
function sets the field to a default value of 128
bytes.)

5. New files must be created (function call X'16')


before they can be written to. This call creates
a new directory entry and opens the file.

B-8
6. If the amount of data being transferred is less than
one sector (512 bytes), DOS will buffer the data
for the requesting program in an internal buffer
within IBMDOS.COM. Because there is only one
disk buffer , performing less-than-sector-size
operations in a random manner or against multiple
files concurrently causes DOS to frequently
change the contents of the buffer. If such
operations are in output mode, this forces DOS
to write a partially full sector to make the buffer
available for any other diskette operation.

Subsequently, the partially full sector would have


to be re-read before further data could be written
to the file. This is called thrashing and can be very
time-consuming. To correct this situation, use of
the Random block read and write routines is
recommended, with a data transfer size as large as
possible. (An entire file can be read this way,
provided enough memory exists.) This method
bypasses the buffering described above, by reading
or writing directly to or from the DTA for as
much of the data as possible. If the file size is not
a multiple of 512 bytes, only the last portion of
the file (the portion past the last 5 12-byte
multiple) is buffered by DOS.

Example of Using DOS Functions


This example illustrates the steps necessary for a
program named TEST.COM to:

1. Create a new file named FILE 1.

2. Load and execute a second program named


PGM I.COM from the diskette in drive B.

B-9
The program is in a file named TEST.COM, and was
invoked from the keyboard by the command TEST
FILEI B:PGMl.COM.

When the program (TEST) receives control, the


Program Segment Prefix has been set up as shown in
Appendix E. The terminate, Ctd-Break, and critical
error exit addresses in the Program Segment Prefix
are the ones which the host (calling program) had
established and should not be modified-they are
restored to interrupt X'22', X'23', and X'24' vectors
when this program terminates. The FCBs at X'SC'
and X'6C' are formatted to contain file names of
FILE! and PGMl.COM, respectively-the first FCB
reflects the default drive and the second, drive B.
The default DTA is set to X'80' into the segment
(the unformatted parameter area of the Program
Segment Prefix).

Crea ting File FILE 1

Because it is known that the data in the FCB at X'6C'


is needed to load and execute the program whose name
it contains in a subsequent step, that FCB must be
preserved; opening the FCB at X'5C' would cause it to
be overlayed. The program should:

I. Copy the FCB at X'6C' to an area within itself.

2. Using the FCB at X'5C'; call function X' 11' to be


sure FILEI does not already exist-if it did exist,
it would be overwritten by this program.

3. Assuming it did not exist, create the file (function


call X'16')-the file is now open.

B-IO
4. Set the FCB current record and random record
fields to zero, and the record size field to the
desired size.

5. Build the memory image of the file's data.

6. Set the DTA to point to the memory image


(function call X' I A').

7. Use the sequential write (X' 15'), random write


(X'22'), or random block write (X'28') calls to
write the file, ensuring the FCB fields and DT A are
set properly for each call. In the case of call X'28'
(the preferred method), the entire file can be
written with one call by setting CX to the number
of records to be written (in terms of the FCB
record size field).

8. Close the FCB at X'5C' -the directory and file


allocation table are updated, and any partial data in
DOS's disk buffer (if it were performing blocking)
are written to disk.

Loading and Executing Program PGM1.COM


from Drive B.

Assume that the current program (TEST) wished to


control the action taken if CTRL-BREAK is entered.
(Until now, the CTRL-BREAK address still pointed to
COMMAND.COM, which would terminate program
TEST if CTRL-BREAK were pressed).

TEST should:

1. Set the terminate and CTRL-BREAK exit vectors


(call X'25') to point to code within itself (the
terminate address is where the program to be loaded
will return to when it terminates).

B-11
2. Determine where PGM l.COM should reside in
memory and set up a segment for it, induding a
Program Segment Prefix (call X'26'). This copies
the terminate and CTRL-BREAK exit addresses
just set into the new segment's Program Segment
Prefix.

3. Set the DTA to offset X'IOO' into the just-created


segment (be sure the DS register contains the
correct segment address). This is the offset at
which PGM I.COM will be loaded.

4. Open the FCB that had been copied earlier (for


PGM I.COM). The FCB file size field will be filled
in by open to a default value of 128 bytes.

5. Set the FCB record size field to the desired size.


Setting it to 1 is very useful in this case.

6. Set the CX register to the number of records (based


on the record size field) to read. If the record size
was set to 1, then the number of records to read
does not have to be computed-it can be obtained
directly from the FCB file size field. In any case,
if the product of the record size field and contents
of the CX register are equal to or greater than the
file size, then the entire file is read in the following
step.

7. Read the file, using the Random Block Read


function (call X'27'), into the new segment at
offset X' 100'. (See step 3 above.) There is no
need to close the file since it was not written to.

8. Prepare the DS, ES, SS and SP registers for the


loaded program and push a word of zeros on the top
of its stack.

B-12
9. Set the DT A to offset X'80' into the new segment.

10. Give control to the loaded program. An


intersegment jump is ideal, since it does not use
stack space. When the called program terminates
via INT X'20', DOS restores interrupt vectors
-
X'22', X'23', and X'24' from the values in the
terminating program's Program Segment Prefix
(the values established in step 1) and pass control
to the terminate exit address. TEST is now back
in control, and can itself issue an INT X'20',
which will cause its caller (COMMAND.COM)
to regain control.

Note: The example just presented was


intentionally simplified by using a memory-
image (.COM) program and by omitting
discussions of checking the return codes
provided by the DOS function calls.

Loading an .EXE file is more complicated due


to the file's structure and the need to resolve
addresses. Refer to Appendix F for detailed
information about the .EXE file structure and
loading.

B-13
B-14
APPENDIX C. DOS DISKETTE
ALLOCATION

The single-sided 40-track (0-39) diskettes have eight


sectors per track, with 512 bytes per sector.

DOS allocates space on the diskette as follows:

Track 0 sector 1 Boot record written by the


FORMAT command.

Track 0 sectors 2-3 Two copies of the File Allocation


Table (FAT), one in each sector.

Track 0 sectors 4-7 Directory.

Track 0 sector 8
to Data area.
Track 39 sector 8

Detailed descriptions of the directory and File Allocation


Table are presented in this appendix.

Dual sided diskettes contain the same number and size


of sectors per track, but they are used on both sides.
For performance reasons, space is allocated on sectors
1-8 on the first side of a track, followed by sectors 1-8
on the second side, before going on to side 0 of the
next track. The layout of space shown above also
applies to dual sided diskettes, except that the directory
is three sectors longer; the extra sectors are track 0,
sector 8, side 0, followed by track 0, sectors 1-2, side 1.
Thus, data space begins at track 0, sector 3, side 1.

The minimum allocation unit is one or two sectors;


therefore, all files begin on a sector boundary.

C-l
Files are not necessarily written sequentially on the
diskette. Diskette space for a file in the data area is
allocated one cluster at a time, skipping over clusters
already allocated. The first free cluster found will be the
next cluster allocated, regardless of its location on the
diskette. This permits the most efficient utilization
of diskette space because clusters made available by
erasing files can be allocated for new files. (Refer to
the description of the "DOS File Allocation Table.")

Note: If the diskette contains a copy of DOS, it


is placed in the data area as follows:

Single sided diskettes

IBMBIO.COM - track 0 sector 8 through


• track 1 sector 3
IBMDOS.COM - track 1 sector 4 through
track 2 sector 8

Dual sided dis ke ttes

IBMBIO.COM - track 0 side 1


sectors 3-6
IBMDOS.COM - track 0 side 1
sectors 7 -8 followed by
track 1 side 0
sectors 1-8 followed by
track 1 side 1
sectors 1-4

These two programs must reside at the specific


locations indicated so that the boot record can
successfully load them when the system is started.

C-2
DOS Diskette Directory

FORMAT builds the directory for single sided diskettes


on track 0 sectors 4-7, a total of 2048 bytes. The
directory has room for 64 entries, each 32 bytes long.
Dual sided diskette directories are seven sectors in
length and contain 112 entries (see "DOS
DISKETTE ALLOCATION" at the beginning of this
appendix for diskette locations).

Each directory entry is formatted as follows. Byte


offsets are in decimal.

0-7 Filename. (X'ES' in byte 0 means this directory


entry is not used.)

8-10 Filename extension.


""br.'
11 File attribute. Contents can be X'02' for a
hidden file and X'04' for a system file. (Both
files are excluded from all directory searches
unless an extended FCB with the appropriate
attribute byte is used.) For all other files this
byte contains X'OO'. A file can be designated
as hidden when it is created.

12-21 Reserved.

22-23 Time the file was created or last updated. The


time is mapped in the bits as follows:

< hh > < mm > < xx >


15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

where:

hh is the binary number of hours (0-23)


mm is the binary number of minutes (0-59)
xx is th€ binary number of two-second
increments

C-3
24-25 Date the file was created or last updated. The
mm/dd/yy are mapped in the bits as follows:

< 25 >< 24 >


15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
y y y y y y ymmmmddddd

where:

mm is 1-12
dd is 1-31
yy is 0-119 (1980-2099)

26-27 Starting cluster; the relative cluster number of


the first cluster in the file.

Note that the first cluster for data space on all


diskettes is always cluster 002. For single sided
diskettes, this is the sector at track 0, sector 8.
For dual sided diskettes, these are the two sectors
starting at track 0, sector 3, side 1.

The cluster number is stored with the least


significant byte first.

To determine the absolute diskette location of a


particular cluster, refer to "Diskette Maps" at the
end of this appendix.

28-31 File size in bytes. The first word contains the


low-order part of the size. Both words are
stored with the least significant byte first.

C-4
Note: If the diskette was formatted with
the /S option (FORMAT command), the
first three files in the directory are
IBMBIO.COM, IBMDOS.COM, and
COMMAND.COM.

The first two system files are placed on


specific sectors. Because they occupy
specific sectors and can not be moved,
they are protected from accidental erasure
or destruction by being excluded from
all directory searches. (See the file-
attribute byte in the directory.) For this
reason, they are called hidden files.

C-5
DOS File Allocation Table

The File Allocation Table (FAT) is used by DOS to


allocate diskette space for a file, one cluster at a
time.

The FAT consists of a 12-bit entry (1.5 bytes) for each


cluster on the diskette.

Note that the first two FAT entries map a portion of


the directory; these FAT entries contain indicators
of the size and format of the diskette.

A value of X'FEFFFF' in the first three bytes of the


FAT indicates a single sided diskette. Dual sided
diskettes are identified by X'FFFFFF' in these bytes.

The third FAT entry begins the mapping of the da ta


area.

Each entry contains three hexadecimal characters,


either:

000 if the sector is unused and available~


or
FFX to indicate the last sector of a file,
or
XXX any other hexadecimal characters that are the
cluster number of the next cluster in the file.
The cluster number of the first cluster in the
file is kept in the file's directory entry.

C-6
Note: The values FFO-FF7 are used to
indicate reserved clusters (FF7 indicates
bad clusters), and FFS-FFF are used as
end-of-file marks.

A copy of the F AT for the, last used diskette in each


drive is kept in memory, and is written to track 0
sectors 2 and 3 on side 0 whenever the status of
diskette space changes. (See "DOS Memory Map" in
Appendix E.)

C-7
How to Use the File Allocation Table
Obtain the starting cluster of the file from the
directory en try.

Determine the absolute diskette location from the


tables under "Diskette Maps" at the end of this
appendix.

Now, to locate the next cluster of the file (both single


and dual sided):

1. Multiply the cluster number just used by 1.5


(each FAT entry is 1.5 bytes long).

2. The whole part of the product is an offset into


the FAT, pointing to the entry that maps the
cluster just used. That entry contains the
cluster number of the next cluster of the file.

3. a
Use MOY instruction to move the word at the
calculated FAT offset into a register.

4. If the last cluster used was an even number, keep


the low-order 12 bits of the register; otherwise,
keep the high-order 12 bits.

5. If the resultant 12 bits are X'FFX', there are no


more clusters in the file. Otherwise, the 12 bits
contain the cluster number of the next cluster
in the file.

Diskette Maps
On the following pages, you will find tables of values
for a Single Sided Diskette Map and a Dual Sided
Diskette Map. The columns in these tables have the
following meanings:

TT Track
S Sector
H Side
SEC Relative Sector
CLU DOS Cluster Number

C-8
TT S H SEC CLV TT S H SEC CLV TT S H SEC CLV TT S H SEC CLV
o 1 0 0 0 o 2 0 1 0 o 3 0 2 0 o 4 0 3 0
o 5 0 4 0 o 6 0 5 0 o 7 0 6 0 o 8 0 7 2
1 108 3 1 209 4 1 3 0 A 5 1 4 0 B 6
1 5 0 C 7 1 6 0 D 8 1 7 0 E 9 1 8 0 F A
2 1 0 10 B 2 2 0 11 C 2 3 0 12 D 2 4 0 13 E
2 5 0 14 F 2 6 0 15 10 2 7 0 16 11 2 8 0 17 12
3 1 0 18 13 3 2 0 19 14 3 3 0 lA 15 3 4 0 IB 16
3 5 0 lC 17 3 6 0 ID 18 3 7 0 IE 19 3 8 0 IF lA
4 1 0 20 IB 4 2 0 21 lC 4 3 0 22 ID 4 4 0 23 IE
4 5 0 24 IF 4 6 0 25 20 4 7 0 26 21 4 8 0 27 22
5 1 0 28 23 5 2 0 29 24 5 3 0 2A 25 5 4 0 2B 26
5 5 0 2C 27 5 6 0 2D 28 5 7 0 2E 29 5 8 0 2F 2A
6 1 0 30 2B 6 2 0 31 2C 6 3 0 32 2D 6 4 0 33 2E
6 5 0 34 2F 6 6 0 35 30 6 7 0 36 31 6 8 0 37 32
7 1 0 38 33 7 2 0 39 34 7 3 0 3A 35 7 4 0 3B 36
7 5 0 3C 37 7 6 0 3D 38 7 7 0 3E 39 7 8 0 3F 3A
8 1 0 40 3B 8 2 0 41 3C 8 3 0 42 3D 8 4 0 43 3E
8 5 0 44 3F 8 6 0 45 40 8 7 0 46 41 8 8 0 47 42
9 1 0 48 43 9 2 0 49 44 9 3 0 4A 45 9 4 0 4B 46
9 5 0 4C 47 9 6 0 4D 48 9 7 0 4E 49 9 8 0 4F 4A
10 1 0 50 4B 10 2 0 51 4C 10 3 0 52 4D 10 4 0 53 4E
10 5 0 54 4F 10 6 0 55 50 10 7 0 56 51 10 8 0 57 52
11 1 0 58 53 11 2 0 59 54 11 3 0 5A 55 11 4 0 5B 56
11 5 0 5C 57 11 6 0 5D 58 11 7 0 5E 59 11 8 0 5F 5A
- - - - - - -

(j
I
\0 Figure 7 (Part 1 of 4). Single Sided Diskette Map
S3XION3ddV
-
('j

o
I TT
12
12
S
1
5
H
0
0
SEC
60
64
CLV
5B
SF
TT
12
12
S
2
6
H
0
0
SEC
61
65
CLV
5C
60
TT
12
12
S
3
7
H
0
0
SEC
62
66
CLV
5D
61
TT
12
12
S
4
8
H
0
0
SEC
63
67
CLV
5E
62
13 1 0 68 63 13 2 0 69 64 13 3 0 6A 65 13 4 0 6B 66
13 5 0 6C 67 13 6 0 6D 68 13 7 0 6E 69 13 8 0 6F 6A
14 1 0 70 6B 14 2 0 71 6C 14 3 0 72 6D 14 4 0 73 6E
14 5 0 74 6F 14 6 0 75 70 14 7 0 76 71 14 8 0 77 72
15 1 0 78 73 15 2 0 79 74 15 3 0 7A 75 15 4 0 7B 76
15 5 0 7C 77 15 6 0 7D 78 15 7 0 7E 79 15 8 0 7F 7A
16 1 0 80 7B 16 2 0 81 7C 16 3 0 82 7D 16 4 0 83 7E
16 5 0 84 7F 16 6 0 85 80 16 7 0 86 81 16 8 0 87 82
17 1 0 88 83 17 2 0 89 84 17 3 0 8A 85 17 4 0 8B 86
17 5 0 8C 87 17 6 0 8D 88 17 7 0 8E 89 17 8 0 8F 8A
18 1 0 90 8B 18 2 0 91 8C 18 3 0 92 8D 18 4 0 93 8E
18 5 0 94 8F 18 6 0 95 90 18 7 0 96 91 18 8 0 97 92
19 1 0 98 93 19 2 0 99 94 19 3 0 9A 95 19 4 0 9B 96
19 5 0 9C 97 19 6 0 9D 98 19 7 0 9E 99 19 8 0 9F 9A
20 1 0 AO 9B 20 2 0 Al 9C 20 3 0 A2 9D 20 4 0 A3 9E
20 5 0 A4 9F 20 6 0 AS AO 20 7 0 A6 Al 20 8 0 A7 A2
21 1 0 A8 A3 21 2 0 A9 A4 21 3 0 AA AS 21 4 0 AB A6
21 5 0 AC A7 21 6 0 AD A8 21 7 0 AE A9 21 8 0 AF AA
22 1 0 BO AB 22 2 0 Bl AC 22 3 0 B2 AD 22 4 0 B3 AE
22 5 0 B4 AF 22 6 0 B5 BO 22 7 0 B6 Bl 22 8 0 B7 B2
23 1 0 B8 B3 23 2 0 B9 B4 23 3 0 BA B5 23 4 0 BB B6
23 5 0 BC B7 23 6 0 BD B8 23 7 0 BE B9 23 8 0 BF BA

Fimre 7 (Part 2 of 4t Simde Sided Oiskette Man


TT S H SEC CLV TT S H SEC CLV TT S H SEC CLV TT S H SEC CLV
24 lOCO BB 24 2 0 Cl BC 24 3 0 C2 BD 24 4 0 C3 BE
24 5 0 C4 BF 24 6 0 C5 CO 24 7 0 C6 Cl 24 8 0 C7 C2
25 1 0 C8 C3 25 2 0 C9 C4 25 3 0 CA C5 25 4 0 CB C6
25 5 0 CC C7 25 6 0 CD C8 25 7 0 CE C9 25 8 0 CF CA
26 1 0 DO CB 26 2 0 Dl CC 26 3 0 D2 CD 26 4 0 D3 CE
26 5 0 D4 CF 26 6 0 D5 DO 26 7 0 D6 Dl 26 8 0 D7 D2
27 1 0 D8 D3 27 2 0 D9 D4 27 3 0 DA D5 27 4 0 DB D6
27 5 0 DC D7 27 6 0 DD D8 27 7 0 DE D9 27 8 0 DF DA
28 1 0 EO DB 28 2 0 El DC 28 3 0 E2 DD 28 4 0 E3 DE
28 5 0 E4 DF 28 6 0 E5 EO 28 7 0 E6 El 28 8 0 E7 E2
29 1 0 E8 E3 29 2 0 E9 E4 29 3 0 EA E5 29 4 0 EB E6
29 5 0 EC E7 29 6 0 ED E8 29 7 0 EE E9 29 8 0 EF EA
30 1 0 FO EB 30 2 0 Fl EC 30 3 0 F2 ED 30 4 0 F3 EE
30 5 0 F4 EF 30 6 0 F5 FO 30 7 0 F6 Fl 30 8 0 F7 F2
31 1 0 F8 F3 31 2 0 F9 F4 31 3 0 FA F5 31 4 0 FB F6
31 5 0 FC F7 31 6 0 FD F8 31 7 0 FE F9 31 8 0 FF FA
32 1 0 100 FB 32 2 0 101 FC 32 3 0 102 FD 32 4 0 103 FE
32 5 0 104 FF 32 6 0 105 100 32 7 0 106 101 32 8 0 107 102
33 1 0 108 103 33 2 0 109 104 33 3 0 lOA 105 33 4 0 lOB 106
33 5 0 10C 107 33 6 0 10D 108 33 7 0 lOE 109 33 8 0 10F lOA
34 1 0 110 lOB 34 2 0 III 10C 34 3 0 112 10D 34 4 0 113 10E
34 5 0 114 10F 34 6 0 115 110 34 7 0 116 111 34 8 0 117 112
35 1 0 118 113 35 2 0 119 114 35 3 0 l1A 115 35 4 0 lIB 116
35 5 0 llC 117 35 6 0 lID 118 35 7 0 lIE 119 35 8 0 I1F llA
('j I
......
I

...... Figure 7 (Part 3 of 4). Single Sided Diskette Map

S3XION3ddV
(j
I TT S H SEC CLV IT S H SEC CLV TT S H SEC CLV IT S H SEC CLV
~
N 36 1 0 120 lIB 36 2 0 121 lIC 36 3 0 122 lID 36 4 0 123 lIE
36 5 0 124 lIF 36 6 0 125 120 36 7 0 126 121 36 8 0 127 122
37 1 0 128 123 37 2 0 129 124 37 3 0 12A 125 37 4 0 12B 126
37 5 0 12C 127 37 6 0 12D 128 37 7 0 12E 129 37 8 0 12F 12A
38 1 0 130 12B 38 2 0 131 12C 38 3 0 132 12D 38 4 0 133 12E
38 5 0 134 12F 38 6 0 135 130 38 7 0 136 131 38 8 0 137 132
39 1 0 138 133 39 2 0 139 134 39 3 0 13A 135 39 4 0 13B 136
39 5 0 13C 137 39 6 0 13D 138 39 7 0 13E 139 39 8 0 13F 13A

Figure 7 (Part 4 of 4). Single Sided Diskette Map


TT S H SEC CLV TT S H SEC CLV TT S H SEC CLV TT S H SEC CLV I

0 100 0 o 2 0 1 0 o 3 0 2 0 o 4 0 3 0
o 5 0 4 0 o 6 0 5 0 o 7 0 6 0 o 8 0 7 0 I

1 108 5 1 209 5 1 3 0 A 6 1 4 0 B 6
1 SOC 7 1 6 0 D 7 1 7 0 E 8 1 8 0 F 8
2 1 0 10 D 2 2 0 11 D 2 3 0 12 E 2 4 0 13 E
2 5 0 14 F 2 6 0 15 F 2 7 0 16 10 2 8 0 17 10
3 1 0 18 15 3 2 0 19 15 3 3 0 lA 16 3 4 0 IB 16 I

3 5 0 lC 17 3 6 0 ID 17 3 7 0 IE 18 3 8 0 IF 18
4 1 0 20 ID 4 2 0 21 ID 4 3 0 22 IE 4 4 0 23 IE
4 5 0 24 IF 4 6 0 25 IF 4 7 0 26 20 4 8 0 27 20
5 1 0 28 25 5 2 0 29 25 5 3 0 2A 26 5 4 0 2B 26
5 5 0 2C 27 5 6 0 2D 27 5 7 0 2E 28 5 8 0 2F 28
6 1 0 30 2D 6 2 0 31 2D 6 3 0 32 2E 6 4 0 33 2E
6 5 0 34 2F 6 6 0 35 2F 6 7 0 36 30 6 8 0 37 30
7 1 0 38 35 7 2 0 39 35 7 3 0 3A 36 7 4 0 3B 36
7 5 0 3C 37 7 6 0 3D 37 7 7 0 3E 38 7 8 0 3F 38
8 1 0 40 3D 8 2 0 41 3D 8 3 0 42 3E 8 4 0 43 3E I

8 5 0 44 3F 8 6 0 45 3F 8 7 0 46 40 8 8 0 47 40
9 1 0 48 45 9 2 0 49 45 9 3 0 4A 46 9 4 0 4B 46 I

9 5 0 4C 47 9 6 0 4D 47 9 7 0 4E 48 9 8 0 4F 48
10 1 0 50 4D 10 2 0 51 4D 10 3 0 52 4E 10 4 0 53 4E
10 5 0 54 4F 10 6 0 55 4F 10 7 0 56 50 10 8 0 57 50
11 1 0 58 55 11 2 0 59 55 11 3 0 SA 56 11 4 0 5B 56
11 5 0 5C 57 11 6 0 5D 57 11 7 0 5E 58 11 8 0 SF 58 I

(j
I
~
W Figure 8 (Part 1 of 7). Dual Sided Diskette Map
S3XION3ddV
-
('j
I

~
TT S H SEC CLU
12
12
1 0 60
5 0 64
5D
5F
TT S H SEC CLU
12
12
2
6
0
0
61
65
5D
5F
TT S H SEC CLU
12
12
3
7
0
0
62
66
5E
60
TT S H SEC CLU
12
12
4
8
0
0
63
67
5E
60 /

13 1 0 68 65 13 2 0 69 65 13 3 0 6A 66 13 4 0 6B 66
13 5 0 6C 67 13 6 0 6D 67 13 7 0 6E 68 13 8 0 6F 68 I
14 1 0 70 6D 14 2 0 71 6D 14 3 0 72 6E 14 4 0 73 6E
14 5 0 74 6F 14 6 0 75 6F 14 7 0 76 70 14 8 0 77 70
15 1 0 78 75 15 2 0 79 75 15 3 0 7A 76 15 4 0 7B 76
15 5 0 7C 77 15 6 0 7D 77 15 7 0 7E 78 15 8 0 7F 78
16 1 0 80 7D 16 2 0 81 7D 16 3 0 82 7E 16 4 0 83 7E
16 5 0 84 7F 16 6 0 85 7F 16 7 0 86 80 16 8 0 87 80
17 1 0 88 85 17 2 0 89 85 17 3 0 8A 86 17 4 0 8B 86
17 5 0 8C 87 17 6 0 8D 87 17 7 0 8E 88 17 8 0 8F 88 I

18 1 0 90 8D 18 2 0 91 8D 18 3 0 92 8E 18 4 0 93 8E
18 5 0 94 8F 18 6 0 95 8F 18 7 0 96 90 18 8 0 97 90
19 1 0 98 95 19 2 0 99 95 19 3 0 9A 96 19 4 0 9B 96
I

19 5 0 9C 97 19 6 0 9D 97 19 7 0 9E 98 19 8 0 9F 98
20 1 0 AO 9D 20 2 0 Al 9D 20 3 0 A2 9E 20 4 0 A3 9E I

20 5 0 A4 9F 20 6 0 A5 9F 20 7 0 A6 AO 20 8 0 A7 AO
21 1 0 A8 A5 21 2 0 A9 A5 21 3 0 AA A6 21 4 0 AB A6
21 5 0 AC A7 21 6 0 AD A7 21 7 0 AE A8 21 8 0 AF A8
22 lOBO AD 22 2 0 Bl AD 22 3 0 B2 AE 22 4 0 B3 AE
22 5 0 B4 AF 22 6 0 B5 AF 22 7 0 B6 BO 22 8 0 B7 BO
23 1 0 B8 B5 23 2 0 B9 B5 23 3 0 BA B6 23 4 0 BB B6
23 5 0 BC B7 23 6 0 BD B7 23 7 0 BE B8 23 8 0 BF B8 I

Figure 8 (Part 2 of 7). Dual Sided Diskette Map


TT S H SEC CLV TT S H SEC CLV TT S H SEC CLV TT S H SEC CLV
24 lOCO BD 24 2 0 C1 BD 24 3 0 C2 BE 24 4 0 C3 BE
24 5 0 C4 BF 24 6 0 C5 BF 24 7 0 C6 CO 24 8 0 C7 CO
25 1 0 C8 C5 25 2 0 C9 C5 25 3 0 CA C6 25 4 0 CB C6
25 5 0 CC C7 25 6 0 CD C7 25 7 0 CE C8 25 8 0 CF C8
26 1 0 DO CD 26 2 0 Dl CD 26 3 0 D2 CE 26 4 0 D3 CE
26 5 0 D4 CF 26 6 0 D5 CF 26 7 0 D6 DO 26 8 0 D7 DO
27 1 0 D8 D5 27 2 0 D9 D5 27 3 0 DA D6 27 4 0 DB D6
27 5 0 DC D7 27 6 0 DD D7 27 7 0 DE D8 27 8 0 DF D8
28 1 0 EO DD 28 2 0 El DD 28 3 0 E2 DE 28 4 0 E3 DE
28 5 0 E4 DF 28 6 0 E5 DF 28 7 0 E6 EO 28 8 0 E7 EO
29 1 0 E8 E5 29 2 0 E9 E5 29 3 0 EA E6 29 4 0 EB E6
29 5 0 EC E7 29 6 0 ED E7 29 7 0 EE E8 29 8 0 EF E8
30 1 0 FO ED 30 2 0 Fl ED 30 3 0 F2 EE 30 4 0 F3 EE
30 5 0 F4 EF 30 6 0 F5 EF 30 7 0 F6 FO 30 8 0 F7 FO
31 1 0 F8 F5 31 2 0 F9 F5 31 3 0 FA F6 31 4 0 FB F6
31 5 0 FC F7 31 6 0 FD F7 31 7 0 FE F8 31 8 0 FF F8
32 1 0 100 FD 32 2 0 101 FD 32 3 0 102 FE 32 4 0 103 FE
32 5 0 104 FF 32 6 0 105 FF 32 7 0 106 100 32 8 0 107 100
33 1 0 108 105 33 2 0 109 105 33 3 0 lOA 106 33 4 0 lOB 106
33 5 0 10C 107 33 6 0 10D 107 33 7 0 10E 108 33 8 0 10F 108
34 1 0 110 10D 34 2 0 III 10D 34 3 0 112 10E 34 4 0 113 10E
34 5 0 114 10F 34 6 0 115 10F 34 7 0 116 110 34 8 0 117 110
35 1 0 118 115 35 2 0 119 115 35 3 0 11A 116 35 4 0 lIB 116
(j
I
35 5 0 11C 117 35 6 0 lID 117 35 7 0 lIE 118 35 8 0 11F 118
_L_.
~ - - - - - -

VI
Figure 8 (Part 3 of 7). Dual Sided Diskette Map
S3:XION3:ddV
'IT S H SEC CLU TT S H SEC CLU TT S H SEC CLU 'IT S H SEC CLU
o
-
0 '\
36
36
1
5
0
0
120
124
lID
I1F
36
36
2
6
0
0
121
125
lID
IIF
36
36
3
7
0
0
122
126
lIE
120
36
36
4
8
0
0
123
127
lIE
120
37 1 0 128 125 37 2 0 129 125 37 3 0 12A 126 37 4 0 12B 126
37 5 0 12C 127 37 6 0 12D 127 37 7 0 12E 128 37 8 0 12F 128
38 1 0 130 12D 38 2 0 131 12D 38 3 0 132 12E 38 4 0 133 12E
38 5 0 134 12F 38 6 0 135 12F 38 7 0 136 130 38 8 0 137 130
39 1 0 138 135 39 2 0 139 135 39 3 0 13A 136 39 4 0 13B 136
39 5 0 13C 137 39 6 0 13D 137 39 7 0 13E 138 39 8 0 13F 138
o 1 1 140 0 o 2 1 141 0 o 3 1 142 2 o 4 1 143 2
o 5 1 144 3 o 6 1 145 3 o 7 1 146 4 o 8 1 147 4
1 1 1 148 9 1 2 1 149 9 1 3 1 14A A 1 4 1 14B A
1 5 1 14C B 1 6 1 14D B 1 7 1 14E C 1 8 1 14F C
2 1 1 150 11 2 2 1 151 11 2 3 1 152 12 2 4 1 153 12
2 5 1 154 13 2 6 1 155 13 2 7 1 156 14 2 8 1 157 14
3 1 1 158 19 3 2 1 159 19 3 3 1 15A lA 3 4 1 15B lA
3 5 1 15C IB 3 6 1 15D IB 3 7 1 15E lC 3 8 1 15F lC
4 1 1 160 21 4 2 1 161 21 4 3 1 162 22 4 4 1 163 22
4 5 1 164 23 4 6 1 165 23 4 7 1 166 24 4 8 1 167 24
5 1 1 168 29 5 2 1 169 29 5 3 1 16A 2A 5 4 1 16B 2A
5 5 1 16C 2B 5 6 1 16D 2B 5 7 1 16E 2C 5 8 1 16F 2C
6 1 1 170 31 6 2 1 171 31 6 3 1 172 32 6 4 1 173 32
6 5 1 174 33 6 6 1 175 33 6 7 1 176 34 6 8 1 177 34
7 1 1 178 39 7 2 1 179 39 7 3 1 17A 3A 7 4 1 17B 3A
7 5 1 17C 3B 7 6 1 17D 3B 7 7 1 17E 3C 7 8 1 17F 3C

Figure 8 (Part 4 of 7). Dual Sided Diskette Map


TT S H SEC CLV IT S H SEC CLV TT S H SEC CLV IT S H SEC CLV I

8 1 1 180 41 8 2 1 181 41 8 3 1 182 42 8 4 1 183 42 I

8 5 1 184 43 8 6 1 185 43 8 7 1 186 44 8 8 1 187 44


9 1 1 188 49 9 2 1 189 49 9 3 1 18A 4A 9 4 1 18B 4A !

9 5 1 18C 4B 9 6 1 18D 4B 9 7 1 18E 4C 9 8 1 18F 4C


10 1 1 190 51 10 2 1 191 51 10 3 1 192 52 10 4 1 193 52
10 5 1 194 53 10 6 1 195 53 10 7 1 196 54 10 8 1 197 54
11 1 1 198 59 11 2 1 199 59 11 3 1 19A SA 11 4 1 19B SA
11 5 1 19C 5B 11 6 1 190 5B 11 7 1 19E 5C 11 8 1 19F 5C
12 1 1 lAO 61 12 2 1 lAI 61 12 3 1 lA2 62 12 4 1 lA3 62
12 5 1 IA4 63 12 6 1 lAS 63 12 7 1 IA6 64 12 8 1 lA7 64
13 1 1 lA8 69 13 2 1 lA9 69 13 3 1 lAA 6A 13 4 1 lAB 6A
13 5 1 lAC 6B 13 6 1 lAD 6B 13 7 1 lAE 6C 13 8 1 lAF 6C
14 1 1 IBO 71 14 2 1 IBI 71 14 3 1 IB2 72 14 4 1 IB3 72
14 5 1 IB4 73 14 6 1 IB5 73 14 7 1 IB6 74 14 8 1 1B7 74
15 1 1 IB8 79 15 2 1 IB9 79 15 3 1 IBA 7A 15 4 1 IBB 7A
15 5 1 IBC 7B 15 6 1 1BO 7B 15 7 1 IBE 7C 15 8 1 IBF 7C
16 1 1 lCO 81 16 2 ] lCI 81 16 3 1 lC2 82 16 4 1 lC3 82
16 5 1 lC4 83 16 6 1 lC5 83 16 7 1 lC6 84 16 8 1 lC7 84
17 1 1 lC8 89 17 2 1 lC9 89 17 3 1 ICA 8A 17 4 1 lCB 8A
17 5 1 ICC 8B 17 6 1 lCD 8B 17 7 1 ICE 8C 17 8 1 lCF 8C
18 1 lIDO 91 18 2 1 101 91 18 3 1 102 92 18 4 1 103 92
18 5 1 104 93 18 6 1 IDS 93 18 7 1 ID6 94 18 8 1 ID7 94
19 1 1 108 99 19 2 1 ID9 99 19 3 1 IDA 9A 19 4 1 lOB 9A
\) 19 5 1 IDC 9B 19 6 lIDO 9B 19 7 1 IDE 9C 19 8 1 IDF 9C
.....
-...J
Figure 8 (Part 5 of 7). Dual Sided Diskette Map
S3XIGN3ddV
-
Q
00
TT S H SEC
20
20
1 1 lEO
5 1 IE4
CLV
Al
A3
TT
20
20
S
2
6
H
1
1
SEC
lEI
IE5
CLV
Al
A3
TT
20
20
S
3
7
H SEC
1 IE2
1 IE6
CLV
A2
A4
IT S H SEC CLV
20
20
4
8
4
1
1
1
IE3
lE7
IEB
A2
A4
AA
21 1 1 IE8 A9 21 2 1 IE9 A9 21 3 1 lEA AA 21
21 5 1 IEC AB 21 6 1 lED AB 21 7 1 lEE AC 21 8 1 IEF AC
22 1 1 IFO BI 22 2 1 IFI BI 22 3 1 IF2 B2 22 4 1 IF3 B2
22 5 1 IF4 B3 22 6 1 IF5 B3 22 7 1 IF6 B4 22 8 1 IF7 B4
23 1 1 IF8 B9 23 2 1 IF9 B9 23 3 1 IFA BA 23 4 1 IFB BA
23 5 1 IFC BB 23 6 1 IFD BB 23 7 lIFE BC 23 8 1 IFF BC
24 1 1 200 CI 24 2 1 201 CI 24 3 1 202 C2 24 4 1 203 C2
24 5 1 204 C3 24 6 1 205 C3 24 7 1 206 C4 24 8 1 207 C4
25 1 1 208 C9 25 2 1 209 C9 25 3 1 20A CA 25 4 1 20B CA
25 5 1 20C CB 25 6 1 20D CB 25 7 1 20E CC 25 8 1 20F CC
26 1 1 210 DI 26 2 1 211 Dl 26 3 1 212 D2 26 4 1 213 D2
26 5 1 214 D3 26 6 1 215 D3 26 7 1 216 D4 26 8 1 217 D4
27 1 1 218 D9 27 2 1 219 D9 27 3 1 21A DA 27 4 1 21B DA
27 5 1 21C DB 27 6 1 21D DB 27 7 1 21E DC 27 8 1 21F DC
28 1 1 220 El 28 2 1 221 El 28 3 1 222 E2 28 4 1 223 E2
28 5 1 224 E3 28 6 1 225 E3 28 7 1 226 E4 28 8 1 227 E4
29 1 1 228 E9 29 2 1 229 E9 29 3 1 22A EA 29 4 1 22B EA
29 5 1 22C EB 29 6 1 22D EB 29 7 1 22E EC 29 8 1 22F EC
30 1 1 230 Fl 30 2 1 231 Fl 30 3 1 232 F2 30 4 1 233 F2
30 5 1 234 F3 30 6 1 235 F3 30 7 1 236 F4 30 8 1 237 F4
31 1 1 238 F9 31 2 1 239 F9 31 3 1 23A FA 31 4 1 23B FA
31 5 1 23C FB 31 6 1 23D FB 31 7 1 23E FC 31 8 1 23F FC

Figure 8 (Part 6 of 7). Dual Sided Diskette Map


IT S H SEC CLV TT S H SEC CLV TT S H SEC CLV TT S H SEC CLV
I

32 1 1 240 101 32 2 1 241 101 32 3 1 242 102 32 4 1 243 102


32 5 1 244 103 32 6 1 245 103 32 7 1 246 104 32 8 1 247 104 I

33 1 1 248 109 33 2 1 249 109 33 3 1 24A lOA 33 4 1 24B lOA


33 5 1 24C lOB 33 6 1 24D lOB 33 7 1 24E 10C 33 8 1 24F 10C I

34 1 1 250 III 34 2 1 251 III 34 3 1 252 112 34 4 1 253 112


34 5 1 254 113 34 6 1 255 113 34 7 1 256 114 34 8 1 257 114 I

35 1 1 258 119 35 2 1 259 119 35 3 1 25A IIA 35 4 1 25B IIA


35 5 1 25C llB 35 6 1 25D lIB 35 7 1 25E llC 35 8 1 25F IIC I

36 1 1 260 121 36 2 1 261 121 36 3 1 262 122 36 4 1 263 122


36 5 1 264 123 36 6 1 265 123 36 7 1 266 124 36 8 1 267 124
37 1 1 268 129 37 2 1 269 129 37 3 1 26A 12A 37 4 1 26B 12A
37 5 1 26C 12B 37 6 1 26D 12B 37 7 1 26E 12C 37 8 1 26F 12C
38 1 1 270 131 38 2 1 271 ] 31 38 3 1 272 132 38 4 1 273 132'
38 5 1 274 133 38 6 1 275 133 38 7 1 276 134 38 8 1 277 134
39 1 1 278 139 39 2 1 279 139 39 3 1 27A 13A 39 4 1 27B 13A
39 5 1 27C 13B 39 6 1 27D 13B 39 7 1 27E 13C 39 8 1 27F 13C

-
Q
\0
Figure 8 (Part 7 of 7). Dual Sided Diskette Map
S3XION3ddV
C-20
APPENDIX D. DOS INTERRUPTS AND
FUNCTION CALLS

Interrupts
DOS reserves interrupt types X'20' to X'3F' for its use.
This means absolute memory locations X'80' to X'FF'
are the transfer address locations reserved by DOS. The
defined interrupts are as follows with all values in
hexadecimal.

20 Program terminate. Issuing Interrupt X'20' is the


normal way to exit from a program. This vector
transfers to the logic in DOS for restoration of the
terminate, Ctrl-Break, and critical error exit
addresses to the values they had on entry to the
program. All file buffers are flushed to diskette.
All files changed in length should be closed (see
function call X' 10') prior to issuing this interrupt.
I[ the changed file is not closed, its length is not
recorded correctly in the directory.

Note: Every program must ensure that the


CS register contains the segment address of its
Program Segment Prefix control block prior
to issuing INT X'20'.

21 Function request. Refer to "Function Calls" in


this appendix.

D-l
22 Terminate address. The address represented by this
interrupt is the address to which control transfers
when the program terminates. This address is
copied into the program's Program Segment Prefix
at the time the segment is created. If a program
wishes to execute a second program it must set the
terminate address prior to creating the segment into
which the new program will be loaded. Otherwise,
when the second program executes, its termination
would cause transfer to its host's termination
address. This address, as wen as the CTRL-BREAK
address below, may be set via DOS function call
X'2S'.

23 Ctrl-Break exit address. If the user enters


Ctrl-Break during keyboard input or display output,
an interrupt type X'23' is executed. If the
Ctrl-Break routine saves all registers, it may end
with a return-from-interrupt instruction (lRET) to
continue program execution. If the Ctrl-Break
interrupts functions 9 or 10, buffered I/O, then
I\C, carriage-return, and linefeed are output. If
execution is then continued with an IRET, I/O
continues from the start of the line. When the
interrupt occurs, all registers are set to the value
they had when the original function call to DOS
was made. There are no restrictions on what the
Ctrl-Break handler is allowed to do, including
DOS function calls, as long as the registers are
unchanged if IRET is used.

If the program creates a new segment and loads


in a second program which itself changes the
Ctrl-Break address, the termination of the second
program and return to the first causes the
Ctrl-Break address to be restored to the value it
had before execution of the second program. (It
is restored from the second program's Program
Segment Prefix.)

D-2
24 Critical error handler vector. When a critical
error occurs within DOS, control is transferred with
an INT 24H. On entry to the error handler, AH
will have its bit 7=0 (high-order bit) if the error
was a hard disk error (probably the most common
occurrence), bit 7= 1 if not.

Currently, the only error possible when AH bit 7= I


is a bad memory image of the file allocation table.

If it is a hard error on diskette, register AL contains


the failing drive number (0 = drive A, etc.); AH
bits 0-2 indicate the affected disk area and whether
it was a read or write operation, as follows:

Bit 0=0 if read operation,


1 if write operation.

Bits 2-1 (affected disk area)

o0 DOS area (system files)


o1 file allocation table
1 0 directory
1 1 data area

The registers will be set up for a retry operation,


and an error code will be in the lower half of the
DI register with the upperhalf undefined. These
are the error codes:

Error code Description

o Attempt to write on write-protected


diskette
2 Drive not ready
4 Data error
6 Seek error
8 Sector not found
A Write fault
C General disk failure

D-3
The user stack will be in effect (the first item
described below is at the top of the stack), and will
contain the following from top to bottom:

IP DOS registers from issuing INT X'24'


es
FLAGS

AX User registers at time of original


BX INT X'21 ' request
ex
OX
SI
01
BP
OS
ES

IP From the original interrupt X'21'


es from the user to DOS
FLAGS

The registers are set such that if an IRET is


executed, DOS will respond according to (AL) as
follows:

(AL )=0 ignore the error.

=1 retry the operation (If this option is used,


then the stack, SP, SS, OS, BX, ex, and
OX must not be modified.)

=2 end the program.

D-4
Notes:

1. Before giving this routine control for


disk errors, DOS perfonns three retries.

2. For disk errors, this exit is taken only


for errors occurring during an INT X'2 1'
function call. It is not used for INT
X'25' or X'26'.

3. If you decide to handle the error


yourself without returning to DOS, be
sure to restore your registers from the
stack (above). The first and last three
words shown should be removed from
the stack and discarded. Also, this
routine should enable interrupts because
it was entered with interrupts disabled.

25 Absolute disk read. This transfers control directly


to the DOS BIOS. Upon return, the original flags
are still on the stack (put there by the INT
instruction). This is necessary because return
information is passed back in the current flags.
Be sure to pop the stack to prevent uncontrolled
growth. For this entry point records and sectors
are the same size. The request is as follows:

(AL) Drive number (for example, O=A or


I=B)
(eX) Number of sectors to read
(DX) Beginning logical record number
(DS:BX) Transfer address

D-5
The number of records specified are transferred
between the given drive and the transfer address.
Logical record numbers are obtained by numbering
each sector sequentially starting from zero and
continuing across track boundaries. For example,
logical record number 0 is track 0, sector 1, side 0,
whereas logical record number X' 12' is track 2,
sector 3, side O. Numbering continues with
record numbers l40-27F on the second side of a
dual sided diskette, beginning at track 0, sector 1,
side 1.

All registers except the segment registers are


, destroyed by this call. If the transfer was
successful the carry flag (CF) will be zero. If the
transfer was not successful CF= I and (AL) will
indicate the error as follows:

X'80' Attachment failed to respond


X'40' SEEK operation failed
X'20' Controller failure
X'lO' Bad CRC on diskette read
X'08' DMA overrun on operation
X'04' Requested sector not found
X'03' Write attempt on write-protected diskette
X'02' Address mark not found

26 Absolute disk write. This vector is the counterpart


of interrupt 25 above. Except for the fact that this
is a write, the description above applies.

27 Terminate but stay resident. This vector is used by


programs that are to remain resident when
COMMAND regains control. After initializing
itself, the program must set DX to its last address
plus one in the segment in which it is executing
(the offset at which COMMAND can load other
programs), then execute an INT 27H. COMMAND
then considers the program as an extension of DOS,
so the program is not overlaid when other programs
are executed. This concept is very useful for
loading programs such as user-written interrupt
handlers which must remain resident.

Note: This interrupt must not be used by


.EXE programs which are loaded in to the
high end of memory.
D-6
Function Calls
DOS functions are called by placing a function number
in the AH register, supplying additional information in
other registers as necessary for the specific function,
then executing an interrupt type X'21 '. When DOS
takes control it switches to an internal stack. User
registers are preserved unless information is passed
back to the requester as indicated in the specific requests.
The user stack needs to be sufficient to accommodate
the interrupt system. It is recommended that it be
X'80' in addition to the user needs.

There is an additional mechanism provided for pre-


existing programs that were written with different
calling conventions. The function number is placed in
the CL register, other registers are set according to the
function specification, and an intrasegment call is
made to location 5 in the current code segment. That
location contains a long call to the DOS function
dispatcher. Register AX is always destroyed if this
mechanism is used; otherwise, it is the same as normal
function calls. This method is valid only for function
calls 0-24 (hexadecimal).

D-7
The functions are as follows with all values in
hexadecimal.

o Program terminate. The terminate and


CTRL-BREAK exit addresses are re"stored to the
values they had on entry to the terminating
program, from the values saved in the Program
Segment Prefix. All file buffers are flushed, but
any files which have been changed in length but
not closed will not be recorded properly in the
directory. Control transfers to the terminate
address.

Note: This call performs exactly the same


function as INT 20R. It is the program's
responsibility to ensure that the CS register
contains the segment address of its Program
Segment Prefix control block prior to calling
this function.

Keyboard input. Waits for a character to be typed


at the keyboard (unless one is ready), then echos
the character to the display and returns it in AL.
The character is checked for a CTRL-BREAK. If
CTRL-BREAK is detected an interrupt X'23' is
executed.

Note: For functions I, 6, 7, and 8, extended


ASCII codes will require two function calls.
(See the IBM Personal Computer BASIC
manual for a description of the extended
ASCII codes.) The first call returns 00 as an
indicator that the next call will return an
extended code.

2 Display output. The character in DL is output to


the display. The backspace character results in
moving the cursor left one position, writing a space
at this position and remaining there. If a
CTRL-BREAK is detected after the output an
interrupt X'23' is executed.

D-8
3 Auxiliary (Asynchronous Communications
Adapter) input. Waits for a character from the
auxiliary input device, then returns that character
in AL.

Notes:

1. Auxiliary support is unbuffered and


non-interrupt driven.

2. At start-up, DOS initializes the first


auxiliary port to 2400 baud, no parity,
one stop bit, and 8-bit word.

3. The auxiliary function calls (3 and 4) do


not return status or error codes. For
greater control, it is recommended that
the ROM BIOS routine (lNT X' 14') be
used.

4 Auxiliary (Asynchronous Communications


Adapter) output. The character in DL is output
to the first auxiliary device.

5 Printer output. The character in DL is output to


the first printer.

6 Direct console I/O. If DL is X'FF', AL returns


with the zero flag clear and a keyboard input
character if one is ready. If a character is not ready,
the zero flag will be set. If DL is not X'FF', then
DL is assumed to have a valid character which is
output to the display. This function does not
check for Ctrl-Break.

7 Direct console input without echo. Waits for a


character to be typed at the keyboard (unless one
is ready), then returns the character in AL. As with
function 6, no checks are made on the character.

D-9
8 Console input without echo. This function is
identical to function I, except the key is not
echoed.

9 Print string. On entry, DS :DX must point to a


character string in memory terminated by a $
(X'24'). Each character in the string will be
output to the display in the same form as
function 2.

A Buffered keyboard input. On entry, DS:DX points


to an input buffer. The first byte must not be
zero and specifies the number of characters the
buffer can hold. Characters are read from the
keyboard and placed in the buffer beginning at the
third byte. Reading the keyboard and filling the
buffer continues until Enter is pressed. If the
buffer fills to one less than the maximum number
of characters it can hold, then each additional
character typed is ignored and causes the bell to
ring, until Enter is pressed. The second byte of
the buffer is set to the number of characters
received excluding the carriage return (X'OD'),
which is always the last character. Editing of this
buffer is described in Chapter 1.

B Check keyboard status. If a character is available


from the keyboard, AL will be X'FF'. Otherwise,
AL will be 00. If a CTRL-BREAK is detected, an
interrupt type X'23' is executed.

C Clear keyboard buffer and invoke a keyboard input


function. Clear the keyboard buffer of any
pre-typed characters, then execute the function
number in AL (only 1, 6, 7, 8, and A are allowed).
This forces the system to wait until a character is
typed.

D-I0
D Disk reset. Selects drive A as the default drive,
sets the disk transfer address to DS:80, and flushes
all file buffers. Files changed in size but not
closed are not properly recorded in the disk
directory. This function need not be called before
a diskette change if all files written have been
closed.

E Select disk. The drive specified in DL (O=A, 1=B)


is selected (if valid) as the default drive. The
number of drives is returned in AL. (A value of
2 is returned on a single-drive system to be
consistent with the philosophy of thinking of the
system as having logical drives A and B. BIOS
equipment determination (INT 11 H) can be used
as an alternative method, returning the actual
number of physical drives.)

F Open file. On entry, DS:DX point to an


unopened file control block (FCB). The
directory is searched for the named file and AL
returns X'FF' if it is not found. If it is found, AL
returns 00 and the FCB is filled as follows:

If the drive code was 0 (default drive), it is


changed to actual drive used (1 =A, 2=B). This
allows changing the default drive without
interfering with subsequent operations on this
file. The current block field (FCB bytes C-D) is
set to zero. The size of the record to be
worked with (FCB bytes E-F) is set to the
system default of X'80'. The size of the file
and the date are set in the FCB from information
obtained from the directory.

D-ll
It is your responsibility to set the record size (FCB
bytes E-F) to the size you wish to think of the file
in terms of, if the default X'80' is insufficient. It is
also your responsibility to set the random record
field and/or current record field. These actions
should be done after open but before any disk
operations are requested.

10 Close file. This function must be called after file


writes to insure all directory information is updated.
On entry, DS:DX point to an opened FCB. The
disk directory is searched and if the file is found,
its position is compared with that kept in the FCB.
If the file is not found in its correct position in the
directory, it is assumed the diskette was changed
and AL returns X'FF'. Otherwise, the directory
is updated to reflect the status in the FCB and AL
returns 00.

11 Search for the first entry. On entry, DS:DX point


to an unopened FCB. The disk directory is searched
for the first matching filename (name could have
"?"s indicating any letter matches) and if none are
found AL returns X'FF'. Otherwise, AL returns
00 and the locations at the disk transfer address
are set as follows:

If the FCB provided for searching was an


extended FCB, then the first byte at the disk
transfer address is set to X'FF', followed by
five bytes of zeros, then the attribute byte from
the search FCB, then the drive number used
(1 =A, 2=B), then the 32 bytes of the directory
entry. Thus, the disk transfer address contains
a valid unopened extended FCB with the same
search attributes as the search FCB.

D-12
If the FCB provided for searching was a normal
FCB, then the first byte is set to the drive number
used (1 =A, 2=B), and the next 32 bytes contain
the matching directory entry. Thus, the disk
transfer address contains a valid unopened normal
FCB.

Refer to the section called "DOS Diskette


Allocation" in Appendix C for the format of
directory entries.

12 Search for the next entry. After function 11 has


been called and found a match, function 12 may
be called to find the next match to an am biguous
request (?s in the search filename). Both inputs
and outputs are the same as function 11. The
reserved area of the FCB keeps information
necessary for continuing the search, so no disk
operations may be performed with this FCB
between a previous function 11 or 12 call and this
one.

13 Delete file. On entry, DS:DX point to an unopened


FCB. All matching directory entries are deleted.
If no directory entries match, AL returns X'FF',
otherwise AL returns 00.

14 Sequential read. On entry, DS:DX point to an


opened FCB. The record addressed by the current
block (FCB bytes C-D) and the current record
(FCB byte 1F) is loaded at the disk transfer
address, then the record address is incremented.
(The length of the record is determined by the
FCB record size field.) If end-of-file is encountered,
AL returns either 01 or 03. A return of 0 1
indicates no data in the record, 03 indicates a
partial record is read and filled out with zeros. A
return of 02 means there was not enough space
in the disk transfer segment to read one record; so,
the transfer was ended. AL returns 00 if the
transfer was completed successfully.

D-13
15 Sequential write. On entry, DS :DX point to an
opened FCB. The record addressed by the current
block and current record fields (size determined
by the FCB record size field) is written from the
disk transfer address (or, in the case of records
less than sector sizes, is buffered up for an eventual
write when a sector's worth of data is accumulated).
The record address is then incremented. If the
diskette is full AL returns 01. A return of 02 means
there was not enough space in the disk transfer
segment to write one record, so the transfer was
ended. AL returns 00 if the transfer was
completed successfully.

16 Create file. On entry, DS:DX point to an


unopened FCB. The disk directory is searched for
a matching entry and if found, it is re-used. If no
match was found, the directory is searched for an
empty entry, and AL returns FF if none is found.
Otherwise, the en try is initialized to a zero-length
file, the file is opened (see function F), and AL
returns 00.

The file may be marked hidden during its creation


by using an extended FCB containing the
appropriate attribute byte.

D-14
17 Rename file. On entry, DS:DX point to a
modified FCB which has a drive code and file name
in the usual position, and a second file name
starting 6 bytes after the first (DS:DX+X'II') in
what is normally a reserved area. Every matching
occurrence of the first name is changed to the
second (with the restriction that two files cannot
have the same name and extension). If?s appear
in the second name, then the corresponding
positions in the original name will be unchanged.
AL returns FF if no match was found or if an
attempt was made to rename to a filename that
already existed, otherwise 00.

18 Not used

19 Current disk. AL returns with the code of the


current default drive (O=A, 1=B).

1A Set disk transfer address. The disk transfer


address is set to DS:DX. DOS does not allow disk
transfers to wrap around within the segment, or
overflow into the next segment.

1B Allocation table address. On return, DS :DX


point to the file allocation table for the current
drive, DX has the number of allocation units, AL
has the number of records per allocation unit, and
CX has the size of the physical sector.

IC Not used

ID Not used

IE Not used

IF Not used

D-15
20 Not used

21 Random read. On entry, DS:DX point to an


opened FCB. The current block and current record
fields are set to agree with the random record field,
then the record addressed by these fields is read
into memory at the current disk transfer address.
If end-of-file is encountered, AL returns either 0 I
or 03. If 01 is returned, no more data is available.
If 03 is returned, a partial record is available filled
out with zeros. A return of 02 means there was
not enough space in the disk transfer segment to
read one record, so the transfer was ended. AL
returns 00 if the transfer was com pleted
successfully.

22 Random write. On entry, DS :DX point to an


opened FCB. The curren t block and curren t record
fields are set to agree with the random record field,
then the record addressed by these fields is
written (or in the case of records not the same as
sector sizes-buffered) from the disk transfer
address. If the diskette is full AL returns 01. A
return of 02 means there was not enough space in
the disk transfer segment to write one record; so,
the transfer was ended. AL returns 00 if the
transfer was completed successfully.

23 File size. On entry, DS:DX point to an unopened


FCB. The diskette directory is searched for the
first matching entry and if none is found, AL
returns FF. Otherwise, the random record field
is set to the number of records in the file (in terms
of the record size field rounded up) and AL returns
00.

Note: Be sure to set the FCB record size field


before using this function call; otherwise,
erroneous information will be returned.

D-16
24 Set random record field. On entry, DS:DX point
to an opened FCB. This function sets the random
record field to the same file address as the current
block and record fields.

25 Set interrupt vector. The interrupt vector table


for the interrupt type specified in AL is set to the
4-byte address contained in DS:DX.

26 Create a new program segment. On entry, DX has


a segment number at which to set up a new
program segment. The entire X'IOO' area at
location zero in the current program segment is
copied into location zero in the new program
segment. The memory size information at location
6 in the new segment is updated and the current
termination and CTRL-BREAK exit addresses
(from interrupt vector table entries for interrupt
types 22 and 23) are saved in the new program
segment starting at X'OA'. They are restored from
this area when the program terminates.

27 Random block read. On entry, DS:DX point to an


opened FCB, and CX contains a record count that
must not be zero. The specified number of records
(in terms of the record size field) are read from the
file address specified by the random record field
into the disk transfer address. If end-of-file is
reached before all records have been read, AL
returns either 0 I or 03. A return of 01 indicates
end-of-file and the last record is complete. A
return of 03 indicates the last record is a partial
record. If wrap-around above address X'FFFF' in
the disk transfer segment would have occurred,
as many records as possible are read and AL
returns 02. If all records are read successfully,
AL returns 00. In any case, CX returns with the
actual number of records read, and the random
record field and the current block/record fields
are set to address the next record (the first record
not read).

D-17
28 Random block write. Essentially the same as
function 27 above, except for writing and a write-
protect check. If there is insufficient space on the
disk, AL returns 0 I and no records are written.
If CX is zero upon entry, no records are written,
but the file is set to the length specified by the
random record field, whether longer or shorter
than the current file size. (Allocation units are
released or allocated as appropriate.)

29 Parse filename. On entry, DS:SI point to a


command line to parse, and ES:DI point to a
portion of memory to be filled with an unopened
FCB. The contents of AL are used to determine
the action to take, as shown below:

< ignored >


bit: 7 6 5 4 3 2 o
If bit 0 = I, then leading separators are scanned
off the command line at DS: S1. Otherwise, no
scan-off of leading separators takes place.

If bit I = I, then the drive ID byte in the result


FCB will be set (changed) only if a drive was
specified in the command line being parsed.

If bit 2 = I, then the filename in the FCB will be


changed only if the command line contains a
filename.

If bit 3 = I, then the filename extension in the


FCB will be changed only if the command line
contains a filename extension.

Filename separators include the following


characters : . ; , = + / " [ ] plus TAB and
SPACE. Filename terminators include all of these
characters plus any control characters.

D-18
The command line is parsed for a filename of the
form d :filename.ext, and if found, a corresponding
unopened FCB is created at ES:DI. If no drive
specifier is present, the default drive is assumed. If
no extension is present, it is assumed to be all
blanks. If the character * appears in the filename
or extension, then it and all remaining characters
in the name or extension are set to ?

If either? or* appears in the filename or extension,


AL returns 0 I; if the drive specifier is invalid AL
returns FF; otherwise 00.

DS: SI will return pointing to the first character


after the filename and ES:Dl will point to the first
byte of the formatted FCB. If no valid filename is
present, ES :DI+ I will contain a blank.

2A Get date. Returns date in CX:DX. CX has the year


(1980-2099 in binary), DH has the month (I-Jan,
2-Feb, etc) and DL has the day. If the time-of-day
clock rolls over to the next day, the date is
adjusted accordingly, taking into account the
number of days in each month and leap years.

2B Set date. On entry, CX:DX must have a valid date


in the same format as returned by function 2A,
above. If the date is indeed valid and the set
operation is successful, AL returns 00. If the date
is not valid, AL returns FF.

2C Get time. Returns with time-of-day in CX:DX.


Time is actually represented as four 8-bit binary
quantities as follows. CH has the hours (0-23),
CL has minutes (0-59), DH has seconds (0-59), DL
has 1/ I 00 seconds (0-99). This format is readily
converted to a printable form yet can also be used
for calculations, such as subtracting one time
value from another.

2D Set time. On entry, CX:DX has time in the same


format as returned by function 2C, above. If any
component of the time is not valid, the set
operation is aborted and AL returns FF. If the
time is valid, AL returns 00.

D-19
2E Set/reset verify switch. On entry, DL must
contain 0, and AL must contain I to turn verify
on, or 0 to turn verify off. When on, DOS will
perform a verify operation each time it performs
a diskette write to assure proper data recording.
Although disk recording errors are very rare, this
function has been provided for those user
applications in which you may wish to verify the
proper recording of critical data.

D-20
~PENDIX E. DOS CONTROL BLOCKS
AND WORK AREAS

DOS Memory Map

0000:0000 Interrupt vector table

0040:0000 ROM communication area

0050:0000 DOS communication area

0060:0000 IBMBIO.COM-DOS interface to ROM I/O routines

XXXX:oooo IBMDOS.COM-DOS interrupt handlers, service


routines (lNT 21 functions)
Directory buffer
Disk buffer
Drive parameter block/file allocation table (one
per drive)

XXXx:oooo Resident portion of COMMAND.COM-Interrupt


handlers for interrupts X'22' (terminate), X'23'
(CTRL-BREAK), X'24' (critical error), X'27'
(terminate but stay resident), and code to reload
the transient portion.

XXXX:oooo External command or utility-(.COM or EXE file)

xxxx:oooo User stack for .COM files (256 bytes)

XXXX:oooo Transient portion of COMMAND .COM -Command


interpreter, internal commands, external command
processor, batch processor.

E-l
Notes:

1. The starting segment of IBMDOS.COM can


be obtained from the word at absolute
location 0000:0086. The segment at which
the resident portion of COMMAND.COM is
located can be obtained from the word at
absolute location 0000:009E.

2. Memory map addresses are in segment:offset


format. For example, 0060:0000 is absolute
address X'0600'.

3. The DOS Comm unica tion Area is used as


follows:

0050:0000 Print screen status flag store

o Print screen not active or


successful print screen
operation

1 Prin t screen in progress

255 Error encountered during


print screen operation

0050:0004 Single-drive mode status byte

o Diskette for drive A: was


last used

1 Diskette for drive B: was


last used

0050:0080 This is the INT l4H (Asynchro-


nous Communications Adapter)
handler, loaded by MODE to
provide multiple retries on
timeout when serial printer is
attached.

0050:00CO This is the INT l7H (parallel


prin ter) handler, loaded by
MODE to intercept printer
requests and redirect them to
COMI or COM2. '
E-2
DOS Program Segment
When you enter an external command, the COMMAND
processor determines the lowest available address
(immediately after the resident portion of
COMMAND.COM) to use as the start of available
memory for the program invoked by the external
command. This area is called the Program Segment.

At offset 0 within the Program Segment, COMMAND


builds the Program Segment Prefix control block. (See
below.) COMMAND loads the program at offset X' I 00'
and gives it control. (.EXE files can be loaded into high
memory just below the transient portion of
COMMAND.COM, but the Program Segment Prefix
will still be in low memory.)

The program returns to COMMAND by a jump to offset


o in the Program Segment Prefix by issuing an INT 20,
or by issuing an INT 2 I with register AH =0. (The
instruction INT 20 is the first item in the control block.)

Note: It is the responsibility of all programs to


ensure that the CS register contains the segment
address of the Program Segment Prefix when
terminating via any of these methods.

All three methods result in an INT 20 being issued,


which transfers control to the resident portion of
COMMAND .COM. It restores interrupt vectors X'22',
X'23', and X'24' (terminate, Ctrl-Break, and critical
error exit addresses) from the values saved in the
Program Segment Prefix of the terminating program.
Con trol is then given to the terminate address. If this
is a program returning to COMMAND, control transfers
to its transient portion. If a batch file was in process,
it is continued; otherwise, COMMAND issues the
system prompt and waits for the next command to
be entered from the keyboard.

E-3
When a program receives control, the following
conditions are in effect:

For all programs:

• Disk transfer address (DTA) is set to X'SO' (default


DTA in the Program Segment Prefix).

• File control blocks at X'5C' and X'6C' are


formatted from the first two parameters entered
when the command was invoked.

• Unformatted parameter area at X'SI ' contains all


the characters entered after the command name
(including leading and embedded delimiters), with
X'SO' set to the number of characters.

• Offset 6 (one word) contains the number of bytes


available in the segment. If the resident portion
of COMMAND.COM is within the segment, this
value is reduced by its size.

• Register AX reflects the validity of drive specifiers


entered with the first two parameters as follows:
- AL=FF if the first parameter contained an
invalid drive specifier (otherwise AL=OO)
- AH=FF if the second parameter contained an
invalid drive specifier (otherwise AH=OO)

For .EXE programs:

• DS and ES registers are set to point to the Program


Segment Prefix. (A diagram of the Program
Segment Prefix is provided in this section.)

• CS, IP, SS, and SP registers are set to the values


passed by the linker.

E-4
For .COM programs:

• All four segment registers contain the segment


address of the Program Segment Prefix control
block.

• The Instruction Pointer (lP) is set to X' 100'.

• SP register is set to the end of the program's


segment, or the bottom of the transient portion of
COMMAND.COM, whichever is lower. The
segment size at offset 6 is reduced by X' 100' to
allow for a stack of that size.

• A word of zeros is placed on the top of the stack.

The Program Segment Prefix (with offsets in


hexadecimal) is formatted as follows.

E-5
PROGRAM SEGMENT PREFIX
(offsets in hex)
Or-----------------r----------,-------------,------------------------~
Total -Long call to
INT X'20' memory Reserved DOS function dis-
size! patcher (5 bytes)2
8~----------------+---------~------------~~~--------------~
Terminate address
CTRL-BREAK
exit address
(IP, CS) (IP)
10~------~----------------~--------~
CTRL-BREAK CRITICAL ERROR
exit address exit address
~CS) (IP, CS)

Reserved

Formatted Parameter Area 1


formatted as standard unopened FCB

Formatted Parameter Area 2


formatted as standard unopened FCB
(overlaid if FCB at X'5C' is opened)
80~----------------------------------~
~,..,

J
Unformatted parameter area
(default disk transfer area) T
~ ...

lOO~--------------------------------~-

1. Memory size is in segment (paragraph) form (for example,


X'lOOO' would represent 64K).

2. The word at offset 6 contains the number of bytes


available in the segment.

E-6
"'!1
c:
('D

n
o
=
tt

-7
FILE CONTROL BLOCK
r - - -,- - - - - - - - - - - - - - - - T - - -, FCB --
o
=
o
I X'FF' I Zeros I Attribute I extension (")
~
I I
o J
I

Standard
Drive Filename (8 bytes) or Reserved device name
FCB
8 I

Filename extension Current block Record size


16
File size File size
Date
(low part) (high part)
24
Reserved for system use
32
Current
record
Random record
number (low part)
I Random record
number (high part)
I
(Offsets are in decimal)
Unshaded areas must be filled in by the using program.
Shaded areas are filled in by DOS and must not be modified.
t(1
........

S3XION3ddV
Standard File Control Block

The standard file control block (FCB) is defined as


follows, with the offsets in decimal:

Byte Function

o Drive number. For example,

Before open: 0 - default drive


I - drive A
2 - drive B

After open: 1 - drive A


2 - drive B

A 0 is replaced by the actual drive number


during open.

1-8 Filename, left-justified with trailing blanks.


If a reserved device name is placed here (such
as LPT1), do not include the optional colon.

9-11 Filename extension, left-justified with trailing


blanks (can be all blanks).

12-13 Current block number relative to the


beginning of the file, starting with zero (set
to zero by the open function call). A block
consists of 128 records, each of the size
specified in the logical record size field. The
current block number is used with the current
record field (below) for sequential reads and
writes.

14-15 Logical record size in bytes. Set to X'80' by


the open function call. If this is not correct,
you must set the value because DOS uses it to
determine the proper locations in the file for
all disk reads and writes.

E-8
Byte Function

16-19 File size in bytes. In this 2-word field, the


first word is the low-order part of the size.

20-21 Date the file was created or last updated. The


mm/dd/yy are mapped in the bits as follows:

< 21 >< 20 >


15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
y y y y y y y mmmmd d d d d

where:

mm is 1-12
dd is 1-31
yy is 0-119 (1980-2099)

22-31 Reserved for system use.

32 Current relative record number (0-127) within


the current block. (See above.) You must set
this field before doing sequential read/write
operations to the diskette. (This field is not
initialized by the open function call.)

33-36 Relative record number relative to the


beginning of the file, starting with zero. You
must set this field before doing random
read/write operations to the diskette. (This
field i~ not initialized by the open function
call.)

If the record size is less than 64 bytes, both


words are used. Otherwise, only the first
three bytes are used. Note that if you use the
File Control Block at X'5C' in the program
segment, the last byte of the FCB overlaps
the first byte of the unformatted parameter
area.

E-9
Notes:

1. An unopened FCB consists of the FCB prefb


(if used), drive number, and filename/
extensions properly filled in. An open FCB
is one in which the remaining fields have beel
filled in by the Open function call.

2. Bytes 0-15 and 32-36 must be set by the


user program. Bytes 16-31 are set by DOS
and must not be changed by user programs.

3. All word fields are stored with the least


significant byte first. For example, a record
length of 128 is stored as X'80' at offset
14, and X'OO' at offset 15.

Extended File Control Block

The extended File Control Block is used to create or


search for files in the diskette directory that have
special attributes.

It adds a 7-byte prefix to the FCB, formatted as


follows:

Byte Function

FCB-7 Flag byte containing X'FF' to


indicate an extended FCB.

FCB-6 to FCB-2 Reserved.

FCB-l Attribute byte to include hidden files


(X'02') or system files (X'04') in
directory searches. IBMBIO.COM and
IBMDOS.COM are considered system
and hidden files supplied on the DOS
diskette. This function is present to
allow applications to define their own
files as hidden, and thereby exclude
them from directory searches. This
prevents them from being accidentally
erased or overwritten by a COPY
command.

E-I0
Any reference in the DOS Function Calls (refer to
Appendix D) to an FCB, whether opened or unopened,
may use either a normal or extended FCB. If using an
extended FCB, the appropriate register should be set
to the first byte of the prefix, rather than the drive-
number field.

E-ll
E-12
APPENDIX F. EXE FILE STRUCTURE
AND LOADING

The .EXE files produced by the Linker program consist


of two parts:

• control and relocation information

• the load module itself

The control and relocation information, which is


described below, is at the beginning of the file in an
area known as the header. The load module
immediately follows the header. The load module
begins on a sector boundary and is the memory image
of the module constructed by the linker.

The header is formatted as follows:

Hex Offset Contents

00-01 X'4D', X'5A' -This is the LINK program's


signature to mark the file as a valid .EXE file.

02-03 Number of bytes actually used in final


sector of the file.

04-05 Size of the file in 5l2-byte increments (pages),


including the header.

06-07 Number of relocation table items that follow


the formatted portion of the header.

08-09 Size of the header in 16-byte increments


(paragraphs). This is used to locate the
beginning of the load module in the file.

F-l
Hex Offset Contents

OA-OB Minimum number of 16-byte paragraphs


req uired above the end of the loaded program.

OC-OD High/low loader switch. This is the maximum


number of 16-byte paragraphs required above
the end of the loaded program. If X'FFFF',
the load module is to be loaded into low
memory.

OE-OF Offset of stack segment in load module (in


segment form).

10-11 Value to be in the SP register when the


module is given control.

12-13 Word checksum-negative sum of all the words


in the file, ignoring overflow.

14-15 Value to be in the IP register when the module


is given control.

16-17 Offset of code segment within load module


(in segment form).

18-19 Offset of the first relocation item within the


file.

1A-1B Overlay number (0 for resident part of the


program).

The relocation table follows the formatted area just


described. The relocation table is made up of a
variable number of relocation items. The number of
items is contained at offset 06-07. The relocation
item contains two fields-a 2-byte offset value,
followed by a 2-byte segment value. These two fields
contain the offset into the load module of a word which
requires modification before the module is given
con tro1. This process is called relocation and is
accomplished as follows:

F-2
1. A Program Segment Prefix is built following the
resident portion of the program that is performing
the load operation.

2. The formatted part of the header is read into


memory (its size is at offset 08-09).

3. The load module size is determined by subtracting


the header size from the file size. Offsets 04-05
and 08-09 can be used for this calculation. The
actual size is downward adjusted based on the
contents of offsets 02-03. Note that all files
created by pre-release 1.10 LINK programs
always placed a value of 4 at that location,
regardless of actual program size. Therefore, we
recommend that this field be ignored if it
contains a value of 4.

Based on the setting of the high/low loader


switch, an appropriate segment is determined at
which to load the load module. This segment is
called the start segment.

4. The load module is read into memory beginning


at the start segment.

5. The relocation table items are read into a work area


(one or more at a time).

6. Each relocation table item segment value is added


to the start segment value. This calculated
segment, in conjunction with the relocation item
offset value, points to a word in the load module
to which is added the start segment value. The
result is placed back into the word in the load
module.

7. Once all relocation items have been processed, the


SS and SP registers are set from the values in the
header and the start segment value is added to SS.
The ES and DS registers are set to the segment
address of the Program Segment Prefix. The start
segment value is added to the header CS register
value. The result, along with the header IP value,
is used to give the module control.

F-3
F-4
IMPORTANT INFORMATION

Instructions For Using IBM Personal


Computer Applications With
320KB Diskette Drives

You MUST read Appendix G before using IBM DOS


Version 1.10 if you are installing or have installed
one or more 320KB diskette drives.

Be sure you have read the "READ THIS FIRST"


section in the front of your DOS 1.10 manual.

After you have read the instructions, insert


Appendix G after Appendix F in your DOS manual.

©Copyright International Business Machines Corp. 1981,1982


6081423
Appendix G. Instructions For Using
IBM Personal Computer Applications
With 320KB Diskette Drives

If you are using 320KB diskette drives, this appendix


contains important information and special
instructions for the following 320KB diskette drive
applications:

• Accounting Packages by Peachtree Software


Incorporated

• Accounting Packages by BPI Systems, Inc.

This appendix does not include special instructions


for any other IBM Personal Computer products.
Please consult the application reference manual for
each software product to determine if there are any
special considerations regarding the use of DOS 1.10
and 320KB diskette drives.

Accounting Packages by Peachtree Software


You can approximately double the capacities of the
Peachtree Software Incorporated accounting
packages by using 320KB diskettes and drives. The
Peachtree Software Incorporated accounting
packages, used with DOS 1.10, will operate only
with either two 160KB drives or two 320KB drives.
Both drives MUST be the same type; you CANNOT
have one of each.

For example, if you have a 320KB diskette in Drive


B, you cannot make a backup copy of the diskette on
a 160KB diskette in Drive A. The two drive types are
not compatible in other areas; consult your DOS
1.10 manual for more information.

G-l
Conversion

The following procedure converts Peachtree


Software Incorporated accounting packages
currently running on IBM DOS 1.00 to packages
that will run on IBM DOS 1.10. If you do not have
packages currently running on DOS 1.00, turn now
to the next section, "First Time Installation."

1) Check to be sure that both your 320KB drives


have been installed in your system unit.

2) Place a WORKING COpy of the IBM Personal


Computer IBM DOS 1.10 diskette in Drive A
and close the drive latch. If the computer is off,
turn on all the power switches to your printer,
monitor, and system unit. Otherwise, hold
down the ~ and @ keys and press the ~
key at the same time. Answer the Date and Time
prompts.

3) Place your MASTER COpy of Program


Diskette #1 in Drive B and close the drive latch.

4) Enter the following command next to the A> on


the screen. Then press the Enter (~ key.

SYS B:

The following message will then be displayed:

System transferred

5) Type the following command and press the


Enter (~) key.

COpy COMMAND.COM B:

The following message will appear on the


screen:

1 File(s) copied

G-2
6) Type the following command and press the
Enter (~) key.

COpy BASIC.COM B:

The following message will appear on the


screen:

1 File(s) copied

7) Repeat steps 3 through 6 for each MASTER


COpy Program Diskette used with the package.

8) Run the DISKCOPY command (make sure you


use IBM DOS 1.10) to copy your MASTER
COpy of each Program Diskette to any
WORKING COpy of that Program Diskette.

To convert your current period Data Diskettes to


320KB Data Diskettes do the following:

1) Recalculate the new file sizes you want using the


instructions in Chapter 2 of your Peachtree
Software Incorporated application manual, but
add 160,000 to the maximum size for the total
of all files on the Data Diskette.

2) Back up your current Data Diskette as your


Peachtree Software Incorporated manual
instructs.

3) Format and label a 320KB blank diskette to use


for your new Data Diskette. With 320KB drives
and IBM DOS 1.10, this diskette will
automatically be formatted as a 320KB
diskette.

4) Run the MAINTAIN SYSTEM FILE program


usin~ your current Data Diskette and change
the file sizes to your new values.

G-3
5) Run the RECOVER DATA FILES program-
when the program asks you to insert a blank,
formatted diskette, use the diskette you
formatted and labeled in step 3. This will make a
new Data Diskette with the files enlarged- your
da ta will remain in tact.

6) Back up your new Data Diskette.

These steps have converted your Peachtree Software


Incorporated package to run with IBM DOS 1.10.
After you have finished this process, DO NOT use
your IBM DOS 1.00 diskette with this application.
Your historical backup Data Diskettes, which you
originally created with IBM DOS 1.00, are still
usable by your converted Peachtree Software
Incorporated application running with IBM DOS
1.10.

First Time Installation

If you are installing a Peachtree Software


Incorporated accounting application for the first
time using 320KB diskette drives and IBM DOS
1.10, do the following:

Check to be sure that both of your 320KB diskette


drives have been installed in your system unit. Using
the instructions in the Peachtree Software
Incorporated application manual, you need only
make the following two changes:

1) Use IBM DOS 1.10 wherever your Peachtree


Software Incorporated application manual
refers to IBM DOS 1.00.

G-4
2) When you create your new Data Diskette for a
Peachtree Software Incorporated application
on 320KB diskettes and drives, the maximum
file space increases by 160,000 bytes. Add this
amount of space anywhere the Peachtree
Software Incorporated application manual
references the maximum diskette capacity to
calculate your file sizes.

Accounting Packages by BPI Systems, Inc.


You can approximately double the capacities of the
BPI Systems, Inc. accounting packages by using
320KB diskettes and drives. The BPI Systems, Inc.
accounting packages, used with DOS 1.10, will
operate only with either two 160KB drives or two
320KB drives. Both drives MUST be the same type;
you CANNOT have one of each.

For example, if you have a 320KB diskette in Drive


B, you cannot make a backup copy of the diskette on
a 160KB diskette in Drive A. The two drive types are
not compatible in other areas; consult your DOS
1.10 manual for more information.

Conversion

The following procedure converts BPI Systems, Inc.


accounting packages currently running on IBM DOS
1.00 to packages that will run on IBM DOS 1.10. If
you do not have packages currently running on DOS
1.00, turn now to the next section, "First Time
Installation."

G-5
1) Check to be sure that both your 320KB drives
have been installed in your system unit.

2) Follow the FIRSTIME procedures in the BPI


Systems, Inc. application manual.

3) You should now make backup copies of each


Program Diskette.

These steps have converted your BPI Systems, Inc.


package to run with IBM DOS 1.10. After you have
finished this process, DO NOT use your IBM DOS
1.00 diskette with this application. Your historical
backup Data Diskettes, which you originally created
with IBM DOS 1.00, are still usable by your
converted BPI Systems, Inc. application running
with IBM DOS 1.10.

First Time Installation

If you are installing a BPI Systems, Inc. accounting


application for the first time using 320KB diskette
drives and IBM DOS 1.10, do the following:

Check to be sure that both of your 320KB diskette


drives have been installed in your system unit. Using
the instructions in the BPI Systems, Inc. application
manual, you need only make the following two
changes:

1) Use IBM DOS 1.10 wherever your BPI Systems,


Inc. application manual refers to IBM DOS
1.00.

2) When you create your new Data Diskette for a


BPI Systems, Inc. application on 320KB
diskettes and drives, the total maximum
capacity of the application approximately
doubles.

G-6
INDEX

Special Characters absolute disk read D-5


absolute disk write D-6
. - period 4-7,4-16 absolute diskette sectors B-2
.COM file format 3-47 absolute sector 6-45
+- backspace key 2-15 absolute segment address
+ (plus sign) how to determine 5-27
in automatic response absolute track/sector,
file 5-20 calculate C-4
in response to linker AC flag set condition 6-37
file 5-10 access, random B-6
$$$ - filename adding hexadecimal values 6-24
extension 4-4 address - DEBUG
* - asterisk 2-21 parameter 6-6
* - EDLIN prompt 2-21, address, terminate
4-4,4-10 interrupt D-2
* - global filename address, disk transfer 6-5
character 3-9 Advanced BASIC 2-13
- (DEBUG prompt) 6-12 AH register D-7
~ key 2-17,2-24 allocating diskette space B-6,
IHIGH and other linker C-6
parameters 5-13 allocation table address D-15
See also linker parameters allocation, diskette C-l
IP parameter 3-35 Alt key 2-4
IS option 3-61, C-5 analyze
IV parameter 3-24 diskettes 3-50
IW parameter 3-35 the directory 3-19
(1 parameter 3-39, 3-42 the File Allocation
% (percent sign) 3-17 Table 3-19
? - global filename Append Lines command 4-11,
character 3-9 4-34
# - pound sign 4-6 architecture, 8088 B-1
:ill character 2-27 ASCII characters 6-14
:ill symbol (linker) 5-20 ASCII codes,
= equal sign 3-5 extended D-8
ASCII representation 6-5
ASCII values 6-9
A assembler 5-4
asterisk
A> prompt 2-6, 3-13 EDLIN prompt 2-21,4-4,
lbort program B-7 4-10
X-I
asterisk (continued) block write, random D-14,
glo bal filename D-16
character 3-9 blocking/deblocking, data B-1
Asynchronous Communications boot record program 1-3,
Adapter 3-53,3-55,3-56, B-1 1-7, B-1, B-2, C-1
attribute byte E-IO boundary, paragraph 5-6
attribute, file C-3 boundary, 16-byte 6-14
AUTOEXEC file B-3 boundary, 8-byte 6-14
AUTOEXEC.BAT file 2-7, BP register 6-5, D-4
3-15, 3-32 brackets, square 3-5
Automatic Program Break key 2-11
Execution 2-7 breakpoint 6-21
automatic response file buffer, input 2-16
linker 5-20 buffered keyboard
AUX: - reserved device input D-IO
name 3-8 buffers, file D-1
Auxiliary Asynchronous built-in functions B-1
Communications BX register 6-5,6-28, D-4
Adapter D-9 byte - DEBUG
auxiliary carry flag 6-37 parameter 6-6
auxiliary input D-9 byte contents
auxiliary output D-9 display 6-17
available functions, DOS B-5 fill 6-20
AX register 6-5, D-4, D-7 replace 6-19
byte, attribute E-IO
byte, flag E-IO
B
back slash (\) 2-14, 2-23 c
backing up diskettes 1-7
backspace key (+-) 2-15 calculate absolute
backup diskette 1-7, 3-40 cluster C-8
backup file, edit 4-4 calculate absolute
BAK filename extension 4-4, track/ sector C-4
4-5, 4-18, 4-26 calls, function D-7
BASIC Program Editor 2-16 carry flag 6-37
BAT filename extension 3-14 chaining file sectors B-6
batch file 2-7, 3-14, 3-58, change date 3-32
3-59, 3-62, 3-65 change diskettes 3-58
batch file processor B-4 change filenames 3-60
batch processing 3-14 change time 3-62
BIOS D-5 check keyboard status D-IO
BIOS interface module B-1 checksum methodology B-3
block number, current E-8 CHKDSK command 3-19,
block read, random D-13, 3-65
D-16 CL register D-7

X-2
class 5-7 Communications Adapter,
clear condition 6-36 Auxiliary Asynchronous D-9
close file D-12 COMP command 3-21, 3-39,
cluster number, relative C-4 3-65
cluster, calculate C-8 Compare command 6-13
cluster, locate next C-6, C-8 comparing diskettes 3-39
cluster, starting C-4 comparing files 3-21
clusters B-6, C-2 comparing memory 6-13
codes, error D-3 compatibility (drive and
codes,return B-13 diskette) 2-8
codes, 8088 instruction 6-22 COM 1: - reserved device
colon 3-5, 3-8 name 3-8
Color/Graphics Monitor CON: - reserved name for
Adapter 3-53 console/keyboard 3-8
COM filename extension 3-4, concatenation 3-23, 3-28
B-4 console I/O, direct D-9
COM programs E-5 console/keyboard 3-8
comma 3-5 console/keyboard
command line routines B-5
linker 5-18 control blocks E-l
command parameters control keys 2-11,3-13,4-10,
DEBUG 6-6 6-14
DOS 3-6 COPY command 1-8,3-16,
EDLIN 4-6 3-23,3-40,3-43,3-65
command processor 1-4, copying diskettes 1-8, 3-42
2-5-2-8, B-3 copying DOS files 1-8
command processor, replacing copying files 3-23
the B-4 correcting input lines 2-16
command processor, resident create file D-14
portion of B-3 creating a .BAT file 3-16
command prompt, creating a backup diskette 1-8
DEBUG 6-12 creating a batch file 3-14
command prompt, DOS 2-6 creating a new file 4-5,4-19
command prompts, linker 5-8 critical error handler B-3, B-5
COMMAND.COM 1-4,2-4, critical error handler
3-50, 6-4, B-3, C-5, E-3 vector D-3
commands critical error handling B-3
DEBUG 6-11 CS register 6-4, 6-21, 6-23,
DOS 3-12 6-26,6-29,6-46, D-I, D-4,
EDLIN 4-9 E-3, E-4
commands, end 3-13 Ctrl key 2-4, 2-11
commands, summary of Ctrl-Break 5-9
DEBUG 6-49 CTRL-BREAK exit
DOS 3-65 address B-4, B-5, D-2
EDLIN 4-34 CTRL-BREAK handler B-3,
Communications B-5
Adapter 3-55
X-3
Ctrl-Break keys 2-11, 2-22, Register 6-34
3-13,3-15,3-58,4-9,4-16, Search 6-39
4-20, 6-11 summary of 6-49
Ctrl-Enter keys 2-12 Trace 6-40
Ctrl-NumLock keys 2-12, Unassemble 6-42
3-13, 4-9, 6-11 Write 6-45
Ctrl-PrtSc keys 2-13, 3-64 DEBUG program
Ctrl-Z character 3-29 command parameters 6-6
Ctrl-Z keys 4-28 commands 6-11
current block number E-8 common information 6-11
current disk D-15 ending 6-33
current relative record how to start 6-4
number E-9 prompt 6-12
CX register 6-5,6-28,6-47, summary of commands 6-49
D-4 what it does 6-3
CY flag set condition 6-37 default disk transfer
address 6-5
default drive
D changing the 2-6
linker 5-9
d: parameter 3-6
default 3-6 specifying the 2-6
parameter 3-6 default segment 6-6
data area C-2 defective tracks 3-50
data blocking/deblocking B-1 DEL command 3-34
date Del key 2-4, 2-17, 2-22
change 3-32 delete file D-13
enter 2-5,3-32 Delete Lines command 4-12,
get D-19 4-34
set D-19 deleting files 3-45
DATE command 3-32, 3-65 delimiters 3-12, 4-9, 6-14
date file created or destination area 6-29
updated E-9 device handler, I/O 1-3
deblocking/blocking, data B-1 device names, reserved 3-8,
DEBUG commands 3-27
Compare 6-13 DGROUP 5-14
Dump 6-14 DI flag clear condition 6-37
Enter 6-17 DI register 6-5, D-3, D-4
Fill 6-20 DIR command 3-9,3-35,3-51,
Go 6-21 3-66
Hexarithmetic 6-24 direct console I/O D-9
Input 6-25 direction flag 6-37
Load 6-26 directory 1-6, C-1
Move 6-29 directory, analyze 3-19
Name 6-30 directory entries, listing 3-35
Output 6-32 directory searches C-3
Quit 6-33
X-4
disk remarks 3-59
current D-15 display instructions 6-42
reset D-ll display output D-2, D-8
select D-l1 displaying memory 6-14
Disk BASIC 2-13 divide-by-zero B-1
disk error handling B-3 DN flag set condition 6-37
disk read, absolute D-5 DOS
disk transfer address 6-5, E-4 available functions B-5
disk transfer address, set D-15 command parameters 3-6
Disk Transfer Area control blocks E-l
(DTA) B-7 copying DOS files 1-8
disk write, absolute D-6 diskette allocation C-l
DISKCOMP command 3-39, diskette directory C-3
3-44,3-66 editing keys 2-16
DISKCOPY command 1-8, EDLIN 4-3
3-39,3-42,3-66 how to start 2-3
diskette and drive Initializa tion B-2
compatibility 2-8 memory map E-l
Diskette/File Management B-6 parts of 1-3
diskettes program segment E-3
allocating space B-6, C-6 prompt 2-6
allocation C-l structure B-1
analyze 3-50 technical information B-1
back up 3-40 work areas E-l
backing up 1-8 DOS commands
change 3-58 Batch processing 3-14
comparing 3-39 CHKDSK 3-19
copying 1-8, 3-42 common information 3-12
creating a backup 1-8 COMP 3-21·
damaged 1-8 COpy 3-23
defective tracks 1-8, 3-50 DATE 3-32
directory C-3 DEL 3-34
filenames 3-7 DIR 3-35
formatting 1-8 DISKCOMP 3-39
fragmented 3-43 DISKCOPY 3-42
handling routines B-5 ERASE 3-45
initialize 3-50 EXE2BIN 3-47
new 1-8 external 3-4
number of files 1-6 FORMAT 3-50
preparing 3-50 internal 3-4
recording format 3-50 MODE 3-53
status report 3-19 PAUSE 3-58
display REM 3-59
byte contents 6-1 7 RENAME (or REN) 3-60
flags 6-36 summary of 3-65
lines 4-22 SYS 3-61
registers 6-35 TIME 3-62
X-5
DOS commands (continued) creating a batch file 3-14
TYPE 3-64 Delete Lines 4-12
types of 3-4 Edit Line 4-16
DOS editing keys End Edit 4-18
entering DOS how to start 4-4
commands 3-13 Insert Lines 4-19
examples using 2-20-2-30 List Lines 4-22
using DEBUG 6-12 program 4-3
using EDLIN 4-10 Quit Edit 4-26
drive 3-6 Replace Text 4-27
drive - DEBUG parameter 6-7 Search Text 4-30
drive and diskette used with DOS editing
compatibility 2-8 keys 2-20
DS register 6-4, 6-5, 6-17, 6-20, Write Lines 4-33
6-29, D-4, E-4 EDLIN commands, summary
IDSALLOCA TION linker of 4-34
parameter 5-14 EDLIN prompt 2-21
DT A (Disk Transfer EI flag set condition 6-37
Area) B-7 ellipsis 3-5
dual sided diskette emptying the template 2-28
allocation C-2 End Edit command 4-5,4-18,
number of files 1-6 4-34
dummy device 3-8 end-of-file 3-29
dummy parameters 3-17, 3-18 end-of-fi1e mark C-7
Dump command 6-14,6-49 ending commands 3-13
DX register 6-5, D-4 Enter command 6-17, 6-49
enter date 2-5, 3-32
Enter key 2-11, 2-16, 3-8, 4-9
E enter time 2-5, 3-62
entries, search for D-12
edit equal sign (=) 3-5
backup file 4-4 ERASE command 3-45, 3-66
existing file 4-4 erasing files 3-45
partial file 4-1 1 error codes D-3
Edit Line command 4-16, error handler B-7
4-34 error handling
editing keys 2-16,3-13,4-10, cri tical B-3
6-12 disk B-3
editing template 2-16 error messages A-3
EDLIN error trapping B-7
prompt 4-4 error, syntax 6-12
Append Lines 4-11 ES register 6-4, 6-5, D-4, E-4
command parameters 4-6 Esckey 2-14,2-17,2-23,4-16
commands 4-9 EXE file structure F-1
common information 4-9 EXE filename extension 3-4,
compared to DOS editing 5-11, 6-5, 6-28, 6-48, B-4, E-3
keys 2-16 EXE files, load F-1
X-6
EXE programs D-6, E-4 per diskette 1-6
execute instructions 6-40 random B-6
execute program 6-21 rename D-15
executing a .BAT file 3-18 sectors B-6
EXE2BIN command 3-47, seq uen tia1 B-6
3-66 size D-16
existing file, edit 4-4 source 4-3
ext 3-7 system E-10
extended ASCII codes D-8 text 3-64, 4-3
extensions 3-7 File Allocation Table
extensions, filename (FAT) 1-6 , B-2, B-6, C-l , C-6
.BAK 4-5,4-18,4-26 file allocation table, how to
.COM 3-4, B-4 use C-8
.EXE 3-4, 6-5, 6-28, 6-48, file buffers D-1
B-4, E-3 File Control Block (FCB) 6-30,
.EXE filename B-6, E-10
extension 5-11 file sectors
.HEX 6-5,6-28,6-48 chaining B-6
.MAP 5-11 mapping B-6
.OBJ 5-10 file size E-9
$$$ 4-4 file structure, .EXE F-l
length in characters 1-5 filename characters, global 3-9
external commands 3-4, B-4 filename extensions
.BAK 4-5,4-18,4-26
.BAT 3-14
F .COM 3-4, B-4
.EXE 3-4,6-5,6-28,6-48,
F AT (see File Allocation B-4, E-3
Table) .EXE filename
FCB E-10 extension 5-11
FCB (see File Control Block) .HEX 6-5, 6-28, 6-48
file .MAP 5-11
attribute C-3 .OBJ 5-10
close D-12 $$$ 4-4
create D-14 characters, valid 3-7
date created or updated E-9 in directory C-3
delete D-13 in file control block E-8
displaying contents of 3-64 length in characters 1-5
erasing 3-45 separators D-19
fragmented 3-26 terminators D-19
hidden C-3, C-5, D-14, E-1 0 filename, parse D-18
how DOS keeps track of 1-6 filenames
length in characters 1-5 characters, valid 3-6
naming convention 1-5 in directory C-3
object files 6-3 in file control block E-8
object program 3-64 length of 3-6
open D-ll renaming 3-60
X-7
filespec 3-7 in RENAME 3-60
filespec - DEBUG Go command 6-21,6-47,6-49
parameter 6-7 group 5-7
Fill command 6-20, 6-49
First Asynchronous
Communications Adapter H
port 3-8
fixups, segment 3-47 header F-1
flag byte E-10 HEX filename extension 6-5,
flag values 6-37 6-28,6-48
flags 6-5 Hexarithmetic command 6-24,
flags, display 6-36 6-49
FORMAT command 1-3, 1-8, hidden files 3-19, 3-51, C-3,
3-50, 3-61, 3-66, C-3 C-5, D-14, E-10
format notation 3-5 /HIGH linker parameter 5-6,
FORMAT status report 3-51 5-14
formatting diskettes high memory 5-14, 6-5, B-4
what it does 1-7 high/low loader switch F-2
fragmented diskettes 3-43
fragmented files 3-26
function calls D-7 I
functions, available DOS B-5
functions, built-in B-1 I/O device handler 1-3
F1 key 2-17,2-24,2-28 IBMBIO.COM 1-3,3-36,3-46,
F2key 2-18,2-25 3-50, B-1, B-2, B-3, C-5
F3 key 2-18, 2-22, 2-23, 2-25, IBMBIO.COM, location on
6-26 diskette C-2
F4key 2-18,2-26 IBMDOS.COM 1-3,3-35,
F5 key 2-19, 2-27, 4-17 3-45, 3-50, B-1, B-2, C-5
F6 key 3-8, 3-16, 3-28, 4-29 IBMDOS.COM, location on
diskette C-2
initialization, DOS B-2
G initialize diskettes 3-50
initializing the Asynchronous
generating line numbers 4-3 Communications Adapter 3-55
get input buffer 2-16
date D-19 Input command 6-25,6-49
time D-19 input files
global filename characters linker 5-4
* 3-9 input, auxiliary D-9
? 3-9 Ins key 2-19, 2-28
examples using 3-10 Insert Lines command 4-19,
in command name 3-13 4-34
in COMP 3-22 insert mode 2-23, 2-27,2-28,
in COPY 3-25 4-20
in DIR 3-35 inserting c;haracters 2-28
in ERASE 3-45 inserting lines 4-3
X-8
instruction codes, 8088 6-22
Instruction Poin ter (lP) 6-4
L
instruction set, 8088 B-1 /LINE linker parameter 5-15
instructions line - EDLIN
display 6-42 parameter 4-6
execute 6-40 Line Editor Program 2-16,
unassemble 6-42 2-20,4-3
variable length 6-42 line numbers 4-3
INT X'24' B-7 linefeed D-2
INT 21 B-6 lines, renumber 4-12,4-19
interface module, BIOS B-1 LINK
internal command See linker (LINK) program
processors B-4 linker (LINK) program
internal commands 3-4 command line 5-18
interrupt codes 6-22 command prompts 5-8
interrupt flag 6-37 example session 5-22
interrupt mechanism, messages 5-28
8088 B-1 starting 5-1 7
interrupt vectors B-2 linker files
interrupt X'20' D-l automatic response 5-4,
interrupt X'22' B-4, B-5, D-l 5-20
interrupt X'23' B-4, B-5, D-2 input 5-4
interrupt X'24' B-5, D-4 library 5-4, 5-12
interrupt X'25' D-5 listing 5-4, 5-11
interrupt X'26' D-5 object 5-4, 5-10
interrupt X'27' B-5, D-6 output 5-4
interrupt, set D-17 run 5-4, 5-11
interrupts D-l linker parameters
invoking one batch file from /DSALLOCATION 5-14
another 3-15 /HIGH 5-6,5-14
IP (Instruction Pointer) 6-4 /LINE 5-15
IP register 6-21, 6-34, D-4, E-5 /MAP 5-15
IRET D-2 /PAUSE 5-15
/STACK 5-16
linker prompts 5-10
K list - DEBUG parameter 6-7
List Lines command 4-22,
keyboard 3-8 4-34
keyboard input D-8 listing directory entries 3-9,
keyboard input, buffered D-I0 3-35
keyboard status, check D-I0 Load command 6-26, 6-47,
keys, control 2-11, 3-13, 4-10, 6-49
6-12 load module 5-16, 5-25
keys, DOS editing 2-16,3-13, load module memory map 5-26
4-10, 6-12 loading .EXE files F-l
keywords 3-5 loading programs 3-47

X-9
locate next cluster C-6, C-8
logical record numbers D-6
o
logical record size E-8 OBJ extension 5-10
LPT 1: - reserved name for object files 6-3
printer 3-8 object modules 5-10
object pn:>gram files 3-64
open file D-11
M operation, suspend
system 2-12,3-58
/MAP linker parameter 5-15 optional remarks, PAUSE
MAP extension 5-11 command 3-58
mapping file sectors B-6 Output command 6-32, 6-49
memory output files
high 5-14, 6-5, B-4 linker 5-4
low 5-14 output routines B-5
memory management output, auxiliary D-9
routine B-6 output, display D-2, D-8
memory maps OV flag set condition 6-37
DOS E-1 overflow flag 6-37
load module 5-26
memory status report 3-19
memory, loading files into 4-4 p
messages A-3
messages, linker 5-28 paragraph boundary 5-6
MODE command 3-53, 3-66 parallel printer to Asynchronous
Monochrome Display Printer Communications Adapter 3-57
Adapter 3-54 parameters
MOV instruction C-8 DEBUG 6-6
Move command 6-29,6-49 DOS 3-6
multi-drive system 2-9 dummy 3-17
EDLIN 4-6
sa ve area E-4
N testing with different 6-21
parity flag 6-37
n - EDLIN parameter 4-7 parse filename D-18
NA flag clear condition 6-37 partial file, edit 4-11
Name command 6-30, 6-49 jPAUSE linker parameter 5-15
NC flag set condition 6-37 PAUSE command 3-58,3-66
new diskette 1-8 PC register 6-34
NG flag set condition 6-37 PE flag set condition 6-37
notation, format 3-5 percent sign C%) 3-17
NUL: - reserved device period C.) 4-7, 4-16
name 3-8 physical append 3-31
numbers, line 4-3, 4-12 PL flag clear condition 6'-37
NV flag clear condition 6-37 plus sign
NZ flag clear condition 6-37 in automatic response
file 5-20
x-tO
plus sign (continued) Read-Only Memory
in response to linker (ROM) B-1
prompt 5-10 read, random D-16
PO flag clear condition 6-37 read, random block D-17
portaddress - DEBUG read, seq uen tial D-13
parameter 6-7 record number, relative E-9
pound sign (#) 4-6 record numbers, logical D-6
prepare diskettes 3-50 record size, logical E-8
print displayed output 2-13 recording format, diskette 3-50
print screen output 2-14 Register command 6-34, 6-50
print string -D-I0 registername - DEBUG
printer 2-13,3-8,3-53 parameter 6-8
printer output D-9 registernames, valid 6-34
printer output routines B-5 registers, display 6-35
PRN: - reserved name for relative cluster number C-4
printer 3-8 relative record number E-9
program execution, stop 6-21 relative sector num ber 6-8
program segment relative zero 5-25
create new D-17 relocatable loader 5-4
DOS E-3 relocation F-3
Program Segment Prefix 6-5, REM command 3-59,3-67
B-4, B-5, B-7, E-5 remarks, display 3-59
program terminate D-6 remarks, PAUSE
protocol parameters 3-56 command 3-58
public symbols 5-24 REN command 3-60, 3-67
punctuation 3-5 RENAME command 3-60,
3-67
rename file D-15
Q renumber lines 4-12, 4-20
replace byte contents 6-17
question mark 3-5, 3-9 Replace Text command 4-27,
Quit command 6-33, 6-50 4-34
Quit Edit command 4-26,4-34 replacing characters 2-27
quotation marks 6-9 replacing the command
processor B-4
reserved device names 3-8,
R 3~27
reset, disk D-ll
random access B-6 reset, system 2-4, B-2
random block read B-6, D-l 7 resident portion of command
random block write B-6, D-18 processor B-3
random read D-16 return codes B-13
random record field, set D-17 ROM (Read-Only
random write D-16 Memory) B-1
range - DEBUG· ROM BIOS routine D-9
param.eter 6-7, 6-8

X-I-1
routines semicolon delimiter 3-12
console/keyboard B-5 separators, filename D-18
device B-1 sequential read D-13
diskette handling B-5 sequential write D-14
keyboard input B-5 set
memory management B-6 date D-19
output B-5 interrupt D-l 7
printer output B-5 random record field D-17
ROM BIOS D-9 time D-19
time function B-5 verify switch D-20
run file 5-11 set condition 6-36
set disk transfer address D-15
Shift-PrtSc keys 2-14
\ SI register 6-5, D-4
sign flag 6-37
\ back slash 2-14, 2-23 single sided diskettes
allocation C-2
compatible drives 2-8
s directory 1-6
single-drive system 2-9, 3-40,
save area, parameter E-4 3-43,D-ll
saving diskette space 3-47 size, file D-16, E-9
screen 3-8 slashes 3-5
screen display source area 6-29
restart 2-13 source drive 3-13
suspend 2-13 source files 4-3
screen output, print 2-14 SP (Stack Pointer) 6-4
Search command 6-39,6-50 SP register E-5
search for entries D-12 space allocation B-6, C-l
Search Text command 4-30, space delimiter 3-12
4-34 special characters 3-9
sector - DEBUG specifying a drive 3-6
parameter 6":8 square brackets 3-5
sector boundary C-I SS register 6-4, E-4
sector number, relative 6-8 stack allocation statement 5-16
sector, absolute 6-45 /ST ACK linker parameter 5-16
sectors 1-6, 3-43, 6-8 Stack Pointer (SP) 6-4
sectors, file B-6 stack space B-2
segment 5-6, 5-10 stack, user D-4
SEGMENT command 5-16 start segment F-3
segment fixups 3-47 starting cluster C-4
segment registers 6-4, 6-43 starting DEBUG 6-4
segment, create new starting DOS
program D-17 computer power off 2-3
segment, default 6-6 computer power on 2-4
segment, start F-3 methods 2-3
select disk D-ll starting ED LIN 4-4
X-12
starting the linker 5-1 7 Trace command 6-40, 6-47,
status report 3-19 6-50
stop program execution 6-21 track/sector, calculate
string - OEBUG parameter 6-9 absolute C-4
string - EO LIN parameter 4-8 tracks, defective 3-50
structure, DOS B-1 transfer address, disk E-4
summing files 3-31 transfer system files 3-61
suspend screen output 2-13 transient portion of command
suspend system operation 2-12, processor B-4
3-58 TYPE command 3-64, 3-67
switch, high/low loader F-3 types of DOS commands 3-4
symbols, global and
public 5-15
syntax error 6-12
SYS command 3-61, 3-67
u
system devices 3-8 Unassemble command 6-42,
system file E-IO 6-50
system files, transfer 3-61 unassemble instructions 6-42
system prompt 2-9,3-13, B-4 unprintable characters 6-14
system reset 2-4,B-2 UP flag clear condition 6-37
user stack 0-4

T
target drive 3-13
v
technical information, DOS B-1 value 6-10
template 2-16 variable length
temporary file, VM.TMP 5-10 instructions 6-42
terminate address B-5 verify switch D-20
terminate address VM.TMP temporary file 5-10
interrupt 0-1
terminate but stay resident B-3
terminate commands 3-13
terminate program 0-8
w
termina te program work areas E-l
interrupt 0-1 Write command 6-45, 6-50
terminators, filename 0-18 Write Lines command 4-33,
text files 3-64, 4-3 4-34
thrashing B-9 write, random 0-16
time write, random block 0-18
enter 2-5, 3-62 write, sequential 0-14
get 0-19
set 0-19
TIME command 3-62,3-67
time function routines B-5
z
time, change 3-62 zero flag 6-37
ZR flag set condition 6-37
X-13
X-14
The Personal Computer
Software Library

Product Comment Form

DISK OPERATING SYSTEM 6172220

Your comments assist us in improving our products.


IBM may use and distribute any of the information
you supply in anyway it believes appropriate without
incurring any obligation whatever. You may, of
course, continue to use the information you supply

Comments:

If you wish a reply, provide your name and address in


this space.
~ame _______________________________________
Address ___________________________________
City _______________ State._______________
Zip Code ______
NO POSTAGE
NECESSARY
111111 IF MAILED
IN THE .
UNITED STATES

BUSINESS REPLY MAIL


FIRST CLAS~ PERMIT NO. 123 BOCA RATON, FLORIDA 33432

POSTAGE WILL BEPAID BY ADDRESSEE

IBM PERSONAL COMPUTER


SALES & SERVICE
P.O. BOX 1328-C
BOCA RATON, FLORIDA 33432

aJa4 PIO::!

aldelS lOU Op aseald ade.l


- The Personal Computer
----
-
--
-
--- -
- --
---
----
-
-
--- Computer Language Series
- -
----- - - -

Product Comment Form

DISK OPERATING SYSTEM 6172220

Your comments assist us in improving our products. IBM


may use and distribute any of the information you supply in
anyway it believes appropriate without incurring any
obligation whatever. You may, of course, continue to use the
information you supply.

Comments:

If you wish a reply, provide your name and address in this


space.
~ame _________________________________________
Address ______________________________________
City _____________ State _________________
Zip Code _ _ _ _ __
NO POSTAGE
NECESSARY
111111 IF MAILED
IN THE
UNITED STATES

BUSINESS REPLY MAIL


FIRST CLASS PERMIT NO. 123 BOCA RATON, FLORIDA 33432

POSTAGE WILL BE PAID BY ADDRESSEE

IBM PERSONAL COMPUTER


SALES & SERVICE
P.O. BOX 1328-C
BOCA RATON, FLORIDA 33432

aJa4 PIO:!

aldelS lOU op aseald adel.


- The Personal Computer
----
- -
- --
--- -
- ---
---
- Computer Language Series
=.::=~=

Product Comment Form

DISK OPERATING SYSTEM 6172220

Your comments assist us in improving our products. IBM


may use and distribute any of the information you supply in
anyway it believes appropriate without incurring any
obligation whatever. You may, of course, continue to use the
information you supply.

Comments:

If you wish a reply, provide your name and address in this


space.
~ame _________________________________________
Address ______________________________________
City __________________ State _________________
Zip Code _ _ _ _ _ __
NO POSTAGE
NECESSARY
111111 IF MAILED
IN THE
UNITED STATES

BUSINESS REPLY MAIL


FIRST CLASS PERMIT NO. 123 BOCA RATON, FLORIDA 33432

POSTAGE WILL BE PAID BY ADDRESSEE

IBM PERSONAL COMPUTER


SALES & SERVICE
P.O. BOX 1328-C
BOCA RATON, FLORIDA 33432

aJa4 PIO::!

aldels louopaseald adel.


Continued from inside front cover DAMAGES ARISING OUT OF THE
USE OR IN ABILITY TO USE SUCH
SOME STATES DO NOT ALLOW THE PROGRAM EVEN IF IBM OR AN
EXCLUSION OF IMPLIED AUTHORIZED IBM PERSONAL
WARRANTIES, SO THE ABOVE COMPUTER DEALER HAS BEEN
EXCLUSION MAY NOT APPLY TO ADVISED OF THE POSSIBLITY OF
YOu. THIS WARRANTY GIVES YOU SUCH DAMAGES, OR FOR ANY
SPECIFIC LEGAL RIGHTS AND YOU CLAIM BY ANY OTHER PARTY.
MA Y ALSO HAVE OTHER RIGHTS SOME STATES DO NOT ALLOW THE
WHICH V AR Y FROM STATE TO LIMITA TION OR EXCLUSION OF
STATE. LIABILITY FOR INCIDENTAL OR
IBM does not warrant that the functions CONSEQUENTIAL DAMAGES SO
contained in the program will meet your THE ABOVE LIMIT A TION OR
requirements or that the operation of the EXCLUSION MAY NOT APPLY TO
program will be uninterrupted or error YOU.
free. GENERAL
However, IBM warrants the diskette(s) or
You may not sublicense, assign or
casseue(s) on which the program is fur-
transfer the license or the program
nished, to be free from defects in materials
except as expressly provided in this
and workmanship under normal use for a
Agreement. Any attempt otherwise to
period of ninety (90) days from the date of
sublicense, assign or transfer any of the
delivery to you as evidenced by a copy of
rights, duties or obligations hereunder is
your receipt.
void.
LIMIT A TIONS OF REMEDIES This Agreement will be governed by the
IBM's entire liability and your exclusive laws of the State of Florida.
remedy shall be: Should you have any questions
1. the replacement of any diskette(s) or concerning this Agreement, you may
cassette(s) not meeting IBM's "Limited contact IBM by writing to IBM Personal
Warranty" and which is returned to Computer, Sales and Service, P.O. Box
IBM or an authorized IBM PERSONAL 1328-W, Boca Raton, Florida 33432.
COMPUTER dealer with a copy of your
YOU ACKNOWLEDGE THAT YOU
receipt, or
HA VE READ THIS AGREEMENT,
2. if IBM or the dealer is unable to deliver a UNDERSTAND IT AND AGREE TO
replacement diskette(s) or cassette(s) BE BOUND BY ITS TERMS AND
which is free of defects in materials or CONDITIONS. YOU FURTHER
workmanship, you may terminate this AGREE THAT IT IS THE COMPLETE
Agreement by returning the program AND EXCLUSIVE STATEMENT OF
and your money will be refunded. THE AGREEMENT BETWEEN US
WHICH SUPERSEDES ANY
PROPOSAL OR PRIOR AGREEMENT,
IN NO EVENT WILL IBM BE LIABLE ORAL OR WRITTEN, AND ANY
TO YOU FOR ANY DAMAGES, OTHER COMMUNICATIONS
INCLUDING ANY LOST PROFITS, BETWEEN US RELATING TO THE
LOST SAVINGS OR OTHER SUBJECT MATTER OF THIS
INCIDENTAL OR CONSEQUENTIAL AGREEMENT.
--
--
---
- --
-- - --
- -
-
-
- ----
- ---
-==-=':'=®
International Business Machines Corporation

P.O. Box 1328-W


Boca Raton, Florida 33432

6172220
Printed in USA
READ THIS FIRST

Welcome to DOS Version 1.10 for your IBM Personal


Compu ter. Whether you are using DOS for the first time
or upgrading to this enhanced version, this brief
discussion contains some information about Version 1.10
that may be of importance to you. For more specific
information about the topics in this document, refer to
the appropriate sections of the DOS manual.

DOS Version 1.10 contains incremental functional


enhancements, performance improvements and support
for the IBM 320K 5 1/4" Diskette Drive. Although
Version 1.10 is functionally compatible with Version 1.00
there are some differences that you should be aware of
and, if necessary, take the appropriate course of action for
your particular situation.

Increased Memory Requirements


First, DOS Version 1.10 is about 250 bytes larger than
Version 1.00 and BASIC or BASICA Versions 1.10 are
about 200 bytes larger than their Version 1.00
counterparts. In general, this should not affect any of the
applications that you have written and already run with
Version 1.00. Should you encounter the rare case of
having one of your applications "not fit" with Version
1.10, it may be necessary to "trim" your program to run
with Version 1.10. Although we've made 'every effort to
keep things from growing, some growth was unavoidable.

©Copyright International Business Machine Corp. 1982


Our one application affected by the growth in Version
1.10 is the IBM Asynchronous Commu1!ications Support
program. For those of you who will be using this program
under Version 1.10, it will be necessary to change line 2 of
the AUTOEXEC.BAT file on the Communications
program diskette (that's the line that invokes BASIC and
subsequently the program TERMINAL) to the following:

BASIC TERMINAL/C:O
You can use either DOS EDLIN or COpy to make this
change.

DOS Packaging Changes

°
Another DOS Version 1.1 change is the packaging of
some DOS functions. For example, in Version 1.00,
TIME and DATE are external commands (individual
COM files). In Version 1.10 they are part of DOS itself
(internal). Thus, it is not necessary to copy these
functions to any of your DOS-based applications in
Version 1.10. If you have any batch programs that copy
these functions to your applications, they don't need tobe
changed; but don't be alarmed if you get the message:

o File(s) Copied
in response to a Version 1.10 DOS COpy command for
any such request. We mention this because some of our
applications (like Dow Jones Reporter) put these
commands on their program diskette.

Serially Attached Printer Support

One significant Version 1.10 change is to the DOS MOD E


command for the dynamic reconfiguration of DOS to
support serially attached printers. This means it is no
longer necessary to change any applications to do this.
With the MODE command you can reassign the DOS
default printer (LPT1:) to the appropriate asynchronous
communications (RS2 32) adapter (either COM1: or
COM2:) for your printer. Also, with the MODE command
you can specify the characteristics of your serially
attached printer (parity, baud rate, etc.).
320K Drive Support
The last and most significant areas of change are for 320K
Diskette Drive support. Although it depends upon your
specific system configura tion, there are several functional
changes to DOS Version 1.10 that can affect your
environment or applications if you have 320K drives on
your system. The system configuration that must be
considered is one where you have "mixed" diskette drives
on your system (ie. Drive A is 160K and Drive B is 320K or
the reverse). Under DOS Version 1.10 diskettes
formatted for dual-sided use on a 320K drive cannot be
processed on a 160K drive. However, those formatted on
a 160K drive can be processed on a 320K drive.

On most systems with "mixed" drives this probably will


not be a problem as you can still backup your diskettes
and data by using DOS DISKCOPY and alternating the
source and target diskettes on the same drive.

Where this can present a problem for systems with


"mixed" drives is with applications that can only make
one backup copy of the application program diskette.

WARNING
With DOS Version 1.10 and on a "mixed" drive system it
is possible to make a backup copy of an application that
will not run on the system that it was made on. This
potential usually exists on systems where Drive A is 160K,
Drive B is 320K and the process to create the backup
diskette uses the DOS FORMAT command first to format
the backup diskette and then the DOS COPY command
to copy the programs onto the backup diskette. Should
you have this situation and it can exist, then use the DOS
TYPE command to display any batch file that may be used
to create a backup copy. If the display shows a line like the
one that follows:

FORMAT B:/S
then use the DOS EDLIN command and change that line
to the following:

FORMAT B:/S/1
In the case of the IBM Dow Jones Reporter where you are
following the instructions in the book and you are told to
enter:

FORMAT' A:/S
to avoid any potential problems type

FORMAT A:/S/l
This will insure your backup diskette is formatted the
same as the Reporter diskette.

We bring this to your attention because the DOS


FORMAT command always formats the diskette to the
capacity (hardware specification - 160K or 320K) of the
target drive, unless you override this default by specifying
/1 on the FORMAT command to format a diskette for
160K on a 320K drive.

Another IBM application that is designed for 160K drives


is Time Manager. If you are formatting a Time Manager
Data Diskette you must use

FORMAT II
or the data diskette will not be usable.

Unlike FORMAT, the Version 1.10 DISKCOPY


command always formats the target diskette to the same
format as the source diskette. Be aware, however, you
cannot use DISKCOPY to copy a 320K-formatted
diskette onto a 160K diskette drive .

. . . In Closing
A final word about DOS Version 1.10 - we've just
brushed the surface of the many enhancements. If you are
a Version 1.00 user, take the time to read the DOS manual
to gain a more detailed understanding of the new and
enhanced functions. If you are not a former user, then
read the book anyway; it will help you get started more
quickly.

You might also like