simulation: Added cell update loop
authorLukas Krickl <lukas@krickl.dev>
Tue, 8 Apr 2025 18:04:38 +0000 (20:04 +0200)
committerLukas Krickl <lukas@krickl.dev>
Tue, 8 Apr 2025 18:04:38 +0000 (20:04 +0200)
src/macros.inc
src/simulation.s

index 4f42bbb392c3e6f14ee3d57a1a04e995aff4b557..8c80e8188215a7423651a4be56e54e73d0aa240f 100644 (file)
@@ -35,6 +35,9 @@
 
 #define NEGATE -1 & 0xFF
 
+#define LO & 0xFF
+#define HI >> 4 & 0xFF
+
 #macro dblo 
 .db $1 & 0xFF
 #endmacro 
   .str $1
   .db 0
 #endmacro
+
index 3cc948721d50d35f850b345904cea561aedff571..fb8420333315e858747dbc912a640f88feab11a2 100644 (file)
@@ -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