-1

I am using QtSPIM to learn assembly language. An screenshot of PC SPIM text segment

How can I identify which part of this line is the original text, assembled code and machine code? What are the major difference between assembled code and machine code?

I have used ChatGPT and it gives me the same answer as below: Assembled Version (Machine Code): 0x8fa40000 Machine Code Version (Hexadecimal): 0x8fa40000

  • 1
    Original text is presumably the last part: `lw $a0, 0($sp)`. Assembled is the middle part `lw $4, 0($29)`. Machine code is as ChatGPT said the `0x8fa40000`. The `00400000` at the front is the address. – Jester Aug 05 '23 at 11:43
  • 1
    Keep in mind that ChatGPT is *very* unreliable for assembly languages specifically. Use a real assembler like GAS or Clang. https://godbolt.org/ can probably be coaxed into assembling MIPS code to binary, although maybe only with inline asm in C (perhaps at global scope). – Peter Cordes Aug 05 '23 at 11:56

1 Answers1

1

Each line is one 32-bit machine code instruction.

The part in []s is the memory address for the insrtuction.

After is a hex value of the instruction encoding, which we would call the machine code instruction.

Following is a disassembly of that instruction.

And finally, the source code assembly.

Erik Eidt
  • 23,049
  • 2
  • 29
  • 53