Question: This program needs to be assembled by the LC-3 assembler and then run on an LC-3 simulator. The LC-3 assembler must be able to map
This program needs to be assembled by the LC-3 assembler and then run on an LC-3 simulator.
The LC-3 assembler must be able to map an insturction's mnemonic opcode into its binary opcode. For instance, given an ADD, it must generate the binary pattern 0001.
Write an LC-3 assembly language program that prompts the user to type in an LC-3 assembly language opcode and then displays its binary opcode. If the assembly language opcode is invalid, it displays an error message.
Note: in the question, the "mnemonic opcode" just means the one that's human readable and makes some intuitive sense ("ADD", "AND", "BR" for Branch, etc.). In contrast, the "binary opcode" is like 0001, 0101, 0000, etc. So the question is just stating the obvious -- that the assembler has to start with the mnemonic opcode (e.g., ADD) and convert that into a binary opcode (e.g., 0001).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
