You are on page 1of 4

Assembly language representation of the binary numbers inside a

computer. It uses 16 symbols

An assembly language (or assembler language) is a low-
(0,1,2,39,A,B,C,D,E,F) called hex digits
level programming language for a computer, or other
programmable device, in which there is a very strong Positional number systems
(generally one-to-one) correspondence between the
Decimal, binary and hexadecimal are all
language and the architecture's machine code
positional number systems.
In a positional number system, each position is
Assembly language is converted into executable
associated with a different weight.
machine code by a utility program referred to
as an assembler; the conversion process is Ex. In the Decimal number 25.4, the weights of
referred to as assembly, or assembling the the three positions, from right to left, are 1/10, 1, and
code. 10.
Assembly language uses a mnemonic to represent each 2 5 . 4
low-level machine instruction or operation.
10 1 1/10 weights
Wrong concepts about Assembly Language
The weight of each position determines how much the
Assembly is hard to learn. digit in that position contributes to the value of the
Assembly is hard to read and understand. number.
Assembly is hard to debug.
In a decimal number, weights increase by a
Assembly is hard to maintain.
factor of 10 from right to left from one position
Assembly language programming is time
to the next. The weight of the position to the
immediate left of the decimal point is always 1.
Today, machines are so fast that we no
Because decimal numbers have 10 symbols (0
longer need to use assembly.
to 9), and have weights that increase by a factor
Whats Right With Assembly Language? of 10, we call decimal a base 10 or radix 10
positional number system.
Speed. Assembly language programs are
generally the fastest programs around. We call the period in a number that divides the
Space. Assembly language programs are whole part from the fractional part the radix
often the smallest. point. When we are dealing with decimal
Capability. You can do things in assembly numbers, we usually call the radix point as
which are difficult or impossible in HLLs. decimal point.
Knowledge. Your knowledge of assembly While in binary and hexadecimal
language will help you write better numbers, we can similarly call the radix point the binary
programs, even when using HLLs. point and hexadecimal point, respectively.
Number Systems Binary is the base 2 positional number system.
Humans use decimal number system but computers use Thus, in the binary number 1011.1, the weights
binary. of each position increase by a factor of 2 from
right to left. As in decimal, the position to the
Decimal numbers use 10 symbols (0,1,2,39) intermediate left of the radix point has weight
called digits. 1. thus, in the binary number 1011.1, the
weights are
Binary numbers use only two symbols (0, and 1)
called bits. 1 0 1 1 . 1
A third binary system, hexadecimal (hex for 8 4 2 1 . weights (in decimal)
short) can be used as a convenient shorthand
Hexadecimal is the base 16 positional number ( 2 1) 1 = 0 complement = 0
system. For its symbols we use 0 to 9, and A to ( 16 1) 3 = C complement = C
F. the weights in a hexadecimal number
In binary, to Flip a bit means to complement it. Thus, if
increase by a factor of 16.
we flip 1, we get 0 and if flip 0 we get 1.
Ex. In the hexadecimal number 1CB.8, the
weights are: Computer circuits are designed to operate on
1 C B . 8 chunks of data of a specific length. These
256 16 1 . 1/16 weights (in chunks of data are called words.
decimal) Common word sizes for modern computers are
The leftmost position in a positional number 32 bits ( 4 bytes) and 64 bits (8 bytes)
system has the most weight, and we call the The term positive is used for a number greater
symbol in that position as the most significant than or equal to zero. But in assembly numbers
bit.(MSB) greater or equal to zero are called non-negative
On the other hand, the right most position has numbers and those lesser than zero are
the least weight, and we call it as the least negative numbers.
significant bit.(LSB) When specifying computer memory sizes we
use the prefixes kilo (K) , mega (M) and giga (G).
But the use of this prefixes is contrary to their
The complements of a symbol (s) in the base (b) usual meanings;
positional number system is the symbol whose
value is: Prefixes Decimal Actual Memory
Equivalent sizes
( b 1) s = complement Kilo 1,000 1024
For example: the complement of 3 in decimal is (thousand)
Mega 1,000,000 1,048,576
( 10 1) 3 = 6 where 10 is the base (b) and 3 (millions)
is the symbol (s) and 6 is the complement. Giga 1,000,000,000 1,073,741,824
Another examples are:

The complement of 1 in binary;

the complement of 3 in hexadecimal;

Arithmetic with Positional Numbers

The rules for performing arithmetic with positional numbers are essentially the same for all bases.

In addition, whenever a column sum is greater than or equal to the number base, a carry is added to the next
column. The result is placed into the rightmost symbol of the column sum; the carry is placed to the next column.

The sum of the right column is 17, the result digit in the right column is 7 with a carry of
1 into the next column.

In subtraction, if the bottom symbol in a column is greater than the effective top symbol, a borrow from the next
column will be needed which is equal to its number base. Then it will be added to the effective top symbol to make
it greater than the bottom symbol of the column, so that the subtraction process will be possible.
Number Base Conversions

Dividing a number repeatedly by b yields remainders equal to the symbols of that number written as a base b
Number Base Conversions (fractional)

To convert a fraction to a different base, we repeatedly multiply by the target base, stripping off the whole part
of the product at each step.
We continue multiplying until a fractional part equal to zero occurs.

To convert a number that has a whole part and a fractional part, we simply do each part separately.
a. To convert 14.6875 decimal to binary we convert its whole part 14 (to get 1110), we convert its fractional
part 0.6875 (to get .1011) and we then put the two results together (to get 1110.1011)

Multiple repetition