Atari User Magazine Vol 1 Issue 03

Page 45

BitWise

#

most significant nybble, we have to shift it over to the left four times.

.

you cast your mind back to last month, this is equivalent to multiplying it by two four times in succession, If

, digit, that is, two column, hexadecimal number, as these are all

on the two

we need to store our bytes in. In this case the left-hand column is the “sixteens” column, the right hand the

.

Iumn.

.

”r"?O"_°°

te

s s

76 7 2 1 76 7 2 D 76 7

2i16+1

=

left hand and a ri ht hand nybble, encode each as g hexa— decimal number. then put the two —

a

side by side. You can go from

binary just

as

hexadecimal to

easily:

$

76 C

33

=

=

2‘16+13 =45

.

byte.

=

12.16“)

192

=

tWO digit "a”S'ate hexanumber into denary srmply multiply the number in the left-hand and add it to the column by 16 number in the right—hand column remembering to translate A to F if T_°

5?

demmal

the hexadecimal

To obtain

8’16+0=128

7

0

is

s 8 0: nybbles

2><2x2><2:16. This is why a the hexadeFimal digit representing. 16 times most Sigmf'cam nybble .'5 than represent— the. “We d'g't larger ing the least Significant nybble. can The “Or? largest number you ls in a two—digit hexademmal number : of This IS, 15x16+15:255. $FF the same as the largest course, number we could store in a binary we often refer to a two digit byte hexadecimal number simply as a

that

bOf)a| postrilve Zigéeger eq'unI/alent is the Ive/f? dmigeeitrblyr?GerTheGZiottism digit, the remainder the right hand, translating into A to F where necessary. For example:

hand

‘fjsk %1(&?

TN“ 000 That

”A“

92901

"01

That

is:

$A Hence

_

IS:

141 $80 = % 10001 101 Although you have probably never thought of it in these terms, you are well aware that the value a digit represents depends on the column it is in. The number 230 is not as large as 320, though both numberscontain =

the same digits.

In hexadecimal coding too the column a digit is in is important. For example, $10 is far greater than $01. In binary each column is worth twice the preceding one. In denary, our usual number system, each column is worth 10 times the preceding one. In hexadecimal, each column is worth 16 times the preceding one.

Believe it or not, the columns in 3 four digit hexadecimal number, from greatest to least, are worth 4096,

256, 16 and This means

necessary. The second column has the value 16 since the first column can only handle numbers up to 15 ($F) the largest you can fit into a nybble 1). After 15, you have to use a (%1 for 16, that is $10. Second column JUSt as '” denary,we "carry" at 10 smce the largest value our columns

respectively. that: 4096 + 256 + 1 = 4353 1

$ 1101 = For the moment let’s concentrate

1

1

_

9, so in hexadecimal we carry at 16’ since the largest our columns can handle is 15 ($F)It is the fact that we carry at 16 that gives this number system its “hex" name ”hexadecimal”_ here can

handle is

_

?tands fc.”

6,3

Hexadecrmal

dec'ma'

Z

6 + 10

Z

for ten16'

Givenasecond column$10,aswe 17 '5 erlbe'$11,wh|Ie $39” 16' $12 is.18'and so on until we reach 31, WhICh IS $1F. have

run OUt Of legal have then We digits for the units column, so if we want to 9° on to 32 we had better ourselves another16,and setthe give units column backtozero, that is $20. way looking at the t at it comes from secon Anzthelr co umn is 0; the most significant nybble. To turn the least significant nybble into the _

R 14

174+16=1° R

$E

174=$AE _

Anyway, here

,

5 a

program that_""'” to

6 "t 0” convertfffhmdeniry ings htexaltiljecimbal S

tor youa ar to ef inlor ,0 d 't' h OW veOW'd un 000 W' ?rm?” b cu rice Y?“ 1? hwriding onlettO Stenary.7convert exa .ron71_h e/Cira or "OW' ”797th ’/l gt;e ak' wayso lie)“ comb/n/ng oob/ngat ers. live mary num _

to m, 10 am mm 20 H” E?u?).???$m

unusznouussmo?r" ‘ ' “ “I“ m 50 I” so If

"5

255

met-nuns»

on

mm

can to

u “t. 7' III-mmuu)

“rims

3

m

mm;

mustnzzkzun

1“ no "I“ 120 PR!!! m a“ “

i

Program/ July 7985 ATARI USER

47


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.