static INTERRUPT_GEN( higemaru_interrupt ) { if (cpu_getiloops(device) == 0) device_set_input_line_and_vector(device, 0, HOLD_LINE, 0xcf); /* RST 08h */ else device_set_input_line_and_vector(device, 0, HOLD_LINE, 0xd7); /* RST 10h */ }
static INTERRUPT_GEN( exedexes_interrupt ) { if (cpu_getiloops(device) != 0) device_set_input_line_and_vector(device, 0, HOLD_LINE, 0xcf); /* RST 08h */ else device_set_input_line_and_vector(device, 0, HOLD_LINE, 0xd7); /* RST 10h - vblank */ }
GFXDECODE_END /* Interrupt Generators */ static INTERRUPT_GEN( deadang_interrupt ) { if (cpu_getiloops(device)) device_set_input_line_and_vector(device, 0, HOLD_LINE, 0xc8/4); /* VBL */ else device_set_input_line_and_vector(device, 0, HOLD_LINE, 0xc4/4); /* VBL */ }
ADDRESS_MAP_END /********************************************* IRQ Handling *********************************************/ void nakajies_state::nakajies_update_irqs( running_machine &machine ) { // Hack: IRQ mask is temporarily disabled because doesn't allow the IRQ vector 0xFA // and 0xFB that are used for scan the kb, this need further investigation. UINT8 irq = m_irq_active; // & m_irq_enabled; UINT8 vector = 0xff; logerror("nakajies_update_irqs: irq_enabled = %02x, irq_active = %02x\n", m_irq_enabled, m_irq_active ); /* Assuming irq 0xFF has the highest priority and 0xF8 the lowest */ while( vector >= 0xf8 && ! ( irq & 0x01 ) ) { irq >>= 1; vector -= 1; } if ( vector >= 0xf8 ) { device_set_input_line_and_vector( m_maincpu, 0, ASSERT_LINE, vector ); } else { device_set_input_line( m_maincpu, 0, CLEAR_LINE ); } }
static WRITE8_HANDLER( aliens_sh_irqtrigger_w ) { aliens_state *state = space->machine().driver_data<aliens_state>(); soundlatch_w(space, offset, data); device_set_input_line_and_vector(state->m_audiocpu, 0, HOLD_LINE, 0xff); }
/*************************************************************************** Pinball Action memory map (preliminary) driver by Nicola Salmoria 0000-9fff ROM d000-d3ff Video RAM d400-d7ff Color RAM d800-dbff Background Video RAM dc00-dfff Background Color RAM e000-e07f Sprites e400-e5ff Palette RAM read: e600 IN0 e601 IN1 e602 IN2 e604 DSW1 e605 DSW2 e606 watchdog reset???? write: e600 interrupt enable e604 flip screen e606 bg scroll? not sure e800 command for the sound CPU Notes: - pbactio2 has a ROM for a third Z80, not emulated, function unknown Stephh's notes (based on the game Z80 code and some tests) : - There is an ingame bug that prevents you to get a bonus life at 1000000 points when you set the "Bonus Life" Dip Switch to "200k 1000k" : * Bonus life table index starts at 0x63c6 (8 * 2 butes, LSB first) : 63C6: D6 63 "70k 200k" -> 04 07 03 02 01 10 63C8: DC 63 "70k 200k 1000k" -> 04 07 03 02 02 01 01 10 63CA: E4 63 "100k" -> 03 01 01 10 63CC: E8 63 "100k 300k" -> 03 01 03 03 01 10 63CE: EE 63 "100k 300k 1000k" -> 03 01 03 03 02 01 01 10 63D0: F6 63 "200k" -> 03 02 01 10 63D2: FA 63 "200k 1000k" -> 03 02 01 10 !!! 63D4: FE 63 "None" -> 01 10 * Each "pair" determines the digit number, then what shall be its value : digit : 12 345 67 number : 99.999.990 Note that digit 1 is displayed outside the score box. * As each digit value can only be 00 to 09, 10 as a bonus life value means that you can't get anymore bonus life. * Now look at 7th table : first, you notice that it's the same as the 6th table; then you find that the first bonus life at 200k and you see the end of table "marker" (01 10) instead of having 02 01. * As addresses and data are the same (after decryption in 'pbactio3'), this bug affects the 3 sets. ***************************************************************************/ #include "emu.h" #include "cpu/z80/z80.h" #include "sound/ay8910.h" #include "machine/segacrpt.h" #include "includes/pbaction.h" WRITE8_MEMBER(pbaction_state::pbaction_sh_command_w) { soundlatch_byte_w(space, offset, data); device_set_input_line_and_vector(m_audiocpu, 0, HOLD_LINE, 0x00); } WRITE8_MEMBER(pbaction_state::nmi_mask_w) { m_nmi_mask = data & 1; } static ADDRESS_MAP_START( pbaction_map, AS_PROGRAM, 8, pbaction_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x8000, 0xbfff) AM_ROM AM_RANGE(0xc000, 0xcfff) AM_RAM AM_SHARE("work_ram") AM_RANGE(0xd000, 0xd3ff) AM_RAM_WRITE(pbaction_videoram2_w) AM_SHARE("videoram2") AM_RANGE(0xd400, 0xd7ff) AM_RAM_WRITE(pbaction_colorram2_w) AM_SHARE("colorram2") AM_RANGE(0xd800, 0xdbff) AM_RAM_WRITE(pbaction_videoram_w) AM_SHARE("videoram") AM_RANGE(0xdc00, 0xdfff) AM_RAM_WRITE(pbaction_colorram_w) AM_SHARE("colorram") AM_RANGE(0xe000, 0xe07f) AM_RAM AM_SHARE("spriteram") AM_RANGE(0xe400, 0xe5ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_byte_le_w) AM_SHARE("paletteram") AM_RANGE(0xe600, 0xe600) AM_READ_PORT("P1") AM_WRITE(nmi_mask_w) AM_RANGE(0xe601, 0xe601) AM_READ_PORT("P2") AM_RANGE(0xe602, 0xe602) AM_READ_PORT("SYSTEM") AM_RANGE(0xe604, 0xe604) AM_READ_PORT("DSW1") AM_WRITE(pbaction_flipscreen_w) AM_RANGE(0xe605, 0xe605) AM_READ_PORT("DSW2") AM_RANGE(0xe606, 0xe606) AM_READNOP /* ??? */ AM_WRITE(pbaction_scroll_w) AM_RANGE(0xe800, 0xe800) AM_WRITE(pbaction_sh_command_w) ADDRESS_MAP_END static ADDRESS_MAP_START( pbaction_sound_map, AS_PROGRAM, 8, pbaction_state ) AM_RANGE(0x0000, 0x1fff) AM_ROM AM_RANGE(0x4000, 0x47ff) AM_RAM AM_RANGE(0x8000, 0x8000) AM_READ(soundlatch_byte_r) AM_RANGE(0xffff, 0xffff) AM_WRITENOP /* watchdog? */ ADDRESS_MAP_END static ADDRESS_MAP_START( pbaction_sound_io_map, AS_IO, 8, pbaction_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) AM_RANGE(0x10, 0x11) AM_DEVWRITE_LEGACY("ay1", ay8910_address_data_w) AM_RANGE(0x20, 0x21) AM_DEVWRITE_LEGACY("ay2", ay8910_address_data_w) AM_RANGE(0x30, 0x31) AM_DEVWRITE_LEGACY("ay3", ay8910_address_data_w) ADDRESS_MAP_END static INPUT_PORTS_START( pbaction ) PORT_START("P1") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_START("P2") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_COCKTAIL PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_COCKTAIL PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_COCKTAIL PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_COCKTAIL PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_START("SYSTEM") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 ) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START2 ) PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_START("DSW1") PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW1:!1,!2") PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) ) PORT_DIPSETTING( 0x01, DEF_STR( 1C_2C ) ) PORT_DIPSETTING( 0x02, DEF_STR( 1C_3C ) ) PORT_DIPSETTING( 0x03, DEF_STR( 1C_6C ) ) PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:!3,!4") PORT_DIPSETTING( 0x04, DEF_STR( 2C_1C ) ) PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) ) PORT_DIPSETTING( 0x08, DEF_STR( 1C_2C ) ) PORT_DIPSETTING( 0x0c, DEF_STR( 1C_3C ) ) PORT_DIPNAME( 0x30, 0x00, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:!5,!6") PORT_DIPSETTING( 0x30, "2" ) PORT_DIPSETTING( 0x00, "3" ) PORT_DIPSETTING( 0x10, "4" ) PORT_DIPSETTING( 0x20, "5" ) PORT_DIPNAME( 0x40, 0x40, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW1:!7") PORT_DIPSETTING( 0x40, DEF_STR( Upright ) ) PORT_DIPSETTING( 0x00, DEF_STR( Cocktail ) ) PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:!8") PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_START("DSW2") PORT_DIPNAME( 0x07, 0x00, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW2:!1,!2,!3") PORT_DIPSETTING( 0x01, "70k 200k 1000k" ) PORT_DIPSETTING( 0x04, "100k 300k 1000k" ) PORT_DIPSETTING( 0x00, "70k 200k" ) PORT_DIPSETTING( 0x03, "100k 300k" ) PORT_DIPSETTING( 0x06, "200k 1000k" ) /* see notes */ PORT_DIPSETTING( 0x02, "100k" ) PORT_DIPSETTING( 0x05, "200k" ) PORT_DIPSETTING( 0x07, DEF_STR( None ) ) PORT_DIPNAME( 0x08, 0x00, "Extra" ) PORT_DIPLOCATION("SW2:!4") PORT_DIPSETTING( 0x00, DEF_STR( Easy ) ) PORT_DIPSETTING( 0x08, DEF_STR( Hard ) ) PORT_DIPNAME( 0x30, 0x00, "Difficulty (Flippers)" ) PORT_DIPLOCATION("SW2:!5,!6") PORT_DIPSETTING( 0x00, DEF_STR( Easy ) ) PORT_DIPSETTING( 0x10, DEF_STR( Medium ) ) PORT_DIPSETTING( 0x20, DEF_STR( Hard ) ) PORT_DIPSETTING( 0x30, DEF_STR( Hardest ) ) PORT_DIPNAME( 0xc0, 0x00, "Difficulty (Outlanes)" ) PORT_DIPLOCATION("SW2:!7,!8") PORT_DIPSETTING( 0x00, DEF_STR( Easy ) ) PORT_DIPSETTING( 0x40, DEF_STR( Medium ) ) PORT_DIPSETTING( 0x80, DEF_STR( Hard ) ) PORT_DIPSETTING( 0xc0, DEF_STR( Hardest ) ) INPUT_PORTS_END static const gfx_layout charlayout1 = { 8,8, RGN_FRAC(1,3), 3, { RGN_FRAC(0,3), RGN_FRAC(1,3), RGN_FRAC(2,3) }, { STEP8(0,1) }, { STEP8(0,8) }, 8*8 }; static const gfx_layout charlayout2 = { 8,8, RGN_FRAC(1,4), 4, { RGN_FRAC(0,4), RGN_FRAC(1,4), RGN_FRAC(2,4), RGN_FRAC(3,4) }, { STEP8(0,1) }, { STEP8(0,8) }, 8*8 }; static const gfx_layout spritelayout1 = { 16,16, RGN_FRAC(1,3), 3, { RGN_FRAC(0,3), RGN_FRAC(1,3), RGN_FRAC(2,3) }, { STEP8(0,1), STEP8(64,1) }, { STEP8(0,8), STEP8(128,8) }, 32*8 }; static const gfx_layout spritelayout2 = { 32,32, RGN_FRAC(1,6), 3, { RGN_FRAC(0,3), RGN_FRAC(1,3), RGN_FRAC(2,3) }, { STEP8(0,1), STEP8(64,1), STEP8(256,1), STEP8(320,1) }, { STEP8(0,8), STEP8(128,8), STEP8(512,8), STEP8(640,8) }, 128*8 }; static GFXDECODE_START( pbaction ) GFXDECODE_ENTRY( "fgchars", 0x00000, charlayout1, 0, 16 ) /* 0-127 characters */ GFXDECODE_ENTRY( "bgchars", 0x00000, charlayout2, 128, 8 ) /* 128-255 background */ GFXDECODE_ENTRY( "sprites", 0x00000, spritelayout1, 0, 16 ) /* 0-127 normal sprites */ GFXDECODE_ENTRY( "sprites", 0x01000, spritelayout2, 0, 16 ) /* 0-127 large sprites */ GFXDECODE_END static INTERRUPT_GEN( pbaction_interrupt ) { device_set_input_line_and_vector(device, 0, HOLD_LINE, 0x02); /* the CPU is in Interrupt Mode 2 */ }
INPUT_PORTS_END static INTERRUPT_GEN( vblank_irq ) { // device_set_input_line_and_vector(device,0,HOLD_LINE,0x08/4); // reads i/o 0x200 and puts the result in ram, pic irq? device_set_input_line_and_vector(device,0,HOLD_LINE,0x4c/4); // ? }
INPUT_PORTS_END static INTERRUPT_GEN( m79amb_interrupt ) { device_set_input_line_and_vector(device, 0, HOLD_LINE, 0xcf); /* RST 08h */ }
GFXDECODE_END /* Interrupt Generator */ static INTERRUPT_GEN( dynduke_interrupt ) { device_set_input_line_and_vector(device, 0, HOLD_LINE, 0xc8/4); // VBL }
static TIMER_DEVICE_CALLBACK( rst2_tick ) { n8080_state *n8080 = timer.machine().driver_data<n8080_state>(); int state = n8080->m_inte ? ASSERT_LINE : CLEAR_LINE; /* vblank */ device_set_input_line_and_vector(n8080->m_maincpu, INPUT_LINE_IRQ0, state, 0xd7); }
static TIMER_CALLBACK( intback_peripheral ) { saturn_state *state = machine.driver_data<saturn_state>(); int pad_num; static const UINT8 peri_id[10] = { 0x02, 0x13, 0x15, 0x23, 0x23, 0x34, 0xe1, 0xe2, 0xe3, 0xff }; UINT8 read_id[2]; UINT8 offset; // if (LOG_SMPC) logerror("SMPC: providing PAD data for intback, pad %d\n", intback_stage-2); read_id[0] = (machine.root_device().ioport("INPUT_TYPE")->read()) & 0x0f; read_id[1] = (machine.root_device().ioport("INPUT_TYPE")->read()) >> 4; /* doesn't work? */ //pad_num = state->m_smpc.intback_stage - 1; if(LOG_PAD_CMD) printf("%d %d %d\n",state->m_smpc.intback_stage - 1,machine.primary_screen->vpos(),(int)machine.primary_screen->frame_number()); offset = 0; for(pad_num=0;pad_num<2;pad_num++) { switch(read_id[pad_num]) { case 0: smpc_digital_pad(machine,pad_num,offset); break; case 1: smpc_analog_pad(machine,pad_num,offset,peri_id[read_id[pad_num]]); break; /* Steering Wheel */ case 2: smpc_analog_pad(machine,pad_num,offset,peri_id[read_id[pad_num]]); break; /* Analog Pad */ case 4: smpc_mouse(machine,pad_num,offset,peri_id[read_id[pad_num]]); break; /* Pointing Device */ case 5: smpc_keyboard(machine,pad_num,offset); break; case 6: smpc_md_pad(machine,pad_num,offset,peri_id[read_id[pad_num]]); break; /* MD 3B PAD */ case 7: smpc_md_pad(machine,pad_num,offset,peri_id[read_id[pad_num]]); break; /* MD 6B PAD */ case 8: smpc_mouse(machine,pad_num,offset,peri_id[read_id[pad_num]]); break; /* Saturn Mouse */ case 9: smpc_unconnected(machine,pad_num,offset); break; } offset += (peri_id[read_id[pad_num]] & 0xf) + 2; /* offset for port 2 */ } if (state->m_smpc.intback_stage == 2) { state->m_smpc.SR = (0x80 | state->m_smpc.pmode); // pad 2, no more data, echo back pad mode set by intback state->m_smpc.intback_stage = 0; } else { state->m_smpc.SR = (0xc0 | state->m_smpc.pmode); // pad 1, more data, echo back pad mode set by intback state->m_smpc.intback_stage ++; } if(!(state->m_scu.ism & IRQ_SMPC)) device_set_input_line_and_vector(state->m_maincpu, 8, HOLD_LINE, 0x47); else state->m_scu.ist |= (IRQ_SMPC); state->m_smpc.OREG[31] = 0x10; /* callback for last command issued */ state->m_smpc.SF = 0x00; /* clear hand-shake flag */ }
void generic_pulse_irq_line_and_vector(device_t *device, int irqline, int vector) { assert(irqline != INPUT_LINE_NMI && irqline != INPUT_LINE_RESET); device_set_input_line_and_vector(device, irqline, ASSERT_LINE, vector); cpu_device *cpudevice = downcast<cpu_device *>(device); attotime target_time = cpudevice->local_time() + cpudevice->cycles_to_attotime(cpudevice->min_cycles()); device->machine().scheduler().timer_set(target_time - device->machine().time(), FUNC(irq_pulse_clear), irqline, (void *)device); }
static TIMER_CALLBACK( cursor_callback ) { lockon_state *state = machine.driver_data<lockon_state>(); if (state->m_main_inten) device_set_input_line_and_vector(state->m_maincpu, 0, HOLD_LINE, 0xff); state->m_cursor_timer->adjust(machine.primary_screen->time_until_pos(CURSOR_YPOS, CURSOR_XPOS)); }
GFXDECODE_END /* handler called by the 3812 emulator when the internal timers cause an IRQ */ static WRITE_LINE_DEVICE_HANDLER( irqhandler ) { exprraid_state *driver_state = device->machine().driver_data<exprraid_state>(); device_set_input_line_and_vector(driver_state->m_slave, 0, state, 0xff); }
GFXDECODE_END /* handler called by the 3812 emulator when the internal timers cause an IRQ */ static void irqhandler( device_t *device, int linestate ) { exprraid_state *state = device->machine().driver_data<exprraid_state>(); device_set_input_line_and_vector(state->m_slave, 0, linestate, 0xff); }
GFXDECODE_END static INTERRUPT_GEN( sound_irq ) { dacholer_state *state = device->machine().driver_data<dacholer_state>(); if (state->m_music_interrupt_enable == 1) { device_set_input_line_and_vector(device, 0, HOLD_LINE, 0x30); } }
static WRITE8_HANDLER( mikie_sh_irqtrigger_w ) { mikie_state *state = space->machine().driver_data<mikie_state>(); if (state->m_last_irq == 0 && data == 1) { // setting bit 0 low then high triggers IRQ on the sound CPU device_set_input_line_and_vector(state->m_audiocpu, 0, HOLD_LINE, 0xff); } state->m_last_irq = data; }
INPUT_PORTS_END /* Interrupts */ static TIMER_DEVICE_CALLBACK( rst1_tick ) { n8080_state *n8080 = timer.machine().driver_data<n8080_state>(); int state = n8080->m_inte ? ASSERT_LINE : CLEAR_LINE; /* V7 = 1, V6 = 0 */ device_set_input_line_and_vector(n8080->m_maincpu, INPUT_LINE_IRQ0, state, 0xcf); }
/************************************* * * Graphics definitions * *************************************/ static const gfx_layout tile_layout = { 16,16, RGN_FRAC(1,1), 4, { 0, 1, 2, 3 }, { 0*4,1*4,2*4,3*4,4*4,5*4,6*4,7*4, 8*32+0*4,8*32+1*4,8*32+2*4,8*32+3*4,8*32+4*4,8*32+5*4,8*32+6*4,8*32+7*4 }, { 0*32,1*32,2*32,3*32,4*32,5*32,6*32,7*32, 16*32+0*32,16*32+1*32,16*32+2*32,16*32+3*32,16*32+4*32,16*32+5*32,16*32+6*32,16*32+7*32 }, 4*8*32 }; static GFXDECODE_START( hvyunit ) GFXDECODE_ENTRY( "gfx1", 0, tile_layout, 0x100, 16 ) /* sprite bank */ GFXDECODE_ENTRY( "gfx2", 0, tile_layout, 0x000, 16 ) /* background tiles */ GFXDECODE_END /************************************* * * Machine driver * *************************************/ /* Main Z80 uses IM2 */ static TIMER_DEVICE_CALLBACK( hvyunit_scanline ) { hvyunit_state *state = timer.machine().driver_data<hvyunit_state>(); int scanline = param; if(scanline == 240) // vblank-out irq device_set_input_line_and_vector(state->m_master_cpu, 0, HOLD_LINE, 0xfd); /* Pandora "sprite end dma" irq? TODO: timing is likely off */ if(scanline == 64) device_set_input_line_and_vector(state->m_master_cpu, 0, HOLD_LINE, 0xff); }
static void adpcm_int( device_t *device ) { dacholer_state *state = device->machine().driver_data<dacholer_state>(); if (state->m_snd_interrupt_enable == 1 || (state->m_snd_interrupt_enable == 0 && state->m_msm_toggle == 1)) { msm5205_data_w(device, state->m_msm_data >> 4); state->m_msm_data <<= 4; state->m_msm_toggle ^= 1; if (state->m_msm_toggle == 0) { device_set_input_line_and_vector(state->m_audiocpu, 0, HOLD_LINE, 0x38); } }
static INTERRUPT_GEN( coin_interrupt ) { polyplay_state *state = device->machine().driver_data<polyplay_state>(); if (state->ioport("INPUT")->read() & 0x80) state->m_last = 0; else { if (state->m_last == 0) /* coin inserted */ device_set_input_line_and_vector(device, 0, HOLD_LINE, 0x50); state->m_last = 1; } }
static INTERRUPT_GEN( chl_interrupt ) { changela_state *state = device->machine().driver_data<changela_state>(); int vector = device->machine().primary_screen->vblank() ? 0xdf : 0xcf; /* 4 irqs per frame: 3 times 0xcf, 1 time 0xdf */ // device->machine().primary_screen->update_partial(device->machine().primary_screen->vpos()); device_set_input_line_and_vector(device, 0, HOLD_LINE, vector); /* it seems the V8 == Vblank and it is connected to the INT on the 68705 */ //so we should cause an INT on the MCU cpu here, as well. //but only once per frame ! if (vector == 0xdf) /* only on vblank */ generic_pulse_irq_line(state->m_mcu, 0); }
/************************************* * * Graphics definitions * *************************************/ static const gfx_layout tile_layout = { 16,16, RGN_FRAC(1,1), 4, { 0, 1, 2, 3 }, { 0*4,1*4,2*4,3*4,4*4,5*4,6*4,7*4, 8*32+0*4,8*32+1*4,8*32+2*4,8*32+3*4,8*32+4*4,8*32+5*4,8*32+6*4,8*32+7*4 }, { 0*32,1*32,2*32,3*32,4*32,5*32,6*32,7*32, 16*32+0*32,16*32+1*32,16*32+2*32,16*32+3*32,16*32+4*32,16*32+5*32,16*32+6*32,16*32+7*32 }, 4*8*32 }; static GFXDECODE_START( hvyunit ) GFXDECODE_ENTRY( "gfx1", 0, tile_layout, 0x100, 16 ) /* sprite bank */ GFXDECODE_ENTRY( "gfx2", 0, tile_layout, 0x000, 16 ) /* background tiles */ GFXDECODE_END /************************************* * * Machine driver * *************************************/ static INTERRUPT_GEN( hvyunit_interrupt ) { hvyunit_state *state = device->machine().driver_data<hvyunit_state>(); state->m_int_vector ^= 0x02; device_set_input_line_and_vector(device, 0, HOLD_LINE, state->m_int_vector); }
static TIMER_CALLBACK( stv_smpc_intback ) { saturn_state *state = machine.driver_data<saturn_state>(); int i; state->m_smpc.OREG[0] = (0x80) | ((state->m_NMI_reset & 1) << 6); for(i=0;i<7;i++) state->m_smpc.OREG[1+i] = state->m_smpc.rtc_data[i]; state->m_smpc.OREG[8]=0x00; // CTG0 / CTG1? state->m_smpc.OREG[9]=0x00; // TODO: system region on Saturn state->m_smpc.OREG[10]= 0 << 7 | state->m_vdp2.dotsel << 6 | 1 << 5 | 1 << 4 | 0 << 3 | //MSHNMI 1 << 2 | 0 << 1 | //SYSRES 0 << 0; //SOUNDRES state->m_smpc.OREG[11]= 0 << 6; //CDRES for(i=0;i<4;i++) state->m_smpc.OREG[12+i]=state->m_smpc.SMEM[i]; for(i=0;i<15;i++) state->m_smpc.OREG[16+i]=0xff; // undefined // /*This is for RTC,cartridge code and similar stuff...*/ //if(LOG_SMPC) printf ("Interrupt: System Manager (SMPC) at scanline %04x, Vector 0x47 Level 0x08\n",scanline); if(!(state->m_scu.ism & IRQ_SMPC)) device_set_input_line_and_vector(state->m_maincpu, 8, HOLD_LINE, 0x47); else state->m_scu.ist |= (IRQ_SMPC); /* put issued command in OREG31 */ state->m_smpc.OREG[31] = 0x10; // TODO: doc says 0? /* clear hand-shake flag */ state->m_smpc.SF = 0x00; }
AM_RANGE(0x8000, 0xffff) AM_ROM ADDRESS_MAP_END INPUT_CHANGED_MEMBER(firetrap_state::coin_inserted) { /* coin insertion causes an IRQ */ if(newval) { m_coin_command_pending = (UINT8)(FPTR)(param); /* Make sure coin IRQ's aren't generated when another command is pending, the main cpu definitely doesn't expect them as it locks out the coin routine */ if (m_coin_command_pending && !m_i8751_current_command) { m_i8751_return = m_coin_command_pending; device_set_input_line_and_vector(m_maincpu, 0, HOLD_LINE, 0xff); m_coin_command_pending = 0; } } }
AM_RANGE(0x8000, 0xffff) AM_ROM ADDRESS_MAP_END static INPUT_CHANGED( coin_inserted ) { firetrap_state *state = field.machine().driver_data<firetrap_state>(); /* coin insertion causes an IRQ */ if(newval) { state->m_coin_command_pending = (UINT8)(FPTR)(param); /* Make sure coin IRQ's aren't generated when another command is pending, the main cpu definitely doesn't expect them as it locks out the coin routine */ if (state->m_coin_command_pending && !state->m_i8751_current_command) { state->m_i8751_return = state->m_coin_command_pending; device_set_input_line_and_vector(state->m_maincpu, 0, HOLD_LINE, 0xff); state->m_coin_command_pending = 0; } } }
static INTERRUPT_GEN( firetrap_irq ) { firetrap_state *state = device->machine().driver_data<firetrap_state>(); UINT8 coin = 0; UINT8 port = input_port_read(device->machine(), "COIN") & 0x07; /* TODO: remove me */ /* Check for coin IRQ */ if (cpu_getiloops(device)) { if (port != 0x07 && !state->m_int_latch) { if (!(port & 0x01)) /* COIN1 */ coin = 1; if (!(port & 0x02)) /* COIN2 */ coin = 2; if (!(port & 0x04)) /* SERVICE1 */ coin = 3; state->m_coin_command_pending = coin; state->m_int_latch = 1; } if (port == 0x07) state->m_int_latch = 0; /* Make sure coin IRQ's aren't generated when another command is pending, the main cpu definitely doesn't expect them as it locks out the coin routine */ if (state->m_coin_command_pending && !state->m_i8751_current_command) { state->m_i8751_return = state->m_coin_command_pending; device_set_input_line_and_vector(device, 0, HOLD_LINE, 0xff); state->m_coin_command_pending = 0; } } if (state->m_nmi_enable && !cpu_getiloops(device)) device_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE); }
static WRITE8_HANDLER( sound_command_w ) { kingofb_state *state = space->machine().driver_data<kingofb_state>(); soundlatch_w(space, 0, data); device_set_input_line_and_vector(state->m_audio_cpu, 0, HOLD_LINE, 0xff); }
static WRITE8_HANDLER( sprite_interrupt_w ) { kingofb_state *state = space->machine().driver_data<kingofb_state>(); device_set_input_line_and_vector(state->m_sprite_cpu, 0, HOLD_LINE, 0xff); }
static WRITE8_HANDLER( circusc_sh_irqtrigger_w ) { circusc_state *state = space->machine().driver_data<circusc_state>(); device_set_input_line_and_vector(state->m_audiocpu, 0, HOLD_LINE, 0xff); }