diff --git a/src/config.h b/src/config.h index 425213d..425d2c7 100644 --- a/src/config.h +++ b/src/config.h @@ -16,3 +16,5 @@ #define BACKCOLOR sfBlack +#define CPUSPEED 4096 * 16 + diff --git a/src/ls7emulator.c b/src/ls7emulator.c index b99c529..d93c592 100644 --- a/src/ls7emulator.c +++ b/src/ls7emulator.c @@ -53,6 +53,12 @@ void drawScreen(){ } int main(int argc, char *argv[]){ + if (argc == 2) { openFile(argv[1]); } + else { + puts("Please specify a input file as an Argument"); + exit(1); + } + window = sfRenderWindow_create((sfVideoMode){800, 600, 24}, "LS7 Emulator", sfResize | sfClose, NULL); sfRenderWindow_setVerticalSyncEnabled(window, sfFalse); sfRenderWindow_setFramerateLimit(window, 60); @@ -61,17 +67,12 @@ int main(int argc, char *argv[]){ renderStates = sfRenderStates_default(); sfTransform_scale(&renderStates.transform, 2, 2); - if (argc == 2) { openFile(argv[1]); } - else { - printf("Please specify a input file\n"); - exit(1); - } resetSystem(); while (sfRenderWindow_isOpen(window)){ pollEvents(window); - for (int i = 0; i < 4096 * 16; i++) step6502(); + for (int i = 0; i < CPUSPEED; i++) step6502(); irq6502(); sfRenderWindow_clear(window, BACKCOLOR);