mirror of
https://github.com/holub/mame
synced 2025-04-16 13:34:55 +03:00
pmd85: use standard palette, clean up video emulation
This commit is contained in:
parent
0c30315e46
commit
93bd0f0daf
@ -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",
|
||||
}
|
||||
|
@ -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")
|
||||
|
@ -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_ */
|
||||
|
@ -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<<i)) ? pen1 : pen0;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
UINT32 pmd85_state::screen_update_pmd85(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
int pmd85_scanline;
|
||||
|
||||
for (pmd85_scanline=0; pmd85_scanline<256; pmd85_scanline++)
|
||||
{
|
||||
pmd85_draw_scanline(bitmap, pmd85_scanline);
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user