Mercurial > repos > blastem
comparison io.h @ 421:d0cacb4ade0b
Move IO code to a separate file and do a tiny bit of refactoring
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Tue, 25 Jun 2013 19:20:39 -0700 |
parents | |
children | 140af5509ce7 |
comparison
equal
deleted
inserted
replaced
420:9fb111b5641f | 421:d0cacb4ade0b |
---|---|
1 #ifndef IO_H_ | |
2 #define IO_H_ | |
3 #include <stdint.h> | |
4 | |
5 typedef struct { | |
6 uint32_t th_counter; | |
7 uint32_t timeout_cycle; | |
8 uint8_t output; | |
9 uint8_t control; | |
10 uint8_t input[3]; | |
11 } io_port; | |
12 | |
13 #define GAMEPAD_TH0 0 | |
14 #define GAMEPAD_TH1 1 | |
15 #define GAMEPAD_EXTRA 2 | |
16 #define GAMEPAD_NONE 0xF | |
17 | |
18 void set_keybindings(); | |
19 void io_adjust_cycles(io_port * pad, uint32_t current_cycle, uint32_t deduction); | |
20 void io_data_write(io_port * pad, uint8_t value, uint32_t current_cycle); | |
21 uint8_t io_data_read(io_port * pad, uint32_t current_cycle); | |
22 void handle_keydown(int keycode); | |
23 void handle_keyup(int keycode); | |
24 void handle_joydown(int joystick, int button); | |
25 void handle_joyup(int joystick, int button); | |
26 void handle_joy_dpad(int joystick, int dpad, uint8_t state); | |
27 | |
28 #endif //IO_H_ | |
29 |