diff options
Diffstat (limited to 'src/mame/video/commando.cpp')
-rw-r--r-- | src/mame/video/commando.cpp | 128 |
1 files changed, 0 insertions, 128 deletions
diff --git a/src/mame/video/commando.cpp b/src/mame/video/commando.cpp deleted file mode 100644 index 0297de67b10..00000000000 --- a/src/mame/video/commando.cpp +++ /dev/null @@ -1,128 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nicola Salmoria -/*************************************************************************** - - commando.cpp - - Functions to emulate the video hardware of the machine. - -***************************************************************************/ - -#include "emu.h" -#include "includes/commando.h" - - -void commando_state::commando_videoram_w(offs_t offset, uint8_t data) -{ - m_videoram[offset] = data; - m_bg_tilemap->mark_tile_dirty(offset); -} - -void commando_state::commando_colorram_w(offs_t offset, uint8_t data) -{ - m_colorram[offset] = data; - m_bg_tilemap->mark_tile_dirty(offset); -} - -void commando_state::commando_videoram2_w(offs_t offset, uint8_t data) -{ - m_videoram2[offset] = data; - m_fg_tilemap->mark_tile_dirty(offset); -} - -void commando_state::commando_colorram2_w(offs_t offset, uint8_t data) -{ - m_colorram2[offset] = data; - m_fg_tilemap->mark_tile_dirty(offset); -} - -void commando_state::commando_scrollx_w(offs_t offset, uint8_t data) -{ - m_scroll_x[offset] = data; - m_bg_tilemap->set_scrollx(0, m_scroll_x[0] | (m_scroll_x[1] << 8)); -} - -void commando_state::commando_scrolly_w(offs_t offset, uint8_t data) -{ - m_scroll_y[offset] = data; - m_bg_tilemap->set_scrolly(0, m_scroll_y[0] | (m_scroll_y[1] << 8)); -} - -void commando_state::commando_c804_w(uint8_t data) -{ - // bits 0 and 1 are coin counters - machine().bookkeeping().coin_counter_w(0, data & 0x01); - machine().bookkeeping().coin_counter_w(1, data & 0x02); - - // bit 4 resets the sound CPU - m_audiocpu->set_input_line(INPUT_LINE_RESET, (data & 0x10) ? ASSERT_LINE : CLEAR_LINE); - - // bit 7 flips screen - flip_screen_set(data & 0x80); -} - -TILE_GET_INFO_MEMBER(commando_state::get_bg_tile_info) -{ - int attr = m_colorram[tile_index]; - int code = m_videoram[tile_index] + ((attr & 0xc0) << 2); - int color = attr & 0x0f; - int flags = TILE_FLIPYX((attr & 0x30) >> 4); - - tileinfo.set(1, code, color, flags); -} - -TILE_GET_INFO_MEMBER(commando_state::get_fg_tile_info) -{ - int attr = m_colorram2[tile_index]; - int code = m_videoram2[tile_index] + ((attr & 0xc0) << 2); - int color = attr & 0x0f; - int flags = TILE_FLIPYX((attr & 0x30) >> 4); - - tileinfo.set(0, code, color, flags); -} - -void commando_state::video_start() -{ - m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(commando_state::get_bg_tile_info)), TILEMAP_SCAN_COLS, 16, 16, 32, 32); - m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(commando_state::get_fg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); - - m_fg_tilemap->set_transparent_pen(3); -} - -void commando_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) -{ - uint8_t *buffered_spriteram = m_spriteram->buffer(); - int offs; - - for (offs = m_spriteram->bytes() - 4; offs >= 0; offs -= 4) - { - // bit 1 of attr is not used - int attr = buffered_spriteram[offs + 1]; - int bank = (attr & 0xc0) >> 6; - int code = buffered_spriteram[offs] + 256 * bank; - int color = (attr & 0x30) >> 4; - int flipx = attr & 0x04; - int flipy = attr & 0x08; - int sx = buffered_spriteram[offs + 3] - ((attr & 0x01) << 8); - int sy = buffered_spriteram[offs + 2]; - - if (flip_screen()) - { - sx = 240 - sx; - sy = 240 - sy; - flipx = !flipx; - flipy = !flipy; - } - - if (bank < 3) - m_gfxdecode->gfx(2)->transpen(bitmap,cliprect, code, color, flipx, flipy, sx, sy, 15); - } -} - -uint32_t commando_state::screen_update_commando(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - draw_sprites(bitmap, cliprect); - m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - return 0; -} |