The first video, LRC01A described the LRC (fictitious) computer, some of it’s language commands, the fetch-decode-execute cycle, a simple, add-two numbers program, and a homework problem to add 3 numbers.
The LRC computer uses decimal numbers. That’s one fiction. Current computers use binary numbers. I’ll put up a video explaining how number systems work, but that is not necessary to know now to understand the basics of a computers functionality. Sure, I could do it in binary, but the input command, 901 is easier to remember than 100100000001. In my example we added 32 and 5 to get 37. That would be 100000 + 101 = 100101. A bit hard on our eyes, but not for any computer’s!
I won’t repeat the old joke (out loud, anyway) “There are 10 kinds of folks in the world. Those that understand binary and those that don’t.” 🙂
As you’ll see in this second video, things get tedious very quickly with machine language (even using decimal numbers). Because ultimately we’ll be dealing with computers that control and interact with robots (or any physical machine), it’s important to understand how the computer works.
You won’t be exposed to much machine language. You’ll not need it unless you get involved with the nitty gritty — which you may never, and if you do, can learn the specifics then. Any computer that you come across will have lots of registers, commands, but will have the same kinds of tasks to perform.
Summary: from the first video, LRC01A, you should now know the following items:
- Have a mental picture (you drew it!) of a room with a little robot that runs around following commands.
- The commands, 901 ,902, 3xx, 5xx, 1xx of this computer’s (machine) language,
- How the program to add 2 numbers works.
- How the robots fetch, decode, execute cycle works.
- Hopefully, how to write a program to add 3 numbers.
- Maybe wonder why there aren’t commands to get inputs directly into the mail boxes (without going through th A register) or being able to do some calculations directly on the numbers in the mail boxes.
- I didn’t talk about that last point much. It is certainly possible to wire up a computer to do that, but it gets very complicated and making the A register the conduit greatly simplifies the circuitry — at the expense of more steps in the program.
- However, computers are so fast that the “extra” steps cost little. There are also some time advantages in modern computers with their many registers because many fetch, decode, and execute operations can be done in parallel. But that’s a another story.
For this video LRC02, here’s what I’ll cover:
- How the simulator (on the internet) at www.peterhigginson.co.uk/LMC works.
- The rest of the machine language commands.
- The 3 number add program.
- Generalize to add more numbers using a loop.
- Code for “add numbers until a zero input”.
- Assembly language to make life easier (for us).
The plan will be to go from the LRC construct to general purpose graphical and higher level textual languages that work on our modern computers. My method will be to expose you to many problems. Some we’ll solve together, some on your own. The only way to learn these languages is to write programs and get them to work. Step at a time. Been in the software biz for a long time. I won’t mislead you.
After awhile I’ll introduce you to some simple robots (Sphero, Lego MindStorms, GoPiGo, etc.) You’ll then experience the fun (and frustration!) of working with objects not on a screen.
They’ll be some side trips along the way, but the internet is a very rich source of information. If one of my explanations is not your cup-of-tea, then I bet that you can find one more to your liking by searching (googling?).
It’s all about self-learning. That’s what actually happens anyway. Even if you are exposed to the best teachers in the world you have to do the learning part — alone! (horse to water and all…)
Learn the fundamentals and then you can take off!
Here’s the second video, LMC02 (Will change to LRC02 soon)
Also follows LRC2A-S, a description of the simulator on YouTube. Go to the simulator and put in your own programs. If this is all new to you, just hang in there. Just using numbers to program is like going to a foreign country hearing the language for the first time. Easy to make mistakes.
That will change soon — it will get easier.