Previous 199869 Revisions Next

r20544 Sunday 27th January, 2013 at 18:55:55 UTC by David Haywood
some mpu4.c tagmap reduction (nw)
[src/mame/drivers]mpu4hw.c mpu4vid.c
[src/mame/includes]mpu4.h

trunk/src/mame/drivers/mpu4hw.c
r20543r20544
462462
463463      int numbanks = romsize / 0x10000;
464464
465      membank("bank1")->configure_entries(0, 8, &rom[0x01000], 0x10000);
465      m_bank1->configure_entries(0, 8, &rom[0x01000], 0x10000);
466466
467467      // some Bwb games must default to the last bank, does anything not like this
468468      // behavior?
469469      // some Bwb games don't work anyway tho, they seem to dislike something else
470470      // about the way the regular banking behaves, not related to the CB2 stuff
471      membank("bank1")->set_entry(numbanks-1);
471      m_bank1->set_entry(numbanks-1);
472472
473      machine().device("maincpu")->reset();
473      m_maincpu->reset();
474474   }
475475}
476476
r20543r20544
515515
516516   // m_pageset is never even set??
517517   m_pageval = (data & 0x03);
518   membank("bank1")->set_entry((m_pageval + (m_pageset ? 4 : 0)) & 0x07);
518   m_bank1->set_entry((m_pageval + (m_pageset ? 4 : 0)) & 0x07);
519519}
520520
521521
522522READ8_MEMBER(mpu4_state::bankswitch_r)
523523{
524   return membank("bank1")->entry();
524   return m_bank1->entry();
525525}
526526
527527
r20543r20544
532532   // m_pageset is never even set??
533533
534534   m_pageval = (data - 2);//writes 2 and 3, to represent 0 and 1 - a hangover from the half page design?
535   membank("bank1")->set_entry((m_pageval + (m_pageset ? 4 : 0)) & 0x07);
535   m_bank1->set_entry((m_pageval + (m_pageset ? 4 : 0)) & 0x07);
536536}
537537
538538
r20543r20544
782782
783783READ8_MEMBER(mpu4_state::pia_ic4_portb_r)
784784{
785   pia6821_device *pia = machine().device<pia6821_device>("pia_ic4");
785   pia6821_device *pia = m_pia4;
786786   if ( m_serial_data )
787787   {
788788      m_ic4_input_b |=  0x80;
r20543r20544
897897   }
898898   LOG(("%s: IC5 PIA Read of Port A (AUX1)\n",machine().describe_context()));
899899
900   return machine().root_device().ioport("AUX1")->read()|m_aux1_input;
900   return m_aux1_port->read()|m_aux1_input;
901901}
902902
903903WRITE8_MEMBER(mpu4_state::pia_ic5_porta_w)
904904{
905905   int i;
906906   mpu4_state *state = machine().driver_data<mpu4_state>();
907   pia6821_device *pia_ic4 = machine().device<pia6821_device>("pia_ic4");
907   pia6821_device *pia_ic4 = m_pia4;
908908   if (m_hopper == HOPPER_NONDUART_A)
909909   {
910910      //hopper1_drive_sensor(data&0x10);
r20543r20544
10841084   coin_lockout_w(machine(), 1, (pia_ic5->b_output() & 0x02) );
10851085   coin_lockout_w(machine(), 2, (pia_ic5->b_output() & 0x04) );
10861086   coin_lockout_w(machine(), 3, (pia_ic5->b_output() & 0x08) );
1087   return machine().root_device().ioport("AUX2")->read() | m_aux2_input;
1087   return m_aux2_port->read() | m_aux2_input;
10881088}
10891089
10901090
r20543r20544
13821382/* IC8, Inputs, TRIACS, alpha clock */
13831383READ8_MEMBER(mpu4_state::pia_ic8_porta_r)
13841384{
1385   static const char *const portnames[] = { "ORANGE1", "ORANGE2", "BLACK1", "BLACK2", "ORANGE1", "ORANGE2", "DIL1", "DIL2" };
1386   pia6821_device *pia_ic5 = machine().device<pia6821_device>("pia_ic5");
1385   ioport_port * portnames[] = { m_orange1_port, m_orange2_port, m_black1_port, m_black2_port, m_orange1_port, m_orange2_port, m_dil1_port, m_dil2_port };
13871386
13881387   LOG_IC8(("%s: IC8 PIA Read of Port A (MUX input data)\n", machine().describe_context()));
13891388/* The orange inputs are polled twice as often as the black ones, for reasons of efficiency.
13901389   This is achieved via connecting every input line to an AND gate, thus allowing two strobes
13911390   to represent each orange input bank (strobes are active low). */
1392   pia_ic5->cb1_w(machine().root_device().ioport("AUX2")->read() & 0x80);
1393   return machine().root_device().ioport(portnames[m_input_strobe])->read();
1391   m_pia5->cb1_w(m_aux2_port->read() & 0x80);
1392   return (portnames[m_input_strobe])->read();
13941393}
13951394
13961395
r20543r20544
14581457// Sampled sound card, using a PIA and PTM for timing and data handling
14591458WRITE8_MEMBER(mpu4_state::pia_gb_porta_w)
14601459{
1461   device_t *msm6376 = machine().device("msm6376");
14621460   LOG_SS(("%s: GAMEBOARD: PIA Port A Set to %2x\n", machine().describe_context(),data));
1463   okim6376_w(msm6376, space, 0, data);
1461   okim6376_w(m_msm6376, space, 0, data);
14641462}
14651463
14661464WRITE8_MEMBER(mpu4_state::pia_gb_portb_w)
14671465{
1468   device_t *msm6376 = machine().device("msm6376");
1469   okim6376_device *msm = machine().device<okim6376_device>("msm6376");
1470
14711466   int changed = m_expansion_latch^data;
14721467
14731468   LOG_SS(("%s: GAMEBOARD: PIA Port B Set to %2x\n", machine().describe_context(),data));
r20543r20544
14871482
14881483         {
14891484            float percent = (32-m_global_volume)/32.0;
1490            msm->set_output_gain(0, percent);
1491            msm->set_output_gain(1, percent);
1485            m_msm6376->set_output_gain(0, percent);
1486            m_msm6376->set_output_gain(1, percent);
14921487         }
14931488      }
14941489   }
1495   okim6376_ch2_w(msm6376,data&0x02);
1496   okim6376_st_w(msm6376,data&0x01);
1490   okim6376_ch2_w(m_msm6376,data&0x02);
1491   okim6376_st_w(m_msm6376,data&0x01);
14971492}
14981493READ8_MEMBER(mpu4_state::pia_gb_portb_r)
14991494{
1500   device_t *msm6376 = machine().device("msm6376");
15011495   LOG_SS(("%s: GAMEBOARD: PIA Read of Port B\n",machine().describe_context()));
15021496   int data=0;
15031497   // b7 NAR - we can load another address into Channel 1
r20543r20544
15061500   // b4, 1 = Vol down, 0 = Vol up
15071501   //
15081502
1509   if ( okim6376_nar_r(msm6376) ) data |= 0x80;
1503   if ( okim6376_nar_r(m_msm6376) ) data |= 0x80;
15101504   else                           data &= ~0x80;
15111505
1512   if ( okim6376_busy_r(msm6376) ) data |= 0x40;
1506   if ( okim6376_busy_r(m_msm6376) ) data |= 0x40;
15131507   else                            data &= ~0x40;
15141508
15151509   return ( data | m_expansion_latch );
r20543r20544
15291523   {
15301524      //printf("pia_gb_cb2_w %d\n", state);
15311525      m_pageval = state;
1532      membank("bank1")->set_entry((m_pageval + (m_pageset ? 4 : 0)) & 0x07);
1526      m_bank1->set_entry((m_pageval + (m_pageset ? 4 : 0)) & 0x07);
15331527   }
15341528}
15351529
r20543r20544
15891583{
15901584   device_t *ic3ss = machine().device("ptm_ic3ss");
15911585   downcast<ptm6840_device *>(ic3ss)->write(offset,data);
1592   device_t *msm6376 = machine().device("msm6376");
15931586
15941587   if (offset == 3)
15951588   {
r20543r20544
16121605
16131606   if (freq)
16141607   {
1615      okim6376_set_frequency(msm6376, freq);
1608      okim6376_set_frequency(m_msm6376, freq);
16161609   }
16171610}
16181611
r20543r20544
17741767   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_SPECIAL)
17751768   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_SPECIAL)
17761769   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_SPECIAL)
1777   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("10p")PORT_IMPULSE(5)
1778   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("20p")PORT_IMPULSE(5)
1779   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("50p")PORT_IMPULSE(5)
1780   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("100p")PORT_IMPULSE(5)
1770   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("10p")//PORT_IMPULSE(5)
1771   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("20p")//PORT_IMPULSE(5)
1772   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("50p")//PORT_IMPULSE(5)
1773   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("100p")//PORT_IMPULSE(5)
17811774INPUT_PORTS_END
17821775
17831776INPUT_PORTS_START( mpu4jackpot8tkn )
r20543r20544
19931986   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_SPECIAL)
19941987   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_SPECIAL)
19951988   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_SPECIAL)
1996   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("10p")PORT_IMPULSE(5)
1997   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("20p")PORT_IMPULSE(5)
1998   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("50p")PORT_IMPULSE(5)
1999   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("100p")PORT_IMPULSE(5)
1989   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("10p")//PORT_IMPULSE(5)
1990   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("20p")//PORT_IMPULSE(5)
1991   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("50p")//PORT_IMPULSE(5)
1992   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("100p")//PORT_IMPULSE(5)
20001993INPUT_PORTS_END
20011994
20021995static const stepper_interface barcrest_reel_interface =
r20543r20544
23322325   mpu4_state *state = machine.driver_data<mpu4_state>();
23332326   state->m_ic24_timer = machine.scheduler().timer_alloc(FUNC(ic24_timeout));
23342327   state->m_lamp_strobe_ext_persistence = 0;
2328
23352329   /* setup 8 mechanical meters */
23362330   MechMtr_config(machine,8);
23372331
r20543r20544
26652659   falling edges of the pulse are used means the timer actually gives a 100Hz
26662660   oscillating signal.*/
26672661   m_signal_50hz = m_signal_50hz?0:1;
2668   machine().device<pia6821_device>("pia_ic4")->ca1_w(m_signal_50hz);  /* signal is connected to IC4 CA1 */
2662   m_pia4->ca1_w(m_signal_50hz);  /* signal is connected to IC4 CA1 */
26692663
26702664   update_meters(this);//run at 100Hz to sync with PIAs
26712665}
trunk/src/mame/drivers/mpu4vid.c
r20543r20544
218218public:
219219   mpu4vid_state(const machine_config &mconfig, device_type type, const char *tag)
220220      : mpu4_state(mconfig, type, tag),
221      m_videocpu(*this, "video"),
221222      m_scn2674(*this, "scn2674_vid"),
222223      m_vid_vidram(*this, "vid_vidram"),
223      m_vid_mainram(*this, "vid_mainram")
224      m_vid_mainram(*this, "vid_mainram"),
225      m_acia_0(*this, "acia6850_0"),
226      m_acia_1(*this, "acia6850_1"),
227      m_ptm(*this, "6840ptm_68k")
224228   {
225229   }
226230
231   required_device<cpu_device> m_videocpu;
227232   optional_device<scn2674_device> m_scn2674;
228233   optional_shared_ptr<UINT16> m_vid_vidram;
229234   optional_shared_ptr<UINT16> m_vid_mainram;
235   required_device<acia6850_device> m_acia_0;
236   required_device<acia6850_device> m_acia_1;
237   required_device<ptm6840_device> m_ptm;
230238
231239   struct ef9369_t m_pal;
232240   struct bt471_t m_bt471;
r20543r20544
425433
426434WRITE8_MEMBER(mpu4vid_state::vid_o1_callback)
427435{
428   downcast<ptm6840_device *>(machine().device("6840ptm_68k"))->set_c2(data); /* this output is the clock for timer2 */
436   m_ptm->set_c2(data); /* this output is the clock for timer2 */
429437
430438   if (data)
431439   {
432      acia6850_device *acia_0 = machine().device<acia6850_device>("acia6850_0");
433      acia6850_device *acia_1 = machine().device<acia6850_device>("acia6850_1");
434      acia_0->tx_clock_in();
435      acia_0->rx_clock_in();
436      acia_1->tx_clock_in();
437      acia_1->rx_clock_in();
440      m_acia_0->tx_clock_in();
441      m_acia_0->rx_clock_in();
442      m_acia_1->tx_clock_in();
443      m_acia_1->rx_clock_in();
438444   }
439445}
440446
441447
442448WRITE8_MEMBER(mpu4vid_state::vid_o2_callback)
443449{
444   downcast<ptm6840_device *>(machine().device("6840ptm_68k"))->set_c3(data); /* this output is the clock for timer3 */
450   m_ptm->set_c3(data); /* this output is the clock for timer3 */
445451}
446452
447453
448454WRITE8_MEMBER(mpu4vid_state::vid_o3_callback)
449455{
450   downcast<ptm6840_device *>(machine().device("6840ptm_68k"))->set_c1(data); /* this output is the clock for timer1 */
456   m_ptm->set_c1(data); /* this output is the clock for timer1 */
451457}
452458
453459
r20543r20544
13521358
13531359static void video_reset(device_t *device)
13541360{
1355   device->machine().device("6840ptm_68k")->reset();
1356   device->machine().device("acia6850_1")->reset();
1361   mpu4vid_state *state = device->machine().driver_data<mpu4vid_state>();
1362   state->m_ptm->reset();
1363   state->m_acia_1->reset();
13571364}
13581365
13591366/* machine start (called only once) */
trunk/src/mame/includes/mpu4.h
r20543r20544
9494public:
9595   mpu4_state(const machine_config &mconfig, device_type type, const char *tag)
9696      : driver_device(mconfig, type, tag),
97         m_maincpu(*this, "maincpu"),
9798         m_vfd(*this, "vfd"),
9899         m_6840ptm(*this, "ptm_ic2"),
99100         m_pia3(*this, "pia_ic3"),
r20543r20544
101102         m_pia5(*this, "pia_ic5"),
102103         m_pia6(*this, "pia_ic6"),
103104         m_pia7(*this, "pia_ic7"),
104         m_pia8(*this, "pia_ic8")
105         { }
105         m_pia8(*this, "pia_ic8"),
106         m_orange1_port(*this, "ORANGE1"),
107         m_orange2_port(*this, "ORANGE2"),
108         m_black1_port(*this, "BLACK1"),
109         m_black2_port(*this, "BLACK2"),
110         m_dil1_port(*this, "DIL1"),
111         m_dil2_port(*this, "DIL2"),
112         m_aux1_port(*this, "AUX1"),
113         m_aux2_port(*this, "AUX2"),
114         m_bank1(*this, "bank1"),
115         m_msm6376(*this, "msm6376")
116   {}
106117
118
119
107120   UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
108121   {
109122      return 0;
110123   }
124   required_device<cpu_device> m_maincpu;
111125   optional_device<roc10937_t> m_vfd;
112126   optional_device<ptm6840_device> m_6840ptm;
113127   optional_device<pia6821_device> m_pia3;
r20543r20544
116130   optional_device<pia6821_device> m_pia6;
117131   optional_device<pia6821_device> m_pia7;
118132   optional_device<pia6821_device> m_pia8;
133   required_ioport m_orange1_port;
134   required_ioport m_orange2_port;
135   required_ioport m_black1_port;
136   required_ioport m_black2_port;
137   required_ioport m_dil1_port;
138   required_ioport m_dil2_port;
139   required_ioport m_aux1_port;
140   required_ioport m_aux2_port;
141   optional_memory_bank m_bank1;
142   optional_device<okim6376_device> m_msm6376;
143
144
119145   int m_mod_number;
120146   int m_mmtr_data;
121147   int m_alpha_data_line;

Previous 199869 Revisions Next


© 1997-2024 The MAME Team