ECE 3430 Exam #2(Fall 2009)
Your Name: ______
Score: ____/117
You may use your pink book (or printout of the pink book), calculator, pencil, and scratch paper if you need it. Nothing else! For multiple-choice questions, circle the single correct answer to each question. For short answer questions, write your answer in the space provided on this exam paper.
1)Upon coming out of the reset state, the HC11 jumps to which of the following addresses to obtain the upper 8-bits of the address containing the first opcode? [2 points]
- $0040
- $00FF
- $E000
- $FFFE
2)Where is the RAM located on our MicroStamps in the lab? [2 points]
3)The EEPROM interfaced to the HC11 address and data bus is how big (on our MicroStamp)? [2 points]
- 4 KB
- 8 KB
- 16 KB
- 32 KB
4)The RAM interfaced to the HC11 address and data bus is mapped to which of the following address ranges? [2 points]
- $0000 - $003F
- $0040 - $00FF
- $A000 - $BFFF
- $E000 - $FFFF
5)The interrupt vectors in the HC11 are initialized using: [2 points]
- At run-time
- Using CPU instructions
- Using assembler directives
- Using black magic
6)True or False: It is possible to execute program code out of RAM. [2 points]
- True
- False
7)Write the HC11 assembly code required to add two 32-bit numbers located in memory locations $0040 and $0044 and store the 32-bit result in $0048. [5 points]
8)What is the minimum number of address lines required to interface a 16Kx8 memory device to a byte-addressable microprocessor? [2 points]
9)The HC11 built-in multiplication instruction is: [2 points]
- Signed and capable of multiplying two 8-bit numbers
- Unsigned and capable of multiplying two 8-bit numbers
- Signed and capable of multiplying two 16-bit numbers
- Unsigned and capable of multiplying two 16-bit numbers
10)The HC11 built-in integer division instruction is: [2 points]
- Signed and capable of dividing two 8-bit numbers
- Unsigned and capable of dividing two 8-bit numbers
- Signed and capable of dividing two 16-bit numbers
- Unsigned and capable of dividing two 16-bit numbers
11)True or False: It is possible to do floating point operations using the HC11? [2 points]
- True
- False
12)When performing packed BCD addition (as we discussed in class) on two 8-bit numbers, which criteria in the HC11 determines when a bias of 6 is added to a 4-bit nibble? [2 points]
- The H flag in the CCR only
- The C and H flags in the CCR only
- The C and H flags in the CCR and whether the nibble is greater than 9
- The C and H flags in the CCR and whether the nibble is greater than 10
13)When performing 8-bit packed BCD addition (as we discussed in class) using accumulator A, which HC11 instruction provides the correction to ensure the result is a valid BCD number? [2 points]
- DAA
- DES
- ADDA
- ADCA
14)Which of the following condition code register flags is not interrogated by any of the HC11 branch instructions? [2 points]
- V
- C
- N
- S
- Z
15)Compare instructions (such as CMPA): [2 points]
- Always use immediate addressing
- Always use extended addressing
- Can change the state of condition code register bits
- Can sometimes change the state of registers/accumulators in the programming model other than the condition code register
16)The branching range of all HC11 branch instructions is: [2 points]
- Backwards 128 bytes, cannot branch forward
- Backwards 128 bytes, forward 127 bytes
- Forward 127 bytes, cannot branch backwards
- Backwards 127 bytes, forward 128 bytes
17)Write out the machine code (hand-assemble) the following code segment. Write the machine code to the right of the assembly code. Assume direct addressing on both the load and store instructions. [6 points]
MAIN:LDAB#$40
INCB
STAB$41
BRAMAIN
18)Fill in the blanks: During the execution of STY $ABCD on the HC11, ____ read cycles are generated on the address/data bus and ____ write cycles are generated on the address/data bus. [2 points]
19)Which of the following is asigned branch instruction? [2 points]
- BLT
- BLO
- BHI
- BLS
Consider the following code segment and answer questions 20 and 21 (assume the E-clock frequency is 2 MHz). Also assume that $0200-$02FF is mapped to an external RAM.
LDAB$0200
CMPB$0201
BGTLABEL2
LABEL1: STAB$0202
BRA RJ1
LABEL2:ADDB#1
STAB$0202
RJ1:…
20)Assuming the BGTbranch is taken, how long does it take the above code segment to complete (up to—but not including the instructions starting at RJ1)? [4 points]
21)Assuming the BGTbranch is not taken, how long does it take the above code segment to complete (up to—but not including the instructions starting at RJ1)? [4 points]
22)What condition must be satisfied for BGT instruction to take the branch? [2 points]
23)The purpose of using a compare instruction prior to executing a branch instruction is: [2 points]
- To ensure memory is properly aligned for the branch instruction
- To test a condition and adjust the CCR flags accordingly
- To preserve the CCR prior to branch instruction execution
- To force a change of contents to accumulators
24)Given the following set of instructions (and the effects each instruction has on the CCR), determine whether each branch instruction will take the branch or skip the branch. Check either Take Branch or Skip Branch for each branch instruction in the table below. [6 points, 1 point each]
S / X / H / I / N / Z / V / CLDAA#$FF / 1 / 1 / 0 / 0 / 1 / 0 / 0 / 0
CMPA#$F0 / 1 / 1 / 0 / 0 / 0 / 0 / 0 / 0
<branch>
Take Branch / Skip Branch
BPL
BLE
BRN
BNE
BRA
BHI
25)Assume accumulator A contains the value $01. After performing alogical shift left on accumulator A (LSLA) 8 times in a row, what would the state of the N, Z, and C flags in the CCR be? [2 points]
N = _____
Z = _____
C = _____
26)To quickly multiply the contents of accumulator D by 16, which HC11 instruction should be used and how many times should it be used? [2 points]
27)The stack is most accurately described as: [2 points]
- A non-volatile structure
- A first-in, first-out structure
- A last-in, last-out structure
- A first-in, last-out structure
28)Assume the stack pointer (SP) is initialized to $00FF. Assume the following 8-bit values were pushed to the HC11 stack in this order: $77, $EF, $CD, $BB. If the TSX instruction is then executed (after all the pushing), what value would you find in the X index register? [2 points]
29)Approximately how long would it take the HC11 (if the E-clock frequency were 2 MHz) to execute the following code segment (assuming nothing interrupts this loop execution)? [4 points]
LDY#535
LOOP:DEY
BNE LOOP
30)How many bytes of memory are consumed by the above chunk of code (in question #29)? [4 points]
31)If the stack pointer were initialized to $0700 and then the PSHX instruction were executed, to what address(es) would data be written? [2 points]
32)Reconsider question #31 using our Microstamp from lab. If the following code was declared and we did the push instruction from question #31, could anything go wrong? If so what? [2 points]
ORG$06FC
JACK: RMB2
JIM: RMB2
33)Discuss briefly when using the JSR instruction would be preferable over the use of the BSR instruction. Also briefly discuss when BSR would be preferable over the use of JSR. [4 points]
34)Explain briefly what happens when the RTI instruction is executed. [4 points]
35)Which of the following is not a standard way to pass parameters in and out of a subroutine? [2 points]
- The stack
- Global memory
- Programming model registers/accumulators
- uC control registers
36)Assuming the HC11 I bit in the CCR is cleared, what happens to the X and I bits in the CCR when the physical IRQ pin is asserted low? [2 points]
- Only I bit is set
- Only X bit is set
- Both X and I bits are cleared
- Both X and I bits are set
37)Which of the following HC11 (our version of the HC11) maskable interrupt sources has the highest default priority? [2 points]
- Timer overflow interrupt
- Real time interrupt
- Timer input capture channel 2
- Timer output compare channel 1
38)Assume the stack looked like the following at the end of a subroutine you wrote (after pulling any data off the stack that you preserved during do-no-damage). If we used RTI rather than RTS to leave the subroutine, to what address would the program counter (PC) be set? [2 points]
M($00F7) = $C8
M($00F8) = $22
M($00F9) = $33
M($00FA) = $44
M($00FB) = $55
M($00FC) = $66
M($00FD) = $77
M($00FE) = $88
M($00FF) = $99
PC = ______
39)Reconsider question #38. In addition to the subroutine not returning to the correct place, what else would happen as a consequence of using RTI instead of RTS to leave the ISR? [2 points]
40)Which of the following will not wake up an HC11 microcontroller currently in the stopped state (due to execution of STOP instruction)? [2 points]
- IRQ
- XIRQ
- Timer overflow interrupt
- Reset
41)Assume a timer overflow interrupt has occurred. Write the minimum HC11 interrupt service routine required to properly handle the timer overflow interrupt and return the machine to normal operation (until the next timer overflow event). [4 points]
42)Assume real-time interrupts are enabled. If you needed to pulse an output pin of the microcontroller every 2 seconds, to what value would you set the RTR1 and RTR0 bits in the PACTL register and how many interrupts would you let lapse before you actually pulsed the output pin? [4 points]
43)Which of the following must be done to enable timer overflow interrupts in the HC11? [2 points]
- TOI bit in TMSK2 = 0, I-bit in CCR = 0
- TOI bit in TMSK2 = 1, I-bit in CCR = 0
- RTII bit in TMSK2 = 0, I-bit in CCR = 0
- RTII bit in TMSK2 = 1, I-bit in CCR = 0
44)What would you consider to be the primary explanation of interrupt latency? [2 points]
45)Name one utility/debugging subroutine we use in the lab that uses global memory parameter passing. [2 points]
Subroutine name = ______
The end.
1/6