Improve BIOS Math tests score from 425 to 625.

Without using BIOS file.
This commit is contained in:
Edênis Freindorfer Azevedo 2020-07-08 20:03:04 -03:00 committed by Edênis Freindorfer Azevedo
parent 6f2e320d59
commit 3ba0529585
2 changed files with 7 additions and 4 deletions

View File

@ -2132,6 +2132,7 @@ void CPUSoftwareInterrupt(int comment)
break; break;
case 0x0A: case 0x0A:
BIOS_ArcTan2(); BIOS_ArcTan2();
reg[3].I = 0x170;
break; break;
case 0x0B: { case 0x0B: {
int len = (reg[2].I & 0x1FFFFF) >> 1; int len = (reg[2].I & 0x1FFFFF) >> 1;

View File

@ -52,7 +52,8 @@ void BIOS_ArcTan()
} }
#endif #endif
int32_t a = -(((int32_t)(reg[0].I * reg[0].I)) >> 14); int32_t i = reg[0].I;
int32_t a = -((i*i) >> 14);
int32_t b = ((0xA9 * a) >> 14) + 0x390; int32_t b = ((0xA9 * a) >> 14) + 0x390;
b = ((b * a) >> 14) + 0x91C; b = ((b * a) >> 14) + 0x91C;
b = ((b * a) >> 14) + 0xFB6; b = ((b * a) >> 14) + 0xFB6;
@ -60,8 +61,9 @@ void BIOS_ArcTan()
b = ((b * a) >> 14) + 0x2081; b = ((b * a) >> 14) + 0x2081;
b = ((b * a) >> 14) + 0x3651; b = ((b * a) >> 14) + 0x3651;
b = ((b * a) >> 14) + 0xA2F9; b = ((b * a) >> 14) + 0xA2F9;
a = ((int32_t)reg[0].I * b) >> 16; reg[0].I = (i * b) >> 16;
reg[0].I = a; reg[1].I = a;
reg[3].I = b;
#ifdef GBA_LOGGING #ifdef GBA_LOGGING
if (systemVerbose & VERBOSE_SWI) { if (systemVerbose & VERBOSE_SWI) {
@ -84,7 +86,7 @@ void BIOS_ArcTan2()
int32_t x = reg[0].I; int32_t x = reg[0].I;
int32_t y = reg[1].I; int32_t y = reg[1].I;
uint32_t res = 0; int32_t res = 0;
if (y == 0) { if (y == 0) {
res = ((x >> 16) & 0x8000); res = ((x >> 16) & 0x8000);
} else { } else {