all repos — mgba @ ff03bcf0f0a1aa39a15619102c95eb8bd7255a93

mGBA Game Boy Advance Emulator

src/main.c (view raw)

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