summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author mamehaze <mamehaze@users.noreply.github.com>2015-03-08 16:22:52 +0000
committer mamehaze <mamehaze@users.noreply.github.com>2015-03-08 16:22:52 +0000
commitbb75bf30c6163c78aebf662b4810a63d7fe53d36 (patch)
tree3cc2041195ab59dc08d6cc0c2f1ac4d28dcbd145
parent9f1daa9e764477f36682cf71ea4d681ab99d9cf0 (diff)
hng64 / v53 - looking at DMA (nw)
-rw-r--r--src/emu/cpu/nec/v53.c31
-rw-r--r--src/emu/cpu/nec/v53.h4
-rw-r--r--src/emu/machine/upd71071.c38
-rw-r--r--src/emu/machine/upd71071.h2
-rw-r--r--src/mame/audio/hng64.c15
-rw-r--r--src/mame/includes/hng64.h4
-rw-r--r--src/mame/mame.mak3
7 files changed, 84 insertions, 13 deletions
diff --git a/src/emu/cpu/nec/v53.c b/src/emu/cpu/nec/v53.c
index bee6dd17557..958b431e707 100644
--- a/src/emu/cpu/nec/v53.c
+++ b/src/emu/cpu/nec/v53.c
@@ -10,7 +10,7 @@
#include "emu.h"
#include "v53.h"
-#include "machine/pit8253.h"
+
const device_type V53 = &device_creator<v53_device>;
const device_type V53A =&device_creator<v53a_device>;
@@ -191,7 +191,7 @@ void v53_base_device::device_start()
void v53_base_device::install_peripheral_io()
{
// unmap everything in I/O space up to the fixed position registers (we avoid overwriting them, it isn't a valid config)
- space(AS_IO).unmap_readwrite(0x0000, 0xfeff);
+ space(AS_IO).unmap_readwrite(0x1000, 0xfeff); // todo, we need to have a way to NOT unmap things defined in the drivers, but instead have this act as an overlay mapping / unampping only!!
// IOAG determines if the handlers used 8-bit or 16-bit access
// the hng64.c games first set everything up in 8-bit mode, then
@@ -201,6 +201,8 @@ void v53_base_device::install_peripheral_io()
if (m_OPSEL & 0x01) // DMA Unit available
{
+ UINT16 base = (m_OPHA << 8) | m_DULA;
+
if (m_SCTL & 0x02) // uPD71037 mode
{
if (IOAG) // 8-bit
@@ -209,12 +211,11 @@ void v53_base_device::install_peripheral_io()
}
else
{
-
}
}
- else
+ else // uPD71071 mode
{
-
+ space(AS_IO).install_readwrite_handler(base+0x00, base+0x0f, read8_delegate(FUNC(upd71071_device::read), (upd71071_device*)m_dma_71071mode), write8_delegate(FUNC(upd71071_device::write), (upd71071_device*)m_dma_71071mode), 0xffff);
}
}
@@ -350,6 +351,13 @@ READ8_MEMBER(v53_base_device::tmu_tst0_r) { return m_pit->read(space, 0); }
READ8_MEMBER(v53_base_device::tmu_tst1_r) { return m_pit->read(space, 1); }
READ8_MEMBER(v53_base_device::tmu_tst2_r) { return m_pit->read(space, 2); }
+/*** DMA ***/
+
+// could be wrong / nonexistent
+int v53_base_device::dmarq(int state, int channel)
+{
+ return m_dma_71071mode->dmarq(state, channel);
+}
/* General stuff */
@@ -392,6 +400,16 @@ static MACHINE_CONFIG_FRAGMENT( v53 )
MCFG_DEVICE_ADD("pit", PIT8254, 0) // functionality identical to uPD71054
MCFG_PIT8253_CLK0(16000000/2/8)
//MCFG_PIT8253_OUT0_HANDLER(WRITELINE(v53_base_device, pit_out0))
+
+ MCFG_DEVICE_ADD("upd71071dma", UPD71071, 0)
+// MCFG_UPD71071_CPU("audiocpu") // should use owner name
+ MCFG_UPD71071_CLOCK(4000000)
+// MCFG_UPD71071_DMA_READ_0_CB(READ16(towns_state, towns_fdc_dma_r))
+// MCFG_UPD71071_DMA_READ_1_CB(READ16(towns_state, towns_scsi_dma_r))
+// MCFG_UPD71071_DMA_READ_3_CB(READ16(towns_state, towns_cdrom_dma_r))
+// MCFG_UPD71071_DMA_WRITE_0_CB(WRITE16(towns_state, towns_fdc_dma_w))
+// MCFG_UPD71071_DMA_WRITE_1_CB(WRITE16(towns_state, towns_scsi_dma_w))
+
MACHINE_CONFIG_END
machine_config_constructor v53_base_device::device_mconfig_additions() const
@@ -403,7 +421,8 @@ machine_config_constructor v53_base_device::device_mconfig_additions() const
v53_base_device::v53_base_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, offs_t fetch_xor, UINT8 prefetch_size, UINT8 prefetch_cycles, UINT32 chip_type)
: nec_common_device(mconfig, type, name, tag, owner, clock, shortname, true, fetch_xor, prefetch_size, prefetch_cycles, chip_type),
m_io_space_config( "io", ENDIANNESS_LITTLE, 16, 16, 0, ADDRESS_MAP_NAME( v53_internal_port_map ) ),
- m_pit(*this, "pit")
+ m_pit(*this, "pit"),
+ m_dma_71071mode(*this, "upd71071dma")
{
}
diff --git a/src/emu/cpu/nec/v53.h b/src/emu/cpu/nec/v53.h
index f4e43d2cdc9..830589c904c 100644
--- a/src/emu/cpu/nec/v53.h
+++ b/src/emu/cpu/nec/v53.h
@@ -4,6 +4,7 @@
#include "necpriv.h"
#include "machine/pit8253.h"
+#include "machine/upd71071.h"
class v53_base_device : public nec_common_device
{
@@ -79,6 +80,9 @@ public:
}
required_device<pit8253_device> m_pit;
+ required_device<upd71071_device> m_dma_71071mode;
+
+ int dmarq(int state, int channel); // trampoline to upd71071
protected:
// device-level overrides
diff --git a/src/emu/machine/upd71071.c b/src/emu/machine/upd71071.c
index c5ed343478a..4c707d21eb8 100644
--- a/src/emu/machine/upd71071.c
+++ b/src/emu/machine/upd71071.c
@@ -29,6 +29,8 @@
Self-explanatory, I hope. :)
NOTE: Datasheet clearly shows this as 24-bit, with register 7 unused.
But the FM-Towns definitely uses reg 7 as bits 24-31.
+ The documentation on the V53A manual doesn't show these bits either, maybe it's
+ an external connection on the FMT? might be worth checking overflow behavior etc.
0x08:
0x09: Device Control register (16-bit)
@@ -73,8 +75,19 @@
0x0f: Mask register
bit 0-3: DMARQ mask
bits 1 and 0 only in MTM transfers
+
+ Note, the uPD71071 compatible mode of the V53 CPU differs from a real uPD71071 in the following ways
+ V53 Real uPD71071
+ Software Reqs No Yes
+ Memory-to-Memory DMA No Yes
+ DMARQ active level High High or Low
+ DMAAK active level Low High or Low
+ Bus Cycle 4 4 or 3
+
+ we don't currently handle the differences
+
*/
#include "emu.h"
@@ -162,7 +175,6 @@ void upd71071_device::device_start()
TIMER_CALLBACK_MEMBER(upd71071_device::dma_transfer_timer)
{
// single byte or word transfer
- address_space& space = m_cpu->space(AS_PROGRAM);
int channel = param;
UINT16 data = 0; // data to transfer
@@ -190,7 +202,17 @@ TIMER_CALLBACK_MEMBER(upd71071_device::dma_transfer_timer)
data = m_dma_read_3_cb(0);
break;
}
- space.write_byte(m_reg.address_current[channel], data & 0xff);
+
+ if (m_cpu)
+ {
+ address_space& space = m_cpu->space(AS_PROGRAM);
+ space.write_byte(m_reg.address_current[channel], data & 0xff);
+ }
+ else
+ {
+ printf("upd71071_device: dma_transfer_timer - write to memory, no dest space %02x\n", data & 0xff);
+ }
+
if (m_reg.mode_control[channel] & 0x20) // Address direction
m_reg.address_current[channel]--;
else
@@ -208,7 +230,17 @@ TIMER_CALLBACK_MEMBER(upd71071_device::dma_transfer_timer)
}
break;
case 0x08: // memory -> I/O
- data = space.read_byte(m_reg.address_current[channel]);
+ if (m_cpu)
+ {
+ address_space& space = m_cpu->space(AS_PROGRAM);
+ data = space.read_byte(m_reg.address_current[channel]);
+ }
+ else
+ {
+ printf("upd71071_device: dma_transfer_timer - read from memory, no src space\n");
+ data = 0x00;
+ }
+
switch (channel)
{
case 0:
diff --git a/src/emu/machine/upd71071.h b/src/emu/machine/upd71071.h
index 27788894fac..b5717ec05b3 100644
--- a/src/emu/machine/upd71071.h
+++ b/src/emu/machine/upd71071.h
@@ -88,7 +88,7 @@ private:
devcb_write_line m_out_dack_3_cb;
int m_hreq;
int m_eop;
- required_device<cpu_device> m_cpu;
+ optional_device<cpu_device> m_cpu;
};
extern const device_type UPD71071;
diff --git a/src/mame/audio/hng64.c b/src/mame/audio/hng64.c
index 6c8c04ca026..b17955891f6 100644
--- a/src/mame/audio/hng64.c
+++ b/src/mame/audio/hng64.c
@@ -147,10 +147,23 @@ static ADDRESS_MAP_START( hng_sound_map, AS_PROGRAM, 16, hng64_state )
AM_RANGE(0xf0000, 0xfffff) AM_RAMBANK("bank1")
ADDRESS_MAP_END
+WRITE16_MEMBER(hng64_state::hng64_sound_port_0008_w)
+{
+ printf("hng64_sound_port_0008_w %04x %04x\n", data, mem_mask);
+ // just a guess, the v53 docs seem to indicate no software requests tho?? buriki sets up the DMA, then writes here, then waits for the counter to expire?
+ // Maybe it's automatic? I see no way to trigger an actual DMA in the uPD71071 code at present otherwise tho?
+ m_audiocpu->dmarq(1, 0);
+ m_audiocpu->dmarq(1, 1);
+ m_audiocpu->dmarq(1, 2);
+ m_audiocpu->dmarq(1, 3);
+
+}
+
static ADDRESS_MAP_START( hng_sound_io, AS_IO, 16, hng64_state )
- AM_RANGE(0xc002, 0xc003) AM_NOP // buriki one fills the log, wants 0xffff
+ AM_RANGE(0x0008, 0x0009) AM_WRITE( hng64_sound_port_0008_w )
ADDRESS_MAP_END
+
MACHINE_CONFIG_FRAGMENT( hng64_audio )
MCFG_CPU_ADD("audiocpu", V53A, 16000000) // V53A, 16? mhz!
MCFG_CPU_PROGRAM_MAP(hng_sound_map)
diff --git a/src/mame/includes/hng64.h b/src/mame/includes/hng64.h
index 933a2a25a57..36ad331dd86 100644
--- a/src/mame/includes/hng64.h
+++ b/src/mame/includes/hng64.h
@@ -127,7 +127,7 @@ public:
{ }
required_device<mips3_device> m_maincpu;
- required_device<cpu_device> m_audiocpu;
+ required_device<v53a_device> m_audiocpu;
required_device<cpu_device> m_comm;
required_device<msm6242_device> m_rtc;
required_shared_ptr<UINT32> m_mainram;
@@ -354,5 +354,7 @@ public:
int m_vertsrom_size;
void reset_sound();
void reset_net();
+ WRITE16_MEMBER(hng64_sound_port_0008_w);
+
};
diff --git a/src/mame/mame.mak b/src/mame/mame.mak
index 3b7436c8363..8e30c163685 100644
--- a/src/mame/mame.mak
+++ b/src/mame/mame.mak
@@ -551,7 +551,7 @@ MACHINES += UPD1990A
MACHINES += UPD4992
MACHINES += UPD4701
MACHINES += UPD7002
-#MACHINES += UPD71071
+MACHINES += UPD71071
MACHINES += UPD765
MACHINES += V3021
MACHINES += WD_FDC
@@ -579,6 +579,7 @@ MACHINES += STEPPERS
#MACHINES += WOZFDC
#MACHINES += DIABLO_HD
+
#-------------------------------------------------
# specify available bus cores
#-------------------------------------------------