/* 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; } }
/* 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 */ 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; } }
DERIVED_OP_HANDLER( hd63705, swi ) { PUSHWORD(m_pc); PUSHBYTE(m_x); PUSHBYTE(m_a); PUSHBYTE(m_cc); SEI; RM16(0x1ffa, &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(); }
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); } }
/* $3e WAI inherent ----- */ INLINE void wai( void ) { /* * WAI stacks the entire machine state on the * hardware stack, then waits for an interrupt. */ m6808.wai_state |= M6808_WAI; PUSHWORD(pPC); PUSHWORD(pX); PUSHBYTE(A); PUSHBYTE(B); PUSHBYTE(CC); CHECK_IRQ_LINES(); if (m6808.wai_state & M6808_WAI) EAT_CYCLES; }
/**************************************************************************** * 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; } }
void NetGameSettings::Packetize(uint8 *buf, uint16 &size) { size = 0; PUSHID(k_PACKET_GAME_SETTINGS_ID); PUSHLONG(m_x); PUSHLONG(m_y); PUSHLONG(m_numPlayers); PUSHBYTE(m_gameStyle); PUSHLONG(m_movesPerSlice); PUSHLONG(m_totalTime); PUSHLONG(m_turnTime); PUSHLONG(m_cityTime); uint32 playerMask = 0; for(sint32 i = 0; i < k_MAX_PLAYERS; i++) { if(g_player[i]) playerMask |= (1 << i); } PUSHLONG(playerMask); PUSHLONG(g_theGameSettings->m_difficulty); PUSHLONG(g_theGameSettings->m_risk); PUSHLONG(g_theGameSettings->m_alienEndGame); PUSHLONG(g_theGameSettings->m_pollution); PUSHLONG(g_theWorld->m_isYwrap); PUSHLONG(g_theWorld->m_isXwrap); }
void NetSetLeaderName::Packetize(uint8 *buf, uint16 &size) { size = 0; PUSHID(k_PACKET_SET_LEADER_NAME_ID); PUSHBYTE(m_player); PUSHSTRING(g_player[m_player]->m_civilisation->GetLeaderName()); }
void NetSetPlayerGuid::Packetize(uint8 *buf, uint16 &size) { size = 0; PUSHID(k_PACKET_SET_PLAYER_GUID_ID); PUSHBYTE(m_player); memcpy(&buf[size], (uint8*)&g_player[m_player]->m_networkGuid, sizeof(GUID)); size += sizeof(GUID); }
static void push_st( void ) { UINT16 t; t = pSR; PUSHBYTE(t); tms7000_icount -= 6; }
/**************************************************************************** * 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); } }
//---------------------------------------------------------------------------- // // Name : NetVision::Packetize // // Description: Generate an application data packet to transmit. // // Parameters : buf : buffer to store the message // // Globals : - // // Returns : size : number of bytes stored in buf // // Remark(s) : - // //---------------------------------------------------------------------------- void NetVision::Packetize(uint8 *buf, uint16 &size) { size = 0; PUSHID(k_PACKET_VISION_ID); PUSHBYTE(m_owner); PUSHSHORT(m_row); PUSHBYTE(m_numRows); uint8 *ptr = NULL; uint8 bitPos = 0; Vision *vision = g_player[m_owner]->m_vision; sint32 w = vision->m_width; sint32 bottom = m_row + m_numRows; if(bottom > vision->m_height) bottom = vision->m_height; for (sint32 y = m_row; y < bottom; ++y) { bitPos = 0; ptr = &buf[size] + ((y - m_row) * ((w+7) / 8)); *ptr = 0; for (sint32 x = 0; x < vision->m_width; ++x) { uint16 vis = vision->m_array[x][y]; if(vis & 0x8000) { *ptr |= 1 << bitPos; } bitPos++; if(bitPos >= 8) { bitPos = 0; ptr++; *ptr = 0; } } } if(bitPos != 0) { ptr++; } size = ptr - buf + 1; }
/* IRQ enter */ void m6800_cpu_device::enter_interrupt(const char *message,UINT16 irq_vector) { LOG((message, tag())); if( m_wai_state & (M6800_WAI|M6800_SLP) ) { if( m_wai_state & M6800_WAI ) m_icount -= 4; m_wai_state &= ~(M6800_WAI|M6800_SLP); } else { PUSHWORD(pPC); PUSHWORD(pX); PUSHBYTE(A); PUSHBYTE(B); PUSHBYTE(CC); m_icount -= 12; } SEI; PCD = RM16( irq_vector ); }
void NetCivilization::Packetize(uint8 *buf, uint16 &size) { size = 0; PUSHID(k_PACKET_CIVILIZATION_ID); PUSHLONG(m_data->m_id); PUSHBYTE((uint8)m_data->m_owner); PUSHBYTE((uint8)m_data->m_gender); PUSHSHORT((uint16)m_data->m_civ); PUSHSTRING(m_data->m_leader_name); PUSHSTRING(m_data->m_civilisation_name); PUSHSTRING(m_data->m_country_name); PUSHSTRING(m_data->m_singular_name); PUSHSTRING(m_data->m_personality_description); uint16 numCityNames = (uint16)g_theCivilisationDB->Get(m_data->m_civ)->GetNumCityName(); PUSHSHORT(numCityNames); sint32 i; for(i = 0; i < numCityNames; i++) { PUSHBYTE(m_data->m_cityname_count[i]); } }
static void push_b( void ) { UINT16 t; t = RDB; PUSHBYTE(t); CLR_NZC; SET_N8(t); SET_Z8(t); tms7000_icount -= 6; }
void NetExclusions::Packetize(uint8 *buf, uint16 &size) { PUSHID(k_PACKET_EXCLUSIONS_ID); PUSHLONG(g_exclusions->m_numUnits); PUSHLONG(g_exclusions->m_numBuildings); PUSHLONG(g_exclusions->m_numWonders); sint32 i; sint32 bitPos; uint8 next; for(i = 0; i < g_exclusions->m_numUnits; i += 8) { next = 0; for(bitPos = 0; (bitPos < 8) && ((i + bitPos) < g_exclusions->m_numUnits); bitPos++) { if(g_exclusions->IsUnitExcluded(i + bitPos)) next |= 1 << bitPos; } PUSHBYTE(next); } for(i = 0; i < g_exclusions->m_numBuildings; i += 8) { next = 0; for(bitPos = 0; (bitPos < 8) && ((i + bitPos) < g_exclusions->m_numBuildings); bitPos++) { if(g_exclusions->IsBuildingExcluded(i + bitPos)) next |= 1 << bitPos; } PUSHBYTE(next); } for(i = 0; i < g_exclusions->m_numWonders; i += 8) { next = 0; for(bitPos = 0; (bitPos < 8) && ((i + bitPos) < g_exclusions->m_numWonders); bitPos++) { if(g_exclusions->IsWonderExcluded(i + bitPos)) next |= 1 << bitPos; } PUSHBYTE(next); } }
static void push_r( void ) { UINT16 t; INT8 r; IMMBYTE(r); t = RM(r); PUSHBYTE(t); CLR_NZC; SET_N8(t); SET_Z8(t); tms7000_icount -= 8; }
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 (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(); } }
void NetCityBuildQueue::Packetize(uint8 *buf, uint16 &size) { size = 0; PUSHID(k_PACKET_CITY_BQ_ID); PUSHLONG((uint32)m_cityData->m_home_city); PUSHLONG(m_cityData->m_build_queue.m_list->GetCount()); PointerList<BuildNode>::Walker walk(m_cityData->m_build_queue.m_list); while(walk.IsValid()) { BuildNode *bn = walk.GetObj(); PUSHLONG(bn->m_cost); PUSHLONG(bn->m_type); PUSHLONG(bn->m_category); PUSHBYTE(bn->m_flags); walk.Next(); } }
/* Generate interrupts */ void m6805_base_device::interrupt() { /* the 6805 latches interrupt requests internally, so we don't clear */ /* pending_interrupts until the interrupt is taken, no matter what the */ /* external IRQ pin does. */ if ((m_pending_interrupts & (1 << HD63705_INT_NMI)) != 0) { PUSHWORD(m_pc); PUSHBYTE(m_x); PUSHBYTE(m_a); PUSHBYTE(m_cc); SEI; /* no vectors supported, just do the callback to clear irq_state if needed */ standard_irq_callback(0); RM16(0x1ffc, &m_pc); m_pending_interrupts &= ~(1 << HD63705_INT_NMI); m_icount -= 11; } else if((m_pending_interrupts & ((1 << M6805_IRQ_LINE) | HD63705_INT_MASK)) != 0) { if ((CC & IFLAG) == 0) { /* standard IRQ */ PUSHWORD(m_pc); PUSHBYTE(m_x); PUSHBYTE(m_a); PUSHBYTE(m_cc); SEI; /* no vectors supported, just do the callback to clear irq_state if needed */ standard_irq_callback(0); interrupt_vector(); m_pending_interrupts &= ~(1 << M6805_IRQ_LINE); } m_icount -= 11; } }
void NetTradeRoute::Packetize(uint8 *buf, uint16 & size) { sint32 i; buf[0] = k_PACKET_TRADE_ROUTE_ID >> 8; buf[1] = k_PACKET_TRADE_ROUTE_ID & 0xff; size = 2; PUSHLONG(m_routeData->m_id); PUSHBYTE(m_newRoute); PUSHBYTE((uint8)m_routeData->m_owner); PUSHBYTE((uint8)m_routeData->m_payingFor); PUSHLONG((uint32)(m_routeData->m_transportCost * 10000.0)); PUSHBYTE((uint8)m_routeData->m_sourceRouteType); PUSHLONG(m_routeData->m_sourceResource); uint32 passesThrough = 0; for(i = 0; i < k_MAX_PLAYERS; i++) { passesThrough |= (m_routeData->m_passesThrough[i] << i); } PUSHLONG(passesThrough); PUSHBYTE(m_routeData->m_crossesWater); PUSHBYTE(m_routeData->m_isActive); PUSHLONG(m_routeData->m_color); PUSHLONG(m_routeData->m_outline); PUSHLONG(m_routeData->m_gold_in_return); PUSHLONG((uint32)(m_routeData->m_sourceCity)); PUSHLONG((uint32)(m_routeData->m_destinationCity)); PUSHLONG((uint32)(m_routeData->m_recip)); PUSHSHORT((uint16)(m_routeData->m_path.Num())); for(i = 0; i < m_routeData->m_path.Num(); i++) { PUSHSHORT((uint16)m_routeData->m_path[i].x); PUSHSHORT((uint16)m_routeData->m_path[i].y); } }
/* Generate interrupts */ static void Interrupt( m6805_Regs *cpustate ) { /* the 6805 latches interrupt requests internally, so we don't clear */ /* pending_interrupts until the interrupt is taken, no matter what the */ /* external IRQ pin does. */ if( (cpustate->pending_interrupts & (1<<HD63705_INT_NMI)) != 0) { PUSHWORD(cpustate->pc); PUSHBYTE(cpustate->x); PUSHBYTE(cpustate->a); PUSHBYTE(cpustate->cc); SEI; /* no vectors supported, just do the callback to clear irq_state if needed */ if (cpustate->irq_callback) (*cpustate->irq_callback)(cpustate->device, 0); RM16( cpustate, 0x1ffc, &pPC); cpustate->pending_interrupts &= ~(1<<HD63705_INT_NMI); cpustate->iCount -= 11; } else if( (cpustate->pending_interrupts & ((1<<M6805_IRQ_LINE)|HD63705_INT_MASK)) != 0 ) { if ( (CC & IFLAG) == 0 ) { { /* standard IRQ */ //#if (HAS_HD63705) // if(SUBTYPE!=SUBTYPE_HD63705) //#endif // PC |= ~AMASK; PUSHWORD(cpustate->pc); PUSHBYTE(cpustate->x); PUSHBYTE(cpustate->a); PUSHBYTE(cpustate->cc); SEI; /* no vectors supported, just do the callback to clear irq_state if needed */ if (cpustate->irq_callback) (*cpustate->irq_callback)(cpustate->device, 0); if(SUBTYPE==SUBTYPE_HD63705) { /* 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((cpustate->pending_interrupts&(1<<HD63705_INT_IRQ1))!=0) { cpustate->pending_interrupts &= ~(1<<HD63705_INT_IRQ1); RM16( cpustate, 0x1ff8, &pPC); } else if((cpustate->pending_interrupts&(1<<HD63705_INT_IRQ2))!=0) { cpustate->pending_interrupts &= ~(1<<HD63705_INT_IRQ2); RM16( cpustate, 0x1fec, &pPC); } else if((cpustate->pending_interrupts&(1<<HD63705_INT_ADCONV))!=0) { cpustate->pending_interrupts &= ~(1<<HD63705_INT_ADCONV); RM16( cpustate, 0x1fea, &pPC); } else if((cpustate->pending_interrupts&(1<<HD63705_INT_TIMER1))!=0) { cpustate->pending_interrupts &= ~(1<<HD63705_INT_TIMER1); RM16( cpustate, 0x1ff6, &pPC); } else if((cpustate->pending_interrupts&(1<<HD63705_INT_TIMER2))!=0) { cpustate->pending_interrupts &= ~(1<<HD63705_INT_TIMER2); RM16( cpustate, 0x1ff4, &pPC); } else if((cpustate->pending_interrupts&(1<<HD63705_INT_TIMER3))!=0) { cpustate->pending_interrupts &= ~(1<<HD63705_INT_TIMER3); RM16( cpustate, 0x1ff2, &pPC); } else if((cpustate->pending_interrupts&(1<<HD63705_INT_PCI))!=0) { cpustate->pending_interrupts &= ~(1<<HD63705_INT_PCI); RM16( cpustate, 0x1ff0, &pPC); } else if((cpustate->pending_interrupts&(1<<HD63705_INT_SCI))!=0) { cpustate->pending_interrupts &= ~(1<<HD63705_INT_SCI); RM16( cpustate, 0x1fee, &pPC); } } else if (SUBTYPE == SUBTYPE_M68HC05EG) { if((cpustate->pending_interrupts&(1<<M68HC05EG_INT_IRQ))!=0) { cpustate->pending_interrupts &= ~(1<<M68HC05EG_INT_IRQ); RM16( cpustate, 0x1ffa, &pPC); } else if((cpustate->pending_interrupts&(1<<M68HC05EG_INT_TIMER))!=0) { cpustate->pending_interrupts &= ~(1<<M68HC05EG_INT_TIMER); RM16( cpustate, 0x1ff8, &pPC); } else if((cpustate->pending_interrupts&(1<<M68HC05EG_INT_CPI))!=0) { cpustate->pending_interrupts &= ~(1<<M68HC05EG_INT_CPI); RM16( cpustate, 0x1ff6, &pPC); } } else { RM16( cpustate, 0xffff - 5, &pPC ); } } // CC & IFLAG cpustate->pending_interrupts &= ~(1<<M6805_IRQ_LINE); } cpustate->iCount -= 11; } }
void CHECK_IRQ_LINES( void ) { if( hd6309.irq_state[HD6309_IRQ_LINE] != CLEAR_LINE || hd6309.irq_state[HD6309_FIRQ_LINE] != CLEAR_LINE ) hd6309.int_state &= ~HD6309_SYNC; /* clear SYNC flag */ if( hd6309.irq_state[HD6309_FIRQ_LINE]!=CLEAR_LINE && !(CC & CC_IF)) { /* fast IRQ */ /* 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 */ } else { if ( MD & MD_FM ) { 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 */ } else { CC &= ~CC_E; /* save 'short' state */ PUSHWORD(pPC); PUSHBYTE(CC); hd6309.extra_cycles += 10; /* subtract +10 cycles */ } } CC |= CC_IF | CC_II; /* inhibit FIRQ and IRQ */ PCD=RM16(0xfff6); CHANGE_PC; (void)(*hd6309.irq_callback)(HD6309_FIRQ_LINE); } else if( hd6309.irq_state[HD6309_IRQ_LINE]!=CLEAR_LINE && !(CC & CC_II) ) { /* standard IRQ */ /* HJB 990225: state already saved by CWAI? */ if( hd6309.int_state & HD6309_CWAI ) { hd6309.int_state &= ~HD6309_CWAI; /* clear CWAI flag */ hd6309.extra_cycles += 7; /* subtract +7 cycles */ } 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 */ } CC |= CC_II; /* inhibit IRQ */ PCD=RM16(0xfff8); CHANGE_PC; (void)(*hd6309.irq_callback)(HD6309_IRQ_LINE); } }
static void check_irq_lines(konami_state *cpustate) { if (cpustate->nmi_pending && (cpustate->int_state & KONAMI_LDS)) { cpustate->nmi_pending = FALSE; /* state already saved by CWAI? */ if (cpustate->int_state & KONAMI_CWAI) { cpustate->int_state &= ~KONAMI_CWAI; cpustate->icount -= 7; } else { CC |= CC_E; /* save entire state */ PUSHWORD(cpustate, pPC); PUSHWORD(cpustate, pU); PUSHWORD(cpustate, pY); PUSHWORD(cpustate, pX); PUSHBYTE(cpustate, DP); PUSHBYTE(cpustate, B); PUSHBYTE(cpustate, A); PUSHBYTE(cpustate, CC); cpustate->icount -= 19; } CC |= CC_IF | CC_II; /* inhibit FIRQ and IRQ */ PCD = RM16(cpustate, 0xfffc); (void)(*cpustate->irq_callback)(cpustate->device, INPUT_LINE_NMI); } else if (cpustate->irq_state[KONAMI_FIRQ_LINE] !=CLEAR_LINE && !(CC & CC_IF)) { /* fast IRQ */ /* state already saved by CWAI? */ if (cpustate->int_state & KONAMI_CWAI) { cpustate->int_state &= ~KONAMI_CWAI; /* clear CWAI */ cpustate->icount -= 7; } else { CC &= ~CC_E; /* save 'short' state */ PUSHWORD(cpustate, pPC); PUSHBYTE(cpustate, CC); cpustate->icount -= 10; } CC |= CC_IF | CC_II; /* inhibit FIRQ and IRQ */ PCD = RM16(cpustate, 0xfff6); (void)(*cpustate->irq_callback)(cpustate->device, KONAMI_FIRQ_LINE); } else if (cpustate->irq_state[KONAMI_IRQ_LINE] != CLEAR_LINE && !(CC & CC_II)) { /* standard IRQ */ /* state already saved by CWAI? */ if (cpustate->int_state & KONAMI_CWAI) { cpustate->int_state &= ~KONAMI_CWAI; /* clear CWAI flag */ cpustate->icount -= 7; } else { CC |= CC_E; /* save entire state */ PUSHWORD(cpustate, pPC); PUSHWORD(cpustate, pU); PUSHWORD(cpustate, pY); PUSHWORD(cpustate, pX); PUSHBYTE(cpustate, DP); PUSHBYTE(cpustate, B); PUSHBYTE(cpustate, A); PUSHBYTE(cpustate, CC); cpustate->icount -= 19; } CC |= CC_II; /* inhibit IRQ */ PCD = RM16(cpustate, 0xfff8); (void)(*cpustate->irq_callback)(cpustate->device, KONAMI_IRQ_LINE); } }
/* $37 PSHB inherent ----- */ INLINE void pshb (void) { PUSHBYTE(m6808.d.b.l); }
/* $36 PSHA inherent ----- */ INLINE void psha (void) { PUSHBYTE(m6808.d.b.h); }