From 4e2d85691d4381bcd6672612a2df0de1cfd92811 Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Sat, 24 May 2025 18:24:21 +0200 Subject: [PATCH] unit: Added oam flag setter to idle/active --- src/hw.inc | 1 + src/unit.s | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/hw.inc b/src/hw.inc index c2f9aa0..513c405 100644 --- a/src/hw.inc +++ b/src/hw.inc @@ -86,6 +86,7 @@ #define OAM_FYFLIP 0b01000000 #define OAM_FXFLIP 0b00100000 +#define OAM_DMG_PAL 0b00010000 ; MBC1 registers diff --git a/src/unit.s b/src/unit.s index c20d1c8..195d526 100644 --- a/src/unit.s +++ b/src/unit.s @@ -70,9 +70,15 @@ unit_demo_1_init: ; inputs ; de: actor unit_demo_1_update: - ; TODO: call with correct values - ldnull hl - ld a, 1 ; hard-coded action remaining + push de + ld hl, act_oam_flags + add hl, de + ld a, [hl] + or a, OAM_DMG_PAL + ld [hl], a + pop de + + push de call unit_handle_inputs pop de @@ -590,6 +596,13 @@ unit_delay_to_active: ; inputs ; de: actor unit_idle: + ; turn on OAM Palette 0 + ld hl, act_oam_flags + add hl, de + ld a, [hl] + and a, ~OAM_DMG_PAL & 0xFF + ld [hl], a + ldnull bc ret -- 2.30.2