cells: Added update loop
authorLukas Krickl <lukas@krickl.dev>
Sun, 20 Apr 2025 18:12:00 +0000 (20:12 +0200)
committerLukas Krickl <lukas@krickl.dev>
Sun, 20 Apr 2025 18:12:00 +0000 (20:12 +0200)
The simulation update loop currently updates all cells in a single
frame.
This is way too slow and will need to be split up.

src/cells.s
src/macros.inc
src/update.s

index 84f8ca228a8e9af29b232a2bdf088b0d0826a777..afffd51d19a21fd0944c8f46bc0601b48948787b 100644 (file)
@@ -9,7 +9,7 @@ cell_update:
   ld a, [de] ; a = head offset
   and a, CF_HEAD
   ; if not head cell return
-  ret nz
+  ret z
 
   ; save cell ptr
   dec de ; de is c_type
@@ -44,9 +44,9 @@ cell_update:
   ; de = c_st_routine 
 
   ; store next routine 
-  ld a, b
-  ld [de], a
   ld a, c
+  ld [de], a
+  ld a, b
   inc de
   ld [de], a
 
index 0703018ced23a7371be82d93e6e3a1c345555e3b..a4f6367e03c7841659620f166dd3759401b2f439 100644 (file)
@@ -36,7 +36,7 @@
 #define NEGATE -1 & 0xFF
 
 #define LO & 0xFF
-#define HI >> 4 & 0xFF
+#define HI >> 8 & 0xFF
 
 #macro dblo 
 .db $1 & 0xFF
index 2e6c2d5c7d2f0a0f84c948b6adb2411c375dedae..422383af2b7f80812fc44156bae7c0e4d68dac53 100644 (file)
@@ -9,7 +9,7 @@ update_game:
   ld de, actor_player 
   call st_update
 
-  call sim_update 
+  call sim_update 
 
   ldnull bc
   ret