-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from jwt2706/dev
Dev
- Loading branch information
Showing
8 changed files
with
718 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
cc_library( | ||
name = "chip8", | ||
srcs = ["chip8.c"], | ||
hdrs = ["chip8.h"], | ||
srcs = glob(["src/*.c"]), | ||
hdrs = glob(["include/*.h"]), | ||
includes = ["include"], | ||
) | ||
|
||
cc_binary( | ||
name = "main", | ||
srcs = ["main.c"], | ||
deps = [":chip8"], | ||
srcs = ["src/main.c"], | ||
deps = [ | ||
":chip8", | ||
"@SDL2//:SDL2", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
# CHIP-8 Emulator | ||
# CHIP-8 <s>Emulator</s> Interpreter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
|
||
http_archive( | ||
name = "SDL2", | ||
urls = ["https://www.libsdl.org/release/SDL2-2.0.14.tar.gz"], | ||
sha256 = "d8215b571a581be1332d2106f8036fcb03d12a70bae01e20f424976d275432bc", | ||
build_file_content = """ | ||
cc_library( | ||
name = "SDL2", | ||
srcs = glob(["SDL2-2.0.14/src/*.c", "SDL2-2.0.14/include/*.h"]), | ||
hdrs = glob(["SDL2-2.0.14/include/*.h"]), | ||
includes = ["SDL2-2.0.14/include"], | ||
visibility = ["//visibility:public"], | ||
) | ||
""" | ||
) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include "chip8.h" | ||
|
||
// CHIP-8 system variables | ||
// (NOTE: chars are 8-bits, shorts are 16-bits) | ||
struct chip8 { | ||
unsigned short opcode; // current operation code | ||
unsigned char memory[4096]; // the CHIP-8 system has 4KB of memory | ||
unsigned char V[16]; // 16 general purpose 8-bit registers | ||
unsigned short I; // memory address | ||
unsigned short pc; // program counter | ||
unsigned char gfx[64 * 32]; // for the monochrome display (size of 64 * 32 pixels) | ||
unsigned char delay_timer; // self explanatory | ||
unsigned char sound_timer; // also self explanatory | ||
unsigned short stack[16]; // stack with 16 levels | ||
unsigned short sp; // stack pointer | ||
unsigned char key[16]; // keypad | ||
}; | ||
|
||
struct chip8 chip8; |
File renamed without changes.