int debug_comment_add(int cpu_num, offs_t addr, const char *comment, rgb_t color, UINT32 c_crc)
{
	int i = 0;
	int insert_point = debug_comments[cpu_num].comment_count;
	int match = 0;

	/* Create a new item to insert into the list */
	debug_comment *insert_me = (debug_comment*) malloc(sizeof(debug_comment));
	insert_me->color = color;
	insert_me->is_valid = 1;
	insert_me->address = addr;
	insert_me->crc = c_crc;
	strcpy(insert_me->text, comment);

	/* Find the insert point */
	for (i = 0; i < debug_comments[cpu_num].comment_count; i++)
	{
		if (insert_me->address < debug_comments[cpu_num].comment_info[i]->address)
		{
			insert_point = i;
			break;
		}
		else if (insert_me->address == debug_comments[cpu_num].comment_info[i]->address &&
				 insert_me->crc == debug_comments[cpu_num].comment_info[i]->crc)
		{
			insert_point = i;
			match = 1;
			break;
		}
	}

	/* Got an exact match?  Just replace */
	if (match == 1)
	{
		free(debug_comments[cpu_num].comment_info[insert_point]);
		debug_comments[cpu_num].comment_info[insert_point] = insert_me;
		debug_comments[cpu_num].change_count++;

		/* force an update of disassembly views */
		debug_view_update_type(DVT_DISASSEMBLY);
		return 1;
	}

	/* Otherwise insert */
	/* First, shift the list down */
	for (i = debug_comments[cpu_num].comment_count; i >= insert_point; i--)
		debug_comments[cpu_num].comment_info[i] = debug_comments[cpu_num].comment_info[i-1];

	/* do the insertion */
	debug_comments[cpu_num].comment_info[insert_point] = insert_me;
	debug_comments[cpu_num].comment_count++;
	debug_comments[cpu_num].change_count++;

	/* force an update of disassembly views */
	debug_view_update_type(DVT_DISASSEMBLY);

	return 1;
}
Example #2
0
void debug_errorlog_write_line(running_machine *machine, const char *line)
{
	if (errorlog_textbuf)
		text_buffer_print(errorlog_textbuf, line);

	/* force an update of any log views */
	debug_view_update_type(DVT_LOG);
}
Example #3
0
void CLIB_DECL debug_console_vprintf(running_machine *machine, const char *format, va_list args)
{
	vsprintf(giant_string_buffer, format, args);
	text_buffer_print(console_textbuf, giant_string_buffer);

	/* force an update of any console views */
	debug_view_update_type(machine, DVT_CONSOLE);
}
Example #4
0
void CLIB_DECL debug_console_printf_wrap(int wrapcol, const char *format, ...)
{
	va_list arg;

	va_start(arg, format);
	vsprintf(giant_string_buffer, format, arg);
	va_end(arg);

	text_buffer_print_wrap(console_textbuf, giant_string_buffer, wrapcol);

	/* force an update of any console views */
	debug_view_update_type(DVT_CONSOLE);
}
Example #5
0
void CLIB_DECL debug_console_printf_wrap(running_machine *machine, int wrapcol, const char *format, ...)
{
	astring buffer;
	va_list arg;

	va_start(arg, format);
	buffer.vprintf(format, arg);
	va_end(arg);

	text_buffer_print_wrap(console_textbuf, buffer, wrapcol);

	/* force an update of any console views */
	debug_view_update_type(machine, DVT_CONSOLE);
}
int debug_comment_remove(int cpu_num, offs_t addr, UINT32 c_crc)
{
	int i;
	int remove_index = -1;

	for (i = 0; i < debug_comments[cpu_num].comment_count; i++)
	{
		if (debug_comments[cpu_num].comment_info[i]->address == addr)	/* got an address match */
		{
			if (debug_comments[cpu_num].comment_info[i]->crc == c_crc)
			{
				remove_index = i;
			}
		}
	}

	/* The comment doesn't exist? */
	if (remove_index == -1)
		return 0;

	/* Okay, it's there, now remove it */
	free(debug_comments[cpu_num].comment_info[remove_index]);

	for (i = remove_index; i < debug_comments[cpu_num].comment_count-1; i++)
	{
		debug_comments[cpu_num].comment_info[i] = debug_comments[cpu_num].comment_info[i+1];
	}

	debug_comments[cpu_num].comment_count--;
	debug_comments[cpu_num].change_count++;

	/* force an update of disassembly views */
	debug_view_update_type(DVT_DISASSEMBLY);

	return 1;
}