GBA BIOS: Implement dummy sound driver calls

This commit is contained in:
Vicki Pfau 2020-02-12 23:41:25 -08:00
parent 00b46d7041
commit 7ea3728165
5 changed files with 245 additions and 86 deletions

View File

@ -7,6 +7,7 @@ Emulation fixes:
- GB Serialize: Fix timing bug loading channel 4 timing
- GBA: Fix multiboot entry point while skipping BIOS
- GBA BIOS: Fix undefined instruction HLE behavior
- GBA BIOS: Implement dummy sound driver calls
- 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

View File

@ -14,6 +14,52 @@ CXX_GUARD_START
mLOG_DECLARE_CATEGORY(GBA_BIOS);
enum GBASwi {
GBA_SWI_SOFT_RESET = 0x00,
GBA_SWI_REGISTER_RAM_RESET = 0x01,
GBA_SWI_HALT = 0x02,
GBA_SWI_STOP = 0x03,
GBA_SWI_INTR_WAIT = 0x04,
GBA_SWI_VBLANK_INTR_WAIT = 0x05,
GBA_SWI_DIV = 0x06,
GBA_SWI_DIV_ARM = 0x07,
GBA_SWI_SQRT = 0x08,
GBA_SWI_ARCTAN = 0x09,
GBA_SWI_ARCTAN2 = 0x0A,
GBA_SWI_CPU_SET = 0x0B,
GBA_SWI_CPU_FAST_SET = 0x0C,
GBA_SWI_GET_BIOS_CHECKSUM = 0x0D,
GBA_SWI_BG_AFFINE_SET = 0x0E,
GBA_SWI_OBJ_AFFINE_SET = 0x0F,
GBA_SWI_BIT_UNPACK = 0x10,
GBA_SWI_LZ77_UNCOMP_WRAM = 0x11,
GBA_SWI_LZ77_UNCOMP_VRAM = 0x12,
GBA_SWI_HUFFMAN_UNCOMP = 0x13,
GBA_SWI_RL_UNCOMP_WRAM = 0x14,
GBA_SWI_RL_UNCOMP_VRAM = 0x15,
GBA_SWI_DIFF_8BIT_UNFILTER_WRAM = 0x16,
GBA_SWI_DIFF_8BIT_UNFILTER_VRAM = 0x17,
GBA_SWI_DIFF_16BIT_UNFILTER = 0x18,
GBA_SWI_SOUND_BIAS = 0x19,
GBA_SWI_SOUND_DRIVER_INIT = 0x1A,
GBA_SWI_SOUND_DRIVER_MODE = 0x1B,
GBA_SWI_SOUND_DRIVER_MAIN = 0x1C,
GBA_SWI_SOUND_DRIVER_VSYNC = 0x1D,
GBA_SWI_SOUND_CHANNEL_CLEAR = 0x1E,
GBA_SWI_MIDI_KEY_2_FREQ = 0x1F,
GBA_SWI_MUSIC_PLAYER_OPEN = 0x20,
GBA_SWI_MUSIC_PLAYER_START = 0x21,
GBA_SWI_MUSIC_PLAYER_STOP = 0x22,
GBA_SWI_MUSIC_PLAYER_CONTINUE = 0x23,
GBA_SWI_MUSIC_PLAYER_FADE_OUT = 0x24,
GBA_SWI_MULTI_BOOT = 0x25,
GBA_SWI_HARD_RESET = 0x26,
GBA_SWI_CUSTOM_HALT = 0x27,
GBA_SWI_SOUND_DRIVER_VSYNC_OFF = 0x28,
GBA_SWI_SOUND_DRIVER_VSYNC_ON = 0x29,
GBA_SWI_SOUND_DRIVER_GET_JUMP_LIST = 0x2A,
};
struct ARMCore;
void GBASwi16(struct ARMCore* cpu, int immediate);
void GBASwi32(struct ARMCore* cpu, int immediate);

View File

