Learn Programming with Fun

Programming Assembly Language – Part 1

This “low level programming language” doesn’t mean it is inferior to the “high level programming language”. It does mean that this language is more abstract and harder to be understood by the programmers themselves. There are two types of low level programming language. They are the first generation which is called “machine code” and the second generation which is called “assembly language”. In this article I’ll write a simple tutorial series about the assembly language.

Chapter One

Types of Numeral System

In assembly language we will have to know about four numeral systems.
– The first one is Binary Numeral System (base 2). This one is commonly used in machine code.
– The second one is Decimal (base 10). Most people must know this type. It is usually used in our life.
– The third one is Octal (base 8)
– And the last one which is the most common type used in assembly language is Hexadecimal (base 16).

But what are they?

Here’s a little explanation.

Actually all data or program in a computer is first translated to binary. Although it is decimal, octal or even hexadecimal, they will always be translated to binary to be processed. If in decimal we use ten numbers, from 0 up to 9, in binary we only use 0’s and 1’s. Because it is base two, we can convert it into decimal by multiplying its “x” number with 2x (counted form left, starting from 0) For example we have this number (1101) in binary. And by using that method we can convert it into decimal — 1101 = (1 X 23) + (1 X 22) + (0 X 21) + (1 X 20) = 26.

Next is the decimal. I don’t think I have to explain much about decimal since we usually use it in our daily life.

Now here comes Octal. It is base eight numeral system. In decimal we use ten numbers, in binary we use two numbers then in octal we use eight numbers, from 0 up to 7. The same method, applied to convert it into decimal, multiply its “x” number with 8x (counted form left, counted from 0). For example, 12 in octal means 10 in decimal. Just try to count it with that method.

And the last and the most complicated one is Hexadecimal. Since it is base 16 then we’ll have to use 16 digits. But we only have ten numbers. So how could it be 16? The answer is simple, we’ll use the first six alphabet. So the digits will be 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F . Usually in assembly code we form it in two digits form. For example, 01,0F,2F, AF, FF. But like Decimal, we can remove the zero if it’s placed in the front. 01 = 1. We can use the same way to convert it to decimal, but we must count A as 10, B as 11, etc. Just try to convert FF to decimal. F means 15, so FF = (15 X 1611) + (15 X 160) = 255. And that is the limit for two digits hexadecimals.

This is the end of the first section. In the next section we’ll discuss more on this numeral system and move into the machine ( It’s microprocessor ).

Next section will come as soon as this writing is published.

If this guide confused you don’t hesitate to contact me.

Rclretail

View more posts from this author