all repos — mgba @ 3cd5e8d093a84fee62d1832d90a37e0bbc1870d9

mGBA Game Boy Advance Emulator

Implement Div
Jeffrey Pfau jeffrey@endrift.com
Fri, 26 Apr 2013 02:05:54 -0700
commit

3cd5e8d093a84fee62d1832d90a37e0bbc1870d9

parent

d2e84f0a3034548cd9326e15127b045b135c7098

1 files changed, 8 insertions(+), 0 deletions(-)

jump to
M src/gba/gba-bios.csrc/gba/gba-bios.c

@@ -96,6 +96,14 @@ }

gba->memory.io[REG_IF >> 1] = 0; ARMRaiseSWI(&gba->cpu); break; + case 0x6: + { + div_t result = div(gba->cpu.gprs[0], gba->cpu.gprs[1]); + gba->cpu.gprs[0] = result.quot; + gba->cpu.gprs[1] = result.rem; + gba->cpu.gprs[2] = abs(result.quot); + } + break; case 0xB: _CpuSet(gba); break;