GBA BIOS: Work around IRQ handling hiccup in Mario & Luigi (fixes #1059)

This commit is contained in:
Vicki Pfau 2021-12-28 17:12:22 -08:00
parent 23a815b99c
commit ee610db141
3 changed files with 14 additions and 13 deletions

View File

@ -15,6 +15,7 @@ Emulation fixes:
- ARM7: Fix unsigned multiply timing
- GB Memory: Add cursory cartridge open bus emulation (fixes mgba.io/i/2032)
- GBA: Improve timing when not booting from BIOS
- GBA BIOS: Work around IRQ handling hiccup in Mario & Luigi (fixes mgba.io/i/1059)
- GBA I/O: Redo internal key input, enabling edge-based key IRQs
- GBA Memory: Fix misaligned 32-bit I/O loads (fixes mgba.io/i/2307)
Other fixes:

View File

@ -9,17 +9,17 @@ const uint8_t hleBios[SIZE_BIOS] = {
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, 0x00, 0x00, 0x00, 0x00, 0x5d, 0xe3, 0x01, 0xd3, 0xa0, 0x03,
0x20, 0xd0, 0x4d, 0x02, 0x00, 0x58, 0x2d, 0xe9, 0x02, 0xb0, 0x5e, 0xe5,
0xd4, 0xc0, 0xa0, 0xe3, 0x0b, 0xb1, 0x9c, 0xe7, 0xd2, 0xcf, 0xa0, 0xe3,
0x0b, 0x00, 0x5c, 0xe1, 0x00, 0xc0, 0x4f, 0xe1, 0x00, 0x10, 0x2d, 0xe9,
0x20, 0xd0, 0x4d, 0x02, 0x10, 0x50, 0x2d, 0xe9, 0x02, 0x40, 0x5e, 0xe5,
0xd4, 0xc0, 0xa0, 0xe3, 0x04, 0x41, 0x9c, 0xe7, 0xd2, 0xcf, 0xa0, 0xe3,
0x04, 0x00, 0x5c, 0xe1, 0x00, 0xc0, 0x4f, 0xe1, 0x00, 0x10, 0x2d, 0xe9,
0x80, 0xc0, 0x0c, 0xe2, 0x1f, 0xc0, 0x8c, 0xe3, 0x0c, 0xf0, 0x21, 0xe1,
0x00, 0x00, 0xf0, 0x0f, 0x04, 0x40, 0x2d, 0xe9, 0x00, 0x00, 0x5b, 0xe3,
0x00, 0x00, 0xf0, 0x0f, 0x04, 0x40, 0x2d, 0xe9, 0x00, 0x00, 0x54, 0xe3,
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,
0x0f, 0xe0, 0xa0, 0xe1, 0x14, 0xff, 0x2f, 0x11, 0x00, 0x00, 0xa0, 0xe1,
0x00, 0x00, 0xa0, 0xe1, 0x00, 0x00, 0xa0, 0xe1, 0x04, 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,
0x10, 0x50, 0xbd, 0xe8, 0x0e, 0xf0, 0xb0, 0xe1, 0x00, 0x00, 0x00, 0x00,
0x04, 0x20, 0xa0, 0xe3, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x01, 0x00, 0x00,
0xb0, 0x01, 0x00, 0x00, 0xb4, 0x01, 0x00, 0x00, 0xb0, 0x01, 0x00, 0x00,
0xcc, 0x01, 0x00, 0x00, 0xc4, 0x01, 0x00, 0x00, 0x48, 0x03, 0x00, 0x00,

View File

@ -31,12 +31,12 @@ swiBase:
cmp sp, #0
moveq sp, #0x04000000
subeq sp, #0x20
stmfd sp!, {r11-r12, lr}
ldrb r11, [lr, #-2]
stmfd sp!, {r4, r12, lr}
ldrb r4, [lr, #-2]
mov r12, #swiTable
ldr r11, [r12, r11, lsl #2]
ldr r4, [r12, r4, lsl #2]
mov r12, #StallCall
cmp r12, r11
cmp r12, r4
mrs r12, spsr
stmfd sp!, {r12}
and r12, #0x80
@ -44,7 +44,7 @@ orr r12, #0x1F
msr cpsr_c, r12
swieq 0xF00000 @ Special mGBA-internal call to load the stall count into r12
stmfd sp!, {r2, lr}
cmp r11, #0
cmp r4, #0
nop
nop
nop
@ -52,7 +52,7 @@ nop
nop
nop
mov lr, pc
bxne r11
bxne r4
nop
nop
nop
@ -60,7 +60,7 @@ ldmfd sp!, {r2, lr}
msr cpsr, #0x93
ldmfd sp!, {r12}
msr spsr, r12
ldmfd sp!, {r11-r12, lr}
ldmfd sp!, {r4, r12, lr}
movs pc, lr
.word 0
.word 0xE3A02004