Пример #1
0
// not really used
Bits CPU_Core_Simple_Trap_Run(void) {
	Bits oldCycles = CPU_Cycles;
	CPU_Cycles = 1;
	cpu.trap_skip = false;

	Bits ret=CPU_Core_Normal_Run();
	if (!cpu.trap_skip) CPU_HW_Interrupt(1);
	CPU_Cycles = oldCycles-1;
	cpudecoder = &CPU_Core_Simple_Run;

	return ret;
}
Пример #2
0
static void slave_startIRQ(){
	Bit8u pic1_irq = 8;
	const Bit8u p = (slave.irr & slave.imrr)&slave.isrr;
	const Bit8u max = slave.special?8:slave.active_irq;
	for(Bit8u i = 0,s = 1;i < max;i++, s<<=1){
		if (p&s){
			pic1_irq = i;
			break;
		}
	}
	// Maybe change the E_Exit to a return
	if (GCC_UNLIKELY(pic1_irq == 8)) E_Exit("irq 2 is active, but no irq active on the slave PIC.");

	slave.start_irq(pic1_irq);
	master.start_irq(2);
	CPU_HW_Interrupt(slave.vector_base + pic1_irq);
}
Пример #3
0
Bits CPU_Core_Dynrec_Trap_Run(void) {
	Bits oldCycles = CPU_Cycles;
	CPU_Cycles = 1;
	cpu.trap_skip = false;

	// let the normal core execute the next (only one!) instruction
	Bits ret=CPU_Core_Normal_Run();

	// trap to int1 unless the last instruction deferred this
	// (allows hardware interrupts to be served without interaction)
	if (!cpu.trap_skip) CPU_HW_Interrupt(1);

	CPU_Cycles = oldCycles-1;
	// continue (either the trapflag was clear anyways, or the int1 cleared it)
	cpudecoder = &CPU_Core_Dynrec_Run;

	return ret;
}
Пример #4
0
void RunPC(void)
	{
	while (1)
		{
		while (CPU_Cycles > 0)
			{
			if (BIOS_HostTimeSync() && !ISR)
			{ 
				intPending = true;													// New timer tick
#ifdef WITHIRQ1
				kbPending = false;
#endif
			}
#ifdef WITHIRQ1
			else if (useIrq1 && !intPending && keyb_req && !ISR)
				kbPending=true;
#endif
			if (GETFLAG(IF))														// (hardware) Interrupts handled
				if (intPending)
					{
					intPending = false;
					if ((Mem_Lodsb(4*8+3)|Mem_Lodsb(4*0x1c+3)) != 0xf0)				// And Int 8 or 1C replaced
						{
						ISR = 1;
						CPU_HW_Interrupt(8);										// Setup executing Int 8 (IRQ0)
						}
					}
#ifdef WITHIRQ1
				else if (kbPending && Mem_Lodsb(4 * 9 + 3) != 0xf0)
					{
						
						kbPending = false;
						keyb_req = false;
						ISR = 2;
						CPU_HW_Interrupt(9);
					}
#endif
				else if (mouse_event_type)
					CPU_HW_Interrupt(0x74);											// Setup executing Int 74 (Mouse)
			Bits ret = (*cpudecoder)();
			if (ret < 0)
				return;
			if (ret > 0 && (*CallBack_Handlers[ret])())
				return;
			}
		GFX_Events();
		Bit32u mSecsNew = GetTickCount();
		if (mSecsNew >= prevWinRefresh+40)											// 25 refreshes per second
			{
			prevWinRefresh = mSecsNew;
			VGA_VerticalTimer();
			}
		if (mSecsNew <= mSecsLast+55)												// To be real save???
			{
			LPT_CheckTimeOuts(mSecsNew);
			Sleep(idleCount >= idleTrigger ? 2: 0);									// If idleTrigger or more repeated idle keyboard requests or int 28h called, sleep fixed (CPU usage drops down)
			if (idleCount > idleTrigger && CPU_CycleMax > CPU_CycleLow)
				CPU_CycleMax -= 100;												// Decrease cycles
			else if (idleCount <= idleTrigger  && CPU_CycleMax < CPU_CycleHigh)
				CPU_CycleMax += 1000;												// Fire up again
			}
		mSecsLast = mSecsNew;
		idleCount = 0;
		CPU_Cycles = CPU_CycleMax;
		}
	}
Пример #5
0
static void inline master_startIRQ(Bitu i){
	master.start_irq(i);
	CPU_HW_Interrupt(master.vector_base + i);
}