BASICS of PC HARDWARE, SOFTWARE,
and the TURBO 7.0 ENVIRONMENT

PC Hardware

Input Device
keyboard, mouse (pointing device), secondary storage device like diskette or hard disk

Output Device
monitor (video display terminal or VDT), printer, secondary storage device

Main memory
Used to store information in the computer when a program is running. Also called "on-line" memory. Each memory location is called a word and each word consists of individual cells called bits. Each bit can hold only a 0 or a 1 ("off" vs "on"). A bit is the smallest unit of information which can be stored and processed by the computer. Typically, 8 bits form one byte, and each computer word consists of 2 to 4 bytes. Thus current PCs use 16 or 32 bits per word. A typical PC today will have on-line memory of 4 to 32 megabytes (1 megabyte (MB) = 1,048,576 bytes).

Secondary memory
Also called "off-line" memory, secondary storage is a device which holds information in a form readable by the computer (such information is read and copied into the computer's on-line memory and visa-versa). Common devices today are 3.5" HD = high density diskettes (holding 1.44MB) which are convenient and portable (but slow and limited in storage), CD-ROM (holding 600+ MB) which hold tremendous amounts of information in a convenient package (but are somewhat slow and cannot have information written on them), and fixed hard drives (containing well over 1,024 MB = 1 gigabyte) which are very fast and can hold a great deal of information (but do not have portability and are relatively expensive).

CPU
Central Processing Unit, the "brain" of the computer. Interprets instructions (also known as a "program") and data stored in main memory and performs actions dictated by the instructions. These instructions are very simple, but must be based in the CPU's native code (generically called machine code). The speed of the CPU is based on its background timing signal (measured in megahertz = MHz). The speed of the first Intel chip with powered the original IBM PC (circa 1981) measured 4.77 MHz. Most PC's today have Pentium processors with speeds of 200 MHz or higher.

Our job in this course is to design software (also known as programs) which will control the action of a computer. Usually, programs are designed to solve specific problems suggested from business, science, medicine, government--even the computer industry itself (such programs which control the computer itself are called system programs; Windows 95 is a type of system program). The Pascal programming language lets us use common English words to control a computer rather than the cryptic numeric codes of the computer's native language. Essentially, a computer must distinguish between numerical information which represent instructions and numerical information which represent data. The instructions call for the computer to take the input data, process it, and produce answers (= "output").

The Pascal environment helps keep these two types of computer information separate while at the same time making it easy to set up and use the computer's memory in the process of solving a problem. One of the ways it does this is to make available to the user two distinctly different tools: an editor and a compiler. The Turbo editor allows you to type in your program on the computer keyboard. It organizes the program for you and allows you to store it on the diskette for later use or revision. The editor lets you piece together portions of different programs (= "cut and paste"). The Pascal language itself forces you to carefully define the instructions in your program and the kind of data you will be processing. This will become very clear as we progress over the next few weeks. The compiler is a special tool which takes the program file you constructed using the editor and makes a (temporary) translation of it into the native machine code of the CPU of your computer. In the process, the compiler alerts you to any errors you have made (using memory locations which have not been defined as to name and kind, missing punctuation, or misuse of the Pascal language, a so-called syntax error). In Turbo the compiler is a "single pass" compiler, so errors are reported in sequence, not all at once. When the compiler has alerted you to an error, the Turbo environment allows you to correct it and then proceed as before. If all goes well, your program will compile correctly. The Turbo environment will then allow you to "run" the program, whereby you can check to see if the output results are what you expected (sometimes, this is not at all obvious!). If the output results are not satisfactory, you then return to the editor to make further changes, recompile the updated code, check the output, either returning for more refinements or accepting the output as correct.

First, you must purchase a number of 3.5" HD diskettes (four or so should be sufficient). Go to the computer lab in McGraw or Anderson Library and format the diskettes (follow the menu system, and make sure that you use your last name when prompted for a label during the format process). The Disk Operating System (DOS) of all PCs stores information on a diskette in files. To the computer, a file is an organized collection of data. The computer knows where to find a file on a diskette by consulting the directory of the diskette which lists all the important information about each file in a special area on the diskette. Each file is named and the file's name is stored in the directory. When you use Turbo Pascal, you must, therefore, name each program file you construct. The name of a file in DOS has two parts: an eight character filename (8 characters maximum) and a three character filetype; these two segments of a file name are separated by a period (called "dot"). The filetype of Pascal program files is always PAS. Typical program file names you will deal with in this course are:

     PROG_01.PAS    (a Pascal program file)
     TEST.DAT       (an input data file, used by a program to obtain output)
     RESULTS.OUT    (an output text file, usually created by a program)
Use only alphanumeric characters in your file names (A, B, ..., Z, 0, 1, 2, ..., 9); upper and lower case letters in file names are the same as far as DOS is concerned. The operating system keeps track of the secondary storage device you are using (called the default drive). In the Labs, this should always be a diskette drive called A: (there may be some special instances when it will be called B:). Notice that the colon (:) is a required part of this designation. When the default drive is drive A: and your diskette is in that drive, all your Pascal programs will be saved (or retrieved) from your storage diskette. To make a backup copy of your diskette, find a PC with two high density 3«" diskette drives. From the file menu, exit to DOS. Put the diskette you wish to copy in drive A: and a blank diskette in drive B: and use the command DISKCOPY A: B: (this will copy everything on drive A: to drive B:). This is the easy way to copy entire diskettes, but there is an also an easy way to copy just a single file while you are in the Turbo Editor. We will see how that works during in- class demos. Remember, YOU are responsible for making adequate backup copies of all your programs! Do NOT assume that lightening always strikes the "other guy."


Back to: [Home Page]