* Copyright (C) 1999 Jonathan St-André
* Copyright (C) 1999 Hugo Villeneuve <hugo@hugovil.com>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ * This file is released under the GPLv2
*/
#if HAVE_CONFIG_H
#include "common.h"
#include "memory.h"
#include "cpu8051.h"
+#include "opcodes.h"
#include "pgmwin.h"
#include "hexfile.h"
#define LIST_VIEW_NAME "Program"
#define DATA_ROWS 100
-enum
-{
+enum {
COL_BREAKPT = 0,
COL_ADDR,
COL_B0,
if (row == 0)
gtk_list_store_set(store, &iter, COL_COLOR, "red", -1);
else
- gtk_list_store_set(store, &iter, COL_COLOR, "black", -1);
+ gtk_list_store_set(store, &iter, COL_COLOR, "black",
+ -1);
}
return store;
gtk_tree_model_get(model, &iter, COL_ADDR, &str_addr, -1);
/* Convert hex address in ASCII to integer. */
+ /* No need to check error, has already been validated. */
val = asciihex2int(str_addr);
log_debug(" row address is: $%04X", val);
- ToggleBreakpoint(val);
+ breakpoint_toggle(val);
pgmwin_refresh();
g_free(str_addr);
gtk_tree_selection_set_mode(selection, GTK_SELECTION_BROWSE);
g_signal_connect(selection, "changed",
- G_CALLBACK(pgmwin_sel_changed_event), NULL);
+ G_CALLBACK(pgmwin_sel_changed_event), NULL);
pgmwin_init_columns();
{
int row;
GtkListStore *store;
- unsigned int Address;
+ unsigned int address;
- Address = cpu8051.pc;
+ address = cpu8051.pc;
store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(pgmlist)));
char str[128];
int k;
int col_id;
- int InstSize;
- unsigned char OpCode;
+ int inst_size;
+ unsigned char opcode;
if (row == 0) {
/* Get first row in list store */
}
if (!valid) {
- printf("Invalid iter...\n");
+ log_err("Tree model: invalid iter");
return;
}
- if (Address > 0xFFFF) {
+ if (address > 0xFFFF) {
/*
* Not the most elegant solution, but it works to not
* display instructions past last address, 0xFFFF.
-1);
} else {
/* Display breakpoints. */
- if (IsBreakpoint(Address))
+ if (breakpoint_is_defined(address))
sprintf(str, "*");
else
str[0] = '\0';
gtk_list_store_set(store, &iter, COL_BREAKPT, str, -1);
/* Display base address. */
- int2asciihex(Address, str, 4);
-
+ int2asciihex(address, str, 4);
gtk_list_store_set(store, &iter, COL_ADDR, str, -1);
- OpCode = memory_read8(PGM_MEM_ID, Address);
- InstSize = cpu8051_get_instruction_size(OpCode);
+ opcode = mem_read8(PGM_MEM_ID, address);
+ inst_size = opcodes_get_instr_size(opcode);
/* Display instruction hex bytes. */
for (k = 0, col_id = COL_B0; k < 3; k++, col_id++) {
- if (k < InstSize)
- int2asciihex(memory_read8(PGM_MEM_ID,
- Address + k),
+ if (k < inst_size)
+ int2asciihex(mem_read8(PGM_MEM_ID,
+ address + k),
str, 2);
else
str[0] = '\0';
- gtk_list_store_set(store, &iter, col_id, str, -1);
+ gtk_list_store_set(store, &iter, col_id, str,
+ -1);
}
/* Display instruction menmonic. */
- cpu8051_disasm_mnemonic(OpCode, str);
+ (void) cpu8051_disasm_mnemonic(opcode, str);
gtk_list_store_set(store, &iter, COL_INST, str, -1);
/* Display instruction arguments (if applicable). */
- str[0] = '\0';
- cpu8051_disasm_args(Address, str);
+ cpu8051_disasm_args(address, str);
gtk_list_store_set(store, &iter, COL_ARGS, str, -1);
- Address += InstSize;
+ address += inst_size;
}
}
}