How Computers Work by Frederick Hoehn, copyright 2013, all rights reserved. Chapter 1 The first commercially available personal computer was a kit that needed to be assembled, the "Altair," that came along in 1975, after the microprocessor had been invented. It was on the cover of Popular Electronics magazine, month of January, I think. Not long afterward came the IBM Personal Computer, not a kit. Microsoft (Bill Gates) is famous for having done much of the software for the IBM personal computer. A microprocessor is an Integrated Circuit, a collection of many transistors arranged as "and gates," "or gates," inverters, registers, that together perform the functions of a computer, by decoding and executing the instructions of whatever program it is running. But there were computers before the Personal Computer, such as the ENIAC, and IBM computers for large companies, called "mainframe computers." Since those mainframe computers were so expensive that ordinary people couldn't afford them, surplus processing capacity on some of those mainframes was hired out for "timesharing." Many people would share processing time on a mainframe. You could write and execute programs in the BASIC programming language. In those timesharing days, people would use Teletype machines as computer terminals, and you could rent them. A Teletype machine was a mass of gears on shafts with clutches and springs and levers, and powered by a one quarter horsepower motor. But after the stepper motor was invented, dot-matrix printers, and simpler keyboards pretty much replaced the much more complicated Teletype machines. Now, we have laser printers, invented at PARC, Palo Alto Research Center, a subsidiary of Xerox. Before we had Integrated Circuits, which are thousands of transistors on a chip, we had transistors. Before we had transistors, we had vacuum tubes. The invention of the transistor didn't immediately put vacuum tubes out of business. That took decades to accomplish. Even today, we have some TV's that still have a Cathode Ray Tube (a picture tube, which is a vacuum tube). Some audiophiles think that vacuum tubes reproduce sound better than transistors and have the tubes in their stereos. Those early computers generally used vacuum tubes, except for some that used relays. A relay is an electromechanical device with a wire coil wound around an iron core. When current is turned on through the coil, the resulting magnetic field pulls an armature toward the coil, causing "normally open" contacts to close, completing a circuit like when someone turns on an electric lamp, at which time, the relay is said to be "energized." When the current through the coil is shut off, an attached spring pulls the armature back to the de-energized position. Because relays are electromechanical devices, computers based on relays necessarily operated more slowly than computers that were strictly electronic. Interestingly, one of the things that used to happen with relay computers was that moths would get in between the relay contacts, preventing the energized relay from closing its contacts. Thus began computer "bugs." "...where moth and rust doth corrupt." (Matt 6:19) But these days, a "bug" usually means something wrong with the software program, causing the program to malfunction. Computer software is the programs written for computers. Computer hardware means the electronic components in the computer, the microprocessor and other integrated circuit chips, the resistors, the capacitors, the printed circuit board on which the components are mounted, etc. It's called a printed circuit board because the design for the copper connections is transferred to the board by a printing process called silk screening. The plastic board is originally covered with a coating of copper metal. A substance that resists acid is applied to the areas of the copper that are to be retained. Then the excess metal that is not part of the desired pattern is etched away with acid, leaving the desired connections from point to point with the remaining copper. Whether relays, or vacuum tubes, or transistors, they all lent themselves to the "and gates," "or gates," and other "logic curcuits" needed to function as a computer. Vacuum tube computers switched faster than relay computers, but the vacuum tubes generated a lot of heat, and kept "burning out," requiring that they be replaced, back in those days when there was very little air conditioning. Some of those old computers were as large as a bedroom. There were some IBM computers that were used in the development of the atomic bomb at Los Alamos, New Mexico. Intel Corp. was one of the early Integrated Circuit chip manufacturers. Their specialty was memory chips. But a Japanese company named Busicom contacted Intel about making a set of chips for them to put into the electronic calculators that they wanted to manufacture. An Engineer at Intel decided that the best way to fill that order was to make a microprocessor, which became the Intel 4004, a four bit chip. A bit is a binary digit. It can have the numerical value of either a 1 or a 0 at any given time. It will have both ones and zeroes as data is moving through the microprocessor. A byte is eight bits. A kilobyte is a thousand bytes. A megabyte is a million bytes. A gigabyte is a billion bytes. If you buy an IPOD, it is rated in how many gigabytes (GB) of storage it has. Many gigabytes means it will hold many songs. Modern computers are "digital" not analog. An example of analog circuitry would be your stereo amplifier that reproduces music. It must handle a range of voltages from perhaps zero to fifty volts, D.C. (direct current, as opposed A.C., alternating current, like you have at the wall outlets at your residence). But digital circuits handle only two levels of voltage, not a range of voltages. The circuit is either on or off, high or low, a 1 or a 0, except when it is switching from one state to the other. It's a more reliable way of processing numerical data than trying to do so with an analog computer. Computers use the binary number system, which consists of only 1's and 0's. The number ten in the decimal number system would be 1010 in the binary number system. The number fifteen would be 1111. The microprocessor has some registers. The Intel 4004 had some four bit registers. A four bit register holds four bits of data, 1's and 0's. You can take the contents of one register and add it to the contents of another register. You might have an overflow, called a carry bit. To process the data that it processes, a microprocessor has an instruction set. The instruction set is the instructions that the microprocessor was designed to be able to execute. It can add. It can subtract. It can shift data to the left or to the right. It can load registers with data. It can store the contents of registers in memory. Today's microprocessors can do floating point math, (engineering and scientific math.) The early microprocessors did simple integer (whole number) math. Chapter 2 A series of instructions written to be executed by a microprocessor is called a program. A very short program might sometimes be called an algorithm, such as an algorithm for finding the square roots of numbers. The program is stored in memory, usually external to the microprocessor. The microprocessor fetches the first instruction from the starting memory location, then decodes and executes the instruction. Then the next instruction. Some of the instructions are conditional instructions, that is, they only execute if certain conditions are met. One such conditional instruction is "Branch if carry." As a result of a previous "Add" instruction, there may or may not have been a carry bit generated, depending on what numbers were added. If there was a carry bit generated, the branch if carry instruction will cause program execution to go and continue execution at a different location in memory, where there are instructions for the microprocessor to execute to deal with that carry bit. But if there was no carry bit, then no branching, and the program execution continues with the next sequential instruction in memory. The device that keeps track of where in memory execution of the program is being performed is called the Program Counter. It holds the memory address of the next instruction to be executed after starting execution of the current instruction. The Program Counter is part of the microprocessor. That first kit computer was rather tedious for entering a program, which had to be done through toggle switches on the front panel. As a result, programs weren't very long, and not much data was processed. Some of the early programs did very little more than just make lights flash on the front panel. After a while, programs could be entered from an audio cassette player or a punched paper tape. Those early Altair personal computer programs were in "Machine Language," a series of 1's and 0's. But then, Assembly Languages were developed which allowed programmers to program using "Mnemonics," which were letter abbreviations that sounded like the instruction they were abbreviating in the instruction set. Assembly languages eliminated some of the tedium of machine language programming. To execute the program written in Assembly Language, that program was first run through a program called an "Assembler," which converted the Assembly Language program into a Machine Language program for execution by the microprocessor. An early storage device for programs and data was the floppy disk, later called the flexible disk. You put your floppy disk into the floppy disk drive, and then you could read from, or write to the floppy disk. The floppy drive caused the disk to spin at a certain speed. Data was read magnetically by a read head, or written by a write head that could move in and out toward the axis or toward the circumference of the disk. You could have a library of floppy disks with various programs and data. Another storage device was the "Hard Drive." It was like the floppy drive, but the disk wasn't removable and stored a lot more programs and data. Later came the "Optical Drive," which handled CD's and DVD’s. A compact disk can hold digital songs, or it can hold computer programs and data. Likewise for the DVD, but the DVD has a larger capacity for data than the CD. DVD stands for digital video disk. Higher level programming came with the BASIC programming language. This is the language that was built into the Timex personal computer. There was FORTRAN, COBOL, Pascal, the "C", programming language, and now there is the very powerful "C++" (C plus plus) programming language. The higher level languages are more powerful because a few lines of code in these higher level languages will replace many more lines of code in Assembly language. Therefore, they are more productive. But some assembly language programming is still done, particularly when speed of execution is important. A programmer writes "source code" in one of these higher level languages. But the source code is not executable by the computer. The source code program must be processed by a program called a Compiler that takes the source code and produces the equivalent "object code" that is executable. When you buy a computer, you don't normally get a compiler. I've written programs in C++, and I use a compiler I purchased from the Bloodshed outfit on the Internet. Don't know how they got that name, but the compiler is reasonably priced, and came in the mail on a CD-ROM. ROM is read only memory. You put the CD-ROM into your optical drive, and install the software onto your hard drive. The computer senses that there's a new disk in the optical drive, and puts information on the screen. You have the option to install the software. You accept that choice by moving the pointer on the screen to your choice using the mouse, and then clicking the left button on the mouse. It is an optical drive because it uses a beam of laser light to read the information on the disk, as opposed to the hard drive which stores the information magnetically. They now have tablet computers such as the IPAD. Those tablets don't appeal to me, as an author. I want a full size keyboard. My laptop computer has a keyboard, but instead, I use an external keyboard from Logitech. It has a cable coming out of it with a USB connector (Universal Serial Bus). You plug the USB connector into a USB port on the laptop computer. The laptop comes with a finger pad, to move the pointer around on the screen, but I use an external wireless mouse (Logitech) because it's faster and more productive, and because my external keyboard covers up the finger pad. There are no wires coming out of the mouse. It uses radio waves to communicate with the transmitter/receiver unit that is plugged into another USB port on the computer. It seems good to me not to purchase a computer that doesn't have USB ports. We now have the Internet, sometimes called the World Wide Web (WWW). Laptop computers now come equipped with WiFi (wireless Internet). If you happen to live in a building that is equipped with WiFi, you can connect to that with your computer's WiFi. Or, you could go to a coffee shop or restaurant that has WiFi, or the Public Library. There are apps available at www.play.google.com that are supposed to make an android cell phone work as a portable WiFi hot spot. There are also free videos to watch at You Tube on this subject. Android phones typically come with a charger to charge their batteries. One part of the charger has an a.c. plug to plug into your wall outlet at home or at work. Then there's a cable, one end of which plugs into your android phone, and the other end of which has a USB connector that can either plug into the charger unit, or into a USB port on your computer. That cable is used for power and for data transfers. Or, you can pay money to an Internet Service Provider for Internet service at your home. Companies like ATT or other phone companies, or Cable TV companies, or Satellite TV companies. But if your Internet connection is through your land line telephone, then typically you'll have a cable that plugs into your computer, rather than using the computer's WiFi capability. You deal with the Internet with a Browser program, such as Internet Explorer from Microsoft that comes with your Windows Operating System. Another browser is Firefox from Mozilla, downloadable for free from the Internet. You can have both Browsers, and then use whichever one is convenient. I mostly use Internet Explorer, except when I'm doing covers for my books. Firefox seems to work better for that. Software is broadly divided into two kinds: Applications (apps), and Operating Systems. When you buy a computer, it comes with an Operating System such as Windows. The O.S. makes all the components of the computer work together. The keyboard, the monitor or display screen, the internal memory, the hard drive, the optical drive, the USB ports. The apps are programs that work under the O.S., such as Word Processors, or Spreadsheets. There's a Kindle app that makes your device work like a Kindle reader so that you can buy and read ebooks from Amazon.com Go to www.Amazon.com and in the search box on the home page, type Kindle Apps Ebooks seem to be gradually replacing physical books. Some of the nation's newspapers are finding they must publish on the Internet because of this trend, as more and more people are reading e-literature and less of what's printed on paper. Accounts can be set up if you wish to subscribe to some publication on the Internet. You pay for things on the Internet with a credit card or debit card. If you have a checking account at a bank, you may already have the debit card. An alternate Operating System is the Linux operating system. For a while, it was thought that Linux might replace Windows, but that seems not to have happened. These days, floppy drives are pretty much no more, having been replace by the "flash drive," also called the "thumb drive" because they're about the size of a thumb. They have a USB connector, and storage capacities of 4, 8, 16, or 32 gigabytes (GB). If you're interesting in learning to program in C++, you could take programming classes at a community college, or at a four year college. Or, you can read books on programming, like I did. The best author of programming books that I've found, for C++, is Herbert A. Schildt. Many of the Public Libraries also have free computer classes to teach people the use of computers, and how to use the Internet. People can save on postage by sending and receiving emails on the Internet for free instead of sending letters through the postal system, and it's much faster than letters sent through the U.S. mail. There are various providers of free email accounts such as outlook.com, gmail.com, yahoo.com and others. Three of the main search engines on the Internet are Google.com, Yahoo.com, and Bing.com, if you want to find something on the Internet. But one must guard against Internet pornography, since God is against pornography, as revealed in his book, the Bible. (Matthew 5:28) ___Psalm 119 1 Blessed are the undefiled in the way, who walk in the law of the Lord. 2 Blessed are those who keep his testimonies, and that seek him with the whole heart. 3 They also don't sin, they walk in his ways. 4 You've commanded us to keep your precepts diligently. 5 O that my ways were directed to keep your statutes! 6 Then I won't be ashamed, when I have respect to all your commandments. 7 I'll praise you with uprightness of heart, when I shall have learned your righteous judgments. 8 I'll keep your statutes, O don't completely forsake me. 9 How shall a young man cleanse his way? By giving heed to your word. 10 I've sought you with my whole heart, O don't let me wander from your commandments. 11 I've hidden your word in my heart so that I won't sin against you. 12 Blessed are you, O Lord, teach me your statutes. 13 I've declared with my lips all the judgments of your mouth. 14 I've rejoiced in the way of your testimonies, as much as in all riches. 15 I'll meditate in your precepts, and have respect to your ways. 16 I'll delight myself in your statutes, I won't forget your word. 17 Deal abundantly with your servant, so I can live, and keep your word. 18 Open my eyes so that I'll see wondrous things out of your law. 19 I'm a stranger in the earth, don't hide your commandments from me. 20 My soul breaks for the longing that it has to your judgments at all times. 21 You've reprimanded the proud that are cursed, who err from your commandments. 22 Remove reproach and contempt from me, for I've kept your testimonies. 23 Princes also sat and spoke against me, but your servant meditated in your statutes. 24 Your testimonies also are my delight and my counselors. 25 My soul sticks to the dust, make me alive according to your word. 26 I've declared my ways, and you heard me, teach me your statutes. 27 Make me to understand the way of your precepts, so I shall talk of your wondrous works. 28 My soul melts for heaviness, strengthen me according to your word. 29 Remove the way of lying from me, and grant me your law graciously. 30 I've chosen the way of truth, I've laid your judgments before me. 31 I've stuck to your testimonies, O Lord, don't put me to shame. 32 I will run the way of your commandments, when you enlarge my heart. 33 Teach me, O Lord, the way of your statutes, and I'll keep it to the end. 34 Give me understanding, and I'll keep your law, yes, I'll observe it with my whole heart. 35 Make me to go in the path of your commandments, for in it I delight. 36 Incline my heart to your testimonies, and not to covetousness. 37 Turn my eyes away from seeing vanity, and make me alive in your way. 38 Establish your word to your servant, who is devoted to your fear. 39 Turn away my reproach that I fear, for your judgments are good. 40 See, I've longed after your precepts, make alive me in your righteousness. 41 Let your mercies come also to me, O Lord, your salvation, according to your word. 42 So I shall have what to answer to him that reproaches me, for I trust in your word. 43 And don't take the word of truth completely out of my mouth, for I've hoped in your judgments. 44 So I shall keep your law continually forever and always. 45 And I'll walk at liberty, for I seek your precepts. 46 I will speak of your testimonies also before kings, and won't be ashamed. 47 And I'll delight myself in your commandments that I've loved. 48 I will also lift up my hands to your commandments that I have loved, and I will meditate in your statutes. 49 Remember the word to your servant, on which you have caused me to hope. 50 This is my comfort in my affliction, for your word has made me alive. 51 The proud have had me greatly in derision, yet I haven't declined from your law. 52 I remembered your judgments of old, O Lord, and have comforted myself. 53 Horror has taken hold on me because of the wicked that forsake your law. 54 Your statutes have been my songs in the house of my pilgrimage. 55 I've remembered your name, O Lord, in the night, and have kept your law. 56 This I had, because I kept your precepts. 57 You are my portion, O Lord, I've said that I would keep your words. 58 I entreated your favor with my whole heart, be merciful to me according to your word. 59 I thought on my ways, and turned my feet to your testimonies. 60 I made haste, and didn't delay to keep your commandments. 61 The gangs of the wicked have robbed me, but I haven't forgotten your law. 62 At midnight I'll rise to give thanks to you because of your righteous judgments. 63 I'm a companion of all of those who fear you, and of those who keep your precepts. 64 The earth, O Lord, is full of your mercy, teach me your statutes. 65 You've dealt well with your servant, O Lord, according to your word. 66 Teach me good judgment and knowledge, for I've believed your commandments. 67 Before I was afflicted I went astray, but now I've kept your word. 68 You are good, and do good, teach me your statutes. 69 The proud have forged a lie against me, but I'll keep your precepts with my whole heart. 70 Their heart is as fat as grease, but I delight in your law. 71 It is good for me that I've been afflicted, so that I would learn your statutes. 72 The law of your mouth is better to me than thousands of gold and silver. 73 Your hands have made me and fashioned me, give me understanding, so I will learn your commandments. 74 Those who fear you will be glad when they see me, because I've hoped in your word. 75 I know, O Lord, that your judgments are right, and that you in faithfulness have afflicted me. 76 Please let your merciful kindness be for my comfort, according to your word to your servant. 77 Let your tender mercies come to me, so I'll live, for your law is my delight. 78 Let the proud be ashamed, for they dealt perversely with me without a reason, but I will meditate in your precepts. 79 Let those that fear you turn to me, and those that have known your testimonies. 80 Let my heart be sound in your statutes, so I'm not ashamed. 81 My soul faints for your salvation, but I hope in your word. 82 My eyes fail for your word, saying, when will you comfort me? 83 For I've become like a bottle in the smoke, yet I don't forget your statutes. 84 How many are the days of your servant? When will you execute judgment on those who persecute me? 85 The proud have dug pits for me, which are not according to your law. 86 All your commandments are faithful, they persecute me wrongfully, help me. 87 They almost consumed me on earth, but I didn't forsake your precepts. 88 Make me alive according to your loving kindness, so I'll keep the testimony of your mouth. 89 Forever, O Lord, your word is settled in heaven. 90 Your faithfulness is to all generations, you've established the earth, and it remains. 91 They continue this day according to your ordinances, for all are your servants. 92 Unless your law had been my delight, I would then have perished in my affliction. 93 I'll never forget your precepts, for with them you've made me alive. 94 I am yours, save me, for I've sought your precepts. 95 The wicked have waited for me to destroy me, but I will consider your testimonies. 96 I've seen an end of all perfection, but your commandment is very broad. 97 O how I love your law! It is my meditation all the day. 98 You, through your commandments have made me wiser than my enemies, for they are always with me. 99 I have more understanding than all my teachers, for your testimonies are my meditation. 100 I understand more than the ancients, because I keep your precepts. 101 I have refrained my feet from every evil way, so that I would keep your word. 102 I haven't departed from your judgments, for you've taught me. 103 How sweet are your words to my taste! Yes, sweeter than honey to my mouth! 104 Through your precepts I get understanding, therefore I hate every false way. 105 Your word is a lamp to my feet, and a light to my path. 106 I've sworn, and I will perform it, that I will keep your righteous judgments. 107 I am afflicted very much, make alive me, O Lord, according to your word. 108 Please accept the freewill offerings of my mouth, O Lord, and teach me your judgments. 109 My soul is continually in my hand, yet I don't forget your law. 110 The wicked have laid a trap for me, yet I didn't err from your precepts. 111 I've taken your testimonies as a heritage forever, for they are the rejoicing of my heart. 112 I have inclined my heart to perform your statutes always, even to the end. 113 I hate vain thoughts, but I love your law. 114 You are my hiding place and my shield, I hope in your word. 115 Depart from me, you evildoers, for I will keep the commandments of my God. 116 Uphold me according to your word, so I'll live, and don't let me be ashamed of my hope. 117 Hold me up, and I shall be safe, and I'll have respect to your statutes continually. 118 You've walked on all those who err from your statutes, for their deceit is falsehood. 119 You put away all the wicked of the earth like dross, therefore I love your testimonies. 120 My flesh trembles for fear of you, and I'm afraid of your judgments. 121 I've done judgment and justice, don't leave me to my oppressors. 122 Be surety for your servant for good, don't let the proud oppress me. 123 My eyes fail for your salvation, and for the word of your righteousness. 124 Deal with your servant according to your mercy, and teach me your statutes. 125 I am your servant, give me understanding, so I will know your testimonies. 126 It is time for you, Lord, to work, for they've made void your law. 127 Therefore I love your commandments more than gold, yes, more than fine gold. 128 Therefore I view all your precepts concerning all things to be right, and I hate every false way. 129 Your testimonies are wonderful, therefore my soul keeps them. 130 The entrance of your word gives light, it gives understanding to the simple. 131 I opened my mouth, and panted, for I longed for your commandments. 132 Look at me, and be merciful to me, as you used to do to those that love your name. 133 Order my steps in your word, and don't let any sin have dominion over me. 134 Deliver me from the oppression of man, so I will keep your precepts. 135 Make your face shine on your servant, and teach me your statutes. 136 Rivers of waters run down my eyes, because they don't keep your law. 137 Righteous are you, O Lord, and upright are your judgments. 138 Your testimonies that you have commanded are righteous and very faithful. 139 My zeal has consumed me, because my enemies have forgotten your words. 140 Your word is very pure, therefore your servant loves it. 141 I am small and despised, yet I don't forget your precepts. 142 Your righteousness is an everlasting righteousness, and your law is the truth. 143 Trouble and anguish have taken hold on me, yet your commandments are my delight. 144 The righteousness of your testimonies is everlasting, give me understanding, and I'll live. 145 I called with my whole heart, hear me, O Lord, I'll keep your statutes. 146 I called to you, save me, and I'll keep your testimonies. 147 I got up before the dawning of the morning, and called, I hoped in your word. 148 My eyes go before the night watches, so I can meditate on your word. 149 Hear my voice according to your loving kindness, O Lord, make me alive according to your judgment. 150 They draw near who follow after mischief, they are far from your law. 151 You are near, O Lord, and all your commandments are truth. 152 Concerning your testimonies, I have known of old that you have founded them forever. 153 Consider my affliction, and deliver me, for I do not forget your law. 154 Plead my cause, and deliver me, make me alive according to your word. 155 Salvation is far from the wicked, for they don't seek your statutes. 156 Great are your tender mercies, O Lord, make me alive according to your judgments. 157 My persecutors and my enemies are many, yet I don't decline from your testimonies. 158 I saw the transgressors, and was grieved, because they didn't keep your word. 159 Consider how I love your precepts, make alive me, O Lord, according to your loving kindness. 160 Your word is true from the beginning, and every one of your righteous judgments endures forever. 161 Princes have persecuted me without a reason, but my heart stands in awe of your word. 162 I rejoice at your word, like someone who finds great treasure. 163 I hate and abhor lying, but I love your law. 164 I praise you seven times a day because of your righteous judgments. 165 Those who love your law have great peace, and nothing shall offend them. 166 Lord, I've hoped for your salvation, and done your commandments. 167 My soul has kept your testimonies, and I love them very much. 168 I have kept your precepts and your testimonies, for all my ways are before you. 169 Let my cry come near before you, O Lord, give me understanding according to your word. 170 Let my prayer come before you, deliver me according to your word. 171 My lips shall speak praise, when you've taught me your statutes. 172 My tongue shall speak of your word, for all your commandments are righteousness. 173 Let your hand help me, for I've chosen your precepts. 174 I've longed for your salvation, O Lord, and your law is my delight. 175 Let my soul live, and it shall praise you, and let your judgments help me. 176 I've gone astray like a lost sheep, seek your servant, for I don't forget your commandments.