From 1effe3ede977b2497f44c8523bbe175f3c569b1f Mon Sep 17 00:00:00 2001 From: Brad Nelson Date: Mon, 7 Mar 2022 14:55:11 -0800 Subject: [PATCH] Allocate heart memory on demand, rename one file. --- common/{grf_test.fs => graphics_test.fs} | 0 common/heart.fs | 13 ++++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) rename common/{grf_test.fs => graphics_test.fs} (100%) diff --git a/common/grf_test.fs b/common/graphics_test.fs similarity index 100% rename from common/grf_test.fs rename to common/graphics_test.fs diff --git a/common/heart.fs b/common/heart.fs index 0a56123..b2b7498 100644 --- a/common/heart.fs +++ b/common/heart.fs @@ -34,15 +34,18 @@ graphics internals definitions 4000 constant heart-steps 1024 constant heart-size -create heart-start heart-size allot -create heart-end heart-size allot -heart-start heart-size 0 fill -heart-end heart-size 0 fill +0 value heart-start +0 value heart-end : cmin! ( n a ) dup >r c@ min r> c! ; : cmax! ( n a ) dup >r c@ max r> c! ; : heart-initialize + heart-start if exit then + heart-size allocate throw to heart-start + heart-size allocate throw to heart-end + heart-start heart-size 0 fill + heart-end heart-size 0 fill heart-start heart-size 7 29 */ 128 fill heart-end heart-size 7 29 */ 128 fill heart-steps 0 do @@ -59,7 +62,7 @@ heart-end heart-size 0 fill 512 29 32 */ constant heart-ratio : raw-heart 0 { x y sx sy r } - heart-start c@ 0= if heart-initialize then + heart-initialize y sy 2/ - to y sy 0< if y sy + to y