Merge pull request #3928 from hp9k/nereid_fixes

nereid: implement reading palette
This commit is contained in:
R. Belmont 2018-08-31 16:00:39 -04:00 committed by GitHub
commit f40ad1e88d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 5 deletions

View File

@ -31,6 +31,7 @@ void nereid_device::device_start()
save_item(NAME(m_blue));
save_item(NAME(m_index));
save_item(NAME(m_palette));
save_item(NAME(m_plane_mask));
}
void nereid_device::device_reset()
@ -48,12 +49,12 @@ READ16_MEMBER(nereid_device::ctrl_r)
case NEREID_RED_DATA:
return 0xff00 | m_red;
case NEREID_GREEN_DATA:
return 0xff00 | m_red;
return 0xff00 | m_green;
case NEREID_BLUE_DATA:
return 0xff00 | m_red;
return 0xff00 | m_blue;
case NEREID_INDEX:
return 0xff00 | m_index;
case NEREID_STROBE:
case NEREID_WRITE_STROBE:
return 0xff00;
case NEREID_PLANE_MASK:
return 0xff00 | m_plane_mask;
@ -80,11 +81,16 @@ WRITE16_MEMBER(nereid_device::ctrl_w)
case NEREID_INDEX:
m_index = ~data;
break;
case NEREID_STROBE:
case NEREID_WRITE_STROBE:
LOG("NEREID: set color index %u: rgb_t(%u,%u,%u)\n",
m_index, m_red, m_green, m_blue);
m_palette[m_index] = rgb_t(m_red, m_green, m_blue);
break;
case NEREID_READ_STROBE:
m_red = (m_palette[m_index]).r();
m_green = (m_palette[m_index]).g();
m_blue = (m_palette[m_index]).b();
break;
case NEREID_PLANE_MASK:
m_plane_mask = data;
break;

View File

@ -27,7 +27,8 @@ private:
static constexpr int NEREID_BLUE_DATA=0x5b;
static constexpr int NEREID_INDEX=0x5c;
static constexpr int NEREID_PLANE_MASK=0x5d;
static constexpr int NEREID_STROBE=0x78;
static constexpr int NEREID_WRITE_STROBE=0x78;
static constexpr int NEREID_READ_STROBE=0x7c;
rgb_t m_palette[256];