Would this instruction have worked as well?

    or    $25,$0,$12     # move s into target register

### A good answer might be:

No — the 32-bit result ($0 OR $12) is moved into $25, destroying the opcode already there.

    $25 <-- ($0  OR $12)     or  $25,$0,$12    # wrong
    $25 <-- ($25 OR $12)     or  $25,$25,$12   # right

# Destination Register and Const

`ori $8,$9,0x004A`
31....26 | 25...21 | 20...16 | 15...................0
opcode | s | d | unsigned const
0xD | 0x9 | 0x8 | 0x004A

The same method is used with the bit pattern that designates the destination register. The `const` part is in register #13, and it is in the correct field. It needs to be copied into $25 The complete program follows. The comments on each line have been improved. Comments should describe the work done in solving the problem. They should not describe the instruction. Of course, when these notes explain an instruction the comment will often do the same. But that is a poor style, in general.

The following can be copied into the clipboard and pasted into your program editor, then saved to a file and run with SPIM.

    ## Program to assemble the instruction ori  $8,$9,0x004A
    ##
            .text
            .globl  main

    main:
    or    $25,$0,$0        # clear $25
    ori   $11,$0,0xD       # opcode
    ori   $12,$0,0x9       # operand $s
    ori   $13,$0,0x8       # dest. $d
    ori   $14,$0,0x004A    # immediate operand

    sll   $11,$11,26       # shift opcode into position
    or    $25,$25,$11      # or it into the instruction

    sll   $12,$12,21       # shift operand $s into position
    or    $25,$25,$12      # or it into the instruction

    sll   $13,$13,16       # shift dest $d into position
    or    $25,$25,$13      # or it into the instruction

    or    $25,$25,$14      # or const into the instruction

    ## end of file

### QUESTION 21:

Would it be possible to dis-assemble the instruction in $25?