Exemple #1
0
void        update_clay(t_clay *clay)
{
    unsigned int        tstate_delta = clay->cpu.tstates;

    Z80Execute(&clay->cpu);         // Execute next instruction
    tstate_delta = clay->cpu.tstates - tstate_delta;

    // Update components
    z80ctc_update(&clay->ctc, tstate_delta);
    ay_3_8912_update(&clay->ay, tstate_delta);
    audio_output_update(&clay->audio_out, tstate_delta);
    // update SIO    

    // Process interrupts if any (and if possible)
    if (clay->cpu.IFF1)
    {
        if (clay->ctc.interrupt_request)
        {
            Z80INT(&clay->cpu, clay->ctc.interrupt_channel_vector);
            z80ctc_ack_interrupt_req(&clay->ctc);
        }
        // ellse if (...)
        // ;
    }
}
Exemple #2
0
unsigned Z80ExecuteTStates(Z80Context* ctx, unsigned tstates)
{
	ctx->tstates = 0;
	while (ctx->tstates < tstates)
		Z80Execute(ctx);
	return ctx->tstates;
}
Exemple #3
0
// Run the z80 cpu for Cycles more cycles
static INLINE void CpuRun(int Cycles)
{
  int Done=0;

  CyclesLeft+=Cycles; CpuBase=CyclesLeft;
#ifdef EMU_DOZE
  DozeRun();
#elif defined(EMU_Z80JB)
  Z80Execute(CpuBase);
#elif defined(EMU_DRZ80)
  DrZ80Run(&drz80,Cycles);
#endif

  Done=CpuMid(); // Find out number of cycles actually done
  CpuBase=CyclesLeft; // Reset CpuBase, so CpuMid() will return 0

  FrameCyc+=Done; // Add cycles done to frame total
  VgmCycleDone(Done); // Add cycles done to VGM total
}