-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathio.h
71 lines (55 loc) · 1.63 KB
/
io.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#ifndef __IO_H__
#define __IO_H__
#define INT_ENABLE 0x00
#define SOUND_ENABLE 0x01
#define FLIP_SCREEN 0x03
#define ONE_PLAYER_START 0x04
#define TWO_PLAYER_START 0x05
#define COIN_LOCKOUT 0x06
#define COIN_COUNTER 0x07
#define SOUND_START 0x40
#define SOUND_LEN 0x20
#define SPRITE_START 0x60
#define SPRITE_LEN 0x20
#define WATCHDOG 0xc0
#define INPUTS_0 0x00
#define INPUTS_1 0x40
#define DIP_1 0x80
#define DIP_2 0xc0
#define FREE_PLAY 0b00000000
#define ONE_COIN_ONE_GAME 0b00000001
#define ONE_COIN_TWO_GAMES 0b00000010
#define TWO_COINS_ONE_GAME 0b00000011
#define ONE_LIFE_PER_GAME 0b00000000
#define TWO_LIVES_PER_GAME 0b00000100
#define THREE_LIVES_PER_GAME 0b00001000
#define FIVE_LIVES_PER_GAME 0b00001100
#define BONUS_AT_10000 0b00000000
#define BONUS_AT_15000 0b00010000
#define BONUS_AT_20000 0b00100000
#define NO_BONUS 0b00110000
#define DIFFICULTY_HARD 0b00000000
#define DIFFICULTY_NORMAL 0b01000000
#define ALTERNATE_NAMES 0b00000000
#define NORMAL_NAMES 0b10000000
class IO: public Memory::Device, public matrix_keyboard {
public:
IO(Screen &screen): Memory::Device(256), _screen(screen) {
_up = _down = _left = _right = true;
_coin = _p1_start = _p2_start = true;
}
void operator=(uint8_t);
operator uint8_t();
void down(uint8_t key);
void up(uint8_t key);
bool int_enabled() { return _int_enabled; }
bool sound_enabled() { return _sound_enabled; }
bool screen_flipped() { return _screen_flipped; }
bool paused() { return _paused; }
private:
uint8_t _sx;
bool _up, _down, _left, _right, _coin, _p1_start, _p2_start;
bool _int_enabled, _sound_enabled, _screen_flipped, _paused;
Screen &_screen;
};
#endif