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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
#include "driver.h"
#include "iqblock.h"
UINT8 *iqblock_bgvideoram;
//UINT8 *iqblock_fgscroll;
UINT8 *iqblock_fgvideoram;
int iqblock_videoenable;
int iqblock_video_type;
static tilemap *bg_tilemap,*fg_tilemap;
/***************************************************************************
Callbacks for the TileMap code
***************************************************************************/
static TILE_GET_INFO( get_bg_tile_info )
{
int code = iqblock_bgvideoram[tile_index] + (iqblock_bgvideoram[tile_index + 0x800] << 8);
SET_TILE_INFO(
0,
code &(iqblock_video_type ? 0x1fff : 0x3fff),
iqblock_video_type? (2*(code >> 13)+1) : (4*(code >> 14)+3),
0);
}
static TILE_GET_INFO( get_fg_tile_info )
{
int code = iqblock_fgvideoram[tile_index];
SET_TILE_INFO(
1,
code & 0x7f,
(code & 0x80) ? 3 : 0,
0);
}
/***************************************************************************
Start the video hardware emulation.
***************************************************************************/
VIDEO_START( iqblock )
{
bg_tilemap = tilemap_create(get_bg_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN, 8, 8,64,32);
fg_tilemap = tilemap_create(get_fg_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,32,64, 8);
tilemap_set_transparent_pen(bg_tilemap,0);
tilemap_set_scroll_cols(fg_tilemap,64);
}
/***************************************************************************
Memory handlers
***************************************************************************/
WRITE8_HANDLER( iqblock_fgvideoram_w )
{
iqblock_fgvideoram[offset] = data;
tilemap_mark_tile_dirty(fg_tilemap,offset);
}
WRITE8_HANDLER( iqblock_bgvideoram_w )
{
iqblock_bgvideoram[offset] = data;
tilemap_mark_tile_dirty(bg_tilemap,offset & 0x7ff);
}
READ8_HANDLER( iqblock_bgvideoram_r )
{
return iqblock_bgvideoram[offset];
}
WRITE8_HANDLER( iqblock_fgscroll_w )
{
tilemap_set_scrolly(fg_tilemap,offset,data);
}
/***************************************************************************
Display refresh
***************************************************************************/
VIDEO_UPDATE( iqblock )
{
if (!iqblock_videoenable) return 0;
tilemap_draw(bitmap,cliprect,fg_tilemap,0,0);
tilemap_draw(bitmap,cliprect,bg_tilemap,0,0);
return 0;
}
|