From 9d7f500f79cd20684669c73685f0b0936c7e2a4f Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Tue, 8 Apr 2025 17:48:21 +0200 Subject: [PATCH] simulation: wip simulation loop --- src/simulation.s | 24 ++++++++++++++++++++++++ src/wram.s | 3 ++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/simulation.s b/src/simulation.s index 3e5fb92..3cc9487 100644 --- a/src/simulation.s +++ b/src/simulation.s @@ -6,4 +6,28 @@ ; increments cell_idx every iteration ; resets cell_idx to 0 when end of cells is reached sim_update: + ld a, 0 ; max loop counter + + ; load back cell ptr from last iteration + ld a, [cell_ptr] + ld e, a + ld a, [cell_ptr+1] + ld d, a + + ; TODO + ; for now we just iterate all + ; cells in a single go + ; later we want a limit + ld de, state_cells +@loop: + + ; jp nz, @loop + + + ; finally store cell ptr + ld e, a + ld [cell_ptr], a + ld d, a + ld [cell_ptr+1], a + ret diff --git a/src/wram.s b/src/wram.s index 1742b51..349ca5b 100644 --- a/src/wram.s +++ b/src/wram.s @@ -59,7 +59,8 @@ r_population: .adv 2 ; current cell index ; for cell update loop -cell_idx: .adv 2 + ; big endian +cell_ptr: .adv 2 state_cells: .adv c_size * MAP_SIZE state_cells_end: -- 2.30.2