diff options
author | Manuel Palenzuela <manuelpalenzuelamerino@gmail.com> | 2021-07-23 00:31:39 +0100 |
---|---|---|
committer | Manuel Palenzuela <manuelpalenzuelamerino@gmail.com> | 2021-07-23 00:31:39 +0100 |
commit | de1aea22e649c246edb7976b6bcce38a210e1851 (patch) | |
tree | d578125e533c5d2f94e8a5d267956dd45669b936 /emulator.h | |
parent | Feature: Implemented various instructions (diff) | |
download | CHIP8-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.h | 10 |
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 |