Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

ASSEMBLY x86 1. Write a piece of code that calculates the following expression:

ID: 3788405 • Letter: A

Question

ASSEMBLY x86

1. Write a piece of code that calculates the following expression:
eax = (ecx + ebx) - (eax + edx)


2. Write a piece of code that copies the number inside al
into ch, so that the value inside ecx will be equal to the value inside the original al multiplied by 256.
Example: Assume that Initially eax = 0x15DBCB19. At the end of your code ecx = 0x00001900.

3. You are given eax = 0x5. Write one line of code in assembly to Zero eax. Don't use Sub instruction.


4. Implement the following arithmetic expression in assembly language:
EBX = va12 - val3 - 9 + val4

5. Write a piece of code that implements the following C++ statement
x = y = 1; // x and y are of size word (2 bytes)

6. Write a piece of code that implements the following C++ statements
d = 'w'; // a ,d,b are of size byte.
a = d;
b = a;

Part two:(8 points)

Copy C:irvineExamplesProject_sample to your local directory
Open the project and download main.asm
Remove any .asm file by right click on the name and select Remove
Add main.asm by right-clicking on the project name and select Add existing
Open main.asm
Before the exit line of code, add the line of code:
mov ebx, -20

Save and build the project.
Set a breakpoint at the mov line that you just added
Run to the breakpoint
Open the debug window to see all the registers
Select Step Into (F11) to run the mov line of code
Show what values are in the following registers:
BL:
BH:
BX:
EBX:

Explanation / Answer

//In following codes text after // is comment.

//Assembly code for first question.

//Given expression is eax=(ecx+ebx)-(eax+edx)

add ecx,ebx   //Adds the content of ecx and ebx and store in ecx.

add edx,eax   //Adds the content of eax and edx and store in edx.

sub ecx,edx //Subtract the content of edx from ecx and store in ecx.

mov eax,ecx //Moves the content of ecx to eax

//For second problem statement

mov ecx,00000000h // initialize ecx to 0

mov ch,al //moves the content of al which is 19 to ch

//After this ecx=0x00001900

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote