mips - How do I print a specific bit of a number? -


i'm struggling question:

prompt user enter number, print number in 16-bit two's complement

to print number print each bit either string "1" or string "0", using loop print 1 bit in each iteration. start printing bit 15. (recall number bits starting 0 @ low order bit.) in loop test bit 15, , print either "1" or "0". use shift instruction next bit position 15 before repeating.

i unfortunately missed lecture shifts , using masks, don't have understanding of how go doing lab. how can print specific bit of number? understand keep printing bit 15, , doing shift left, have no idea done in mips. appreciated.

edit:

i understand shifting perfectly, it's printing bit thats confusing me.

for example, if number wanted convert two's complement 25 , in register $t0.

first print 15th bit. shift left. , repeat 15 times.

it should this:

# print bit sll     $t0, $t0, 1 

i don't how print first bit @ spot 15.

break down problem -- 1. how print bit, , 2. how determine bit's value

you know how determine bit's value, test bit 15 , keep shifting other bits position 15.

how expected "prompt user" enter value? printing bit same printing prompt.


Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -