Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 27 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Currently, all opcodes are implemented and all of them except for a few work as
- [X] Supports all opcodes for the original [Chip-8](https://emu.gulrak.net/reference/opcodes/) system
- [X] Settings.txt to change background and pixel color values as well as the display scaling
- [X] Chip-8 Audio emulation (it's just a beep...)
- [X] Correct keypad input (currently wonky...)
- [X] Correct keypad input
- [ ] Settings panel to change color, display scale and debug/FPS info in the application
- [ ] Loading previous ROM files for quick access via "Load ROM"
- *Scrapped*: ~~External Debug window to show RAM contents, fetched/executed opcodes etc.~~
Expand Down Expand Up @@ -82,7 +82,32 @@ the ANGLE dylib files into the `build` dir, so it can load them. Remember to run

---
### Windows
No idea, good luck. If you figured it out, let me know per PR. Probably something similair to the steps above.
**WARNING:** I do not own a device that runs on Windows. These instructions might not work.
If there are any issues, feel free to open an issue & PR request.

**Requirements:**
- MinGW-w64 (https://www.mingw-w64.org/)
- CMake (https://cmake.org/download/)

Follow these steps to install MinGW-w64 for Windows: https://code.visualstudio.com/docs/cpp/config-mingw#_installing-the-mingww64-toolchain

Change the default compiler to use in CMakeList.txt to the following:
```cmake
set(CMAKE_CXX_COMPILER gcc)
```
Once complete, continue in Powershell:

```zsh
git clone https://github.com/npxtune/chisel8.git
cd chisel8
git submodule update --init --recursive # To fetch raylib & raygui
mkdir build && cd ./build
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j 6 # '6' -> How many cores you want to use
```

There should now be an executable called `chisel8.exe` in your build folder.
Run it and the application should open.

---
#### Copyright & Licensing
Expand Down
3 changes: 1 addition & 2 deletions include/core/emu_definition.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ typedef struct Chip8 {
uint8_t delay, sound; // Delay and sound timers
uint8_t ram[RAM_SIZE], reg[REGISTER_SIZE + 1];
uint16_t stack[STACK_SIZE];
uint16_t pc, I;
uint16_t opcode;
uint16_t pc, I, opcode;

int16_t key, i_stack;

Expand Down
4 changes: 2 additions & 2 deletions src/core/emu_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ int32_t gui_load_file(emu *chip8) {

if (file != NULL) {
SetWindowTitle(GetFileName(*dropped_file.paths));
TraceLog(LOG_INFO, "EMU_FILE -> Loading ROM into ram");
TraceLog(LOG_INFO, "EMU_FILE -> Loading ROM into RAM");

if ((fread(chip8->ram + 0x200, 1, RAM_SIZE, file)) > 0) {
TraceLog(LOG_INFO, "EMU_FILE -> ROM was loaded into ram");
TraceLog(LOG_INFO, "EMU_FILE -> ROM was loaded into RAM");
fclose(file);
UnloadDroppedFiles(dropped_file);
return 0;
Expand Down
1 change: 0 additions & 1 deletion src/core/emu_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ void emu_stop(emu *chip8, AudioStream beep) {
UnloadTexture(chip8->display);
ClearBackground(BLACK);
TraceLog(LOG_INFO, "EMU_MAIN -> Stopped emulation");
SetWindowState(FLAG_WINDOW_RESIZABLE);
SetExitKey(KEY_ESCAPE);
}

Expand Down
4 changes: 3 additions & 1 deletion src/gui/main_window.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,17 @@ void main_window(options_config *config) {
/*-------------------------------------------------------------------------------------------------------------*/

case (init):
SetExitKey(KEY_NULL);
DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), Fade(RAYWHITE, 0.2f));
DrawText("Please drag a ROM file into the window",
GetScreenWidth() / 2 - (scale.font_size * 10) + (scale.font_size / 2),
(GetScreenHeight() / 2) - scale.font_size * 1.5, scale.font_size, RAYWHITE);

if (GuiButton((Rectangle) {scale.button_x, GetScreenHeight() - (GetScreenHeight() / 6),
scale.button_width, scale.button_height},
GuiIconText(ICON_REREDO_FILL, "Return"))) {
GuiIconText(ICON_REREDO_FILL, "Return")) || IsKeyPressed(KEY_ESCAPE)) {
menu_state = normal;
SetExitKey(KEY_ESCAPE);
break;
}
if (IsFileDropped()) { // Initialize Emulation
Expand Down
5 changes: 4 additions & 1 deletion src/gui/options_window.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ float temp;

int32_t options_window(options_config *config, ui_scale *scale) {

SetExitKey(KEY_NULL);

DrawText("Settings", GetScreenWidth() / 2 - (scale->font_size * 2), (GetScreenHeight() / 12),
scale->font_size, RAYWHITE);

Expand All @@ -179,7 +181,8 @@ int32_t options_window(options_config *config, ui_scale *scale) {

if (GuiButton((Rectangle) {scale->button_x, GetScreenHeight() - (GetScreenHeight() / 6),
scale->button_width, scale->button_height},
GuiIconText(ICON_REREDO_FILL, "Return"))) {
GuiIconText(ICON_REREDO_FILL, "Return")) || IsKeyPressed(KEY_ESCAPE)) {
SetExitKey(KEY_ESCAPE);
return 0;
}
return 1;
Expand Down