Previous 199869 Revisions Next

r26375 Saturday 23rd November, 2013 at 12:28:55 UTC by Osso
Updated maygayv1 to use the n68681 device. (nw)
[src/mame/drivers]maygayv1.c

trunk/src/mame/drivers/maygayv1.c
r26374r26375
129129#include "video/awpvid.h"
130130#include "cpu/mcs51/mcs51.h"
131131#include "machine/6821pia.h"
132#include "machine/68681.h"
132#include "machine/n68681.h"
133133#include "sound/2413intf.h"
134134#include "sound/upd7759.h"
135135#include "machine/nvram.h"
r26374r26375
220220      : driver_device(mconfig, type, tag),
221221      m_maincpu(*this, "maincpu"),
222222      m_soundcpu(*this, "soundcpu"),
223      m_upd7759(*this, "upd") { }
223      m_upd7759(*this, "upd"),
224      m_duart68681(*this, "duart68681") { }
224225
226   required_device<cpu_device> m_maincpu;
227   required_device<i8052_device> m_soundcpu;
228   required_device<upd7759_device> m_upd7759;
229   required_device<duartn68681_device> m_duart68681;
230   
225231   int m_vsync_latch_preset;
226232   UINT8 m_p1;
227233   UINT8 m_p3;
228234   int m_d68681_val;
229   device_t *m_duart68681;
230235   i82716_t m_i82716;
231236   i8279_t m_i8279;
232237   DECLARE_WRITE16_MEMBER(i82716_w);
r26374r26375
249254   INTERRUPT_GEN_MEMBER(vsync_interrupt);
250255   DECLARE_WRITE8_MEMBER(data_from_i8031);
251256   DECLARE_READ8_MEMBER(data_to_i8031);
252   required_device<cpu_device> m_maincpu;
253   required_device<i8052_device> m_soundcpu;
254   required_device<upd7759_device> m_upd7759;
257   DECLARE_WRITE_LINE_MEMBER(duart_irq_handler);
258   DECLARE_WRITE_LINE_MEMBER(duart_txa);
255259};
256260
257261
r26374r26375
697701   AM_RANGE(0x860000, 0x86000d) AM_READWRITE(read_odd, write_odd)
698702   AM_RANGE(0x86000e, 0x86000f) AM_WRITE(vsync_int_ctrl)
699703   AM_RANGE(0x880000, 0x89ffff) AM_READWRITE(i82716_r, i82716_w)
700   AM_RANGE(0x8a0000, 0x8a001f) AM_DEVREADWRITE8_LEGACY("duart68681", duart68681_r, duart68681_w, 0xff)
704   AM_RANGE(0x8a0000, 0x8a001f) AM_DEVREADWRITE8("duart68681", duartn68681_device, read, write, 0xff)
701705   AM_RANGE(0x8c0000, 0x8c000f) AM_DEVREADWRITE8("pia", pia6821_device, read, write, 0xff)
702706ADDRESS_MAP_END
703707
r26374r26375
940944
941945***************************************************************************/
942946
943static void duart_irq_handler(device_t *device, int state, UINT8 vector)
947WRITE_LINE_MEMBER(maygayv1_state::duart_irq_handler)
944948{
945   maygayv1_state *drvstate = device->machine().driver_data<maygayv1_state>();
946   drvstate->m_maincpu->set_input_line_and_vector(5, state, vector);
947//  drvstate->m_maincpu->set_input_line(5, state ? ASSERT_LINE : CLEAR_LINE);
949   m_maincpu->set_input_line_and_vector(5, state, m_duart68681->get_irq_vector());
950//  m_maincpu->set_input_line(5, state ? ASSERT_LINE : CLEAR_LINE);
948951};
949952
950953
951static void duart_tx(device_t *device, int channel, UINT8 data)
954WRITE_LINE_MEMBER(maygayv1_state::duart_txa)
952955{
953   maygayv1_state *state = device->machine().driver_data<maygayv1_state>();
954   if (channel == 0)
955   {
956      state->m_d68681_val = data;
957      state->m_soundcpu->set_input_line(MCS51_RX_LINE, ASSERT_LINE);  // ?
958   }
959
956   m_d68681_val = state;
957   m_soundcpu->set_input_line(MCS51_RX_LINE, ASSERT_LINE);  // ?
960958};
961959
962static const duart68681_config maygayv1_duart68681_config =
960static const duartn68681_config maygayv1_duart68681_config =
963961{
964   duart_irq_handler,
965   duart_tx,
966   NULL,
967   NULL
962   DEVCB_DRIVER_LINE_MEMBER(maygayv1_state, duart_irq_handler),
963   DEVCB_DRIVER_LINE_MEMBER(maygayv1_state, duart_txa),
964   DEVCB_NULL,
965   DEVCB_NULL,
966   DEVCB_NULL
968967};
969968
970969
r26374r26375
975974
976975WRITE8_MEMBER(maygayv1_state::data_from_i8031)
977976{
978   duart68681_rx_data(m_duart68681, 0, data);
977   m_duart68681->rx_a_w(data);
979978}
980979
981980READ8_MEMBER(maygayv1_state::b_read)
r26374r26375
10161015
10171016   save_pointer(NAME(i82716.dram), 0x40000);
10181017
1019//  duart_68681_init(DUART_CLOCK, duart_irq_handler, duart_tx);
1020
10211018   m_soundcpu->i8051_set_serial_tx_callback(write8_delegate(FUNC(maygayv1_state::data_from_i8031),this));
10221019   m_soundcpu->i8051_set_serial_rx_callback(read8_delegate(FUNC(maygayv1_state::data_to_i8031),this));
10231020}
r26374r26375
10261023{
10271024   i82716_t &i82716 = m_i82716;
10281025   // ?
1029   m_duart68681 = machine().device( "duart68681" );
10301026   memset(i82716.dram, 0, 0x40000);
10311027   i82716.r[RWBA] = 0x0200;
10321028}
r26374r26375
10651061
10661062   MCFG_PALETTE_LENGTH(16)
10671063
1068   MCFG_DUART68681_ADD("duart68681", DUART_CLOCK, maygayv1_duart68681_config)
1064   MCFG_DUARTN68681_ADD("duart68681", DUART_CLOCK, maygayv1_duart68681_config)
10691065
10701066
10711067   MCFG_SPEAKER_STANDARD_MONO("mono")

Previous 199869 Revisions Next


© 1997-2024 The MAME Team