1

In PCSpim, when a program is executed, it displays in the Text Window a line for each instruction.

e.g. [0x00400028] 0x34020004 ori $2, $0, 4 ;13: li $v0, 4

That example loads 4 into the register $v0.

What does the ori $2, $0, 4 mean?

And is 0x34020004 just the same command, but in hexidecimal?

Thanks.

1 Answers1

3
[0x00400028] 0x34020004 ori $2, $0, 4 ;13: li $v0, 4
  • 0x00400028 is the address where the instruction is located.
  • 0x34020004 is the instruction word, i.e. the four bytes encoding the instruction.
  • ori $2, $0, 4 is the human-readable form of the instruction, which in this case sets $2 (aka $v0) to 4.
  • li $v0, 4 is the instruction you typed in. Since li is a pseudo-instruction, it is translated by the assembler into one or more actual MIPS instructions (in this case ori $2, $0, 4).
Michael
  • 57,169
  • 9
  • 80
  • 125
  • 1
    and `ori` is bitwise OR, and it "ors" the zero from `$0` (called sometimes also `$zero`) with immediate constant `4`, which results into value `4`, and the result is stored into `$v0` (in pseudo C: `$v0 = $zero | 4;`) – Ped7g Jul 26 '17 at 09:06