blob: 2f2f9d07173709836b9c545c7b69537963cee16d (
plain)
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
|
#include "screen.h"
#include "mem.h"
#include "vcpu.h"
#include "speaker.h"
#include <stdio.h>
#define SCREEN_WIDTH 1000
#define SCREEN_HEIGHT 500
int main(int argc, char *argv[])
{
// Parse argument
if(argc != 2){
printf("Usage: %s [rom]\n",argv[0]);
return 1;
} else if(!FileExists(argv[1])){
printf("ROM not found: %s\n",argv[1]);
return 1;
}
// Initialize
VCPUInit(SCREEN_WIDTH, SCREEN_HEIGHT);
MemLoadROM(argv[1]); // Load ROM into main memory
// Set game to run at very high FPS (prevent raylib to interfer with emulator CPU frequency)
SetTargetFPS(VCPU_FREQ*100);
// Emulator main loop
while (!WindowShouldClose()){
VCPUTick();
}
// Finish
VCPUFinish();
return 0;
}
|