summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/debug/debugvw.h
blob: 696c46e54c83f13de8509320d30e8f2530039d0a (plain) (blame)
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
/*********************************************************************

    debugvw.h

    Debugger view engine.

    Copyright Nicola Salmoria and the MAME Team.
    Visit http://mamedev.org for licensing and usage restrictions.

*********************************************************************/

#ifndef __DEBUGVIEW_H__
#define __DEBUGVIEW_H__


/***************************************************************************
    CONSTANTS
***************************************************************************/

/* types passed to debug_view_alloc */
#define DVT_CONSOLE							(1)
#define DVT_REGISTERS						(2)
#define DVT_DISASSEMBLY						(3)
#define DVT_MEMORY							(4)
#define DVT_LOG								(5)
#define DVT_TIMERS							(6)
#define DVT_ALLOCS							(7)

/* properties available for all views */
#define DVP_VISIBLE_ROWS					(1)		/* r/w - UINT32 */
#define DVP_VISIBLE_COLS					(2)		/* r/w - UINT32 */
#define DVP_TOTAL_ROWS						(3)		/* r/w - UINT32 */
#define DVP_TOTAL_COLS						(4)		/* r/w - UINT32 */
#define DVP_TOP_ROW							(5)		/* r/w - UINT32 */
#define DVP_LEFT_COL						(6)		/* r/w - UINT32 */
#define DVP_UPDATE_CALLBACK					(7)		/* r/w - void (*update)(debug_view *) */
#define DVP_VIEW_DATA						(8)		/* r/o - debug_view_char * */
#define DVP_SUPPORTS_CURSOR					(9)		/* r/o - UINT32 */
#define DVP_CURSOR_VISIBLE					(10)	/* r/w - UINT32 */
#define DVP_CURSOR_ROW						(11)	/* r/w - UINT32 */
#define DVP_CURSOR_COL						(12)	/* r/w - UINT32 */
#define DVP_CHARACTER						(13)	/* w/o - UINT32 */
#define DVP_OSD_PRIVATE						(14)	/* r/w - void * */

/* properties available for register views */
#define DVP_REGS_CPUNUM						(100)	/* r/w - UINT32 */

/* properties available for disassembly views */
#define DVP_DASM_CPUNUM						(100)	/* r/w - UINT32 */
#define DVP_DASM_EXPRESSION					(101)	/* r/w - const char * */
#define DVP_DASM_TRACK_LIVE					(102)	/* r/w - UINT32 */
#define DVP_DASM_RIGHT_COLUMN				(103)	/* r/w - UINT32 */
#define   DVP_DASM_RIGHTCOL_NONE			(0)
#define   DVP_DASM_RIGHTCOL_RAW				(1)
#define   DVP_DASM_RIGHTCOL_ENCRYPTED		(2)
#define   DVP_DASM_RIGHTCOL_COMMENTS		(3)
#define DVP_DASM_BACKWARD_STEPS				(104)	/* r/w - UINT32 */
#define DVP_DASM_WIDTH						(105)	/* r/w - UINT32 */
#define DVP_DASM_ACTIVE_ADDRESS				(112)	/* r/w - UINT32 */

/* properties available for memory views */
#define DVP_MEM_CPUNUM						(100)	/* r/w - UINT32 */
#define DVP_MEM_EXPRESSION					(101)	/* r/w - const char * */
#define DVP_MEM_TRACK_LIVE					(102)	/* r/w - UINT32 */
#define DVP_MEM_SPACENUM					(103)	/* r/w - UINT32 */
#define DVP_MEM_BYTES_PER_CHUNK				(104)	/* r/w - UINT32 */
#define DVP_MEM_REVERSE_VIEW				(105)	/* r/w - UINT32 */
#define DVP_MEM_ASCII_VIEW					(106)	/* r/w - UINT32 */
#define DVP_MEM_RAW_BASE					(107)	/* r/w - void * */
#define DVP_MEM_RAW_LENGTH					(108)	/* r/w - UINT32 */
#define DVP_MEM_RAW_OFFSET_XOR				(109)	/* r/w - UINT32 */
#define DVP_MEM_RAW_LITTLE_ENDIAN			(110)	/* r/w - UINT32 */
#define DVP_MEM_WIDTH						(111)	/* r/w - UINT32 */
#define DVP_MEM_NO_TRANSLATION				(113)	/* r/w - UINT32 */

