summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author mooglyguy <therealmogminer@gmail.com>2019-05-29 05:09:11 +0200
committer mooglyguy <therealmogminer@gmail.com>2019-05-29 05:09:11 +0200
commit3d67ace098b3c856a56232b44e67a6a0ca7f9958 (patch)
treebf6ae2030234fdb97ca1354373efe1f86a32f15f
parente15b2b50addadecbf4e13304dca4e99991140118 (diff)
-newport: Various fixes. [Ryan Holtz]
* Fixed handling of COLORI register alternate access. * Added suport for RAMDAC gamma LUT.
-rw-r--r--src/devices/bus/gio64/newport.cpp58
-rw-r--r--src/devices/bus/gio64/newport.h8
2 files changed, 60 insertions, 6 deletions
diff --git a/src/devices/bus/gio64/newport.cpp b/src/devices/bus/gio64/newport.cpp
index 865f3ea0143..c75c5093dfd 100644
--- a/src/devices/bus/gio64/newport.cpp
+++ b/src/devices/bus/gio64/newport.cpp
@@ -211,6 +211,11 @@ void newport_base_device::device_start()
save_item(NAME(m_readout_y0));
save_item(NAME(m_readout_x1));
save_item(NAME(m_readout_y1));
+
+ save_item(NAME(m_ramdac_lut_r));
+ save_item(NAME(m_ramdac_lut_g));
+ save_item(NAME(m_ramdac_lut_b));
+ save_item(NAME(m_ramdac_lut_index));
}
//-------------------------------------------------
@@ -224,6 +229,9 @@ void newport_base_device::device_reset()
memset(&m_xmap1, 0, sizeof(xmap_t));
memset(&m_rex3, 0, sizeof(rex3_t));
memset(&m_cmap0, 0, sizeof(cmap_t));
+ memset(m_ramdac_lut_r, 0, sizeof(uint32_t) * 256);
+ memset(m_ramdac_lut_g, 0, sizeof(uint32_t) * 256);
+ memset(m_ramdac_lut_b, 0, sizeof(uint32_t) * 256);
m_rex3.m_draw_mode0 = 0x00000000;
m_rex3.m_draw_mode1 = 0x3002f001;
@@ -565,6 +573,8 @@ uint32_t newport_base_device::screen_update(screen_device &device, bitmap_rgb32
}
}
+ ramdac_remap(dest - 1);
+
src_ci++;
src_pup++;
src_olay++;
@@ -584,6 +594,15 @@ uint32_t newport_base_device::screen_update(screen_device &device, bitmap_rgb32
return 0;
}
+void newport_base_device::ramdac_remap(uint32_t *dest)
+{
+ uint32_t out = 0xff000000;
+ out |= m_ramdac_lut_r[(uint8_t)(*dest >> 16)];
+ out |= m_ramdac_lut_g[(uint8_t)(*dest >> 8)];
+ out |= m_ramdac_lut_b[(uint8_t)(*dest >> 0)];
+ *dest = out;
+}
+
uint32_t newport_base_device::convert_4bpp_bgr_to_8bpp(uint8_t pix_in)
{
const uint8_t r = 0xff * BIT(pix_in, 0);
@@ -704,6 +723,22 @@ uint32_t newport_base_device::convert_12bpp_bgr_to_24bpp_rgb(uint16_t pix_in)
return (r << 16) | (g << 8) | b;
}
+void newport_base_device::ramdac_write(uint32_t data)
+{
+ switch (m_rex3.m_dcb_reg_select)
+ {
+ case 0:
+ m_ramdac_lut_index = (uint8_t)data;
+ break;
+ case 1:
+ m_ramdac_lut_r[m_ramdac_lut_index] = (uint8_t)(data >> 8) << 16;
+ m_ramdac_lut_g[m_ramdac_lut_index] = (uint8_t)(data >> 16) << 8;
+ m_ramdac_lut_b[m_ramdac_lut_index] = (uint8_t)(data >> 24) << 0;
+ m_ramdac_lut_index++;
+ break;
+ }
+}
+
void newport_base_device::cmap0_write(uint32_t data)
{
switch (m_rex3.m_dcb_reg_select)
@@ -2158,7 +2193,18 @@ uint32_t newport_base_device::get_rgb_color(int16_t x, int16_t y)
if (!BIT(m_rex3.m_draw_mode1, 15)) // RGB
{
- return red;
+ switch (m_rex3.m_plane_depth)
+ {
+ case 0: // 4bpp
+ return (m_rex3.m_color_red >> 11) & 0x0000000f;
+ case 1: // 8bpp
+ return (m_rex3.m_color_red >> 11) & 0x000000ff;
+ case 2: // 12bpp
+ return (m_rex3.m_color_red >> 9) & 0x00000fff;
+ case 3: // 24bpp
+ // Not supported
+ return 0;
+ }
}
if (BIT(m_rex3.m_draw_mode1, 16)) // Dithering
@@ -3592,7 +3638,10 @@ WRITE64_MEMBER(newport_base_device::rex3_w)
{
LOGMASKED(LOG_REX3, "REX3 Red/CI Full State Write: %08x\n", (uint32_t)(data >> 32));
m_rex3.m_color_red = (int32_t)((data >> 32) & 0xffffff);
- m_rex3.m_color_i = (uint32_t)(m_rex3.m_color_red >> 9) & 0x00000fff;
+ if (m_rex3.m_plane_depth == 2 && !BIT(m_rex3.m_draw_mode1, 15))
+ {
+ m_rex3.m_color_i = m_rex3.m_color_red >> 9;
+ }
}
if (ACCESSING_BITS_0_31)
{
@@ -3697,9 +3746,6 @@ WRITE64_MEMBER(newport_base_device::rex3_w)
{
LOGMASKED(LOG_REX3, "REX3 Packed Color Fractions Write: %08x\n", (uint32_t)data);
m_rex3.m_color_i = (uint32_t)data;
- //m_rex3.m_color_red = ((m_rex3.m_color_i >> 0) & 0xff) << 11;
- //m_rex3.m_color_green = ((m_rex3.m_color_i >> 8) & 0xff) << 11;
- //m_rex3.m_color_blue = ((m_rex3.m_color_i >> 16) & 0xff) << 11;
}
break;
case 0x0228/8:
@@ -3789,7 +3835,7 @@ WRITE64_MEMBER(newport_base_device::rex3_w)
xmap1_write(data32);
break;
case DCB_ADDR_RAMDAC:
- LOGMASKED(LOG_REX3, "REX3 Display Control Bus Data MSW Write to RAMDAC (not yet implemented): %08x\n", data32);
+ ramdac_write(data32);
break;
case DCB_ADDR_CC1:
LOGMASKED(LOG_REX3, "REX3 Display Control Bus Data MSW Write to CC1 (not yet implemented): %08x\n", data32);
diff --git a/src/devices/bus/gio64/newport.h b/src/devices/bus/gio64/newport.h
index 074c1ee16f8..b9738328e26 100644
--- a/src/devices/bus/gio64/newport.h
+++ b/src/devices/bus/gio64/newport.h
@@ -228,6 +228,7 @@ protected:
void xmap1_write(uint32_t data);
uint32_t vc2_read();
void vc2_write(uint32_t data);
+ void ramdac_write(uint32_t data);
void write_x_start(int32_t val);
void write_y_start(int32_t val);
@@ -287,8 +288,15 @@ protected:
void decode_vt_table();
void update_screen_size();
+ void ramdac_remap(uint32_t *dest);
+
required_device<screen_device> m_screen;
+ uint32_t m_ramdac_lut_r[256];
+ uint32_t m_ramdac_lut_g[256];
+ uint32_t m_ramdac_lut_b[256];
+ uint8_t m_ramdac_lut_index;
+
vc2_t m_vc2;
xmap_t m_xmap0;
xmap_t m_xmap1;