added a config file

This commit is contained in:
Ghostie 2025-02-08 17:54:12 -05:00
parent 9880e3b52c
commit 73a23407e4
5 changed files with 32 additions and 4 deletions

View File

@ -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:

3
compile_flags.txt Normal file
View File

@ -0,0 +1,3 @@
-Iinclude
-Wall
-Werror

10
include/chip8.h Normal file
View File

@ -0,0 +1,10 @@
#ifndef __CHIP8_H
#define __CHIP8_H
#include "config.h"
struct chip8
{
};
#endif

11
include/config.h Normal file
View File

@ -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

View File

@ -1,13 +1,15 @@
#include <SDL2/SDL.h>
#include <stdio.h>
#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);