diff options
Diffstat (limited to 'src/mame/video/lviv.cpp')
-rw-r--r-- | src/mame/video/lviv.cpp | 55 |
1 files changed, 24 insertions, 31 deletions
diff --git a/src/mame/video/lviv.cpp b/src/mame/video/lviv.cpp index db8577c316d..4fa8e63bf05 100644 --- a/src/mame/video/lviv.cpp +++ b/src/mame/video/lviv.cpp @@ -13,7 +13,7 @@ #include "emu.h" #include "includes/lviv.h" -const unsigned char lviv_palette[8*3] = +const uint8_t lviv_state::s_palette[8*3] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0xa4, @@ -28,54 +28,46 @@ const unsigned char lviv_palette[8*3] = PALETTE_INIT_MEMBER(lviv_state, lviv) { - int i; - - for ( i = 0; i < sizeof(lviv_palette) / 3; i++ ) { - m_palette->set_pen_color(i, lviv_palette[i*3], lviv_palette[i*3+1], lviv_palette[i*3+2]); + for (int i = 0; i < sizeof(s_palette) / 3; i++) + { + m_palette->set_pen_color(i, s_palette[i*3], s_palette[i*3+1], s_palette[i*3+2]); } } -void lviv_state::lviv_update_palette(uint8_t pal) +void lviv_state::update_palette(uint8_t pal) { m_colortable[0][0] = 0; m_colortable[0][1] = 0; m_colortable[0][2] = 0; m_colortable[0][3] = 0; - m_colortable[0][0] |= (((pal>>3)&0x01) == ((pal>>4)&0x01)) ? 0x04 : 0x00; - m_colortable[0][0] |= ((pal>>5)&0x01) ? 0x02 : 0x00; - m_colortable[0][0] |= (((pal>>2)&0x01) == ((pal>>6)&0x01)) ? 0x01 : 0x00; - - m_colortable[0][1] |= ((pal&0x01) == ((pal>>4)&0x01)) ? 0x04 : 0x00; - m_colortable[0][1] |= ((pal>>5)&0x01) ? 0x02 : 0x00; - m_colortable[0][1] |= ((pal>>6)&0x01) ? 0x00 : 0x01; + m_colortable[0][0] |= (BIT(pal, 3) == BIT(pal, 4)) ? 0x04 : 0x00; + m_colortable[0][0] |= BIT(pal, 5) ? 0x02 : 0x00; + m_colortable[0][0] |= (BIT(pal, 2) == BIT(pal, 6)) ? 0x01 : 0x00; - m_colortable[0][2] |= ((pal>>4)&0x01) ? 0x04 : 0x00; - m_colortable[0][2] |= ((pal>>5)&0x01) ? 0x00 : 0x02; - m_colortable[0][2] |= ((pal>>6)&0x01) ? 0x01 : 0x00; + m_colortable[0][1] |= (BIT(pal, 0) == BIT(pal, 4)) ? 0x04 : 0x00; + m_colortable[0][1] |= BIT(pal, 5) ? 0x02 : 0x00; + m_colortable[0][1] |= BIT(pal, 6) ? 0x00 : 0x01; - m_colortable[0][3] |= ((pal>>4)&0x01) ? 0x00 : 0x04; - m_colortable[0][3] |= (((pal>>1)&0x01) == ((pal>>5)&0x01)) ? 0x02 : 0x00; - m_colortable[0][3] |= ((pal>>6)&0x01) ? 0x01 : 0x00; -} + m_colortable[0][2] |= BIT(pal, 4) ? 0x04 : 0x00; + m_colortable[0][2] |= BIT(pal, 5) ? 0x00 : 0x02; + m_colortable[0][2] |= BIT(pal, 6) ? 0x01 : 0x00; -void lviv_state::video_start() -{ + m_colortable[0][3] |= BIT(pal, 4) ? 0x00 : 0x04; + m_colortable[0][3] |= (BIT(pal, 1) == BIT(pal, 5)) ? 0x02 : 0x00; + m_colortable[0][3] |= BIT(pal, 6) ? 0x01 : 0x00; } -uint32_t lviv_state::screen_update_lviv(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +uint32_t lviv_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x,y; - int pen; - uint8_t data; - - for (y=0; y<256; y++) - for (x=0; x<256; x+=4) + for (int y = 0; y < 256; y++) + { + for (int x = 0; x < 256; x += 4) { - data = m_video_ram[y*64+x/4]; + const uint8_t data = m_video_ram[(y << 6) | (x >> 2)]; - pen = m_colortable[0][((data & 0x08) >> 3) | ((data & 0x80) >> (3+3))]; + int pen = m_colortable[0][((data & 0x08) >> 3) | ((data & 0x80) >> (3+3))]; bitmap.pix16(y, x + 0) = pen; pen = m_colortable[0][((data & 0x04) >> 2) | ((data & 0x40) >> (2+3))]; @@ -87,5 +79,6 @@ uint32_t lviv_state::screen_update_lviv(screen_device &screen, bitmap_ind16 &bit pen = m_colortable[0][((data & 0x01) >> 0) | ((data & 0x10) >> (0+3))]; bitmap.pix16(y, x + 3) = pen; } + } return 0; } |