Add HLE BIOS from GBA.js

This commit is contained in:
Jeffrey Pfau 2013-04-17 00:45:23 -07:00
parent 38b1c8d235
commit 54fffb7fff
3 changed files with 33 additions and 2 deletions

View File

@ -1,6 +1,7 @@
#include "gba-memory.h"
#include "gba-io.h"
#include "hle-bios.h"
#include <limits.h>
#include <string.h>
@ -26,7 +27,7 @@ void GBAMemoryInit(struct GBAMemory* memory) {
memory->d.store16 = GBAStore16;
memory->d.store8 = GBAStore8;
memory->bios = 0;
memory->bios = hleBios;
memory->wram = mmap(0, SIZE_WORKING_RAM, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
memory->iwram = mmap(0, SIZE_WORKING_IRAM, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
memory->rom = 0;
@ -75,7 +76,7 @@ static void GBASetActiveRegion(struct ARMMemory* memory, uint32_t address) {
switch (address & ~OFFSET_MASK) {
case BASE_BIOS:
memory->activeRegion = gbaMemory->bios;
memory->activeMask = 0;
memory->activeMask = SIZE_BIOS - 1;
break;
case BASE_WORKING_RAM:
memory->activeRegion = gbaMemory->wram;

23
src/gba/hle-bios.c Normal file
View File

@ -0,0 +1,23 @@
#include "hle-bios.h"
const unsigned int hleBiosLength = 216;
const unsigned char hleBios[] = {
0x06, 0x00, 0x00, 0xea, 0xfe, 0xff, 0xff, 0xea, 0x05, 0x00, 0x00, 0xea,
0xfe, 0xff, 0xff, 0xea, 0xfe, 0xff, 0xff, 0xea, 0x00, 0x00, 0xa0, 0xe1,
0x0c, 0x00, 0x00, 0xea, 0xfe, 0xff, 0xff, 0xea, 0x02, 0xf3, 0xa0, 0xe3,
0x00, 0x00, 0x5d, 0xe3, 0x01, 0xd3, 0xa0, 0x03, 0x20, 0xd0, 0x4d, 0x02,
0x00, 0x40, 0x2d, 0xe9, 0x02, 0x00, 0x5e, 0xe5, 0x04, 0x00, 0x50, 0xe3,
0x09, 0x00, 0x00, 0x0b, 0x05, 0x00, 0x50, 0xe3, 0x07, 0x00, 0x00, 0x0b,
0x00, 0x40, 0xbd, 0xe8, 0x0e, 0xf0, 0xb0, 0xe1, 0x0f, 0x50, 0x2d, 0xe9,
0x01, 0x03, 0xa0, 0xe3, 0x00, 0xe0, 0x8f, 0xe2, 0x04, 0xf0, 0x10, 0xe5,
0x0f, 0x50, 0xbd, 0xe8, 0x04, 0xf0, 0x5e, 0xe2, 0x04, 0x40, 0x2d, 0xe9,
0x04, 0xd0, 0x4d, 0xe2, 0xb0, 0x10, 0xcd, 0xe1, 0x01, 0x23, 0xa0, 0xe3,
0x02, 0x2c, 0x82, 0xe2, 0xb0, 0x00, 0xd2, 0xe1, 0xb2, 0x00, 0xcd, 0xe1,
0xb0, 0x10, 0xdd, 0xe1, 0x01, 0x10, 0x80, 0xe1, 0xb0, 0x10, 0xc2, 0xe1,
0x1f, 0x00, 0xa0, 0xe3, 0x00, 0xf0, 0x29, 0xe1, 0x00, 0x00, 0x02, 0xef,
0xd3, 0x00, 0xa0, 0xe3, 0x00, 0xf0, 0x29, 0xe1, 0x01, 0x03, 0xa0, 0xe3,
0xb8, 0x20, 0x50, 0xe1, 0xb0, 0x10, 0xdd, 0xe1, 0x02, 0x10, 0x11, 0xe0,
0x02, 0x10, 0x21, 0x10, 0xb8, 0x10, 0x40, 0x11, 0xb2, 0x00, 0xdd, 0xe1,
0x01, 0x13, 0xa0, 0xe3, 0x02, 0x1c, 0x81, 0xe2, 0xb0, 0x00, 0xc1, 0xe1,
0xe8, 0xff, 0xff, 0x0a, 0x04, 0xd0, 0x8d, 0xe2, 0x04, 0x80, 0xbd, 0xe8
};

7
src/gba/hle-bios.h Normal file
View File

@ -0,0 +1,7 @@
#ifndef HLE_BIOS_H
#define HLE_BIOS_H
const unsigned int hleBiosLength;
const unsigned char hleBios[];
#endif