Use a limit on $I rather than on $B for examples/fib.asm

This commit is contained in:
2023-11-29 23:14:01 +00:00
parent af142e71ff
commit 04a27bcfec

View File

@@ -5,7 +5,7 @@
;;; stack version. ;;; stack version.
;; Constants ;; Constants
%const(limit) 12200160415121876738 %end %const(limit) 93 %end
%const(increment_i) %const(increment_i)
push.reg.word 2 push.reg.word 2
@@ -57,10 +57,10 @@ loopback:
plus.word plus.word
mov.word 1 mov.word 1
;; IF $B >= $LIMIT ... ;; IF $I < $LIMIT ...
push.reg.word 2
push.word $limit push.word $limit
push.reg.word 1 lt.word
gte.word
;; THEN jump to `loopback` ;; THEN jump to `loopback`
jump.if.byte loopback jump.if.byte loopback
;; ELSE halt ;; ELSE halt