Beispiel #1
0
void m6809_base_device::execute_run()
{
	m_icount -= m_extra_cycles;
	m_extra_cycles = 0;

	check_irq_lines();

	if (m_int_state & (M6809_CWAI | M6809_SYNC))
	{
		debugger_instruction_hook(this, PCD);
		m_icount = 0;
	}
	else
	{
		do
		{
			pPPC = pPC;

			debugger_instruction_hook(this, PCD);

			m_ireg = ROP(PCD);
			PC++;
			(this->*m_opcode[m_ireg])();
			m_icount -= m_cycles1[m_ireg];

		} while( m_icount > 0 );

		m_icount -= m_extra_cycles;
		m_extra_cycles = 0;
	}
}
/* execute instructions on this CPU until icount expires */
static CPU_EXECUTE( m6809 )	/* NS 970908 */
{
	m68_state_t *m68_state = get_safe_token(device);

    m68_state->icount -= m68_state->extra_cycles;
	m68_state->extra_cycles = 0;

	check_irq_lines(m68_state);

	if (m68_state->int_state & (M6809_CWAI | M6809_SYNC))
	{
		debugger_instruction_hook(device, PCD);
		m68_state->icount = 0;
	}
	else
	{
		do
		{
			pPPC = pPC;

			debugger_instruction_hook(device, PCD);

			m68_state->ireg = ROP(PCD);
			PC++;
        	(*m6809_main[m68_state->ireg])(m68_state);
			m68_state->icount -= cycles1[m68_state->ireg];

		} while( m68_state->icount > 0 );

        m68_state->icount -= m68_state->extra_cycles;
		m68_state->extra_cycles = 0;
    }
}
Beispiel #3
0
void nec_common_device::execute_run()
{
	int prev_ICount;

	if (m_halted)
	{
		m_icount = 0;
		debugger_instruction_hook(this, (Sreg(PS)<<4) + m_ip);
		return;
	}

	while(m_icount>0) {
		/* Dispatch IRQ */
		if (m_pending_irq && m_no_interrupt==0)
		{
			if (m_pending_irq & NMI_IRQ)
				external_int();
			else if (m_IF)
				external_int();
		}

		/* No interrupt allowed between last instruction and this one */
		if (m_no_interrupt)
			m_no_interrupt--;

		debugger_instruction_hook(this, (Sreg(PS)<<4) + m_ip);
		prev_ICount = m_icount;
		(this->*s_nec_instruction[fetchop()])();
		do_prefetch(prev_ICount);
	}
}
Beispiel #4
0
static CPU_EXECUTE( necv )
{
	nec_state_t *nec_state = get_safe_token(device);
	int prev_ICount;

	if (nec_state->halted)
	{
		nec_state->icount = 0;
		debugger_instruction_hook(device, (Sreg(PS)<<4) + nec_state->ip);
		return;
	}

	while(nec_state->icount>0) {
		/* Dispatch IRQ */
		if (nec_state->pending_irq && nec_state->no_interrupt==0)
		{
			if (nec_state->pending_irq & NMI_IRQ)
				external_int(nec_state);
			else if (nec_state->IF)
				external_int(nec_state);
		}

		/* No interrupt allowed between last instruction and this one */
		if (nec_state->no_interrupt)
			nec_state->no_interrupt--;

		debugger_instruction_hook(device, (Sreg(PS)<<4) + nec_state->ip);
		prev_ICount = nec_state->icount;
		nec_instruction[fetchop(nec_state)](nec_state);
		do_prefetch(nec_state, prev_ICount);
	}
}
Beispiel #5
0
static CPU_EXECUTE( sc61860 )
{
    sc61860_state *cpustate = get_safe_token(device);

    do
    {
        cpustate->oldpc = cpustate->pc;

        debugger_instruction_hook(device, cpustate->pc);

        sc61860_instruction(cpustate);

#if 0
        /* Are we in HLT-mode? */
        if (cpustate->c & 4)
        {
            if ((cpustate->config && cpustate->config->ina && (cpustate->config->ina(cpustate)!=0)) || cpustate->timer.t512ms)
            {
                cpustate->c&=0xfb;
                if (cpustate->config->outc) cpustate->config->outc(cpustate->c);
            }
            cpustate->icount-=4;
        }
        else if(cpustate->c & 8) {}

        else sc61860_instruction(cpustate);
#endif

    } while (cpustate->icount > 0);
}
Beispiel #6
0
void minx_cpu_device::execute_run()
{
	do
	{
		m_curpc = GET_MINX_PC;
		debugger_instruction_hook(this, m_curpc);

		if ( m_interrupt_pending )
		{
			m_halted = 0;
			if ( ! ( m_F & 0xc0 ) && m_U == m_V )
			{
				//logerror("minx_execute(): taking IRQ\n");
				PUSH8( m_V );
				PUSH16( m_PC );
				PUSH8( m_F );

				/* Set Interrupt Branch flag */
				m_F |= 0x80;
				m_V = 0;
				m_PC = rd16( standard_irq_callback( 0 ) << 1 );
				m_icount -= 28;     /* This cycle count is a guess */
			}
		}

		if ( m_halted )
		{
			m_icount -= insnminx_cycles_CE[0xAE];
		}
		else
		{
			execute_one();
		}
	} while ( m_icount > 0 );
}
Beispiel #7
0
static CPU_EXECUTE( t11 )
{
	t11_state *cpustate = get_safe_token(device);

	t11_check_irqs(cpustate);

	if (cpustate->wait_state)
	{
		cpustate->icount = 0;
		goto getout;
	}

	do
	{
		UINT16 op;

		cpustate->ppc = cpustate->reg[7];	/* copy PC to previous PC */

		debugger_instruction_hook(device, cpustate->PCD);

		op = ROPCODE(cpustate);
		(*opcode_table[op >> 3])(cpustate, op);

	} while (cpustate->icount > 0);

getout:
	;
}
Beispiel #8
0
void lr35902_cpu_device::execute_run()
{
	do
	{
		if ( m_execution_state ) {
			UINT8   x;
			/* Execute instruction */
			switch( m_op ) {
#include "opc_main.inc"
				default:
					// actually this should lock up the cpu!
					logerror("LR35902: Illegal opcode $%02X @ %04X\n", m_op, m_PC);
					break;
			}
		} else {
			/* Fetch and count cycles */
			check_interrupts();
			debugger_instruction_hook(this, m_PC);
			if ( m_enable & HALTED ) {
				cycles_passed( 4 );
				m_execution_state = 1;
			} else {
				m_op = mem_read_byte( m_PC++ );
				if ( m_handle_halt_bug ) {
					m_PC--;
					m_handle_halt_bug = false;
				}
			}
		}
		m_execution_state ^= 1;
	} while (m_icount > 0);
}
Beispiel #9
0
/* execute instructions on this CPU until icount expires */
static CPU_EXECUTE( konami )
{
	konami_state *cpustate = get_safe_token(device);

	check_irq_lines(cpustate);

	if( cpustate->int_state & (KONAMI_CWAI | KONAMI_SYNC) )
	{
		cpustate->icount = 0;
	}
	else
	{
		do
		{
			UINT8 ireg;

			pPPC = pPC;

			debugger_instruction_hook(device, PCD);

			cpustate->ireg = ireg = ROP(cpustate, PCD);
			PC++;

            (*konami_main[ireg])(cpustate);

            cpustate->icount -= cycles1[ireg];

        } while( cpustate->icount > 0 );
    }
}
Beispiel #10
0
inline void cosmac_device::debug()
{
	if (device_t::machine().debug_flags & DEBUG_FLAG_ENABLED)
	{
		debugger_instruction_hook(this, R[P]);
	}
}
Beispiel #11
0
void lr35902_cpu_device::execute_run()
{
	do
	{
		if ( m_execution_state ) {
			UINT8   x;
			/* Execute instruction */
			switch( m_op ) {
#include "opc_main.h"
			}
		} else {
			/* Fetch and count cycles */
			check_interrupts();
			debugger_instruction_hook(this, m_PC);
			if ( m_enable & HALTED ) {
				cycles_passed( 4 );
				m_execution_state = 1;
			} else {
				m_op = mem_read_byte( m_PC++ );
				if ( m_doHALTbug ) {
					m_PC--;
					m_doHALTbug = 0;
				}
			}
		}
		m_execution_state ^= 1;
	} while (m_icount > 0);
}
Beispiel #12
0
void dsp16_device::execute_run()
{
	// HACK TO MAKE CPU DO NOTHING.
	// REMOVE IF DEVELOPING CPU CORE.
	m_icount = 0;
	return;

	do
	{
		// debugging
		m_ppc = m_pc;   // copy PC to previous PC
		debugger_instruction_hook(this, m_pc);

		// instruction fetch & execute
		UINT8 cycles;
		UINT8 pcAdvance;
		const UINT16 op = opcode_read();
		execute_one(op, cycles, pcAdvance);

		// step
		m_pc += pcAdvance;
		m_icount -= cycles;

		// The 16 bit PI "shadow" register gets set to PC on each instruction except
		// when an interrupt service routine is active (TODO: Interrupt check)  (page 2-4)
		m_pi = m_pc;

	} while (m_icount > 0);
}
Beispiel #13
0
void tms32082_mp_device::execute_run()
{
	while (m_icount > 0)
	{
		m_pc = m_fetchpc;

		check_interrupts();

		debugger_instruction_hook(this, m_pc);

		m_ir = fetch();
		execute();

		m_tcount--;
		if (m_tcount < 0)
		{
			// TODO: timer interrupt
			m_tcount = m_tscale;
		}

		m_icount--;
	};

	return;
}
Beispiel #14
0
void tms32082_mp_device::delay_slot()
{
	debugger_instruction_hook(this, m_pc);
	m_ir = fetch();
	execute();

	m_icount--;
}
Beispiel #15
0
void alpha_device::execute_run()
{
	while (m_icount > 0)
	{
		debugger_instruction_hook(m_pc);

		m_icount--;
	}
}
Beispiel #16
0
void tms32082_pp_device::execute_run()
{
	m_pc = m_fetchpc;
	debugger_instruction_hook(this, m_pc);

	m_icount = 0;

	return;
}
Beispiel #17
0
void pdp8_device::execute_run()
{
	while (m_icount > 0)
	{
		m_pc &= 07777;

		debugger_instruction_hook(this, m_pc);

		UINT16 op = m_program->read_word(m_pc);

		--m_icount;
	}
}
Beispiel #18
0
void lr35902_cpu_device::execute_run()
{
	do
	{
		if (m_dma_cycles_to_burn > 0)
		{
			if (m_dma_cycles_to_burn < 4)
			{
				cycles_passed(m_dma_cycles_to_burn);
				m_dma_cycles_to_burn = 0;
			}
			else
			{
				cycles_passed(4);
				m_dma_cycles_to_burn -= 4;
			}
		}
		else
		{
			if ( m_execution_state ) {
				uint8_t   x;
				/* Execute instruction */
				switch( m_op ) {
#include "opc_main.hxx"
					default:
						// actually this should lock up the cpu!
						logerror("LR35902: Illegal opcode $%02X @ %04X\n", m_op, m_PC);
						break;
				}
			} else {
				/* Fetch and count cycles */
				bool was_halted = (m_enable & HALTED);
				check_interrupts();
				debugger_instruction_hook(m_PC);
				if ( m_enable & HALTED ) {
					cycles_passed(m_has_halt_bug ? 2 : 4);
					m_execution_state = 1;
					m_entering_halt = false;
				} else {
					if (was_halted) {
						m_PC++;
					} else {
						m_op = mem_read_byte( m_PC++ );
					}
				}
			}
			m_execution_state ^= 1;
		}
	} while (m_icount > 0);
}
Beispiel #19
0
static CPU_EXECUTE( m6502 )
{
	m6502_Regs *cpustate = get_safe_token(device);

	do
	{
		UINT8 op;
		PPC = PCD;

		debugger_instruction_hook(device, PCD);

		/* if an irq is pending, take it now */
		if( cpustate->pending_irq )
			m6502_take_irq(cpustate);

		op = RDOP();
		(*cpustate->insn[op])(cpustate);

		/* check if the I flag was just reset (interrupts enabled) */
		if( cpustate->after_cli )
		{
			LOG(("M6502 '%s' after_cli was >0", cpustate->device->tag()));
			cpustate->after_cli = 0;
			if (cpustate->irq_state != CLEAR_LINE)
			{
				LOG((": irq line is asserted: set pending IRQ\n"));
				cpustate->pending_irq = 1;
			}
			else
			{
				LOG((": irq line is clear\n"));
			}
		}
		else {
			if ( cpustate->pending_irq == 2 ) {
				if ( cpustate->int_occured - cpustate->icount > 1 ) {
					cpustate->pending_irq = 1;
				}
			}
			if( cpustate->pending_irq == 1 )
				m6502_take_irq(cpustate);
			if ( cpustate->pending_irq == 2 ) {
				cpustate->pending_irq = 1;
			}
		}

	} while (cpustate->icount > 0);
}
Beispiel #20
0
static CPU_EXECUTE( h6280 )
{
	int in;
	h6280_Regs* cpustate = get_safe_token(device);

	if ( cpustate->irq_pending == 2 ) {
		cpustate->irq_pending--;
	}

	/* Execute instructions */
	do
    {
		cpustate->ppc = cpustate->pc;

		debugger_instruction_hook(device, PCW);

		/* Execute 1 instruction */
		in=RDOP();
		PCW++;
		insnh6280[in](cpustate);

		if ( cpustate->irq_pending ) {
			if ( cpustate->irq_pending == 1 ) {
				if ( !(P & _fI) ) {
					cpustate->irq_pending--;
					CHECK_AND_TAKE_IRQ_LINES;
				}
			} else {
				cpustate->irq_pending--;
			}
		}

		/* Check internal timer */
		if(cpustate->timer_status)
		{
			if(cpustate->timer_value<=0)
			{
				if ( ! cpustate->irq_pending )
					cpustate->irq_pending = 1;
				while( cpustate->timer_value <= 0 )
					cpustate->timer_value += cpustate->timer_load;
				set_irq_line(cpustate, 2,ASSERT_LINE);
			}
		}
	} while (cpustate->ICount > 0);
}
Beispiel #21
0
static CPU_EXECUTE( lh5801 )
{
	lh5801_state *cpustate = get_safe_token(device);

	if (cpustate->idle) {
		cpustate->icount=0;
	} else {
		do
		{
			cpustate->oldpc = P;

			debugger_instruction_hook(device, P);
			lh5801_instruction(cpustate);

		} while (cpustate->icount > 0);
	}
}
void dsp16_device::execute_run()
{
	bool check_debugger = ((device_t::machine().debug_flags & DEBUG_FLAG_ENABLED) != 0);

	do
	{
		// debugging
		m_ppc = m_pc;	// copy PC to previous PC
		if (check_debugger)
			debugger_instruction_hook(this, m_pc);

		// instruction fetch
		//UINT16 op = opcode_read();

        m_icount--;
    } while (m_icount > 0);
}
Beispiel #23
0
void arc_device::execute_run()
{
	//UINT32 lres;
	//lres = 0;

	while (m_icount > 0)
	{
		debugger_instruction_hook(this, m_pc<<2);

		//UINT32 op = READ32(m_pc);

		m_pc++;

		m_icount--;
	}

}
Beispiel #24
0
Datei: v60.cpp Projekt: Fulg/mame
void v60_device::execute_run()
{
	if (m_irq_line != CLEAR_LINE)
		v60_try_irq();

	while (m_icount > 0)
	{
		UINT32 inc;
		m_PPC = PC;
		debugger_instruction_hook(this, PC);
		m_icount -= 8;  /* fix me -- this is just an average */
		inc = (this->*s_OpCodeTable[OpRead8(PC)])();
		PC += inc;
		if (m_irq_line != CLEAR_LINE)
			v60_try_irq();
	}
}
Beispiel #25
0
void lh5801_cpu_device::execute_run()
{
	do
	{
		check_irq();

		if (m_idle)
			m_icount = 0;
		else
		{
			m_oldpc = P;

			debugger_instruction_hook(this, P);
			lh5801_instruction();
		}

	} while (m_icount > 0);
}
Beispiel #26
0
void tms32082_mp_device::execute_run()
{
	while (m_icount > 0)
	{
		m_pc = m_fetchpc;

		check_interrupts();

		debugger_instruction_hook(this, m_pc);

		m_ir = fetch();
		execute();

		m_icount--;
	};

	return;
}
Beispiel #27
0
void sm510_base_device::execute_run()
{
	while (m_icount > 0)
	{
		// remember previous state
		m_prev_op = m_op;
		m_prev_pc = m_pc;

		// fetch next opcode
		debugger_instruction_hook(this, m_pc);
		m_icount -= 2; // 61us typical
		m_op = m_program->read_byte(m_pc);
		increment_pc();
		get_opcode_param();

		// handle opcode

	}
}
Beispiel #28
0
static CPU_EXECUTE( m4510 )
{
	m4510_Regs *cpustate = get_safe_token(device);

	cpustate->icount = cycles;

	do
	{
		UINT8 op;
		PPC = PCD;

		debugger_instruction_hook(device, PCD);

		/* if an irq is pending, take it now */
		if( cpustate->pending_irq )
			m4510_take_irq(cpustate);

		op = RDOP();
		(*insn4510[op])(cpustate);

		/* check if the I flag was just reset (interrupts enabled) */
		if( cpustate->after_cli )
		{
			LOG(("M4510 '%s' after_cli was >0", cpustate->device->tag));
			cpustate->after_cli = 0;
			if (cpustate->irq_state != CLEAR_LINE)
			{
				LOG((": irq line is asserted: set pending IRQ\n"));
				cpustate->pending_irq = 1;
			}
			else
			{
				LOG((": irq line is clear\n"));
			}
		}
		else
		if( cpustate->pending_irq )
			m4510_take_irq(cpustate);

	} while (cpustate->icount > 0);

	return cycles - cpustate->icount;
}
Beispiel #29
0
/* Execute cycles */
void cp1610_cpu_device::execute_run()
{
	UINT16 opcode;

	do
	{
		debugger_instruction_hook(this, m_pc);

		opcode = xxx_readop(m_pc);
		m_pc++;

		switch( opcode )
		{
			default:
				xxx_illegal();
				break;
		}

	} while( m_icount > 0 );
}
Beispiel #30
0
/* Execute cycles */
void mb86235_cpu_device::execute_run()
{
	UINT32 opcode;

	do
	{
		debugger_instruction_hook(this, m_pc);

		opcode = mb86235_readop(m_pc);
		//m_pc++;

		switch( opcode )
		{
			default:
				mb86235_illegal();
				break;
		}

	} while( m_icount > 0 );
}