X-Git-Url: http://gitweb.hugovil.com/?a=blobdiff_plain;f=src%2Fmemwin.c;h=4387f4661ea40ef4f53a32a191c7ce5b48485b30;hb=fb3b3529579773b8a14959cc6bc5bb2096fd0fe8;hp=f5a7f61cf493cb3ecba8316b79c6263351740289;hpb=a78a174393ff9c8dbc0d5212576507f25d7e9bf1;p=emu8051.git diff --git a/src/memwin.c b/src/memwin.c index f5a7f61..4387f46 100644 --- a/src/memwin.c +++ b/src/memwin.c @@ -26,13 +26,13 @@ #include #include "common.h" +#include "memory.h" +#include "hexfile.h" #include "cpu8051.h" #include "memwin.h" - static GtkWidget *memclist; - GtkWidget * memwin_init( int width, int height ) { @@ -89,12 +89,23 @@ memwin_init( int width, int height ) /* Dump 16 rows of 16 bytes from Address in Memory (direct addressing) */ void -memwin_DumpD( unsigned int Address ) +memwin_DumpD(char *MemAddress) { - char TextTmp[255]; + 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 ); @@ -118,34 +129,3 @@ memwin_DumpD( unsigned int Address ) gtk_clist_select_row( GTK_CLIST( memclist ), 0, 0 ); gtk_clist_thaw( GTK_CLIST( memclist ) ); } - - -/* Dump 16 rows of 16 bytes from Address in Memory (indirect addressing) */ -void -memwin_DumpI( unsigned int Address ) -{ - char TextTmp[255]; - int row, column, TextLength; - - 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_ReadI( Address + column ) ); - gtk_clist_set_text( GTK_CLIST( memclist ), row, column + 1, TextTmp ); - } - - TextLength = 0; - for ( column = 0; column < 16; column++ ) { - if ( ( ( int ) cpu8051_ReadI( Address + column ) >= 32 ) && ( ( int ) cpu8051_ReadI( Address + column ) <= 126 ) ) - TextLength += sprintf( &TextTmp[ TextLength ], "%c", cpu8051_ReadI( Address + column ) ); - else TextLength += sprintf( &TextTmp[ TextLength ], "." ); - } - gtk_clist_set_text( GTK_CLIST( memclist ), row, 17, TextTmp ); - - Address += 16; - } - gtk_clist_thaw( GTK_CLIST( memclist ) ); -}