From: Lukas Krickl Date: Wed, 1 Oct 2025 15:53:57 +0000 (+0200) Subject: rectangle: added temporary storage for hl while refactoring is ongoing X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=6dcda1ec37c7d81552347bad12b4e7d3795bc8ac;p=gbrg%2F.git rectangle: added temporary storage for hl while refactoring is ongoing --- diff --git a/src/hram.s b/src/hram.s index 8935ae7..98ec384 100644 --- a/src/hram.s +++ b/src/hram.s @@ -1,3 +1,4 @@ #define HRAM 0xFF80 .org HRAM + diff --git a/src/rectangle.s b/src/rectangle.s index 528c1cb..e8c8b77 100644 --- a/src/rectangle.s +++ b/src/rectangle.s @@ -159,16 +159,21 @@ rect_br: ; a == 1: inside ; a == 0: not inside rect_point_test: - ; bottom left - push hl + ; TODO: remove store hl + ld a, h + ld [h2], a + ld a, l + ld [l2], a + inc hl ; skip mask + ; bottom left + ; load bottom left point ld a, [hl+] ld d, a ; d = y ld a, [hl] ld e, a ; e = x - pop hl ld a, b ; compare y cp a, d @@ -177,6 +182,12 @@ rect_point_test: cp a, e jr c, @no_collision REL + ; TODO: remove restore hl + ld a, [h2] + ld h, a + ld a, [l2] + ld l, a + ; top left push hl call rect_tl diff --git a/src/wram.s b/src/wram.s index f5f6ffe..42cc100 100644 --- a/src/wram.s +++ b/src/wram.s @@ -117,3 +117,16 @@ dbg_fn: .adv 1 dbg_rect: .adv 2 dbg_delay: .adv 1 + + + ; shadow registers +a2: .adv 1 +b2: .adv 1 +c2: .adv 1 +d2: .adv 1 +e2: .adv 1 +h2: .adv 1 +l2: .adv 1 + + +