summaryrefslogtreecommitdiff
path: root/chip8.c
diff options
context:
space:
mode:
authorDaniel Jones <admin@danieljon.es>2020-10-17 00:30:01 +1030
committerDaniel Jones <admin@danieljon.es>2020-10-17 00:30:01 +1030
commit1857ca47143624ee81acfa61e9cf4ea57bd4b042 (patch)
treed45014df481aaa4bdbd9ec3112fca16ccc74b848 /chip8.c
parentc2c45b45f981e557838943c6f24329c51b1adb4b (diff)
downloadchip8-1857ca47143624ee81acfa61e9cf4ea57bd4b042.tar.gz
chip8-1857ca47143624ee81acfa61e9cf4ea57bd4b042.zip
use getopts for argument parsing
Diffstat (limited to 'chip8.c')
-rw-r--r--chip8.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/chip8.c b/chip8.c
index f181494..0e83917 100644
--- a/chip8.c
+++ b/chip8.c
@@ -52,21 +52,20 @@ uint8_t chip8_fontset[80] =
int
load_rom(char *rom)
{
- int ret = 1;
printf("loading rom %s..\n", rom);
FILE *romfile;
romfile = fopen(rom, "rb");
if (romfile == NULL)
{
fprintf(stderr, "cannot read rom %s: %s\n", rom, strerror(errno));
- ret = 0;
+ return 0;
}
/* read a maximum of MAX_ROM_SIZE bytes into memory starting after the reserved memory */
fread(&memory[PROGRAM_START], 1, MAX_ROM_SIZE, romfile);
fclose(romfile);
- return ret;
+ return 1;
}
void