Пример #1
0
static int
tape_play( int autoplay )
{
  if( !libspectrum_tape_present( tape ) ) return 1;
  
  /* Otherwise, start the tape going */
  tape_playing = 1;
  tape_autoplay = autoplay;
  tape_microphone = 0;

  event_remove_type( tape_mic_off_event );

  /* Update the status bar */
  ui_statusbar_update( UI_STATUSBAR_ITEM_TAPE, UI_STATUSBAR_STATE_ACTIVE );

  /* If we're fastloading, turn sound off */
  if( settings_current.fastload ) sound_pause();

  loader_tape_play();

  event_add( tstates + next_tape_edge_tstates, tape_edge_event );
  next_tape_edge_tstates = 0;

  debugger_event( play_event );

  return 0;
}
Пример #2
0
int
tape_stop( void )
{
  if( tape_playing ) {

    tape_playing = 0;
    ui_statusbar_update( UI_STATUSBAR_ITEM_TAPE, UI_STATUSBAR_STATE_INACTIVE );
    loader_tape_stop();

    /* If we were fastloading, sound was off, so turn it back on, and
       reset the speed counter */
    if( settings_current.fastload ) {
      sound_unpause();
      timer_estimate_reset();
    }

    tape_save_next_edge();
    event_remove_type( tape_edge_event );

    /* Turn off any lingering MIC level in a second (some loaders like Alkatraz
       seem to check the MIC level soon after loading is finished, presumably as
       a copy protection check */
    event_add( tstates + machine_current->timings.tstates_per_frame,
               tape_mic_off_event );
  }

  if( stop_event != -1 ) debugger_event( stop_event );

  return 0;
}
Пример #3
0
static void
statusbar_update( int busy )
{
  ui_statusbar_update( UI_STATUSBAR_ITEM_DISK,
		       busy ? UI_STATUSBAR_STATE_ACTIVE :
			      UI_STATUSBAR_STATE_INACTIVE );
}
Пример #4
0
static void
opus_reset( int hard_reset )
{
    int i;

    opus_active = 0;
    opus_available = 0;

    if( !periph_is_active( PERIPH_TYPE_OPUS ) ) {
        return;
    }

    if( machine_load_rom_bank( opus_memory_map_romcs_rom, 0,
                               settings_current.rom_opus,
                               settings_default.rom_opus, 0x2000 ) ) {
        settings_current.opus = 0;
        periph_activate_type( PERIPH_TYPE_OPUS, 0 );
        return;
    }

    for( i = 0; i < MEMORY_PAGES_IN_2K; i++ ) {
        struct memory_page *page =
                &opus_memory_map_romcs_ram[ i ];
        page->page = opus_ram + i * MEMORY_PAGE_SIZE;
        page->offset = i * MEMORY_PAGE_SIZE;
    }

    machine_current->ram.romcs = 0;

    for( i = 0; i < MEMORY_PAGES_IN_2K; i++ )
        opus_memory_map_romcs_ram[ i ].writable = 1;

    data_reg_a = 0;
    data_dir_a = 0;
    control_a  = 0;
    data_reg_b = 0;
    data_dir_b = 0;
    control_b  = 0;

    opus_available = 1;

    if( hard_reset )
        memset( opus_ram, 0, sizeof( opus_ram ) );

    wd_fdc_master_reset( opus_fdc );

    for( i = 0; i < OPUS_NUM_DRIVES; i++ ) {
        ui_media_drive_update_menus( &opus_ui_drives[ i ],
                                     UI_MEDIA_DRIVE_UPDATE_ALL );
    }

    opus_fdc->current_drive = &opus_drives[ 0 ];
    fdd_select( &opus_drives[ 0 ], 1 );
    machine_current->memory_map();

    ui_statusbar_update( UI_STATUSBAR_ITEM_DISK, UI_STATUSBAR_STATE_INACTIVE );
}
Пример #5
0
void
ui_menu_disk_update( void )
{
    int drives_avail;

    drives_avail = ui_media_drive_any_available();

    /* Set the disk menu items and statusbar appropriately */

    if( drives_avail ) {
        ui_menu_activate( UI_MENU_ITEM_MEDIA_DISK, 1 );
        ui_statusbar_update( UI_STATUSBAR_ITEM_DISK, UI_STATUSBAR_STATE_INACTIVE );
    } else {
        ui_menu_activate( UI_MENU_ITEM_MEDIA_DISK, 0 );
        ui_statusbar_update( UI_STATUSBAR_ITEM_DISK,
                             UI_STATUSBAR_STATE_NOT_AVAILABLE );
    }

    ui_media_drive_update_parent_menus();
}
Пример #6
0
/* Machine/Pause */
void
menu_machine_pause( int action )
{
  if( paused ) {
    paused = 0;
    ui_statusbar_update( UI_STATUSBAR_ITEM_PAUSED,
                         UI_STATUSBAR_STATE_INACTIVE );
    timer_estimate_reset();
    PostMessage( fuse_hWnd, WM_USER_EXIT_PROCESS_MESSAGES, 0, 0 );

    /* Resume emulation */
    fuse_emulation_unpause();
  } else {

    /* Stop emulation */
    fuse_emulation_pause();

    paused = 1;
    ui_statusbar_update( UI_STATUSBAR_ITEM_PAUSED, UI_STATUSBAR_STATE_ACTIVE );
    win32ui_process_messages( 0 );
  }
}
Пример #7
0
static void
plusd_reset( int hard_reset )
{
  int i;

  plusd_active = 0;
  plusd_available = 0;

  if( !periph_is_active( PERIPH_TYPE_PLUSD ) ) {
    return;
  }

  if( machine_load_rom_bank( plusd_memory_map_romcs_rom, 0,
			     settings_current.rom_plusd,
			     settings_default.rom_plusd, 0x2000 ) ) {
    settings_current.plusd = 0;
    periph_activate_type( PERIPH_TYPE_PLUSD, 0 );
    return;
  }

  machine_current->ram.romcs = 0;

  for( i = 0; i < MEMORY_PAGES_IN_8K; i++ ) {
    plusd_memory_map_romcs_ram[ i ].page = &plusd_ram[ i * MEMORY_PAGE_SIZE ];
    plusd_memory_map_romcs_ram[ i ].writable = 1;
  }

  plusd_available = 1;
  plusd_active = 1;

  if( hard_reset )
    memset( plusd_ram, 0, 0x2000 );

  wd_fdc_master_reset( plusd_fdc );

  for( i = 0; i < PLUSD_NUM_DRIVES; i++ ) {
    ui_media_drive_update_menus( &plusd_ui_drives[ i ],
                                 UI_MEDIA_DRIVE_UPDATE_ALL );
  }

  plusd_fdc->current_drive = &plusd_drives[ 0 ];
  fdd_select( &plusd_drives[ 0 ], 1 );
  machine_current->memory_map();

  ui_statusbar_update( UI_STATUSBAR_ITEM_DISK, UI_STATUSBAR_STATE_INACTIVE );
}
Пример #8
0
int
machine_reset( int hard_reset )
{
  size_t i;
  int error;

  sound_ay_reset();

  tape_stop();

  memory_pool_free();

  machine_current->ram.romcs = 0;

  machine_set_variable_timings( machine_current );

  /* Do the machine-specific bits, including loading the ROMs */
  error = machine_current->reset(); if( error ) return error;

  module_reset( hard_reset );

  error = machine_current->memory_map(); if( error ) return error;

  /* Set up the contention array */
  for( i = 0; i < machine_current->timings.tstates_per_frame; i++ ) {
    ula_contention[ i ] = machine_current->ram.contend_delay( i );
    ula_contention_no_mreq[ i ] = machine_current->ram.contend_delay_no_mreq( i );
  }

  /* Check for an Interface I ROM */
  ui_statusbar_update( UI_STATUSBAR_ITEM_MICRODRIVE,
		       UI_STATUSBAR_STATE_NOT_AVAILABLE );
  
  /* Update the disk menu items */
  ui_menu_disk_update();

  /* clear out old display image ready for new one */
  display_refresh_all();

  return 0;
}
Пример #9
0
int tape_stop( void )
{
  if( tape_playing ) {

    tape_playing = 0;
    ui_statusbar_update( UI_STATUSBAR_ITEM_TAPE, UI_STATUSBAR_STATE_INACTIVE );
    loader_tape_stop();

    /* If we were fastloading, sound was off, so turn it back on, and
       reset the speed counter */
    if( settings_current.fastload ) {
      sound_unpause();
      timer_estimate_reset();
    }

    event_remove_type( tape_edge_event );
  }

  if( stop_event != -1 ) debugger_event( stop_event );

  return 0;
}