diff options
Diffstat (limited to 'src/mame/video/cinemat.cpp')
-rw-r--r-- | src/mame/video/cinemat.cpp | 139 |
1 files changed, 44 insertions, 95 deletions
diff --git a/src/mame/video/cinemat.cpp b/src/mame/video/cinemat.cpp index 967296dc00b..e1f9c120e3a 100644 --- a/src/mame/video/cinemat.cpp +++ b/src/mame/video/cinemat.cpp @@ -7,28 +7,11 @@ ***************************************************************************/ #include "emu.h" -#include "cpu/ccpu/ccpu.h" #include "includes/cinemat.h" /************************************* * - * Constants - * - *************************************/ - -enum -{ - COLOR_BILEVEL, - COLOR_16LEVEL, - COLOR_64LEVEL, - COLOR_RGB -}; - - - -/************************************* - * * Vector rendering * *************************************/ @@ -70,55 +53,52 @@ void cinemat_state::cinemat_vector_callback(int16_t sx, int16_t sy, int16_t ex, WRITE_LINE_MEMBER(cinemat_state::vector_control_w) { - // TODO: turn this into a virtual method and just override for each type - int r, g, b, i; - cpu_device *cpu = m_maincpu; + /* color is either bright or dim, selected by the value sent to the port */ + m_vector_color = state ? rgb_t(0x80,0x80,0x80) : rgb_t(0xff,0xff,0xff); +} + + +WRITE_LINE_MEMBER(cinemat_16level_state::vector_control_w) +{ + /* on the rising edge of the data value, latch bits 0-3 of the */ + /* X register as the intensity */ + if (state) + { + int xval = m_maincpu->state_int(ccpu_cpu_device::CCPU_X) & 0x0f; + int i = (xval + 1) * 255 / 16; + m_vector_color = rgb_t(i,i,i); + } +} + + +WRITE_LINE_MEMBER(cinemat_64level_state::vector_control_w) +{ + /* on the rising edge of the data value, latch bits 2-7 of the */ + /* X register as the intensity */ + if (state) + { + int xval = m_maincpu->state_int(ccpu_cpu_device::CCPU_X); + xval = (~xval >> 2) & 0x3f; + int i = (xval + 1) * 255 / 64; + m_vector_color = rgb_t(i, i, i); + } +} + - switch (m_color_mode) +WRITE_LINE_MEMBER(cinemat_color_state::vector_control_w) +{ + /* on the rising edge of the data value, latch the X register */ + /* as 4-4-4 BGR values */ + if (state) { - case COLOR_BILEVEL: - /* color is either bright or dim, selected by the value sent to the port */ - m_vector_color = state ? rgb_t(0x80,0x80,0x80) : rgb_t(0xff,0xff,0xff); - break; - - case COLOR_16LEVEL: - /* on the rising edge of the data value, latch bits 0-3 of the */ - /* X register as the intensity */ - if (state) - { - int xval = cpu->state_int(ccpu_cpu_device::CCPU_X) & 0x0f; - i = (xval + 1) * 255 / 16; - m_vector_color = rgb_t(i,i,i); - } - break; - - case COLOR_64LEVEL: - /* on the rising edge of the data value, latch bits 2-7 of the */ - /* X register as the intensity */ - if (state) - { - int xval = cpu->state_int(ccpu_cpu_device::CCPU_X); - xval = (~xval >> 2) & 0x3f; - i = (xval + 1) * 255 / 64; - m_vector_color = rgb_t(i,i,i); - } - break; - - case COLOR_RGB: - /* on the rising edge of the data value, latch the X register */ - /* as 4-4-4 BGR values */ - if (state) - { - int xval = cpu->state_int(ccpu_cpu_device::CCPU_X); - r = (~xval >> 0) & 0x0f; - r = r * 255 / 15; - g = (~xval >> 4) & 0x0f; - g = g * 255 / 15; - b = (~xval >> 8) & 0x0f; - b = b * 255 / 15; - m_vector_color = rgb_t(r,g,b); - } - break; + int xval = m_maincpu->state_int(ccpu_cpu_device::CCPU_X); + int r = (~xval >> 0) & 0x0f; + r = r * 255 / 15; + int g = (~xval >> 4) & 0x0f; + g = g * 255 / 15; + int b = (~xval >> 8) & 0x0f; + b = b * 255 / 15; + m_vector_color = rgb_t(r,g,b); } } @@ -158,37 +138,6 @@ WRITE_LINE_MEMBER(qb3_state::vector_control_w) /************************************* * - * Video startup - * - *************************************/ - -void cinemat_state::video_start() -{ - m_color_mode = COLOR_BILEVEL; -} - - -VIDEO_START_MEMBER(cinemat_state,cinemat_16level) -{ - m_color_mode = COLOR_16LEVEL; -} - - -VIDEO_START_MEMBER(cinemat_state,cinemat_64level) -{ - m_color_mode = COLOR_64LEVEL; -} - - -VIDEO_START_MEMBER(cinemat_state,cinemat_color) -{ - m_color_mode = COLOR_RGB; -} - - - -/************************************* - * * End-of-frame * *************************************/ |