@ -424,43 +424,43 @@ void GBASwi16(struct ARMCore* cpu, int immediate) {
return;
}
switch (immediate) {
case 0x0:
case GBA_SWI_SOFT_RESET:
_SoftReset(gba);
break;
case 0x1:
case GBA_SWI_REGISTER_RAM_RESET:
_RegisterRamReset(gba);
break;
case 0x2:
case GBA_SWI_HALT:
GBAHalt(gba);
break;
case 0x3:
case GBA_SWI_STOP:
GBAStop(gba);
break;
case 0x05:
case GBA_SWI_VBLANK_INTR_WAIT:
// VBlankIntrWait
// Fall through:
case 0x04:
case GBA_SWI_INTR_WAIT:
// IntrWait
ARMRaiseSWI(cpu);
break;
case 0x6:
case GBA_SWI_DIV:
_Div(gba, cpu->gprs[0], cpu->gprs[1]);
break;
case 0x7:
case GBA_SWI_DIV_ARM:
_Div(gba, cpu->gprs[1], cpu->gprs[0]);
break;
case 0x8:
case GBA_SWI_SQRT:
cpu->gprs[0] = _Sqrt(cpu->gprs[0], &cpu->cycles);
break;
case 0x9:
case GBA_SWI_ARCTAN:
cpu->gprs[0] = _ArcTan(cpu->gprs[0], &cpu->gprs[1], &cpu->gprs[3], &cpu->cycles);
break;
case 0xA:
case GBA_SWI_ARCTAN2:
cpu->gprs[0] = (uint16_t) _ArcTan2(cpu->gprs[0], cpu->gprs[1], &cpu->gprs[1], &cpu->cycles);
cpu->gprs[3] = 0x170;
break;
case 0xB:
case 0xC:
case GBA_SWI_CPU_SET:
case GBA_SWI_CPU_FAST_SET:
if (cpu->gprs[0] >> BASE_OFFSET < REGION_WORKING_RAM) {
mLOG(GBA_BIOS, GAME_ERROR, "Cannot CpuSet from BIOS");
break;
@ -473,18 +473,18 @@ void GBASwi16(struct ARMCore* cpu, int immediate) {
}
ARMRaiseSWI(cpu);
break;
case 0xD:
case GBA_SWI_GET_BIOS_CHECKSUM:
cpu->gprs[0] = GBA_BIOS_CHECKSUM;
cpu->gprs[1] = 1;
cpu->gprs[3] = SIZE_BIOS;
break;
case 0xE:
case GBA_SWI_BG_AFFINE_SET:
_BgAffineSet(gba);
break;
case 0xF:
case GBA_SWI_OBJ_AFFINE_SET:
_ObjAffineSet(gba);
break;
case 0x10:
case GBA_SWI_BIT_UNPACK:
if (cpu->gprs[0] < BASE_WORKING_RAM) {
mLOG(GBA_BIOS, GAME_ERROR, "Bad BitUnPack source");
break;
@ -500,8 +500,8 @@ void GBASwi16(struct ARMCore* cpu, int immediate) {
break;
}
break;
case 0x11:
case 0x12:
case GBA_SWI_LZ77_UNCOMP_WRAM:
case GBA_SWI_LZ77_UNCOMP_VRAM:
if (cpu->gprs[0] < BASE_WORKING_RAM) {
mLOG(GBA_BIOS, GAME_ERROR, "Bad LZ77 source");
break;
@ -513,11 +513,11 @@ void GBASwi16(struct ARMCore* cpu, int immediate) {
case REGION_WORKING_RAM:
case REGION_WORKING_IRAM:
case REGION_VRAM:
_unLz77(gba, immediate == 0x11 ? 1 : 2);
_unLz77(gba, immediate == GBA_SWI_LZ77_UNCOMP_WRAM ? 1 : 2);
break;
}
break;
case 0x13:
case GBA_SWI_HUFFMAN_UNCOMP:
if (cpu->gprs[0] < BASE_WORKING_RAM) {
mLOG(GBA_BIOS, GAME_ERROR, "Bad Huffman source");
break;
@ -533,8 +533,8 @@ void GBASwi16(struct ARMCore* cpu, int immediate) {
break;
}
break;
case 0x14:
case 0x15:
case GBA_SWI_RL_UNCOMP_WRAM:
case GBA_SWI_RL_UNCOMP_VRAM:
if (cpu->gprs[0] < BASE_WORKING_RAM) {
mLOG(GBA_BIOS, GAME_ERROR, "Bad RL source");
break;
@ -546,13 +546,13 @@ void GBASwi16(struct ARMCore* cpu, int immediate) {
case REGION_WORKING_RAM:
case REGION_WORKING_IRAM:
case REGION_VRAM:
_unRl(gba, immediate == 0x14 ? 1 : 2);
_unRl(gba, immediate == GBA_SWI_RL_UNCOMP_WRAM ? 1 : 2);
break;
}
break;
case 0x16:
case 0x17:
case 0x18:
case GBA_SWI_DIFF_8BIT_UNFILTER_WRAM:
case GBA_SWI_DIFF_8BIT_UNFILTER_VRAM:
case GBA_SWI_DIFF_16BIT_UNFILTER:
if (cpu->gprs[0] < BASE_WORKING_RAM) {
mLOG(GBA_BIOS, GAME_ERROR, "Bad UnFilter source");
break;
@ -564,17 +564,20 @@ void GBASwi16(struct ARMCore* cpu, int immediate) {
case REGION_WORKING_RAM:
case REGION_WORKING_IRAM:
case REGION_VRAM:
_unFilter(gba, immediate == 0x18 ? 2 : 1, immediate == 0x16 ? 1 : 2);
_unFilter(gba, immediate == GBA_SWI_DIFF_16BIT_UNFILTER ? 2 : 1, immediate == GBA_SWI_DIFF_8BIT_UNFILTER_WRAM ? 1 : 2);
break;
}
break;
case 0x19:
case GBA_SWI_SOUND_BIAS:
// SoundBias is mostly meaningless here
mLOG(GBA_BIOS, STUB, "Stub software interrupt: SoundBias (19)");
break;
case 0x1F:
case GBA_SWI_MIDI_KEY_2_FREQ:
_MidiKey2Freq(gba);
break;
case GBA_SWI_SOUND_DRIVER_GET_JUMP_LIST:
ARMRaiseSWI(cpu);
break;
default:
mLOG(GBA_BIOS, STUB, "Stub software interrupt: %02X", immediate);
}

View File

@ -3,10 +3,10 @@
#include <mgba/internal/gba/memory.h>
const uint8_t hleBios[SIZE_BIOS] = {
0x06, 0x00, 0x00, 0xea, 0x88, 0x00, 0x00, 0xea, 0x0b, 0x00, 0x00, 0xea,
0x06, 0x00, 0x00, 0xea, 0x58, 0x00, 0x00, 0xea, 0x0b, 0x00, 0x00, 0xea,
0xfe, 0xff, 0xff, 0xea, 0xfe, 0xff, 0xff, 0xea, 0x00, 0x00, 0xa0, 0xe1,
0x2c, 0x00, 0x00, 0xea, 0xfe, 0xff, 0xff, 0xea, 0x02, 0x03, 0xa0, 0xe3,
0x03, 0x10, 0xd0, 0xe5, 0xea, 0x00, 0x51, 0xe3, 0x04, 0x02, 0x9f, 0x15,
0x4b, 0x00, 0x00, 0xea, 0xfe, 0xff, 0xff, 0xea, 0x02, 0x03, 0xa0, 0xe3,
0x03, 0x10, 0xd0, 0xe5, 0xea, 0x00, 0x51, 0xe3, 0x14, 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,
@ -16,39 +16,55 @@ const uint8_t hleBios[SIZE_BIOS] = {
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,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00,
0xd4, 0x01, 0x00, 0x00, 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,
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, 0xb8, 0x30, 0x4c, 0xe1, 0x01, 0x03, 0xcc, 0xe5,
0x08, 0x02, 0xcc, 0xe5, 0xb8, 0x30, 0x5c, 0xe1, 0x01, 0x30, 0x13, 0xe0,
0x01, 0x30, 0x23, 0x10, 0xb8, 0x30, 0x4c, 0x11, 0x08, 0x22, 0xcc, 0xe5,
0xf7, 0xff, 0xff, 0x0a, 0x0c, 0x80, 0xbd, 0xe8, 0x30, 0x40, 0x2d, 0xe9,
0x02, 0x46, 0xa0, 0xe1, 0x00, 0xc0, 0xa0, 0xe1, 0x01, 0x50, 0xa0, 0xe1,
0x01, 0x04, 0x12, 0xe3, 0x0f, 0x00, 0x00, 0x0a, 0x01, 0x03, 0x12, 0xe3,
0x05, 0x00, 0x00, 0x0a, 0x24, 0x45, 0x85, 0xe0, 0x08, 0x00, 0xbc, 0xe8,
0x04, 0x00, 0x55, 0xe1, 0x08, 0x00, 0xa5, 0xb8, 0xfc, 0xff, 0xff, 0xba,
0x14, 0x00, 0x00, 0xea, 0x01, 0xc0, 0xcc, 0xe3, 0x01, 0x50, 0xc5, 0xe3,
0xa4, 0x45, 0x85, 0xe0, 0xb0, 0x30, 0xdc, 0xe1, 0x04, 0x00, 0x55, 0xe1,
0xb2, 0x30, 0xc5, 0xb0, 0xfc, 0xff, 0xff, 0xba, 0x0c, 0x00, 0x00, 0xea,
0x01, 0x03, 0x12, 0xe3, 0x05, 0x00, 0x00, 0x0a, 0x24, 0x45, 0x85, 0xe0,
0x04, 0x00, 0x55, 0xe1, 0x08, 0x00, 0xbc, 0xb8, 0x08, 0x00, 0xa5, 0xb8,
0xfb, 0xff, 0xff, 0xba, 0x04, 0x00, 0x00, 0xea, 0xa4, 0x45, 0x85, 0xe0,
0x04, 0x00, 0x55, 0xe1, 0xb2, 0x30, 0xdc, 0xb0, 0xb2, 0x30, 0xc5, 0xb0,
0xfb, 0xff, 0xff, 0xba, 0x17, 0x3e, 0xa0, 0xe3, 0x30, 0x80, 0xbd, 0xe8,
0xf0, 0x47, 0x2d, 0xe9, 0x01, 0x04, 0x12, 0xe3, 0x02, 0x36, 0xa0, 0xe1,
0x23, 0x25, 0x81, 0xe0, 0x0b, 0x00, 0x00, 0x0a, 0x00, 0x30, 0x90, 0xe5,
0x03, 0x40, 0xa0, 0xe1, 0x03, 0x50, 0xa0, 0xe1, 0x03, 0x60, 0xa0, 0xe1,
0x03, 0x70, 0xa0, 0xe1, 0x03, 0x80, 0xa0, 0xe1, 0x03, 0x90, 0xa0, 0xe1,
0x03, 0xa0, 0xa0, 0xe1, 0x02, 0x00, 0x51, 0xe1, 0xf8, 0x07, 0xa1, 0xb8,
0xfc, 0xff, 0xff, 0xba, 0x03, 0x00, 0x00, 0xea, 0x02, 0x00, 0x51, 0xe1,
0xf8, 0x07, 0xb0, 0xb8, 0xf8, 0x07, 0xa1, 0xb8, 0xfb, 0xff, 0xff, 0xba,
0xf0, 0x87, 0xbd, 0xe8, 0x04, 0xf0, 0x5e, 0xe2, 0x00, 0x00, 0x00, 0x00,
0x04, 0xe0, 0xa0, 0x03, 0xc0, 0x00, 0x00, 0x02
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,
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,
0xb8, 0x30, 0x4c, 0xe1, 0x01, 0x03, 0xcc, 0xe5, 0x08, 0x02, 0xcc, 0xe5,
0xb8, 0x30, 0x5c, 0xe1, 0x01, 0x30, 0x13, 0xe0, 0x01, 0x30, 0x23, 0x10,
0xb8, 0x30, 0x4c, 0x11, 0x08, 0x22, 0xcc, 0xe5, 0xf7, 0xff, 0xff, 0x0a,
0x0c, 0x80, 0xbd, 0xe8, 0x30, 0x40, 0x2d, 0xe9, 0x02, 0x46, 0xa0, 0xe1,
0x00, 0xc0, 0xa0, 0xe1, 0x01, 0x50, 0xa0, 0xe1, 0x01, 0x04, 0x12, 0xe3,
0x0f, 0x00, 0x00, 0x0a, 0x01, 0x03, 0x12, 0xe3, 0x05, 0x00, 0x00, 0x0a,
0x24, 0x45, 0x85, 0xe0, 0x08, 0x00, 0xbc, 0xe8, 0x04, 0x00, 0x55, 0xe1,
0x08, 0x00, 0xa5, 0xb8, 0xfc, 0xff, 0xff, 0xba, 0x14, 0x00, 0x00, 0xea,
0x01, 0xc0, 0xcc, 0xe3, 0x01, 0x50, 0xc5, 0xe3, 0xa4, 0x45, 0x85, 0xe0,
0xb0, 0x30, 0xdc, 0xe1, 0x04, 0x00, 0x55, 0xe1, 0xb2, 0x30, 0xc5, 0xb0,
0xfc, 0xff, 0xff, 0xba, 0x0c, 0x00, 0x00, 0xea, 0x01, 0x03, 0x12, 0xe3,
0x05, 0x00, 0x00, 0x0a, 0x24, 0x45, 0x85, 0xe0, 0x04, 0x00, 0x55, 0xe1,
0x08, 0x00, 0xbc, 0xb8, 0x08, 0x00, 0xa5, 0xb8, 0xfb, 0xff, 0xff, 0xba,
0x04, 0x00, 0x00, 0xea, 0xa4, 0x45, 0x85, 0xe0, 0x04, 0x00, 0x55, 0xe1,
0xb2, 0x30, 0xdc, 0xb0, 0xb2, 0x30, 0xc5, 0xb0, 0xfb, 0xff, 0xff, 0xba,
0x17, 0x3e, 0xa0, 0xe3, 0x30, 0x80, 0xbd, 0xe8, 0xf0, 0x47, 0x2d, 0xe9,
0x01, 0x04, 0x12, 0xe3, 0x02, 0x36, 0xa0, 0xe1, 0x23, 0x25, 0x81, 0xe0,
0x0b, 0x00, 0x00, 0x0a, 0x00, 0x30, 0x90, 0xe5, 0x03, 0x40, 0xa0, 0xe1,
0x03, 0x50, 0xa0, 0xe1, 0x03, 0x60, 0xa0, 0xe1, 0x03, 0x70, 0xa0, 0xe1,
0x03, 0x80, 0xa0, 0xe1, 0x03, 0x90, 0xa0, 0xe1, 0x03, 0xa0, 0xa0, 0xe1,
0x02, 0x00, 0x51, 0xe1, 0xf8, 0x07, 0xa1, 0xb8, 0xfc, 0xff, 0xff, 0xba,
0x03, 0x00, 0x00, 0xea, 0x02, 0x00, 0x51, 0xe1, 0xf8, 0x07, 0xb0, 0xb8,
0xf8, 0x07, 0xa1, 0xb8, 0xfb, 0xff, 0xff, 0xba, 0xf0, 0x87, 0xbd, 0xe8,
0xf0, 0x07, 0x2d, 0xe9, 0x38, 0x10, 0x9f, 0xe5, 0x01, 0x30, 0xa0, 0xe1,
0x01, 0x40, 0xa0, 0xe1, 0x01, 0x50, 0xa0, 0xe1, 0x01, 0x60, 0xa0, 0xe1,
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
};

View File

@ -52,20 +52,51 @@ movs pc, lr
.word 0xE3A02004
swiTable:
.word SoftReset
.word RegisterRamReset
.word Halt
.word Stop
.word IntrWait
.word VBlankIntrWait
.word Div
.word DivArm
.word Sqrt
.word ArcTan
.word ArcTan2
.word CpuSet
.word CpuFastSet
@ ... The rest of this table isn't needed if the rest aren't implemented
.word SoftReset @ 0x00
.word RegisterRamReset @ 0x01
.word Halt @ 0x02
.word Stop @ 0x03
.word IntrWait @ 0x04
.word VBlankIntrWait @ 0x05
.word Div @ 0x06
.word DivArm @ 0x07
.word Sqrt @ 0x08
.word ArcTan @ 0x09
.word ArcTan2 @ 0x0A
.word CpuSet @ 0x0B
.word CpuFastSet @ 0x0C
.word GetBiosChecksum @ 0x0D
.word BgAffineSet @ 0x0E
.word ObjAffineSet @ 0x0F
.word BitUnPack @ 0x10
.word Lz77UnCompWram @ 0x11
.word Lz77UnCompVram @ 0x12
.word HuffmanUnComp @ 0x13
.word RlUnCompWram @ 0x14
.word RlUnCompVram @ 0x15
.word Diff8BitUnFilterWram @ 0x16
.word Diff8BitUnFilterVram @ 0x17
.word Diff16BitUnFilter @ 0x18
.word SoundBias @ 0x19
.word SoundDriverInit @ 0x1A
.word SoundDriverMode @ 0x1B
.word SoundDriverMain @ 0x1C
.word SoundDriverVsync @ 0x1D
.word SoundChannelClear @ 0x1E
.word MidiKey2Freq @ 0x1F
.word MusicPlayerOpen @ 0x20
.word MusicPlayerStart @ 0x21
.word MusicPlayerStop @ 0x22
.word MusicPlayerContinue @ 0x23
.word MusicPlayerFadeOut @ 0x24
.word MultiBoot @ 0x25
.word HardReset @ 0x26
.word CustomHalt @ 0x27
.word SoundDriverVsyncOff @ 0x28
.word SoundDriverVsyncOn @ 0x29
.word SoundDriverGetJumpList @ 0x2A
.ltorg
irqBase:
stmfd sp!, {r0-r3, r12, lr}
@ -77,6 +108,54 @@ subs pc, lr, #4
.word 0
.word 0xE55EC002
undefBase:
subs pc, lr, #4
.word 0
.word 0x03A0E004
@ Unimplemented
SoftReset:
RegisterRamReset:
Halt:
Stop:
Div:
DivArm:
Sqrt:
ArcTan:
ArcTan2:
GetBiosChecksum:
BgAffineSet:
ObjAffineSet:
BitUnPack:
Lz77UnCompWram:
Lz77UnCompVram:
HuffmanUnComp:
RlUnCompWram:
RlUnCompVram:
Diff8BitUnFilterWram:
Diff8BitUnFilterVram:
Diff16BitUnFilter:
SoundBias:
SoundDriverInit:
SoundDriverMode:
SoundDriverMain:
SoundDriverVsync:
SoundChannelClear:
MidiKey2Freq:
MusicPlayerOpen:
MusicPlayerStart:
MusicPlayerStop:
MusicPlayerContinue:
MusicPlayerFadeOut:
MultiBoot:
HardReset:
CustomHalt:
SoundDriverVsyncOff:
SoundDriverVsyncOn:
NopCall:
bx lr
VBlankIntrWait:
mov r0, #1
mov r1, #1
@ -187,9 +266,23 @@ blt 0b
2:
ldmfd sp!, {r4-r10, pc}
undefBase:
subs pc, lr, #4
.word 0
.word 0x03A0E004
SoundDriverGetJumpList:
stmfd sp!, {r4-r10}
ldr r1, =NopCall
mov r3, r1
mov r4, r1
mov r5, r1
mov r6, r1
mov r7, r1
mov r8, r1
mov r9, r1
mov r10, r1
stmia r0!, {r1, r3-r10}
stmia r0!, {r1, r3-r10}
stmia r0!, {r1, r3-r10}
stmia r0!, {r1, r3-r10}
mov r1, #0
ldmfd sp!, {r4-r10}
bx lr
.ltorg