From 30c8272ba3a159c68bd31c18c7cbe5b25843ba66 Mon Sep 17 00:00:00 2001 From: Carsten Teibes Date: Fri, 10 Jul 2020 02:04:22 +0200 Subject: [PATCH] Do not use a0 register in pspgum Fixes some examples (see #26) Reason is newlib's `memset()` clobbers the a0 register, meaning that `t` points to garbage after the call. --- src/gum/pspgum.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gum/pspgum.c b/src/gum/pspgum.c index 1ad2a5ef..52ed0306 100644 --- a/src/gum/pspgum.c +++ b/src/gum/pspgum.c @@ -439,7 +439,7 @@ void sceGumMultMatrix(const ScePspFMatrix4* m) #ifdef F_sceGumOrtho void sceGumOrtho(float left, float right, float bottom, float top, float near, float far) { - register ScePspFMatrix4* t __asm("a0") = GUM_ALIGNED_MATRIX(); + register ScePspFMatrix4* t = GUM_ALIGNED_MATRIX(); float dx = right-left, dy = top-bottom, dz = far-near; memset(t,0,sizeof(ScePspFMatrix4)); @@ -462,7 +462,7 @@ void sceGumPerspective(float fovy, float aspect, float near, float far) float angle = (fovy / 2) * (GU_PI/180.0f); float cotangent = cosf(angle) / sinf(angle); float delta_z = near-far; - register ScePspFMatrix4* t __asm("a0") = GUM_ALIGNED_MATRIX(); + register ScePspFMatrix4* t = GUM_ALIGNED_MATRIX(); memset(t,0,sizeof(ScePspFMatrix4)); t->x.x = cotangent / aspect;