We begin our discussion of DOS with several basic definitions.
Procedure. To cold-start your computer, turn the power switch off, then on. The following events will occur:
A: >
.
Definition. Warm Start is used when the computer is already powered up or locked up.
Definition. The warm start procedure is the same as with cold
start. However, to warm-start your computer, press the
{CTRL}
, {ALT}
, and {DEL}
keys
at the same time. Events 2-5, as listed above, will occur.
Question. What does booting do?
O.SYS
,
MSDOS.SYS
) and then COMMAND.COM
(the latter contains internal commands);
FORMAT
command, and why it is needed:
Function: FORMAT
prepares a floppy disk for use
Notation: DOS Disk drive specifiers: A:
B:
(floppy disk
drives); C:
, D:
, ... (hard disk
drives).
Options: Switches for the FORMAT
command
are:
/S
- puts DOS system files on disk, thereby
making a system disk.
Usage: FORMAT [switches] drive-specifier
Procedure: To format a floppy disk:
Note: DO NOT TYPE "FORMAT C:". This can cause much trouble by erasing your hard disk.
Tasks Performed by FORMAT
Command:
UNFORMAT
command:
Function: Restores contents of disk to original contents (prior to formatting) ONLY if no files have been stored on the disk after the disk was formatted.
Usage: UNFORMAT drive-spec
LABEL
command:
Function: Changes a floppy disk's electronic label, which is useful for documentation purposes.
Usage: LABEL [drive-spec]
[label]
, where
A:
,
B:,
etc. [label] = a string of characters in {A-Z,0-9,"-"}.
Procedure: To change a disk label, perform the following steps:
A:
;
LABEL A:
label
, as defined previously.
VOLUME
command:
drive-spec
.
Usage: VOL drive-spec
CHKDSK
command:
DIR
) command.
Function: CHKDSK
causes a disk checking
program to run on the disk drive denoted by
drive-spec
.
Usage: CHKDSK drive-spec
.
Options: CHKDSK /V
Note: On some versions of DOS, CHKDSK
may
cause your stored data to be partially erased. Check
with your operating system manual before you use this command.
DISKCOPY
command:
Function: DISKCOPY
copies the contents
of one disk drive to another.
Usage: DISKCOPY old-disk
new-disk
, where
old-disk
denotes the disk data is to
be copied from, andnew-disk
denotes the disk data from
old-disk
will be copied to.
Example: DISKCOPY A: B:
Example: DISKCOPY A: A:
Definition. Root Directory is the highest-level directory.
Definition. Subdirectory is any directory subordinate to (or under) the root directory.
Example. Given the root directory denoted by (\) and
subdirectories called DATA
, PROJECTS
,
PROJ-1
, and PROJ-2
, assume that one has
the following organizational scheme:
\ -+- DATA +- PROJECTS | +- PROJ-1 | | | +- PROJ-1.DRW | +- PROJ-2The preceding diagram means that:
DATA
and PROJECTS
;
PROJECTS
directory has two subdirectories,
called PROJ-1
and PROJ-2
;
PROJ-1
contains a file called
PROJ-1.DRW
.
DIR
command,
which displays directory contents, to see how DOS commands
can interact with this concept of directory and file structures.
CD \PROJECTS
DIR
Directory of \PROJECTS: . .. PROJ-1 < DIR > 12 Jan 97:1343 PROJ-2 < DIR > 14 Jan 97:1537where "." and ".." denote the current and parent (higher-level) directories, respectively.
name.ext
, where
name
is a string of 8 legal
filename characters or less taken from the set:
A = { A-Z,a-z,0-9,$,&,@,!,%,-,_,(,),{,} } ,
In this class, we prefer that you use the abbreviated character set:F = { A-Z,a-z,0-9,$,-,_ } .
b) . is the period; and
c) ext
is a string of 3 legal
filename characters or less, called the extension.
Note: A filename may NOT contain arithmetic operators such as + and = .
Observation. File types are also specified by their extensions. Several examples follow:
.EXE
- executable file (an application program); .COM
- executable file that can be relocated
in memory; .BAT
- a script file that the computer uses like a
small program, for convenience; .ASC
or .TXT
- text file; .DOC
- document file produced by a word processor; .PAS
- Pascal program (source code); .BAS
- BASIC programming language file; and.DRW
or .ACD
- AutoCad drawing file.Observation. Filenames may include wildcards, which are ways of making filenaming easier when you don't know the complete file name.
Definition. The global wildcard "*" matches zero or more characters in the file name or extension.
Example. The wildcarded file name TES*.*
denotes all files whose names start with "TES", and have any
extension or no extension.
Definition. The local wildcard "?" matches one and only one character in the file name or extension.
Example. The wildcarded file name TES??.E*
denotes all files whose name has five characters and starts with TES,
and has an extension that begins with "E".
COPY
command:
COPY
command helps you do this.
Usage: COPY old-file new-file
,
where
old-file
is the file to be copied new-file
is the new copy of
old-file
.
Example: COPY test.txt test.cpy
.
Example: COPY old.dat B:\old.cpy
old.dat
from the
current drive and directory and will transfer
that file to floppy drive B at the root
directory (\) as the new file old.cpy
.
COPY A:DR*.* B:\PROJ-1\????????.???
A:
beginning with the letters DR
to drive B:
's directory
PROJ-1
.
COPY CON file
CON
for "console") will be redirected by
the operating system to reside in the diskfile denoted by
file
.
Note: The COPY
command cannot be used to copy
directories.
XCOPY
command:
XCOPY
functions much like the COPY
command, but allows interactive selection of files,
which was not found in early versions of MS-DOS.
COMP
command:
COMP
allows you to compare the contents of
two files.
Usage: COMP file-1 file-2
Output: A list of differences between lines in
file-1
and file-2
is
displayed on-screen.
RENAME
command:
RENAME
is a destructive form of the
COPY
command.
Usage: RENAME old-file new-file
, where
old-file
is the file to be renamed new-file
is the new filename for
old-file
.
Function: The preceding command sequence causes two operations to be executed:
old-file
is copied to
new-file
, then old-file
is deleted (removed
from disk storage).
DELETE
command:
Usage: DEL file
file
from
the current disk drive.
Note: Use DEL
with care! If DEL
is used in conjunction with a filename that has wildcards
in it, then DOS may (or may not) prompt you whether or
not you really
want to delete all the files that match that wildcarded
filename.
ERASE
command is a synonym for the
DELETE
command.
ATTRIB
command:
ATTRIB
more reliably. Thus, we will not deal
with ATTRIB
in this class.
TYPE
command:
TYPE
command facilitates.
Usage: TYPE filename
, where
filename
is the name of a text file.Note: Don't use this command with non-text files, as it may cause your computer to lock up.
PRINT
command:
PRINT
command facilitates.
Usage: PRINT filename
filename
is the name of a text file.Note: Don't use this command with non-text files, as it may cause your printer to lock up.
CD
command:
CD
changes the current directory.
Usage: CD dir
, where
dir
denotes the directory-path
of the directory to be set as current.
Example: CD A:\PROJECTS\PROJ-1
Variants: A:
, B:
, etc. set the
current (default) disk drive.
MKDIR
command:
Function: MKDIR
builds new directories in
an existing directory structure.
Usage: MKDIR dir
dir
that will
dir
is correct; and dir
does not exist prior
to the execution of the MKDIR
command.
MKDIR A:\PROJECTS\PROJ-2
PROJ-2
under
the directory PROJECTS
, if
PROJECTS
exists as a directory on drive A,
under the root directory (\).
Example: MKDIR PROJ-2
PROJ-2
under the
current (default) directory, if
PROJ-2
does not already exist under the
current directory.
DIR
command:
DIR
command and its various options help us
to perform this task efficiently.
Function: DIR
displays a list of the files
and directories in the current directory or in a directory
path that is specified in the command. File size is given in
bytes or characters, together with the date and time the file was
last modified.
Usage: DIR [dir-path]
, where
dir-path
is the pathname of
a directory.
Options: DIR /W
Options: DIR /P
TREE
command:
TREE
command displays a hierarchical file
structure starting at the current directory (highest level of
the hierarchy).
Usage: TREE dir-path
, where
dir-path
must
exist on disk prior to invocation of TREE
.
RMDIR
command:
RMDIR
removes a directory, if it exists on disk.
Usage: RMDIR dir-path
, where
dir-path
must
exist prior to invocation of RMDIR
; and
b) all subordinate files and directories of
dir-path
must be deleted prior to
invoking RMDIR
.
HELP
command:
Function: Information pertaining to the computer or to a given command is displayed on the monitor.
Usage: HELP
(or
HELP command-name
, where
DATE
and TIME
commands:
Usage: Enter the command, then respond to the prompt by
entering the date and time as DDMMYYYY
or
HHMM
(24-hour format).
CLS
command clears the monitor screen.
VER
command displays the version number of the
version of DOS you are running.
This concludes our brief summary of how DOS works. We next examine DOS' role in supporting applications programs.
SAVE
s a file that you've programmed
using the Turbo Pascal interface, the following high-level actions could occur:
SAVE
button. Step 2a. The FSW requests an I/O operation from the operating system (OS), which acknowledges it has received the request.
Step 2b. The OS requests an I/O operation from the CPU, which acknowledges it has received the request.
Step 2c. If the CPU is performing another task (e.g., in a multi-tasking system), then that task is suspended, and the CPU requests an I/O operation from the I/O processor (IOP). The IOP acknowledges that it has received the request, and checks to see if the requested disk drive is available.
Step 3. If the disk drive is not available, the IOP passes that information through the CPU to the OS, and thence to the applications program. The user waits until the requested resource is available. Otherwise, the IOP seizes control of the disk drive and informs the CPU (and, hence, the OS and applications program) that the requested data transfer can occur.
Step 4. The applications program passes the data to be saved to the OS, which passes the data to the CPU (and, hence, to the IOP). The IOP writes the data onto the disk at the location pointed to by the File Access Table entry.
Step 5. If the write-to-disk operation encounters an error or an exception, then that information may be passed up to the application program, and user intervention may be sought. Otherwise, the IOP notifies the CPU, which notifies the OS, which notifies the applications program that the write operation has succeeded. Additionally, the IOP modifies the FAT as required, to reflect changes in the disk or file attributes or structure. If a process was suspended by the CPU to permit the I/O operation to occur, then that process is restarted.
By preserving software modularity, system developers can enhance maintenance and reliability. That is, by localizing specific operations to given software modules, it is easier to detect places in the source code where errors occur. Such errors can then be fixed at the given modular level, without having to modify the entire software system.
Additional benefits of modular design are realized in efficient replacement of components. For example, when a given component of the application software that performs a specific task (e.g., line drawing) is to be replaced, then that component (if properly designed) can be replaced by another, more capable software module. We call this process incremental upgrading.
This concludes our overview of DOS and its associated commands.
We next discuss software modularity in greater detail.