mirror of
https://github.com/holub/mame
synced 2025-07-02 16:49:22 +03:00
some tidying (nw)
This commit is contained in:
parent
c9190b482c
commit
f3d04843e3
@ -52,8 +52,8 @@ public:
|
||||
nesapu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
|
||||
|
||||
// static configuration helpers
|
||||
template<class _Object> static devcb_base &set_irq_handler(device_t &device, _Object object) { return downcast<nesapu_device &>(device).m_irq_handler.set_callback(object); }
|
||||
template<class _Object> static devcb_base &set_mem_read_callback(device_t &device, _Object object) { return downcast<nesapu_device &>(device).m_mem_read_cb.set_callback(object); }
|
||||
template <class Object> static devcb_base &set_irq_handler(device_t &device, Object &&cb) { return downcast<nesapu_device &>(device).m_irq_handler.set_callback(std::forward<Object>(cb)); }
|
||||
template <class Object> static devcb_base &set_mem_read_callback(device_t &device, Object &&cb) { return downcast<nesapu_device &>(device).m_mem_read_cb.set_callback(std::forward<Object>(cb)); }
|
||||
|
||||
virtual void device_clock_changed() override;
|
||||
|
||||
|
@ -128,32 +128,64 @@ void ppu_vt03_device::read_sprite_plane_data(int address)
|
||||
m_va34 = 0;
|
||||
m_planebuf[0] = m_read_sp((address + 0) & 0x1fff);
|
||||
m_planebuf[1] = m_read_sp((address + 8) & 0x1fff);
|
||||
m_va34 = 1;
|
||||
m_extplanebuf[0] = m_read_sp((address + 0) & 0x1fff);
|
||||
m_extplanebuf[1] = m_read_sp((address + 8) & 0x1fff);
|
||||
|
||||
int is4bpp = get_201x_reg(0x0) & 0x04;
|
||||
|
||||
if (is4bpp)
|
||||
{
|
||||
m_va34 = 1;
|
||||
m_extplanebuf[0] = m_read_sp((address + 0) & 0x1fff);
|
||||
m_extplanebuf[1] = m_read_sp((address + 8) & 0x1fff);
|
||||
}
|
||||
}
|
||||
|
||||
void ppu_vt03_device::make_sprite_pixel_data(uint8_t &pixel_data, int flipx)
|
||||
{
|
||||
ppu2c0x_device::make_sprite_pixel_data(pixel_data, flipx);
|
||||
|
||||
if (flipx)
|
||||
int is4bpp = get_201x_reg(0x0) & 0x04;
|
||||
|
||||
if (is4bpp)
|
||||
{
|
||||
pixel_data |= (((m_extplanebuf[0] & 1) << 5) | ((m_extplanebuf[1] & 1) << 6)); // yes, shift by 5 and 6 because of the way the palette is arranged in RAM
|
||||
m_extplanebuf[0] = m_extplanebuf[0] >> 1;
|
||||
m_extplanebuf[1] = m_extplanebuf[1] >> 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
pixel_data |= (((m_extplanebuf[0] >> 7) & 1) << 5) | (((m_extplanebuf[1] >> 7) & 1) << 6); // yes, shift by 5 and 6 because of the way the palette is arranged in RAM
|
||||
m_extplanebuf[0] = m_extplanebuf[0] << 1;
|
||||
m_extplanebuf[1] = m_extplanebuf[1] << 1;
|
||||
if (flipx)
|
||||
{
|
||||
// yes, shift by 5 and 6 because of the way the palette is arranged in RAM
|
||||
pixel_data |= (((m_extplanebuf[0] & 1) << 5) | ((m_extplanebuf[1] & 1) << 6));
|
||||
m_extplanebuf[0] = m_extplanebuf[0] >> 1;
|
||||
m_extplanebuf[1] = m_extplanebuf[1] >> 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
pixel_data |= (((m_extplanebuf[0] >> 7) & 1) << 5) | (((m_extplanebuf[1] >> 7) & 1) << 6);
|
||||
m_extplanebuf[0] = m_extplanebuf[0] << 1;
|
||||
m_extplanebuf[1] = m_extplanebuf[1] << 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ppu_vt03_device::draw_sprite_pixel(int sprite_xpos, int color, int pixel, uint8_t pixel_data, bitmap_ind16& bitmap)
|
||||
{
|
||||
bitmap.pix16(m_scanline, sprite_xpos + pixel) = pixel_data + (4 * color);
|
||||
int is4bpp = get_201x_reg(0x0) & 0x04;
|
||||
int is16pix = get_201x_reg(0x0) & 0x01;
|
||||
|
||||
if (is4bpp)
|
||||
{
|
||||
if (!is16pix)
|
||||
{
|
||||
bitmap.pix16(m_scanline, sprite_xpos + pixel) = pixel_data + (4 * color);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* this mode makes use of the extra planes to increase sprite width instead
|
||||
we probably need to split them out again and draw them at xpos+8 with a
|
||||
cliprect - not seen used yet */
|
||||
bitmap.pix16(m_scanline, sprite_xpos + pixel) = pixel_data + (machine().rand()&3);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ppu2c0x_device::draw_sprite_pixel(sprite_xpos, color, pixel, pixel_data, bitmap);
|
||||
}
|
||||
}
|
||||
|
||||
void ppu_vt03_device::read_tile_plane_data(int address, int color)
|
||||
|
@ -9,7 +9,11 @@
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#ifndef MAME_VIDEO_PPU_VT03_H
|
||||
#define MAME_VIDEO_PPU_VT03_H
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "video/ppu2c0x.h"
|
||||
|
||||
#define MCFG_PPU_VT03_ADD(_tag) \
|
||||
@ -25,8 +29,8 @@ class ppu_vt03_device : public ppu2c0x_device {
|
||||
public:
|
||||
ppu_vt03_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
template<class _Object> static devcb_base &set_read_bg_callback(device_t &device, _Object object) { return downcast<ppu_vt03_device &>(device).m_read_bg.set_callback(object); }
|
||||
template<class _Object> static devcb_base &set_read_sp_callback(device_t &device, _Object object) { return downcast<ppu_vt03_device &>(device).m_read_sp.set_callback(object); }
|
||||
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)); }
|
||||
|
||||
virtual DECLARE_READ8_MEMBER(read) override;
|
||||
virtual DECLARE_WRITE8_MEMBER(write) override;
|
||||
@ -75,4 +79,6 @@ private:
|
||||
void set_new_pen(int i);
|
||||
};
|
||||
|
||||
DECLARE_DEVICE_TYPE(PPU_VT03, ppu_vt03_device)
|
||||
DECLARE_DEVICE_TYPE(PPU_VT03, ppu_vt03_device)
|
||||
|
||||
#endif // MAME_VIDEO_PPU_VT03_H
|
||||
|
@ -366,7 +366,7 @@ void nes_vt_state::machine_reset()
|
||||
|
||||
int nes_vt_state::calculate_real_video_address(int addr, int extended, int readtype)
|
||||
{
|
||||
// might be a VT09 only feature (8bpp or 4bpp direct colour mode??)
|
||||
// might be a VT09 only feature (8bpp?) but where are the other 4 bits?
|
||||
int alt_order = m_ppu->get_201x_reg(0x0) & 0x40;
|
||||
|
||||
if (readtype == 0)
|
||||
|
@ -72,11 +72,11 @@ class nes_state : public nes_base_state
|
||||
public:
|
||||
nes_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: nes_base_state(mconfig, type, tag),
|
||||
m_ppu(*this, "ppu"),
|
||||
m_exp(*this, "exp"),
|
||||
m_cartslot(*this, "nes_slot"),
|
||||
m_disk(*this, "disk")
|
||||
{ }
|
||||
m_ppu(*this, "ppu"),
|
||||
m_exp(*this, "exp"),
|
||||
m_cartslot(*this, "nes_slot"),
|
||||
m_disk(*this, "disk")
|
||||
{ }
|
||||
|
||||
|
||||
int nes_ppu_vidaccess(int address, int data);
|
||||
|
Loading…
Reference in New Issue
Block a user