Docsity

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

Toggle sidebar
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