From 33b120016afb87dfe906d82bd7a90621b91f3c04 Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Tue, 8 Apr 2025 20:04:38 +0200 Subject: [PATCH] simulation: Added cell update loop --- src/macros.inc | 4 ++++ src/simulation.s | 14 +++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/macros.inc b/src/macros.inc index 4f42bbb..8c80e81 100644 --- a/src/macros.inc +++ b/src/macros.inc @@ -35,6 +35,9 @@ #define NEGATE -1 & 0xFF +#define LO & 0xFF +#define HI >> 4 & 0xFF + #macro dblo .db $1 & 0xFF #endmacro @@ -153,3 +156,4 @@ .str $1 .db 0 #endmacro + diff --git a/src/simulation.s b/src/simulation.s index 3cc9487..fb84203 100644 --- a/src/simulation.s +++ b/src/simulation.s @@ -20,10 +20,18 @@ sim_update: ; later we want a limit ld de, state_cells @loop: - - ; jp nz, @loop - + ; advance to next cell + .rep i, c_size, 1, inc de + + ; check if we need to exit + ld a, state_cells_end LO + cp a, e + jp nz, @loop + ld a, state_cells_end HI + cp a, d + jp nz, @loop + ; finally store cell ptr ld e, a ld [cell_ptr], a -- 2.30.2