- char TextTmp[1024];
- int row, column, TextLength;
- unsigned int Address;
-
- if (strlen(MemAddress) != 0) {
- if (STREQ(MemAddress, "PC"))
- Address = cpu8051.pc;
- else
- Address = Ascii2Hex(MemAddress, strlen(MemAddress));
- } else {
- Address = 0;
- }
-
- gtk_clist_freeze( GTK_CLIST( memclist ) );
-
- for ( row = 0; row < 16; row++ ) {
- sprintf( TextTmp, "%.4X", Address );
- gtk_clist_set_text( GTK_CLIST( memclist ), row, 0, TextTmp );
-
- for ( column = 0; column < 16; column++ ) {
- sprintf( TextTmp, "%.2X", ( int ) cpu8051_ReadD( Address + column ) );
- gtk_clist_set_text( GTK_CLIST( memclist ), row, column + 1, TextTmp );
- }
-
- TextLength = 0;
- for ( column = 0; column < 16; column++ ) {
- if ( ( ( int ) cpu8051_ReadD( Address + column ) >= 32 ) && ( ( int ) cpu8051_ReadD( Address + column ) <= 126 ) )
- TextLength += sprintf( &TextTmp[ TextLength ], "%c", cpu8051_ReadD( Address + column ) );
- else TextLength += sprintf( &TextTmp[ TextLength ], "." );
- }
- gtk_clist_set_text( GTK_CLIST( memclist ), row, 17, TextTmp );
-
- Address += 16;
- }
-
- gtk_clist_select_row( GTK_CLIST( memclist ), 0, 0 );
- gtk_clist_thaw( GTK_CLIST( memclist ) );
+ int row;
+ unsigned int Address;
+ GtkListStore *store;
+
+#ifdef EMU8051_DEBUG
+ printf("memwin_DumpD, address = %s\n", MemAddress);
+#endif
+
+ if (strlen(MemAddress) != 0) {
+ if (STREQ(MemAddress, "PC"))
+ Address = cpu8051.pc;
+ else
+ Address = Ascii2Hex(MemAddress, strlen(MemAddress));
+ } else {
+ Address = 0;
+ }
+
+ store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(memlist)));
+
+ for (row = 0; row < DATA_ROWS; row++) {
+ int valid;
+ GtkTreeIter iter;
+ char TextTmp[1024];
+ int column, TextLength;
+
+ if (row == 0) {
+ /* Get first row in list store */
+ valid = gtk_tree_model_get_iter_first(
+ GTK_TREE_MODEL(store), &iter);
+ } else {
+ /* Get next row in list store */
+ valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter);
+ }
+
+ if (!valid) {
+ printf("Invalid iter...\n");
+ return;
+ }
+
+ sprintf(TextTmp, "%.4X", Address);
+ gtk_list_store_set(store, &iter, COL_ADDRESS, TextTmp, -1);
+
+ for (column = 0; column < DATA_COLS; column++) {
+ sprintf(TextTmp, "%.2X",
+ (int) cpu8051_ReadD(Address + column));
+
+ gtk_list_store_set(store, &iter, column + 1, TextTmp,
+ -1);
+ }
+
+ TextLength = 0;
+ for (column = 0; column < DATA_COLS; column++) {
+ if (((int) cpu8051_ReadD(Address + column) >= 32) &&
+ ((int) cpu8051_ReadD(Address + column) <= 126))
+ TextLength += sprintf(
+ &TextTmp[TextLength],
+ "%c", cpu8051_ReadD(Address + column));
+ else
+ TextLength +=
+ sprintf(&TextTmp[TextLength], ".");
+ }
+
+ gtk_list_store_set(store, &iter, COL_ASCII, TextTmp, -1);
+
+ Address += DATA_COLS;
+ }