projects
/
emu8051.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add external memory window vpaned_mem
[emu8051.git]
/
src
/
regwin.c
diff --git
a/src/regwin.c
b/src/regwin.c
index
06c643a
..
aaa006b
100644
(file)
--- a/
src/regwin.c
+++ b/
src/regwin.c
@@
-30,7
+30,10
@@
#include "cpu8051.h"
#include "regwin.h"
#include "memwin.h"
#include "cpu8051.h"
#include "regwin.h"
#include "memwin.h"
+#include "pgmwin.h"
#include "instructions_8051.h"
#include "instructions_8051.h"
+#include "hexfile.h"
+#include "emugtk.h"
static GtkWidget *reglist;
static GtkWidget *reglist;
@@
-64,7
+67,8
@@
regwin_read(int addr, int width)
/* Address is low address. */
return (cpu8051_ReadD(addr + 1) << 8) +
cpu8051_ReadD(addr);
/* Address is low address. */
return (cpu8051_ReadD(addr + 1) << 8) +
cpu8051_ReadD(addr);
- }
+ } else
+ return 0xFFFFFFFF;
}
static void
}
static void
@@
-279,22
+283,20
@@
static GtkListStore *
regwin_init_store(void)
{
GtkTreeIter iter;
regwin_init_store(void)
{
GtkTreeIter iter;
- int row
s
;
+ int row;
int col;
GtkListStore *store;
GType col_types[N_COLUMNS];
int col;
GtkListStore *store;
GType col_types[N_COLUMNS];
- for (col = 0; col < N_COLUMNS; col++) {
+ /* No need for static array, all our columns are of the same type. */
+ for (col = 0; col < N_COLUMNS; col++)
col_types[col] = G_TYPE_STRING;
col_types[col] = G_TYPE_STRING;
- }
store = gtk_list_store_newv(N_COLUMNS, col_types);
store = gtk_list_store_newv(N_COLUMNS, col_types);
- /* Initialize with rows of dummy data... */
- for (rows = 0; rows < DATA_ROWS; rows++) {
- /* Add new row. */
+ /* Add rows. */
+ for (row = 0; row < DATA_ROWS; row++)
gtk_list_store_append(store, &iter);
gtk_list_store_append(store, &iter);
- }
return store;
}
return store;
}
@@
-339,16
+341,14
@@
regwin_cell_edited(GtkCellRendererText *cell, gchar *path_string,
/* Read current (old) value. */
gtk_tree_model_get(model, &iter, COL_VAL, &str, -1);
/* Read current (old) value. */
gtk_tree_model_get(model, &iter, COL_VAL, &str, -1);
- /* Convert old value (asciihex) to integer. */
- sscanf(str, "%x", &old);
+ old = asciihex2int(str);
if (regwin_infos[row].w == 2)
log_info(" old value: $%02X", old);
else if (regwin_infos[row].w == 4)
log_info(" old value: $%04X", old);
if (regwin_infos[row].w == 2)
log_info(" old value: $%02X", old);
else if (regwin_infos[row].w == 4)
log_info(" old value: $%04X", old);
- /* Convert new value (asciihex) to integer. */
- sscanf(new_str, "%x", &new);
+ new = asciihex2int(new_str);
if (regwin_infos[row].w == 2) {
if ((new < 0) || (new > 0xFF)) {
if (regwin_infos[row].w == 2) {
if ((new < 0) || (new > 0xFF)) {
@@
-367,10
+367,7
@@
regwin_cell_edited(GtkCellRendererText *cell, gchar *path_string,
}
/* Convert new value to text. */
}
/* Convert new value to text. */
- if (regwin_infos[row].w == 2)
- sprintf(str, "%02X", new);
- else if (regwin_infos[row].w == 4)
- sprintf(str, "%04X", new);
+ int2asciihex(new, str, regwin_infos[row].w);
/* Store new value in emulator register. */
if (regwin_infos[row].write_func == NULL) {
/* Store new value in emulator register. */
if (regwin_infos[row].write_func == NULL) {
@@
-391,8
+388,7
@@
regwin_cell_edited(GtkCellRendererText *cell, gchar *path_string,
* Make sure to update all windows.
* For example, R0-R7 values depends on internal memory values.
*/
* Make sure to update all windows.
* For example, R0-R7 values depends on internal memory values.
*/
- regwin_Show();
- memwin_DumpD("0");
+ emugtk_UpdateDisplay();
};
static void
};
static void
@@
-507,14
+503,12
@@
regwin_Show(void)
regwin_infos[row].w);
} else {
/* Read register value using custom function pointer. */
regwin_infos[row].w);
} else {
/* Read register value using custom function pointer. */
- val = regwin_infos[row].read_func(regwin_infos[row].param);
+ val = regwin_infos[row].read_func(
+ regwin_infos[row].param);
}
/* Convert to specified number of hex digits. */
}
/* Convert to specified number of hex digits. */
- if (regwin_infos[row].w == 2)
- sprintf(str , "%.2X", (u_int8_t) val);
- else if (regwin_infos[row].w == 4)
- sprintf(str , "%.4X", (u_int16_t) val);
+ int2asciihex(val, str, regwin_infos[row].w);
gtk_list_store_set(store, &iter,
COL_NAME, regwin_infos[row].name,
gtk_list_store_set(store, &iter,
COL_NAME, regwin_infos[row].name,