summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2017-07-27 00:00:01 -0400
committer AJR <ajrhacker@users.noreply.github.com>2017-07-27 00:00:22 -0400
commit4a05d05fbd1c4bbe7cae948ac83f8dfe3432ba15 (patch)
treea5fdb466d09d92d86557ef6514fb74f68d7fe81c
parentea7bc5dd72ef330dd8e73b45c6bf039209cf013e (diff)
decodmd1: Add addressable latch device (nw)
-rw-r--r--src/mame/video/decodmd1.cpp82
-rw-r--r--src/mame/video/decodmd1.h8
2 files changed, 50 insertions, 40 deletions
diff --git a/src/mame/video/decodmd1.cpp b/src/mame/video/decodmd1.cpp
index 369c448d773..ed58f706334 100644
--- a/src/mame/video/decodmd1.cpp
+++ b/src/mame/video/decodmd1.cpp
@@ -40,7 +40,6 @@ WRITE8_MEMBER( decodmd_type1_device::ctrl_w )
if((m_ctrl & 0x02) && !(data & 0x02))
{
m_rombank1->set_entry(0);
- m_bank = 0;
set_busy(B_SET,0);
m_rowselect = 0;
m_blank = 0;
@@ -102,44 +101,40 @@ WRITE8_MEMBER( decodmd_type1_device::dmd_port_w )
break;
case 0x84:
bit = data & 0x01;
- switch(offset & 0xdc)
- {
- case 0x84: // Bank bit 0
- m_bank = (m_bank & ~0x01) | (~bit & 0x01);
- m_rombank1->set_entry(m_bank);
- break;
- case 0x8c: // Bank bit 1
- m_bank = (m_bank & ~0x02) | ((~bit & 0x01) << 1);
- m_rombank1->set_entry(m_bank);
- break;
- case 0x94: // Bank bit 2
- m_bank = (m_bank & ~0x04) | ((~bit & 0x01) << 2);
- m_rombank1->set_entry(m_bank);
- break;
- case 0x9c: // Blanking
- m_blank = bit;
- if(bit)
- output_data();
- break;
- case 0xc4: // Status
- m_status = bit;
- break;
- case 0xcc: // Row data
- m_rowdata = bit;
- break;
- case 0xd4: // Row clock
- if(~bit & m_rowclock) // on negative edge
- m_rowselect = (m_rowselect << 1) | m_rowdata;
- m_rowclock = bit;
- break;
- case 0xdc: // Test
- set_busy(B_SET,bit);
- break;
- }
+ m_bitlatch->write_bit((offset & 0x40) >> 4 | (offset & 0x18) >> 3, bit);
break;
}
}
+WRITE_LINE_MEMBER(decodmd_type1_device::blank_w)
+{
+ m_blank = state;
+ if (state)
+ output_data();
+}
+
+WRITE_LINE_MEMBER(decodmd_type1_device::status_w)
+{
+ m_status = state;
+}
+
+WRITE_LINE_MEMBER(decodmd_type1_device::rowdata_w)
+{
+ m_rowdata = state;
+}
+
+WRITE_LINE_MEMBER(decodmd_type1_device::rowclock_w)
+{
+ if (!state & m_rowclock) // on negative edge
+ m_rowselect = (m_rowselect << 1) | m_rowdata;
+ m_rowclock = state;
+}
+
+WRITE_LINE_MEMBER(decodmd_type1_device::test_w)
+{
+ set_busy(B_SET, state);
+}
+
void decodmd_type1_device::output_data()
{
uint8_t ptr = 0;
@@ -225,15 +220,23 @@ MACHINE_CONFIG_MEMBER( decodmd_type1_device::device_add_mconfig )
MCFG_RAM_ADD(RAM_TAG)
MCFG_RAM_DEFAULT_SIZE("8K")
+ MCFG_DEVICE_ADD("bitlatch", HC259, 0) // U4
+ MCFG_ADDRESSABLE_LATCH_PARALLEL_OUT_CB(MEMBANK("dmdbank1")) MCFG_DEVCB_MASK(0x07) MCFG_DEVCB_INVERT
+ MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE(decodmd_type1_device, blank_w))
+ MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(WRITELINE(decodmd_type1_device, status_w))
+ MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(WRITELINE(decodmd_type1_device, rowdata_w))
+ MCFG_ADDRESSABLE_LATCH_Q6_OUT_CB(WRITELINE(decodmd_type1_device, rowclock_w))
+ MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(WRITELINE(decodmd_type1_device, test_w))
MACHINE_CONFIG_END
decodmd_type1_device::decodmd_type1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, DECODMD1, tag, owner, clock),
- m_cpu(*this,"dmdcpu"),
- m_rombank1(*this,"dmdbank1"),
- m_rombank2(*this,"dmdbank2"),
- m_ram(*this,RAM_TAG)
+ m_cpu(*this, "dmdcpu"),
+ m_rombank1(*this, "dmdbank1"),
+ m_rombank2(*this, "dmdbank2"),
+ m_ram(*this, RAM_TAG),
+ m_bitlatch(*this, "bitlatch")
{}
void decodmd_type1_device::device_start()
@@ -256,7 +259,6 @@ void decodmd_type1_device::device_reset()
m_rombank1->set_entry(0);
m_rombank2->set_entry(0);
m_status = 0;
- m_bank = 0;
m_busy = 0;
set_busy(B_CLR|B_SET,0);
m_rowselect = 0;
diff --git a/src/mame/video/decodmd1.h b/src/mame/video/decodmd1.h
index 4c2d19b65a9..aec68790ecf 100644
--- a/src/mame/video/decodmd1.h
+++ b/src/mame/video/decodmd1.h
@@ -10,6 +10,7 @@
#pragma once
#include "cpu/z80/z80.h"
+#include "machine/74259.h"
#include "machine/ram.h"
#define MCFG_DECODMD_TYPE1_ADD(_tag, _region) \
@@ -24,6 +25,7 @@ public:
required_memory_bank m_rombank1;
required_memory_bank m_rombank2;
required_device<ram_device> m_ram;
+ required_device<hc259_device> m_bitlatch;
memory_region* m_rom;
DECLARE_READ8_MEMBER(latch_r);
@@ -36,6 +38,12 @@ public:
DECLARE_READ8_MEMBER(dmd_port_r);
DECLARE_WRITE8_MEMBER(dmd_port_w);
+ DECLARE_WRITE_LINE_MEMBER(blank_w);
+ DECLARE_WRITE_LINE_MEMBER(status_w);
+ DECLARE_WRITE_LINE_MEMBER(rowdata_w);
+ DECLARE_WRITE_LINE_MEMBER(rowclock_w);
+ DECLARE_WRITE_LINE_MEMBER(test_w);
+
static void static_set_gfxregion(device_t &device, const char *tag);
protected: