A86: Re: Re: ASM Posts
[Prev][Next][Index][Thread]
A86: Re: Re: ASM Posts
Thanks for the help. I haven't read the whole message but I printed it out
to view later. I really appreciate it. From what I've read, the whole
concept is that the hex is a 16 base, right? (mind you I've only skimmed it
now). I've been through higher math and I couldn't do this. Pretty pathetic.
I knew it wouldn't be hard. I just needed it explained.
Thanks again.
-----Original Message-----
From: Justin Karneges <jgkarneges@ucdavis.edu>
To: assembly-86@lists.ticalc.org <assembly-86@lists.ticalc.org>
Date: Friday, January 22, 1999 6:15 PM
Subject: A86: Re: ASM Posts
>
>>Also, can anyone post a decimal to hex conversion "thing". I know your
calc
>>does it but...when I convert 10 to hex I get 'Ah'. How does $10 revert
back
>>to 10? I know this is simple. I just haven't grasped the complex yet. Just
>>think, I'm in advanced calculus and can't convert to hex. Hmm....
>
>
>Number bases scare entry level asm programmers bad. However, they're not
>that hard to understand. Basically, number bases are ways of representing
>numbers or values. This is a pretty long message, but it should be fairly
>easy to understand.
>
>Take the value twelve. I write it in english since '12' is base ten.
>"Twelve" in english does not mean that you have to think of it as 1, then
2.
>Twelve simply means twelve things or a value of twelve. You have to
>remember that when converting to a different base, the value is still the
>same. A new base is just a different way to represent it. Anyways:
>
>twelve:
>
>in base 10, that would be: 12
>
>If you remember back from grade school, each digit has a place with a name.
>In the case of '12', there is a '1' in the tens place and a '2' in the ones
>place. Remember that stuff? Well, the third digit would be the hundreds
>place, then the thousands place and so on.
>
>base 10: 2439
>
>is a '2' in the thousands place, a '4' in the hundreds place, a '3' in the
>tens place and a '9' in the ones place. Think about it like this:
>
>there are 2 "thousands"
>and 4 "hundreds"
>and 3 "tens"
>and 9 "ones"
>
>2 * 1000 + 4 * 100 + 3 * 10 + 9 * 1 = 2439. You're probably wondering what
>the heck the point of that was. Well, now you can see why they name the
>digit places as they do. The thousands place is called what it is because
>it holds the number of "thousands" in the number.
>
>Notice that the "places" are named by the following values:
>
>10^3 10^2 10^1 10^0
>
>10^0 being the ones place since 10^0 = 1 obviously.
>
>Now, let's move on to a different base... like 16 (hexidecimal). by the
>way, the word hexidecimal means 6(hex) and 10(decimal) which is base 16.
In
>base 16, we have the following:
>
>16^3 16^2 16^1 16^0
>
>Now this one is trickier to read. We're used to all those zeros from our
>base 10 life that we live. But in base 16, we have:
>
>the 4096's place
>the 256's place
>the 16's place
>and the 1's place (there is a ones place in all bases)
>
>So lets say you have a number in base 16 ---> 35
>
>that's a 3 in the 16's place and a 5 in the 1's place.
>thus there are 3 sixteens, and 5 ones.... or in other words: 53
>
>so 35 in hex is 53 in decimal.
>
>another thing to remember is that the number of possible values per digit
>changes based on the base. how many different values could be in the 1's
>place in base 10? the answer: 10! 0, 1, 2, 3, 4, 5, 6, 7, 8, 9...
>that's 10 possible values for a digit to have. In base 16, we have 16
>possible values per digit. Unfortunately since we all live in a world
>dominated by base 10, no other symbols were invented for subsequent values.
>Thus, we use the alphabet letters A through F to represent our otherwise
>unrepresentable 6 values.
>
>so what is the value of the hex number: 2b ??
>
>2 sixteens and B ones. that's 43. remember that B is a value of eleven in
>a single digit. One way to see why is to count. In base 10, we go "0, 1,
>2, 3, 4, 5, 6, 7, 8, 9, THEN 10". Every other base is the same way. We
>don't move on to the next digit until we have counted out all 10 values.
In
>the case of base 16, we don't move onto the next digit until we have
counted
>16 values. "0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F, THEN 10".
Your
>probably saying. Huh? 10? where did that come from? Well, remember that
>F is 15. What is 10 in base 16? that's 1 sixteen and 0 ones. which is
>16.
>
>so F is fifteen, and 10 is sixteen....hexidecimally speaking, of course.
>you should really read 10 as "one, zero" and not "ten" otherwise it'll
screw
>you up bad.
>
>Ok, by now the answer to your question should be clear but let's go over it
>anyway.
>
>10 in decimal (or base 10) is A in hexidecimal. remember? 0, 1, 2, 3, 4,
>5, 6, 7, 8, 9, A, B ..." A is the tenth value and thus A is ten. note
>that it should be written as:
>
>Ah
>
>or
>
>$A
>
>since those are standard ways to write hex (and your assembler won't
>understand what the heck you mean unless write it one of those ways).
>
>Now, $10 is different. that's a hex number.
>
>$10 (or 10h) is 1 sixteen and 0 ones. Thus, $10 in hex is 16 in base 10.
>
>
>All the rest of the number bases follow the same rule:
>
>Base^3 Base^2 Base^1 Base^0
>
>Just insert the base you want to use. For bases higher than 10, you must
>use something to fill in the missing values (although the standard is to
use
>letters). For bases below 10, just use less of the normal numbers. Like
>for base 8 you'd only use 0-7. And remember that Binary is Base 2, if you
>ever feel like messing around with that.
>
>Hope this helped =).
>
>-Justin Karneges [Infiniti]
>
>
>