Question
Memory and Registers Consider the following .data segment: L1 L2 L3 L4 L5 3A FF 01 02 FF 6B B2 AA 42 41 61 62
Memory and Registers
Consider the following .data segment:
L1 L2 L3 L4 L5 3A FF 01 02 FF 6B B2 AA 42 41 61 62 D3 D5 D7
and the following program fragment:
mov eax, L3 mov ebx, L5 mov ecx, 0 mov cl, [L2] sub ebx, ecx mov ebx, [ebx] add eax, 2 mov ecx, [eax] mov [L4], cx mov ax, [L1] add bx, ax mov [L1], ebx
After the code finishes executing, what are the contents of the 15 memory bytes starting at address L1, on a machine using Little Endian?
Show your work for each instruction, as done for the examples in the lecture notes. Each instruction is worth 3 points. An instruction with no work shown will receive zero points.
Here is the way to show your work for each instruction:
If an instruction updates the value of a register, show the value of that register (e.g., ecx = 00AABBCC, bx = FF FF, eax = the address of the 8th byte, edx = the address of the byte with value 42);
If an instruction updates memory, then show the full memory state after that instruction.
For instance, a partial answer (for a different program) could look like this:
L1 L2 L3 L4 L5 3A FF 01 02 FF 6B B2 AA 42 41 61 62 D3 D5 D7 mov ebx, L1 ; ebx = address of the 1st byte mov ecx, 0 ; ecx = 00 00 00 00 mov cx, [L3] ; ecx = 00 00 AA B2 mov [L2], ecx ; updates memory state: L1 L2 L3 L4 L5 3A FF 01 B2 AA 00 00 AA 42 41 61 62 D3 D5 D7 mov ebx, L4 ; ebx = address of the byte with value 41 mov bx, 12 ; ebx = ?? ?? 00 0C ...
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