COE 538 Quiz

 

Name: _____________________________     Student #: __________________     Time: 50 min.

 

 

Notes:

 

  1. Close book
  2. Neatly write the answers in the space provided
  3. The Instruction Set can be detached

 

 

1.      Write assembler directives to reserve 100 bytes from $6000.                            [1 mark]

 

                                    ORG   $6000

                                    RMB   100

 

 

 

2.      Assume that the E-clock signal frequency is 1 MHz. Write a program to create a time delay of 100 µS.                                                                                                                [3 marks]

 

 

                                    LDY     #14

                        del       DEY   

                                    BNE    del

 

 

 

 

 

3.      Given a program listing below, trace the results for each instruction from start to end. What are the contents of the memory locations at $6010 and $6011 after the execution of the swi instruction?                                                                                              [6 marks]

           

            Note: ASCII codes for characters t, =, and @, are $74, $3D, and $40 respectively.

 

 

            org       $6000

            temp    fcc       ‘t=@’

                                                           

                        org       $6010

            res       fdb       $4, $20

                                                           

                        org       $6050

            start     ldx        #temp              ;x = $6000      

                        ldaa     2, x                  ;a = $40

                        ldy        #res                 ;y = $6010

                        ldab     1, y                  ;b = $04

            end      mul                              ;d = $0101

            loop     deca                           

                        bne      loop                

                  std       res                   [$6010] = 00                [$6011] = 00

                  swi                              

 

4.      Write a program (only one program):

 

-       to multiply the contents of the memory location at $6000 by the contents of the memory location at $6001                                                                               [2 marks]

-       to add the contents of the memory location at $6050 to the product computed above and save the result at $7000 and $7001                                                           [3 marks]

 

           

 

                                    LDAA   $6000

                                    LDAB  $6001

                                    MUL

                                   

                                    ADDD  $6050

                                    STD    $7000

 

 

 

 

 

 

 

 

 

 

 

 

5.      Write a code that sets two most significant bits and clears two least significant bits of Accumulator A.                                                                                                                 [2 marks]

 

 

                                    ORAA  #% 1100 0000

                                    ANDA  #% 1111 1100

 

 

 

 

 

 

6.       Assume that the result of the A-to-D conversion of a DC voltage Vx at the channel 0 of the ADC is $57. What is the value of the voltage Vx in Volts, if VREFL=0 V and VREFH=5 V?                                                                                                                                          [2 marks]

 

 

                                    $57 = 87

 

                                    255 / 87 = 5 / Vx

 

                                                Vx = 5x87 / 255 = 1.71 [V]