static void astrocade_trigger_lightpen(running_machine &machine, UINT8 vfeedback, UINT8 hfeedback) { /* both bits 1 and 4 enable lightpen interrupts; bit 4 enables them even in horizontal */ /* blanking regions; we treat them both the same here */ if ((interrupt_enable & 0x12) != 0) { /* bit 0 controls the interrupt mode: mode 0 means assert until acknowledged */ if ((interrupt_enable & 0x01) == 0) { cputag_set_input_line_and_vector(machine, "maincpu", 0, HOLD_LINE, interrupt_vector & 0xf0); machine.scheduler().timer_set(machine.primary_screen->time_until_pos(vfeedback), FUNC(interrupt_off)); } /* mode 1 means assert for 1 instruction */ else { cputag_set_input_line_and_vector(machine, "maincpu", 0, ASSERT_LINE, interrupt_vector & 0xf0); machine.scheduler().timer_set(machine.device<cpu_device>("maincpu")->cycles_to_attotime(1), FUNC(interrupt_off)); } /* latch the feedback registers */ vertical_feedback = vfeedback; horizontal_feedback = hfeedback; } }
static TIMER_CALLBACK( setvector_callback ) { switch(param) { case VECTOR_INIT: irqvector = 0xff; break; case YM2151_ASSERT: irqvector &= 0xef; break; case YM2151_CLEAR: irqvector |= 0x10; break; case Z80_ASSERT: irqvector &= 0xdf; break; case Z80_CLEAR: irqvector |= 0x20; break; } if (irqvector == 0) logerror("You didn't call m72_init_sound()\n"); if (irqvector == 0xff) /* no IRQs pending */ cputag_set_input_line_and_vector(machine, "soundcpu",0,CLEAR_LINE, irqvector); else /* IRQ pending */ cputag_set_input_line_and_vector(machine, "soundcpu",0,ASSERT_LINE, irqvector); }
static TIMER_DEVICE_CALLBACK( butasan_scanline ) { int scanline = param; if(scanline == 248) // vblank-out irq cputag_set_input_line_and_vector(timer.machine(), "maincpu", 0, HOLD_LINE,0xd7); /* RST 10h */ if(scanline == 8) // vblank-in irq cputag_set_input_line_and_vector(timer.machine(), "maincpu", 0, HOLD_LINE,0xcf); /* RST 08h */ }
static TIMER_DEVICE_CALLBACK( higemaru_scanline ) { int scanline = param; if(scanline == 240) // vblank-out irq cputag_set_input_line_and_vector(timer.machine(), "maincpu", 0, HOLD_LINE, 0xcf); /* RST 08h - vblank */ if(scanline == 0) // unknown irq event, does various stuff like copying the spriteram cputag_set_input_line_and_vector(timer.machine(), "maincpu", 0, HOLD_LINE, 0xd7); /* RST 10h */ }
static TIMER_DEVICE_CALLBACK( psychic5_scanline ) { int scanline = param; if(scanline == 240) // vblank-out irq cputag_set_input_line_and_vector(timer.machine(), "maincpu", 0, HOLD_LINE, 0xd7); /* RST 10h - vblank */ if(scanline == 0) // sprite buffer irq cputag_set_input_line_and_vector(timer.machine(), "maincpu", 0, HOLD_LINE, 0xcf); /* RST 08h */ }
static TIMER_DEVICE_CALLBACK( exedexes_scanline ) { int scanline = param; if(scanline == 240) // vblank-out irq cputag_set_input_line_and_vector(timer.machine(), "maincpu", 0, HOLD_LINE, 0xd7); /* RST 10h - vblank */ if(scanline == 0) // unknown irq event cputag_set_input_line_and_vector(timer.machine(), "maincpu", 0, HOLD_LINE, 0xcf); /* RST 08h */ }
static TIMER_DEVICE_CALLBACK( c1942_scanline ) { int scanline = param; if(scanline == 240) // vblank-out irq cputag_set_input_line_and_vector(timer.machine(), "maincpu", 0, HOLD_LINE, 0xd7); /* RST 10h - vblank */ if(scanline == 0) // unknown irq event, presumably vblank-in or a periodic one (writes to the soundlatch and drives freeze dip-switch) cputag_set_input_line_and_vector(timer.machine(), "maincpu", 0, HOLD_LINE, 0xcf); /* RST 08h */ }
static TIMER_DEVICE_CALLBACK( panicr_scanline ) { int scanline = param; if(scanline == 240) // vblank-out irq cputag_set_input_line_and_vector(timer.machine(), "maincpu", 0, HOLD_LINE, 0xc4/4); if(scanline == 0) // <unknown> cputag_set_input_line_and_vector(timer.machine(), "maincpu", 0, HOLD_LINE, 0xc8/4); }
static TIMER_DEVICE_CALLBACK( deadang_sub_scanline ) { int scanline = param; if(scanline == 240) // vblank-out irq cputag_set_input_line_and_vector(timer.machine(), "sub", 0, HOLD_LINE,0xc4/4); if(scanline == 0) // vblank-in irq cputag_set_input_line_and_vector(timer.machine(), "sub", 0, HOLD_LINE,0xc8/4); }
GFXDECODE_END static TIMER_DEVICE_CALLBACK( darkmist_scanline ) { int scanline = param; if(scanline == 240) // vblank-out irq cputag_set_input_line_and_vector(timer.machine(), "maincpu", 0, HOLD_LINE,0x10); /* RST 10h */ if(scanline == 0) // vblank-in irq cputag_set_input_line_and_vector(timer.machine(), "maincpu", 0, HOLD_LINE,0x08); /* RST 08h */ }
GFXDECODE_END /* Interrupt Generators */ static TIMER_DEVICE_CALLBACK( deadang_main_scanline ) { int scanline = param; if(scanline == 240) // vblank-out irq cputag_set_input_line_and_vector(timer.machine(), "maincpu", 0, HOLD_LINE,0xc4/4); if(scanline == 0) // vblank-in irq cputag_set_input_line_and_vector(timer.machine(), "maincpu", 0, HOLD_LINE,0xc8/4); }
ROM_END static TIMER_DEVICE_CALLBACK( polyplay_timer_callback ) { cputag_set_input_line_and_vector(timer.machine(), "maincpu", 0, HOLD_LINE, 0x4c); }
static TIMER_CALLBACK( cursor_callback ) { if (lockon_main_inten) cputag_set_input_line_and_vector(machine, "maincpu", 0, HOLD_LINE, 0xff); timer_adjust_oneshot(cursor_timer, video_screen_get_time_until_pos(machine->primary_screen, CURSOR_YPOS, CURSOR_XPOS), 0); }
INPUT_PORTS_END /* handler called by the 2151 emulator when the internal timers cause an IRQ */ static void blockout_irq_handler(const device_config *device, int irq) { cputag_set_input_line_and_vector(device->machine, "audiocpu", 0, irq ? ASSERT_LINE : CLEAR_LINE, 0xff); }
static TIMER_CALLBACK( setvector_callback ) { m72_audio_state *state = (m72_audio_state *)ptr; switch(param) { case VECTOR_INIT: state->irqvector = 0xff; break; case YM2151_ASSERT: state->irqvector &= 0xef; break; case YM2151_CLEAR: state->irqvector |= 0x10; break; case Z80_ASSERT: state->irqvector &= 0xdf; break; case Z80_CLEAR: state->irqvector |= 0x20; break; } if (state->irqvector == 0) logerror("You didn't call m72_init_sound()\n"); cputag_set_input_line_and_vector(machine, "soundcpu", 0, (state->irqvector == 0xff) ? CLEAR_LINE : ASSERT_LINE, state->irqvector); }
/******************************************************************************/ static INPUT_PORTS_START( djboy ) PORT_START("IN0") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* labeled "TEST" in self test */ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_TILT ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_START("IN1") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) /* punch */ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) /* kick */ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) /* jump */ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_START("IN2") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_START("DSW1") PORT_DIPNAME( 0x01, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:1") /* Manual states "CAUTION !! .... Don't use ." */ PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x01, DEF_STR( On ) ) PORT_DIPNAME( 0x02, 0x00, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:2") PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x02, DEF_STR( On ) ) PORT_SERVICE_DIPLOC( 0x04, IP_ACTIVE_HIGH, "SW1:3" ) // PORT_DIPNAME( 0x04, 0x00, DEF_STR( Service_Mode ) ) PORT_DIPLOCATION("SW1:3") // PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) // PORT_DIPSETTING( 0x04, DEF_STR( On ) ) PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:4") PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x08, DEF_STR( On ) ) PORT_DIPNAME( 0x30, 0x00, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:5,6") PORT_DIPSETTING( 0x20, DEF_STR( 2C_1C ) ) PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) ) PORT_DIPSETTING( 0x30, DEF_STR( 2C_3C ) ) PORT_DIPSETTING( 0x10, DEF_STR( 1C_2C ) ) PORT_DIPNAME( 0xc0, 0x00, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW1:7,8") PORT_DIPSETTING( 0x80, DEF_STR( 2C_1C ) ) PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) ) PORT_DIPSETTING( 0xc0, DEF_STR( 2C_3C ) ) PORT_DIPSETTING( 0x40, DEF_STR( 1C_2C ) ) PORT_START("DSW2") PORT_DIPNAME( 0x03, 0x00, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:1,2") PORT_DIPSETTING( 0x01, DEF_STR( Easy ) ) PORT_DIPSETTING( 0x00, DEF_STR( Normal ) ) PORT_DIPSETTING( 0x02, DEF_STR( Hard ) ) PORT_DIPSETTING( 0x03, DEF_STR( Hardest ) ) PORT_DIPNAME( 0x0c, 0x00, "Bonus Levels (in thousands)" ) PORT_DIPLOCATION("SW2:3,4") PORT_DIPSETTING( 0x00, "10,30,50,70,90" ) PORT_DIPSETTING( 0x04, "10,20,30,40,50,60,70,80,90" ) PORT_DIPSETTING( 0x08, "20,50" ) PORT_DIPSETTING( 0x0c, DEF_STR( None ) ) PORT_DIPNAME( 0x30, 0x00, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW2:5,6") PORT_DIPSETTING( 0x10, "3" ) PORT_DIPSETTING( 0x00, "5" ) PORT_DIPSETTING( 0x20, "7" ) PORT_DIPSETTING( 0x30, "9" ) PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:7") PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x80, 0x80, "Stereo Sound" ) PORT_DIPLOCATION("SW2:8") PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) INPUT_PORTS_END 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( djboy ) GFXDECODE_ENTRY( "gfx1", 0, tile_layout, 0x100, 16 ) /* sprite bank */ GFXDECODE_ENTRY( "gfx2", 0, tile_layout, 0x000, 16 ) /* background tiles */ GFXDECODE_END /******************************************************************************/ /* Main Z80 uses IM2 */ static TIMER_DEVICE_CALLBACK( djboy_scanline ) { int scanline = param; if(scanline == 240) // vblank-out irq cputag_set_input_line_and_vector(timer.machine, "maincpu", 0, HOLD_LINE, 0xfd); /* Pandora "sprite end dma" irq? TODO: timing is clearly off, attract mode relies on this */ if(scanline == 64) cputag_set_input_line_and_vector(timer.machine, "maincpu", 0, HOLD_LINE, 0xff); }
static WRITE16_HANDLER( heberpop_sound_command_w ) { if (ACCESSING_BITS_0_7) { soundlatch_w(space, 0, data & 0xff); cputag_set_input_line_and_vector(space->machine, "audiocpu", 0, HOLD_LINE, 0xff); /* RST 38h */ } }
static TIMER_DEVICE_CALLBACK( m107_scanline_interrupt ) { running_machine &machine = timer.machine(); m107_state *state = machine.driver_data<m107_state>(); int scanline = param; /* raster interrupt */ if (scanline == state->m_raster_irq_position) { machine.primary_screen->update_partial(scanline); cputag_set_input_line_and_vector(machine, "maincpu", 0, HOLD_LINE, M107_IRQ_2); } /* VBLANK interrupt */ else if (scanline == machine.primary_screen->visible_area().max_y + 1) { machine.primary_screen->update_partial(scanline); cputag_set_input_line_and_vector(machine, "maincpu", 0, HOLD_LINE, M107_IRQ_0); } }
ADDRESS_MAP_END /*************************************************************************** MACHINE DRIVERS ***************************************************************************/ static void duarta_irq_handler(device_t *device, UINT8 vector) { verboselog(device->machine(), 0, "duarta_irq_handler\n"); cputag_set_input_line_and_vector(device->machine(), "maincpu", M68K_IRQ_6, HOLD_LINE, M68K_INT_ACK_AUTOVECTOR); };
static TIMER_CALLBACK( scanline_callback ) { astrocde_state *state = machine.driver_data<astrocde_state>(); int scanline = param; int astrocade_scanline = mame_vpos_to_astrocade_vpos(scanline); /* force an update against the current scanline */ if (scanline > 0) machine.primary_screen->update_partial(scanline - 1); /* generate a scanline interrupt if it's time */ if (astrocade_scanline == state->m_interrupt_scanline && (state->m_interrupt_enabl & 0x08) != 0) { /* bit 2 controls the interrupt mode: mode 0 means assert until acknowledged */ if ((state->m_interrupt_enabl & 0x04) == 0) { cputag_set_input_line_and_vector(machine, "maincpu", 0, HOLD_LINE, state->m_interrupt_vector); machine.scheduler().timer_set(machine.primary_screen->time_until_vblank_end(), FUNC(interrupt_off)); } /* mode 1 means assert for 1 instruction */ else { cputag_set_input_line_and_vector(machine, "maincpu", 0, ASSERT_LINE, state->m_interrupt_vector); machine.scheduler().timer_set(machine.device<cpu_device>("maincpu")->cycles_to_attotime(1), FUNC(interrupt_off)); } } /* on some games, the horizontal drive line is conected to the lightpen interrupt */ else if (state->m_video_config & AC_LIGHTPEN_INTS) astrocade_trigger_lightpen(machine, astrocade_scanline, 8); /* advance to the next scanline */ scanline++; if (scanline >= machine.primary_screen->height()) scanline = 0; state->m_scanline_timer->adjust(machine.primary_screen->time_until_pos(scanline), scanline); }
static TIMER_CALLBACK( m107_scanline_interrupt ) { m107_state *state = machine.driver_data<m107_state>(); int scanline = param; /* raster interrupt */ if (scanline == state->m_raster_irq_position) { machine.primary_screen->update_partial(scanline); cputag_set_input_line_and_vector(machine, "maincpu", 0, HOLD_LINE, M107_IRQ_2); } /* VBLANK interrupt */ else if (scanline == machine.primary_screen->visible_area().max_y + 1) { machine.primary_screen->update_partial(scanline); cputag_set_input_line_and_vector(machine, "maincpu", 0, HOLD_LINE, M107_IRQ_0); } /* adjust for next scanline */ if (++scanline >= machine.primary_screen->height()) scanline = 0; state->m_scanline_timer->adjust(machine.primary_screen->time_until_pos(scanline), scanline); }
/* When a typewriter key is struck, the code for the struck key is placed in the * typewriter buffer, Program Flag 1 is set, and the type-in status bit is set to * one. A program designed to accept typed-in data would periodically check * Program Flag 1, and if found to be set, an In-Out Transfer Instruction with * address 4 could be executed for the information to be transferred to the * In-Out Register. This In-Out Transfer should not use the optional in-out wait. * The information contained in the typewriter buffer is then transferred to the * right six bits of the In-Out Register. The tyi instruction automatically * clears the In-Out Register before transferring the information and also clears * the type-in status bit. */ static void iot_tyi(device_t *device, int op2, int nac, int mb, int *io, int ac) { pdp1_state *state = device->machine().driver_data<pdp1_state>(); if (LOG_IOT_EXTRA) logerror("Warning, TYI instruction not fully emulated: mb=0%06o, (%s)\n", (unsigned) mb, device->machine().describe_context()); *io = state->m_typewriter.tb; if (! (state->m_io_status & io_st_tyi)) *io |= 0100; else { state->m_io_status &= ~io_st_tyi; if (USE_SBS) cputag_set_input_line_and_vector(device->machine(), "maincpu", 0, CLEAR_LINE, 0); /* interrupt it, baby */ } }
static WRITE8_HANDLER ( xxmissio_status_s_w ) { xxmissio_state *state = space->machine().driver_data<xxmissio_state>(); switch (data) { case 0x00: state->m_status |= 0x10; break; case 0x40: state->m_status |= 0x08; break; case 0x80: state->m_status &= ~0x04; cputag_set_input_line_and_vector(space->machine(), "maincpu", 0, HOLD_LINE, 0x10); break; } }
static WRITE8_HANDLER( tp84_sh_irqtrigger_w ) { cputag_set_input_line_and_vector(space->machine, "audiocpu",0,HOLD_LINE,0xff); }
static void duart_irq_handler(device_t *device, UINT8 vector) { cputag_set_input_line_and_vector(device->machine(), "maincpu", M68K_IRQ_3, HOLD_LINE, M68K_INT_ACK_AUTOVECTOR); }
void micro3d_duart_irq_handler(device_t *device, int state, UINT8 vector) { cputag_set_input_line_and_vector(device->machine(), "maincpu", 3, state, vector); };
static WRITE8_HANDLER( sprite_interrupt_w ) { cputag_set_input_line_and_vector(space->machine, "sprite", 0, HOLD_LINE, 0xff ); }
static WRITE8_HANDLER( sound_command_w ) { soundlatch_w( space, 0, data ); cputag_set_input_line_and_vector(space->machine, "audiocpu", 0, HOLD_LINE, 0xff ); }
static TIMER_CALLBACK( stfight_interrupt_1 ) { // Do a RST08 cputag_set_input_line_and_vector(machine, "maincpu", 0, HOLD_LINE, 0xcf); }
static WRITE16_HANDLER( m107_sound_status_w ) { m107_state *state = space->machine().driver_data<m107_state>(); COMBINE_DATA(&state->m_sound_status); cputag_set_input_line_and_vector(space->machine(), "maincpu", 0, HOLD_LINE, M107_IRQ_3); }