mirror of https://github.com/mgba-emu/mgba.git
GBA BIOS: Improve HLE BIOS timing
This commit is contained in:
parent
7ea3728165
commit
8a8b4add91
1
CHANGES
1
CHANGES
|
@ -8,6 +8,7 @@ Emulation fixes:
|
|||
- GBA: Fix multiboot entry point while skipping BIOS
|
||||
- GBA BIOS: Fix undefined instruction HLE behavior
|
||||
- GBA BIOS: Implement dummy sound driver calls
|
||||
- GBA BIOS: Improve HLE BIOS timing
|
||||
- GBA DMA: Linger last DMA on bus (fixes mgba.io/i/301 and mgba.io/i/1320)
|
||||
- GBA Memory: Misaligned SRAM writes are ignored
|
||||
- GBA Memory: Improve gamepak prefetch timing
|
||||
|
|
|
@ -431,8 +431,8 @@ void GBASwi16(struct ARMCore* cpu, int immediate) {
|
|||
_RegisterRamReset(gba);
|
||||
break;
|
||||
case GBA_SWI_HALT:
|
||||
GBAHalt(gba);
|
||||
break;
|
||||
ARMRaiseSWI(cpu);
|
||||
return;
|
||||
case GBA_SWI_STOP:
|
||||
GBAStop(gba);
|
||||
break;
|
||||
|
@ -442,7 +442,7 @@ void GBASwi16(struct ARMCore* cpu, int immediate) {
|
|||
case GBA_SWI_INTR_WAIT:
|
||||
// IntrWait
|
||||
ARMRaiseSWI(cpu);
|
||||
break;
|
||||
return;
|
||||
case GBA_SWI_DIV:
|
||||
_Div(gba, cpu->gprs[0], cpu->gprs[1]);
|
||||
break;
|
||||
|
@ -472,7 +472,7 @@ void GBASwi16(struct ARMCore* cpu, int immediate) {
|
|||
mLOG(GBA_BIOS, GAME_ERROR, "Misaligned CpuSet destination");
|
||||
}
|
||||
ARMRaiseSWI(cpu);
|
||||
break;
|
||||
return;
|
||||
case GBA_SWI_GET_BIOS_CHECKSUM:
|
||||
cpu->gprs[0] = GBA_BIOS_CHECKSUM;
|
||||
cpu->gprs[1] = 1;
|
||||
|
@ -577,7 +577,7 @@ void GBASwi16(struct ARMCore* cpu, int immediate) {
|
|||
break;
|
||||
case GBA_SWI_SOUND_DRIVER_GET_JUMP_LIST:
|
||||
ARMRaiseSWI(cpu);
|
||||
break;
|
||||
return;
|
||||
default:
|
||||
mLOG(GBA_BIOS, STUB, "Stub software interrupt: %02X", immediate);
|
||||
}
|
||||
|
|
|
@ -3,38 +3,44 @@
|
|||
#include <mgba/internal/gba/memory.h>
|
||||
|
||||
const uint8_t hleBios[SIZE_BIOS] = {
|
||||
0x06, 0x00, 0x00, 0xea, 0x58, 0x00, 0x00, 0xea, 0x0b, 0x00, 0x00, 0xea,
|
||||
0x06, 0x00, 0x00, 0xea, 0x66, 0x00, 0x00, 0xea, 0x0b, 0x00, 0x00, 0xea,
|
||||
0xfe, 0xff, 0xff, 0xea, 0xfe, 0xff, 0xff, 0xea, 0x00, 0x00, 0xa0, 0xe1,
|
||||
0x4b, 0x00, 0x00, 0xea, 0xfe, 0xff, 0xff, 0xea, 0x02, 0x03, 0xa0, 0xe3,
|
||||
0x03, 0x10, 0xd0, 0xe5, 0xea, 0x00, 0x51, 0xe3, 0x14, 0x01, 0x9f, 0x15,
|
||||
0x59, 0x00, 0x00, 0xea, 0xfe, 0xff, 0xff, 0xea, 0x02, 0x03, 0xa0, 0xe3,
|
||||
0x03, 0x10, 0xd0, 0xe5, 0xea, 0x00, 0x51, 0xe3, 0x4c, 0x01, 0x9f, 0x15,
|
||||
0x10, 0xff, 0x2f, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x29, 0xe1,
|
||||
0x00, 0x00, 0x5d, 0xe3, 0x01, 0xd3, 0xa0, 0x03, 0x20, 0xd0, 0x4d, 0x02,
|
||||
0x00, 0x58, 0x2d, 0xe9, 0x02, 0xb0, 0x5e, 0xe5, 0x9c, 0xc0, 0xa0, 0xe3,
|
||||
0x00, 0x58, 0x2d, 0xe9, 0x02, 0xb0, 0x5e, 0xe5, 0xd4, 0xc0, 0xa0, 0xe3,
|
||||
0x0b, 0xb1, 0x9c, 0xe7, 0x00, 0x00, 0x5b, 0xe3, 0x00, 0xc0, 0x4f, 0xe1,
|
||||
0x00, 0x10, 0x2d, 0xe9, 0x80, 0xc0, 0x0c, 0xe2, 0x1f, 0xc0, 0x8c, 0xe3,
|
||||
0x0c, 0xf0, 0x29, 0xe1, 0x00, 0x40, 0x2d, 0xe9, 0x0f, 0xe0, 0xa0, 0xe1,
|
||||
0x1b, 0xff, 0x2f, 0x11, 0x00, 0x40, 0xbd, 0xe8, 0x93, 0xf0, 0x29, 0xe3,
|
||||
0x00, 0x10, 0xbd, 0xe8, 0x0c, 0xf0, 0x69, 0xe1, 0x00, 0x58, 0xbd, 0xe8,
|
||||
0x0e, 0xf0, 0xb0, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x04, 0x20, 0xa0, 0xe3,
|
||||
0x78, 0x01, 0x00, 0x00, 0x78, 0x01, 0x00, 0x00, 0x78, 0x01, 0x00, 0x00,
|
||||
0x78, 0x01, 0x00, 0x00, 0x84, 0x01, 0x00, 0x00, 0x7c, 0x01, 0x00, 0x00,
|
||||
0x78, 0x01, 0x00, 0x00, 0x78, 0x01, 0x00, 0x00, 0x78, 0x01, 0x00, 0x00,
|
||||
0x78, 0x01, 0x00, 0x00, 0x78, 0x01, 0x00, 0x00, 0xcc, 0x01, 0x00, 0x00,
|
||||
0x60, 0x02, 0x00, 0x00, 0x78, 0x01, 0x00, 0x00, 0x78, 0x01, 0x00, 0x00,
|
||||
0x78, 0x01, 0x00, 0x00, 0x78, 0x01, 0x00, 0x00, 0x78, 0x01, 0x00, 0x00,
|
||||
0x78, 0x01, 0x00, 0x00, 0x78, 0x01, 0x00, 0x00, 0x78, 0x01, 0x00, 0x00,
|
||||
0x78, 0x01, 0x00, 0x00, 0x78, 0x01, 0x00, 0x00, 0x78, 0x01, 0x00, 0x00,
|
||||
0x78, 0x01, 0x00, 0x00, 0x78, 0x01, 0x00, 0x00, 0x78, 0x01, 0x00, 0x00,
|
||||
0x78, 0x01, 0x00, 0x00, 0x78, 0x01, 0x00, 0x00, 0x78, 0x01, 0x00, 0x00,
|
||||
0x78, 0x01, 0x00, 0x00, 0x78, 0x01, 0x00, 0x00, 0x78, 0x01, 0x00, 0x00,
|
||||
0x78, 0x01, 0x00, 0x00, 0x78, 0x01, 0x00, 0x00, 0x78, 0x01, 0x00, 0x00,
|
||||
0x78, 0x01, 0x00, 0x00, 0x78, 0x01, 0x00, 0x00, 0x78, 0x01, 0x00, 0x00,
|
||||
0x78, 0x01, 0x00, 0x00, 0x78, 0x01, 0x00, 0x00, 0x78, 0x01, 0x00, 0x00,
|
||||
0xb8, 0x02, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x02, 0x0f, 0x50, 0x2d, 0xe9,
|
||||
0x01, 0x03, 0xa0, 0xe3, 0x00, 0xe0, 0x8f, 0xe2, 0x04, 0xf0, 0x10, 0xe5,
|
||||
0x0f, 0x50, 0xbd, 0xe8, 0x04, 0xf0, 0x5e, 0xe2, 0x00, 0x00, 0x00, 0x00,
|
||||
0x02, 0xc0, 0x5e, 0xe5, 0x04, 0xf0, 0x5e, 0xe2, 0x00, 0x00, 0x00, 0x00,
|
||||
0x04, 0xe0, 0xa0, 0x03, 0x1e, 0xff, 0x2f, 0xe1, 0x01, 0x00, 0xa0, 0xe3,
|
||||
0x0c, 0xf0, 0x29, 0xe1, 0x00, 0x40, 0x2d, 0xe9, 0x00, 0x00, 0xa0, 0xe1,
|
||||
0x00, 0x00, 0xa0, 0xe1, 0x00, 0x00, 0xa0, 0xe1, 0x00, 0x00, 0xa0, 0xe1,
|
||||
0x00, 0x00, 0xa0, 0xe1, 0x00, 0x00, 0xa0, 0xe1, 0x00, 0x00, 0xa0, 0xe1,
|
||||
0x00, 0x00, 0xa0, 0xe1, 0x00, 0x00, 0xa0, 0xe1, 0x00, 0x00, 0xa0, 0xe1,
|
||||
0x0f, 0xe0, 0xa0, 0xe1, 0x1b, 0xff, 0x2f, 0x11, 0x00, 0x00, 0xa0, 0xe1,
|
||||
0x00, 0x00, 0xa0, 0xe1, 0x00, 0x00, 0xa0, 0xe1, 0x00, 0x00, 0xa0, 0xe1,
|
||||
0x00, 0x40, 0xbd, 0xe8, 0x93, 0xf0, 0x29, 0xe3, 0x00, 0x10, 0xbd, 0xe8,
|
||||
0x0c, 0xf0, 0x69, 0xe1, 0x00, 0x58, 0xbd, 0xe8, 0x0e, 0xf0, 0xb0, 0xe1,
|
||||
0x00, 0x00, 0x00, 0x00, 0x04, 0x20, 0xa0, 0xe3, 0xb0, 0x01, 0x00, 0x00,
|
||||
0xb0, 0x01, 0x00, 0x00, 0xb4, 0x01, 0x00, 0x00, 0xb0, 0x01, 0x00, 0x00,
|
||||
0xcc, 0x01, 0x00, 0x00, 0xc4, 0x01, 0x00, 0x00, 0xb0, 0x01, 0x00, 0x00,
|
||||
0xb0, 0x01, 0x00, 0x00, 0xb0, 0x01, 0x00, 0x00, 0xb0, 0x01, 0x00, 0x00,
|
||||
0xb0, 0x01, 0x00, 0x00, 0x14, 0x02, 0x00, 0x00, 0xa8, 0x02, 0x00, 0x00,
|
||||
0xb0, 0x01, 0x00, 0x00, 0xb0, 0x01, 0x00, 0x00, 0xb0, 0x01, 0x00, 0x00,
|
||||
0xb0, 0x01, 0x00, 0x00, 0xb0, 0x01, 0x00, 0x00, 0xb0, 0x01, 0x00, 0x00,
|
||||
0xb0, 0x01, 0x00, 0x00, 0xb0, 0x01, 0x00, 0x00, 0xb0, 0x01, 0x00, 0x00,
|
||||
0xb0, 0x01, 0x00, 0x00, 0xb0, 0x01, 0x00, 0x00, 0xb0, 0x01, 0x00, 0x00,
|
||||
0xb0, 0x01, 0x00, 0x00, 0xb0, 0x01, 0x00, 0x00, 0xb0, 0x01, 0x00, 0x00,
|
||||
0xb0, 0x01, 0x00, 0x00, 0xb0, 0x01, 0x00, 0x00, 0xb0, 0x01, 0x00, 0x00,
|
||||
0xb0, 0x01, 0x00, 0x00, 0xb0, 0x01, 0x00, 0x00, 0xb0, 0x01, 0x00, 0x00,
|
||||
0xb0, 0x01, 0x00, 0x00, 0xb0, 0x01, 0x00, 0x00, 0xb0, 0x01, 0x00, 0x00,
|
||||
0xb0, 0x01, 0x00, 0x00, 0xb0, 0x01, 0x00, 0x00, 0xb0, 0x01, 0x00, 0x00,
|
||||
0xb0, 0x01, 0x00, 0x00, 0xb0, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00,
|
||||
0xc0, 0x00, 0x00, 0x02, 0x0f, 0x50, 0x2d, 0xe9, 0x01, 0x03, 0xa0, 0xe3,
|
||||
0x00, 0xe0, 0x8f, 0xe2, 0x04, 0xf0, 0x10, 0xe5, 0x0f, 0x50, 0xbd, 0xe8,
|
||||
0x04, 0xf0, 0x5e, 0xe2, 0x00, 0x00, 0x00, 0x00, 0x02, 0xc0, 0x5e, 0xe5,
|
||||
0x04, 0xf0, 0x5e, 0xe2, 0x00, 0x00, 0x00, 0x00, 0x04, 0xe0, 0xa0, 0x03,
|
||||
0x1e, 0xff, 0x2f, 0xe1, 0x00, 0x20, 0xa0, 0xe3, 0x01, 0xc3, 0xa0, 0xe3,
|
||||
0x01, 0x23, 0xcc, 0xe5, 0x1e, 0xff, 0x2f, 0xe1, 0x01, 0x00, 0xa0, 0xe3,
|
||||
0x01, 0x10, 0xa0, 0xe3, 0x0c, 0x40, 0x2d, 0xe9, 0x01, 0xc3, 0xa0, 0xe3,
|
||||
0x00, 0x00, 0x50, 0xe3, 0x00, 0x00, 0xa0, 0xe3, 0x01, 0x20, 0xa0, 0xe3,
|
||||
0x03, 0x00, 0x00, 0x0a, 0xb8, 0x30, 0x5c, 0xe1, 0x01, 0x30, 0xc3, 0xe1,
|
||||
|
@ -66,5 +72,5 @@ const uint8_t hleBios[SIZE_BIOS] = {
|
|||
0x01, 0x70, 0xa0, 0xe1, 0x01, 0x80, 0xa0, 0xe1, 0x01, 0x90, 0xa0, 0xe1,
|
||||
0x01, 0xa0, 0xa0, 0xe1, 0xfa, 0x07, 0xa0, 0xe8, 0xfa, 0x07, 0xa0, 0xe8,
|
||||
0xfa, 0x07, 0xa0, 0xe8, 0xfa, 0x07, 0xa0, 0xe8, 0x00, 0x10, 0xa0, 0xe3,
|
||||
0xf0, 0x07, 0xbd, 0xe8, 0x1e, 0xff, 0x2f, 0xe1, 0x78, 0x01, 0x00, 0x00
|
||||
0xf0, 0x07, 0xbd, 0xe8, 0x1e, 0xff, 0x2f, 0xe1, 0xb0, 0x01, 0x00, 0x00
|
||||
};
|
||||
|
|
|
@ -40,8 +40,22 @@ and r12, #0x80
|
|||
orr r12, #0x1F
|
||||
msr cpsr, r12
|
||||
stmfd sp!, {lr}
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
mov lr, pc
|
||||
bxne r11
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
ldmfd sp!, {lr}
|
||||
msr cpsr, #0x93
|
||||
ldmfd sp!, {r12}
|
||||
|
@ -116,7 +130,6 @@ subs pc, lr, #4
|
|||
@ Unimplemented
|
||||
SoftReset:
|
||||
RegisterRamReset:
|
||||
Halt:
|
||||
Stop:
|
||||
Div:
|
||||
DivArm:
|
||||
|
@ -156,6 +169,12 @@ SoundDriverVsyncOn:
|
|||
NopCall:
|
||||
bx lr
|
||||
|
||||
Halt:
|
||||
mov r2, #0
|
||||
mov r12, #0x04000000
|
||||
strb r2, [r12, #0x301]
|
||||
bx lr
|
||||
|
||||
VBlankIntrWait:
|
||||
mov r0, #1
|
||||
mov r1, #1
|
||||
|
|
Loading…
Reference in New Issue