There was an article in my Sunday newspaper the other day about some scientist who was warning us that if we are not careful the robots will take over and wipe us out. What made this bloke different from most others was that he was a researcher in cybernetics. My first reaction was pretty much along the same lines as the bowl of petunias in the Hitchhikers Guide to the Galaxy, “Oh No - Not again!” But then I read the article and the scientist in question did have a reasonable argument. Basically he saying that any robot we create will almost certainly be designed to act and feel just like humans. Now consider how we humans treat other animals. Would highly intelligent robots treat us any differently?

For a few minutes I was almost convinced by his argument, but then I realised there were a couple of flaws in it.

First it assumes that the ability to perform complex calculations equates to intelligence. This, in my opinion, is just not true. Intelligence requires some form of self awareness. You must be capable of knowing that you exist, a machine is not capable of this. Now while it may well be that a sufficiently complex computer will become aware of its own existence I suspect that there is more to it than that.

The second flaw is the assumption that all Intelligence is the same. That is any creature which is intelligent will be able to understand any other. But is this true? A number of people think that dolphins are highly intelligent creatures but we have very little idea of how they think or how they view the world. In fact is quite possible that we might have already met intelligent creatures and not even noticed it! If I may mention the Hitchhikers Guide to the Galaxy again, in that Humans were in fact only the third most intelligent beings on Earth.

Of course the above two arguments are exactly that - arguments. And I suspect that a large number of people reading this will be thinking what a lot of rubbish I'm talking :-)

But I have a third reason for not worrying about super intelligent robots taking over.

Humans have been around for a very long time and have had machines of one sort or another for a few thousand years. And yet we still can't make a reliable one :-) And when it comes to computers - well, just look at what happens when you load a new piece of software. As for hardware, the chance of adding a new bit and getting it to work without spending several hours on it is pretty low :-)

Nope - any super intelligent robots will be far to busy repairing them selves and/or adding the latest all singing all dancing gizmo to ever have time to take over the world.

”But why is so difficult to add new hardware? And what can I do to make it easier?”

I'm glad you asked - cos that's what I want to talk about this time.

Adding New Bits

The real problem with adding new hardware to a PC is down to the basic design of the PC. In order to explain what I mean I will have to describe how a PC works. I'll keep it simple otherwise I'll get lost :-)

As you know a PC consists of a number of parts. The obvious ones being the keyboard, the VDU, the floppy diskette drive and the hard drive. The other bits you will have heard off are the RAM and the CPU.

”So how do all these bits fit together?”

Well - the bit that does all the work [well most of it anyway] is the CPU or Central Processing Unit. This basically takes input from, for example a program, or the keyboard, or memory or what ever, process it and passes it to the output. The output can be the VDU, or a printer, or a sound card, or a modem, or memory or... well you get the idea.

The problem the CPU has is knowing where the input is to come from. Now in some cases it is obvious. For example a program might be adding two numbers. In this case the numbers are probably in known memory locations and the CPU can easily find them. But, supposing you decide to interrupt the program by pressing ctrl-break? How does the CPU know that you have pressed some keys?

Well, when a piece of hardware, such as the keyboard, mouse, disk controller etc. needs to take over the CPU it issues an Interrupt which is abbreviated to IRQ and the CPU then knows that it has to stop what it is doing and deal with this.

”But what happens if two things issue an IRQ?”

Well, what actually happens when an IRQ is issued is that a 'line' is set high. That is a voltage is applied to one of the pins on the Programmable Interrupt Controller or PIC for short. The thing is the PIC detects the change in voltage rather than the fact that the voltage is there. To use a bit of jargon it is ”edge triggered” rather than ”level triggered”. One of the consequences of this is that if two things try and set the same line high the PIC will only see one of them, the first.

”OK, so give everything its own line.”

Good idea. The trouble is the PIC only has 8.

”Hang on a minute. If I enter the command MSD and look at the IRQ Status it tells me there are 16. Try it for yourself.”

Yes that's true. It was realised quite early on that 8 IRQs were not enough so a second PIC was added. The second PIC is activated if IRQ 2 is set. To put it another way to use IRQ 8 to 15 you also have to use IRQ 2.

”Well I only have 8 slots so 16 IRQs are plenty. Aren't they?”

Unfortunately not. The thing is that a lot of the IRQs are used by hardware already installed such as the hard disk. The full list is:-

 IRQ     Use   Port (in hexadecimal)
  0 Timer Click 040 - 043
  1 Keyboard 060 - 063
  2 Second PIC 020 - 021
  3 Com2: and Com4: Com2 = 2f8 - 2ff,
Com4 = 2e8 - 2ef
  4 Com1: and Com3: Com1 = 3f8 - 3ff,
Com3 = 3e8 - 3ef
  5 LPT2: 278 - 27f
  6 Floppy Diskette 3f0 - 3f7h
  7 LPT1: 378 - 37f
  8 Real Time Clock  
  9 Redirected IRQ 2  
 13 Math Co-Processor  
 14 Fixed Disk 320 - 32f

As you can see from the above table a lot of the 16 IRQs are already in use. Mind you, it is possible to re-use some of the used IRQs. For example, if you only have 1 printer, you can safely use IRQ 5 for something else.

”Well, I've got 5 spare IRQs, so all I have do to is put in a new card set the IRQ to one of the spare ones and everything will work wonderfully”

Unfortunately, it's not quite that simple. The IRQ just tells the CPU that something wants to talk to it, but not what. Actually the CPU doesn't really care what is interrupting it, but it does need to have a way to talk to it. In order to make this simple the CPU uses a port, which is sometimes known as an I/O Address. A port is used to establish a direct connection between the item which generated the interrupt and the CPU. The ports are very simply memory address in the range 000h to 3ffh. [The little 'h' by the way indicates that the number is hexadecimal. Don't worry if you don't understand hex, it's not actually necessary.]

So in order to install a card you need to give it both and IRQ and a Port, which are not in use by anything else. Often the card will be pre-set to suitable values when you buy it. But there are going to be times when you will need to change the defaults.

There are two ways of changing the defaults:-

1. Physically changing the hardware
2. Using software

The second method is the easiest, by far. Basically the hardware has registers which you can set by running a configuration program. In some cases this configuration program is supplied by the card manufacture but in some cases the configuration is automatic. For example a Plug and Play card under Windows 95 may be set up automatically by Windows.

But, this method can lead to you completely loosing a card. I have known occasions when a card has been set to the wrong values and on re-booting the PC the card is not seen by the PC or by the configuration software. :-( This makes it rather difficult to change the values. I should, however, point out that well written configuration software will not allow this to happen.

The first method is much more fiddley and is rarely used on modern cards. There are two ways of making physical changes, dip switches and jumpers. Dip switches are basically little switches which can be used to turn options on and off. A bit like a light switch. Jumpers perform a similar function but work by linking two pins with a small block which has two holes in it. Incidentally technically it is the block which is the jumper.

This method has the advantage that you cannot 'loose' the card. If it doesn't work just reset the jumpers or dip switches. However, if you are not sure which settings are best it is very time consuming, since you have to take your machine apart every time you want to make a change.

”So how does all that help to add new hardware?”

I'm glad you asked that. The most important thing is to write down what hardware you have and which IRQ and port address is assigned to each. Then when you add a new card you will know which ones are free. Easy isn't it :-)