Cleaned up some stuff

This commit is contained in:
0xmac 2024-12-02 14:31:43 +01:00
parent 0db7573a04
commit ab3b026324
2 changed files with 9 additions and 6 deletions

View File

@ -16,3 +16,5 @@
#define BACKCOLOR sfBlack #define BACKCOLOR sfBlack
#define CPUSPEED 4096 * 16

View File

@ -53,6 +53,12 @@ void drawScreen(){
} }
int main(int argc, char *argv[]){ 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); window = sfRenderWindow_create((sfVideoMode){800, 600, 24}, "LS7 Emulator", sfResize | sfClose, NULL);
sfRenderWindow_setVerticalSyncEnabled(window, sfFalse); sfRenderWindow_setVerticalSyncEnabled(window, sfFalse);
sfRenderWindow_setFramerateLimit(window, 60); sfRenderWindow_setFramerateLimit(window, 60);
@ -61,17 +67,12 @@ int main(int argc, char *argv[]){
renderStates = sfRenderStates_default(); renderStates = sfRenderStates_default();
sfTransform_scale(&renderStates.transform, 2, 2); sfTransform_scale(&renderStates.transform, 2, 2);
if (argc == 2) { openFile(argv[1]); }
else {
printf("Please specify a input file\n");
exit(1);
}
resetSystem(); resetSystem();
while (sfRenderWindow_isOpen(window)){ while (sfRenderWindow_isOpen(window)){
pollEvents(window); pollEvents(window);
for (int i = 0; i < 4096 * 16; i++) step6502(); for (int i = 0; i < CPUSPEED; i++) step6502();
irq6502(); irq6502();
sfRenderWindow_clear(window, BACKCOLOR); sfRenderWindow_clear(window, BACKCOLOR);