I need to break down a binary number into 4 decimal digits using assemb开发者_运维百科ly.
For example, break down 0010 0110 1001 0010 which is 9874 into '9' '8' '7' '4' and show each on a 7-segment display. I got that display part, I just don't understand the logic/process of breaking it down.
Can anyone help please?
Thanks!
divide by 10, capturing the remainder. (modulus operation). Push the remainder onto a stack or other suitable structure. Repeat until the quotient is zero. The remainders that you pushed are the digit values.
精彩评论