



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The midterm examination for the eel 3801c course focusing on assembly programming. The exam consists of six problems, including writing assembly programs for arithmetic expressions, error handling, array manipulation, and c language implementation. Students are expected to write uncommented and correct code within the given time frame.
Typology: Exams
1 / 6
This page cannot be seen from the preview
Don't miss anything!




Date: March 4th, 2004 Name: Student Code: Instructions: This exam is open book and open notes. Allotted time is 90 minutes. Add comments to your code!!! Uncommented and incorrect code will not get partial credit. Note that the points add up to 120. Problem 1 (20 points) Write an assembly program which computes the expression v = ((x + y) / z ) * u where x, y, z, u and v are 16 bit integer variables. Assume that no overflow will happen and the result and the partial results fit in 16 bit.
Modify the assembly program from step 1 as follows: add a byte variable ERRORCODE, which will be set as follows o ERRORCODE = 0 if the expression is correctly evaluated o ERRORCODE = 1 if there is an overflow at addition or subtraction o ERRORCODE = 2 if the result of a multiplication does not fit in 16 bits o ERRORCODE = 3 if there is a division with 0
Let ARRAY be an array of non-zero, positive, 8 bit integers, terminated with 0. Write an assembly language program which counts how many elements are greater than 42 and writes the answer into the 16 bit variable RESULT. An example of the array would be: ARRAY db 45, 6, 7, 8, 12, 80, 90, 0 In this case, the value of RESULT would be 3.
Implement problem 4 in the C language.