How can a particular bit pattern be loaded into a register?
With an ori instruction.
Here are the fields of the ori instruction.
The numbers in the first row are bit positions, numbered from
the low-order bit on the right.
The opcode of the instruction is 0xD.
The source register is s,
the destination register is d,
and the immediate operand is const.
31....26 25...21 20...16 15...................0 0xD s d unsigned const
Our example program will assemble the machine code that corresponds to the assembly language instruction:
ori $8,$9,0x004A
The instruction will be assembled in register $25. The program uses bitwise logic and shift operations. Let us say that this example is part of a larger program. It is wise to initialize $25 to contain all zeros (this is called clearing the register).