/* Generate interrupt - m68705 version */ static void m68705_Interrupt(void) { if( (m6805.pending_interrupts & ((1<<M6805_IRQ_LINE)|M68705_INT_MASK)) != 0 ) { if ( (CC & IFLAG) == 0 ) { PUSHWORD(m6805.pc); PUSHBYTE(m6805.x); PUSHBYTE(m6805.a); PUSHBYTE(m6805.cc); SEI; if (m6805.irq_callback) (*m6805.irq_callback)(0); if ((m6805.pending_interrupts & (1<<M68705_IRQ_LINE)) != 0 ) { m6805.pending_interrupts &= ~(1<<M68705_IRQ_LINE); RM16( 0xfffa, &pPC); change_pc(PC); } else if((m6805.pending_interrupts&(1<<M68705_INT_TIMER))!=0) { m6805.pending_interrupts &= ~(1<<M68705_INT_TIMER); RM16( 0xfff8, &pPC); change_pc(PC); } } m6805_ICount -= 11; } }
/* Generate interrupt - m68705 version */ static void m68705_Interrupt( m6805_Regs *cpustate ) { if( (cpustate->pending_interrupts & ((1<<M6805_IRQ_LINE)|M68705_INT_MASK)) != 0 ) { if ( (CC & IFLAG) == 0 ) { PUSHWORD(cpustate->pc); PUSHBYTE(cpustate->x); PUSHBYTE(cpustate->a); PUSHBYTE(cpustate->cc); SEI; if (cpustate->irq_callback) (*cpustate->irq_callback)(cpustate->device, 0); if ((cpustate->pending_interrupts & (1<<M68705_IRQ_LINE)) != 0 ) { cpustate->pending_interrupts &= ~(1<<M68705_IRQ_LINE); RM16( cpustate, 0xfffa, &pPC); } else if((cpustate->pending_interrupts&(1<<M68705_INT_TIMER))!=0) { cpustate->pending_interrupts &= ~(1<<M68705_INT_TIMER); RM16( cpustate, 0xfff8, &pPC); } } cpustate->iCount -= 11; } }
/* Generate interrupt - m68705 version */ void m68705_device::interrupt() { if ((m_pending_interrupts & ((1 << M6805_IRQ_LINE) | M68705_INT_MASK)) != 0 ) { if ((CC & IFLAG) == 0) { PUSHWORD(m_pc); PUSHBYTE(m_x); PUSHBYTE(m_a); PUSHBYTE(m_cc); SEI; standard_irq_callback(0); if ((m_pending_interrupts & (1 << M68705_IRQ_LINE)) != 0 ) { m_pending_interrupts &= ~(1 << M68705_IRQ_LINE); RM16(0xfffa, &m_pc); } else if ((m_pending_interrupts & (1 << M68705_INT_TIMER)) != 0) { m_pending_interrupts &= ~(1 << M68705_INT_TIMER); RM16(0xfff8, &m_pc); } } m_icount -= 11; } }
static void check_irq_lines(m68_state_t *m68_state) { if( m68_state->irq_state[M6809_IRQ_LINE] != CLEAR_LINE || m68_state->irq_state[M6809_FIRQ_LINE] != CLEAR_LINE ) m68_state->int_state &= ~M6809_SYNC; /* clear SYNC flag */ if( m68_state->irq_state[M6809_FIRQ_LINE]!=CLEAR_LINE && !(CC & CC_IF) ) { /* fast IRQ */ /* HJB 990225: state already saved by CWAI? */ if( m68_state->int_state & M6809_CWAI ) { m68_state->int_state &= ~M6809_CWAI; /* clear CWAI */ m68_state->extra_cycles += 7; /* subtract +7 cycles */ } else { CC &= ~CC_E; /* save 'short' state */ PUSHWORD(pPC); PUSHBYTE(CC); m68_state->extra_cycles += 10; /* subtract +10 cycles */ } CC |= CC_IF | CC_II; /* inhibit FIRQ and IRQ */ PCD=RM16(m68_state, 0xfff6); (void)(*m68_state->irq_callback)(m68_state->device, M6809_FIRQ_LINE); } else if( m68_state->irq_state[M6809_IRQ_LINE]!=CLEAR_LINE && !(CC & CC_II) ) { /* standard IRQ */ /* HJB 990225: state already saved by CWAI? */ if( m68_state->int_state & M6809_CWAI ) { m68_state->int_state &= ~M6809_CWAI; /* clear CWAI flag */ m68_state->extra_cycles += 7; /* subtract +7 cycles */ } else { CC |= CC_E; /* save entire state */ PUSHWORD(pPC); PUSHWORD(pU); PUSHWORD(pY); PUSHWORD(pX); PUSHBYTE(DP); PUSHBYTE(B); PUSHBYTE(A); PUSHBYTE(CC); m68_state->extra_cycles += 19; /* subtract +19 cycles */ } CC |= CC_II; /* inhibit IRQ */ PCD=RM16(m68_state, 0xfff8); (void)(*m68_state->irq_callback)(m68_state->device, M6809_IRQ_LINE); } }
void m68705Reset() { m6805_reset(); /* Overide default 6805 type */ m6805.subtype = SUBTYPE_M68705; RM16( 0xfffe, &m6805.pc ); }
static void trap_23( void ) { PUSHWORD( PC ); pPC = RM16(0xffd0); CHANGE_PC; tms7000_icount -= 14; }
static CPU_RESET( m6805 ) { m6805_Regs *cpustate = get_safe_token(device); device_irq_callback save_irqcallback = cpustate->irq_callback; memset(cpustate, 0, sizeof(m6805_Regs)); cpustate->iCount=50000; /* Used to be global */ cpustate->irq_callback = save_irqcallback; cpustate->device = device; cpustate->program = device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); /* Force CPU sub-type and relevant masks */ cpustate->subtype = SUBTYPE_M6805; SP_MASK = 0x07f; SP_LOW = 0x060; /* Initial stack pointer */ S = SP_MASK; /* IRQ disabled */ SEI; RM16( cpustate, 0xfffe, &pPC ); }
static CPU_RESET( m68705 ) { m6805_Regs *cpustate = get_safe_token(device); CPU_RESET_CALL(m6805); /* Overide default 6805 type */ cpustate->subtype = SUBTYPE_M68705; RM16( cpustate, 0xfffe, &cpustate->pc ); }
void m68hc05eg_device::interrupt_vector() { if ((m_pending_interrupts & (1 << M68HC05EG_INT_IRQ)) != 0) { m_pending_interrupts &= ~(1 << M68HC05EG_INT_IRQ); RM16(0x1ffa, &m_pc); } else if((m_pending_interrupts & (1 << M68HC05EG_INT_TIMER)) != 0) { m_pending_interrupts &= ~(1 << M68HC05EG_INT_TIMER); RM16(0x1ff8, &m_pc); } else if((m_pending_interrupts & (1 << M68HC05EG_INT_CPI)) != 0) { m_pending_interrupts &= ~(1 << M68HC05EG_INT_CPI); RM16(0x1ff6, &m_pc); } }
/**************************************************************************** * M68HC05EG section ****************************************************************************/ void m68hc05eg_device::device_reset() { m6805_base_device::device_reset(); m_sp_mask = 0xff; m_sp_low = 0xc0; RM16(0x1ffe, &m_pc); }
DERIVED_OP_HANDLER( hd63705, swi ) { PUSHWORD(m_pc); PUSHBYTE(m_x); PUSHBYTE(m_a); PUSHBYTE(m_cc); SEI; RM16(0x1ffa, &m_pc); }
/**************************************************************************** * HD63705 section ****************************************************************************/ void hd63705_device::device_reset() { m6805_base_device::device_reset(); m_sp_mask = 0x17f; m_sp_low = 0x100; m_s.w.l = SP_MASK; RM16(0x1ffe, &m_pc); }
/* $3f SWI absolute indirect ----- */ INLINE void swi( void ) { PUSHWORD(pPC); PUSHWORD(pX); PUSHBYTE(A); PUSHBYTE(B); PUSHBYTE(CC); SEI; PCD = RM16(0xfffa); CHANGE_PC(); }
void hd63705Reset(void) { m6805_reset(); /* Overide default 6805 types */ m6805.subtype = SUBTYPE_HD63705; SP_MASK = 0x17f; SP_LOW = 0x100; RM16( 0x1ffe, &m6805.pc ); S = 0x17f; }
static CPU_RESET( m68hc05eg ) { m6805_Regs *cpustate = get_safe_token(device); CPU_RESET_CALL(m6805); /* Overide default 6805 type */ cpustate->subtype = SUBTYPE_M68HC05EG; SP_MASK = 0xff; SP_LOW = 0xc0; RM16( cpustate, 0x1ffe, &cpustate->pc ); }
static CPU_RESET( hd63705 ) { m6805_Regs *cpustate = get_safe_token(device); CPU_RESET_CALL(m6805); /* Overide default 6805 types */ cpustate->subtype = SUBTYPE_HD63705; SP_MASK = 0x17f; SP_LOW = 0x100; RM16( cpustate, 0x1ffe, &cpustate->pc ); S = 0x17f; }
void tlcs870_device::do_POP_gg(const uint8_t opbyte0, const uint8_t opbyte1) { /* OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles POP gg 1110 10gg 0000 0110 - - - - 5 */ m_cycles = 5; m_sp.d += 2; const uint16_t val = RM16(m_sp.d - 1); set_reg16(opbyte0 & 3, val); // no flag changes }
/**************************************************************************** * Set IRQ line state ****************************************************************************/ static void set_irq_line(int irqline, int state) { if (irqline == INPUT_LINE_NMI) { if (hd6309.nmi_state == state) return; hd6309.nmi_state = state; LOG(("HD6309#%d set_irq_line (NMI) %d (PC=%4.4X)\n", cpu_getactivecpu(), state, pPC)); if( state == CLEAR_LINE ) return; /* if the stack was not yet initialized */ if( !(hd6309.int_state & HD6309_LDS) ) return; hd6309.int_state &= ~HD6309_SYNC; /* HJB 990225: state already saved by CWAI? */ if( hd6309.int_state & HD6309_CWAI ) { hd6309.int_state &= ~HD6309_CWAI; hd6309.extra_cycles += 7; /* subtract +7 cycles next time */ } else { CC |= CC_E; /* save entire state */ PUSHWORD(pPC); PUSHWORD(pU); PUSHWORD(pY); PUSHWORD(pX); PUSHBYTE(DP); if ( MD & MD_EM ) { PUSHBYTE(F); PUSHBYTE(E); hd6309.extra_cycles += 2; /* subtract +2 cycles */ } PUSHBYTE(B); PUSHBYTE(A); PUSHBYTE(CC); hd6309.extra_cycles += 19; /* subtract +19 cycles next time */ } CC |= CC_IF | CC_II; /* inhibit FIRQ and IRQ */ PCD = RM16(0xfffc); CHANGE_PC; } else if (irqline < 2) { LOG(("HD6309#%d set_irq_line %d, %d (PC=%4.4X)\n", cpu_getactivecpu(), irqline, state, pPC)); hd6309.irq_state[irqline] = state; if (state == CLEAR_LINE) return; CHECK_IRQ_LINES(); } }
static void m6805_reset(void *param) { memset(&m6805, 0, sizeof(m6805)); /* Force CPU sub-type and relevant masks */ m6805.subtype = SUBTYPE_M6805; SP_MASK = 0x07f; SP_LOW = 0x060; /* Initial stack pointer */ S = SP_MASK; /* IRQ disabled */ SEI; RM16( 0xfffe , &pPC ); change_pc(PC); }
static void konami_reset(void) { konami.int_state = 0; konami.nmi_state = CLEAR_LINE; konami.irq_state[0] = CLEAR_LINE; konami.irq_state[0] = CLEAR_LINE; DPD = 0; /* Reset direct page register */ CC |= CC_II; /* IRQ disabled */ CC |= CC_IF; /* FIRQ disabled */ PCD = RM16(0xfffe); change_pc(PC); /* TS 971002 */ }
void m6809_base_device::device_reset() { m_int_state = 0; m_nmi_state = CLEAR_LINE; m_irq_state[0] = CLEAR_LINE; m_irq_state[1] = CLEAR_LINE; DPD = 0; /* Reset direct page register */ CC |= CC_II; /* IRQ disabled */ CC |= CC_IF; /* FIRQ disabled */ PCD = RM16(0xfffe); update_state(); }
void hd63705_device::interrupt_vector() { /* Need to add emulation of other interrupt sources here KW-2/4/99 */ /* This is just a quick patch for Namco System 2 operation */ if ((m_pending_interrupts & (1 << HD63705_INT_IRQ1)) != 0) { m_pending_interrupts &= ~(1 << HD63705_INT_IRQ1); RM16(0x1ff8, &m_pc); } else if ((m_pending_interrupts & (1 << HD63705_INT_IRQ2)) != 0) { m_pending_interrupts &= ~(1 << HD63705_INT_IRQ2); RM16(0x1fec, &m_pc); } else if ((m_pending_interrupts & (1 << HD63705_INT_ADCONV)) != 0) { m_pending_interrupts &= ~(1 << HD63705_INT_ADCONV); RM16(0x1fea, &m_pc); } else if ((m_pending_interrupts & (1 << HD63705_INT_TIMER1)) != 0) { m_pending_interrupts &= ~(1 << HD63705_INT_TIMER1); RM16(0x1ff6, &m_pc); } else if ((m_pending_interrupts & (1 << HD63705_INT_TIMER2)) != 0) { m_pending_interrupts &= ~(1 << HD63705_INT_TIMER2); RM16(0x1ff4, &m_pc); } else if ((m_pending_interrupts & (1 << HD63705_INT_TIMER3)) != 0) { m_pending_interrupts &= ~(1<<HD63705_INT_TIMER3); RM16(0x1ff2, &m_pc); } else if ((m_pending_interrupts & (1 << HD63705_INT_PCI)) != 0) { m_pending_interrupts &= ~(1 << HD63705_INT_PCI); RM16(0x1ff0, &m_pc); } else if ((m_pending_interrupts & (1 << HD63705_INT_SCI)) != 0) { m_pending_interrupts &= ~(1 << HD63705_INT_SCI); RM16(0x1fee, &m_pc); } }
/**************************************************************************** * Set IRQ line state ****************************************************************************/ void konami_set_irq_line(int irqline, int state) { #if defined FBA_DEBUG if (!DebugCPU_KonamiInitted) bprintf(PRINT_ERROR, _T("konami_set_irq_line called without init\n")); #endif if (irqline == KONAMI_INPUT_LINE_NMI) { if (konami.nmi_state == state) return; konami.nmi_state = state; // LOG(("KONAMI#%d set_nmi_line %d\n", cpu_getactivecpu(), state)); if( state == CPU_IRQSTATUS_NONE ) return; /* if the stack was not yet initialized */ if( !(konami.int_state & KONAMI_LDS) ) return; konami.int_state &= ~KONAMI_SYNC; /* state already saved by CWAI? */ if( konami.int_state & KONAMI_CWAI ) { konami.int_state &= ~KONAMI_CWAI; konami.extra_cycles += 7; /* subtract +7 cycles next time */ } else { CC |= CC_E; /* save entire state */ PUSHWORD(pPC); PUSHWORD(pU); PUSHWORD(pY); PUSHWORD(pX); PUSHBYTE(DP); PUSHBYTE(B); PUSHBYTE(A); PUSHBYTE(CC); konami.extra_cycles += 19; /* subtract +19 cycles next time */ } CC |= CC_IF | CC_II; /* inhibit FIRQ and IRQ */ PCD = RM16(0xfffc); change_pc(PC); /* TS 971002 */ } else if (irqline < 2) { // LOG(("KONAMI#%d set_irq_line %d, %d\n", cpu_getactivecpu(), irqline, state)); konami.irq_state[irqline] = state; if (state == CPU_IRQSTATUS_NONE) return; CHECK_IRQ_LINES; } }
static void m6805_reset(void) { int (*save_irqcallback)(int) = m6805.irq_callback; memset(&m6805, 0, sizeof(m6805)); m6805.irq_callback = save_irqcallback; /* Force CPU sub-type and relevant masks */ m6805.subtype = SUBTYPE_M6805; SP_MASK = 0x07f; SP_LOW = 0x060; /* Initial stack pointer */ S = SP_MASK; /* IRQ disabled */ SEI; RM16( 0xfffe , &pPC ); change_pc(PC); }
static void hd6309_reset(void) { hd6309.int_state = 0; hd6309.nmi_state = CLEAR_LINE; hd6309.irq_state[0] = CLEAR_LINE; hd6309.irq_state[0] = CLEAR_LINE; DPD = 0; /* Reset direct page register */ MD = 0; /* Mode register gets reset */ CC |= CC_II; /* IRQ disabled */ CC |= CC_IF; /* FIRQ disabled */ PCD = RM16(0xfffe); CHANGE_PC; UpdateState(); }
static CPU_RESET( konami ) { konami_state *cpustate = get_safe_token(device); cpustate->int_state = 0; cpustate->nmi_state = CLEAR_LINE; cpustate->nmi_pending = FALSE; cpustate->irq_state[0] = CLEAR_LINE; cpustate->irq_state[1] = CLEAR_LINE; DPD = 0; /* Reset direct page register */ CC |= CC_II; /* IRQ disabled */ CC |= CC_IF; /* FIRQ disabled */ PCD = RM16(cpustate, 0xfffe); }
static CPU_RESET( m6809 ) { m68_state_t *m68_state = get_safe_token(device); m68_state->int_state = 0; m68_state->nmi_state = CLEAR_LINE; m68_state->irq_state[0] = CLEAR_LINE; m68_state->irq_state[1] = CLEAR_LINE; DPD = 0; /* Reset direct page register */ CC |= CC_II; /* IRQ disabled */ CC |= CC_IF; /* FIRQ disabled */ PCD = RM16(m68_state, 0xfffe); UpdateState(m68_state); }
static void tms7000_do_interrupt( UINT16 address, UINT8 line ) { PUSHBYTE( pSR ); /* Push Status register */ PUSHWORD( PC ); /* Push Program Counter */ pSR = 0; /* Clear Status register */ pPC = RM16(address); /* Load PC with interrupt vector */ CHANGE_PC; if( tms7000.idle_state == 0 ) tms7000_icount -= 19; /* 19 cycles used */ else { tms7000_icount -= 17; /* 17 if idled */ tms7000.idle_state = 0; } (void)(*tms7000.irq_callback)(line); }
/**************************************************************************** * Set IRQ line state ****************************************************************************/ static void set_irq_line(int irqline, int state) { if (irqline == INPUT_LINE_NMI) { if (konami.nmi_state == state) return; konami.nmi_state = state; LOG(("KONAMI#%d set_nmi_line %d\n", cpu_getactivecpu(), state)); if( state == CLEAR_LINE ) return; /* if the stack was not yet initialized */ if( !(konami.int_state & KONAMI_LDS) ) return; konami.int_state &= ~KONAMI_SYNC; /* state already saved by CWAI? */ if( konami.int_state & KONAMI_CWAI ) { konami.int_state &= ~KONAMI_CWAI; konami.extra_cycles += 7; /* subtract +7 cycles next time */ } else { CC |= CC_E; /* save entire state */ PUSHWORD(pPC); PUSHWORD(pU); PUSHWORD(pY); PUSHWORD(pX); PUSHBYTE(DP); PUSHBYTE(B); PUSHBYTE(A); PUSHBYTE(CC); konami.extra_cycles += 19; /* subtract +19 cycles next time */ } CC |= CC_IF | CC_II; /* inhibit FIRQ and IRQ */ PCD = RM16(0xfffc); change_pc(PC); /* TS 971002 */ } else if (irqline < 2) { LOG(("KONAMI#%d set_irq_line %d, %d\n", cpu_getactivecpu(), irqline, state)); konami.irq_state[irqline] = state; if (state == CLEAR_LINE) return; CHECK_IRQ_LINES; } }
/**************************************************************************** * Set IRQ line state ****************************************************************************/ static void set_irq_line(m68_state_t *m68_state, int irqline, int state) { if (irqline == INPUT_LINE_NMI) { if (m68_state->nmi_state == state) return; m68_state->nmi_state = state; LOG(("M6809 '%s' set_irq_line (NMI) %d\n", m68_state->device->tag(), state)); if( state == CLEAR_LINE ) return; /* if the stack was not yet initialized */ if( !(m68_state->int_state & M6809_LDS) ) return; m68_state->int_state &= ~M6809_SYNC; /* HJB 990225: state already saved by CWAI? */ if( m68_state->int_state & M6809_CWAI ) { m68_state->int_state &= ~M6809_CWAI; m68_state->extra_cycles += 7; /* subtract +7 cycles next time */ } else { CC |= CC_E; /* save entire state */ PUSHWORD(pPC); PUSHWORD(pU); PUSHWORD(pY); PUSHWORD(pX); PUSHBYTE(DP); PUSHBYTE(B); PUSHBYTE(A); PUSHBYTE(CC); m68_state->extra_cycles += 19; /* subtract +19 cycles next time */ } CC |= CC_IF | CC_II; /* inhibit FIRQ and IRQ */ PCD = RM16(m68_state, 0xfffc); } else if (irqline < 2) { LOG(("M6809 '%s' set_irq_line %d, %d\n", m68_state->device->tag(), irqline, state)); m68_state->irq_state[irqline] = state; if (state == CLEAR_LINE) return; check_irq_lines(m68_state); } }