Sale!

# CSC 3210 Assignment 2 solved

Original price was: \$35.00.Current price is: \$30.00.

Category:

## Requirements:

(5 points) Implement the following expression in assembly language:
EDX = (val3 + val4) – (val2 – val1) – (5/3)*7
Assume that val1, val2, val3 and val4 are 16-bit integer variables
You need to implement the expression the way it is provided, you cannot do any reduction on the expression while implementing it.

You are NOT allowed to update the values of any variables.
Use ONLY mov, add, sub, movzx, movsx, or neg instructions whenever needed.

##### Submit the following:

Screenshot (showing the code and register window) of AX register contains the correct result.
(5 points) Implement the following expression in assembly language:
ECX = –(val3 + val1) + (-val4 – val2) + 3

Assume that val1 is 8-bit variable, val2 is 16-bit variable, val3 is 32-bit variable, and val4 is 8-bit variable.
You need to implement the expression the way it is provided, you cannot do any reduction on the expression while implementing it.
Initialize val1 with 12 (decimal), val2 with 9 (decimal), val3 with 2 (decimal), val4 with 20 (decimal),
You are NOT allowed to update the values stored in val1, val2, val3 and val4
Use mov, add, sub, movsx, movzx, or neg instructions whenever needed.

##### Submit the following:

Screenshot (showing the code and register window) of ECX register contains the correct result.

(5 points) Write an assembly program to compute the following expressions

Create a DWORD array named ‘z’ of size 3 using DUP operator. Leave the array ‘z’ uninitialized. You can denote the items in the array as [z_0,z_1,z_2], where z_0 is the first item, z_1 is the second item, z_2 is the third item
Update each array item using the following expressions.

z_0=x+130
z_1=y-x+ z_0
z_2=r+x-z_1

Where x, y, r are 16-bit integer memory variables.
x = 10, y = 15, r = 4
Use mov, movzx, movsx, add, sub instructions only.
(hint: Do not alter the value of x, y and r during the computation. Transfer them to appropriate registers to do computation)
At the end, open memory window to see the variable z stored in memory (little endian format).
Submit the following:
Rename the asm file using your last name as Lastname3.asm
Screenshot of the code and memory window showing the content of the variable z (little endian format).