*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#if HAVE_CONFIG_H
#include <stdio.h>
#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 )
{
/* 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 );
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 ) );
-}