-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
50 lines (39 loc) · 710 Bytes
/
main.cpp
File metadata and controls
50 lines (39 loc) · 710 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/**
* Copyright 2011 - Joel Abrahamsson
*
* This is only used for debugging YACE. It's not a GUI.
*/
#include <cstdio>
#include <cstdlib>
#include "include/Chip8.h"
void show_help();
int main(int argc, char **argv)
{
using namespace YACE;
if (argc > 1)
{
Chip8 chip8 = Chip8();
chip8.load_game(argv[1]);
if (argc > 2)
{
int cycles = atoi(argv[2]);
if (cycles)
chip8.set_cpu_cycles(cycles);
}
// CAUTION! Infinite loop!
while (true)
{
chip8.step();
if (std::getchar() == EOF)
break;
}
}
else
show_help();
return 0;
}
void show_help()
{
printf("Usage:\n");
printf("\tyace <file> [<cpu cycles>]\n");
}