I'm learning MIPS assembly using a website for practice exercises.
Exercise 2
In each register $1 through $7 set the corresponding bit. That is, in register 1 set bit 1 (and clear the rest to zero), in $2 set bit 2 (and clear the rest to zero), and so on. Use only one ori instruction in your program, to set the bit in register $1. start with: 'ori $1,$0,0x01' Don't use any ori instructions other than that one. Note: bit 1 of a register is the second from the right, the one that (in unsigned binary) corresponds to the first power of two.
Can someone please explain this?
Is it correct to put 0x02 in register 1? (I can't use ori, so I would use a left shift to make the 0x01 into 0x02)
This makes register 1 == 10 (binary). Therefore the 1st bit of register 1 is a 1, and other bits are zero?
I'm confused because the MIPS simulator doesn't show the leading zeros. So I don't know if I'm doing this correctly.