summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/video/spcforce.cpp
blob: 28fe46ace898d46b38912f2d910bc3b17c13e0eb (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
// license:BSD-3-Clause
// copyright-holders:Zsolt Vasvari
/***************************************************************************

  spcforce.c

  Functions to emulate the video hardware of the machine.

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

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


WRITE_LINE_MEMBER(spcforce_state::flip_screen_w)
{
	flip_screen_set(!state);
}


uint32_t spcforce_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
	int offs;
	int flip = flip_screen();

	/* draw the characters as sprites because they could be overlapping */
	bitmap.fill(0, cliprect);
	for (offs = 0; offs < 0x400; offs++)
	{
		int code,sx,sy,col;

		sy = 8 * (offs / 32) -  (m_scrollram[offs]       & 0x0f);
		sx = 8 * (offs % 32) + ((m_scrollram[offs] >> 4) & 0x0f);

		code = m_videoram[offs] + ((m_colorram[offs] & 0x01) << 8);
		col  = (~m_colorram[offs] >> 4) & 0x07;

		if (flip)
		{
			sx = 248 - sx;
			sy = 248 - sy;
		}

		m_gfxdecode->gfx(0)->transpen(bitmap,cliprect,
				code, col,
				flip, flip,
				sx, sy,0);
	}

	return 0;
}