ISA & Assembly
What is the relationship between assembly language and machine code?
- AAssembly instructions are translated almost one-to-one into machine instructions by an assembler
- BAssembly is the same for every CPU and runs unchanged on any of them
- CMachine code is an interpreter that reads assembly line by line at run time
Show answer and explanation
Answer: A. Assembly instructions are translated almost one-to-one into machine instructions by an assembler
Assembly language writes machine instructions as readable mnemonics such as "add a0, a0, a1", and an assembler converts them into instruction bit patterns. Because it maps almost one-to-one onto instructions, a different ISA means a different assembly language. Pseudo-instructions such as "li" and "mv", however, are replaced by the assembler with one or more real instructions. Turning labels into addresses is also the assembler's job.
- A. Correct. It writes the instructions as readable mnemonics.
- B. Assembly differs for each ISA.
- C. Machine code is the bit pattern the CPU executes directly.