added a little function to initialise the chip8 structure
This commit is contained in:
parent
d4944caf67
commit
fac5c920de
6
Makefile
6
Makefile
@ -3,7 +3,7 @@ ECHO=echo -e
|
|||||||
CFLAGS=-Wall -Werror -std=gnu99 -O0 -g -Iinclude
|
CFLAGS=-Wall -Werror -std=gnu99 -O0 -g -Iinclude
|
||||||
LIBS=-lSDL2
|
LIBS=-lSDL2
|
||||||
|
|
||||||
FILES=build/main.o build/mem.o build/stack.o build/keyboard.o
|
FILES=build/main.o build/mem.o build/stack.o build/keyboard.o build/chip8.o
|
||||||
OUT=bin/chip8.out
|
OUT=bin/chip8.out
|
||||||
|
|
||||||
all: $(FILES)
|
all: $(FILES)
|
||||||
@ -26,6 +26,10 @@ build/keyboard.o: src/keyboard.c
|
|||||||
@$(ECHO) "CC\t\t"$<
|
@$(ECHO) "CC\t\t"$<
|
||||||
@$(CC) $(CFLAGS) $< -c -o $@ $(LIBS)
|
@$(CC) $(CFLAGS) $< -c -o $@ $(LIBS)
|
||||||
|
|
||||||
|
build/chip8.o: src/chip8.c
|
||||||
|
@$(ECHO) "CC\t\t"$<
|
||||||
|
@$(CC) $(CFLAGS) $< -c -o $@ $(LIBS)
|
||||||
|
|
||||||
run: all
|
run: all
|
||||||
@$(ECHO) "Runing the Chip8 compiler"
|
@$(ECHO) "Runing the Chip8 compiler"
|
||||||
@$(OUT)
|
@$(OUT)
|
||||||
|
@ -15,4 +15,6 @@ struct chip8
|
|||||||
struct chip8_keyboard keyboard;
|
struct chip8_keyboard keyboard;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void chip8_init (struct chip8 *chip8);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
8
src/chip8.c
Normal file
8
src/chip8.c
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#include "chip8.h"
|
||||||
|
#include <memory.h>
|
||||||
|
|
||||||
|
void
|
||||||
|
chip8_init (struct chip8 *chip8)
|
||||||
|
{
|
||||||
|
memset (chip8, 0, sizeof (struct chip8));
|
||||||
|
}
|
@ -10,6 +10,7 @@ int
|
|||||||
main (int argc, char **argv)
|
main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
struct chip8 chip8;
|
struct chip8 chip8;
|
||||||
|
chip8_init (&chip8);
|
||||||
|
|
||||||
SDL_Init (SDL_INIT_EVERYTHING);
|
SDL_Init (SDL_INIT_EVERYTHING);
|
||||||
SDL_Window *window = SDL_CreateWindow (
|
SDL_Window *window = SDL_CreateWindow (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user