Question
Opcodes Instruction Opcode Instruction Opcode Instruction Opcode ADD 00000000 OR 00000100 Bcc 00001000 SUB 00000001 MOV 00000101 HLT 00001001 NOT 00000010 LD 00000110 AND 00000011
Opcodes Instruction Opcode Instruction Opcode Instruction Opcode ADD 00000000 OR 00000100 Bcc 00001000 SUB 00000001 MOV 00000101 HLT 00001001 NOT 00000010 LD 00000110 AND 00000011 ST 00000111
Part II: Hand Assemble Translate the following program into hexadecimal form, and put it in a file named prog2 with the same format as the le prog. Run the simulator by [python3] sim.py [-d] prog2 Write down the nal result stored in P. What does the program do?
LD P0, R4 LD P1, R1 LD P2, R2 LD P3, R3 L: ADD R4, R2, R4 SUB R3, R1, R3 BNZ L ST R4, P HLT P0: .WORD 0 P1: .WORD 1 P2: .WORD 5 P3: .WORD 4 P: .WORD A working simulator (executable pyc le only, without source code) is given to you, so that you can complete this part using this program, if your simulator in Part I is not working.
I want to know --> Write down the nal result stored in P. What does the program do?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started