1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
// license:BSD-3-Clause
// copyright-holders:Zsolt Vasvari, Aaron Giles
/***************************************************************************
Atari Tetris hardware
***************************************************************************/
#include "emu.h"
#include "includes/atetris.h"
/*************************************
*
* Tilemap callback
*
*************************************/
TILE_GET_INFO_MEMBER(atetris_state::get_tile_info)
{
uint8_t *videoram = m_videoram;
int code = videoram[tile_index * 2] | ((videoram[tile_index * 2 + 1] & 7) << 8);
int color = (videoram[tile_index * 2 + 1] & 0xf0) >> 4;
tileinfo.set(0, code, color, 0);
}
/*************************************
*
* Video RAM write
*
*************************************/
WRITE8_MEMBER(atetris_state::videoram_w)
{
uint8_t *videoram = m_videoram;
videoram[offset] = data;
m_bg_tilemap->mark_tile_dirty(offset / 2);
}
/*************************************
*
* Video system start
*
*************************************/
void atetris_state::video_start()
{
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(atetris_state::get_tile_info)), TILEMAP_SCAN_ROWS, 8,8, 64,32);
}
/*************************************
*
* Main refresh
*
*************************************/
uint32_t atetris_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_bg_tilemap->draw(screen, bitmap, cliprect, 0,0);
return 0;
}
|