summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/video/tms9928a.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/video/tms9928a.cpp')
-rw-r--r--src/devices/video/tms9928a.cpp42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/devices/video/tms9928a.cpp b/src/devices/video/tms9928a.cpp
index 8af4ba861f0..dbfcdabe2b4 100644
--- a/src/devices/video/tms9928a.cpp
+++ b/src/devices/video/tms9928a.cpp
@@ -58,6 +58,7 @@ void tms9928a_device::memmap(address_map &map)
tms9928a_device::tms9928a_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, bool is_50hz, bool is_reva, bool is_99)
: device_t(mconfig, type, tag, owner, clock)
, device_memory_interface(mconfig, *this)
+ , device_palette_interface(mconfig, *this)
, device_video_interface(mconfig, *this)
, m_vram_size(0)
, m_out_int_line_cb(*this)
@@ -196,7 +197,7 @@ void tms9928a_device::update_backdrop()
{
// update backdrop colour to transparent if EXTVID bit is set
if ((m_Regs[7] & 15) == 0)
- m_palette[0] = rgb_t(m_Regs[0] & 1 ? 0 : 255,0,0,0);
+ set_pen_color(0, rgb_t(m_Regs[0] & 1 ? 0 : 255,0,0,0));
}
@@ -346,7 +347,7 @@ void tms9928a_device::device_timer(emu_timer &timer, device_timer_id id, int par
{
/* Draw backdrop colour */
for ( int i = 0; i < TOTAL_HORZ; i++ )
- p[i] = m_palette[BackColour];
+ p[i] = pen(BackColour);
/* vblank is set at the last cycle of the first inactive line */
if ( y == 193 )
@@ -361,7 +362,7 @@ void tms9928a_device::device_timer(emu_timer &timer, device_timer_id id, int par
/* Left border */
for ( int i = 0; i < HORZ_DISPLAY_START; i++ )
- p[i] = m_palette[BackColour];
+ p[i] = pen(BackColour);
/* Active display */
@@ -377,8 +378,8 @@ void tms9928a_device::device_timer(emu_timer &timer, device_timer_id id, int par
uint8_t charcode = m_vram_space->read_byte( addr );
uint8_t pattern = m_vram_space->read_byte( m_pattern + ( charcode << 3 ) + ( y & 7 ) );
uint8_t colour = m_vram_space->read_byte( m_colour + ( charcode >> 3 ) );
- rgb_t fg = m_palette[(colour >> 4) ? (colour >> 4) : BackColour];
- rgb_t bg = m_palette[(colour & 15) ? (colour & 15) : BackColour];
+ rgb_t fg = pen((colour >> 4) ? (colour >> 4) : BackColour);
+ rgb_t bg = pen((colour & 15) ? (colour & 15) : BackColour);
for ( int i = 0; i < 8; pattern <<= 1, i++ )
p[x+i] = ( pattern & 0x80 ) ? fg : bg;
@@ -390,8 +391,8 @@ void tms9928a_device::device_timer(emu_timer &timer, device_timer_id id, int par
//if (vpos==100 ) popmessage("TMS9928A MODE 1");
{
uint16_t addr = m_nametbl + ( ( y >> 3 ) * 40 );
- rgb_t fg = m_palette[(m_Regs[7] >> 4) ? (m_Regs[7] >> 4) : BackColour];
- rgb_t bg = m_palette[BackColour];
+ rgb_t fg = pen((m_Regs[7] >> 4) ? (m_Regs[7] >> 4) : BackColour);
+ rgb_t bg = pen(BackColour);
/* Extra 6 pixels left border */
for ( int x = HORZ_DISPLAY_START; x < HORZ_DISPLAY_START + 6; x++ )
@@ -422,8 +423,8 @@ void tms9928a_device::device_timer(emu_timer &timer, device_timer_id id, int par
uint16_t charcode = m_vram_space->read_byte( addr ) + ( ( y >> 6 ) << 8 );
uint8_t pattern = m_vram_space->read_byte( m_pattern + ( ( charcode & m_patternmask ) << 3 ) + ( y & 7 ) );
uint8_t colour = m_vram_space->read_byte( m_colour + ( ( charcode & m_colourmask ) << 3 ) + ( y & 7 ) );
- rgb_t fg = m_palette[(colour >> 4) ? (colour >> 4) : BackColour];
- rgb_t bg = m_palette[(colour & 15) ? (colour & 15) : BackColour];
+ rgb_t fg = pen((colour >> 4) ? (colour >> 4) : BackColour);
+ rgb_t bg = pen((colour & 15) ? (colour & 15) : BackColour);
for ( int i = 0; i < 8; pattern <<= 1, i++ )
p[x+i] = ( pattern & 0x80 ) ? fg : bg;
@@ -435,8 +436,8 @@ void tms9928a_device::device_timer(emu_timer &timer, device_timer_id id, int par
//if (vpos==100) popmessage("TMS9928A MODE1+2");
{
uint16_t addr = m_nametbl + ( ( y >> 3 ) * 40 );
- rgb_t fg = m_palette[(m_Regs[7] >> 4) ? (m_Regs[7] >> 4) : BackColour];
- rgb_t bg = m_palette[BackColour];
+ rgb_t fg = pen((m_Regs[7] >> 4) ? (m_Regs[7] >> 4) : BackColour);
+ rgb_t bg = pen(BackColour);
/* Extra 6 pixels left border */
for ( int x = HORZ_DISPLAY_START; x < HORZ_DISPLAY_START + 6; x++ )
@@ -466,8 +467,8 @@ void tms9928a_device::device_timer(emu_timer &timer, device_timer_id id, int par
{
uint8_t charcode = m_vram_space->read_byte( addr );
uint8_t colour = m_vram_space->read_byte( m_pattern + ( charcode << 3 ) + ( ( y >> 2 ) & 7 ) );
- rgb_t fg = m_palette[(colour >> 4) ? (colour >> 4) : BackColour];
- rgb_t bg = m_palette[(colour & 15) ? (colour & 15) : BackColour];
+ rgb_t fg = pen((colour >> 4) ? (colour >> 4) : BackColour);
+ rgb_t bg = pen((colour & 15) ? (colour & 15) : BackColour);
p[x+0] = p[x+1] = p[x+2] = p[x+3] = fg;
p[x+4] = p[x+5] = p[x+6] = p[x+7] = bg;
@@ -478,8 +479,8 @@ void tms9928a_device::device_timer(emu_timer &timer, device_timer_id id, int par
case 5: case 7: /* MODE bogus */
//if (vpos==100 ) popmessage("TMS9928A MODE bogus");
{
- rgb_t fg = m_palette[(m_Regs[7] >> 4) ? (m_Regs[7] >> 4) : BackColour];
- rgb_t bg = m_palette[BackColour];
+ rgb_t fg = pen((m_Regs[7] >> 4) ? (m_Regs[7] >> 4) : BackColour);
+ rgb_t bg = pen(BackColour);
/* Extra 6 pixels left border */
for ( int x = HORZ_DISPLAY_START; x < HORZ_DISPLAY_START + 6; x++ )
@@ -506,8 +507,8 @@ void tms9928a_device::device_timer(emu_timer &timer, device_timer_id id, int par
{
uint8_t charcode = m_vram_space->read_byte( addr );
uint8_t colour = m_vram_space->read_byte( m_pattern + ( ( ( charcode + ( ( y >> 2 ) & 7 ) + ( ( y >> 6 ) << 8 ) ) & m_patternmask ) << 3 ) );
- rgb_t fg = m_palette[(colour >> 4) ? (colour >> 4) : BackColour];
- rgb_t bg = m_palette[(colour & 15) ? (colour & 15) : BackColour];
+ rgb_t fg = pen((colour >> 4) ? (colour >> 4) : BackColour);
+ rgb_t bg = pen((colour & 15) ? (colour & 15) : BackColour);
p[x+0] = p[x+1] = p[x+2] = p[x+3] = fg;
p[x+4] = p[x+5] = p[x+6] = p[x+7] = bg;
@@ -600,7 +601,7 @@ void tms9928a_device::device_timer(emu_timer &timer, device_timer_id id, int par
if ( ! ( spr_drawn[ colission_index ] & 0x02 ) )
{
spr_drawn[ colission_index ] |= 0x02;
- p[ HORZ_DISPLAY_START + colission_index - 32 ] = m_palette[sprcol];
+ p[ HORZ_DISPLAY_START + colission_index - 32 ] = pen(sprcol);
}
}
}
@@ -625,7 +626,7 @@ void tms9928a_device::device_timer(emu_timer &timer, device_timer_id id, int par
/* Right border */
for ( int i = HORZ_DISPLAY_START + 256; i < TOTAL_HORZ; i++ )
- p[i] = m_palette[BackColour];
+ p[i] = pen(BackColour);
}
/* Schedule next callback */
@@ -692,7 +693,7 @@ void tms9928a_device::set_palette()
/* copy default palette into working palette */
for (int i = 0; i < PALETTE_SIZE; i++)
{
- m_palette[i] = tms9928a_palette[i];
+ set_pen_color(i, tms9928a_palette[i]);
}
}
@@ -738,7 +739,6 @@ void tms9928a_device::device_start()
save_item(NAME(m_spriteattribute));
save_item(NAME(m_spritepattern));
save_item(NAME(m_mode));
- save_item(NAME(m_palette));
}