Update NEWS and ChangeLog
authorHugo Villeneuve <hugo@hugovil.com>
Fri, 19 Mar 2010 23:59:19 +0000 (23:59 +0000)
committerHugo Villeneuve <hugo@hugovil.com>
Sun, 8 Sep 2013 22:54:51 +0000 (18:54 -0400)
ChangeLog
NEWS
src/emuconsole.c
src/emugtk.c
src/memory.c
src/memory.h
src/memwin.c
src/memwin.h

index 3207ba9..680a55e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-03-19  Hugo Villeneuve  <hugo@hugovil.com>
+        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  <hugo@hugovil.com>
         * Updated Free Software Foundation address.
 
diff --git a/NEWS b/NEWS
index 5dca773..2aa3d32 100644 (file)
--- 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.
 
index 48ae43e..8073c56 100644 (file)
@@ -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();
index 7d25174..45448a2 100644 (file)
@@ -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");
   }
 }
index 922b9aa..202d8d3 100644 (file)
  */
 
 #include <stdio.h>
+#include <string.h>
 
+#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);
+       }
+}
index 76c0b86..55a034a 100644 (file)
@@ -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 */
index f5a7f61..4387f46 100644 (file)
 #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 )
 {
@@ -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 ) );
-}
index 0732086..b2108b2 100644 (file)
 #ifndef MEMWIN_H
 #define MEMWIN_H 1
 
-
 #include <gtk/gtk.h>
 
-
 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 */