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.
This commit is contained in:
Carsten Teibes
2020-07-10 02:04:22 +02:00
parent 526d0423b4
commit 30c8272ba3

View File

@@ -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;