Starting from:
$30

$24

CSC 3210 – Assignment #4 Solved

    1. (8 points) Write an assembly program to implement the following. sum = 0

        i = 0
        j = 12
var1 = 3
var2 = 3
var3 = 0
for(i=0; i<j; i++){
if (var1 > var3){
var1 =var1 – i;
}
else {
var3 = var3+ i;
}

sum = var1 + var2+ var3;

j = j-1
}

        ◦ If you code it correctly, at the end sum contains 15 (decimal).

        ◦ Assume that variables are 32-bit signed integers variables
        ◦ You are not allowed to make any logical reduction to the code. You need to implement it the way it is provided.
o
o  Submit the following:
            ▪ Rename the asm file using your last name as Lastname1.asm and submit it.
            ▪ Screenshot of the code
            ▪ Then run the code until you reach INVOKE ExitProcess, 0
            ▪ Then take a screenshot of the watch window showing Sum variable content.


    2. (7 points) Write a function that can find the largest item in the array and returns it. The function takes the array as an input. From the main function, send initial address, type and length of the array to the function. You can use registers to send the data to the function. Also return the largest item in the array using EAX register.
You can use the following array for this problem. Array DWORD 10, 34, 2, 56, 67, -1, 9, 45, 0, 11

    o Submit the following:

        ◦ Rename the asm file using your last name as Lastname2.asm and submit it.
        ◦ Screenshot of the code
        ◦ Then run the code until you reach INVOKE ExitProcess, 0
        ◦ Then take a screenshot of the register window showing EAX register contains the largest value.

Note:

    • Comment header for .ASM files: Student Name

Class: CSC3210

Assignment#: 4

Description: This program ………….

    • Follow the program standards as presented in your book. Pay more attention to code comments and consistent indentation.

    • Create a new project for every question. Do not use one project with multiple .asm files.

More products