What is a program? You probably already know because you most likely use them everyday. Even so, I would like to begin with a reasonable, but not too technical idea of what a program is.
Now, I'm assuming you know what a computer is. If you didn't, you wouldn't be reading this right now. We can think of programs as being magical spells. I know that sounds kind of lame but it's a good analogy. If programs are magic spells, then your spellbook must be a computer. Let's assume that you are a magician with an actual spellbook and you have 2 spells to choose from: Flame and Freeze. Classic ones, indeed. A magician who uses Flame to set something on fire will understand that the spell must work very differently from Freeze, which transforms water into ice. The same is true with computer programs. A person who starts up the program "Cave Story" will use it for a very different purpose than somebody else who starts up the program "Microsoft Word" or "Google Chrome". Each program has a specific action that it performs. Cave Story provides you with entertainment in the form of a game. Microsoft Word lets you edit documents. Google Chrome lets you view web pages on the Internet or on your harddrive. Back to the magician. Let's assume that the magician wants to do something more advanced than cast the spells Flame and Freeze. He takes a look at Freeze, designed to turn water to ice, and sees that it's not quite so useful for his purposes. Instead, he wants it to send flying shards of ice at his enemies. Suddenly this becomes a difficult problem. Not only does the magician need to understand how to generate ice, he also needs to understand how to break it into shards, how to make those shards fly, and how to make them fly fast enough to damage his enemies. The magician is no fool. He manipulates the symbols on certain pages of his spellbook. Those pages define how the spell Freeze works. By changing the symbols, erasing some, and then writing new ones, he effectively modifies how the Freeze spell works. He then renames it Ice Attack. For us, renaming a program is easy. Right click on it and then choose "rename". But modifying how it works - that will be much harder. Again, the program "Cave Story", also known as Doukutsu.exe, is like a magical spell composed of symbols. Inside the .exe file, there will be computer code: lots of it. By changing this code, we can make Cave Story act very differently, thus turning it into a more unique and exciting game. The code is called assembly code. Our goal is to learn the meaning behind the symbols - the basics of assembly language. Assembly Instructions The fundamental basis of assembly code is the instruction. Each instruction is a command that tells your computer processor what to do. Here is a good example of an instruction: ADD ECX,3This looks confusing at first, but it's actually not too bad. Pretend that ECX is a box that can hold numbers. Right now, it has a number inside it: 5. I just chose the number 5 randomly.
If ECX holds 5, then what does ADD ECX,3 do?
It's simple: ADD ECX,3 will add the number 3 to ECX . So after this command is executed by your computer, the "box" ECX will hold the number 8.
So there's your short introduction to what assembly instructions are. They are just commands that the computer will run. Don't worry, the lesson after this will have more pictures. Previous Lesson: Assumptions Next Lesson: Olly Debug Table of Contents |