all repos — mgba @ d3abd2dc63b0ad2b62e4dd05126d6f76f69e0639

mGBA Game Boy Advance Emulator

src/main.c (view raw)

 1#include "arm.h"
 2#include "gba.h"
 3#include "isa-arm.h"
 4
 5#include <fcntl.h>
 6#include <sys/stat.h>
 7#include <unistd.h>
 8
 9int main(int argc, char** argv) {
10	struct GBA gba;
11	GBAInit(&gba);
12	int fd = open("test.rom", O_RDONLY);
13	GBALoadROM(&gba, fd);
14	gba.cpu.gprs[ARM_PC] = 0x08000004;
15	gba.memory.d.setActiveRegion(&gba.memory.d, gba.cpu.gprs[ARM_PC]);
16	int i;
17	for (i = 0; i < 1024 * 1024 * 16; ++i) {
18		ARMStep(&gba.cpu);
19	}
20	GBADeinit(&gba);
21	close(fd);
22
23	return 0;
24}