mirror of
https://github.com/holub/mame
synced 2025-04-29 11:30:28 +03:00
RGB palette support for correct SY-889 colours
This commit is contained in:
parent
040bd0c8d2
commit
b783dfc797
@ -40,10 +40,21 @@ READ8_MEMBER(ppu_vt03_device::palette_read)
|
|||||||
|
|
||||||
void ppu_vt03_device::set_new_pen(int i)
|
void ppu_vt03_device::set_new_pen(int i)
|
||||||
{
|
{
|
||||||
uint16_t palval = (m_newpal[i&0x7f] & 0x3f) | ((m_newpal[(i&0x7f)+0x80] & 0x3f)<<6);
|
if(m_pal_mode == PAL_MODE_NEW_RGB) {
|
||||||
// &0x3f so we don't attempt to use any of the extended colours right now because
|
|
||||||
// I haven't managed to work out the format
|
uint16_t rgbval = (m_newpal[i&0x7f] & 0xff) | ((m_newpal[(i&0x7f)+0x80] & 0xff)<<8);
|
||||||
m_palette->set_pen_indirect(i&0x7f,palval&0x3f);
|
logerror ("pal %d rgb %04x\n",i,rgbval);
|
||||||
|
uint8_t blue = (rgbval & 0x001f) << 3;
|
||||||
|
uint8_t green = (rgbval & 0x3e0) >> 2;
|
||||||
|
uint8_t red = (rgbval & 0x7C00) >> 7;
|
||||||
|
m_palette->set_pen_color(i & 0x7f, rgb_t(red, green, blue));
|
||||||
|
} else {
|
||||||
|
uint16_t palval = (m_newpal[i&0x7f] & 0x3f) | ((m_newpal[(i&0x7f)+0x80] & 0x3f)<<6);
|
||||||
|
// &0x3f so we don't attempt to use any of the extended colours right now because
|
||||||
|
// I haven't managed to work out the format
|
||||||
|
m_palette->set_pen_indirect(i&0x7f,palval&0x3f);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WRITE8_MEMBER(ppu_vt03_device::palette_write)
|
WRITE8_MEMBER(ppu_vt03_device::palette_write)
|
||||||
|
@ -25,6 +25,16 @@
|
|||||||
#define MCFG_PPU_VT03_READ_SP_CB(_devcb) \
|
#define MCFG_PPU_VT03_READ_SP_CB(_devcb) \
|
||||||
devcb = &ppu_vt03_device::set_read_sp_callback(*device, DEVCB_##_devcb);
|
devcb = &ppu_vt03_device::set_read_sp_callback(*device, DEVCB_##_devcb);
|
||||||
|
|
||||||
|
#define MCFG_PPU_VT03_MODIFY MCFG_DEVICE_MODIFY
|
||||||
|
|
||||||
|
#define MCFG_PPU_VT03_SET_PAL_MODE(pmode) \
|
||||||
|
ppu_vt03_device::set_palette_mode(*device, pmode);
|
||||||
|
|
||||||
|
enum vtxx_pal_mode {
|
||||||
|
PAL_MODE_VT0x,
|
||||||
|
PAL_MODE_NEW_RGB,
|
||||||
|
};
|
||||||
|
|
||||||
class ppu_vt03_device : public ppu2c0x_device {
|
class ppu_vt03_device : public ppu2c0x_device {
|
||||||
public:
|
public:
|
||||||
ppu_vt03_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
ppu_vt03_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||||
@ -32,6 +42,8 @@ public:
|
|||||||
template <class Object> static devcb_base &set_read_bg_callback(device_t &device, Object &&cb) { return downcast<ppu_vt03_device &>(device).m_read_bg.set_callback(std::forward<Object>(cb)); }
|
template <class Object> static devcb_base &set_read_bg_callback(device_t &device, Object &&cb) { return downcast<ppu_vt03_device &>(device).m_read_bg.set_callback(std::forward<Object>(cb)); }
|
||||||
template <class Object> static devcb_base &set_read_sp_callback(device_t &device, Object &&cb) { return downcast<ppu_vt03_device &>(device).m_read_sp.set_callback(std::forward<Object>(cb)); }
|
template <class Object> static devcb_base &set_read_sp_callback(device_t &device, Object &&cb) { return downcast<ppu_vt03_device &>(device).m_read_sp.set_callback(std::forward<Object>(cb)); }
|
||||||
|
|
||||||
|
static void set_palette_mode(device_t &device, vtxx_pal_mode pmode) { downcast<ppu_vt03_device &>(device).m_pal_mode = pmode; }
|
||||||
|
|
||||||
virtual DECLARE_READ8_MEMBER(read) override;
|
virtual DECLARE_READ8_MEMBER(read) override;
|
||||||
virtual DECLARE_WRITE8_MEMBER(write) override;
|
virtual DECLARE_WRITE8_MEMBER(write) override;
|
||||||
virtual DECLARE_READ8_MEMBER(palette_read) override;
|
virtual DECLARE_READ8_MEMBER(palette_read) override;
|
||||||
@ -74,6 +86,8 @@ private:
|
|||||||
|
|
||||||
uint8_t m_201x_regs[0x20];
|
uint8_t m_201x_regs[0x20];
|
||||||
|
|
||||||
|
vtxx_pal_mode m_pal_mode = PAL_MODE_VT0x;
|
||||||
|
|
||||||
void set_2010_reg(uint8_t data);
|
void set_2010_reg(uint8_t data);
|
||||||
|
|
||||||
void set_new_pen(int i);
|
void set_new_pen(int i);
|
||||||
|
@ -121,7 +121,7 @@ private:
|
|||||||
void scanline_irq(int scanline, int vblank, int blanked);
|
void scanline_irq(int scanline, int vblank, int blanked);
|
||||||
uint8_t m_410x[0xc];
|
uint8_t m_410x[0xc];
|
||||||
|
|
||||||
uint8_t vdma_ctrl;
|
uint8_t m_vdma_ctrl;
|
||||||
|
|
||||||
int m_timer_irq_enabled;
|
int m_timer_irq_enabled;
|
||||||
int m_timer_running;
|
int m_timer_running;
|
||||||
@ -749,9 +749,9 @@ WRITE8_MEMBER(nes_vt_state::nes_vh_sprite_dma_w)
|
|||||||
|
|
||||||
WRITE8_MEMBER(nes_vt_state::vt_hh_sprite_dma_w)
|
WRITE8_MEMBER(nes_vt_state::vt_hh_sprite_dma_w)
|
||||||
{
|
{
|
||||||
uint8_t dma_mode = vdma_ctrl & 0x01;
|
uint8_t dma_mode = m_vdma_ctrl & 0x01;
|
||||||
uint8_t dma_len = (vdma_ctrl >> 1) & 0x07;
|
uint8_t dma_len = (m_vdma_ctrl >> 1) & 0x07;
|
||||||
uint8_t src_nib_74 = (vdma_ctrl >> 4) & 0x0F;
|
uint8_t src_nib_74 = (m_vdma_ctrl >> 4) & 0x0F;
|
||||||
int length = 256;
|
int length = 256;
|
||||||
switch(dma_len) {
|
switch(dma_len) {
|
||||||
case 0x0: length = 256; break;
|
case 0x0: length = 256; break;
|
||||||
@ -761,7 +761,7 @@ WRITE8_MEMBER(nes_vt_state::vt_hh_sprite_dma_w)
|
|||||||
case 0x7: length = 128; break;
|
case 0x7: length = 128; break;
|
||||||
}
|
}
|
||||||
uint16_t src_addr = (data << 8) | (src_nib_74 << 4);
|
uint16_t src_addr = (data << 8) | (src_nib_74 << 4);
|
||||||
logerror("vthh dma start ctrl=%02x addr=%04x\n", vdma_ctrl, src_addr);
|
logerror("vthh dma start ctrl=%02x addr=%04x\n", m_vdma_ctrl, src_addr);
|
||||||
for (int i = 0; i < length; i++)
|
for (int i = 0; i < length; i++)
|
||||||
{
|
{
|
||||||
uint8_t spriteData = space.read_byte(src_addr + i);
|
uint8_t spriteData = space.read_byte(src_addr + i);
|
||||||
@ -779,7 +779,7 @@ WRITE8_MEMBER(nes_vt_state::vt_hh_sprite_dma_w)
|
|||||||
|
|
||||||
WRITE8_MEMBER(nes_vt_state::vt03_4034_w)
|
WRITE8_MEMBER(nes_vt_state::vt03_4034_w)
|
||||||
{
|
{
|
||||||
vdma_ctrl = data;
|
m_vdma_ctrl = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ADDRESS_MAP_START( nes_vt_map, AS_PROGRAM, 8, nes_vt_state )
|
static ADDRESS_MAP_START( nes_vt_map, AS_PROGRAM, 8, nes_vt_state )
|
||||||
@ -935,6 +935,8 @@ MACHINE_CONFIG_END
|
|||||||
static MACHINE_CONFIG_DERIVED( nes_vt_hh, nes_vt_xx )
|
static MACHINE_CONFIG_DERIVED( nes_vt_hh, nes_vt_xx )
|
||||||
MCFG_CPU_MODIFY("maincpu")
|
MCFG_CPU_MODIFY("maincpu")
|
||||||
MCFG_CPU_PROGRAM_MAP(nes_vt_hh_map)
|
MCFG_CPU_PROGRAM_MAP(nes_vt_hh_map)
|
||||||
|
MCFG_PPU_VT03_MODIFY("ppu")
|
||||||
|
MCFG_PPU_VT03_SET_PAL_MODE(PAL_MODE_NEW_RGB);
|
||||||
MACHINE_CONFIG_END
|
MACHINE_CONFIG_END
|
||||||
|
|
||||||
static INPUT_PORTS_START( nes_vt )
|
static INPUT_PORTS_START( nes_vt )
|
||||||
|
Loading…
Reference in New Issue
Block a user