diff --git a/main.c b/main.c index 68cc409..f088a07 100644 --- a/main.c +++ b/main.c @@ -23,6 +23,7 @@ #include "simdata.h" #include "stdint.h" #include +#include void help(char* progname){ printf("Usage: %s -i \n", progname); @@ -54,6 +55,13 @@ int main(int argc, char* argd[] ){ /// READ ROM FILE /// FILE* rom=fopen(infile,"r"); + + if (rom == NULL) { + printf("ERROR: Couldn't open rom file\n"); + perror(infile); + return 1; + } + fseek(rom, 0, SEEK_END); if(ftell(rom)!=16777216){ printf("ERROR: ROM file isn't 16MiB\n");