Esempio n. 1
0
int
widget_memory_draw( void *data )
{
  int x, y;
  char pbuf[36];

  widget_rectangle( LC(0), LR(0), 40 * 8, 16 * 8 + 4, 1 );
  widget_rectangle( LC(0), LR(16) + 2, 320, 1, 7 );

  for( y = 0; y < 16; ++y ) {
    libspectrum_word addr = memaddr + y * 8;

    sprintf( pbuf, "%04X:", addr );
    widget_printstring_right( LC(5) - 4, LR(y), 5, pbuf );

    for( x = 0; x < 8; ++x ) {
      libspectrum_byte b = readbyte_internal( addr + x );

      widget_printchar_fixed( LC(x + 29) / 8, LR(y) / 8, 7 - (y & 1), b );
      sprintf( pbuf + x * 3, "%02X ", b );
    }
    widget_printstring_fixed( LC(5) / 8, LR(y) / 8, 7 - (y & 1), pbuf );
  }

  widget_display_lines( LR(0) / 8, 17 );

  return 0;
}
Esempio n. 2
0
int
widget_roms_draw( void *data )
{
  int i;
  char buffer[32];
  char key[] = "\x0A ";

  if( data ) info = data;

  /* Get a copy of the current settings */
  if( !info->initialised ) {

    widget_settings = malloc( sizeof( settings_info ) );
    if( !widget_settings ) {
      ui_error( UI_ERROR_ERROR, "out of memory at %s:%d", __FILE__, __LINE__ );
      return 1;
    }

    memset( widget_settings, 0, sizeof( settings_info ) );
    settings_copy( widget_settings, &settings_current );

    info->initialised = 1;
  }

  first_rom = info->start;
  rom_count = info->count;
  is_peripheral = info->is_peripheral;

  /* Blank the main display area */
  widget_dialog_with_border( 1, 2, 30, rom_count + 2 );

  widget_printstring( 10, 16, WIDGET_COLOUR_TITLE, info->title );
  widget_display_lines( 2, rom_count + 2 );

  for( i=0; i < info->count; i++ ) {

    snprintf( buffer, sizeof( buffer ), "ROM %d:", i );
    key[1] = 'A' + i;
    widget_printstring_right( 24, i*8+24, WIDGET_COLOUR_FOREGROUND, key );
    widget_printstring( 28, i*8+24, WIDGET_COLOUR_FOREGROUND, buffer );

    print_rom( i );
  }

  return 0;
}
Esempio n. 3
0
int
widget_text_draw( void *data )
{
  widget_text_t* text_data = data;

  if( data ) {
    title = text_data->title;
    allow = text_data->allow;
    snprintf( text, sizeof( text ), "%s", text_data->text );
  }

  widget_dialog_with_border( 1, 2, 30, 3 );

  widget_printstring( 10, 16, WIDGET_COLOUR_TITLE, title );
  widget_printstring_right( 12, 28, 5, "[" );
  widget_printstring( 244, 28, 5, "]" );

  widget_display_lines( 2, 3 );

  return widget_text_draw_text();
}