Question: Answer in JAVA language COMP360 Assembler Write an assembler that reads the source code of an assembly program (for an imaginary machine) and displays the


COMP360 Assembler Write an assembler that reads the source code of an assembly program (for an imaginary machine) and displays the machine language for that program. The following assembler instructions must be supported. Instruction opcode Length Format Example add add R1, R2, R3 sub R1, R2, R3 mult mult RI, R2, R3 I ld R1, addr R7) la R1, addr (RTT st R1, addr R71 jump addr R71 R1, addr R71 3 push R1 Machine language instructions have the following formats: 0: arithmetic Lopcode Reg I Reg 2 Reg3 4bits 4 bits 4 bits 1: Load, store. conditional jump Dopcode eg index ad 4 bits 4 bits 4 bits 20 bits 2: call, jump de unused index addr 4 bits 4 bits 4 bits 20 bits 3: push, pop, lpsw. spsw opcode Reg 4 bits 4 bits 4: rtn opcode unused. 4 bits 4 bits
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
