Previous 199869 Revisions Next

r22609 Monday 29th April, 2013 at 14:42:12 UTC by Miodrag Milanović
voodoo is using now device callbacks and some minor cleanups in few drivers (nw)
[src/emu/video]vooddefs.h voodoo.c voodoo.h
[src/mame/drivers]astrocde.c funkball.c gticlub.c hornet.c iteagle.c magictg.c nss.c nwk-tr.c seattle.c sfcbox.c snesb.c vegas.c viper.c
[src/mame/includes]astrocde.h snes.h
[src/mame/machine]snes.c
[src/mame/video]astrocde.c
[src/mess/drivers]astrocde.c macpci.c snes.c

trunk/src/emu/video/vooddefs.h
r22608r22609
14761476   fifo_state          fifo;                   /* PCI FIFO */
14771477   UINT32              init_enable;            /* initEnable value */
14781478   UINT8               stall_state;            /* state of the system if we're stalled */
1479   voodoo_stall_func   stall_callback;         /* callback for stalling/unstalling */
1479   devcb_resolved_write_line    stall_callback;         /* callback for stalling/unstalling */
14801480   UINT8               op_pending;             /* true if an operation is pending */
14811481   attotime            op_end_time;            /* time when the pending operation ends */
14821482   emu_timer *         continue_timer;         /* timer to use to continue processing */
r22608r22609
15921592   UINT8               vblank_swap_pending;    /* a swap is pending, waiting for a vblank */
15931593   UINT8               vblank_swap;            /* swap when we hit this count */
15941594   UINT8               vblank_dont_swap;       /* don't actually swap when we hit this point */
1595   voodoo_vblank_func  vblank_client;          /* client callback */
1595   devcb_resolved_write_lin  vblank_client;          /* client callback */
15961596
15971597   /* triangle setup info */
15981598   UINT8               cheating_allowed;       /* allow cheating? */
trunk/src/emu/video/voodoo.c
r22608r22609
10061006      {
10071007         v->reg[intrCtrl].u |= 0x200;        // VSYNC int (falling) active
10081008
1009         if (v->fbi.vblank_client != NULL)
1010            (*v->fbi.vblank_client)(v->device, FALSE);
1009         if (!v->fbi.vblank_client.isnull())
1010            v->fbi.vblank_client(FALSE);
10111011
10121012      }
10131013   }
10141014   else
10151015   {
1016      if (v->fbi.vblank_client != NULL)
1017         (*v->fbi.vblank_client)(v->device, FALSE);
1016      if (!v->fbi.vblank_client.isnull())
1017         v->fbi.vblank_client(FALSE);
10181018   }
10191019
10201020   /* go to the end of the next frame */
r22608r22609
10331033   {
10341034      if (LOG_VBLANK_SWAP) logerror("---- vblank flush begin\n");
10351035      flush_fifos(v, machine.time());
1036      if (LOG_VBLANK_SWAP) logerror("---- vblank flush end\n");
1036      if (LOG_VBLANK_SWAP) logerror("---- vblank flush end\n");     
10371037   }
10381038
10391039   /* increment the count */
r22608r22609
10621062      {
10631063         v->reg[intrCtrl].u |= 0x100;        // VSYNC int (rising) active
10641064
1065         if (v->fbi.vblank_client != NULL)
1066            (*v->fbi.vblank_client)(v->device, TRUE);
1065         if (!v->fbi.vblank_client.isnull())
1066            v->fbi.vblank_client(TRUE);
10671067      }
10681068   }
10691069   else
10701070   {
1071      if (v->fbi.vblank_client != NULL)
1072         (*v->fbi.vblank_client)(v->device, TRUE);
1071      if (!v->fbi.vblank_client.isnull())
1072         v->fbi.vblank_client(TRUE);
10731073   }
10741074}
10751075
r22608r22609
21732173      v->pci.stall_state = NOT_STALLED;
21742174
21752175      /* either call the callback, or trigger the trigger */
2176      if (v->pci.stall_callback)
2177         (*v->pci.stall_callback)(v->device, FALSE);
2176      if (!v->pci.stall_callback.isnull())
2177         v->pci.stall_callback(FALSE);
21782178      else
21792179         v->device->machine().scheduler().trigger(v->trigger);
21802180   }
r22608r22609
21972197   v->stats.stalls++;
21982198
21992199   /* either call the callback, or spin the CPU */
2200   if (v->pci.stall_callback)
2201      (*v->pci.stall_callback)(v->device, TRUE);
2200   if (!v->pci.stall_callback.isnull())
2201      v->pci.stall_callback(TRUE);
22022202   else
22032203      v->cpu->execute().spin_until_trigger(v->trigger);
22042204
r22608r22609
25542554         v->reg[intrCtrl].u &= ~0x80000000;
25552555
25562556         // TODO: rename vblank_client for less confusion?
2557         if (v->fbi.vblank_client != NULL)
2558            (*v->fbi.vblank_client)(v->device, TRUE);
2557         if (!v->fbi.vblank_client.isnull())
2558            v->fbi.vblank_client(TRUE);
25592559         break;
25602560
25612561      /* gamma table access -- Voodoo/Voodoo2 only */
r22608r22609
49024902
49034903   /* copy config data */
49044904   v->freq = device->clock();
4905   v->fbi.vblank_client = config->vblank;
4906   v->pci.stall_callback = config->stall;
4905   v->fbi.vblank_client.resolve(config->vblank,*device);
4906   v->pci.stall_callback.resolve(config->stall,*device);
49074907
49084908   /* create a multiprocessor work queue */
49094909   v->poly = poly_alloc(device->machine(), 64, sizeof(poly_extra_data), 0);
trunk/src/emu/video/voodoo.h
r22608r22609
6767    TYPE DEFINITIONS
6868***************************************************************************/
6969
70typedef void (*voodoo_vblank_func)(device_t *device, int state);
71typedef void (*voodoo_stall_func)(device_t *device, int state);
72
73
7470struct voodoo_config
7571{
7672   UINT8               fbmem;
r22608r22609
7874   UINT8               tmumem1;
7975   const char *        screen;
8076   const char *        cputag;
81   voodoo_vblank_func  vblank;
82   voodoo_stall_func   stall;
77   devcb_write_line    vblank;
78   devcb_write_line    stall;
8379};
8480
8581
trunk/src/mess/drivers/astrocde.c
r22608r22609
2525   DECLARE_INPUT_CHANGED_MEMBER(set_write_protect);
2626};
2727
28
2928/*************************************
3029 *
3130 *  Memory maps
trunk/src/mess/drivers/macpci.c
r22608r22609
7979INPUT_PORTS_END
8080
8181
82static MACHINE_RESET( pippin )
83{
84}
85
86static VIDEO_START( pippin )
87{
88}
89
9082UINT32 macpci_state::screen_update_pippin(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
9183{
9284   return 0;
r22608r22609
109101   MCFG_CPU_ADD("maincpu", PPC603, 66000000)
110102   MCFG_CPU_PROGRAM_MAP(pippin_mem)
111103
112   MCFG_MACHINE_RESET(pippin)
113
114104   /* video hardware */
115105   MCFG_SCREEN_ADD("screen", RASTER)
116106   MCFG_SCREEN_REFRESH_RATE(60)
r22608r22609
122112   MCFG_PALETTE_LENGTH(2)
123113   MCFG_PALETTE_INIT(black_and_white)
124114
125   MCFG_VIDEO_START(pippin)
126
127115   /* sound hardware */
128116   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
129117
trunk/src/mess/drivers/snes.c
r22608r22609
9595   DECLARE_READ8_MEMBER(snes_oldjoy1_read);
9696   DECLARE_READ8_MEMBER(snes_oldjoy2_read);
9797
98   virtual void machine_start();
99   virtual void machine_reset();
98100   int m_type;
99101   optional_device<sns_cart_slot_device> m_cartslot;
100102};
r22608r22609
14971499   SLOT_INTERFACE_INTERNAL("lorom_st11leg", SNS_LOROM_SETA11_LEG)
14981500SLOT_INTERFACE_END
14991501
1500static MACHINE_START( snes_console )
1502void snes_console_state::machine_start()
15011503{
1502   snes_console_state *state = machine.driver_data<snes_console_state>();
1504   snes_state::machine_start();
15031505
1504   MACHINE_START_CALL(snes);
1506   m_type = m_cartslot->get_type();
15051507
1506   state->m_type = state->m_cartslot->get_type();
1507
1508   switch (state->m_type)
1508   switch (m_type)
15091509   {
15101510      // LoROM & LoROM + addons
15111511      case SNES_MODE20:
r22608r22609
15191519      case SNES_Z80GB:    // still unemulated
15201520         break;
15211521      case SNES_DSP:
1522         state->m_maincpu->space(AS_PROGRAM).install_read_handler(0x208000, 0x20ffff, 0, 0x9f0000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)state->m_cartslot));
1523         state->m_maincpu->space(AS_PROGRAM).install_write_handler(0x208000, 0x20ffff, 0, 0x9f0000, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)state->m_cartslot));
1522         m_maincpu->space(AS_PROGRAM).install_read_handler(0x208000, 0x20ffff, 0, 0x9f0000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)m_cartslot));
1523         m_maincpu->space(AS_PROGRAM).install_write_handler(0x208000, 0x20ffff, 0, 0x9f0000, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)m_cartslot));
15241524         break;
15251525      case SNES_DSP_2MB:
1526         state->m_maincpu->space(AS_PROGRAM).install_read_handler(0x600000, 0x607fff, 0, 0x8f0000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)state->m_cartslot));
1527         state->m_maincpu->space(AS_PROGRAM).install_write_handler(0x600000, 0x607fff, 0, 0x8f0000, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)state->m_cartslot));
1526         m_maincpu->space(AS_PROGRAM).install_read_handler(0x600000, 0x607fff, 0, 0x8f0000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)m_cartslot));
1527         m_maincpu->space(AS_PROGRAM).install_write_handler(0x600000, 0x607fff, 0, 0x8f0000, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)m_cartslot));
15281528         break;
15291529      case SNES_DSP4:
1530         state->m_maincpu->space(AS_PROGRAM).install_read_handler(0x308000, 0x30ffff, 0, 0x8f0000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)state->m_cartslot));
1531         state->m_maincpu->space(AS_PROGRAM).install_write_handler(0x308000, 0x30ffff, 0, 0x8f0000, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)state->m_cartslot));
1530         m_maincpu->space(AS_PROGRAM).install_read_handler(0x308000, 0x30ffff, 0, 0x8f0000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)m_cartslot));
1531         m_maincpu->space(AS_PROGRAM).install_write_handler(0x308000, 0x30ffff, 0, 0x8f0000, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)m_cartslot));
15321532         break;
15331533      case SNES_OBC1:
1534         state->m_maincpu->space(AS_PROGRAM).install_read_handler(0x006000, 0x007fff, 0, 0xbf0000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)state->m_cartslot));
1535         state->m_maincpu->space(AS_PROGRAM).install_write_handler(0x006000, 0x007fff, 0, 0xbf0000, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)state->m_cartslot));
1534         m_maincpu->space(AS_PROGRAM).install_read_handler(0x006000, 0x007fff, 0, 0xbf0000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)m_cartslot));
1535         m_maincpu->space(AS_PROGRAM).install_write_handler(0x006000, 0x007fff, 0, 0xbf0000, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)m_cartslot));
15361536         break;
15371537      case SNES_SFX:
1538         state->m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::snessfx_lo_r),state), write8_delegate(FUNC(snes_console_state::snessfx_lo_w),state));
1539         state->m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::snessfx_hi_r),state), write8_delegate(FUNC(snes_console_state::snessfx_hi_w),state));
1540         set_5a22_map(state->m_maincpu);
1538         m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::snessfx_lo_r),this), write8_delegate(FUNC(snes_console_state::snessfx_lo_w),this));
1539         m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::snessfx_hi_r),this), write8_delegate(FUNC(snes_console_state::snessfx_hi_w),this));
1540         set_5a22_map(m_maincpu);
15411541         break;
15421542      case SNES_SDD1:
1543         state->m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::snessdd1_lo_r),state), write8_delegate(FUNC(snes_console_state::snessdd1_lo_w),state));
1544         state->m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::snessdd1_hi_r),state), write8_delegate(FUNC(snes_console_state::snessdd1_hi_w),state));
1545         set_5a22_map(state->m_maincpu);
1543         m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::snessdd1_lo_r),this), write8_delegate(FUNC(snes_console_state::snessdd1_lo_w),this));
1544         m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::snessdd1_hi_r),this), write8_delegate(FUNC(snes_console_state::snessdd1_hi_w),this));
1545         set_5a22_map(m_maincpu);
15461546         break;
15471547      case SNES_BSX:
1548         state->m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::snesbsx_lo_r),state), write8_delegate(FUNC(snes_console_state::snesbsx_lo_w),state));
1549         state->m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::snesbsx_hi_r),state), write8_delegate(FUNC(snes_console_state::snesbsx_hi_w),state));
1550         set_5a22_map(state->m_maincpu);
1548         m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::snesbsx_lo_r),this), write8_delegate(FUNC(snes_console_state::snesbsx_lo_w),this));
1549         m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::snesbsx_hi_r),this), write8_delegate(FUNC(snes_console_state::snesbsx_hi_w),this));
1550         set_5a22_map(m_maincpu);
15511551         break;
15521552      // HiROM & HiROM + addons
15531553      case SNES_MODE21:
15541554      case SNES_BSXHI:
1555         state->m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::snes21_lo_r),state), write8_delegate(FUNC(snes_console_state::snes21_lo_w),state));
1556         state->m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::snes21_hi_r),state), write8_delegate(FUNC(snes_console_state::snes21_hi_w),state));
1557         set_5a22_map(state->m_maincpu);
1555         m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::snes21_lo_r),this), write8_delegate(FUNC(snes_console_state::snes21_lo_w),this));
1556         m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::snes21_hi_r),this), write8_delegate(FUNC(snes_console_state::snes21_hi_w),this));
1557         set_5a22_map(m_maincpu);
15581558         break;
15591559      case SNES_DSP_MODE21:
1560         state->m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::snes21_lo_r),state), write8_delegate(FUNC(snes_console_state::snes21_lo_w),state));
1561         state->m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::snes21_hi_r),state), write8_delegate(FUNC(snes_console_state::snes21_hi_w),state));
1562         state->m_maincpu->space(AS_PROGRAM).install_read_handler(0x006000, 0x007fff, 0, 0x9f0000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)state->m_cartslot));
1563         state->m_maincpu->space(AS_PROGRAM).install_write_handler(0x006000, 0x007fff, 0, 0x9f0000, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)state->m_cartslot));
1564         set_5a22_map(state->m_maincpu);
1560         m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::snes21_lo_r),this), write8_delegate(FUNC(snes_console_state::snes21_lo_w),this));
1561         m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::snes21_hi_r),this), write8_delegate(FUNC(snes_console_state::snes21_hi_w),this));
1562         m_maincpu->space(AS_PROGRAM).install_read_handler(0x006000, 0x007fff, 0, 0x9f0000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)m_cartslot));
1563         m_maincpu->space(AS_PROGRAM).install_write_handler(0x006000, 0x007fff, 0, 0x9f0000, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)m_cartslot));
1564         set_5a22_map(m_maincpu);
15651565         break;
15661566      case SNES_SRTC:
1567         state->m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::snes21_lo_r),state), write8_delegate(FUNC(snes_console_state::snes21_lo_w),state));
1568         state->m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::snes21_hi_r),state), write8_delegate(FUNC(snes_console_state::snes21_hi_w),state));
1569         state->m_maincpu->space(AS_PROGRAM).install_read_handler(0x002800, 0x002800, 0, 0xbf0000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)state->m_cartslot));
1570         state->m_maincpu->space(AS_PROGRAM).install_write_handler(0x002801, 0x002801, 0, 0xbf0000, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)state->m_cartslot));
1571         set_5a22_map(state->m_maincpu);
1567         m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::snes21_lo_r),this), write8_delegate(FUNC(snes_console_state::snes21_lo_w),this));
1568         m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::snes21_hi_r),this), write8_delegate(FUNC(snes_console_state::snes21_hi_w),this));
1569         m_maincpu->space(AS_PROGRAM).install_read_handler(0x002800, 0x002800, 0, 0xbf0000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)m_cartslot));
1570         m_maincpu->space(AS_PROGRAM).install_write_handler(0x002801, 0x002801, 0, 0xbf0000, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)m_cartslot));
1571         set_5a22_map(m_maincpu);
15721572         break;
15731573      case SNES_SPC7110:
15741574      case SNES_SPC7110_RTC:
1575         state->m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::snes7110_lo_r),state), write8_delegate(FUNC(snes_console_state::snes7110_lo_w),state));
1576         state->m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::snes7110_hi_r),state), write8_delegate(FUNC(snes_console_state::snes7110_hi_w),state));
1577         set_5a22_map(state->m_maincpu);
1575         m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::snes7110_lo_r),this), write8_delegate(FUNC(snes_console_state::snes7110_lo_w),this));
1576         m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::snes7110_hi_r),this), write8_delegate(FUNC(snes_console_state::snes7110_hi_w),this));
1577         set_5a22_map(m_maincpu);
15781578         break;
15791579      case SNES_PFEST94:
1580         state->m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::pfest94_lo_r),state), write8_delegate(FUNC(snes_console_state::pfest94_lo_w),state));
1581         state->m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::pfest94_hi_r),state), write8_delegate(FUNC(snes_console_state::pfest94_hi_w),state));
1582         set_5a22_map(state->m_maincpu);
1580         m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x000000, 0x7dffff, read8_delegate(FUNC(snes_console_state::pfest94_lo_r),this), write8_delegate(FUNC(snes_console_state::pfest94_lo_w),this));
1581         m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x800000, 0xffffff, read8_delegate(FUNC(snes_console_state::pfest94_hi_r),this), write8_delegate(FUNC(snes_console_state::pfest94_hi_w),this));
1582         set_5a22_map(m_maincpu);
15831583         break;
15841584         // pirate 'mappers'
15851585      case SNES_POKEMON:
1586         state->m_maincpu->space(AS_PROGRAM).install_read_handler(0x800000, 0x80ffff, 0, 0x780000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)state->m_cartslot));
1587         state->m_maincpu->space(AS_PROGRAM).install_write_handler(0x800000, 0x80ffff, 0, 0x780000, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)state->m_cartslot));
1586         m_maincpu->space(AS_PROGRAM).install_read_handler(0x800000, 0x80ffff, 0, 0x780000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)m_cartslot));
1587         m_maincpu->space(AS_PROGRAM).install_write_handler(0x800000, 0x80ffff, 0, 0x780000, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)m_cartslot));
15881588         break;
15891589      case SNES_TEKKEN2:
1590         state->m_maincpu->space(AS_PROGRAM).install_read_handler(0x808000, 0x8087ff, 0, 0x3f0000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)state->m_cartslot));
1591         state->m_maincpu->space(AS_PROGRAM).install_write_handler(0x808000, 0x8087ff, 0, 0x3f0000, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)state->m_cartslot));
1590         m_maincpu->space(AS_PROGRAM).install_read_handler(0x808000, 0x8087ff, 0, 0x3f0000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)m_cartslot));
1591         m_maincpu->space(AS_PROGRAM).install_write_handler(0x808000, 0x8087ff, 0, 0x3f0000, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)m_cartslot));
15921592         break;
15931593      case SNES_MCPIR1:
15941594      case SNES_MCPIR2:
1595         state->m_maincpu->space(AS_PROGRAM).install_write_handler(0xffff00, 0xffffff, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)state->m_cartslot));
1595         m_maincpu->space(AS_PROGRAM).install_write_handler(0xffff00, 0xffffff, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)m_cartslot));
15961596         break;
15971597      case SNES_20COL:
1598         state->m_maincpu->space(AS_PROGRAM).install_write_handler(0x008000, 0x008fff, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)state->m_cartslot));
1598         m_maincpu->space(AS_PROGRAM).install_write_handler(0x008000, 0x008fff, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)m_cartslot));
15991599         break;
16001600      case SNES_SOULBLAD:
16011601         // reads from xxx0-xxx3in range [80-bf] return a fixed sequence of 4bits; reads in range [c0-ff] return open bus
1602         state->m_maincpu->space(AS_PROGRAM).install_read_handler(0x808000, 0x808003, 0, 0x3f7ff0, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)state->m_cartslot));
1603         state->m_maincpu->space(AS_PROGRAM).install_legacy_read_handler(0xc00000, 0xffffff, FUNC(snes_open_bus_r));
1602         m_maincpu->space(AS_PROGRAM).install_read_handler(0x808000, 0x808003, 0, 0x3f7ff0, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)m_cartslot));
1603         m_maincpu->space(AS_PROGRAM).install_legacy_read_handler(0xc00000, 0xffffff, FUNC(snes_open_bus_r));
16041604         break;
16051605      case SNES_BUGS:
16061606      case SNES_BANANA:
1607//          state->m_maincpu->space(AS_PROGRAM).install_read_handler(0x808000, 0x80ffff, 0, 0x780000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)state->m_cartslot));
1608//          state->m_maincpu->space(AS_PROGRAM).install_write_handler(0x808000, 0x80ffff, 0, 0x780000, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)state->m_cartslot));
1609//          set_5a22_map(state->m_maincpu);
1607//          m_maincpu->space(AS_PROGRAM).install_read_handler(0x808000, 0x80ffff, 0, 0x780000, read8_delegate(FUNC(base_sns_cart_slot_device::chip_read),(base_sns_cart_slot_device*)m_cartslot));
1608//          m_maincpu->space(AS_PROGRAM).install_write_handler(0x808000, 0x80ffff, 0, 0x780000, write8_delegate(FUNC(base_sns_cart_slot_device::chip_write),(base_sns_cart_slot_device*)m_cartslot));
1609//          set_5a22_map(m_maincpu);
16101610         break;
16111611   }
16121612}
16131613
1614static MACHINE_RESET( snes_console )
1614void snes_console_state::machine_reset()
16151615{
1616   snes_console_state *state = machine.driver_data<snes_console_state>();
1616   snes_state::machine_reset();
16171617
1618   MACHINE_RESET_CALL(snes);
1619
1620   state->m_io_read = write8_delegate(FUNC(snes_console_state::snes_input_read),state);
1621   state->m_oldjoy1_read = read8_delegate(FUNC(snes_console_state::snes_oldjoy1_read),state);
1622   state->m_oldjoy2_read = read8_delegate(FUNC(snes_console_state::snes_oldjoy2_read),state);
1618   m_io_read = write8_delegate(FUNC(snes_console_state::snes_input_read),this);
1619   m_oldjoy1_read = read8_delegate(FUNC(snes_console_state::snes_oldjoy1_read),this);
1620   m_oldjoy2_read = read8_delegate(FUNC(snes_console_state::snes_oldjoy2_read),this);
16231621}
16241622
16251623
r22608r22609
16351633   //MCFG_QUANTUM_TIME(attotime::from_hz(48000))
16361634   MCFG_QUANTUM_PERFECT_CPU("maincpu")
16371635
1638   MCFG_MACHINE_START(snes_console)
1639   MCFG_MACHINE_RESET(snes_console)
1640
16411636   /* video hardware */
16421637   MCFG_SCREEN_ADD("screen", RASTER)
16431638   MCFG_SCREEN_RAW_PARAMS(DOTCLK_NTSC * 2, SNES_HTOTAL * 2, 0, SNES_SCR_WIDTH * 2, SNES_VTOTAL_NTSC, 0, SNES_SCR_HEIGHT_NTSC)
trunk/src/mame/drivers/viper.c
r22608r22609
344344   DECLARE_WRITE64_MEMBER(cf_card_w);
345345   DECLARE_READ64_MEMBER(ata_r);
346346   DECLARE_WRITE64_MEMBER(ata_w);
347   DECLARE_WRITE_LINE_MEMBER(voodoo_vblank);
347348   DECLARE_DRIVER_INIT(viper);
348349   DECLARE_DRIVER_INIT(vipercf);
349350   virtual void machine_start();
r22608r22609
19961997   //mpc8240_interrupt(device.machine, MPC8240_IRQ3);
19971998}
19981999
1999static void voodoo_vblank(device_t *device, int state)
2000WRITE_LINE_MEMBER(viper_state::voodoo_vblank)
20002001{
2001   viper_state *drvstate = device->machine().driver_data<viper_state>();
2002   drvstate->mpc8240_interrupt(MPC8240_IRQ4);
2002   mpc8240_interrupt(MPC8240_IRQ4);
20032003}
20042004
20052005void viper_state::machine_start()
r22608r22609
20402040   0,//                tmumem1;
20412041   "screen",//         screen;
20422042   "maincpu",//        cputag;
2043   voodoo_vblank,//    vblank;
2044   NULL,//             stall;
2043   DEVCB_DRIVER_LINE_MEMBER(viper_state,voodoo_vblank),//    vblank;
2044   DEVCB_NULL//             stall;
20452045};
20462046
20472047static MACHINE_CONFIG_START( viper, viper_state )
trunk/src/mame/drivers/snesb.c
r22608r22609
174174   DECLARE_DRIVER_INIT(sblast2b);
175175   DECLARE_DRIVER_INIT(ffight2b);
176176   DECLARE_DRIVER_INIT(endless);
177   DECLARE_MACHINE_RESET(ffight2b);
177178};
178179
179180
r22608r22609
633634
634635   MCFG_QUANTUM_PERFECT_CPU("maincpu")
635636
636   MCFG_MACHINE_START( snes )
637   MCFG_MACHINE_RESET( snes )
638
639637   /* video hardware */
640638   MCFG_SCREEN_ADD("screen", RASTER)
641639   MCFG_SCREEN_RAW_PARAMS(DOTCLK_NTSC, SNES_HTOTAL, 0, SNES_SCR_WIDTH, SNES_VTOTAL_NTSC, 0, SNES_SCR_HEIGHT_NTSC)
r22608r22609
648646   MCFG_SOUND_ROUTE(1, "rspeaker", 1.00)
649647MACHINE_CONFIG_END
650648
651MACHINE_RESET( ffight2b )
649MACHINE_RESET_MEMBER( snesb_state, ffight2b )
652650{
653   snesb_state *state = machine.driver_data<snesb_state>();
654   address_space &cpu0space = state->m_maincpu->space(AS_PROGRAM);
655   MACHINE_RESET_CALL( snes );
651   address_space &cpu0space = m_maincpu->space(AS_PROGRAM);
652   snes_state::machine_reset();
656653
657654   /* Hack: avoid starting with 55 credits. It's either a work RAM init fault or MCU clears it by his own, hard to tell ... */
658655   cpu0space.write_byte(0x7eadce, 0x00);
659656}
660657
661658static MACHINE_CONFIG_DERIVED( ffight2b, kinstb )
662   MCFG_MACHINE_RESET( ffight2b )
659   MCFG_MACHINE_RESET_OVERRIDE( snesb_state, ffight2b )
663660MACHINE_CONFIG_END
664661
665662DRIVER_INIT_MEMBER(snesb_state,kinstb)
trunk/src/mame/drivers/astrocde.c
r22608r22609
127127#include "spacezap.lh"
128128#include "tenpindx.lh"
129129
130
131130/*************************************
132131 *
133 *  Machine setup
134 *
135 *************************************/
136
137static MACHINE_START( astrocde )
138{
139   astrocde_state *state = machine.driver_data<astrocde_state>();
140   state_save_register_global(machine, state->m_port_1_last);
141   state_save_register_global(machine, state->m_port_2_last);
142   state_save_register_global(machine, state->m_ram_write_enable);
143   state_save_register_global(machine, state->m_input_select);
144   state_save_register_global(machine, state->m_profpac_bank);
145
146   state->m_port_1_last = state->m_port_2_last = 0xff;
147}
148
149
150
151/*************************************
152 *
153132 *  Protected RAM
154133 *
155134 *************************************/
r22608r22609
12891268   MCFG_CPU_ADD("maincpu", Z80, ASTROCADE_CLOCK/4)
12901269   /* each game has its own map */
12911270
1292   MCFG_MACHINE_START(astrocde)
1293
12941271   /* video hardware */
12951272   MCFG_PALETTE_LENGTH(512)
12961273
trunk/src/mame/drivers/magictg.c
r22608r22609
900900   0,//                tmumem1;
901901   "screen",//         screen;
902902   "mips",//           cputag;
903   NULL,//             vblank;
904   NULL,//             stall;
903   DEVCB_NULL,//             vblank;
904   DEVCB_NULL//             stall;
905905};
906906
907907static const voodoo_config voodoo_2_intf =
r22608r22609
911911   0,//                tmumem1;
912912   "screen",//         screen;
913913   "mips",//           cputag;
914   NULL,//vblank_assert                vblank;
915   NULL,// voodoo_stall            stall;
914   DEVCB_NULL,//vblank_assert                vblank;
915   DEVCB_NULL// voodoo_stall            stall;
916916};
917917/*************************************
918918 *
trunk/src/mame/drivers/gticlub.c
r22608r22609
263263   DECLARE_WRITE32_MEMBER(dsp_dataram0_w);
264264   DECLARE_READ32_MEMBER(dsp_dataram1_r);
265265   DECLARE_WRITE32_MEMBER(dsp_dataram1_w);
266   DECLARE_WRITE_LINE_MEMBER(voodoo_vblank_0);
267   DECLARE_WRITE_LINE_MEMBER(voodoo_vblank_1);
266268   void init_hangplt_common();
267269   DECLARE_DRIVER_INIT(hangplt);
268270   DECLARE_DRIVER_INIT(hangpltu);
r22608r22609
287289   palette_set_color_rgb(machine(), offset, pal5bit(data >> 10), pal5bit(data >> 5), pal5bit(data >> 0));
288290}
289291
290static void voodoo_vblank_0(device_t *device, int param)
292WRITE_LINE_MEMBER(gticlub_state::voodoo_vblank_0)
291293{
292   gticlub_state *state = device->machine().driver_data<gticlub_state>();
293   state->m_maincpu->set_input_line(INPUT_LINE_IRQ0, param ? ASSERT_LINE : CLEAR_LINE);
294   m_maincpu->set_input_line(INPUT_LINE_IRQ0, state? ASSERT_LINE : CLEAR_LINE);
294295}
295296
296static void voodoo_vblank_1(device_t *device, int param)
297WRITE_LINE_MEMBER(gticlub_state::voodoo_vblank_1)
297298{
298   gticlub_state *state = device->machine().driver_data<gticlub_state>();
299   state->m_maincpu->set_input_line(INPUT_LINE_IRQ1, param ? ASSERT_LINE : CLEAR_LINE);
299   m_maincpu->set_input_line(INPUT_LINE_IRQ1, state ? ASSERT_LINE : CLEAR_LINE);
300300}
301301
302302READ32_MEMBER(gticlub_state::gticlub_k001604_tile_r)
r22608r22609
907907   2,//                tmumem1;
908908   "lscreen",//        screen;
909909   "dsp",//            cputag;
910   voodoo_vblank_0,//  vblank;
911   NULL,//             stall;
910   DEVCB_DRIVER_LINE_MEMBER(gticlub_state,voodoo_vblank_0),//  vblank;
911   DEVCB_NULL//             stall;
912912};
913913
914914static const voodoo_config voodoo_r_intf =
r22608r22609
918918   2,//                tmumem1;
919919   "rscreen",//        screen;
920920   "dsp2",//           cputag;
921   voodoo_vblank_1,//  vblank;
922   NULL,//             stall;
921   DEVCB_DRIVER_LINE_MEMBER(gticlub_state,voodoo_vblank_1),//  vblank;
922   DEVCB_NULL//             stall;
923923};
924924
925925static MACHINE_CONFIG_START( hangplt, gticlub_state )
trunk/src/mame/drivers/vegas.c
r22608r22609
490490   int m_dynamic_count;
491491   dynamic_address m_dynamic[MAX_DYNAMIC_ADDRESSES];
492492   DECLARE_WRITE_LINE_MEMBER(ide_interrupt);
493   DECLARE_WRITE_LINE_MEMBER(vblank_assert);
493494   DECLARE_DRIVER_INIT(gauntleg);
494495   DECLARE_DRIVER_INIT(cartfury);
495496   DECLARE_DRIVER_INIT(tenthdeg);
r22608r22609
12551256}
12561257
12571258
1258static void vblank_assert(device_t *device, int state)
1259WRITE_LINE_MEMBER(vegas_state::vblank_assert)
12591260{
1260   vegas_state *drvstate = device->machine().driver_data<vegas_state>();
1261   if (!drvstate->m_vblank_state && state)
1261   if (!m_vblank_state && state)
12621262   {
1263      drvstate->m_sio_irq_state |= 0x20;
1264      drvstate->update_sio_irqs();
1263      m_sio_irq_state |= 0x20;
1264      update_sio_irqs();
12651265   }
1266   drvstate->m_vblank_state = state;
1266   m_vblank_state = state;
12671267
12681268   /* if we have stalled DMA, restart */
12691269//  if (dma_pending_on_vblank[0]) { perform_dma(0); }
r22608r22609
22262226   4,//                tmumem1;
22272227   "screen",//     screen;
22282228   "maincpu",//            cputag;
2229   vblank_assert,//    vblank;
2230   NULL,//             stall;
2229   DEVCB_DRIVER_LINE_MEMBER(vegas_state,vblank_assert),//    vblank;
2230   DEVCB_NULL//             stall;
22312231};
22322232
22332233static MACHINE_CONFIG_START( vegascore, vegas_state )
r22608r22609
22842284   0,//                tmumem1;
22852285   "screen",//     screen;
22862286   "maincpu",//            cputag;
2287   vblank_assert,//    vblank;
2288   NULL,//             stall;
2287   DEVCB_DRIVER_LINE_MEMBER(vegas_state,vblank_assert),//    vblank;
2288   DEVCB_NULL//             stall;
22892289};
22902290static MACHINE_CONFIG_DERIVED( vegasban, vegascore )
22912291   MCFG_FRAGMENT_ADD(dcs2_audio_2104)
trunk/src/mame/drivers/funkball.c
r22608r22609
11181118   0,//                tmumem1;
11191119   "screen",//         screen;
11201120   "maincpu",//        cputag;
1121   NULL,//             vblank;
1122   NULL,//             stall;
1121   DEVCB_NULL,//             vblank;
1122   DEVCB_NULL//             stall;
11231123};
11241124
11251125static MACHINE_CONFIG_START( funkball, funkball_state )
trunk/src/mame/drivers/iteagle.c
r22608r22609
101101
102102   DECLARE_DRIVER_INIT(iteagle);
103103   DECLARE_WRITE_LINE_MEMBER(ide_interrupt);
104   DECLARE_WRITE_LINE_MEMBER(vblank_assert);   
104105   UINT32 screen_update_iteagle(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
106   virtual void machine_start();
105107};
106108
107109
r22608r22609
111113 *
112114 *************************************/
113115
114static MACHINE_START( gtfore )
116void iteagle_state::machine_start()
115117{
116118   /* set the fastest DRC options */
117   mips3drc_set_options(machine.device("maincpu"), MIPS3DRC_FASTEST_OPTIONS);
119   mips3drc_set_options(m_maincpu, MIPS3DRC_FASTEST_OPTIONS);
118120}
119121
120122
121
122123/*************************************
123124 *
124 *  Machine init
125 *
126 *************************************/
127
128static MACHINE_RESET( gtfore )
129{
130}
131
132
133
134/*************************************
135 *
136125 *  Video refresh
137126 *
138127 *************************************/
r22608r22609
167156   AM_RANGE(0x1fc00000, 0x1fcfffff) AM_ROM AM_REGION("maincpu", 0) AM_SHARE("rombase")
168157ADDRESS_MAP_END
169158
170static void vblank_assert(device_t *device, int state)
159WRITE_LINE_MEMBER(iteagle_state::vblank_assert)
171160{
172161}
173162
r22608r22609
193182   0,//                tmumem1;
194183   "screen",//     screen;
195184   "maincpu",//            cputag;
196   vblank_assert,//    vblank;
197   NULL,//             stall;
185   DEVCB_DRIVER_LINE_MEMBER(iteagle_state,vblank_assert),//    vblank;
186   DEVCB_NULL//             stall;
198187};
199188
200189static const mips3_config r4310_config =
r22608r22609
210199   MCFG_CPU_CONFIG(r4310_config)
211200   MCFG_CPU_PROGRAM_MAP(main_map)
212201
213   MCFG_MACHINE_START(gtfore)
214   MCFG_MACHINE_RESET(gtfore)
215
216202   MCFG_IDE_CONTROLLER_ADD("ide", ide_devices, "hdd", NULL, true)
217203   MCFG_IDE_CONTROLLER_IRQ_HANDLER(DEVWRITELINE(DEVICE_SELF, iteagle_state, ide_interrupt))
218204
trunk/src/mame/drivers/seattle.c
r22608r22609
481481   DECLARE_WRITE32_MEMBER(widget_w);
482482   DECLARE_READ32_MEMBER(seattle_ide_r);
483483   DECLARE_WRITE_LINE_MEMBER(ide_interrupt);
484   DECLARE_WRITE_LINE_MEMBER(vblank_assert);
485   DECLARE_WRITE_LINE_MEMBER(voodoo_stall);   
484486   DECLARE_DRIVER_INIT(sfrush);
485487   DECLARE_DRIVER_INIT(blitz2k);
486488   DECLARE_DRIVER_INIT(carnevil);
r22608r22609
777779}
778780
779781
780static void vblank_assert(device_t *device, int state)
782WRITE_LINE_MEMBER(seattle_state::vblank_assert)
781783{
782   seattle_state *drvstate = device->machine().driver_data<seattle_state>();
783784   /* cache the raw state */
784   drvstate->m_vblank_state = state;
785   m_vblank_state = state;
785786
786787   /* latch on the correct polarity transition */
787   if ((state && !(*drvstate->m_interrupt_enable & 0x100)) || (!state && (*drvstate->m_interrupt_enable & 0x100)))
788   if ((state && !(*m_interrupt_enable & 0x100)) || (!state && (*m_interrupt_enable & 0x100)))
788789   {
789      drvstate->m_vblank_latch = 1;
790      drvstate->update_vblank_irq();
790      m_vblank_latch = 1;
791      update_vblank_irq();
791792   }
792793}
793794
r22608r22609
13631364}
13641365
13651366
1366static void voodoo_stall(device_t *device, int stall)
1367WRITE_LINE_MEMBER(seattle_state::voodoo_stall)
13671368{
1368   seattle_state *state = device->machine().driver_data<seattle_state>();
13691369   /* set the new state */
1370   state->m_voodoo_stalled = stall;
1370   m_voodoo_stalled = state;
13711371
13721372   /* if we're stalling and DMA is active, take note */
1373   if (stall)
1373   if (state)
13741374   {
1375      if (state->m_galileo.dma_active != -1)
1375      if (m_galileo.dma_active != -1)
13761376      {
1377         if (LOG_DMA) logerror("Stalling DMA%d on voodoo\n", state->m_galileo.dma_active);
1378         state->m_galileo.dma_stalled_on_voodoo[state->m_galileo.dma_active] = TRUE;
1377         if (LOG_DMA) logerror("Stalling DMA%d on voodoo\n", m_galileo.dma_active);
1378         m_galileo.dma_stalled_on_voodoo[m_galileo.dma_active] = TRUE;
13791379      }
13801380      else
13811381      {
1382         if (LOG_DMA) logerror("%08X:Stalling CPU on voodoo\n", state->m_maincpu->pc());
1383         state->m_maincpu->spin_until_trigger(45678);
1382         if (LOG_DMA) logerror("%08X:Stalling CPU on voodoo\n", m_maincpu->pc());
1383         m_maincpu->spin_until_trigger(45678);
13841384      }
13851385   }
13861386
r22608r22609
13911391
13921392      /* loop over any active DMAs and resume them */
13931393      for (which = 0; which < 4; which++)
1394         if (state->m_galileo.dma_stalled_on_voodoo[which])
1394         if (m_galileo.dma_stalled_on_voodoo[which])
13951395         {
1396            address_space &space = state->m_maincpu->space(AS_PROGRAM);
1396            address_space &space = m_maincpu->space(AS_PROGRAM);
13971397            if (LOG_DMA) logerror("Resuming DMA%d on voodoo\n", which);
13981398
13991399            /* mark this DMA as no longer stalled */
1400            state->m_galileo.dma_stalled_on_voodoo[which] = FALSE;
1400            m_galileo.dma_stalled_on_voodoo[which] = FALSE;
14011401
14021402            /* resume execution */
1403            state->galileo_perform_dma(space, which);
1403            galileo_perform_dma(space, which);
14041404            break;
14051405         }
14061406
14071407      /* if we finished all our pending DMAs, then we can resume CPU operations */
1408      if (!state->m_voodoo_stalled)
1408      if (!m_voodoo_stalled)
14091409      {
14101410         /* if the CPU had a pending write, do it now */
1411         if (state->m_cpu_stalled_on_voodoo)
1411         if (m_cpu_stalled_on_voodoo)
14121412         {
1413            address_space &space = device->machine().firstcpu->space(AS_PROGRAM);
1414            voodoo_w(device, space, state->m_cpu_stalled_offset, state->m_cpu_stalled_data, state->m_cpu_stalled_mem_mask);
1413            address_space &space = machine().firstcpu->space(AS_PROGRAM);
1414            voodoo_w(m_voodoo, space, m_cpu_stalled_offset, m_cpu_stalled_data, m_cpu_stalled_mem_mask);
14151415         }
1416         state->m_cpu_stalled_on_voodoo = FALSE;
1416         m_cpu_stalled_on_voodoo = FALSE;
14171417
14181418         /* resume CPU execution */
14191419         if (LOG_DMA) logerror("Resuming CPU on voodoo\n");
1420         device->machine().scheduler().trigger(45678);
1420         machine().scheduler().trigger(45678);
14211421      }
14221422   }
14231423}
r22608r22609
25182518   0,//                tmumem1;
25192519   "screen",//         screen;
25202520   "maincpu",//            cputag;
2521   vblank_assert,//    vblank;
2522   voodoo_stall,//             stall;
2521   DEVCB_DRIVER_LINE_MEMBER(seattle_state,vblank_assert),//    vblank;
2522   DEVCB_DRIVER_LINE_MEMBER(seattle_state,voodoo_stall)//             stall;
25232523};
25242524
25252525static MACHINE_CONFIG_START( seattle_common, seattle_state )
r22608r22609
25952595   4,//                tmumem1;
25962596   "screen",//         screen;
25972597   "maincpu",//            cputag;
2598   vblank_assert,//    vblank;
2599   voodoo_stall,//             stall;
2598   DEVCB_DRIVER_LINE_MEMBER(seattle_state,vblank_assert),//    vblank;
2599   DEVCB_DRIVER_LINE_MEMBER(seattle_state,voodoo_stall)//             stall;
26002600};
26012601
26022602static MACHINE_CONFIG_DERIVED( flagstaff, seattle_common )
trunk/src/mame/drivers/nwk-tr.c
r22608r22609
255255   DECLARE_WRITE32_MEMBER(lanc2_w);
256256   DECLARE_READ32_MEMBER(dsp_dataram_r);
257257   DECLARE_WRITE32_MEMBER(dsp_dataram_w);
258   DECLARE_WRITE_LINE_MEMBER(voodoo_vblank_0);
258259   DECLARE_DRIVER_INIT(nwktr);
259260   virtual void machine_start();
260261   virtual void machine_reset();
r22608r22609
278279   palette_set_color_rgb(machine(), offset, pal5bit(data >> 10), pal5bit(data >> 5), pal5bit(data >> 0));
279280}
280281
281static void voodoo_vblank_0(device_t *device, int param)
282WRITE_LINE_MEMBER(nwktr_state::voodoo_vblank_0)
282283{
283   nwktr_state *drvstate = device->machine().driver_data<nwktr_state>();
284   drvstate->m_maincpu->set_input_line(INPUT_LINE_IRQ0, param);
284   m_maincpu->set_input_line(INPUT_LINE_IRQ0, state);
285285}
286286
287287
r22608r22609
725725   2,//                tmumem1;
726726   "screen",//         screen;
727727   "dsp",//            cputag;
728   voodoo_vblank_0,//  vblank;
729   NULL,//             stall;
728   DEVCB_DRIVER_LINE_MEMBER(nwktr_state,voodoo_vblank_0),//  vblank;
729   DEVCB_NULL//             stall;
730730};
731731
732732static MACHINE_CONFIG_START( nwktr, nwktr_state )
trunk/src/mame/drivers/hornet.c
r22608r22609
372372   DECLARE_WRITE32_MEMBER(dsp_dataram0_w);
373373   DECLARE_READ32_MEMBER(dsp_dataram1_r);
374374   DECLARE_WRITE32_MEMBER(dsp_dataram1_w);
375   DECLARE_WRITE_LINE_MEMBER(voodoo_vblank_0);
376   DECLARE_WRITE_LINE_MEMBER(voodoo_vblank_1);
375377   DECLARE_DRIVER_INIT(hornet);
376378   DECLARE_DRIVER_INIT(hornet_2board);
377379   virtual void machine_start();
r22608r22609
433435   k037122_reg_w(k037122, space, offset, data, mem_mask);
434436}
435437
436static void voodoo_vblank_0(device_t *device, int param)
438WRITE_LINE_MEMBER(hornet_state::voodoo_vblank_0)
437439{
438   hornet_state *drvstate = device->machine().driver_data<hornet_state>();
439   drvstate->m_maincpu->set_input_line(INPUT_LINE_IRQ0, param);
440   m_maincpu->set_input_line(INPUT_LINE_IRQ0, state);
440441}
441442
442static void voodoo_vblank_1(device_t *device, int param)
443WRITE_LINE_MEMBER(hornet_state::voodoo_vblank_1)
443444{
444445}
445446
r22608r22609
10001001   0,//                tmumem1;
10011002   "screen",//         screen;
10021003   "dsp",//            cputag;
1003   voodoo_vblank_0,//  vblank;
1004   NULL,//             stall;
1004   DEVCB_DRIVER_LINE_MEMBER(hornet_state,voodoo_vblank_0),//  vblank;
1005   DEVCB_NULL//             stall;
10051006};
10061007
10071008static MACHINE_CONFIG_START( hornet, hornet_state )
r22608r22609
10791080   0,//                tmumem1;
10801081   "lscreen",//        screen;
10811082   "dsp",//            cputag;
1082   voodoo_vblank_0,//  vblank;
1083   NULL,//             stall;
1083   DEVCB_DRIVER_LINE_MEMBER(hornet_state,voodoo_vblank_0),//  vblank;
1084   DEVCB_NULL//             stall;
10841085};
10851086
10861087static const voodoo_config voodoo_r_intf =
r22608r22609
10901091   0,//                tmumem1;
10911092   "rscreen",//        screen;
10921093   "dsp2",//           cputag;
1093   voodoo_vblank_1,//  vblank;
1094   NULL,//             stall;
1094   DEVCB_DRIVER_LINE_MEMBER(hornet_state,voodoo_vblank_1),//  vblank;
1095   DEVCB_NULL//             stall;
10951096};
10961097
10971098static MACHINE_CONFIG_DERIVED( hornet_2board, hornet )
trunk/src/mame/drivers/sfcbox.c
r22608r22609
435435
436436void sfcbox_state::machine_start()
437437{
438   MACHINE_START_CALL_LEGACY(snes);
438   snes_state::machine_start();
439439
440440   m_is_sfcbox = 1;
441441}
442442
443443void sfcbox_state::machine_reset()
444444{
445   MACHINE_RESET_CALL_LEGACY( snes );
445   snes_state::machine_reset();
446446
447447   /* start with both CPUs disabled */
448448   m_maincpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
trunk/src/mame/drivers/nss.c
r22608r22609
621621
622622void nss_state::machine_start()
623623{
624   MACHINE_START_CALL_LEGACY(snes);
624   snes_state::machine_start();
625625
626626   m_is_nss = 1;
627627   m_wram = auto_alloc_array_clear(machine(), UINT8, 0x1000);
r22608r22609
796796
797797void nss_state::machine_reset()
798798{
799   MACHINE_RESET_CALL_LEGACY( snes );
799   snes_state::machine_reset();
800800
801801   /* start with both CPUs disabled */
802802   m_maincpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
trunk/src/mame/machine/snes.c
r22608r22609
992992
993993*************************************/
994994
995static void snes_init_timers( running_machine &machine )
995void snes_state::snes_init_timers()
996996{
997   snes_state *state = machine.driver_data<snes_state>();
998
999997   /* init timers and stop them */
1000   state->m_scanline_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(snes_state::snes_scanline_tick),state));
1001   state->m_scanline_timer->adjust(attotime::never);
1002   state->m_hblank_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(snes_state::snes_hblank_tick),state));
1003   state->m_hblank_timer->adjust(attotime::never);
1004   state->m_nmi_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(snes_state::snes_nmi_tick),state));
1005   state->m_nmi_timer->adjust(attotime::never);
1006   state->m_hirq_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(snes_state::snes_hirq_tick_callback),state));
1007   state->m_hirq_timer->adjust(attotime::never);
1008   //state->m_div_timer = machine.scheduler().timer_alloc(FUNC(snes_div_callback));
1009   //state->m_div_timer->adjust(attotime::never);
1010   //state->m_mult_timer = machine.scheduler().timer_alloc(FUNC(snes_mult_callback));
1011   //state->m_mult_timer->adjust(attotime::never);
1012   state->m_io_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(snes_state::snes_update_io),state));
1013   state->m_io_timer->adjust(attotime::never);
998   m_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(snes_state::snes_scanline_tick),this));
999   m_scanline_timer->adjust(attotime::never);
1000   m_hblank_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(snes_state::snes_hblank_tick),this));
1001   m_hblank_timer->adjust(attotime::never);
1002   m_nmi_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(snes_state::snes_nmi_tick),this));
1003   m_nmi_timer->adjust(attotime::never);
1004   m_hirq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(snes_state::snes_hirq_tick_callback),this));
1005   m_hirq_timer->adjust(attotime::never);
1006   //m_div_timer = machine().scheduler().timer_alloc(FUNC(snes_div_callback));
1007   //m_div_timer->adjust(attotime::never);
1008   //m_mult_timer = machine().scheduler().timer_alloc(FUNC(snes_mult_callback));
1009   //m_mult_timer->adjust(attotime::never);
1010   m_io_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(snes_state::snes_update_io),this));
1011   m_io_timer->adjust(attotime::never);
10141012
10151013   // SNES hcounter has a 0-339 range.  hblank starts at counter 260.
10161014   // clayfighter sets an HIRQ at 260, apparently it wants it to be before hdma kicks off, so we'll delay 2 pixels.
1017   state->m_hblank_offset = 274;
1018   state->m_hblank_timer->adjust(machine.primary_screen->time_until_pos(((state->m_ppu.m_stat78 & 0x10) == SNES_NTSC) ? SNES_VTOTAL_NTSC - 1 : SNES_VTOTAL_PAL - 1, state->m_hblank_offset));
1015   m_hblank_offset = 274;
1016   m_hblank_timer->adjust(machine().primary_screen->time_until_pos(((m_ppu.m_stat78 & 0x10) == SNES_NTSC) ? SNES_VTOTAL_NTSC - 1 : SNES_VTOTAL_PAL - 1, m_hblank_offset));
10191017}
10201018
10211019void snes_state::snes_init_ram()
r22608r22609
10511049      m_ppu.m_beam.current_vert = SNES_VTOTAL_PAL;
10521050}
10531051
1054MACHINE_START( snes )
1052void snes_state::machine_start()
10551053{
1056   snes_state *state = machine.driver_data<snes_state>();
10571054   // power-on sets these registers like this
1058   SNES_CPU_REG_STATE(WRIO) = 0xff;
1059//  SNES_CPU_REG_STATE(WRMPYA) = 0xff;
1060//  SNES_CPU_REG_STATE(WRDIVL) = 0xff;
1061//  SNES_CPU_REG_STATE(WRDIVH) = 0xff;
1055   SNES_CPU_REG(WRIO) = 0xff;
1056//  SNES_CPU_REG(WRMPYA) = 0xff;
1057//  SNES_CPU_REG(WRDIVL) = 0xff;
1058//  SNES_CPU_REG(WRDIVH) = 0xff;
10621059
1063   snes_init_timers(machine);
1060   snes_init_timers();
10641061
10651062   for (int i = 0; i < 6; i++)
10661063   {
1067      state_save_register_item(machine, "snes_dma", NULL, i, state->m_dma_channel[i].dmap);
1068      state_save_register_item(machine, "snes_dma", NULL, i, state->m_dma_channel[i].dest_addr);
1069      state_save_register_item(machine, "snes_dma", NULL, i, state->m_dma_channel[i].src_addr);
1070      state_save_register_item(machine, "snes_dma", NULL, i, state->m_dma_channel[i].bank);
1071      state_save_register_item(machine, "snes_dma", NULL, i, state->m_dma_channel[i].trans_size);
1072      state_save_register_item(machine, "snes_dma", NULL, i, state->m_dma_channel[i].ibank);
1073      state_save_register_item(machine, "snes_dma", NULL, i, state->m_dma_channel[i].hdma_addr);
1074      state_save_register_item(machine, "snes_dma", NULL, i, state->m_dma_channel[i].hdma_line_counter);
1075      state_save_register_item(machine, "snes_dma", NULL, i, state->m_dma_channel[i].unk);
1076      state_save_register_item(machine, "snes_dma", NULL, i, state->m_dma_channel[i].do_transfer);
1077      state_save_register_item(machine, "snes_dma", NULL, i, state->m_dma_channel[i].dma_disabled);
1064      state_save_register_item(machine(), "snes_dma", NULL, i, m_dma_channel[i].dmap);
1065      state_save_register_item(machine(), "snes_dma", NULL, i, m_dma_channel[i].dest_addr);
1066      state_save_register_item(machine(), "snes_dma", NULL, i, m_dma_channel[i].src_addr);
1067      state_save_register_item(machine(), "snes_dma", NULL, i, m_dma_channel[i].bank);
1068      state_save_register_item(machine(), "snes_dma", NULL, i, m_dma_channel[i].trans_size);
1069      state_save_register_item(machine(), "snes_dma", NULL, i, m_dma_channel[i].ibank);
1070      state_save_register_item(machine(), "snes_dma", NULL, i, m_dma_channel[i].hdma_addr);
1071      state_save_register_item(machine(), "snes_dma", NULL, i, m_dma_channel[i].hdma_line_counter);
1072      state_save_register_item(machine(), "snes_dma", NULL, i, m_dma_channel[i].unk);
1073      state_save_register_item(machine(), "snes_dma", NULL, i, m_dma_channel[i].do_transfer);
1074      state_save_register_item(machine(), "snes_dma", NULL, i, m_dma_channel[i].dma_disabled);
10781075   }
10791076
1080   state->save_item(NAME(state->m_hblank_offset));
1081   state->save_item(NAME(state->m_wram_address));
1082   state->save_item(NAME(state->m_htime));
1083   state->save_item(NAME(state->m_vtime));
1084   state->save_item(NAME(state->m_hdmaen));
1085   state->save_item(NAME(state->m_data1));
1086   state->save_item(NAME(state->m_data2));
1087   state->save_item(NAME(state->m_read_idx));
1088   state->save_item(NAME(state->m_dma_regs));
1089   state->save_item(NAME(state->m_cpu_regs));
1090   state->save_item(NAME(state->m_oldjoy1_latch));
1077   save_item(NAME(m_hblank_offset));
1078   save_item(NAME(m_wram_address));
1079   save_item(NAME(m_htime));
1080   save_item(NAME(m_vtime));
1081   save_item(NAME(m_hdmaen));
1082   save_item(NAME(m_data1));
1083   save_item(NAME(m_data2));
1084   save_item(NAME(m_read_idx));
1085   save_item(NAME(m_dma_regs));
1086   save_item(NAME(m_cpu_regs));
1087   save_item(NAME(m_oldjoy1_latch));
10911088
10921089   for (int i = 0; i < 2; i++)
10931090   {
1094      state_save_register_item(machine, "snes_dma", NULL, i, state->m_joypad[i].buttons);
1095      state_save_register_item(machine, "snes_dma", NULL, i, state->m_mouse[i].x);
1096      state_save_register_item(machine, "snes_dma", NULL, i, state->m_mouse[i].oldx);
1097      state_save_register_item(machine, "snes_dma", NULL, i, state->m_mouse[i].y);
1098      state_save_register_item(machine, "snes_dma", NULL, i, state->m_mouse[i].oldy);
1099      state_save_register_item(machine, "snes_dma", NULL, i, state->m_mouse[i].buttons);
1100      state_save_register_item(machine, "snes_dma", NULL, i, state->m_mouse[i].deltax);
1101      state_save_register_item(machine, "snes_dma", NULL, i, state->m_mouse[i].deltay);
1102      state_save_register_item(machine, "snes_dma", NULL, i, state->m_mouse[i].speed);
1103      state_save_register_item(machine, "snes_dma", NULL, i, state->m_scope[i].x);
1104      state_save_register_item(machine, "snes_dma", NULL, i, state->m_scope[i].y);
1105      state_save_register_item(machine, "snes_dma", NULL, i, state->m_scope[i].buttons);
1106      state_save_register_item(machine, "snes_dma", NULL, i, state->m_scope[i].turbo_lock);
1107      state_save_register_item(machine, "snes_dma", NULL, i, state->m_scope[i].pause_lock);
1108      state_save_register_item(machine, "snes_dma", NULL, i, state->m_scope[i].fire_lock);
1109      state_save_register_item(machine, "snes_dma", NULL, i, state->m_scope[i].offscreen);
1091      state_save_register_item(machine(), "snes_dma", NULL, i, m_joypad[i].buttons);
1092      state_save_register_item(machine(), "snes_dma", NULL, i, m_mouse[i].x);
1093      state_save_register_item(machine(), "snes_dma", NULL, i, m_mouse[i].oldx);
1094      state_save_register_item(machine(), "snes_dma", NULL, i, m_mouse[i].y);
1095      state_save_register_item(machine(), "snes_dma", NULL, i, m_mouse[i].oldy);
1096      state_save_register_item(machine(), "snes_dma", NULL, i, m_mouse[i].buttons);
1097      state_save_register_item(machine(), "snes_dma", NULL, i, m_mouse[i].deltax);
1098      state_save_register_item(machine(), "snes_dma", NULL, i, m_mouse[i].deltay);
1099      state_save_register_item(machine(), "snes_dma", NULL, i, m_mouse[i].speed);
1100      state_save_register_item(machine(), "snes_dma", NULL, i, m_scope[i].x);
1101      state_save_register_item(machine(), "snes_dma", NULL, i, m_scope[i].y);
1102      state_save_register_item(machine(), "snes_dma", NULL, i, m_scope[i].buttons);
1103      state_save_register_item(machine(), "snes_dma", NULL, i, m_scope[i].turbo_lock);
1104      state_save_register_item(machine(), "snes_dma", NULL, i, m_scope[i].pause_lock);
1105      state_save_register_item(machine(), "snes_dma", NULL, i, m_scope[i].fire_lock);
1106      state_save_register_item(machine(), "snes_dma", NULL, i, m_scope[i].offscreen);
11101107   }
11111108
1112   state->m_is_nss = 0;
1113   state->m_is_sfcbox = 0;
1109   m_is_nss = 0;
1110   m_is_sfcbox = 0;
11141111}
11151112
1116MACHINE_RESET( snes )
1113void snes_state::machine_reset()
11171114{
1118   snes_state *state = machine.driver_data<snes_state>();
11191115   int i;
11201116
1121   state->snes_init_ram();
1117   snes_init_ram();
11221118
11231119   /* init DMA regs to be 0xff */
11241120   for(i = 0; i < 8; i++)
11251121   {
1126      state->m_dma_channel[i].dmap = 0xff;
1127      state->m_dma_channel[i].dest_addr = 0xff;
1128      state->m_dma_channel[i].src_addr = 0xffff;
1129      state->m_dma_channel[i].bank = 0xff;
1130      state->m_dma_channel[i].trans_size = 0xffff;
1131      state->m_dma_channel[i].ibank = 0xff;
1132      state->m_dma_channel[i].hdma_addr = 0xffff;
1133      state->m_dma_channel[i].hdma_line_counter = 0xff;
1134      state->m_dma_channel[i].unk = 0xff;
1122      m_dma_channel[i].dmap = 0xff;
1123      m_dma_channel[i].dest_addr = 0xff;
1124      m_dma_channel[i].src_addr = 0xffff;
1125      m_dma_channel[i].bank = 0xff;
1126      m_dma_channel[i].trans_size = 0xffff;
1127      m_dma_channel[i].ibank = 0xff;
1128      m_dma_channel[i].hdma_addr = 0xffff;
1129      m_dma_channel[i].hdma_line_counter = 0xff;
1130      m_dma_channel[i].unk = 0xff;
11351131   }
11361132
11371133   /* Set STAT78 to NTSC or PAL */
1138   if (ATTOSECONDS_TO_HZ(machine.primary_screen->frame_period().attoseconds) >= 59.0f)
1139      state->m_ppu.m_stat78 = SNES_NTSC;
1134   if (ATTOSECONDS_TO_HZ(machine().primary_screen->frame_period().attoseconds) >= 59.0f)
1135      m_ppu.m_stat78 = SNES_NTSC;
11401136   else /* if (ATTOSECONDS_TO_HZ(machine.primary_screen->frame_period().attoseconds) == 50.0f) */
1141      state->m_ppu.m_stat78 = SNES_PAL;
1137      m_ppu.m_stat78 = SNES_PAL;
11421138
11431139   // reset does this to these registers
1144   SNES_CPU_REG_STATE(NMITIMEN) = 0;
1145   state->m_htime = 0x1ff;
1146   state->m_vtime = 0x1ff;
1140   SNES_CPU_REG(NMITIMEN) = 0;
1141   m_htime = 0x1ff;
1142   m_vtime = 0x1ff;
11471143
1148   state->m_ppu.m_htmult = 1;
1149   state->m_ppu.m_interlace = 1;
1150   state->m_ppu.m_obj_interlace = 1;
1144   m_ppu.m_htmult = 1;
1145   m_ppu.m_interlace = 1;
1146   m_ppu.m_obj_interlace = 1;
11511147}
11521148
11531149
trunk/src/mame/video/astrocde.c
r22608r22609
1010#include "sound/astrocde.h"
1111#include "video/resnet.h"
1212
13/*************************************
14 *
15 *  Machine setup
16 *
17 *************************************/
1318
19void astrocde_state::machine_start()
20{
21   state_save_register_global(machine(), m_port_1_last);
22   state_save_register_global(machine(), m_port_2_last);
23   state_save_register_global(machine(), m_ram_write_enable);
24   state_save_register_global(machine(), m_input_select);
25   state_save_register_global(machine(), m_profpac_bank);
1426
27   m_port_1_last = m_port_2_last = 0xff;
28}
29
30
31
1532/*************************************
1633 *
1734 *  Constants
trunk/src/mame/includes/astrocde.h
r22608r22609
135135   inline void increment_dest(UINT8 curwidth);
136136   void execute_blit(address_space &space);
137137   void init_sparklestar();
138   virtual void machine_start();
138139   required_device<cpu_device> m_maincpu;
139140   optional_device<cpu_device> m_subcpu;
140141   optional_device<samples_device> m_samples;
trunk/src/mame/includes/snes.h
r22608r22609
364364
365365
366366#define SNES_CPU_REG(a) m_cpu_regs[a - 0x4200]  // regs 0x4200-0x421f
367#define SNES_CPU_REG_STATE(a) state->m_cpu_regs[a - 0x4200] // regs 0x4200-0x421f
368367
369368/* (PPU) Video related */
370369
r22608r22609
703702   DECLARE_DEVICE_IMAGE_LOAD_MEMBER(snes_cart);
704703   DECLARE_DEVICE_IMAGE_LOAD_MEMBER(sufami_cart);
705704   virtual void video_start();
705   void snes_init_timers();
706   virtual void machine_start();
707   virtual void machine_reset();
706708};
707709
708710/* Special chips, checked at init and used in memory handlers */
r22608r22609
748750   SNES_COLOR
749751};
750752
751/*----------- defined in machine/snes.c -----------*/
752
753
754extern MACHINE_START( snes );
755extern MACHINE_RESET( snes );
756
757753DECLARE_READ8_HANDLER( snes_open_bus_r );
758754
759755#endif /* _SNES_H_ */

Previous 199869 Revisions Next


© 1997-2024 The MAME Team