So I am using spim and I am trying to figure out how to take a users input say "16" and then print it as 9 digit binary number. for example 16, 000010000 or say 4, 000000100, 67 01000011 etc etc always 9 spaces and in binary. I have all the input and I am currently just printing the number itself, but I want to print the binary anyone got any ideas/ tips?
calvintmoss
0
Newbie Poster
Recommended Answers
Jump to PostTry something like this:
NineDigits db "123456789$" ;the target sting - any old junk will do mov cx,9 ;loop count move ax,value ;value to convert move bx NineDigits ;Pointer to NineDigits LoopHere: shr ax ;low order bit into carry flag mov [bx],'0' ;Assume bit is not set …
All 2 Replies
Reply to this topic
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.