I wanted to ask about how to read machine code as assembly code. I have only done convertions that looks like this
001000 00001 00000 0000000000000100 -- addi $r0, $r1, 0x0004
or R-type instruction like this
000000 00000 00001 00010 00000 100000 -- add $r2, $r0, $r1
for example. But now I’ve come across some instructions that looks like this
001000 10001 10000 0000000000000101 -- addi $s0, $s1, 5
and
001000 10011 01000 1111111111110100 -- addi $t0, $s3, –12
I know that for addi instruction it is addi target_reg, source_reg, imm
and I assume they write $t and $s here because it is the target and source reg, but I don’t understand why they are red differently then the once I gave example on first.
If I would have red the machine code for the lw instruction for example, I would have written it as
addi $t16, $s17, 5
and
addi $t8, $s19, -12
Could someone help me understand what is wrong with this way of converting these code snippets where it is not wrong in my first examples.
Elias Sk is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.