start: STP ; get input x: NOP y: NOP LDA x SUB y BRZ start ; x=y, A=0 loop: LDA x SUB one BRZ xy STA y JMP loop x>y: LDA one ; A := 1 JMP start x