summaryrefslogtreecommitdiffstatshomepage
path: root/src/mess/video/mc68328.c
blob: 16c05c59c7ea4a39375b6ba8a1f21a4737360702 (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
/**********************************************************************

    Motorola 68328 ("DragonBall") System-on-a-Chip LCD implementation

    By MooglyGuy
    contact mooglyguy@gmail.com with licensing and usage questions.

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

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

/* THIS IS PRETTY MUCH TOTALLY WRONG AND DOESN'T REFLECT THE MC68328'S INTERNAL FUNCTIONALITY AT ALL! */
PALETTE_INIT( mc68328 )
{
	palette_set_color_rgb(machine, 0, 0x7b, 0x8c, 0x5a);
	palette_set_color_rgb(machine, 1, 0x00, 0x00, 0x00);
}

VIDEO_START( mc68328 )
{
}

/* THIS IS PRETTY MUCH TOTALLY WRONG AND DOESN'T REFLECT THE MC68328'S INTERNAL FUNCTIONALITY AT ALL! */
SCREEN_UPDATE_IND16( mc68328 )
{
	device_t *mc68328_device = screen.machine().device(MC68328_TAG);
	mc68328_t* mc68328 = mc68328_get_safe_token( mc68328_device );

	const UINT16 *video_ram = (const UINT16 *)(screen.machine().device<ram_device>(RAM_TAG)->pointer() + (mc68328->regs.lssa & 0x00ffffff));
	UINT16 word;
	UINT16 *line;
	int y, x, b;

	if(mc68328->regs.lckcon & LCKCON_LCDC_EN)
	{
		for (y = 0; y < 160; y++)
		{
			line = &bitmap.pix16(y);

			for (x = 0; x < 160; x += 16)
			{
				word = *(video_ram++);
				for (b = 0; b < 16; b++)
				{
					line[x + b] = (word >> (15 - b)) & 0x0001;
				}
			}
		}
	}
	else
	{
		for (y = 0; y < 160; y++)
		{
			line = &bitmap.pix16(y);

			for (x = 0; x < 160; x++)
			{
				line[x] = 0;
			}
		}
	}
	return 0;
}