-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
59 lines (41 loc) · 943 Bytes
/
main.c
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
51
52
53
54
55
56
57
58
59
/*
* Chip-8 emulator implementation
*
* Graham Briggs, February 2013
*/
#include <stdio.h>
#include "SDL/SDL.h"
#include "chip8.h"
#include "video.h"
#include "input.h"
#include "timer.h"
#include "stack.h"
#include "debug.h"
int main() {
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER);
video v;
input in;
chip8cpu c8cpu;
init_video(&v);
chip8_init(&c8cpu);
chip8_load_resources(&c8cpu, &v, &in);
load_program(&c8cpu);
for (;;) {
/*
parse_instruction(&c8cpu, 0x620A); // set r2 to 0A
parse_instruction(&c8cpu, 0x6308); // set r3 to 09
parse_instruction(&c8cpu, 0x8235); // subtract r3 from r2
parse_instruction(&c8cpu, 0xA003); // set I to 123
parse_instruction(&c8cpu, 0xF555); // move r4 to [I]
*/
if (check_for_exit(c8cpu.p_input))
break;
SDL_Flip(c8cpu.p_video->screen);
SDL_Delay(250);
break;
}
print_chip8_state(&c8cpu);
main_memory_dump(&c8cpu);
SDL_Quit();
return 0;
}