chip-8/src/main.c
2023-12-26 13:21:09 +01:00

40 lines
756 B
C

#include "screen.h"
#include "mem.h"
#include "vcpu.h"
#include "speaker.h"
#include <stdio.h>
//#define ROM "../roms/chip8-test-suite/5-quirks.ch8"
//#define ROM "../roms/chip8-test-suite/8-scrolling.ch8"
#define ROM "../roms/games/pong_1player.ch8"
//#define ROM "../roms/ibm.ch8"
int main(int argc, char *argv[])
{
// Initialize
MemInit();
MemLoadROM(ROM);
ScreenInit(1000,500);
VCPUInit();
SpeakerInit();
// Set game to run at very high FPS (prevent raylib to interfer with emulator CPU frequency)
SetTargetFPS(VCPU_FREQ*100);
// Emulator main loop
int i=0;
while (!WindowShouldClose()){
VCPUTick();
if(i%600 == 0)
printf("tick\n");
i++;
}
// Finish
SpeakerFinish();
ScreenClose();
return 0;
}