about summary refs log tree commit diff
path: root/main.c
blob: a257c9636b4ef9fca23c9e0468b82836f4b2e1a6 (plain) (blame)
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
#include <emulator.h>

int main(int argc, char** argv);
void show_help();

int main(int argc, char** argv)
{
    if(argc < 2)
    {
        show_help();
        return 1;
    }

    Emulator emulator;

    emulator_initialise(&emulator);

    if(emulator_load_rom(&emulator, argv[1]) != 0)
        return 2;

    printf("Hello brother!\n");

    while(emulator.is_on == 1)
    {
        emulator_tick(&emulator);
        usleep(1000000 / INSTRUCTIONS_PER_SECOND);
    }

    return 0;
}

void show_help()
{
    printf("BAD USAGE! -> ./chip8_emulator [ROM]\n");
}