开发者

Breaking down a binary number into 4 digits?

开发者 https://www.devze.com 2023-02-09 17:37 出处:网络
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-s

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号