PROGRAMMING IN ASSEMBLY
BY STEVE BJORK
LESSON 1 FOUNDATION – IT’S ALL ABOUT THE MATH
HOW MATH WORKS ON THE 6809 CPU
Digital Electronics has only two states.
Zero or off
One or on
The more states a digit has the more likely to create an error
With digital, it’s hard to make an error.
Digital or Binary is also easier for the CPU to do the math.
HOW MATH WORKS ON THE 6809 CPU
How to do larger numbers
Our normal math, Decimal or Base-Ten has 10 states per digit.
0-1-2-3-4-5-6-7-8-9
Binary or Base-Two has only two states per digit.
0-1
In Base-Ten math, we can add more Digits to work with numbers
greater than 9.
The same is true with Base-Two math.
HOW MATH WORKS ON THE 6809 CPU
1,000 100 10 1
0 2 4 5
0*(1000) + 2*(100) + 4*(10) + 5*(1) = 245
Using extra digits for larger number like 245 in Base Ten.
Using extra digits for larger numbers like 245 in Base Two.
128 64 32 16 8 4 2 1
11110101
1*(128) + 1*(64) + 1*(32) + 1*(16) + 0*(8) + 1*(4) + 0*(2) + 1*(1) = 245
HOW MATH WORKS ON THE 6809 CPU
With so many digits in binary, sometimes we use Base-Sixteen.
Hexadecimal Think 6 + 10 or 16 digits.
The numbers are 0-1-2-3-4-5-6-7-8-9-A-B-C-D-E-F.
A=10, B=11, C=12, D=13, E=14 and F=15.
Using extra digits for larger numbers like 245 in Base-Sixteen.
256 16 1
15 5
0*(256) + 15*(16) + 5*(1) = 245 or ($F5 in Hexadecimal)
1 / 9 100%
La catégorie de ce document est-elle correcte?
Merci pour votre participation!

Faire une suggestion

Avez-vous trouvé des erreurs dans linterface ou les textes ? Ou savez-vous comment améliorer linterface utilisateur de StudyLib ? Nhésitez pas à envoyer vos suggestions. Cest très important pour nous !