Question
CSC 3210 Assignment #6 Fall 2017 due Tuesday, November 7th, 11:59 pm (No 24-late period is provided for this assignment) Objective: Learn conditional processing and
CSC 3210 Assignment #6 Fall 2017 due Tuesday, November 7th, 11:59 pm (No 24-late period is provided for this assignment) Objective: Learn conditional processing and integer arithmetic: Comparison and jump instructions, if and while statements, and Shift instructions. Requirements: 1. (5 points) Write an assembly program to find the smallest element by searching an array int ary[ ] = {11, 15, -3, -4, 0, 60,11,-1,18} int index = 0 ; int max = ary[0]; int arraySize = sizeof array / sizeof max while (index < arraySize) { if (ary[index] < min) min = ary[index]; } - Use cmp instruction and the appropriate jump instruction (signed or unsigned) to translate the if and while statements - Use $ operator (see chapter 3) to calculate the size of the array, and inc instruction to increment the index of the array - Run your program using the debugger to verify your answers (do this too for questions 2 and 3) - Submit the following: o Lastname1.asm
2. (5 points) Write an assembly program to implement the following. while X > 0 if X != 3 AND (X > A OR X < B) X = X 2 else X = X 1 end while - Use short-circuit evaluation - Assume that A, B, and X are 16-bit signed integers variables - Assume that A=9, B=8, and X=11 o Submit the following: Lastname2.asm
3. (5 points) Write an assembly program to test if the MSB in the register al is set: - If it is set, then divide the content of al by 8 using the appropriate shift instruction and exit. - Else, if it is not set, then multiply the content of al by 4 using the appropriate shift instruction and exit. - When checking al MSB, do not change al content. - Assume that al is equal to the signed integer 88h. - You need to come up with the appropriate mask to check the MSB. - Run your program using the debugger to verify your answers. o Submit the following: Lastname3.asm
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