From f2bef353f55317c8371c6856048b5e11b8ecf1c2 Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Mon, 8 Dec 2025 05:50:15 +0100 Subject: [PATCH] sys: optimized oamalloc slightly --- src/sys.s | 13 ++++++------- src/wram.s | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/sys.s b/src/sys.s index c2d41f0..711367e 100644 --- a/src/sys.s +++ b/src/sys.s @@ -66,13 +66,12 @@ call_tbl: oamalloc: push af ld a, [current_oam_obj] - - - ld d, 0 - ld e, a - ld hl, shadow_oam - - add hl, de ; hl = next oam + ld hl, current_oam_obj + ld l, [hl] ; load low byte + ; this works because current_oam_obj is in the same bank + ; as shadown oam + + ; hl = next oam object ; next object ld b, a diff --git a/src/wram.s b/src/wram.s index 11b0b4c..9ab5bb9 100644 --- a/src/wram.s +++ b/src/wram.s @@ -4,11 +4,11 @@ ; needs to be at the start or alinged properly for DMA! shadow_oam: .adv OBJSMAX * oamsize shadow_oam_end: +current_oam_obj: .adv 1 frame_ready: .adv 1 frame_count: .adv 1 -current_oam_obj: .adv 1 ; current frame's inputs curr_inputs: .adv 1 -- 2.30.2