summaryrefslogtreecommitdiffstatshomepage
path: root/src/mess/video/pp01.c
blob: 915c4ad791f6ac8dec9780ea74e3263b19cd49cb (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
/***************************************************************************

        PP-01 driver by Miodrag Milanovic

        08/09/2008 Preliminary driver.

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


#include "emu.h"
#include "includes/pp01.h"
#include "machine/ram.h"

VIDEO_START( pp01 )
{
}

SCREEN_UPDATE_IND16( pp01 )
{
	pp01_state *state = screen.machine().driver_data<pp01_state>();
	UINT8 code_r,code_g,code_b;
	UINT8 col;
	int y, x, b;
	UINT8 *ram = screen.machine().device<ram_device>(RAM_TAG)->pointer();

	for (y = 0; y < 256; y++)
	{
		for (x = 0; x < 32; x++)
		{
			code_r = ram[0x6000 + ((y+state->m_video_scroll)&0xff)*32 + x];
			code_g = ram[0xa000 + ((y+state->m_video_scroll)&0xff)*32 + x];
			code_b = ram[0xe000 + ((y+state->m_video_scroll)&0xff)*32 + x];
			for (b = 0; b < 8; b++)
			{
				col = (((code_r >> b) & 0x01) ? 4 : 0) + (((code_g >> b) & 0x01) ? 2 : 0) + (((code_b >> b) & 0x01) ? 1 : 0);
				bitmap.pix16(y, x*8+(7-b)) =  col;
			}
		}
	}
	return 0;
}

static const rgb_t pp01_palette[8] = {
	MAKE_RGB(0x00, 0x00, 0x00), // 0
	MAKE_RGB(0x00, 0x00, 0x80), // 1
	MAKE_RGB(0x00, 0x80, 0x00), // 2
	MAKE_RGB(0x00, 0x80, 0x80), // 3
	MAKE_RGB(0x80, 0x00, 0x00), // 4
	MAKE_RGB(0x80, 0x00, 0x80), // 5
	MAKE_RGB(0x80, 0x80, 0x00), // 6
	MAKE_RGB(0x80, 0x80, 0x80), // 7
};

PALETTE_INIT( pp01 )
{
	palette_set_colors(machine, 0, pp01_palette, ARRAY_LENGTH(pp01_palette));
}