;
; Solution to 3.5
;
;     S.Norr
;
;Built to test in THRSim11

      org 0
      db 00,01,02,03,05,32,0a,07,08
      org ff00
      ldx #0
      jsr Even2
      pula
End:  bra End


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Even2:
            ; A subroutine which locates the
            ; first two consecutive bytes of
            ; data in memory which are both even.
            ; Input Parameters: Index Reg X points
            ;               to starting location
            ;               in memory
            ; Output Parameters: First byte is passed to
            ;                to the stack
            ; This routine corrupts D and X registers
      puly
EveA: ldd 0,x
      anda #1
      beq EveB
      inx
      bra EveA
EveB: andb #1
      beq EvStr
      inx
      bra EveA
EvStr:      ldd 0,x
      psha
      pshy
      rts
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;