Computer with Input and Output
Inputs and outputs have been added to the computer above in place of two memory latches. When data is written to (copied to) 'output latch 1111,' then each loop, O3, O2, O1, and O0, will turn on its light if a 1 is stored in the loop. When data is read from (copied from) input 'latch' 1110 (It's not really a latch because it doesn't have loops.), then a 1 will be copied from key I3 if key I3 is pressed. If key 3 is not pressed, then a 0 is copied from I3. I2, I1, and I0 work similarly.
For example, the following one-instruction program (for the four-bit computer above) copies data from address (input 'latch') 1110 to address (output latch) 1111 over and over again. Therefore, when the program is running, pressing key I3 turns on light O3, pressing key I2 turns on light O2, pressing key I1 turns on light O1, and pressing key I0 turns on light O0.
label address data comment start 0000 0100 start at 0100 instr_1 0100 1110 from inputs 0101 1111 to outputs 0110 1111 copy all bits 0111 0100 repeat this instruction, no rotate
The keys PP, A3, A2, …D0 along the bottom of the computer diagrammed above allow you to control the computer. You can write to memory, start the processor, stop the processor, and read the results from memory. These keys are, together, called the control panel. A control panel controlled early computers. However, today a keyboard controls a computer. A keyboard is a lot of keys similar to the input keys. The computer runs a program that checks for key presses and reacts accordingly. That program is called an operating system. A joystick may control a game computer. Inside a typical joystick are keys that the joystick bumps into. Those keys and the keys under the joystick's buttons are also like the input keys above. The outputs can control motors (like in a disk drive) rather than lights.
Modern computers use two types of transistors, which correspond to the two types of relays. An N-channel transistor corresponds to a normally open relay. A P-channel transistor corresponds to a normally closed relay. However, transistors have some idiosyncrasies and you can't simply replace relays with transistors to make a successful transistor-based design. It takes about twice as many transistors as relays to do something. Of course, the high speed and low cost of transistors make transistors vastly superior in spite of the extra design effort required. The millions of transistors in a modern microprocessor allow for more than one type of instruction. For example, besides, or instead of, rotate and mask, the instruction set can include add, subtract, multiply, divide, etc.
This completes the explanation of how the vast majority of computers work now. One instruction is executed at a time. In modern designs, it is common for the ensuing instruction to be started before the prior instruction finishes, so a few instructions can be executed at once. There are designs that allow many instructions to be executed at once; but such computers, though very fast, are relatively hard to program and, mainly for that reason, have not become very popular. Most such designs use many (often relatively simple) computers, each of which can execute an instruction at once, and which communicate with each other through inputs and outputs. Computers with such designs are called parallel computers and are probably what will be used in the future. For example, I have an idea for a computer that would be able to execute thousands of instructions at a time and still be programmed almost the same way as a normal computer. That will have to be the subject of another book.
Page 37 . . . Page 1