projects
/
gbrg
/
.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
9d7f500
)
simulation: Added cell update loop
author
Lukas Krickl
<lukas@krickl.dev>
Tue, 8 Apr 2025 18:04:38 +0000
(20:04 +0200)
committer
Lukas Krickl
<lukas@krickl.dev>
Tue, 8 Apr 2025 18:04:38 +0000
(20:04 +0200)
src/macros.inc
patch
|
blob
|
history
src/simulation.s
patch
|
blob
|
history
diff --git
a/src/macros.inc
b/src/macros.inc
index 4f42bbb392c3e6f14ee3d57a1a04e995aff4b557..8c80e8188215a7423651a4be56e54e73d0aa240f 100644
(file)
--- 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 3cc948721d50d35f850b345904cea561aedff571..fb8420333315e858747dbc912a640f88feab11a2 100644
(file)
--- 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