1 // license:BSD-3-Clause
2 // copyright-holders:Tomasz Slanina, Roberto Fresca
3 /***************************************************************************
4 
5   IDSA 4 En Raya
6 
7   Functions to emulate the video hardware of the machine.
8 
9 ***************************************************************************/
10 
11 #include "emu.h"
12 #include "includes/4enraya.h"
13 
fenraya_videoram_w(offs_t offset,uint8_t data)14 void _4enraya_state::fenraya_videoram_w(offs_t offset, uint8_t data)
15 {
16 	m_videoram[(offset & 0x3ff) * 2] = data;
17 	m_videoram[(offset & 0x3ff) * 2 + 1] = (offset & 0xc00) >> 10;
18 	m_bg_tilemap->mark_tile_dirty(offset & 0x3ff);
19 }
20 
TILE_GET_INFO_MEMBER(_4enraya_state::get_tile_info)21 TILE_GET_INFO_MEMBER(_4enraya_state::get_tile_info)
22 {
23 	int code = m_videoram[tile_index * 2] + (m_videoram[tile_index * 2 + 1] << 8);
24 	tileinfo.set(0, code, 0, 0);
25 }
26 
video_start()27 void _4enraya_state::video_start()
28 {
29 	m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(_4enraya_state::get_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
30 }
31 
screen_update_4enraya(screen_device & screen,bitmap_ind16 & bitmap,const rectangle & cliprect)32 uint32_t _4enraya_state::screen_update_4enraya(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
33 {
34 	m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
35 	return 0;
36 }
37