summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Dirk Best <mail@dirk-best.de>2015-07-27 13:37:27 +0200
committer Dirk Best <mail@dirk-best.de>2015-07-27 13:37:56 +0200
commitcb04819c8a4bea5c743fa2aae8f794babc97de1c (patch)
tree8536b84cfb83d64b3da9bf6ed70f12ba302d5d3b
parent6187ca5ef0c10dc563c9e401c681edc706a3de3a (diff)
dorachan: use standard 3-bit bgr palette, get rid of tag-lookup for
color prom
-rw-r--r--src/mame/drivers/dorachan.c46
1 files changed, 13 insertions, 33 deletions
diff --git a/src/mame/drivers/dorachan.c b/src/mame/drivers/dorachan.c
index 64c9bf5eba2..2a1e4f111cc 100644
--- a/src/mame/drivers/dorachan.c
+++ b/src/mame/drivers/dorachan.c
@@ -14,9 +14,6 @@ Todo:
#include "cpu/z80/z80.h"
-#define NUM_PENS (8)
-
-
class dorachan_state : public driver_device
{
public:
@@ -24,7 +21,9 @@ public:
: driver_device(mconfig, type, tag),
m_videoram(*this, "videoram"),
m_maincpu(*this, "maincpu"),
- m_screen(*this, "screen") { }
+ m_screen(*this, "screen"),
+ m_palette(*this, "palette"),
+ m_colors(*this, "colors") { }
/* memory pointers */
required_shared_ptr<UINT8> m_videoram;
@@ -41,6 +40,8 @@ public:
UINT32 screen_update_dorachan(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
required_device<cpu_device> m_maincpu;
required_device<screen_device> m_screen;
+ required_device<palette_device> m_palette;
+ required_region_ptr<UINT8> m_colors;
};
@@ -76,49 +77,29 @@ CUSTOM_INPUT_MEMBER(dorachan_state::dorachan_protection_r)
*
*************************************/
-static void get_pens(pen_t *pens)
-{
- offs_t i;
-
- for (i = 0; i < NUM_PENS; i++)
- {
- pens[i] = rgb_t(pal1bit(i >> 2), pal1bit(i >> 1), pal1bit(i >> 0));
- }
-}
-
-
UINT32 dorachan_state::screen_update_dorachan(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
- pen_t pens[NUM_PENS];
- offs_t offs;
- const UINT8 *color_map_base;
-
- get_pens(pens);
-
- color_map_base = memregion("proms")->base();
-
- for (offs = 0; offs < m_videoram.bytes(); offs++)
+ for (offs_t offs = 0; offs < m_videoram.bytes(); offs++)
{
- int i;
UINT8 fore_color;
UINT8 x = offs >> 8 << 3;
UINT8 y = offs & 0xff;
- /* the need for +1 is extremely unusual, but definetely correct */
+ /* the need for +1 is extremely unusual, but definitely correct */
offs_t color_address = ((((offs << 2) & 0x03e0) | (offs >> 8)) + 1) & 0x03ff;
UINT8 data = m_videoram[offs];
if (m_flip_screen)
- fore_color = (color_map_base[color_address] >> 3) & 0x07;
+ fore_color = (m_colors[color_address] >> 3) & 0x07;
else
- fore_color = (color_map_base[color_address] >> 0) & 0x07;
+ fore_color = (m_colors[color_address] >> 0) & 0x07;
- for (i = 0; i < 8; i++)
+ for (int i = 0; i < 8; i++)
{
UINT8 color = (data & 0x01) ? fore_color : 0;
- bitmap.pix32(y, x) = pens[color];
+ bitmap.pix32(y, x) = m_palette->pen_color(color);
data = data >> 1;
x = x + 1;
@@ -238,14 +219,12 @@ void dorachan_state::machine_reset()
}
static MACHINE_CONFIG_START( dorachan, dorachan_state )
-
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", Z80, 2000000)
MCFG_CPU_PROGRAM_MAP(dorachan_map)
MCFG_CPU_IO_MAP(dorachan_io_map)
MCFG_CPU_PERIODIC_INT_DRIVER(dorachan_state, irq0_line_hold, 2*60)
-
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_SIZE(32*8, 32*8)
@@ -253,6 +232,7 @@ static MACHINE_CONFIG_START( dorachan, dorachan_state )
MCFG_SCREEN_REFRESH_RATE(60)
MCFG_SCREEN_UPDATE_DRIVER(dorachan_state, screen_update_dorachan)
+ MCFG_PALETTE_ADD_3BIT_BGR("palette")
MACHINE_CONFIG_END
@@ -279,7 +259,7 @@ ROM_START( dorachan )
ROM_LOAD( "d12.rom", 0x7000, 0x0400, CRC(275e5dc1) SHA1(ac07db4b428daa49a52c679de95ddedbea0076b9) )
ROM_LOAD( "d13.rom", 0x7400, 0x0400, CRC(24ccfcf9) SHA1(85e5052ee657f518b0509eb64e494bc3a74e651e) )
- ROM_REGION( 0x0400, "proms", 0 ) /* color map */
+ ROM_REGION( 0x0400, "colors", 0 )
ROM_LOAD( "d14.rom", 0x0000, 0x0400, CRC(c0d3ee84) SHA1(f2207c685ce8d5144a373c28f11d2cebf9518b65) )
ROM_END