summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/video/pp01.cpp
blob: 7593ed48026e7b6dd8e92c893e84bebdd7213039 (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
// license:BSD-3-Clause
// copyright-holders:Miodrag Milanovic
/***************************************************************************

        PP-01 driver by Miodrag Milanovic

        08/09/2008 Preliminary driver.

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


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

void pp01_state::video_start()
{
}

uint32_t pp01_state::screen_update_pp01(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
	uint8_t const *const ram = m_ram->pointer();

	for (int y = 0; y < 256; y++)
	{
		for (int x = 0; x < 32; x++)
		{
			uint8_t const code_r = ram[0x6000 + ((y+m_video_scroll)&0xff)*32 + x];
			uint8_t const code_g = ram[0xa000 + ((y+m_video_scroll)&0xff)*32 + x];
			uint8_t const code_b = ram[0xe000 + ((y+m_video_scroll)&0xff)*32 + x];
			for (int b = 0; b < 8; b++)
			{
				uint8_t const col = (BIT(code_r, b) << 2) | (BIT(code_g, b) << 1) | (BIT(code_b, b) << 0);
				bitmap.pix16(y, x*8+(7-b)) = col;
			}
		}
	}
	return 0;
}

static constexpr rgb_t pp01_pens[8] = {
	{ 0x00, 0x00, 0x00 }, // 0
	{ 0x00, 0x00, 0x80 }, // 1
	{ 0x00, 0x80, 0x00 }, // 2
	{ 0x00, 0x80, 0x80 }, // 3
	{ 0x80, 0x00, 0x00 }, // 4
	{ 0x80, 0x00, 0x80 }, // 5
	{ 0x80, 0x80, 0x00 }, // 6
	{ 0x80, 0x80, 0x80 }  // 7
};

void pp01_state::pp01_palette(palette_device &palette) const
{
	palette.set_pen_colors(0, pp01_pens);
}