From: Lukas Krickl Date: Tue, 8 Apr 2025 18:04:38 +0000 (+0200) Subject: simulation: Added cell update loop X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=33b120016afb87dfe906d82bd7a90621b91f3c04;p=gbrg%2F.git simulation: Added cell update loop --- 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