Take a look at the opcode bits - the most significant 6 bits. In C, if n
is the 32-bit command dword, the expression for the opcode is (n >> 26) & 0x3f
.
If opcode is 0, then it's a register command.
If it's 2 (j
), 3 (jal
), or 26 (trap
) - it's a jump.
Else immediate.
A cheat sheet of MIPS encoding, including a list of all opcodes, is available here, and probably elsewhere.