EE 2361 - Introduction to Microcontrollers
Summer Term, 2005
Homework Assignment 1
Due: Friday, June 24

  1. Convert each of the following decimal numbers into an 8-bit unsigned binary number:
    1. 253
    2. 17
    3. 128

  2. Convert each of the following unsigned hex numbers into decimal:
    1. $ABCD
    2. $7008
    3. $2F

  3. Three 8-bit signed numbers are given below, expressed in hex format. Compute the two's complement of each number and express your answers in hex format. Also, give the decimal equivalents of each original number and its two's complement.
    1. $AC
    2. $07
    3. $FE

  4. Sign-extend each of the following 8-bit signed numbers expressed in hex format to a 16-bit signed number expressed in hex format:
    1. $92
    2. $7F

  5. Perform the indicated 16-bit arithmetic operations assuming all of the numbers are signed. Express your answers as 16-bit signed numbers in hex format. In each case, indicate whether or not a signed overflow occurs.
    1. $80CD + $1701
    2. $80CD + $8701
    3. $80CD - $8701
    4. $8701 - $70CD

  6. Give the addressing mode and the effective address for each of the following instructions. Assume that index register X contains $1234 and index register Y contains $A321.

    1. stab 4, x
    2. ldab 9, y
    3. ldaa $F0AB
    4. staa $DE
    5. ldab #$88

  7. For each of the instructions given in question 6 above, draw a diagram that shows the byte in memory at the effective address, the relevant accumulator (i.e, A or B), and an arrow indicating the transfer of information from one place to the other.


  8. Suppose that register D contains $3456, index register X contains $1234 and index register Y contains $A321. Also, assume that a portion of memory is configured as follows:

    Address Data
    $9000 $AC
    $9001 $BD
    $9002 $00
    $9003 $FF
    $9004 $DE
    $9005 $34

    Suppose that the following sequence of instructions are executed. Give the contents of registers D, X, and Y, and the contents of memory locations $9000 - $9005 after the last instruction has been executed.

    ldd $9004
    stx $9004
    sty $9000
    ldy $9002
    ldx #$FEDC