summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/video/chqflag.c
blob: 9400c309c5845fd27bff31249db84e6210b12da6 (plain) (blame)
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
/***************************************************************************

  video.c

  Functions to emulate the video hardware of the machine.

***************************************************************************/

#include "emu.h"
#include "video/konicdev.h"
#include "includes/chqflag.h"


/***************************************************************************

  Callbacks for the K051960

***************************************************************************/

void chqflag_sprite_callback( running_machine &machine, int *code, int *color, int *priority, int *shadow )
{
	chqflag_state *state = machine.driver_data<chqflag_state>();
	*priority = (*color & 0x10) >> 4;
	*color = state->m_sprite_colorbase + (*color & 0x0f);
}


/***************************************************************************

  Callbacks for the K051316

***************************************************************************/

void chqflag_zoom_callback_0( running_machine &machine, int *code, int *color, int *flags )
{
	chqflag_state *state = machine.driver_data<chqflag_state>();
	*code |= ((*color & 0x03) << 8);
	*color = state->m_zoom_colorbase[0] + ((*color & 0x3c) >> 2);
}

void chqflag_zoom_callback_1( running_machine &machine, int *code, int *color, int *flags )
{
	chqflag_state *state = machine.driver_data<chqflag_state>();
	*flags = TILE_FLIPYX((*color & 0xc0) >> 6);
	*code |= ((*color & 0x0f) << 8);
	*color = state->m_zoom_colorbase[1] + ((*color & 0x10) >> 4);
}

/***************************************************************************

    Start the video hardware emulation.

***************************************************************************/

VIDEO_START( chqflag )
{
	chqflag_state *state = machine.driver_data<chqflag_state>();

	machine.generic.paletteram.u8 = auto_alloc_array(machine, UINT8, 0x800);

	state->m_sprite_colorbase = 0;
	state->m_zoom_colorbase[0] = 0x10;
	state->m_zoom_colorbase[1] = 0x02;

	state_save_register_global_pointer(machine, machine.generic.paletteram.u8, 0x800);
}

/***************************************************************************

    Display Refresh

***************************************************************************/

SCREEN_UPDATE( chqflag )
{
	chqflag_state *state = screen->machine().driver_data<chqflag_state>();

	bitmap_fill(bitmap, cliprect, 0);

	k051316_zoom_draw(state->m_k051316_2, bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0);
	k051960_sprites_draw(state->m_k051960, bitmap, cliprect, 0, 0);
	k051316_zoom_draw(state->m_k051316_2, bitmap, cliprect, TILEMAP_DRAW_LAYER0, 0);
	k051960_sprites_draw(state->m_k051960, bitmap, cliprect, 1, 1);
	k051316_zoom_draw(state->m_k051316_1, bitmap, cliprect, 0, 0);
	return 0;
}