コード例 #1
0
ファイル: m68k_cmn_intrf.cpp プロジェクト: Bith76/iUAE
void m68k_go (int may_quit)
{
    gui_purge_events();
#if !defined(DREAMCAST) || defined(DEBUG_UAE4ALL)
    if (in_m68k_go || !may_quit) {
#ifdef DEBUG_UAE4ALL
        puts("Bug! m68k_go is not reentrant.\n");
#endif
        return;
    }

    in_m68k_go++;
#endif
    g_emulator.quit_program = RunStateReset;
    for (;;) {
        if (g_emulator.quit_program > RunStateNormal) {
            if (g_emulator.quit_program == RunStateExit)
                break;

            g_emulator.quit_program = RunStateNormal;
            g_emulator.reset_all_systems ();
            customreset ();
            check_prefs_changed_cpu ();
            sound_default_evtime ();
            /* We may have been restoring state, but we're done now.  */
            handle_active_events ();
            if (mispcflags)
                do_specialties (0);
        }

        m68k_run();
    }
#if !defined(DREAMCAST) || defined(DEBUG_UAE4ALL)
    in_m68k_go--;
#endif
#ifdef DEBUG_UAE4ALL
    puts("BYE?");
#endif
}
コード例 #2
0
ファイル: m68k_cmn_intrf.cpp プロジェクト: Bith76/iUAE
static void m68k_run (void)
{
    uae4all_reset ();
    unsigned cycles, cycles_actual=M68KCONTEXT.cycles_counter;
    for (;;) {
#ifdef DEBUG_M68K
        dbg_cycle(m68k_fetch(m68k_get_pc(),0));
        m68k_emulate(1);

#else
        uae4all_prof_start(0);

        cycles = nextevent - currcycle;
        switch (timeslice_mode) {
        case 3:
            cycles>>=6;
            break;
        case 2:
            cycles>>=7;
            break;
        case 1:
            cycles=(cycles>>8)+(cycles>>9);
            break;
        default:
            cycles>>=8;
            break;
        }

#define NDEBUG_CYCLES
#ifdef DEBUG_CYCLES
        static unsigned next_cycles = 60000000;
        if (M68KCONTEXT.cycles_counter > next_cycles) {
            next_cycles += 100000;
            printf("cycles=%9d|%03i|%03i, pc=%.6x\n", M68KCONTEXT.cycles_counter, cycles, IO_CYCLE, _68k_getpc());
        }

        if (M68KCONTEXT.cycles_counter > 80000000) {
            // exit(0);
        }

        if (M68KCONTEXT.cycles_counter >= 500000000) {
            // do_debug = 1;
        }

#endif

#if defined(FAME_INTERRUPTS_SECURE_PATCH) && defined(FAME_INTERRUPTS_PATCH)
        if (uae4all_go_interrupt)
            m68k_emulate(FAME_INTERRUPTS_PATCH);
        else
#endif
            m68k_emulate(cycles);

        uae4all_prof_end(0);
#endif
#if 0 // def FAME_INTERRUPTS_PATCH
        if (uae4all_go_interrupt)
        {
            /*if (verb)*/ printf("uae4all_go_interrupt: %02x\n", uae4all_go_interrupt);
            M68KCONTEXT.interrupts[0]=uae4all_go_interrupt;
            M68KCONTEXT.execinfo&=0xFF67;
            uae4all_go_interrupt=0;
            m68k_irq_update(0);
        }
#endif

        uae4all_prof_start(1);

        cycles=(M68KCONTEXT.cycles_counter-cycles_actual) * cycles_factor;

#ifdef DEBUG_INTERRUPTS
        dbgf("cycles=%i (%i) -> PC=%.6x\n",cycles>>8,nextevent - currcycle, _68k_getpc());
#endif


#ifdef NO_SHORT_EVENTS
#ifdef PROTECT_INFINITE
        unsigned cuentalo=0;
#endif
        do {
#endif
            do_cycles(cycles);
            if (mispcflags)
                if (do_specialties (cycles))
                    return;
#ifndef DEBUG_M68K
#ifdef NO_SHORT_EVENTS
            cycles=2048;
#ifdef PROTECT_INFINITE
            cuentalo++;
            if (cuentalo>1024) {
                g_emulator.quit_program=RunStateReset;
                return;
            }
#endif
        } while((nextevent - currcycle)<=2048);
#endif
        cycles_actual=M68KCONTEXT.cycles_counter;
#endif
        uae4all_prof_end(1);
    }
}
コード例 #3
0
ファイル: m68k_cmn_intrf.cpp プロジェクト: CypherXG/UAE4Droid
static void m68k_run (void)
{
	uae4all_reset ();
	unsigned cycles, cycles_actual=M68KCONTEXT.cycles_counter;
	for (;;) {
		while (pause_program > 0)
		{
			usleep(200000);
		}
        
#ifdef DEBUG_M68K
		dbg_cycle(m68k_fetch(m68k_get_pc(),0));
		m68k_emulate(1);

#else
		uae4all_prof_start(0);
		cycles = nextevent - currcycle;
		switch (timeslice_mode) {
			case 3:  cycles>>=6; break;
			case 2:  cycles>>=7; break;
			case 1:  cycles=(cycles>>8)+(cycles>>9); break;
			default: cycles>>=8; break;
		}
#ifdef DEBUG_TIMESLICE
		unsigned ts=cycles;
#endif
#if defined(FAME_INTERRUPTS_SECURE_PATCH) && defined(FAME_INTERRUPTS_PATCH)
		if (uae4all_go_interrupt)
			m68k_emulate(FAME_INTERRUPTS_PATCH);
		else
#endif
			m68k_emulate(cycles);
		uae4all_prof_end(0);
#endif
#if 0 // def FAME_INTERRUPTS_PATCH
		if (uae4all_go_interrupt)
		{
			/*if (verb)*/ printf("uae4all_go_interrupt: %02x\n", uae4all_go_interrupt);
			M68KCONTEXT.interrupts[0]=uae4all_go_interrupt;
			M68KCONTEXT.execinfo&=0xFF67;
			uae4all_go_interrupt=0;
			m68k_irq_update(0);
		}
#endif
#ifdef DEBUG_M68K

		if (M68KCONTEXT.execinfo & 0x0080)
			mispcflags|=SPCFLAG_STOP;
#endif
                uae4all_prof_start(1);

		//cycles=((unsigned)(((double)(M68KCONTEXT.cycles_counter-cycles_actual))*cycles_factor))<<8;
		cycles=(M68KCONTEXT.cycles_counter-cycles_actual) * cycles_factor;

#ifdef DEBUG_INTERRUPTS
		dbgf("cycles=%i (%i) -> PC=%.6x\n",cycles>>8,nextevent - currcycle, _68k_getpc());
#endif


#ifdef NO_SHORT_EVENTS
#ifdef PROTECT_INFINITE
		unsigned cuentalo=0;
#endif
		do{
#endif
			do_cycles(cycles);
			if (mispcflags)
				if (do_specialties (cycles))
					return;
#ifndef DEBUG_M68K
#ifdef NO_SHORT_EVENTS
			cycles=2048;
#ifdef PROTECT_INFINITE
			cuentalo++;
			if (cuentalo>1024)
			{
				quit_program=2;
				return;
			}
#endif
		}while((nextevent - currcycle)<=2048);
#endif
		cycles_actual=M68KCONTEXT.cycles_counter;
#endif
                uae4all_prof_end(1);
	}
}