From 93bd0f0daf4bce350dc66071799edb38812a8d2f Mon Sep 17 00:00:00 2001 From: Dirk Best Date: Thu, 30 Jul 2015 10:29:41 +0200 Subject: [PATCH] pmd85: use standard palette, clean up video emulation --- scripts/target/mame/mess.lua | 1 - src/mess/drivers/pmd85.c | 33 +++++++++++++++-- src/mess/includes/pmd85.h | 7 ---- src/mess/video/pmd85.c | 69 ------------------------------------ 4 files changed, 31 insertions(+), 79 deletions(-) delete mode 100644 src/mess/video/pmd85.c diff --git a/scripts/target/mame/mess.lua b/scripts/target/mame/mess.lua index 0bbeb1915ef..abfaa3dd801 100644 --- a/scripts/target/mame/mess.lua +++ b/scripts/target/mame/mess.lua @@ -2332,7 +2332,6 @@ files { MAME_DIR .. "src/mess/video/ondra.c", MAME_DIR .. "src/mess/drivers/pmd85.c", MAME_DIR .. "src/mess/machine/pmd85.c", - MAME_DIR .. "src/mess/video/pmd85.c", MAME_DIR .. "src/mess/drivers/pmi80.c", MAME_DIR .. "src/mess/drivers/sapi1.c", } diff --git a/src/mess/drivers/pmd85.c b/src/mess/drivers/pmd85.c index 737c7e63a4f..ce1189c9592 100644 --- a/src/mess/drivers/pmd85.c +++ b/src/mess/drivers/pmd85.c @@ -182,6 +182,36 @@ I/O ports #include "formats/pmd_cas.h" #include "machine/ram.h" + +//************************************************************************** +// VIDEO EMULATION +//************************************************************************** + +UINT32 pmd85_state::screen_update_pmd85(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + for (int y = 0; y < 256; y++) + { + // address of current line in PMD-85 video memory + UINT8 *line = m_ram->pointer() + 0xc000 + 0x40 * y; + + for (int x = 0; x < 288/6; x++) + { + int pen = BIT(line[x], 7) ? 1 : 2; + + bitmap.pix16(y, x * 6 + 0) = BIT(line[x], 0) ? pen : 0; + bitmap.pix16(y, x * 6 + 1) = BIT(line[x], 1) ? pen : 0; + bitmap.pix16(y, x * 6 + 2) = BIT(line[x], 2) ? pen : 0; + bitmap.pix16(y, x * 6 + 3) = BIT(line[x], 3) ? pen : 0; + bitmap.pix16(y, x * 6 + 4) = BIT(line[x], 4) ? pen : 0; + bitmap.pix16(y, x * 6 + 5) = BIT(line[x], 5) ? pen : 0; + } + + } + + return 0; +} + + /* I/O ports */ static ADDRESS_MAP_START( pmd85_io_map, AS_IO, 8, pmd85_state ) @@ -578,8 +608,7 @@ static MACHINE_CONFIG_START( pmd85, pmd85_state ) MCFG_SCREEN_UPDATE_DRIVER(pmd85_state, screen_update_pmd85) MCFG_SCREEN_PALETTE("palette") - MCFG_PALETTE_ADD("palette", sizeof (pmd85_palette) / 3) - MCFG_PALETTE_INIT_OWNER(pmd85_state, pmd85) + MCFG_PALETTE_ADD_MONOCHROME_GREEN_HIGHLIGHT("palette") /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") diff --git a/src/mess/includes/pmd85.h b/src/mess/includes/pmd85.h index 46ec61a52d9..07d9986994b 100644 --- a/src/mess/includes/pmd85.h +++ b/src/mess/includes/pmd85.h @@ -76,8 +76,6 @@ public: DECLARE_DRIVER_INIT(alfa); DECLARE_DRIVER_INIT(c2717); virtual void machine_reset(); - virtual void video_start(); - DECLARE_PALETTE_INIT(pmd85); UINT32 screen_update_pmd85(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); TIMER_CALLBACK_MEMBER(pmd85_cassette_timer_callback); DECLARE_WRITE_LINE_MEMBER(write_cas_tx); @@ -148,15 +146,10 @@ protected: void mato_update_memory(); void c2717_update_memory(); void pmd85_common_driver_init(); - void pmd85_draw_scanline(bitmap_ind16 &bitmap, int pmd85_scanline); virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); int m_cas_tx; }; -/*----------- defined in video/pmd85.c -----------*/ - -extern const unsigned char pmd85_palette[3*3]; - #endif /* PMD85_H_ */ diff --git a/src/mess/video/pmd85.c b/src/mess/video/pmd85.c deleted file mode 100644 index 146e7a03e6f..00000000000 --- a/src/mess/video/pmd85.c +++ /dev/null @@ -1,69 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Krzysztof Strzecha -/*************************************************************************** - - pmd85.c - - Functions to emulate the video hardware of PMD-85. - - Krzysztof Strzecha - -***************************************************************************/ - -#include "emu.h" -#include "includes/pmd85.h" - -const unsigned char pmd85_palette[3*3] = -{ - 0x00, 0x00, 0x00, - 0x7f, 0x7f, 0x7f, - 0xff, 0xff, 0xff -}; - -PALETTE_INIT_MEMBER(pmd85_state, pmd85) -{ - int i; - - for ( i = 0; i < sizeof(pmd85_palette) / 3; i++ ) { - m_palette->set_pen_color(i, pmd85_palette[i*3], pmd85_palette[i*3+1], pmd85_palette[i*3+2]); - } -} - -void pmd85_state::video_start() -{ -} - -void pmd85_state::pmd85_draw_scanline(bitmap_ind16 &bitmap, int pmd85_scanline) -{ - int x, i; - int pen0, pen1; - UINT8 data; - - /* set up scanline */ - UINT16 *scanline = &bitmap.pix16(pmd85_scanline); - - /* address of current line in PMD-85 video memory */ - UINT8* pmd85_video_ram_line = m_ram->pointer() + 0xc000 + 0x40*pmd85_scanline; - - for (x=0; x<288; x+=6) - { - data = pmd85_video_ram_line[x/6]; - pen0 = 0; - pen1 = data & 0x80 ? 1 : 2; - - for (i=0; i<6; i++) - scanline[x+i] = (data & (0x01<