int machine_reset( int hard_reset ) { size_t i; int error; /* Clear poke list (undoes effects of active pokes on Spectrum memory) */ pokemem_clear(); sound_ay_reset(); tape_stop(); memory_pool_free(); machine_current->ram.romcs = 0; machine_set_variable_timings( machine_current ); memory_reset(); /* 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 ); } /* Update the disk menu items */ ui_menu_disk_update(); /* clear out old display image ready for new one */ display_refresh_all(); return 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; }
void AY8910_reset(int chip) { // Don't reset the AY CLK, as this is a property of the card (MB/Phasor), not the AY chip sound_ay_reset(&g_AY8910[chip]); // Calls: sound_ay_init(); }
/* read a file and play it. sound_init() should already have been called, * and sound device should still be open when we exit. */ void mainloop(void) { int oldfile=-1; aydata.filedata=NULL; aydata.tracks=NULL; /* this is kind of a weird multi-level event loop (if * you consider do_interrupt()); it's difficult to do it very * differently without turning the Z80 emulation inside-out. */ while(!want_quit) { /* load a new file if we need to */ if(ay_file!=oldfile) { if(aydata.tracks) free(aydata.tracks); if(aydata.filedata) free(aydata.filedata); if(!read_ay_file(ay_filenames[ay_file])) { ui_end(); if(sound_enabled) sound_end(); fprintf(stderr,"%s: reading `%s' failed.\n", progname,ay_filenames[ay_file]); exit(1); } if(!play_one_track_only) ay_track=0; else { ay_track=play_one_track_only-1; if(ay_track>=aydata.num_tracks) { ui_end(); if(sound_enabled) sound_end(); fprintf(stderr,"%s: `%s' has only %d track%s.\n", progname,ay_filenames[ay_file], aydata.num_tracks,(aydata.num_tracks==1)?"":"s"); exit(1); } } if(go_to_last) { go_to_last=0; ay_track=aydata.num_tracks-1; } } oldfile=ay_file; /* only do the whole emulation thing if we're actually playing... */ if(playing) { /* re-enable sound after stopping, if needed */ if(!sound_enabled && !sound_init()) { ui_end(); fprintf(stderr,"%s: couldn't reopen sound device.\n",progname); exit(1); } ay_current_reg=0; sound_ay_reset(); mem_init(ay_track); tunetime_reset(); tsmax=FRAME_STATES_128; do_cpc=0; z80loop(aydata.tracks[ay_track].data, aydata.tracks[ay_track].data_stacketc); } /* if stopped, close sound device */ if(sound_enabled && !playing) sound_end(); /* do reset now, so any paused/stopped status time makes sense */ tunetime_reset(); while((!playing || paused) && ay_file==oldfile) do_interrupt(); } free(aydata.tracks); free(aydata.filedata); }