unit: Added oam flag setter to idle/active
authorLukas Krickl <lukas@krickl.dev>
Sat, 24 May 2025 16:24:21 +0000 (18:24 +0200)
committerLukas Krickl <lukas@krickl.dev>
Sat, 24 May 2025 16:24:21 +0000 (18:24 +0200)
src/hw.inc
src/unit.s

index c2f9aa0cd33407d4d4a1d07afba8189dffc35160..513c4057a94e030ffad30ae19c96672528cb6cb8 100644 (file)
@@ -86,6 +86,7 @@
 
 #define OAM_FYFLIP 0b01000000
 #define OAM_FXFLIP 0b00100000
+#define OAM_DMG_PAL 0b00010000
 
 ; MBC1 registers
 
index c20d1c8b3d4e0b0e56f1b6516c4a48c8d85b029e..195d5269eed0762a2253e78bab662d8500bd2e7c 100644 (file)
@@ -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