diff --git a/Notes.org b/Notes.org index d70fce7..0d77595 100644 --- a/Notes.org +++ b/Notes.org @@ -1,5 +1,7 @@ * Chip8 Emulator +Reference [[http://devernay.free.fr/hacks/chip8/C8TECH10.HTM][here]]. + ** The memory Layout The Chip8 has 4095 bytes of memory: diff --git a/compile_flags.txt b/compile_flags.txt new file mode 100644 index 0000000..05b6df6 --- /dev/null +++ b/compile_flags.txt @@ -0,0 +1,3 @@ +-Iinclude +-Wall +-Werror diff --git a/include/chip8.h b/include/chip8.h new file mode 100644 index 0000000..ed504fe --- /dev/null +++ b/include/chip8.h @@ -0,0 +1,10 @@ +#ifndef __CHIP8_H +#define __CHIP8_H + +#include "config.h" + +struct chip8 +{ +}; + +#endif diff --git a/include/config.h b/include/config.h new file mode 100644 index 0000000..d449802 --- /dev/null +++ b/include/config.h @@ -0,0 +1,11 @@ +#ifndef __CONFIG_H +#define __CONFIG_H + +#define EMULATOR_WINDOW_TITLE "Chip8" +#define EMULATOR_WINDOW_MULTIPLIER 10 + +#define CHIP8_MEMORY_SIZE 4096 +#define CHIP8_DISPLAY_WIDTH 63 +#define CHIP8_DISPLAY_HEIGHT 32 + +#endif diff --git a/src/main.c b/src/main.c index f598dde..f2c6603 100644 --- a/src/main.c +++ b/src/main.c @@ -1,13 +1,15 @@ #include -#include + +#include "chip8.h" int main (int argc, char **argv) { SDL_Init (SDL_INIT_EVERYTHING); - SDL_Window *window - = SDL_CreateWindow ("Chip8", SDL_WINDOWPOS_UNDEFINED, - SDL_WINDOWPOS_UNDEFINED, 640, 320, SDL_WINDOW_SHOWN); + SDL_Window *window = SDL_CreateWindow ( + EMULATOR_WINDOW_TITLE, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, + CHIP8_DISPLAY_WIDTH * EMULATOR_WINDOW_MULTIPLIER, + CHIP8_DISPLAY_HEIGHT * EMULATOR_WINDOW_MULTIPLIER, SDL_WINDOW_SHOWN); SDL_Renderer *renderer = SDL_CreateRenderer (window, -1, SDL_TEXTUREACCESS_TARGET);