about summary refs log tree commit diff
path: root/emulator.h
diff options
context:
space:
mode:
authorManuel Palenzuela <manuelpalenzuelamerino@gmail.com>2021-07-19 17:30:55 +0100
committerManuel Palenzuela <manuelpalenzuelamerino@gmail.com>2021-07-19 17:30:55 +0100
commite60c3c684f87f32ba0500892ff85215faaaad0d5 (patch)
tree7707021822ebdf348d0dc6468d216ed33d207bff /emulator.h
parentMisc: Added the dbgprintf() macro (diff)
downloadCHIP8-Emulator-e60c3c684f87f32ba0500892ff85215faaaad0d5.tar.gz
CHIP8-Emulator-e60c3c684f87f32ba0500892ff85215faaaad0d5.tar.bz2
CHIP8-Emulator-e60c3c684f87f32ba0500892ff85215faaaad0d5.zip
Feature: Added timers thread
Diffstat (limited to 'emulator.h')
-rw-r--r--emulator.h15
1 files changed, 10 insertions, 5 deletions
diff --git a/emulator.h b/emulator.h
index 05cd3ef..cf1e81c 100644
--- a/emulator.h
+++ b/emulator.h
@@ -4,8 +4,10 @@
 #include <config.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <sys/stat.h>
 #include <string.h>
+#include <unistd.h>
+#include <pthread.h>
+#include <sys/stat.h>
 
 typedef struct
 {
@@ -41,13 +43,14 @@ typedef struct
 
 typedef struct
 {
-    uint8_t is_on;
-    uint16_t pc; //program counter
+    volatile uint8_t is_on;
+    volatile uint8_t delay_timer;
+    volatile uint8_t sound_timer;
+    uint8_t display[64][32];
     Registers regs;
     uint8_t sp; //stack pointer
     uint16_t stack[16];
-    volatile uint8_t delay_timer;
-    volatile uint8_t sound_timer;
+    uint16_t pc; //program counter
     uint8_t memory[4096];
 } Emulator;
 
@@ -56,4 +59,6 @@ int emulator_load_rom(Emulator* emulator, char* rom_name);
 int emulator_tick(Emulator* emulator);
 void emulator_dump_registers(Emulator* emulator);
 
+void* emulator_timers_thread();
+
 #endif