summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Ville Linde <villedevs@gmail.com>2021-07-23 05:08:54 +0300
committer Ville Linde <villedevs@gmail.com>2021-07-23 05:08:54 +0300
commitbaf71cb650b0b8007835414d3dc4d8e3b7fe3898 (patch)
treefd2be2190f86e3015f711dbd79c0ccfeef9127dc
parent70667e3fdf4a2c9227c8aae420c3bed3a14273ee (diff)
k001604: added callback for vblank irq
-rw-r--r--src/mame/video/k001604.cpp23
-rw-r--r--src/mame/video/k001604.h4
2 files changed, 26 insertions, 1 deletions
diff --git a/src/mame/video/k001604.cpp b/src/mame/video/k001604.cpp
index 7d6ad0b209b..adad9db6c50 100644
--- a/src/mame/video/k001604.cpp
+++ b/src/mame/video/k001604.cpp
@@ -17,6 +17,7 @@
* Foreground tiles 2x or 4x 1Mbit SRAM in a 16-bit bus.
- GTI Club: 37C 34C 32C 29C filled
- NWK-TR: 34A 31A filled, no empty solder pads
+ - Cobra: 6F 6H
* Background tiles 2x or 4x 1Mbit SRAM in a 16-bit bus.
- GTI Club: 37A 34A filled, 32A 29A empty
- NWK-TR: 34C 31C 28C 25C empty
@@ -28,6 +29,7 @@
CLUT RAM:
* 2x 256KBit SRAMs on NWK-TR in a 16-bit bus (32768 colors)
* 2x 64Kbit SRAMs on "GTI Club" in a 16-bit bus (8192 colors)
+ * 3x 256KBit SRAMs on Cobra in a 24-bit bus (32768 colors). Cobra uses 24-bit colors instead of 15-bit.
Background and foreground layer with ROZ capabilities
Both tilemaps are 128x128 tiles, with ability to use smaller sub-tilemaps
@@ -159,7 +161,8 @@ k001604_device::k001604_device(const machine_config &mconfig, const char *tag, d
m_tile_ram(nullptr),
m_fg_char_ram(nullptr),
m_bg_char_ram(nullptr),
- m_reg(nullptr)
+ m_reg(nullptr),
+ m_irq(*this)
{
}
@@ -169,6 +172,8 @@ k001604_device::k001604_device(const machine_config &mconfig, const char *tag, d
void k001604_device::device_start()
{
+ m_irq.resolve_safe();
+
if (!palette().device().started())
throw device_missing_dependencies();
@@ -542,4 +547,20 @@ void k001604_device::char_w(offs_t offset, uint32_t data, uint32_t mem_mask)
void k001604_device::reg_w(offs_t offset, uint32_t data, uint32_t mem_mask)
{
COMBINE_DATA(m_reg.get() + offset);
+
+ if (offset == 0x5c / 4)
+ {
+ if (ACCESSING_BITS_24_31)
+ {
+ // Cobra clears and enables 0x1 in the IRQ handler
+ // (1 = enable VBLANK IRQ, 0 = clear IRQ?)
+ if ((data & 0x1) == 0)
+ {
+ if (!m_irq.isnull())
+ {
+ m_irq(CLEAR_LINE);
+ }
+ }
+ }
+ }
}
diff --git a/src/mame/video/k001604.h b/src/mame/video/k001604.h
index 188cb480ea4..7f2ee10698f 100644
--- a/src/mame/video/k001604.h
+++ b/src/mame/video/k001604.h
@@ -13,6 +13,8 @@ class k001604_device : public device_t, public device_gfx_interface
public:
k001604_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ auto irq_callback() { return m_irq.bind(); }
+
void draw_tilemap(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, bool front, tilemap_t* tilemap);
void draw_back_layer(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
@@ -42,6 +44,8 @@ private:
TILE_GET_INFO_MEMBER(tile_info_fg);
TILE_GET_INFO_MEMBER(tile_info_bg8);
TILE_GET_INFO_MEMBER(tile_info_bg16);
+
+ devcb_write_line m_irq;
};
DECLARE_DEVICE_TYPE(K001604, k001604_device)