summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/aristmk4.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/drivers/aristmk4.cpp')
-rw-r--r--src/mame/drivers/aristmk4.cpp214
1 files changed, 106 insertions, 108 deletions
diff --git a/src/mame/drivers/aristmk4.cpp b/src/mame/drivers/aristmk4.cpp
index a2ff4bc9606..fd36775d135 100644
--- a/src/mame/drivers/aristmk4.cpp
+++ b/src/mame/drivers/aristmk4.cpp
@@ -378,6 +378,13 @@ public:
void init_aristmk4();
private:
+ enum
+ {
+ TIMER_POWER_FAIL
+ };
+
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
+
required_device<cpu_device> m_maincpu;
required_device<mc146818_device> m_rtc;
required_device<ay8910_device> m_ay1;
@@ -409,6 +416,8 @@ private:
int m_insnote;
int m_cashcade_c;
int m_printer_motor;
+ emu_timer *m_power_timer;
+
DECLARE_READ8_MEMBER(ldsw);
DECLARE_READ8_MEMBER(cgdrr);
DECLARE_WRITE8_MEMBER(cgdrw);
@@ -442,17 +451,17 @@ private:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(aristmk4);
- DECLARE_PALETTE_INIT(lions);
+ void aristmk4_palette(palette_device &palette);
+ void lions_palette(palette_device &palette);
uint32_t screen_update_aristmk4(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(note_input_reset);
TIMER_CALLBACK_MEMBER(coin_input_reset);
TIMER_CALLBACK_MEMBER(hopper_reset);
- TIMER_DEVICE_CALLBACK_MEMBER(aristmk4_pf);
+ void power_fail();
inline void uBackgroundColour();
- void aristmk4_map(address_map &map);
- void aristmk4_poker_map(address_map &map);
+ void slots_mem(address_map &map);
+ void poker_mem(address_map &map);
};
/* Partial Cashcade protocol */
@@ -1016,7 +1025,7 @@ ADDRESS MAP - SLOT GAMES
******************************************************************************/
-void aristmk4_state::aristmk4_map(address_map &map)
+void aristmk4_state::slots_mem(address_map &map)
{
map(0x0000, 0x07ff).ram().share("mkiv_vram"); // video ram - chips U49 / U50
map(0x0800, 0x17ff).ram();
@@ -1061,7 +1070,7 @@ The graphics rom is mapped from 0x4000 - 0x4fff
The U87 personality rom is not required, therefore game rom code mapping is from 0x8000-0xffff
*/
-void aristmk4_state::aristmk4_poker_map(address_map &map)
+void aristmk4_state::poker_mem(address_map &map)
{
map(0x0000, 0x07ff).ram().share("mkiv_vram"); // video ram - chips U49 / U50
map(0x0800, 0x17ff).ram();
@@ -1692,29 +1701,18 @@ READ8_MEMBER(aristmk4_state::pc1_r)
}
/* same as Casino Winner HW */
-PALETTE_INIT_MEMBER(aristmk4_state, aristmk4)
+void aristmk4_state::aristmk4_palette(palette_device &palette)
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- for (i = 0;i < palette.entries();i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- int bit0,bit1,bit2,r,g,b;
-
- bit0 = (color_prom[0] >> 0) & 0x01;
- bit1 = (color_prom[0] >> 1) & 0x01;
- b = 0x4f * bit0 + 0xa8 * bit1;
- bit0 = (color_prom[0] >> 2) & 0x01;
- bit1 = (color_prom[0] >> 3) & 0x01;
- bit2 = (color_prom[0] >> 4) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- bit0 = (color_prom[0] >> 5) & 0x01;
- bit1 = (color_prom[0] >> 6) & 0x01;
- bit2 = (color_prom[0] >> 7) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ const uint8_t data = color_prom[i];
+ const int b = 0x4f * BIT(data, 0) + 0xa8 * BIT(data, 1);
+ const int g = 0x21 * BIT(data, 2) + 0x47 * BIT(data, 3) + 0x97 * BIT(data, 4);
+ const int r = 0x21 * BIT(data, 5) + 0x47 * BIT(data, 6) + 0x97 * BIT(data, 7);
palette.set_pen_color(i, rgb_t(r, g, b));
- color_prom++;
}
}
@@ -1732,6 +1730,7 @@ void aristmk4_state::machine_start()
m_credit_out_meter.resolve();
m_hopper_motor_out.resolve();
m_lamps.resolve();
+ m_power_timer = timer_alloc(TIMER_POWER_FAIL);
}
void aristmk4_state::machine_reset()
@@ -1746,9 +1745,20 @@ void aristmk4_state::machine_reset()
m_maincpu->set_unscaled_clock(MAIN_CLOCK/8); // 1.5 MHz
break;
}
+
+ m_power_timer->adjust(attotime::from_hz(1), 0, attotime::from_hz(1));
}
-TIMER_DEVICE_CALLBACK_MEMBER(aristmk4_state::aristmk4_pf)
+void aristmk4_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
+{
+ switch (id)
+ {
+ case TIMER_POWER_FAIL: power_fail(); break;
+ default: assert_always(false, "Unknown id in aristmk4_state::device_timer");
+ }
+}
+
+void aristmk4_state::power_fail()
{
/*
IRQ generator pulses the NMI signal to CPU in the event of power down or power failure.
@@ -1768,118 +1778,106 @@ TIMER_DEVICE_CALLBACK_MEMBER(aristmk4_state::aristmk4_pf)
if(ioport("powerfail")->read()) // send NMI signal if L pressed
{
- m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE );
+ m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
}
}
-MACHINE_CONFIG_START(aristmk4_state::aristmk4)
+void aristmk4_state::aristmk4(machine_config &config)
+{
/* basic machine hardware */
- MCFG_DEVICE_ADD("maincpu", MC6809E, MAIN_CLOCK/8) // M68B09E @ 1.5 MHz
- MCFG_DEVICE_PROGRAM_MAP(aristmk4_map)
- MCFG_DEVICE_VBLANK_INT_DRIVER("screen", aristmk4_state, irq0_line_hold)
+ MC6809E(config, m_maincpu, MAIN_CLOCK/8); // M68B09E @ 1.5 MHz
+ m_maincpu->set_addrmap(AS_PROGRAM, &aristmk4_state::slots_mem);
- MCFG_NVRAM_ADD_0FILL("nvram")
- MCFG_TIMER_DRIVER_ADD_PERIODIC("power_fail", aristmk4_state, aristmk4_pf, attotime::from_hz(1))
+ NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
/* video hardware */
- MCFG_SCREEN_ADD("screen", RASTER)
- MCFG_SCREEN_REFRESH_RATE(60)
- MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
- MCFG_SCREEN_SIZE(320, 256)
- MCFG_SCREEN_VISIBLE_AREA(0, 304-1, 0, 216-1) /* from the crtc registers... updated by crtc */
- MCFG_SCREEN_UPDATE_DRIVER(aristmk4_state, screen_update_aristmk4)
- MCFG_SCREEN_PALETTE("palette")
-
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_aristmk4)
- MCFG_PALETTE_ADD("palette", 512)
- MCFG_PALETTE_INIT_OWNER(aristmk4_state, aristmk4)
-
- MCFG_DEVICE_ADD("ppi8255_0", I8255A, 0)
- MCFG_I8255_IN_PORTA_CB(READ8(*this, aristmk4_state, pa1_r))
- MCFG_I8255_IN_PORTB_CB(READ8(*this, aristmk4_state, pb1_r))
- MCFG_I8255_IN_PORTC_CB(READ8(*this, aristmk4_state, pc1_r))
-
- MCFG_DEVICE_ADD("via6522_0", VIA6522, MAIN_CLOCK/8) // R65C22P2
- MCFG_VIA6522_READPA_HANDLER(READ8(*this, aristmk4_state, via_a_r))
- MCFG_VIA6522_READPB_HANDLER(READ8(*this, aristmk4_state, via_b_r))
- MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(*this, aristmk4_state, via_a_w))
- MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(*this, aristmk4_state, via_b_w))
- MCFG_VIA6522_CA2_HANDLER(WRITELINE(*this, aristmk4_state, via_ca2_w))
- MCFG_VIA6522_CB2_HANDLER(WRITELINE(*this, aristmk4_state, via_cb2_w))
- MCFG_VIA6522_IRQ_HANDLER(INPUTLINE("maincpu", M6809_FIRQ_LINE))
+ screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
+ screen.set_refresh_hz(60);
+ screen.set_vblank_time(ATTOSECONDS_IN_USEC(0));
+ screen.set_size(320, 256);
+ screen.set_visarea(0, 304-1, 0, 216-1); /* from the crtc registers... updated by crtc */
+ screen.set_screen_update(FUNC(aristmk4_state::screen_update_aristmk4));
+ screen.screen_vblank().set_inputline(m_maincpu, M6809_IRQ_LINE, HOLD_LINE);
+ screen.set_palette(m_palette);
+
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_aristmk4);
+ PALETTE(config, m_palette, 512);
+ m_palette->set_init(DEVICE_SELF_OWNER, FUNC(aristmk4_state::aristmk4_palette));
+
+ i8255_device &ppi(I8255A(config, "ppi8255_0"));
+ ppi.in_pa_callback().set(FUNC(aristmk4_state::pa1_r));
+ ppi.in_pb_callback().set(FUNC(aristmk4_state::pb1_r));
+ ppi.in_pc_callback().set(FUNC(aristmk4_state::pc1_r));
+
+ via6522_device &via(VIA6522(config, "via6522_0", MAIN_CLOCK/8)); // R65C22P2
+ via.readpa_handler().set(FUNC(aristmk4_state::via_a_r));
+ via.readpb_handler().set(FUNC(aristmk4_state::via_b_r));
+ via.writepa_handler().set(FUNC(aristmk4_state::via_a_w));
+ via.writepb_handler().set(FUNC(aristmk4_state::via_b_w));
+ via.ca2_handler().set(FUNC(aristmk4_state::via_ca2_w));
+ via.cb2_handler().set(FUNC(aristmk4_state::via_cb2_w));
+ via.irq_handler().set_inputline(m_maincpu, M6809_FIRQ_LINE);
// CA1 is connected to +5V, CB1 is not connected.
- MCFG_DEVICE_ADD("pia6821_0", PIA6821, 0)
- MCFG_PIA_READPA_HANDLER(READ8(*this, aristmk4_state, mkiv_pia_ina))
- MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, aristmk4_state, mkiv_pia_outa))
- MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, aristmk4_state, mkiv_pia_outb))
- MCFG_PIA_CA2_HANDLER(WRITELINE(*this, aristmk4_state, mkiv_pia_ca2))
- MCFG_PIA_CB2_HANDLER(WRITELINE(*this, aristmk4_state, mkiv_pia_cb2))
+ pia6821_device &pia(PIA6821(config, "pia6821_0", 0));
+ pia.readpa_handler().set(FUNC(aristmk4_state::mkiv_pia_ina));
+ pia.writepa_handler().set(FUNC(aristmk4_state::mkiv_pia_outa));
+ pia.writepb_handler().set(FUNC(aristmk4_state::mkiv_pia_outb));
+ pia.ca2_handler().set(FUNC(aristmk4_state::mkiv_pia_ca2));
+ pia.cb2_handler().set(FUNC(aristmk4_state::mkiv_pia_cb2));
- MCFG_MC6845_ADD("crtc", C6545_1, "screen", MAIN_CLOCK/8) // TODO: type is unknown
+ mc6845_device &crtc(C6545_1(config, "crtc", MAIN_CLOCK/8)); // TODO: type is unknown
+ crtc.set_screen("screen");
/* in fact is a mc6845 driving 4 pixels by memory address.
that's why the big horizontal parameters */
- MCFG_MC6845_SHOW_BORDER_AREA(false)
- MCFG_MC6845_CHAR_WIDTH(4)
+ crtc.set_show_border_area(false);
+ crtc.set_char_width(4);
- MCFG_DEVICE_ADD("rtc", MC146818, 4.194304_MHz_XTAL)
+ MC146818(config, m_rtc, 4.194304_MHz_XTAL);
SPEAKER(config, "mono").front_center();
// the Mark IV has X 2 AY8910 sound chips which are tied to the VIA
- MCFG_DEVICE_ADD("ay1", AY8910 , MAIN_CLOCK/8)
- MCFG_AY8910_PORT_A_READ_CB(IOPORT("DSW1"))
- MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(*this, aristmk4_state, zn434_w)) // Port write to set Vout of the DA convertors ( 2 x ZN434 )
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40)
-
- MCFG_DEVICE_ADD("ay2", AY8910 , MAIN_CLOCK/8)
- MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(*this, aristmk4_state, pblp_out)) // Port A write - goes to lamps on the buttons x8
- MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(*this, aristmk4_state, pbltlp_out)) // Port B write - goes to lamps on the buttons x4 and light tower x4
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40)
-
- MCFG_DEVICE_ADD("samples", SAMPLES)
- MCFG_SAMPLES_CHANNELS(5) /* one for each meter - can pulse simultaneously */
- MCFG_SAMPLES_NAMES(meter_sample_names)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.05)
-
-MACHINE_CONFIG_END
+ AY8910(config, m_ay1, MAIN_CLOCK/8);
+ m_ay1->port_a_read_callback().set_ioport("DSW1");
+ m_ay1->port_b_write_callback().set(FUNC(aristmk4_state::zn434_w)); // Port write to set Vout of the DA convertors ( 2 x ZN434 )
+ m_ay1->add_route(ALL_OUTPUTS, "mono", 0.40);
+
+ AY8910(config, m_ay2, MAIN_CLOCK/8);
+ m_ay2->port_a_write_callback().set(FUNC(aristmk4_state::pblp_out)); // Port A write - goes to lamps on the buttons x8
+ m_ay2->port_b_write_callback().set(FUNC(aristmk4_state::pbltlp_out)); // Port B write - goes to lamps on the buttons x4 and light tower x4
+ m_ay2->add_route(ALL_OUTPUTS, "mono", 0.40);
+
+ SAMPLES(config, m_samples);
+ m_samples->set_channels(5); /* one for each meter - can pulse simultaneously */
+ m_samples->set_samples_names(meter_sample_names);
+ m_samples->add_route(ALL_OUTPUTS, "mono", 0.05);
+}
-MACHINE_CONFIG_START(aristmk4_state::aristmk4_poker)
+void aristmk4_state::aristmk4_poker(machine_config &config)
+{
aristmk4(config);
- /* basic machine hardware */
- MCFG_DEVICE_MODIFY("maincpu")
- MCFG_DEVICE_PROGRAM_MAP(aristmk4_poker_map)
- MCFG_DEVICE_VBLANK_INT_DRIVER("screen", aristmk4_state, irq0_line_hold)
-MACHINE_CONFIG_END
+ m_maincpu->set_addrmap(AS_PROGRAM, &aristmk4_state::poker_mem);
+}
/* same as Aristocrat Mark-IV HW color offset 7 */
-PALETTE_INIT_MEMBER(aristmk4_state,lions)
+void aristmk4_state::lions_palette(palette_device &palette)
{
- int i;
-
- for (i = 0;i < palette.entries();i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- int bit0,bit1,r,g,b;
-
- bit0 = (i >> 0) & 0x01;
- bit1 = (i >> 1) & 0x01;
- b = 0x4f * bit0 + 0xa8 * bit1;
- bit0 = (i >> 2) & 0x01;
- bit1 = (i >> 3) & 0x01;
- g = 0x4f * bit0 + 0xa8 * bit1;
- bit0 = (i >> 4) & 0x01;
- bit1 = (i >> 5) & 0x01;
- r = 0x4f * bit0 + 0xa8 * bit1;
+ const int b = 0x4f * BIT(i, 0) + 0xa8 * BIT(i, 1);
+ const int g = 0x4f * BIT(i, 2) + 0xa8 * BIT(i, 3);
+ const int r = 0x4f * BIT(i, 4) + 0xa8 * BIT(i, 5);
palette.set_pen_color(i, rgb_t(r, g, b));
}
}
-MACHINE_CONFIG_START(aristmk4_state::_86lions)
+void aristmk4_state::_86lions(machine_config &config)
+{
aristmk4(config);
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_INIT_OWNER(aristmk4_state,lions)
-MACHINE_CONFIG_END
+ m_palette->set_init(DEVICE_SELF_OWNER, FUNC(aristmk4_state::lions_palette));
+}
ROM_START( 3bagflvt )
ROM_REGION(0x10000, "maincpu", 0 )