summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--src/devices/video/huc6272.cpp83
-rw-r--r--src/devices/video/huc6272.h15
2 files changed, 58 insertions, 40 deletions
diff --git a/src/devices/video/huc6272.cpp b/src/devices/video/huc6272.cpp
index dce9cb7fe5c..17eb18443c6 100644
--- a/src/devices/video/huc6272.cpp
+++ b/src/devices/video/huc6272.cpp
@@ -18,88 +18,103 @@
// device type definition
const device_type huc6272 = &device_creator<huc6272_device>;
-static ADDRESS_MAP_START( huc6272_vram, AS_0, 32, huc6272_device )
+static ADDRESS_MAP_START( microprg_map, AS_PROGRAM, 16, huc6272_device )
+ AM_RANGE(0x00, 0x0f) AM_RAM AM_SHARE("microprg_ram")
+ADDRESS_MAP_END
+
+static ADDRESS_MAP_START( kram_map, AS_DATA, 32, huc6272_device )
AM_RANGE(0x000000, 0x0fffff) AM_RAM
AM_RANGE(0x100000, 0x1fffff) AM_RAM
ADDRESS_MAP_END
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
//-------------------------------------------------
-// memory_space_config - return a description of
-// any address spaces owned by this device
+// huc6272_device - constructor
//-------------------------------------------------
-const address_space_config *huc6272_device::memory_space_config(address_spacenum spacenum) const
+huc6272_device::huc6272_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
+ : device_t(mconfig, huc6272, "huc6272", tag, owner, clock, "huc6272", __FILE__),
+ device_memory_interface(mconfig, *this),
+ m_program_space_config("microprg", ENDIANNESS_LITTLE, 16, 4, 0, nullptr, *ADDRESS_MAP_NAME(microprg_map)),
+ m_data_space_config("kram", ENDIANNESS_LITTLE, 32, 32, 0, nullptr, *ADDRESS_MAP_NAME(kram_map)),
+ m_microprg_ram(*this, "microprg_ram")
{
- return (spacenum == AS_0) ? &m_space_config : nullptr;
}
-//**************************************************************************
-// INLINE HELPERS
-//**************************************************************************
//-------------------------------------------------
-// read_dword - read a dword at the given address
+// device_validity_check - perform validity checks
+// on this device
//-------------------------------------------------
-inline uint32_t huc6272_device::read_dword(offs_t address)
+void huc6272_device::device_validity_check(validity_checker &valid) const
{
- return space().read_dword(address << 2);
}
//-------------------------------------------------
-// write_dword - write a dword at the given address
+// device_start - device-specific startup
//-------------------------------------------------
-inline void huc6272_device::write_dword(offs_t address, uint32_t data)
+void huc6272_device::device_start()
{
- space().write_dword(address << 2, data);
}
-//**************************************************************************
-// LIVE DEVICE
-//**************************************************************************
//-------------------------------------------------
-// huc6272_device - constructor
+// device_reset - device-specific reset
//-------------------------------------------------
-huc6272_device::huc6272_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, huc6272, "huc6272", tag, owner, clock, "huc6272", __FILE__),
- device_memory_interface(mconfig, *this),
- m_space_config("videoram", ENDIANNESS_LITTLE, 32, 32, 0, nullptr, *ADDRESS_MAP_NAME(huc6272_vram))
+void huc6272_device::device_reset()
{
}
-
//-------------------------------------------------
-// device_validity_check - perform validity checks
-// on this device
+// memory_space_config - return a description of
+// any address spaces owned by this device
//-------------------------------------------------
-void huc6272_device::device_validity_check(validity_checker &valid) const
+const address_space_config *huc6272_device::memory_space_config(address_spacenum spacenum) const
{
+ switch(spacenum)
+ {
+ case AS_PROGRAM: return &m_program_space_config;
+ case AS_DATA: return &m_data_space_config;
+ default: return nullptr;
+ }
}
+//**************************************************************************
+// INLINE HELPERS
+//**************************************************************************
//-------------------------------------------------
-// device_start - device-specific startup
+// read_dword - read a dword at the given address
//-------------------------------------------------
-void huc6272_device::device_start()
+inline uint32_t huc6272_device::read_dword(offs_t address)
{
+ return space(AS_DATA).read_dword(address << 2);
}
//-------------------------------------------------
-// device_reset - device-specific reset
+// write_dword - write a dword at the given address
//-------------------------------------------------
-void huc6272_device::device_reset()
+inline void huc6272_device::write_dword(offs_t address, uint32_t data)
{
+ space(AS_DATA).write_dword(address << 2, data);
}
+void huc6272_device::write_microprg_data(offs_t address, uint16_t data)
+{
+ space(AS_PROGRAM).write_word(address << 1, data);
+}
//**************************************************************************
// READ/WRITE HANDLERS
@@ -230,13 +245,13 @@ WRITE32_MEMBER( huc6272_device::write )
break;
case 0x13:
- m_micro_prg.addr = data & 0xf;
+ m_micro_prg.index = data & 0xf;
break;
case 0x14:
- m_micro_prg.data[m_micro_prg.addr] = data & 0xffff;
- m_micro_prg.addr++;
- m_micro_prg.addr &= 0xf;
+ write_microprg_data(m_micro_prg.index,data & 0xffff);
+ m_micro_prg.index ++;
+ m_micro_prg.index &= 0xf;
break;
case 0x15:
diff --git a/src/devices/video/huc6272.h b/src/devices/video/huc6272.h
index 9a2e173f919..d6274531b38 100644
--- a/src/devices/video/huc6272.h
+++ b/src/devices/video/huc6272.h
@@ -44,11 +44,9 @@ protected:
virtual void device_validity_check(validity_checker &valid) const override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override;
+ virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_PROGRAM) const override;
private:
- inline uint32_t read_dword(offs_t address);
- inline void write_dword(offs_t address, uint32_t data);
uint8_t m_register;
uint32_t m_kram_addr_r, m_kram_addr_w;
uint16_t m_kram_inc_r,m_kram_inc_w;
@@ -57,12 +55,17 @@ private:
uint8_t m_bgmode[4];
struct{
- uint8_t addr;
+ uint8_t index;
uint8_t ctrl;
- uint16_t data[16];
}m_micro_prg;
- const address_space_config m_space_config;
+ const address_space_config m_program_space_config;
+ const address_space_config m_data_space_config;
+ required_shared_ptr<uint16_t> m_microprg_ram;
+
+ uint32_t read_dword(offs_t address);
+ void write_dword(offs_t address, uint32_t data);
+ void write_microprg_data(offs_t address, uint16_t data);
};