G'day to all you readers who are not too proud to be seen reading the "Beginners Basics." For our heavyweight stuff this month, let's have a look at how your commands are carried out. The Command Processor This is the most visible part of your DOS Operating System. It is a program called COMMAND.COM, and was mentioned in Part 2 of this series. It presents the DOS prompt and waits for you to type your command, usually from the keyboard. When you switch on your computer, COMMAND.COM can't operate until the boot process has finished. To fully understand this, we need to look more closely at your hardware. What's hardware? The collection of electronic and electro-mechanical stuff that's cluttering your desk right now. The flashing lights and the beeping and scraping from the disk drives, that's hardware. The stuff you have to buy, after you've pirated the software from friends or from work, that's hardware. Software? That's the programs, like word processor, database or spreadsheet that you use to make the hardware do whatever it is that made you buy the computer in the first place. The Central Processing Unit (CPU) In PCs, the CPU is one large chip, containing the microprocessor. It's a black box with lots of wires coming out of its sides. In my computer, it's about 3 cm square and is labelled i486DX. That means it's one of the 486 class of processors made by Intel. Their processors started off with the 8086, then went through the 8088, 80286, 80386, 80486 to the Pentium. The preliminary digits 8 and 0 have been dropped from the name, so we talk about 386, 486 etc. Today, you wouldn't buy anything below the 486 level as a new machine, but plenty of good work is being done by 8088 processors (also known as XT) and 286 machines, also called the AT. These are generally available at bargain prices and carry enough computing power for many of us. We just have to ignore the pressure to buy the latest and best. Program languages The microprocessor alone can only carry out a few simple tasks, like adding two numbers or storing something in a particular memory location. To do useful work, it must be given a program. This is a list of instructions which the microprocessor will perform step by step, each step being one of the simple things it knows how to do. For example, if you want to multiply a number by 386, you can do it by 386 additions, addition being a much simpler task for computer hardware than multiplication. Each instruction the program passes to the CPU will be in machine language, a series of "1"s and "0"s. This is the CPU's native tongue, but it's hard for us humans to work with, so programmers mainly use "high-level languages" such as Basic, Pascal, C++ and many others. These enable programmers to write their instructions in English-like text. For example, to write "an employee's gross pay equals his working hours multiplied by the hourly rate" the C language might say gross_pay = hours * rate This the microprocessor can't understand, so a compiler program is necessary to translate this high-level language into machine language. Because the statement above represents several operations, the compiler will translate it into lots of machine language instructions. Memory in your PC Memory means the chips in which the computer stores the instructions and data you're using. Other instructions and data are stored on your hard or floppy disks, to be retrieved and stored in memory when they are needed. Disk storage is not usually classified as memory. Read Only Memory, usually called ROM, has instructions and data permanently encoded onto its chips. ROM doesn't lose its information when the computer is switched off, so it can be used for repeated tasks, such as the startup procedure. Your CPU can randomly access ROM, but can't change it. What's the use of that? Tell you later. Using RAM Random Access Memory, usually called RAM, is what most people mean when they talk of memory. You "load" your program instructions and data into RAM from a disk drive before starting work. The computer can use different sections of its RAM in any order (randomly) to store the instructions and data it's working with. RAM is used to store the results of your intermediate calculations. For example, in calculating profits from sales, your program might first calculate 20 percent of the sale price then store that value in RAM before adding it to the cost price. RAM is "volatile" and cannot be used for long-term storage, since when the computer is switched off you lose all the information. Therefore what you want to keep for another day must be "saved" or stored to hard or floppy disk before you switch off (power down is the trendy term for that). Then, at your next working session, you load the program and data back into RAM. Sounds complicated, but all you have to do is select an item from a menu or click on a Windows icon. The computer responds to the instructions it gets from the menu and that does the rest. There is also that special area called CMOS RAM, used to contain the setup parameters of your computer. This RAM is non-volatile only because it is battery-powered, so you should have backup information for it in case of battery failure. Control circuits and buses These buses don't have wheels, they are electrical pathways along which the CPU can send its instructions. It can coordinate activity by the control bus, access a memory location by the address bus and send information via the data bus. With lots of components connected to these three buses, coordination is only achieved by everything keeping time with the system clock. This synchronises all the internal workings, but interruptions from outside, such as your pressing a key, will not be in step with the clock. To service such external events the CPU must stop what it's doing and give immediate attention to the interrupt. This is done by the interrupt controller, a special component which detects the event and informs the CPU how to deal with it. Booting your computer At power on time the computer is dead. DOS is there on hard or floppy disk, but it can't do anything yet. What we need is a heart-starter, and this is available in the BIOS (Basic Input/Output System). It lives permanently on a chip in your computer, and when you switch on, the BIOS begins the "booting" process. The first step in this is called "POST," meaning Power On Self Test. This checks that your hardware is present and in working condition. You'll see messages on the screen during the first half-minute or so telling you what's happening. You can run a Setup program during this time, but my advice to you is don't touch until you have more experience. This process of bringing the computer alive is done in stages by a series of increasingly sophisticated programs. These are called "boot" programs, a name derived from the idea of pulling yourself up by your own bootstraps. The first of these is stored permanently in ROM on the BIOS chip. The CPU is designed so that when power is first turned on it looks in ROM and executes this program. More boot programs follow, then after testing the computer's memory, track zero of the boot disk is accessed. On it is another boot program, the last of this series, which can be on either hard or floppy disk (the boot or system disk). Usually, this is found on your hard disk, but you can also boot from a floppy. The Startup files The last boot program then looks for a file called CONFIG.SYS. This is one of the two Startup Files (the other is AUTOEXEC.BAT). With a little more reading of these columns, you should be able to modify both of these files. That will make your computer operate in just the way you want it to. CONFIG.SYS is read only once at startup. Please note, therefore, if you change CONFIG.SYS, you must restart (reboot) the computer for the changes to take effect. There are fifteen commands which you are allowed to use in CONFIG.SYS, and I think we'll leave a full discussion till next month. With setup completed, the boot program loads from the disk and turns over control to COMMAND.COM, the command interpreter file. COMMAND.COM then searches the root directory of the boot disk for the file called AUTOEXEC.BAT. If it finds it, each line of the file is executed successively as a series of DOS commands. This special startup file allows you to tailor the startup configuration (read what programs are loaded) of your PC to meet your specific needs. For example, if you rarely use anything other than your database, AUTOEXEC.BAT allows you to have the PC bring up the opening screen of that program, bypassing the more boring DOS shells that most of us suffer. You can change many other things too, such as colours, but wait till next month for a full discussion on these startup files. Practical work section At last, I hear you say. I've made you wade through a fair amount of high-powered stuff this month, but think of how much you've learned. Now you can have a play! Let's look at a very useful DOS feature, MS-DOS Editor. Next month we'll look at actually modifying some of your files. We'll need the Editor program for that, so here's an introduction to it. MS-DOS Editor First we need a file for you to work on. It needs to be a text file, that is plain (?) English. It needs to be a file not essential to any of your operations. A good suggestion would be a README.1ST file from a Shareware floppy you didn't use. If you don't have one of those, you'll have to copy a file you are using to a different filename (leaving the original file intact). There's a small snag here (isn't there always?) To use MS-DOS Editor (we'll just call it the Editor now), you need the file QBASIC.EXE to be in the same directory as the file EDIT.COM. I found both of these already in my DOS directory and you should also. Use the DIR command to check. If not, you may have to copy them from your original DOS disks. Starting the Editor Two ways. One, if you're at the DOS prompt (command prompt it's called in DOS 5 manual), then type EDIT. You'll see a screen like Figure 1. To get some information about the Editor, press Enter. To start work, press Esc, and you'll see an empty window on your screen. Type the text you're going to work on into that window. Try it now, any old text will do (Mary had a little lamb?). To see how it all works, use these keyboard combinations. You can also use your mouse to move the cursor.
If you're going to edit a file called README, then type EDIT README (capital letters not necessary) and press Enter at the DOS prompt. The Editor will start up with README loaded and on screen. If you already have the Editor running, as above, then you'll need to use the "File to Edit" box (see below). Second way, if you have DOS Shell when you start up, you can double-click Editor in the Main group. You'll get a "File to Edit" box in which you can type the name of your README file. Don't forget to specify the Path so DOS can find it. So now you can edit the file which you have on your screen. Mind you, the Editor is no word processor, but you can do basic things. Cut and Paste takes a block of text and moves it somewhere else You can copy, print and find and replace. Using the Editor Across the top of your screen with your file (or part of it) displayed you'll find a Menu Bar. Try selecting a menu, either by clicking on it or by pressing Alt. This highlights the first menu name (File). Enter will show you the menu and the left or right arrows will move to other menus. There are only four of them, and not many choices in each. Ron retires to the rear Now, this is supposed to be your practical work session. I'm not going to do the work. Yes, you guessed it, you're on stage here, Ron's backstage offering suggestions. Start with your file displayed on screen. Press Alt or click on File and save your file under the name of TRIPE.TXT. From now on you'll work on TRIPE.TXT, leaving your original file safely hidden under its own name. Next, use the Edit menu to cut and copy a block of text from TRIPE.TXT and paste it to the end of that file. Don't like the result? Delete the new block and you're back to square one. How do you do this? I'm not telling, it's your practical work session and you learn by doing. If you're stuck
Ron reappears from the scenery Well, there you go for this month. With the little piece on the MS-DOS Editor, aided of course by your manual, you've found a working knowledge of a new program. This is going to be useful for you, since the Editor is a text editor. That means plain unadulterated English, with no formatting bits added as word processors usually do. This is an ASCII file which can be handled by any other program or peripheral device (read Printer). If you use the TYPE command - TYPE TRIPE.TXT - you will only get plain English on screen if the file is in ASCII form. What's ASCII? American Standard Code for Information Interchange. If your file is in WordPerfect or other word processor format, you'll get gobbledegook from the TYPE command. Next month we're going to need some of these ASCII text files, so back you go and finish your practical work session. Till next month . . . Reprinted from the April 1995 issue of PC Update, the magazine of Melbourne PC User Group, Australia |