mirror of
https://github.com/holub/mame
synced 2025-06-05 12:26:35 +03:00
bt450: new ramdac device
This commit is contained in:
parent
56ecdf4249
commit
77a89b409e
@ -1720,3 +1720,15 @@ if (VIDEOS["ZR36110"]~=null) then
|
|||||||
MAME_DIR .. "src/devices/video/zr36110.h",
|
MAME_DIR .. "src/devices/video/zr36110.h",
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--------------------------------------------------
|
||||||
|
--
|
||||||
|
--@src/devices/video/bt450.h,VIDEOS["BT450"] = true
|
||||||
|
--------------------------------------------------
|
||||||
|
|
||||||
|
if (VIDEOS["BT450"]~=null) then
|
||||||
|
files {
|
||||||
|
MAME_DIR .. "src/devices/video/bt450.cpp",
|
||||||
|
MAME_DIR .. "src/devices/video/bt450.h",
|
||||||
|
}
|
||||||
|
end
|
||||||
|
99
src/devices/video/bt450.cpp
Normal file
99
src/devices/video/bt450.cpp
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
// license:BSD-3-Clause
|
||||||
|
// copyright-holders:Patrick Mackinlay
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Brooktree Bt450 66MHz Monolithic CMOS 16x12 Color Palette RAMDAC
|
||||||
|
*
|
||||||
|
* Sources:
|
||||||
|
* - Product Databook 1991, Brooktree Corporation
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "emu.h"
|
||||||
|
#include "bt450.h"
|
||||||
|
|
||||||
|
#define LOG_READS (1U << 1)
|
||||||
|
#define LOG_WRITES (1U << 2)
|
||||||
|
|
||||||
|
#define VERBOSE (LOG_WRITES)
|
||||||
|
|
||||||
|
#include "logmacro.h"
|
||||||
|
|
||||||
|
DEFINE_DEVICE_TYPE(BT450, bt450_device, "bt450", "Brooktree Bt450 16x12 Color RAMDAC")
|
||||||
|
|
||||||
|
bt450_device::bt450_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock)
|
||||||
|
: device_t(mconfig, BT450, tag, owner, clock)
|
||||||
|
, device_palette_interface(mconfig, *this)
|
||||||
|
, m_address(0)
|
||||||
|
, m_address_rgb(0)
|
||||||
|
, m_color_ram(nullptr)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void bt450_device::device_start()
|
||||||
|
{
|
||||||
|
m_color_ram = std::make_unique<std::array<u8, 3>[]>(palette_entries());
|
||||||
|
|
||||||
|
save_item(NAME(m_address));
|
||||||
|
save_item(NAME(m_address_rgb));
|
||||||
|
|
||||||
|
save_pointer(NAME(m_color_ram), palette_entries());
|
||||||
|
}
|
||||||
|
|
||||||
|
u8 bt450_device::address_r()
|
||||||
|
{
|
||||||
|
LOGMASKED(LOG_READS, "address_r 0x%02x (%s)\n", m_address, machine().describe_context());
|
||||||
|
|
||||||
|
if (!machine().side_effects_disabled())
|
||||||
|
m_address_rgb = 0;
|
||||||
|
|
||||||
|
return m_address;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void bt450_device::address_w(u8 data)
|
||||||
|
{
|
||||||
|
LOGMASKED(LOG_WRITES, "address_w 0x%02x (%s)\n", data, machine().describe_context());
|
||||||
|
|
||||||
|
m_address_rgb = 0;
|
||||||
|
m_address = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
u8 bt450_device::palette_r(address_space &space)
|
||||||
|
{
|
||||||
|
u8 const data = (m_address < palette_entries()) ? m_color_ram[m_address][m_address_rgb] : space.unmap();
|
||||||
|
|
||||||
|
LOGMASKED(LOG_READS, "palette_r 0x%02x (%s)\n", data, machine().describe_context());
|
||||||
|
|
||||||
|
if (!machine().side_effects_disabled())
|
||||||
|
{
|
||||||
|
// increment component index and address register
|
||||||
|
m_address_rgb = (m_address_rgb + 1) % 3;
|
||||||
|
if (m_address_rgb == 0)
|
||||||
|
m_address++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
void bt450_device::palette_w(u8 data)
|
||||||
|
{
|
||||||
|
LOGMASKED(LOG_WRITES, "palette_w 0x%02x (%s)\n", data, machine().describe_context());
|
||||||
|
|
||||||
|
if (m_address < palette_entries())
|
||||||
|
{
|
||||||
|
m_color_ram[m_address][m_address_rgb] = data & 0x0f;
|
||||||
|
|
||||||
|
// update the mame palette to match the device
|
||||||
|
if (m_address_rgb == 2)
|
||||||
|
set_pen_color(m_address, rgb_t(
|
||||||
|
m_color_ram[m_address][0] << 4,
|
||||||
|
m_color_ram[m_address][1] << 4,
|
||||||
|
m_color_ram[m_address][2] << 4));
|
||||||
|
}
|
||||||
|
|
||||||
|
// increment component index and address register
|
||||||
|
m_address_rgb = (m_address_rgb + 1) % 3;
|
||||||
|
if (m_address_rgb == 0)
|
||||||
|
m_address++;
|
||||||
|
}
|
37
src/devices/video/bt450.h
Normal file
37
src/devices/video/bt450.h
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// license:BSD-3-Clause
|
||||||
|
// copyright-holders:Patrick Mackinlay
|
||||||
|
|
||||||
|
#ifndef MAME_VIDEO_BT450_H
|
||||||
|
#define MAME_VIDEO_BT450_H
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
class bt450_device
|
||||||
|
: public device_t
|
||||||
|
, public device_palette_interface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
bt450_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock);
|
||||||
|
|
||||||
|
u8 address_r();
|
||||||
|
void address_w(u8 data);
|
||||||
|
u8 palette_r(address_space &space);
|
||||||
|
void palette_w(u8 data);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// device_palette_interface implementation
|
||||||
|
virtual void device_start() override ATTR_COLD;
|
||||||
|
|
||||||
|
// device_palette_interface implementation
|
||||||
|
virtual u32 palette_entries() const noexcept override { return 16 + 3; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
u8 m_address;
|
||||||
|
u8 m_address_rgb;
|
||||||
|
|
||||||
|
std::unique_ptr<std::array<u8, 3>[]> m_color_ram;
|
||||||
|
};
|
||||||
|
|
||||||
|
DECLARE_DEVICE_TYPE(BT450, bt450_device)
|
||||||
|
|
||||||
|
#endif // MAME_VIDEO_BT450_H
|
Loading…
Reference in New Issue
Block a user