void amiga_state::update_irqs() { amiga_state *state = this; // if the external interrupt line is still active, set the interrupt request bit if (int2_pending()) CUSTOM_REG(REG_INTREQ) |= INTENA_PORTS; if (int6_pending()) CUSTOM_REG(REG_INTREQ) |= INTENA_EXTER; int ints = CUSTOM_REG(REG_INTENA) & CUSTOM_REG(REG_INTREQ); // master interrupt switch if (CUSTOM_REG(REG_INTENA) & INTENA_INTEN) { m_maincpu->set_input_line(1, ints & (INTENA_TBE | INTENA_DSKBLK | INTENA_SOFT) ? ASSERT_LINE : CLEAR_LINE); m_maincpu->set_input_line(2, ints & (INTENA_PORTS) ? ASSERT_LINE : CLEAR_LINE); m_maincpu->set_input_line(3, ints & (INTENA_COPER | INTENA_VERTB | INTENA_BLIT) ? ASSERT_LINE : CLEAR_LINE); m_maincpu->set_input_line(4, ints & (INTENA_AUD0 | INTENA_AUD1 | INTENA_AUD2 | INTENA_AUD3) ? ASSERT_LINE : CLEAR_LINE); m_maincpu->set_input_line(5, ints & (INTENA_RBF | INTENA_DSKSYN) ? ASSERT_LINE : CLEAR_LINE); m_maincpu->set_input_line(6, ints & (INTENA_EXTER) ? ASSERT_LINE : CLEAR_LINE); } else { m_maincpu->set_input_line(1, CLEAR_LINE); m_maincpu->set_input_line(2, CLEAR_LINE); m_maincpu->set_input_line(3, CLEAR_LINE); m_maincpu->set_input_line(4, CLEAR_LINE); m_maincpu->set_input_line(5, CLEAR_LINE); m_maincpu->set_input_line(6, CLEAR_LINE); } }
static void amiga_write_dsklen(UINT16 data) { if ( data & 0x8000 ) { if ( CUSTOM_REG(REG_DSKLEN) & 0x8000 ) amiga_fdc_setup_dma(); } }
static TIMER_CALLBACK(tp6525_delayed_irq) { amiga_state *state = machine.driver_data<amiga_state>(); (void)param; if ( (CUSTOM_REG(REG_INTREQ) & INTENA_PORTS) == 0 ) { state->amiga_custom_w(*state->m_maincpu_program_space, REG_INTREQ, 0x8000 | INTENA_PORTS, 0xffff); } else { tp6525_delayed_timer->adjust(attotime::from_msec(1)); } }
static TIMER_CALLBACK(tp6525_delayed_irq) { amiga_state *state = machine.driver_data<amiga_state>(); (void)param; if ( (CUSTOM_REG(REG_INTREQ) & INTENA_PORTS) == 0 ) { amiga_custom_w(machine.device("maincpu")->memory().space(AS_PROGRAM), REG_INTREQ, 0x8000 | INTENA_PORTS, 0xffff); } else { tp6525_delayed_timer->adjust(attotime::from_msec(1)); } }
static void kbd_update( void *param, UINT32 oldvalue, UINT32 newvalue ) { int index = *( (int*)(param) ), i; UINT32 delta = oldvalue ^ newvalue; #if AMIGA_ACTION_REPLAY_1 /* Special case Page UP, which we will use as Action Replay button */ if ( (index == 3) && ( delta & 0x80000000 ) && ( newvalue & 0x80000000 ) ) { /* copy custom regs */ for( i = 0; i < 256; i++ ) { amiga_ar_ram[0x1800+i] = CUSTOM_REG(i); } amiga_chip_ram_w( 0x60, 0xC5F0 ); amiga_chip_ram_w( 0x62, 0x0008 ); amiga_chip_ram_w( 0x7c, 0xC5F0 ); amiga_chip_ram_w( 0x7e, 0x0006 ); /* trigger NMI irq */ cpunum_set_input_line(0, 7, PULSE_LINE); } else #endif { for( i = 0; i < 32; i++ ) { if ( delta & ( 1 << i ) ) { int down = ( newvalue & ( 1 << i ) ) ? 0 : 1; int scancode = ( ( (index*32)+i ) << 1 ) | down; int amigacode = ~scancode; int j; /* send over to the cia A */ for( j = 0; j < 8; j++ ) { /* lower cnt */ cia_set_input_cnt( 0, 0 ); /* set the serial data */ cia_set_input_sp( 0, ( amigacode >> j ) & 1 ); /* raise cnt */ cia_set_input_cnt( 0, 1 ); } } } }
static void amigacd_tpi6525_irq_trampoline(device_t *device, int level) { amiga_state *state = device->machine().driver_data<amiga_state>(); LOG(( "TPI6525 Interrupt: level = %d\n", level )); if ( level ) { if ( (CUSTOM_REG(REG_INTREQ) & INTENA_PORTS) == 0 ) { state->amiga_custom_w(*state->m_maincpu_program_space, REG_INTREQ, 0x8000 | INTENA_PORTS, 0xffff); } else { /* we *have to* deliver the irq, so if we can't, delay it and try again later */ tp6525_delayed_timer->adjust(attotime::from_msec(1)); } } }
return down | (right << 1) | (up << 8) | (left << 9); } /************************************* * * Ascending blitter variant * *************************************/ static UINT32 blit_ascending(amiga_state *state) { UINT32 shifta = (CUSTOM_REG(REG_BLTCON0) >> 12) & 0xf; UINT32 shiftb = (CUSTOM_REG(REG_BLTCON1) >> 12) & 0xf; UINT32 height = CUSTOM_REG(REG_BLTSIZV); UINT32 width = CUSTOM_REG(REG_BLTSIZH); UINT32 acca = 0, accb = 0; UINT32 blitsum = 0; UINT32 x, y; /* iterate over the height */ for (y = 0; y < height; y++) { /* iterate over the width */ for (x = 0; x < width; x++) { UINT16 abc0, abc1, abc2, abc3; UINT32 tempa, tempd = 0; UINT32 b;