0

Hello

I hava a question regarding assembly. How could I take a number from register and find out how many hundreds, tens and ones it has. For example a number 412 has 4 hundreds 1 dozens i 2ones. Ive tried with looping a sub with a BRMI branch, but the problem is how could I LDI a number like 412 in a 8bit reg. Also how could I potentiate a register to a power of 3.
Thank you for any given help
Cheers

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by low_coder
0

if you divide the number by 10, then the remainder will be the last digit from your number.
so you can make a loop (till the number becomes 0), in which you will get the last digit using the method above, and then to remove the last digit from the number you just divide it by 10

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.