Hi,
Please find the solution below and in case any thing is unclear, let me know. (Please note that opcode to machine code mapping is different for different controllers/processors).
Q.)
ORG 0H
MOV R5,#25H
MOV R7,#34H
MOV A,#0
ADD A,R5
ADD A,R7
ADD A,#12H
HERE: SJMP HERE
END
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
a.) Relevant register and accumulator values are as follows :
| Executed Instruction | R5 | R7 | ACC | PSW |
| ORG 0H | 0x00 | 0x00 | 0x00 | 0x00 |
| MOV R5,#25H | 0x25 | 0x00 | 0x00 | 0x00 |
| MOV R7,#34H | 0x25 | 0x34 | 0x00 | 0x00 |
| MOV A,#0 | 0x25 | 0x34 | 0x00 | 0x00 |
| ADD A,R5 | 0x25 | 0x34 | 0x25 | 0x01 |
| ADD A,R7 | 0x25 | 0x34 | 0x59 | 0x00 |
| ADD A,#12H | 0x25 | 0x34 | 0x6B | 0x01 |
| HERE: SJMP HERE | 0x25 | 0x34 | 0x6B | 0x01 |
| END |
b.) Machine code(in hex) for the given assembly code (assuming we are working on 8051 microcontroller) would be as follows:
| Executed Instruction | Address | OP -> M.C.(HEX) |
| ORG 0H | ||
| MOV R5,#25H | 0000 | AD 25 |
| MOV R7,#34H | 0002 | AF 34 |
| MOV A,#0 | 0004 | E5 0 |
| ADD A,R5 | 0006 | ED |
| ADD A,R7 | 0007 | EF |
| ADD A,#12H | 0008 | E5 12 |
| HERE: SJMP HERE | 000A | 80 000A |
| END |
c.)
EDSIM51 simulation

Note : Examining the code, we can see that at the end of the code there is an "SJMP" (short-jump) from label "HERE" back to the same label "HERE", thus creating an infinite loop.
Examine the following code and answer the following: 10. Register contents after execution of each instruction Machine code using hand assembly EDSIM51 Simulation a. b. c. istart (origin) at 0 ;l...