From: Hugo Villeneuve Date: Fri, 19 Mar 2010 23:59:19 +0000 (+0000) Subject: Update NEWS and ChangeLog X-Git-Tag: v1.1.0~3 X-Git-Url: http://gitweb.hugovil.com/?a=commitdiff_plain;h=fb3b3529579773b8a14959cc6bc5bb2096fd0fe8;p=emu8051.git Update NEWS and ChangeLog --- diff --git a/ChangeLog b/ChangeLog index 3207ba9..680a55e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-03-19 Hugo Villeneuve + Reintroduced the console mode if no GTK+ librairies are + detected. The default is to build the GUI if GTK+ is detected, + but the console mode can always be forced by using + "--enable-gui=no" as a configure option. + 2009-02-09 Hugo Villeneuve * Updated Free Software Foundation address. diff --git a/NEWS b/NEWS index 5dca773..2aa3d32 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,8 @@ +2010-03-19: emu8051-1.1.0 has been released. + Reintroduced the console mode if no GTK+ librairies are + detected. + 2009-02-09: emu8051-1.0.2 has been released. Updated Free Software Foundation address. diff --git a/src/emuconsole.c b/src/emuconsole.c index 48ae43e..8073c56 100644 --- a/src/emuconsole.c +++ b/src/emuconsole.c @@ -36,8 +36,6 @@ /* Maximum number of BreakPoints */ #define MAXBP 32 -#define ENDLINE "\n" - static int RunningState; static int NbBreakpoints; static unsigned int Breakpoints[MAXBP]; @@ -177,46 +175,6 @@ Disasm(char *Address, char *NumberInst) DisasmN(MemAddress, NbInst); } -/* Dump memory */ -static void -DumpMem(char *Address, int memory_id) -{ - unsigned int MemAddress; - int Offset, Column; - int size = 256; - - if (strlen(Address) != 0) { - if (STREQ(Address, "PC")) - MemAddress = cpu8051.pc; - else - MemAddress = Ascii2Hex(Address, strlen(Address)); - } else { - MemAddress = 0; - } - - for (Offset = 0; Offset < size; Offset += 16) { - unsigned char data[16]; - - printf("%.4X ", MemAddress + Offset); - for (Column = 0; Column < 16; Column++) { - data[Column] = memory_read8(memory_id, MemAddress + - Offset + Column); - printf(" %.2X", (int) data[Column]); - } - printf(" "); - - /* Display any ASCII characters */ - for (Column = 0; Column < 16; Column++) { - if ((int) data[Column] >= 32 && - (int) data[Column] <= 126) - printf("%c", data[Column]); - else - printf("."); - } - printf("\n"); - } -} - /* Set NewValue to Register */ static void SetRegister(char *Register, char *NewValue) @@ -230,7 +188,7 @@ SetRegister(char *Register, char *NewValue) else if (STREQ(Register, "SP")) cpu8051_WriteD(_SP_, Ascii2Hex(NewValue, 2)); else { - printf("%sInvalid register name!%s", ENDLINE, ENDLINE); + printf("\nInvalid register name!\n"); printf("Valid registers are A, B, PC and SP.\n"); } } @@ -336,11 +294,11 @@ console_main(void) Index = 0; while (Title[Index] != 0) - printf("%s%s", Title[Index++], ENDLINE); + printf("%s\n", Title[Index++]); Index = 0; while (Menu[Index] != 0) - printf("%s%s", Menu[Index++], ENDLINE); + printf("%s\n", Menu[Index++]); console_reset(); @@ -417,19 +375,24 @@ console_main(void) } switch (Command[0]) { - case 'D': + case 'D': if (strlen(Parameter2) == 0) { + char buf[1024]; + if (STREQ(Command, "DB") && (strlen(Parameter1) == 0)) ShowBreakpoints(); - else if (STREQ(Command, "DE")) - DumpMem(Parameter1, EXT_MEM_ID); - else if (STREQ(Command, "DI")) - DumpMem(Parameter1, INT_MEM_ID); - else if (STREQ(Command, "DP")) { + else if (STREQ(Command, "DE")) { + DumpMem(buf, Parameter1, EXT_MEM_ID); + printf(buf); + } else if (STREQ(Command, "DI")) { + DumpMem(buf, Parameter1, INT_MEM_ID); + printf(buf); + } else if (STREQ(Command, "DP")) { if ((strlen(Parameter1) == 0)) strcpy(Parameter1, "PC"); - DumpMem(Parameter1, PGM_MEM_ID); + DumpMem(buf, Parameter1, PGM_MEM_ID); + printf(buf); } else if (STREQ(Command, "DR") && (strlen(Parameter1) == 0)) console_show_registers(); diff --git a/src/emugtk.c b/src/emugtk.c index 7d25174..45448a2 100644 --- a/src/emugtk.c +++ b/src/emugtk.c @@ -264,7 +264,7 @@ emugtk_UpdateDisplay( void ) regwin_Show(); pgmwin_Disasm(); - memwin_DumpD( 0 ); + memwin_DumpD("0x00"); } @@ -288,7 +288,7 @@ emugtk_Reset( void ) cpu8051_Reset( ); regwin_Show(); pgmwin_Disasm(); - memwin_DumpD( 0 ); + memwin_DumpD("0x00"); } @@ -301,7 +301,7 @@ emugtk_Step( void ) cpu8051_Exec(); regwin_Show(); pgmwin_Disasm(); - memwin_DumpD( 0 ); + memwin_DumpD("0x00"); } @@ -424,6 +424,6 @@ emugtk_StopRunning( ) RunningState = 0; regwin_Show(); pgmwin_Disasm(); - memwin_DumpD( 0 ); + memwin_DumpD("0x00"); } } diff --git a/src/memory.c b/src/memory.c index 922b9aa..202d8d3 100644 --- a/src/memory.c +++ b/src/memory.c @@ -20,7 +20,11 @@ */ #include +#include +#include "common.h" +#include "cpu8051.h" +#include "hexfile.h" #include "memory.h" #define PGM_MEM_SIZE 65536 @@ -106,3 +110,52 @@ memory_read8( int memory_id, unsigned long address ) break; } } + +/* Dump memory */ +void +DumpMem(char *buf, char *Address, int memory_id) +{ + unsigned int MemAddress; + int Offset, Column; + int size = 256; + int k = 0; + + if (strlen(Address) != 0) { + if (STREQ(Address, "PC")) + MemAddress = cpu8051.pc; + else + MemAddress = Ascii2Hex(Address, strlen(Address)); + } else { + MemAddress = 0; + } + + for (Offset = 0; Offset < size; Offset += 16) { + unsigned char data[16]; + + sprintf(&buf[k], "%.4X ", MemAddress + Offset); + k = strlen(buf); + + for (Column = 0; Column < 16; Column++) { + data[Column] = memory_read8(memory_id, MemAddress + + Offset + Column); + sprintf(&buf[k], " %.2X", (int) data[Column]); + k = strlen(buf); + } + sprintf(&buf[k], " "); + k = strlen(buf); + + /* Display any ASCII characters */ + for (Column = 0; Column < 16; Column++) { + if ((int) data[Column] >= 32 && + (int) data[Column] <= 126) { + sprintf(&buf[k], "%c", data[Column]); + k = strlen(buf); + } else { + sprintf(&buf[k], "."); + k = strlen(buf); + } + } + sprintf(&buf[k], "\n"); + k = strlen(buf); + } +} diff --git a/src/memory.h b/src/memory.h index 76c0b86..55a034a 100644 --- a/src/memory.h +++ b/src/memory.h @@ -36,4 +36,7 @@ memory_write8( int memory_id, unsigned long address, u_int8_t value ); u_int8_t memory_read8( int memory_id, unsigned long address ); +void +DumpMem(char *buf, char *Address, int memory_id); + #endif /* MEMORY_H */ 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 ) ); -} diff --git a/src/memwin.h b/src/memwin.h index 0732086..b2108b2 100644 --- a/src/memwin.h +++ b/src/memwin.h @@ -22,18 +22,12 @@ #ifndef MEMWIN_H #define MEMWIN_H 1 - #include - GtkWidget * -memwin_init( int width, int height ); +memwin_init(int width, int height); void -memwin_DumpD( unsigned int Address ); - -void -memwin_DumpI( unsigned int Address ); - +memwin_DumpD(char *Address); #endif /* MEMWIN_H */