int spectrum_frame( void ) { libspectrum_dword frame_length; int error; /* Reduce the t-state count of both the processor and all the events scheduled to occur. Done slightly differently if RZX playback is occurring */ frame_length = rzx_playback ? tstates : machine_current->timings.tstates_per_frame; error = event_frame( frame_length ); if( error ) return error; tstates -= frame_length; if( z80.interrupts_enabled_at >= 0 ) z80.interrupts_enabled_at -= frame_length; if( sound_enabled ) sound_frame(); if( display_frame() ) return 1; if( profile_active ) profile_frame( frame_length ); printer_frame(); /* Add an interrupt unless they're being generated by .rzx playback */ if( !rzx_playback ) { if( event_add( machine_current->timings.tstates_per_frame, spectrum_frame_event ) ) return 1; } loader_frame( frame_length ); return 0; }
void AY8910Update(int chip, int16_t** buffer, int nNumSamples) { AY8910UpdateSetCycles(); sound_generator_framesiz = nNumSamples; g_ppSoundBuffers = buffer; sound_frame(&g_AY8910[chip]); }
void eo_tick( void ) { static int j, borrow; if ( !nosound ) { sound_frame(); } if ( zx81_stop ) { //AccurateUpdateDisplay( false ); return; } // mouse.x = Controls::Mouse->CursorPos.x; // mouse.y = Screen->Height - Controls::Mouse->CursorPos.y; fps++; frametstates = 0; j = zx81.single_step ? 1 : ( machine.tperframe + borrow ); if ( zx81.machine != MACHINESPEC48 && j != 1 ) { j += ( zx81.speedup * machine.tperframe ) / machine.tperscanline; } while ( j > 0 && !zx81_stop ) { j -= machine.do_scanline(); AccurateDraw(); } if ( !zx81_stop ) { borrow = j; } }
/* rets zero if we want to exit the emulation (i.e. exit track) */ int do_interrupt(void) { static int count=0; static int silent_for=0; count++; if(count>=4) count=0; if(!playing || paused) usleep(20000); else { /* check for fade needed */ if(!done_fade && stopafter && tunetime.min*60+tunetime.sec>=stopafter) { done_fade=1; sound_start_fade(fadetime); } /* incr time */ tunetime.subsecframes++; if(tunetime.subsecframes>=50) { tunetime.subsecframes=0; tunetime.sec++; if(tunetime.sec>=60) { tunetime.sec=0; tunetime.min++; } } /* play frame, and stop if it's been silent for a while */ if(!sound_frame(count==0 || !highspeed)) silent_for++; else silent_for=0; if(silent_for>=silent_max) { silent_for=0; ui_change_notify(); /* do next track, or file, or just stop */ /* if play_one_track_only is set, then finish now */ if (play_one_track_only) { want_quit=1; return(0); } ay_track++; if(ay_track>=aydata.num_tracks) { ay_track=0; ay_file++; if(ay_file>=ay_num_files) { /* return to first file/track (except for non-UI, * to save any pointless reload), and stop. */ if(use_ui) ay_file=ay_track=0; else ay_file--,ay_track=aydata.num_tracks-1; playing=0; } } return(0); } } return(ui_frame()); }