X-Git-Url: http://gitweb.hugovil.com/?a=blobdiff_plain;f=src%2Fgtk%2Fpgmwin.c;h=d1ad01055c310668d7d3910695fa2ed6c81782f4;hb=f7e3f1d8d0438f52e4f988a12318075cc1b43568;hp=f2c6a8c4dc87c589450a5cc29d7660a118f270c9;hpb=3c838204cd78bcf106fdd65476180659ab629fcb;p=emu8051.git diff --git a/src/gtk/pgmwin.c b/src/gtk/pgmwin.c index f2c6a8c..d1ad010 100644 --- a/src/gtk/pgmwin.c +++ b/src/gtk/pgmwin.c @@ -16,6 +16,7 @@ #include "common.h" #include "memory.h" #include "cpu8051.h" +#include "opcodes.h" #include "pgmwin.h" #include "hexfile.h" @@ -24,8 +25,7 @@ static GtkWidget *pgmlist; #define LIST_VIEW_NAME "Program" #define DATA_ROWS 100 -enum -{ +enum { COL_BREAKPT = 0, COL_ADDR, COL_B0, @@ -72,7 +72,8 @@ pgmwin_init_store(void) 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; @@ -133,11 +134,12 @@ pgmwin_sel_changed_event(GtkWidget *widget, GdkEvent *event, gpointer data) 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); @@ -183,7 +185,7 @@ pgmwin_init(void) 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(); @@ -203,9 +205,9 @@ pgmwin_refresh(void) { 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))); @@ -215,8 +217,8 @@ pgmwin_refresh(void) 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 */ @@ -233,7 +235,7 @@ pgmwin_refresh(void) return; } - if (Address > 0xFFFF) { + if (address > 0xFFFF) { /* * Not the most elegant solution, but it works to not * display instructions past last address, 0xFFFF. @@ -250,7 +252,7 @@ pgmwin_refresh(void) -1); } else { /* Display breakpoints. */ - if (IsBreakpoint(Address)) + if (breakpoint_is_defined(address)) sprintf(str, "*"); else str[0] = '\0'; @@ -258,35 +260,34 @@ pgmwin_refresh(void) 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; } } }