chip8

CHIP-8 emulator
git clone git://git.christosmarg.xyz/chip8.git
Log | Files | Refs | README | LICENSE

commit 097af219ccf7d31216828178597065c3b130764c
parent 4ca5d318e2c2146355dd28e4ee8a6940304808da
Author: Christos Margiolis <christos@margiolis.net>
Date:   Fri, 13 Nov 2020 19:24:11 +0200

minor changes

Diffstat:
MMakefile | 9+++++----
Mchip8.1 | 0
Mchip8.c | 7+++----
Mconfig.mk | 8--------
Mroms/15PUZZLE | 0
Mroms/BLINKY | 0
Mroms/BLITZ | 0
Mroms/BRIX | 0
Mroms/CAVE | 0
Mroms/CONNECT4 | 0
Mroms/GUESS | 0
Mroms/HIDDEN | 0
Mroms/IBM | 0
Mroms/INVADERS | 0
Mroms/KALEID | 0
Mroms/MAZE | 0
Mroms/MAZE2 | 0
Mroms/MERLIN | 0
Mroms/MISSILE | 0
Mroms/PONG | 0
Mroms/PONG2 | 0
Mroms/PONG3 | 0
Mroms/PUZZLE | 0
Mroms/REVERSI | 0
Mroms/RUSH_HOUR | 0
Mroms/SYZYGY | 0
Mroms/TANK | 0
Mroms/TETRIS | 0
Mroms/TICTAC | 0
Mroms/UFO | 0
Mroms/VBRIX | 0
Mroms/VERS | 0
Mroms/WALL | 0
Mroms/WIPEOFF | 0
Mroms/super/ALIEN | 0
Mroms/super/ANT | 0
Mroms/super/BLINKY | 0
Mroms/super/CAR | 0
Mroms/super/JOUST | 0
Mroms/super/PIPER | 0
Mroms/super/RACE | 0
Mroms/super/SPACEFIG | 0
Mroms/super/UBOAT | 0
Mroms/super/WORM | 0
44 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/Makefile b/Makefile @@ -8,8 +8,9 @@ BIN = chip8 DIST = ${BIN}-${VERSION} MAN1 = ${BIN}.1 +EXT = c SRC = chip8.c -OBJ = chip8.o +OBJ = ${SRC:.${EXT}=.o} all: options ${BIN} @@ -22,12 +23,12 @@ options: ${BIN}: ${OBJ} ${CC} ${LDFLAGS} ${OBJ} -o $@ -${OBJ}: ${SRC} - ${CC} ${CFLAGS} -c ${SRC} -o $@ +.${EXT}.o: + ${CC} -c ${CFLAGS} $< dist: clean ${MKDIR} ${DIST} - ${CP} -R roms ${SRC} config.mk LICENSE Makefile README.md ${DIST} + ${CP} -R roms ${MAN1} ${SRC} config.mk LICENSE Makefile README.md ${DIST} ${TAR} ${DIST}.tar ${DIST} ${GZIP} ${DIST}.tar ${RM_DIR} ${DIST} diff --git a/chip8.1 b/chip8.1 diff --git a/chip8.c b/chip8.c @@ -1,5 +1,4 @@ /* See LICENSE file for copyright and license details. */ - #include <stdarg.h> #include <stdio.h> #include <stdlib.h> @@ -48,7 +47,7 @@ static const u_int8_t keymap[16] = { }; static void chip8_init(struct Chip8 *); -static void romload(struct Chip8 *, const char *); +static void rom_load(struct Chip8 *, const char *); static void emulate(struct Chip8 *); static int decode(struct Chip8 *); static void timers_update(struct Chip8 *); @@ -107,7 +106,7 @@ chip8_init(struct Chip8 *chip8) } void -romload(struct Chip8 *chip8, const char *fpath) +rom_load(struct Chip8 *chip8, const char *fpath) { FILE *rom; size_t res; @@ -444,7 +443,7 @@ main(int argc, char *argv[]) die("SDL error: %s", SDL_GetError()); chip8_init(&chip8); - romload(&chip8, argv[1]); + rom_load(&chip8, argv[1]); while (evts(&chip8)) { emulate(&chip8); diff --git a/config.mk b/config.mk @@ -6,10 +6,6 @@ VERSION = 0 PREFIX = /usr/local MAN_DIR = ${PREFIX}/man/man1 BIN_DIR = ${PREFIX}/bin -# uncomment if you're making a library -#MAN_DIR = ${PREFIX}/man/man3 -#INC_DIR = ${PREFIX}/include -#LIB_DIR = ${PREFIX}/lib # includes and libs INCS = -Iinclude @@ -21,8 +17,6 @@ CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L \ CFLAGS = -std=c99 -pedantic -Wall -Wno-deprecated-declarations \ -O3 ${INCS} ${CPPFLAGS} LDFLAGS = ${LIBS} -# uncomment if you're making a library -#ARFLAGS = rs # utils CP = cp -f @@ -36,5 +30,3 @@ GZIP = gzip # compiler CC = gcc -# uncomment if you're making a library -#AR = ar diff --git a/roms/15PUZZLE b/roms/15PUZZLE Binary files differ. diff --git a/roms/BLINKY b/roms/BLINKY Binary files differ. diff --git a/roms/BLITZ b/roms/BLITZ Binary files differ. diff --git a/roms/BRIX b/roms/BRIX Binary files differ. diff --git a/roms/CAVE b/roms/CAVE Binary files differ. diff --git a/roms/CONNECT4 b/roms/CONNECT4 Binary files differ. diff --git a/roms/GUESS b/roms/GUESS Binary files differ. diff --git a/roms/HIDDEN b/roms/HIDDEN Binary files differ. diff --git a/roms/IBM b/roms/IBM Binary files differ. diff --git a/roms/INVADERS b/roms/INVADERS Binary files differ. diff --git a/roms/KALEID b/roms/KALEID Binary files differ. diff --git a/roms/MAZE b/roms/MAZE Binary files differ. diff --git a/roms/MAZE2 b/roms/MAZE2 Binary files differ. diff --git a/roms/MERLIN b/roms/MERLIN Binary files differ. diff --git a/roms/MISSILE b/roms/MISSILE Binary files differ. diff --git a/roms/PONG b/roms/PONG Binary files differ. diff --git a/roms/PONG2 b/roms/PONG2 Binary files differ. diff --git a/roms/PONG3 b/roms/PONG3 Binary files differ. diff --git a/roms/PUZZLE b/roms/PUZZLE Binary files differ. diff --git a/roms/REVERSI b/roms/REVERSI Binary files differ. diff --git a/roms/RUSH_HOUR b/roms/RUSH_HOUR Binary files differ. diff --git a/roms/SYZYGY b/roms/SYZYGY Binary files differ. diff --git a/roms/TANK b/roms/TANK Binary files differ. diff --git a/roms/TETRIS b/roms/TETRIS Binary files differ. diff --git a/roms/TICTAC b/roms/TICTAC Binary files differ. diff --git a/roms/UFO b/roms/UFO Binary files differ. diff --git a/roms/VBRIX b/roms/VBRIX Binary files differ. diff --git a/roms/VERS b/roms/VERS Binary files differ. diff --git a/roms/WALL b/roms/WALL Binary files differ. diff --git a/roms/WIPEOFF b/roms/WIPEOFF Binary files differ. diff --git a/roms/super/ALIEN b/roms/super/ALIEN Binary files differ. diff --git a/roms/super/ANT b/roms/super/ANT Binary files differ. diff --git a/roms/super/BLINKY b/roms/super/BLINKY Binary files differ. diff --git a/roms/super/CAR b/roms/super/CAR Binary files differ. diff --git a/roms/super/JOUST b/roms/super/JOUST Binary files differ. diff --git a/roms/super/PIPER b/roms/super/PIPER Binary files differ. diff --git a/roms/super/RACE b/roms/super/RACE Binary files differ. diff --git a/roms/super/SPACEFIG b/roms/super/SPACEFIG Binary files differ. diff --git a/roms/super/UBOAT b/roms/super/UBOAT Binary files differ. diff --git a/roms/super/WORM b/roms/super/WORM Binary files differ.