/* properties available for textbuffer views */
#define DVP_TEXTBUF_LINE_LOCK				(100)	/* r/w - UINT32 */

/* attribute bits for debug_view_char.attrib */
#define DCA_NORMAL							(0x00)	/* in Windows: black on white */
#define DCA_CHANGED							(0x01)	/* in Windows: red foreground */
#define DCA_SELECTED						(0x02)	/* in Windows: light red background */
#define DCA_INVALID							(0x04)	/* in Windows: dark blue foreground */
#define DCA_DISABLED						(0x08)	/* in Windows: darker foreground */
#define DCA_ANCILLARY						(0x10)	/* in Windows: grey background */
#define DCA_CURRENT							(0x20)	/* in Windows: yellow background */
#define DCA_COMMENT							(0x40)	/* in Windows: green foreground */

/* special characters that can be passed as a DVP_CHARACTER */
#define DCH_UP								(1)		/* up arrow */
#define DCH_DOWN							(2)		/* down arrow */
#define DCH_LEFT							(3)		/* left arrow */
#define DCH_RIGHT							(4)		/* right arrow */
#define DCH_PUP								(5)		/* page up */
#define DCH_PDOWN							(6)		/* page down */
#define DCH_HOME							(7)		/* home */
#define DCH_CTRLHOME						(8)		/* ctrl+home */
#define DCH_END								(9)		/* end */
#define DCH_CTRLEND							(10)	/* ctrl+end */
#define DCH_CTRLRIGHT						(11)	/* ctrl+right */
#define DCH_CTRLLEFT						(12)	/* ctrl+left */


/***************************************************************************
    MACROS
***************************************************************************/



/***************************************************************************
    TYPE DEFINITIONS
***************************************************************************/

/* opaque structure representing a debug view */
typedef struct _debug_view debug_view;


/* a single "character" in the debug view has an ASCII value and an attribute byte */
struct _debug_view_char
{
	UINT8		byte;
	UINT8		attrib;
};
typedef struct _debug_view_char debug_view_char;


union _debug_property_info
{
	UINT32 i;
	const char *s;
	void *p;
	genf *f;
};
typedef union _debug_property_info debug_property_info;



/***************************************************************************
    FUNCTION PROTOTYPES
***************************************************************************/

/* initialization */
void				debug_view_init(running_machine *machine);
void				debug_view_exit(running_machine *machine);

/* view creation/deletion */
debug_view *		debug_view_alloc(int type);
void				debug_view_free(debug_view *view);

/* property management */
void				debug_view_get_property(debug_view *view, int property, debug_property_info *value);
void				debug_view_set_property(debug_view *view, int property, debug_property_info value);

/* update management */
void				debug_view_begin_update(debug_view *view);
void				debug_view_end_update(debug_view *view);
void				debug_view_update_all(void);
void				debug_view_update_type(int type);

/* misc stuff */
void				debug_disasm_update_all(void);



/***************************************************************************
    INLINE HELPERS
***************************************************************************/

INLINE UINT32 debug_view_get_property_UINT32(debug_view *view, int property)
{
	debug_property_info value;
	debug_view_get_property(view, property, &value);
	return value.i;
}

INLINE void debug_view_set_property_UINT32(debug_view *view, int property, UINT32 value)
{
	debug_property_info info;
	info.i = value;
	debug_view_set_property(view, property, info);
}


INLINE const char *debug_view_get_property_string(debug_view *view, int property)
{
	debug_property_info value;
	debug_view_get_property(view, property, &value);
	return value.s;
}

INLINE void debug_view_set_property_string(debug_view *view, int property, const char *value)
{
	debug_property_info info;
	info.s = value;
	debug_view_set_property(view, property, info);
}


INLINE void *debug_view_get_property_ptr(debug_view *view, int property)
{
	debug_property_info value;
	debug_view_get_property(view, property, &value);
	return value.p;
}

INLINE void debug_view_set_property_ptr(debug_view *view, int property, void *value)
{
	debug_property_info info;
	info.s = value;
	debug_view_set_property(view, property, info);
}


INLINE genf *debug_view_get_property_fct(debug_view *view, int property)
{
	debug_property_info value;
	debug_view_get_property(view, property, &value);
	return value.f;
}

INLINE void debug_view_set_property_fct(debug_view *view, int property, genf *value)
{
	debug_property_info info;
	info.f = value;
	debug_view_set_property(view, property, info);
}

#endif