RosettaCodeData/Task/Integer-comparison/Computer-zero-Assembly/integer-comparison.computer
2016-12-05 23:44:36 +01:00

28 lines
380 B
Text

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