ECE
473 - Embedded Systems
Assembly
Programming Sample Questions
-
Basic
Skills
- Increment
a 16-bit number stored in locations $2000 (high byte) and $2001 (low byte)
- 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.
- Copy bits
7-4 of ACCA to bits 3-0 of ACCB without permanently modifying ACCA or
bits 7-4 of ACCB
- 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)
- Set ACCB
to $FF if either bit 7 or bit 3 of ACCA are set; otherwise clear ACCB
to 0.
- Perform an
arithmetic right shift on a 32-bit number stored at $2000 (high byte)
- $2003.
- Using ABX,
transfer ACCA to IX without permanently modifying any other registers;
use no more than 7 instructions total
- Find the
smallest value (assuming signed numbers) in locations $0000 - $000E and
store it in $000F
-
Parallel
I/O Ports
- Configure
PA7 for output. Write a 1, then a 0, then a 1 to PA7 without modifying
any other pins of Port A.
- 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.
-
Interrupts
- 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.
- 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).
- 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.