ECE 473 - Embedded Systems

Assembly Programming Sample Questions

  1. Basic Skills
    1. Increment a 16-bit number stored in locations $2000 (high byte) and $2001 (low byte)
    2. Subtract a 32-bit number stored in locations $2000 (highest byte) - $2003 from a 32-bit number stored in locations $2004 - $2007; Store result in $2008 - $200B.
    3. Copy bits 7-4 of ACCA to bits 3-0 of ACCB without permanently modifying ACCA or bits 7-4 of ACCB
    4. Convert an 8-bit two’s complement number in ACCA to an equivalent 16-bit two’s complement number in ACCD (ACCA is the high byte of ACCD)
    5. Set ACCB to $FF if either bit 7 or bit 3 of ACCA are set; otherwise clear ACCB to 0.
    6. Perform an arithmetic right shift on a 32-bit number stored at $2000 (high byte) - $2003.
    7. Using ABX, transfer ACCA to IX without permanently modifying any other registers; use no more than 7 instructions total
    8. Find the smallest value (assuming signed numbers) in locations $0000 - $000E and store it in $000F

    9.  
  2. Parallel I/O Ports
    1. Configure PA7 for output.  Write a 1, then a 0, then a 1 to PA7 without modifying any other pins of Port A.
    2. Configure PD3 for input and PD4 for output.  In a continuous loop, read the value of PD3 and output that on PD4.  Do not modify any other pins of Port D.

  3. Interrupts
    1. If your program uses the ISRs RTI_ISR, OC1_ISR, SWI_ISR, show how to initialize Buffalo's interrupt vector jump table so your program will go to the correct ISR.
    2. Write a program to measure the length of a pulse coming in on pin 1 of port A (PA1).  As soon as PA1 goes high, the program should enable the RTI interrupt for the fastest possible rate.  It should then count the number of RTI interrupts before the pin goes low again.  The value should be saved in a 16-bit variable called COUNT.  Assume the number of counts is less than 65536 (216).
    3. Using the OC1 interrupt, toggle output pin PA6 every 10ms (i.e. 1, 0, 1, 0, ...).  Do not assume that you can obtain the current value of PA6 by reading Port A.