about summary refs log tree commit diff
path: root/emulator.h
diff options
context:
space:
mode:
authorManuel Palenzuela <manuelpalenzuelamerino@gmail.com>2021-07-23 00:31:39 +0100
committerManuel Palenzuela <manuelpalenzuelamerino@gmail.com>2021-07-23 00:31:39 +0100
commitde1aea22e649c246edb7976b6bcce38a210e1851 (patch)
treed578125e533c5d2f94e8a5d267956dd45669b936 /emulator.h
parentFeature: Implemented various instructions (diff)
downloadCHIP8-Emulator-de1aea22e649c246edb7976b6bcce38a210e1851.tar.gz
CHIP8-Emulator-de1aea22e649c246edb7976b6bcce38a210e1851.tar.bz2
CHIP8-Emulator-de1aea22e649c246edb7976b6bcce38a210e1851.zip
Feature: Added key detection
Diffstat (limited to 'emulator.h')
-rw-r--r--emulator.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/emulator.h b/emulator.h
index 489ad71..fa455d9 100644
--- a/emulator.h
+++ b/emulator.h
@@ -44,11 +44,18 @@ typedef struct
 
 typedef struct
 {
+    uint8_t activated;
+    uint8_t value;
+} Key;
+
+typedef struct
+{
     volatile uint8_t is_on;
     volatile uint8_t draw_flag;
     volatile uint8_t delay_timer;
     volatile uint8_t sound_timer;
     uint8_t display[64][32];
+    Key keys[16];
     Registers regs;
     uint8_t sp; //stack pointer
     uint16_t stack[16];
@@ -62,6 +69,9 @@ int emulator_tick(Emulator* emulator);
 void emulator_step(Emulator* emulator);
 void emulator_dump_registers(Emulator* emulator);
 
+int emulator_handle_key_press(Emulator* emulator, uint8_t key);
+int emulator_handle_key_release(Emulator* emulator, uint8_t key);
+
 void* emulator_timers_thread();
 
 #endif