Tuesday, 29 January 2013

ECHO

You have seen one facet of ECHO already: it can send a messageto the screen. More
importantly, it can help clear the clutter on the screen when a batch file executes. Normally, the
batch file commands would show on the screen as if you were typing them. This can get distracting.
If you want to suppress the command echoing type:

ECHO OFF

To restart echoing, type: ECHO ON
When ECHO is off no part of the actual DOS commands in the batch file will show on the
screen. To display a message put it after the ECHO command:
ECHO Message
As you will see, the REMark command also displays messages; butNOT if ECHO is off!
Use ECHO if you want the message to show no mater what.

REMark

REMark can be used to send messages to the screen or simply to document some part of
your batch file's operation.
Use them extensively in long batch files. The computer operator (it won't always be you)
wants to know what is happening and, over time, you might forget whata complicated set of
commands really does.
The format is:
REMMessage
REMarks can be up to 123 characters long, although you usually won't want to go over the
screen width so you can control the display.
An undocumented, variation of this command is the period. In DOS 2.x, if a line in a batch
file starts with one or more periods (.) it is treated as a  remark. It is dangerous to use this however
since in DOS 3.x and later that same line would be treated as the path to a command!

PAUSE

The last "simple" command is  PAUSE. Its basic function is to stop the execution of the
batch file until you press a key. This can allow you to perform anecessary task; like perhaps
changing a disk or verifying that a particular disk configuration is in place in order to avoid errors
as the remaining parts of the batch file are executed.
In early DOS versions PAUSE would optionally display a message. It does not now. In
order to display a message you have to couple PAUSE with the ECHO command. The format in use
now would require:
ECHO Message
PAUSE
The message will show, followed by the DOS message:
Strike a key when ready... (in early DOS versions)
Press any key to continue... (in later DOS versions)

Saturday, 19 January 2013

BATCH FILES

A batch file is nothing more than a collection of DOS commands placed into an ASCII text
file. When DOS executes a batch file, each line in the file is treated as a DOS command and is
executed as if you had typed the command at the system prompt. Their main use is to automate
DOS command sequences you repeat often or are hard to remember.
Each line in the file is treated as a DOS command and is executed as if you had typed the
command at the system prompt.
In addition to standard DOS commands, batch files also have their own subset of commands
which allow you to actually write a batch file as a small program. Branching and iteration are
allowed in these programs.
Also, batch commands may have external parameters passed to them at the time you execute
the file.
A batch file must have the extension .BAT and you execute the commands in it like any
other DOS command: by typing the file's root name, without the extension, at the system prompt.
Parameters are extra pieces of information that you type after many of the DOS commands. For
example, "DIR B: /W" contains the parameters B: and /W. These modify the basic operation of the
command, but are not required by the command.
You pass parameters to a batch file in the same manner; by typing the information after the
batch command, but before tapping the Enter key. 


The parameters may be used in any place in the batch file  where a parameter would
normally be used as part of the DOS command being run.
Markers are used within the batch file to signify which parameter goes where. Markers are
comprised of a percent sign (%) and a single digit between 0 and 9 (that's ten markers in use at any
one time; remember, zero is a number).
As an example:

Assume that a batch file named REPEAT.BAT is on the current drive. This file contains two
commands: "ECHO OFF" which stops DOS from showing commands and  "ECHO %1 %3" where
the ECHO command can show messages on the screen. If, at the DOS prompt you typed "REPEAT
Red Blue Green" your screen would show "Red Green" as shown in the screen capture: 




In this simple example, three parameters were passed to  the batch file and were placed into
the ECHO command in the order received. Only the first and third are shown as only those were
referenced in the batch file.
The parameters and markers were related as follows...
•  %1 is marker 1 and, in this example, represents "Red", the first parameter;
•  %3 is marker 3 and, in this example, represents "Green", the third parameter;
•  %2 would be marker 2 but, in this example, is not present so "Blue", the second parameter,
is ignored.
Note: Marker zero is assigned the name of the batch file in the form you typed it in (i.e., all caps, all
lower case, or a mixture).
In addition to the normal DOS commands, batch files have their own sub command structure.
Following are the sub commands in the order we will discuss them:
•  ECHO:Turns command display on/off or may display a message.
•  REM:Displays a message on the screen.
•  PAUSE:Temporarily stops the batch file execution.
•  GOTO:Jumps to a labeled set of commands in the batch file.
•  IF:Permits conditional operation of any command.
•  SHIFT:Reassigns the relationship of parameters to markers.
•  FOR..IN..DO:Allows iteration subject to defined conditions.
•  CALL:Runs another batch file then returns to first.
•  @:Turns display off for single command

Subdirectory Review

Assume the shown subdirectory structure...



The following series of commands perform the indicated functions.  Study them and make
certain you understand them.
From the root:
•  MD \WORDPROC\LETTERS\HOME Makes a new directory called HOME in LETTERS.
•  RD \WORDPROC\BOOK Removes BOOK from WORDPROC.
•  CD \WORDPROC\MEMOS Makes MEMOS the active directory.
To move from the root to the subdirectory MEMOS type:
•  CD \WORDPROC\MEMOS
Remember, to make any directory the current directory, simplyissue the CD command using
the pathname that you would use to access any file in that subdirectory. CD \ alone will move you
back to the root from anywhere.
From the root, the following command removes the subdirectory LETTERS:
•  RD \WORDPROC\LETTERS
Remember, before you can remove a subdirectory, it must be empty (all files deleted and other
subdirectories removed), you cannot be in it, and you cannot remove the root directory. In DOS 6.0
you can do both with the single command DELTREE. 




A final reminder:
Use subdirectories as needed, but don't overdo it. Pathnames are limited to 63 characters;
and, you can get lost in the directory structure if you create a  very complex one.  PROMPT$P$G
will help you keep track.
Also, directories are not free. Each takes up some disk spaceso if you fill your disk with
directories, there won't be room for anything else.

Tuesday, 8 January 2013

Make and Remove Subdirectories


If you are going to have sub directories, there must be a way  to make them. The syntax for
the make directory command is:
MDd:pathname\DIRNAME
You can make a subdirectory IN any directory FROM any directory so long as you give the
appropriate pathname. Usually, you will change to the directory you want the sub directory to be in

and then issue a simple MD DIR NAME command. That way there isno mistake about what will
happen.

When you no longer need a directory you may remove it from the disk. The first thing you
have to do is empty it of files and move out of it. Only then will  you be able to remove it. The
syntax for removing is:
RDd:pathname\DIRNAME
You cannot remove the root directory (it's the master for the disk and when it's the only
directory you would have to be in it, and you can't remove a directory you are in).
Note:In DOS 6.0 the command  DELTREEwas introduced. DELTREE will both remove files
from a directory and remove that directory with a single command.


Mysterious Dots

When you are in a subdirectory and issue the DIR command, you willsee something like
this:



The dots indicate you are in a subdirectory. The single dot is the  current directory and the
double dots are the parent to the current directory. Thus you could  move to the parent of
TUTORIAL (in the example above) by simply issuing the command CD ..
Used with care, the dots can speed up subdirectory commands.


Tree

All directory paths and their relationships are called a tree. If you don't remember the
various subdirectories (and optionally the files in them) DOS offers you a chance to see them with
the TREE command:
TREEd:/f

This command lists all paths from the root on the disk. If you use the/f option, you will also
see all files in each sub directory. (Only the file names are shown, not their size or creation
date/time.)
For a permanent record, press Control-PrtScr before issuing  the TREE command and again after.
Your printer will record all text scrolling past on the screen. (Or redirect to a file with TREE d:/f >
Filename.)

[Note: TREE has been removed under Windows.]

Subdirectory Introduction

As the name implies, a pathname is nothing more than a "path" that directs DOS to your
particular file.
You see, with DOS 2.x, IBM/Microsoft introduced multiple directories on a single disk. In
effect, this lets you sort your files into groups and place each related group into its own directory.
This means you don't have to search an entire disk to find one file.
A lower-level directory is called a subdirectory (what else?)
Seriously, consider a disk. To this point you have learned that each file on that disk is represented as
an entry in the directory, put there so both you and DOS can find the file on disk.
If, instead of data, you created a file that pointed to other  files on the disk, you will have
built what amounts to a subdirectory.
DOS manipulates files in subdirectories through several directory commands and what is
called a pathname.
In this section we'll look at the DOS commands for manipulating subdirectories and how we
can set an environment variable (PATH) to allow DOS to find programs.
The DOS directory structure can be thought of as a tree, with the master disk directory being
called the  rootand subdirectories thought of as branches. The root is the hard disk's master
directory. It may contain up to 512 entries. Subdirectories may contain any number of entries (until  the disk is full). A floppy root directory may contain 112 or 224 entries. A typical tree might look
like...



In the example there are five files and two subdirectories in the root. Each of the
subdirectories has similar contents. SubDir1, for example, has three files and one subdirectory in it.
This structure can be extended until the disk is completely full, subject only to the constraint of 63
characters for the pathname that you will use to find a particular file.
The rules for a subdirectory name are just like that for filenames (eight characters followed
by a period and three character extension).
They show up in a directory listing with the designator <DIR> behind them.
Let's see now how to build a pathname.



Pathnames 


Assume the subdirectory structure (only directories are shown, not files)...



This series of subdirectories was set up to categorize  various files developed by a word
processor. Let's move in the structure:
•  \WORDPROC\LETTERS Would be the pathname from the root to subdirectory LETTERS.
•  \WORDPROC Is the pathname from root to WORDPROC.
Note that each subdirectory in the path is separated by a backslash (\). The single backslash at
the beginning of the pathname indicates the root. All pathnames must originate in either the current
directory or root.
A test -- What is the pathname from the root to the subdirectories listed below?
•  Subdirectory LETTERS
•  Subdirectory BOOK
•  Subdirectory WORDPROC
Answers...
•  \WORDPROC\LETTERS
•  \WORDPROC\BOOK
•  \WORDPROC
When DOS is booted, the root directory is automatically selected. To type a file named
MYMEMO.TXT in subdirectory MEMOS the command would be:
C:\> TYPE \WORDPROC\MEMOS\MYMEMO.TXT
\WORDPROC\MEMOS\ is the pathname that DOS would use to find the file MYMEMO.TXT and
then show it on the screen.
If you've got work to do with files in the MEMOS subdirectory, typing the complete
pathname all the time would be inefficient. Therefore, DOS gives you a method of making DOS
recognize the MEMOS directory as the default: the Change Directorycommand.
To change to the MEMOS subdirectory from the root the command would be:
C:\> CD\WORDPROC\MEMOS
If set properly (see just below) the prompt might also change to reflect the change directory
(C:\WORDPROC\MEMOS>, and a DIR command would now show the contents  of the MEMOS
subdirectory instead of the root and DOS would look for all command files in that subdirectory
instead of the root.
An easy way to keep track of where you are in the directory tree is to use the  PROMPT
command to set a prompt that shows the current directory along with the current drive. You can
easily do this by adding the line:
PROMPT $P$G
to your AUTOEXEC.BAT file.

Saturday, 5 January 2013

XCOPY

For copying multiple files the XCOPY command can be a powerful ally. As its name
implies, the command performs extended copies.
Its format (with only often-used options) is shown here:
XCOPYd1:PATH1 d2:path2 /a /m /s /v
Like the COPY command, XCOPY can take a single drive/path designator in which case
files from that destination will be copied into the current directory. Some options:
/A Copy only files with archive bit set; do not reset archive bit.
/M Copy only files with archive bit set; reset archive bit.
/S Copy subdirectories as well unless they are empty.
/V Verify copied files as they are written.
You can copy an entire hard disk to another disk with a single command:
XCOPY C: D: /S
The contents of drive C: will be copied to drive D: a file at  a time, with the subdirectory
structure intact.
You can use the same technique to back up a hard disk to a removabledisk (e.g., Bernoulli
or other removable media - don't use floppies). Note the /M optionabove. When DOS writes a file
to the disk it sets an archive bit in the disk directory to indicate the file has been somehow changed
(it's possible to write a file and not change it but DOS just assumes changes were made). The /M
option for XCOPY can take advantage of this.
To proceed:
1) Make a full backup first.
Use the ~ATTRIB~ command to set all archive bits to ON:
C:\>ATTRIB +A *.* /S
Use XCOPY to copy all files and directories, turning all archive bits OFF in the process (assumes
removable media is G:):
C:\>XCOPY C:\ G: /M /S

2) On a regular basis use the XCOPY command to perform an incremental backup:

C:\>XCOPY C:\ G: /M /S

The backup on drive G: will be an image of the file and directory structure on drive C:. The
incremental backup makes certain the image is current.
Periodically, in order to purge deleted files from the backup  you should start over at #1
above and a clean backup disk. 


Typing a File

Any text file saved in ASCII character format can be easily seen on your video display. Use
the type command:
TYPE d:FILE NAME.ext
All characters in the file will be displayed on the screen, including any control characters,
sometimes resulting in interesting displays.
Any control-I characters found will be interpreted as a tab, and spaces will be added to get
the cursor over to the next 8-character boundary; some output may appear as tables. Control-Z will
cause output to stop.
Attempting to TYPE a .COM or .EXE file will result in garbage on the screen, and should
generally be avoided.

Copying Files

The COPY command is a very powerful command within DOS. With it you can create
duplicates of individual files, join several files into one, and even use your computer like a simple
typewriter by "copying" from the device named CON: to the device named PRN (inefficient, but
OK for short notes).
Copying one file to another (copies from filename1 to filename2):
COPYd1:FILENAME1.ext d2:filename2.ext/v
/v option verifies the copy as it takes place. This adds confidence at the price of slower operation.
There are other options not shown here. Wildcards are allowed.
For example,
C:\>COPY ADDRS.LST B: Copies the single file ADDRS.LST from C: to B:.
C:\>COPY *.* B:/VCopies all files on C: to the disk in B: and verifies the information is it is being
written.
C:\>COPY ADDRS.LST Yields an error message. Can't copy a file to itself.
C:\>COPY B:*.*Copies all files from drive B: to drive C:. (If a destination is not specified, the
default drive and directory is used.)
Copy can also be used to concatenate (join) several files by using the following form:
COPYd1:FILENAME1.ext+d2:FILENAME2.ext+... d0:filename0.ext/v
The options are the same as the previous version of the copy command.
All specified file names (#1, #2, etc.) will be copied and joined into filename0. If no filename0 is
specified, the first source file named will be used.
Wildcards are dangerous with this command. 

Example:
Contents of FILE1:This is file number one
Contents of FILE2:This is file number two
C:\>COPY FILE1+FILE2 FILE3
Contents of FILE3: This is file number one This is file number two
The COPY command can be used to create text files by copying from device CON: to a file.
The procedure is outlined in the text of the example below.
C:\>COPY CON: TEXT FILE
This is the text to go into the text file being created. Each line is typed to the screen and it is
being saved into a buffer for later transfer to the file TEXT FILE. Each line may be corrected as it is
typed, but cannot be changed after it is terminated by the carriage return. Also, if you happen to
type beyond column 80 on the screen, you cannot correct anything on the line above. Each line
must be terminated by a carriage return (the enter key). You  signal you are finished by typing a
Control-Z, the symbol for end-of-file, followed by Return. ^Z
1 File(s) copied

Checking the Disk

Now and again it is useful to check the integrity of the disk directory and file allocation
table (FAT). The FAT is so important to the disk that there are two copies of it on each disk.
The CHKDSK program does this for you. The basic format is:
CHKDSK d: file name.ext /f /v
Using the file name causes it to be checked for continuity (i.e.,  being stored on contiguous
sectors on the disk for more efficient access).
•  /f tells DOS to automatically fix the FAT and other problems
•  /v is a verbose mode that shows progress as disk checking is taking place
Example:



Only use the version of CHKDSK that came with your version of of DOS. Crossing versions can
cause great damage to a disk.


Backing Up a Floppy Disk

Floppy disks wear out after several hundred spin hours. Well before  then you should have
made a copy of the disk to preserve the integrity of its contents. You can, of course FORMAT and
then COPY*.* to accomplish this. There is a quicker way however:
DISKCOPYd1: d2:
If you do not give drive specifications, the utility will ask for them.
All information on the target disk will be destroyed, and DISK COPY will format the target
if it is found blank. Be careful, it's easy to destroy data by putting the disks in backwards!


Problem : Copy disk A: to B:. Issue the proper command.
Answer
: C:\>DISKCOPY A: B: 



Erasing Files

Files you no longer need should be deleted from your disk to make room for more current
files. Use the ERASE (DEL etc) command for this:
ERASE d:FILE NAME.ext
or
DEL d:FILE NAME.ext
Be careful, typographic errors in this command can bring disaster!
You are allowed to delete all files on a disk with the wildcard *  (ERASE *.*), but DOS will
question you.
Recovery BEFORE writing anything else to disk is possible. An UN DELETE utility started
shipping with DOS 5.0. Before that commercial utilities were available.



Renaming Files 

For whatever reason, you may need to change the name of a file on your disk. (Usually this
is the case when you want to change a backup file to another name  in order to return it to active
status.)
Use this format:
REN d:OLD NAME.ext NEW NAME.ext
Wildcards are allowed, but can cause trouble if you are not careful.
The rename command will give you an error message if NEW NAME exists.

Friday, 4 January 2013

Command Syntax

Each DOS command has a mandatory part and some have an optional part. Presented here,
the mandatory parts will be shown in  bold CAPITAL LETTERS and the optional parts in lower
case.
For example,

DIR d:pathname\filename.ext /p /w
is the complete command for a disk directory. Note that only DIR is necessary.
You may note the term path name in the above command. The path name is the full
descriptive name to any location on the disk. It includes the names of all directories (see
sub directories later in this section).
In some commands you may use wildcards. A wildcard, like the joker in a card deck, can
stand for any character or group of characters.
The ? represents any single character:
FILE? = FILE1 or FILED etc.
The * represents any group of characters:
*.* = Any file and extension
Use caution with wildcards. They can be dangerous with commands that do things like erase
files. Also, in some cases a wildcard formulation can be misleading. The combination
AP*EX.COM does not mean all files that start with AP and end with EX in their root name and
with a COM extension. It means all files starting with AP  and having an extension of COM. The
EX is meaningless as it is ignored because of the asterisk.

Disk Directory

To see a listing of what is on a disk, issue the DIRectory command.
It comes with several options (shown are the most useful, not all).
DIR d:filename.ext /p /w
DIR alone will show the complete directory. With the optional file name, DIR will try to find
just that file.
•  The /p option causes a pause when the screen fills.
•  The /w option yields a full 80-column display of just the file names.
There are other options for sorting the listing and displaying the contents of lower-level directories.
Now we'll see what would happen when you type DIR at the prompt.


Note several things here.

•  DIR tells you what files are on the disk, how big they are, and when they were created.
•  DIR also tells how many files total are in the list, how much space those take and what free
space remains.

Three Simple Commands

CLS Clears the screen and puts the cursor in the home (upper left) position.
VER Shows the DOS version number on the video display. You are shown the one-digit version
and two-digit revision:
MS-DOS Version 6.00
VOL d: Displays a volume label, if one exists. The label is a name you have given to the disk when
it was formatted. It is used for identification purposes. (The serial number is put on the disk by the
FORMAT utility.)
Volume in drive C is HANDBOOK
Volume Serial Number is 2C35-16F9


Date and Time
 

These two commands show and/or set the system date and time.
Early computers relied on you to set the DOS clock during the boot process. In short order
peripheral makers came out with clock cards that, with the helpof a battery, kept a clock going and,
with the help of a program in AUTOEXEC.BAT, loaded the time into DOS for you during boot.
New computers have the clock built-in and do not require a program to load the time.
If your clock battery fails, the default values will be 1-1-80 for the date and 00:00:00.00 for
time. Now and again you will see files with a create date  of 1/1/80; they were created on a system
where the clock has failed and DOS has used its default value.
For the DATE command you can enter the date as month/day/year with hyphens or slashes,
i.e., 3/1/94 or 3-1-94 are acceptable dates.
Do not enter the day of the week, even though it shows on the screen. The computer will
calculate it for you. A two digit year assumes dates between 1980 and 1999. In 2000 you will have
to start putting in all four digits. 


The format for DATE is:

DATE <date>
On early computers the time setting required a 24-hour clock, i.e., any time after noon had to
have 12 added to it, for example 3:00 pm had to be entered as 15:00. While the TIME command
will still respond to this type of time, you may not also enter  3:00p and the computer is smart
enough to know you mean 15:00.
The format for TIME is:

TIME <time>
On most computers these commands will change the permanent clock settings as well as
changing the date/time in DOS.
Disks straight out of the package need to be formatted, that is have tracks and sectors defined so
DOS can find programs and data on the disk.
The command syntax is below (only the most useful options are shown).
FORMAT d: /s /u
where
•  d: defines the disk that will be formatted
•  /s puts the DOS system on disk to make it bootable
•  /u specifies an unconditional format (can't unformat the disk)
An example:

Problem :Format the disk in drive A: without UNFORMAT information.
Answer :The proper command is:
C>FORMAT A: /U 



In order, you are asked to confirm a disk is present for formatting, then told to what capacity
the disk will be formatted (press Control-C to stop the format if this is not correct), then you are
given a report on format progress. At the end you are asked for a volume label (optional) and then
given a report on the success of the format in terms of the number of bytes on the disk. A serial
number is assigned by DOS. It is based on system time and will likely never be the same on two
individual disks. 



Additional Comments
Some microcomputers have 1.2 megabyte 5.25" disk drives. There is the temptation to use
360 kilobyte disks in those drives; don't do it. The track width is smaller and if you then put the
360K disks into a 360K drive, they may not work properly. Likewise, you cannot use the high
density floppy disks themselves in 360K drives. The magnetic properties of the disk are such that
the 360K drives won't format them.
With the introduction of 3.5" drives, higher versions of DOS are required to correctly
support the new formats. The 3.5" drives come in two sizes: 720K and 1.4MB.
Unlike the 1.2MB/360K drives disks, it is possible to format to 720K in a 1.4MB 3.5" drive.
All you have to do is tell the FORMAT command the track/sector combination you need:
FORMATA: /F:720 (this tells DOS to format the disk in drive A: to 720K)
Not all versions of DOS support higher capacity disks. For example, DOS 3.2 introduced
support for 3.5-inch disks, but only at 720K format. In order to format  a 3.5-inch disk at 1.44MB
you will need DOS 3.3 or later.

Input/Output System


This most primitive of the DOS systems has two parts:

•  BIOS (Basic Input/Output System).These are the fundamental routines that control the
keyboard, video display and other peripherals. The BIOS is comprised of a ROM on the
computer's main circuit board and the file IBMBIO.COM (or IO.SYS), one of the two
hidden files on your disk.
•  Operating System.This is the main file-handling system for the computer. Actually, two
systems exist: one for disk-based files and one for non-disk peripheral devices. They are in
hidden file IBMDOS.COM (or MSDOS.SYS). (IBMBIO and IBMDOS areIBM names;
MS-DOS uses IO.SYS and MSDOS.SYS.)
The two systems are necessary because non-disk peripherals demand their data as strings of
characters, while disks move information in large groups, known as blocks.

Command Processor

The command processor (COMMAND.COM on your disk) performs three tasks:

•  It handles critical interrupts...that is, COMMAND.COM takes care of all demands for
attention by parts of the computer. The user typing the Control-Break program break
command is an example of an interrupt.
•  It handles critical errors...that is, COMMAND.COM takes care of problems. For example,
if you leave the disk drive door open during a disk operation COMMAND.COM is
responsible for the error message you will see.
•  It performs end-of-program housekeeping...that is, COMMAND.COM takes care of
making the computer's memory available for other programs and reloading parts of itself if
the program wrote over them.
COMMAND.COM also places the C> prompt on the screen and interprets any command(s) you
might type. In short, the command processor tells the rest of DOS what to do.
Everything that DOS interacts with has a name and the names have  certain rules that have to be
followed. Let's look at some of them.

Default Drive

The default drive is the first disk drive on which DOS will look fora program if no drive
specification is given with the file name.
How do you know what it is? Look at the prompt. The default drive letter is part of the
prompt (unless someone has changed the prompt to eliminate it).
A:\> indicates that drive A (the left or top drive in a two-drive system) is the default drive. The right
(or second) drive in such a system is called drive B and the first hard disk in any system is given the
letter C as its drive designation.
DOS supports many more than drives A through C. In fact, if your computer has them you
can specify up to 63 drive names. (This is a "Catch 22" situation. DOS can respond to 63
drive names but converts all lower case to upper case automatically so you really can't
access 63 devices.) You change drives by typing the desired default  drive followed by a
colon at the prompt. To change to drive C type C: as shown here:


Device Names

Character oriented devices can be addressed by DOS through their names:
•  CON:The name for the video display and keyboard.
•  AUX: or COM1:This is the first asynchronous communications port which usually has a
modem or other serial device connected to it. The second communications port is COM2:
•  PRN or LPT1:The first parallel printer port. PRN comes from printer  and LPT is an old
designator derived from line printer. A colon on PRN and all device names is optional in
later DOS versions. The second parallel port is LPT2:
•  CAS1:A holdover; this is the cassette recorder port.
•  NUL:This is a test device. Anything sent to device NUL: goes into the bit bucket (i.e., gets
thrown away).
Rules for File names
Like devices, disk files have to be identified so DOS can address them. These file names
have specific rules.
The basic form of a file name is:
File name.ext
The first part of the name to the left of the period is called the root name. The root name can
be from one to eight characters long and cannot be the same as a device name. The second part to
the right of the period is the extension. It is optional and, if used, can be one to three characters
long.
The period is used between the root name and extension and must be present if there is an
extension.
The following are legal and illegal characters in a file name:
•  Legal:A-Z 0-9 $#&@!()-{}'`_~
•  Illegal:|<>\^+=?/[]";,* plus control characters and the space
Some other operating systems allow longer file names and there are commercial utilities which
link a database of long names to your short names so you can find files by using more fully
descriptive names.
[Note: Windows allows longer file names with the space but underneath the facade the 8.3 format is
maintained.]
DOS commands are issued at the prompt C:\>. Whatever you type after that prompt that is
not in the COMMAND.COM standard library is assumed to be the name of a file on the default
disk and DOS will search for it under one of three names (in the order listed).
If you type C\:> FILE NAME
DOS will look for: FILE NAME.COM or FILE NAME.EXE or FILE NAME.BAT
The first is a command file (note the COM extension). The second is an execution file (EXE
extension). And, the third is a batch file (a series of DOS commands in a text file which you'll learn
about later in this tutorial). The first file found will be read into memory and the command
processor will start the program running.
Both .COM and .EXE files execute as programs. The difference between the two relates to
how memory is allocated and certain parameters in the computer are set.

Examples of Disk Operating Systems that were the OS itself

•  The DOS/360initial/simple operating system for the IBM System/360family of mainframe
computers (it later became DOS/VSE, and was eventually just called VSE).

•  The  DOS operating system for DEC PDP-11 minicomputers (this OS and the computers it
ran on were nearly obsolete by the time PCs became common, with various descendants and other
replacements).

•  DOSfor the IBM PC compatible platform
The best known family of operating systems named "DOS" is  that running on IBM PCs type
hardware using the Intel CPUs or their compatible cousins from  other makers. Any DOS in this
family is usually just referred to as  DOS. The original was licensed to IBM by Microsoft, and
marketed by them as  "PC-DOS". When Microsoft licenced it to other hardware manufacturers, it
was called  MS-DOS. Digital Research produced a compatible variant known as  "DR-DOS", which
was eventually taken over (after a buyout of Digital Research) by Novell. This became "Open DOS"
for a while after the relevant division of Novell was sold to Caldera International, now called SCO.
There is also a free version named "Free DOS".
DOS consists of an input/output system, a command processor and several utilities. The
utilities are individual program files found on your DOS disk. While part ofDOS, these files are not
needed often enough to make it necessary or practical to keep them in the computer's RAM all the
time. FORMAT.COM, the program that formats blank disks, is an  example of a DOS utility.
Sometimes these utilities are called external commands (as  opposed to internal commands which are included as part of the file COMMAND.COM and remain resident in memory at all times; e.g.,
DIR and COPY).
The command processor is also a file you see on the disk, but once read into the computer's
memory, it usually resides there. Some programs provide their own command processor, and there
are times when the command processor will be overwritten in memory by a program and have to be
reloaded when the program stops executing.
The input/output system consists of two files and a ROM (Read Only Memory) chip. While the two
files are on your disks and are loaded into memory when the computer starts, they are normally
hidden from your view and not available to you for changing.

Thursday, 3 January 2013

Examples of disk operating systems that were extensions to the OS

•  The  DOS operating system for the Apple Computer's Apple II family of computers. This
was the primary operating system for this family from 1979 with the introduction of the floppy disk
drive until 1983 with the introduction of  Pro DOS; many people continued using it long after that
date. Usually it was called Apple DOS to distinguish it from MS-DOS.
•  Commodore DOS, which was used by 8-bit Commodore computers. Unlike most other
DOS systems, it was integrated into the disk drives, not loaded into the computer's own memory.
•  Atari DOS, which was used by the Atari 8-bit family of computers. The Atari OS only
offered low-level disk-access, so an extra layer called DOS was booted off of a floppy that offered
higher level functions such as filesystems.
•  MSX-DOS, for the MSX computer standard. Initial version, released in 1984, was  nothing
but MS-DOS 1.0 ported to Z80; but in 1988 it evolved to version 2, offering facilities such as
sub directories, memory management and environment strings. The MSX -DOS kernel resided in
ROM (built-in on the disk controller) so basic file access capacity was available even without the
command interpreter, by using BASIC extended commands.
•  Disc Filing System(DFS) This was an optional component for the BBC Micro, offered as a
kit with a disk controller chip, a ROM chip, and a handful of logic  chips, to be installed inside the
computer. See also Advanced Disc Filing System.
•  AMSDOS, for the Amstrad CPC computers.
•  GDOS and G+DOS, for the +D and DISCiPLE disk interfaces for the ZX Spectrum.

History of DOS

In the early days of computers, there were no disk drives; delay lines, punched cards, paper
tape, magnetic tape, magnetic drums, were used instead. And in  the early days of microcomputers,
paper tape or audio cassette tape (see Kansas City standard) or nothing were used instead. In the
latter case, program and data entry was done at front panel  switches directly into memory or
through a computer terminal / keyboard, sometimes controlled by a ROM BASIC interpreter; when
power was turned off after running the program, the information so entered vanished.
Both hard disks and floppy disk drives require software to manage rapid access to block storage of
sequential and other data. When microcomputers rarely had expensive disk drives of any kind, the
necessity to have software to manage such devices (ie, the 'disk's) carried much status. To have one
or the other was a mark of distinction and prestige, and so was having the Disk sort of an Operating
System. As prices for both disk hardware and operating system software decreased, there were
many such microcomputer systems.
Mature versions of the Commodore, SWTPC, Atari and Apple home computer systems all
featured a disk operating system (actually called 'DOS' in  the case of the Commodore 64 (CBM
DOS), Atari 800 (Atari DOS), and Apple II machines (Apple DOS)), as did (at the other end of the
hardware spectrum, and much earlier) IBM's System/360, 370 and (later) 390 series of mainframes
(e.g., DOS/360:  Disk  Operating  System / 360and DOS/VSE:  Disk  Operating  System /  Virtual
Storage Extended). Most home computer DOS'es were stored on a floppy disk always to be booted
at start-up, with the notable exception of Commodore, whose DOS resided on ROM chips in the
disk drives themselves, available at power-on.
In large machines there were other disk operating systems, such as IBM's VM, DEC's RSTS
/ RT-11 / VMS / TOPS-10 / TWENEX, MIT's ITS / CTSS, Control  Data's assorted NOS variants, Harris's Vulcan, Bell Labs' Unix, and so on. In microcomputers, SWTPC's 6800 and 6809 machines
used TSC's FLEX disk operating system, Radio Shack's TRS-80machines used TRS-DOS, their
Color Computer used OS-9, and most of the Intel 8080 based machines from  IMSAI, MITS
(makers of the legendary Altair 8800), Cromemco, North Star, etc used the CP/M-80 disk operating
system. See list of operating systems.
Usually, a disk operating system was loaded from a disk. Only a very few comparable
DOSes were stored elsewhere than floppy disks; among these exceptions were the British BBC
Micro's optional Disc Filing System, DFS, offered as a kit with a disk controller chip, a ROM chip,
and a handful of logic chips, to be installed inside the computer; and Commodore's CBM DOS,
located in a ROM chip in each disk drive.

Disk operating system

Disk Operating System(specifically) and  disk operating system(generically), most often
abbreviated as DOS(not to be confused with the DOS family of disk operating systems for the IBM
PC compatible platform), refer to operating system software used in most computers that provides
the abstraction and management of secondary storage devices and the information on them (e.g.,
file systems for organizing files of all sorts). Such software is referred to as a disk operating system
when the storage devices it manages are made of rotating platters (such as hard disks or floppy
disks).
In the early days of micro computing, memory space was often limited, so the disk operating
system was an extension of the operating system. This component was only loaded if it was needed.
Otherwise, disk-access would be limited to low-level operations such as reading and writing disks
at the sector-level.
In some cases, the  disk operating system component (or even the operating system) was
known as DOS.
Sometimes, a disk operating system can refer to the entire operating system if it is loaded off
a disk and supports the abstraction and management of disk devices. An  example is DOS/360. On
the PC compatible platform, an entire family of operating systems was called DOS.

Laptop computers

A laptop computer or simply laptop (also notebook computer or notebook) is a small
personal computer designed for mobility. Usually all of the peripherals needed to operate the laptop
are built in to a single unit. Most laptops contain batteries to facilitate operation without a readily
available electrical outlet. 


Non IBM-compatible personal computers

Though many personal computers are IBM PC compatible using either Microsoft Windows
or closed and open-source Unix-likes such as Linux, a number of other personal computer types are
also popular.
A leading alternative to the IBM PC is the Apple Macintosh, a  combination of proprietary
hardware and operating system. The Macintosh orignally used the Motorola 68000 series, then
shifted to the IBM and Motorola Power PC processors.
In January 2006, Apple shifted its architecture to the same Intel chip found in IBM
compatibles, allowing their computers to run Apple's own Mac OS X as well as other IBM PC
Compatible Operating Systems.
Further PC and PW (Personal Workstation) types through time:
•  Amiga (previously produced by Commodore, now under license from Amiga Inc.) 

•  Acorn Archimedes & Risc PC
•  Atari ST
•  Be OS Be Box
•  Pegasos
•  NEC PC-9800 (At one time, in Japan)
•  NeXT workstations
•  Sun SPARC station
•  SGI workstations like the SGI Indigo and SGI Onyx
The term "personal computer" is often avoided by advocates of the  above computer systems,
ostensibly because of the association it has to the "PC" in "IBM PC".

Wednesday, 2 January 2013

Main memory

A PC's main memory place (or primary storage) is fast storage space that is directly
accessible by the CPU. It is generally used for storing relatively short-term data needed for software
execution. Main memory is usually much faster than mass storage devices like hard disks or optical
discs, but usually cannot retain data for more than a few fractions of a second without power and is
more expensive. Therefore, it is not generally suitable for long-term or archival data storage. As
with the CPU, most PCs use some form of semiconductor random access memory such as DRAM
or SRAM as their primary storage.



Hard disk drive

The disk drives use a sealed head/disk assembly (HDA) which was  first introduced by
IBM's "Winchester" disk system. The use of a sealed assembly allowed the use of positive air
pressure to drive out particles from the surface of the disk, which improves reliability.
If the mass storage controller provides for expandability, a PC may also be upgraded by the addition
of extra hard disk or optical drives. For example, DVD-ROMs, CD-ROMs, and various optical disc
recorders may all be added by the user to certain PCs. Standard internal storage device interfaces
are ATA, Serial ATA, SCSI, and CF+ Type II in 2005. 


Graphics - Video card 

The graphics card - otherwise called a graphics adapter, video adapter, or video card - processes and
renders the graphics output from the computer to the VDU or computer monitor and is an essential
part of the modern computer. On older and budget models graphics cards tended to be integrated
with the motherboard but, more commonly, they are supplied in PCI, AGP, or PCI Express format.
Graphic cards are also the most glamorized computer component as it is the component which
creates all the visual effects on the computer which is essential for playing games.

Mouse Computing



Operating a mechanical mouse (Fig. 2).
1: Moving the mouse turns the ball.
2: X and Y rollers grip the ball and transfer movement.
3: Optical encoding disks include light holes.
4: Infrared LEDs shine through the disks.
5: Sensors gather light pulses to convert to X and Y velocities.




A  mouse is a handheld pointing device for computers, being a small object fitted with one
or more buttons and shaped to sit naturally under the hand. The underside of the mouse houses a
device that detects the mouse's motion relative to the flat surface on which it moves. The mouse's
2D motion is typically translated into the motion of a pointer on the display.
It is called a mouse primarily because the cord on early models resembled the rodent's tail,
and also because the motion of the pointer on the screen can be mouse-like (Fig. 2).