/[smarc]/smarc/src/smarcgui/src/main.cc
ViewVC logotype

Diff of /smarc/src/smarcgui/src/main.cc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by misto, Mon Dec 30 19:27:13 2002 UTC revision 1.3 by misto, Thu Jan 2 17:57:25 2003 UTC
# Line 37  void refresh_intreg( void ) Line 37  void refresh_intreg( void )
37  {  {
38          GtkEntry *entry;          GtkEntry *entry;
39          GtkToggleButton *tb;          GtkToggleButton *tb;
40          char buf[100], fmt[] = "0x%08X";          char buf[100], fmt[] = "%08X";
41    
42          if ( vm.is_on() ){          if ( vm.is_on() ){
43                  entry = GTK_ENTRY(lookup_widget( window_main, "entry_CWP"));                  entry = GTK_ENTRY(lookup_widget( window_main, "entry_CWP"));
# Line 208  void refresh_reglist( void ) Line 208  void refresh_reglist( void )
208                                  gtk_clist_set_text(winregs, j, i, buf[1]);                                  gtk_clist_set_text(winregs, j, i, buf[1]);
209                          }                          }
210                  }                  }
211    
212                    int cwp = vm.get_CWP();
213                    gtk_clist_moveto( winregs, 0, cwp*2 + 1, 0, 0.5 );
214                    
215                    cwp = (cwp + 1) % 32;
216                    for( int j = 0 ; j < 3 ; j++ ){
217                            char buf[50];
218                            sprintf(buf, "%d", ( cwp == 0 && j == 0)?
219                                    512 : (( cwp == 32 && j == 3 )?
220                                            8 : cwp*16 + 8*j )  );
221    
222                            gtk_clist_set_column_title(winregs,cwp*2+j,
223                                    buf );
224                            gtk_clist_set_column_justification( winregs,
225                                    cwp*2+j, GTK_JUSTIFY_CENTER );
226                    }
227                    
228                    cwp = (cwp - 2) % 32;
229                    for( int j = 0 ; j < 3 ; j++ ){
230                            char buf[50];
231                            sprintf(buf, "%d", ( cwp == 0 && j == 0)?
232                                    512 : (( cwp == 32 && j == 3 )?
233                                            8 : cwp*16 + 8*j )  );
234    
235                            gtk_clist_set_column_title(winregs,cwp*2+j,
236                                    buf );
237                            gtk_clist_set_column_justification( winregs,
238                                    cwp*2+j, GTK_JUSTIFY_CENTER );
239                    }
240                    
241                    cwp = vm.get_CWP();
242                    for( int j = 0 ; j < 3 ; j++ ){
243                            char buf[50];
244                            sprintf(buf, "%d / %s",
245                                    ( cwp == 0 && j == 0)?
246                                    512 : (( cwp == 32 && j == 3 )?
247                                            8 : cwp*16 + 8*j ) ,
248                                    (j==0)?"%o":((j==1)?"%l":"%i") );
249    
250                            gtk_clist_set_column_title(winregs,cwp*2+j,
251                                    buf );
252                            gtk_clist_set_column_justification( winregs,
253                                    cwp*2+j, GTK_JUSTIFY_CENTER );
254                    }
255          } else {          } else {
256                  ptrs[0] = buf[0];                  ptrs[0] = buf[0];
257                  for( int i = 0 ; i < 8 ; i++ ){                  for( int i = 0 ; i < 8 ; i++ ){
# Line 223  void refresh_reglist( void ) Line 267  void refresh_reglist( void )
267  void init_reglist( void )  void init_reglist( void )
268  {  {
269          GtkLabel  *lab;          GtkLabel  *lab;
270            
271          for( int i = 0 ; i < 66 ; i++ ){          for( int i = 0 ; i < 66 ; i++ ){
272                  char buf[20];                  char buf[20];
273                  sprintf( buf, "label_winregs%02d", i );                  sprintf( buf, "label_winregs%02d", i );
# Line 238  void init_reglist( void ) Line 282  void init_reglist( void )
282                  else                  else
283                          sprintf( buf, "%d", i*8  );                          sprintf( buf, "%d", i*8  );
284                  gtk_label_set_text(lab, buf );                  gtk_label_set_text(lab, buf );
285                    
286          }          }
287                    
288          refresh_reglist();          refresh_reglist();
289  }  }
290  void init_codelist( void )  void init_memory( void )
291  {  {
292            GtkCList *listmem;
293    
294            listmem = GTK_CLIST(lookup_widget( window_main, "clist_memory"));
295    
296            for( int i = 0 ; i < 5; i++)
297                    gtk_clist_set_column_auto_resize(listmem, i, true );
298    }
299    
300    void reinit_codelist( void )
301    {
302            GtkCList *codelist;
303    
304            codelist = GTK_CLIST(lookup_widget( window_main, "clist_code"));
305            
306            GdkColormap *sys = gdk_colormap_get_system();
307            GdkColor colors = {0, 65535,65535,65535} ;
308            gdk_colormap_alloc_color( sys, &colors,  FALSE, TRUE );
309            
310            gtk_clist_freeze( codelist );
311            gtk_clist_clear( codelist );
312            
313            if ( vm.is_on() ){
314                    char  buf[3][100], *ptrs[3] = {0};
315                    vector<unsigned long> mem = bin_loader.get_instr();
316    
317                    for(int i = 0 ; i < 3 ; i++)
318                            ptrs[i] = buf[i];
319                    
320                    for( int i = 0 ; i < mem.size() ; i++ ){
321                            sprintf( buf[0], "%08X:", i*4 );
322                            buf[1][0] = '\0';
323                            sprintf( buf[2], "%08X", mem[i] );
324                            
325                            gtk_clist_append( codelist, ptrs );
326                            gtk_clist_set_background(codelist, i, &colors );
327                    }
328    
329                    for( int i = 0 ; i < 3 ; i++ )
330                            gtk_clist_set_column_auto_resize(codelist, i, true );
331            }
332            
333            gtk_clist_thaw( codelist );
334  }  }
335  void refresh_codelist( void )  void refresh_codelist( void )
336  {  {
337            GtkCList *codelist;
338            codelist = GTK_CLIST(lookup_widget( window_main, "clist_code"));
339            gboolean dummy[6];
340    
341            GdkColormap *sys = gdk_colormap_get_system();
342            GdkColor colors[6] = {
343                    {0, 65535,65535,65535},
344                    {0, 6553*9,6553*9,6553*9},
345                    {0, 6553*8,6553*8,6553*8},
346                    {0, 6553*7,6553*7,6553*7},
347                    {0, 6553*6,6553*6,6553*6},
348                    {0, 6553*5,6553*5,6553*5}
349                    };
350    
351            gdk_colormap_alloc_colors( sys, colors, 6, FALSE, TRUE, dummy );
352    
353            
354            gtk_clist_set_background(codelist, vm.get_ppppPC()/4, &(colors[0]) );
355            gtk_clist_set_background(codelist, vm.get_pppPC()/4, &(colors[5]) );
356            gtk_clist_set_background(codelist, vm.get_ppPC()/4, &(colors[4]) );
357            gtk_clist_set_background(codelist, vm.get_pPC()/4, &(colors[3]) );
358            gtk_clist_set_background(codelist, vm.get_PC()/4, &(colors[2]) );
359            gtk_clist_set_background(codelist, vm.get_nPC()/4, &(colors[1]) );
360  }  }
361  void refresh_memory( void )  void refresh_memory( void )
362  {  {
# Line 259  void refresh_memory( void ) Line 368  void refresh_memory( void )
368          gtk_clist_clear(listmem);          gtk_clist_clear(listmem);
369                    
370          if ( vm.is_on() ){          if ( vm.is_on() ){
371                  char buf[100], buf2[256], *ptrs[2] = {0};                  char buf[100], buf2[4][100], *ptrs[5] = {0};
372                  vector<unsigned long> mem = vm.get_dcache( 64 );                  vector<unsigned long> mem = vm.get_dcache( 64 );
373    
374                  ptrs[0] = buf;                  ptrs[0] = buf;
375                  ptrs[1] = buf2;                  for(int i = 0 ; i < 4 ; i++)
376                            ptrs[i+1] = buf2[i];
377                                    
378                  for( int i = 0 ; i < 64 ; i+=4 ){                  for( int i = 0 ; i < 64 ; i+=4 ){
379                          sprintf( buf, "%08X", i );                          sprintf( buf, "%08X:", i*4 );
380                                            
381                          sprintf(buf2, "%08X %08X %08X %08X",                          for( int j = 0 ; j < 4 ; j++ )
382                                  mem[i], mem[i+1], mem[i+2], mem[i+3] );                                  sprintf(buf2[j], "%08X", mem[i+j] );
383                                                    
384                          gtk_clist_append( listmem, ptrs );                          gtk_clist_append( listmem, ptrs );
385                  }                  }
# Line 287  void refresh_gui( void ) Line 397  void refresh_gui( void )
397  void init_gui( void )  void init_gui( void )
398  {  {
399          init_reglist();          init_reglist();
400            init_memory();
401    }
402    void reinit_reglist( void )
403    {
404            GtkCList *gregs;
405    
406            gregs = GTK_CLIST(lookup_widget( window_main, "clist_gregs"));
407            gtk_clist_set_column_auto_resize( gregs, 0, true );
408            gtk_clist_set_column_auto_resize( gregs, 1, true );
409    }
410    void reinit_gui( void )
411    {
412            reinit_codelist();
413            reinit_reglist();
414  }  }
415    
416  int main( int argc, char *argv[] )  int main( int argc, char *argv[] )

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26