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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
/**********************************************************************
Mephisto Chess Computers
**********************************************************************/
#ifndef __MBOARD_H__
#define __MBOARD_H__
/***************************************************************************
MACROS
***************************************************************************/
enum
{
EM, /*No piece*/
BP,
BN,
BB,
BR,
BQ,
BK,
WP,
WN,
WB,
WR,
WQ,
WK
};
#define NOT_VALID 99
#define BORDER_PIECE 64
/***************************************************************************
FUNCTION PROTOTYPES
***************************************************************************/
class mboard_state : public driver_device
{
public:
mboard_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag)
{ }
DECLARE_READ8_MEMBER(mboard_read_board_8);
DECLARE_WRITE8_MEMBER(mboard_write_board_8);
DECLARE_WRITE8_MEMBER(mboard_write_LED_8);
DECLARE_READ16_MEMBER(mboard_read_board_16);
DECLARE_WRITE16_MEMBER(mboard_write_board_16);
DECLARE_WRITE16_MEMBER(mboard_write_LED_16);
DECLARE_READ32_MEMBER(mboard_read_board_32);
DECLARE_WRITE32_MEMBER(mboard_write_board_32);
DECLARE_WRITE32_MEMBER(mboard_write_LED_32);
TIMER_DEVICE_CALLBACK_MEMBER( mboard_update_artwork);
void mboard_savestate_register();
void mboard_set_board();
void mboard_set_border_pieces();
inline UINT8 pos_to_num(UINT8 val);
UINT8 mboard_lcd_invert;
UINT8 mboard_key_select;
UINT8 mboard_key_selector;
int get_first_cleared_bit(UINT8 data);
private:
static const int start_board[64];
static UINT8 border_pieces[12];
int m_board[64];
int save_board[64];
UINT16 Line18_LED;
UINT16 Line18_REED;
int mouse_hold_border_piece;
UINT8 mouse_hold_from;
UINT8 mouse_hold_piece;
int read_board_flag;
int get_first_bit(UINT8 data);
UINT8 read_board();
void write_board(UINT8 data);
void write_LED(UINT8 data);
void board_presave();
void board_postload();
void clear_board();
void set_artwork();
void check_board_buttons();
};
#endif /* __MBOARD_H__ */
|