RosettaCodeData/Task/Integer-comparison/Computer-zero-Assembly/integer-comparison.0asm

29 lines
380 B
Plaintext

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