Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- gcd:
- ldi r3 0
- beq r0 r3 gcd_zero
- gcd_loop:
- beq r1 r3 gcd_end
- bgt r0 r1 gcd_a_greater_than_b
- sub r1 r0
- jmp gcd_loop
- gcd_a_greater_than_b:
- sub r0 r1
- jmp gcd_loop
- gcd_zero:
- mov r2 r1
- rts
- gcd_end:
- mov r2 r0
- ldi r0 0
- ldi r1 0
- rts
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement