summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README6
-rw-r--r--chip8.c5
2 files changed, 5 insertions, 6 deletions
diff --git a/README b/README
index 33b0471..91bb524 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-CHIP-8 interpreter in C using SDL2 for graphics and sound.
+CHIP-8 interpreter in C using SDL2 for graphics.
# build
```
@@ -8,8 +8,8 @@ make
The binary is in bin/
# running
```
-usage: bin/chip8 [scale] [speed] [romfile]
-scale - pixel scaling (~5 recommended)
+usage: bin/chip8 [-s video scale] [-f framerate] romfile
+scale - pixel scaling (5-10 recommended)
speed - how many cycles per second should be run (60-1000 or so, depends on the game)
```
A number of example ROM files are provided in the roms/ directory.
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