
6 Assembly Language Programming for the 68000 Family
Binary
Virtually all computers use 2 as the base for numerical quantities.
The choice of 2 as a base for computers is not arbitrary. Internally, the
electrical elements, or gates, that collectively construct the computer are
much easier to build if they are required to represent only two values or
states, they are thus called binary state devices. Each element can only
represent the values zero or one. Each one or zero is called a bit, or binary
digit. In order to represent larger numbers, bit positions must be used.
Binary numbers are based on powers of two rather than on powers of
ten. For example, the binary number “1011” is equivalent to:
1(2)3+0(2)2+l(2 >1+1(2)0
This value is equivalent to:
8+0+2+1 = 11
in decimal representation. The positional values of the bits are thus:
(2)°
=
1
(2)1
=
2
(2) 2
=
4
(2)3
=
8
(2) 4
s
16
<2)16 = 65,536
etc.
To convert a binary number to its decimal equivalent, merely add up
the appropriate powers of two. If the binary position contains a 1, the
decimal value of that bit position is added.
Conversions
Converting a decimal number to binary is not quite as simple as con
verting a binary number to decimal. One method is to work backwards.
Commenti su questo manuale