diff options
Diffstat (limited to 'src/mame/video/galivan.cpp')
-rw-r--r-- | src/mame/video/galivan.cpp | 79 |
1 files changed, 65 insertions, 14 deletions
diff --git a/src/mame/video/galivan.cpp b/src/mame/video/galivan.cpp index c66eabe36d1..fb20b4cfef3 100644 --- a/src/mame/video/galivan.cpp +++ b/src/mame/video/galivan.cpp @@ -34,7 +34,8 @@ background: 0x4000 bytes of ROM: 76543210 tile code low bits #include "emu.h" #include "includes/galivan.h" -/* Layers has only bits 5-6 active. +/* Layers has only bits 5-7 active. + 7 selects text off/on 6 selects background off/on 5 controls sprite priority (active only on title screen, not for scores or push start nor game) @@ -42,7 +43,7 @@ background: 0x4000 bytes of ROM: 76543210 tile code low bits /* Notes: - write_layers and layers are used in galivan/dangar but not ninjemak + layers are used in galivan/dangar but not ninjemak ninjemak_dispdisable is used in ninjemak but not galivan/dangar */ @@ -71,6 +72,56 @@ void galivan_state::galivan_palette(palette_device &palette) const // color_prom now points to the beginning of the lookup table color_prom += 0x300; + // characters use colors 0-0x3f + // the bottom two bits of the color code select the palette bank for pens 0-7; + // the top two bits for pens 8-15. + for (int i = 0; i < 0x100; i++) + { + uint8_t const ctabentry = (i & 0x0f) | ((i >> ((i & 0x08) ? 2 : 0)) & 0x30); + + palette.set_pen_indirect(i, ctabentry); + } + + // I think that background tiles use colors 0xc0-0xff in four banks + // the bottom two bits of the color code select the palette bank for pens 0-7; + // the top two bits for pens 8-15. + for (int i = 0; i < 0x100; i++) + { + uint8_t const ctabentry = 0xc0 | (i & 0x0f) | ((i >> ((i & 0x08) ? 2 : 0)) & 0x30); + + palette.set_pen_indirect(0x100 + i, ctabentry); + } + + // sprites use colors 0x80-0xbf in four banks + // The lookup table tells which colors to pick from the selected bank + // the bank is selected by another PROM and depends on the top 7 bits of the sprite code. + // The PROM selects the bank *separately* for pens 0-7 and 8-15 (like for tiles). + for (int i = 0; i < 0x1000; i++) + { + uint8_t const ctabentry = 0x80 | ((i << ((i & 0x80) ? 2 : 4)) & 0x30) | (color_prom[i >> 4] & 0x0f); + int const i_swapped = ((i & 0x0f) << 8) | ((i & 0xff0) >> 4); + + palette.set_pen_indirect(0x200 + i_swapped, ctabentry); + } +} + +void galivan_state::ninjemak_palette(palette_device& palette) const +{ + const uint8_t *color_prom = memregion("proms")->base(); + + // create a lookup table for the palette + for (int i = 0; i < 0x100; i++) + { + int const r = pal4bit(color_prom[i + 0x000]); + int const g = pal4bit(color_prom[i + 0x100]); + int const b = pal4bit(color_prom[i + 0x200]); + + palette.set_indirect_color(i, rgb_t(r, g, b)); + } + + // color_prom now points to the beginning of the lookup table + color_prom += 0x300; + // characters use colors 0-0x7f for (int i = 0; i < 0x80; i++) palette.set_pen_indirect(i, i); @@ -123,7 +174,7 @@ TILE_GET_INFO_MEMBER(galivan_state::get_tx_tile_info) int code = m_videoram[tile_index] | ((attr & 0x01) << 8); SET_TILE_INFO_MEMBER(0, code, - (attr & 0xe0) >> 5, /* not sure */ + (attr & 0x78) >> 3, /* seems correct */ 0); tileinfo.category = attr & 8 ? 0 : 1; /* seems correct */ } @@ -247,13 +298,7 @@ WRITE8_MEMBER(galivan_state::galivan_scrollx_w) { if (offset == 1) { - if (data & 0x80) - m_write_layers = 1; - else if (m_write_layers) - { - m_layers = data & 0x60; - m_write_layers = 0; - } + m_layers = data & 0xe0; } m_galivan_scrollx[offset] = data; } @@ -324,15 +369,21 @@ uint32_t galivan_state::screen_update_galivan(screen_device &screen, bitmap_ind1 if (m_layers & 0x20) { - m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 0); - m_tx_tilemap->draw(screen, bitmap, cliprect, 1, 0); + if ((m_layers & 0x80) == 0) + { + m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 0); + m_tx_tilemap->draw(screen, bitmap, cliprect, 1, 0); + } draw_sprites(bitmap, cliprect); } else { draw_sprites(bitmap, cliprect); - m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 0); - m_tx_tilemap->draw(screen, bitmap, cliprect, 1, 0); + if ((m_layers & 0x80) == 0) + { + m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 0); + m_tx_tilemap->draw(screen, bitmap, cliprect, 1, 0); + } } return 0; |