assembly language! please help me! thanks in advance!
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
The key thing about "Binary Coded Decimal" (BCD) is that each byte only holds decimal digits (values between 0..9). It's often used in controller applications (e.g. a clock or timer that needs to display decimal values).
So the number "123" (decimal "one hundred twenty three") is represented like this:
Code:
Binary BCD
------ ---
0x007b 0x0123
The example above used "packed BCD" - two digits per byte. As you can see, its less efficient than binary.
"Unpacked BCD" is even LESS efficient: you only store ONE decimal digit per byte.
how does Binary-Coded Decimal addition really works?
Oh, stuff, I don't think that you really mean you want to know how BCD arith really works, but, just in case I'm wrong. If you go to http://www.educypedia.be/electronics...arithmetic.htm and download the datasheet on, eg, the 74F283, you'll see that on page 3 there is a logic diagram for a binary half adder. This is how a normal half-adder works.
Now further down that page, if you look at http://mayaweb.upr.clu.edu/~borges/Chp5.pdf, you'll see an excellent tutorial on how the more complex circuits, including BCD are constructed. And now you know that, you should be able to work out why the original Z80 has a four bit alu, why it didn't look like that to a programmer (ie, took two passes through the 4 bit alu to do eight bith math) and why it was a bad idea.
The key thing about "Binary Coded Decimal" (BCD) is that each byte only holds decimal digits (values between 0..9). It's often used in controller applications (e.g. a clock or timer that needs to display decimal values).
So the number "123" (decimal "one hundred twenty three") is represented like this:
Code:
Binary BCD
------ ---
0x007b 0x0123
The example above used "packed BCD" - two digits per byte. As you can see, its less efficient than binary.
"Unpacked BCD" is even LESS efficient: you only store ONE decimal digit per byte.
Oh, stuff, I don't think that you really mean you want to know how BCD arith really works, but, just in case I'm wrong. If you go to http://www.educypedia.be/electronics...arithmetic.htm and download the datasheet on, eg, the 74F283, you'll see that on page 3 there is a logic diagram for a binary half adder. This is how a normal half-adder works.
Now further down that page, if you look at http://mayaweb.upr.clu.edu/~borges/Chp5.pdf, you'll see an excellent tutorial on how the more complex circuits, including BCD are constructed. And now you know that, you should be able to work out why the original Z80 has a four bit alu, why it didn't look like that to a programmer (ie, took two passes through the 4 bit alu to do eight bith math) and why it was a bad idea.
i just wanna know how this works?do you know?thanks!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.