Dekejit/tests/assembly/loop.grasm

18 lines
298 B
Plaintext
Raw Normal View History

2023-05-03 23:47:26 +02:00
;; Small program that counts to 10. Yay!
.text main
addi t1 10
sub t0 t0 t0 ; set t0 = 0
addi t2 loop ; set t2 to loop's addr.
addi t3 end ; set t3 to end's addr
.text loop
call t0 0 ; print t0
addi t0 1 ; t0 = t0 + 1;
beq t3 t1 t0
beq t2 zero zero
.text end
halt