GBA BIOS: Fix some regressions regarding signed 16-bit loads (fixes #196)
Jeffrey Pfau jeffrey@endrift.com
Sat, 21 Feb 2015 10:58:24 -0800
1 files changed,
3 insertions(+),
3 deletions(-)
jump to
M
src/gba/bios.c
→
src/gba/bios.c
@@ -129,8 +129,8 @@ float a, b, c, d;
while (i--) { // [ sx 0 ] [ cos(theta) -sin(theta) ] [ A B ] // [ 0 sy ] * [ sin(theta) cos(theta) ] = [ C D ] - sx = cpu->memory.load16(cpu, offset, 0) / 256.f; - sy = cpu->memory.load16(cpu, offset + 2, 0) / 256.f; + sx = (int16_t) cpu->memory.load16(cpu, offset, 0) / 256.f; + sy = (int16_t) cpu->memory.load16(cpu, offset + 2, 0) / 256.f; theta = (cpu->memory.load16(cpu, offset + 4, 0) >> 8) / 128.f * M_PI; offset += 8; // Rotation@@ -335,7 +335,7 @@ bytes = (block >> 12) + 3;
while (bytes-- && remaining) { --remaining; if (width == 2) { - byte = cpu->memory.load16(cpu, disp & ~1, 0); + byte = (int16_t) cpu->memory.load16(cpu, disp & ~1, 0); if (dest & 1) { byte >>= (disp & 1) * 8; halfword |= byte << 8;