1.2 STARLASERPRINTER4SOFTWARE
1.2.1Binary and hexadecimalarithmetic
1fyoualready know what hexadecimalnumbersare, you can skip this
sectionandgo ahead to readabout ASCII.
Thedecimal numbersystemwith which we’reall familiar is apositional
countingsystem. There’s the “ones” position, the “tens” position, the
“hundreds”positionandsoon.Each higherpositionisworthtentimesmore
thanthepositionto therightof it, sincethedecimalsystemusesthe baseof
ten.Moreover,we needten symbolstoshow theactualvalues thatmaybe
ineach position.
Thebinarysystemis positionaltoo.There’sthe“ones”position,the“twos”
position,the“fours”position,the“eights”positionandsoon.In binaryeach
positionisworthonlytwicethatofthepositiontoits right.Andweonlyneed
twosymbols- O(zero)and1(one)- to showthevaluesthatmaybe in any
position.So inbinary we getnumbersthat looklike 1O1Oor10001100.
Thehexadecimalsystemismadeof base-sixteennumbers.Hexadecimalis
positionalliketheothercountingsystems.Andeachhigherpositionisworth
sixteentimesas muchas the positionto its right.
We need sixteendifferent symbolsto show all the possible values one
hexadecimaldigit could have. We can use our decimal system’s ten
symbols,butwe’vehad to borrowafew morefrom our alphabettoget all
thesymbolsweneed.Inhexadecimal,therefore,youcanhaveanumberthat
lookslike2C7C, or evenFACE.
Here’showthedecimal,binaryandhexadecimalnumbersystemscompare:
Decimal
o
1
2
3
4
5
6
7
Binary
Ooo1
0010
0011
0100
0101
0110
0111
Hexadecimal
o
1
2
3
4
5
6
7
Decimal
8
9
10
11
12
13
14
15
Binary
1000
1001
1010
1o11
11(X)
1101
1110
1111
Hexadecimal
8
9
A
B
c
D
E
F
5