rectangle: added temporary storage for hl while refactoring is ongoing
authorLukas Krickl <lukas@krickl.dev>
Wed, 1 Oct 2025 15:53:57 +0000 (17:53 +0200)
committerLukas Krickl <lukas@krickl.dev>
Wed, 1 Oct 2025 15:53:57 +0000 (17:53 +0200)
src/hram.s
src/rectangle.s
src/wram.s

index 8935ae76ad8ce9f2967d76f2208558c4b3f5bbf0..98ec3842cd8d607aad56710ee31e6b1ddfefdf57 100644 (file)
@@ -1,3 +1,4 @@
 #define HRAM 0xFF80
 
 .org HRAM
+
index 528c1cb604ca942f6747867433ecdca0e30d3375..e8c8b776320dc0e7d95cb9e4daf0679b0c409299 100644 (file)
@@ -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
index f5f6ffe242d5c24cd719768c63aa625c23e1d40e..42cc100d891008997b6a2bf50b2220bb3c7f0813 100644 (file)
@@ -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
+
+
+