From 8d8f37d4aa96ff4c926fd129f3d0593c8ab777ec Mon Sep 17 00:00:00 2001 From: zerico <71151164+ZERICO2005@users.noreply.github.com> Date: Mon, 20 Oct 2025 14:12:05 -0600 Subject: [PATCH] fixed gfx_AllocSprite return value bug --- src/graphx/graphx.asm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/graphx/graphx.asm b/src/graphx/graphx.asm index e175e14ce..9bb4da952 100644 --- a/src/graphx/graphx.asm +++ b/src/graphx/graphx.asm @@ -388,10 +388,12 @@ gfx_AllocSprite: inc de ; de = width * height + 2 push de call _indcallHL ; hl = malloc(width * height + 2) - pop de ; de = width * height + 2 - add hl, de ; this should never carry - sbc hl, de ; check if malloc failed (hl == 0) - pop de ; e = width, d = height + pop de + pop de ; e = width, d = height, ude = unknown + ; check if malloc failed (hl == 0) + add hl, de + or a, a + sbc hl, de ret z ; abort if malloc failed ld (hl), de ; store width and height ret