summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/video/polyplay.c
blob: 220e55dfa8c165fd6fd67861f68b36e92cab227f (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
/***************************************************************************

  Poly-Play
  (c) 1985 by VEB Polytechnik Karl-Marx-Stadt

  video hardware

  driver written by Martin Buchholz (buchholz@mail.uni-greifswald.de)

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

#include "emu.h"
#include "includes/polyplay.h"


PALETTE_INIT( polyplay )
{
	palette_set_color(machine,0,MAKE_RGB(0x00,0x00,0x00));
	palette_set_color(machine,1,MAKE_RGB(0xff,0xff,0xff));

	palette_set_color(machine,2,MAKE_RGB(0x00,0x00,0x00));
	palette_set_color(machine,3,MAKE_RGB(0xff,0x00,0x00));
	palette_set_color(machine,4,MAKE_RGB(0x00,0xff,0x00));
	palette_set_color(machine,5,MAKE_RGB(0xff,0xff,0x00));
	palette_set_color(machine,6,MAKE_RGB(0x00,0x00,0xff));
	palette_set_color(machine,7,MAKE_RGB(0xff,0x00,0xff));
	palette_set_color(machine,8,MAKE_RGB(0x00,0xff,0xff));
	palette_set_color(machine,9,MAKE_RGB(0xff,0xff,0xff));
}


WRITE8_HANDLER( polyplay_characterram_w )
{
	polyplay_state *state = space->machine().driver_data<polyplay_state>();
	if (state->m_characterram[offset] != data)
	{
		gfx_element_mark_dirty(space->machine().gfx[1], (offset >> 3) & 0x7f);

		state->m_characterram[offset] = data;
	}
}

VIDEO_START( polyplay )
{
	polyplay_state *state = machine.driver_data<polyplay_state>();
	gfx_element_set_source(machine.gfx[1], state->m_characterram);
}


SCREEN_UPDATE( polyplay )
{
	polyplay_state *state = screen->machine().driver_data<polyplay_state>();
	UINT8 *videoram = state->m_videoram;
	offs_t offs;


	for (offs = 0; offs < 0x800; offs++)
	{
		int sx = (offs & 0x3f) << 3;
		int sy = offs >> 6 << 3;
		UINT8 code = videoram[offs];

		drawgfx_opaque(bitmap,cliprect, screen->machine().gfx[(code >> 7) & 0x01],
				code, 0, 0, 0, sx, sy);
	}

	return 0;
}