Question
I need help with this. 1. In this part you are asked to recognize what a given segment of machine code does, by translating it
I need help with this.
1. In this part you are asked to recognize what a given segment of machine code does, by translating it into assembly code, and annotating it with expressions in a high level language like C. This process, from binary code back to source code, is called disassembling. Disassemble the following machine code into operations and arguments, e.g., ADD R1, R2, R3. Explain what the whole program does, either in plain English (e.g., it calculates the product of R1 and R2) or in C type of pseudo code (e.g, R3 = R1 * R2.) Note: you need to make up unique labels for branch instructions in your assembly code. Addr: Code
-----------------------
0x00: 07FF
0x02: 280A
0x04: 0608
0x06: 23C7
0x08: 3802
0x0A: 3C00
2. If the register files (each register has 8-bit) have the initial image as the following, what are the values of these 8 registers when the execution of the program in part 1 stops? R0: 0101 1010
R1: 0000 0100
R2: 0000 0000
R4: 0000 0000
R5: 0000 0000
R6: 0000 0000
R7: 0000 1000
3. Translate the following segment of C program into assembly code for the machine given above. Note: you may assume the unsigned integer a is already given in register R0. By convention, put the returned value in R7. c = 0; while (a>0) { if (a & 0x01 ==1){
c++; a>> 1;
}
return c;
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