Embedded Systems Exam 3 - Spring 2008 - Problem Set, Exams of Microprocessors

Three problems from an embedded systems exam held in spring 2008. The problems involve writing assembly code, converting assembly code to c code, and analyzing the behavior of an unconventional subroutine. No registers are altered by the provided code in problem 1, and no registers or memory locations are given initial values in problem 3.

Typology: Exams

Pre 2010

Uploaded on 08/19/2009

koofers-user-6pf
koofers-user-6pf 🇺🇸

7 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
EE3376 – Embedded Systems - Spring 2008 - Exam 3 – MacDonald – Page 1
Student Name:______________________________ Student ID: _______________
Problem 1
Provide the assembly code that can perform the following code.
Full credit for 5 instructions or less and 10 points off for every additional instruction.
Assume that do_something – a function in C – is a subroutine in assembly.
Make sure no registers are altered by this code after completion.
for (i=10; i > 0; i--)
{
do_something();
}
pf3

Partial preview of the text

Download Embedded Systems Exam 3 - Spring 2008 - Problem Set and more Exams Microprocessors in PDF only on Docsity!

Student Name:______________________________ Student ID: _______________

Problem 1 Provide the assembly code that can perform the following code.

Full credit for 5 instructions or less and 10 points off for every additional instruction. Assume that do_something – a function in C – is a subroutine in assembly.

Make sure no registers are altered by this code after completion.

for (i=10; i > 0; i--)

do_something();

Student Name:______________________________ Student ID: _______________

Problem 2

Write the equivalent C code for the assembly below. Assume J and K are global variables declared with ds.b directive that are signed integers in C.

J ds.b 1 K ds.b 1 …

ldaa J cmpa #$F bne done cmpa #$ bne done movb #$00, K done: movb #$FF, K