ECE2560 Quiz 2

ECE2560
Quiz 2 (Midterm Bonus)
Name.#: ________________
Problem 1: Given the following lines of code, what are the contents at the beginning of
RAM and Flash before starting your program? Fill in the two tables below (in 16 bit
chunk) with only the known data. (4pts)
Address
0x200
0x202
0x204
0x206
0x208
0x20A
Content
0x 0000
0x 0000
0x
0x
0x
0x
Address
0xC000
0xC002
0xC004
0xC006
0xC008
0xC00A
Content
0x 4345
0x 0045
0x ××A0
0x
0x
0x
The rest of the program is as given below. Please answer problem 2 to 6 based on the
entire given program:
Problem 2: What is the initial value of PC? (3pts) 0xC006
Problem 3: A snippet of the disassembled code is as shown below. What is the value at
0x200 (labeled boo) after executing the mov command at line 37? (3pts)
0xC014
PC is pointing to the instruction marked out by the red box
Problem 4: What are the contents at the beginning of RAM and Flash when the program
reaches endLoop? What is the value of R15? Fill in the two tables below (in 16 bit chunk)
with only the known data. (5pts)
Address
0x200
0x202
0x204
0x206
0x208
0x20A
R15
Content
0x C014
0x 0000
0x
0x
0x
0x
Address
0xC000
0xC002
0xC004
0xC006
0xC008
0xC00A
Content
0x 4345
0x 0045
0x ××A0
0x
0x
0x
0000
Problem 6: How does the N, Z, C, V bits in your status register looks like when the
program reaches endLoop? (5pts) (in our code only add command and dec command
affect the status register)
N = 0, Z = 1, C = 1, V = 0