* ======================================================== *
*  Thomas C. Penick   ID# 452 80 6040         Program   3  *
*  EE319K Microprocessor Programming          due 2/20/98  *
*  Instructor: Laurence                       Section   B  *
*  MC6811 Program Source Code  PA3.asm        Roster#      *
*  How to Hand Assemble Source Code                        *
* ======================================================== *

       org  $E000    ; start of ROM
Main   lds  #$00FF   ; initialize the stack pointer
       ldx  First    ; place first no. in X
       ldy  Second   ; place second number in Y
       bsr  Max      ; call Max for largest
       stop

       bra  Main
First  fdb  5        ; first number
Second fdb  9        ; second number

Max    pshy          ; put Y on the stack
       pshx          ; put X on the stack
       tsx           ; get the stack pointer
       cpy  0,X      ; compare the nos, (Y-stack)
       bgt  Mout     ; Is second largest?
       ldd  0,X      ; put the first in D
       bra  Mdone
Mout   xgdy          ; put second number in D
Mdone  pulx          ; restore X
       puly          ; restore Y
       rts           ; return

outmsg fcb  CR
       fcc  "Largest Is:"
       fcb  EOT
       org  $FFFE
       fdb  Main
       end


