* ======================================================== *
*  Thomas C. Penick   ID# 452 80 6040         Program   1  *
*  EE319K Microprocessor Programming          due  2/6/98  *
*  Instructor: Laurence                       Section   B  *
*  MC6811 Program Source Code  1.asm          Roster#      *
* ======================================================== *

      org  0          Globals go in Ram
M     rmb  1          Copy of Input from Port E
      org  $E000      Object code goes in ROM
Main  lds  #$00FF     Stack grows down from $00FF
      clr  Ddrc       Make all pins of Port C input

* Display N
Start ldaa Portc      Read switch values from Port C
      staa Portb      Output N to lights
      stop            Displaying N

* Display M
      ldab Porte      Read switch values from Port E
      stab Portb      Output M to lights
      stop            Displaying M

* Display N+M
      ldaa Portc      Read switch values from Port C
      ldab Porte      Read switch values from Port E
      aba             A+B -> A
      staa Portb      Output RegA to lights
      stop            Displaying N+M

* Display N-M
      ldaa Portc      Read switch values from Port C
      ldab Porte      Read switch values from Port E
      stab M          Save a copy in variable M
      suba M          A-M -> A
      staa Portb      Output RegA to lights
      stop            Displaying N-M

* Display N OR M
      ldaa Portc      Read switch values from Port C
      ldab Porte      Read switch values from Port E
      stab M          Save a copy in variable M
      oraa M          A OR N -> A
      staa Portb      Output RegA to lights
      stop            Displaying N OR M

* Display N AND M
      ldaa Portc      Read switch values from Port C
      ldab Porte      Read switch values from Port E
      stab M          Save a copy in variable M
      anda M          A AND N -> A
      staa Portb      Output RegA to lights
      stop            Displaying N AND M

* Display N EOR M
      ldaa Portc      Read switch values from Port C
      ldab Porte      Read switch values from Port E
      stab M          Save a copy in variable M
      eora M          A EOR N -> A
      staa Portb      Output RegA to lights
      stop            Displaying N EOR M

* Display N/2 (arithmetic shift right)
      ldaa Portc      Read switch values from Port C
      asra            A/2 -> A
      staa Portb      Output RegA to lights
      stop            Displaying N/2 (arithmetic shift right)

* Display 2*N (arithmetic shift left)
      ldaa Portc      Read switch values from Port C
      asla            A*2 -> A
      staa Portb      Output RegA to lights
      stop            Displaying 2*N (arithmetic shift left)

* Display N/2 (logical shift right)
      ldaa Portc      Read switch values from Port C
      lsra            A/2 -> A
      staa Portb      Output RegA to lights
      stop            Displaying N/2 (logical shift right)

* Display 2*N (logical shift left)
      ldaa Portc      Read switch values from Port C
      lsla            A*2 -> A
      staa Portb      Output RegA to lights
      stop            Displaying 2*N (logical shift left)

      jmp  Start      Return to the first operation
      org  $FFFE
      fdb  Main       Starting address after a RESET
      end


