all repos — mgba @ 8750f78808736560c24cc662d5a570b81e64b6e0

mGBA Game Boy Advance Emulator

src/platform/test/gb-main.c (view raw)

 1/* Copyright (c) 2013-2016 Jeffrey Pfau
 2 *
 3 * This Source Code Form is subject to the terms of the Mozilla Public
 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 6#include "lr35902/lr35902.h"
 7#include "gb/gb.h"
 8#include "util/vfs.h"
 9
10int main(int argc, char* argv[]) {
11	struct LR35902Core cpu;
12	struct GB gb;
13
14	GBCreate(&gb);
15	LR35902SetComponents(&cpu, &gb.d, 0, 0);
16	LR35902Init(&cpu);
17	struct VFile* vf = VFileOpen(argv[1], O_RDONLY);
18	GBLoadROM(&gb, vf, 0, argv[1]);
19
20	LR35902Reset(&cpu);
21	while (true) {
22		LR35902Tick(&cpu);
23	}
24	vf->close(vf);
25	return 0;
26}