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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.