some support for extended sprite addressing used by cybar120

This commit is contained in:
David Haywood 2017-05-23 23:52:56 +01:00
parent 17294fd6eb
commit 9a61271e52
4 changed files with 37 additions and 7 deletions

View File

@ -125,6 +125,7 @@ public:
virtual void read_sprite_plane_data(int address); virtual void read_sprite_plane_data(int address);
virtual void make_sprite_pixel_data(uint8_t &pixel_data, int flipx); virtual void make_sprite_pixel_data(uint8_t &pixel_data, int flipx);
virtual void draw_sprite_pixel(int sprite_xpos, int color, int pixel, uint8_t pixel_data, bitmap_ind16& bitmap); virtual void draw_sprite_pixel(int sprite_xpos, int color, int pixel, uint8_t pixel_data, bitmap_ind16& bitmap);
virtual void read_extra_sprite_bits(int sprite_index);
void draw_sprites( uint8_t *line_priority ); void draw_sprites( uint8_t *line_priority );
void render_scanline(); void render_scanline();
@ -216,6 +217,7 @@ protected:
// used in rendering // used in rendering
uint8_t m_planebuf[2]; uint8_t m_planebuf[2];
int m_scanline; /* scanline count */ int m_scanline; /* scanline count */
std::unique_ptr<uint8_t[]> m_spriteram; /* sprite ram */
private: private:
static constexpr device_timer_id TIMER_HBLANK = 0; static constexpr device_timer_id TIMER_HBLANK = 0;
@ -226,7 +228,6 @@ private:
inline void writebyte(offs_t address, uint8_t data); inline void writebyte(offs_t address, uint8_t data);
std::unique_ptr<bitmap_ind16> m_bitmap; /* target bitmap */ std::unique_ptr<bitmap_ind16> m_bitmap; /* target bitmap */
std::unique_ptr<uint8_t[]> m_spriteram; /* sprite ram */
std::unique_ptr<pen_t[]> m_colortable; /* color table modified at run time */ std::unique_ptr<pen_t[]> m_colortable; /* color table modified at run time */
std::unique_ptr<pen_t[]> m_colortable_mono; /* monochromatic color table modified at run time */ std::unique_ptr<pen_t[]> m_colortable_mono; /* monochromatic color table modified at run time */

View File

@ -230,10 +230,21 @@ void ppu_vt03_device::draw_tile_pixel(uint8_t pix, int color, uint16_t back_pen,
} }
} }
void ppu_vt03_device::read_extra_sprite_bits(int sprite_index)
{
m_extra_sprite_bits = (m_spriteram[sprite_index + 2] & 0x1c) >>2;
}
uint8_t ppu_vt03_device::get_speva2_speva0()
{
return m_extra_sprite_bits;
}
void ppu_vt03_device::set_2010_reg(uint8_t data) void ppu_vt03_device::set_2010_reg(uint8_t data)
{ {
/* 7 : COLCOMP /* 7 : COLCOMP
6,5 : UNUSED 6 : UNUSED (8bpp enable on VT09?)
5 : UNUSED
4 : BKEXTEN 4 : BKEXTEN
3 : SPEXTEN 3 : SPEXTEN
2 : SP16EN 2 : SP16EN

View File

@ -42,6 +42,7 @@ public:
virtual void read_sprite_plane_data(int address) override; virtual void read_sprite_plane_data(int address) override;
virtual void make_sprite_pixel_data(uint8_t &pixel_data, int flipx) override; virtual void make_sprite_pixel_data(uint8_t &pixel_data, int flipx) override;
virtual void draw_sprite_pixel(int sprite_xpos, int color, int pixel, uint8_t pixel_data, bitmap_ind16& bitmap) override; virtual void draw_sprite_pixel(int sprite_xpos, int color, int pixel, uint8_t pixel_data, bitmap_ind16& bitmap) override;
virtual void read_extra_sprite_bits(int sprite_index) override;
virtual void device_start() override; virtual void device_start() override;
virtual void device_reset() override; virtual void device_reset() override;
@ -51,6 +52,7 @@ public:
uint8_t get_va34(); uint8_t get_va34();
uint8_t get_m_read_bg4_bg3(); uint8_t get_m_read_bg4_bg3();
uint8_t get_speva2_speva0();
private: private:
devcb_read8 m_read_bg; devcb_read8 m_read_bg;
@ -62,6 +64,7 @@ private:
int m_va34; int m_va34;
uint8_t m_extplanebuf[2]; uint8_t m_extplanebuf[2];
uint8_t m_extra_sprite_bits;
palette_device *m_palette; palette_device *m_palette;

View File

@ -14,7 +14,9 @@
VT02 - banking scheme to access 32MB, Dual APU with PCM support VT02 - banking scheme to access 32MB, Dual APU with PCM support
VT03 - above + 4bpp sprite / bg modes, enhanced palette VT03 - above + 4bpp sprite / bg modes, enhanced palette
VT08 - 8bpp or direct colour modes? VT08 - ?
VT09 - 8bpp or direct colour modes?
VT16 - ? VT16 - ?
VT18 - ? VT18 - ?
@ -374,6 +376,17 @@ int nes_vt_state::calculate_real_video_address(int addr, int extended, int readt
extended = 0; extended = 0;
} }
} }
else if (readtype == 1)
{
if (m_ppu->get_201x_reg(0x0) & 0x08)
{
extended = 1;
}
else
{
extended = 0;
}
}
/* /*
Calculating TVA17 - TVA10 Calculating TVA17 - TVA10
@ -517,8 +530,10 @@ int nes_vt_state::calculate_real_video_address(int addr, int extended, int readt
break; break;
case 1: // sprite display case 1: // sprite display
is4bpp = m_ppu->get_201x_reg(0x0) & 0x04; is4bpp = m_ppu->get_201x_reg(0x0) & 0x04; // 16 colors or 16-pixel wide (both adjust the read)
// todo (need something using it to test)
eva2_eva0 |= m_ppu->get_speva2_speva0();
break; break;
case 2: // CPU R/W access case 2: // CPU R/W access
@ -526,7 +541,7 @@ int nes_vt_state::calculate_real_video_address(int addr, int extended, int readt
break; break;
} }
finaladdr = ((m_410x[0x0] & 0x0F) << 21) | (va17_va10 << 13) | (eva2_eva0 << 10) | (addr & 0x03ff); finaladdr = ((m_410x[0x0] & 0x0f) << 21) | (va17_va10 << 13) | (eva2_eva0 << 10) | (addr & 0x03ff);
if (is4bpp) if (is4bpp)
finaladdr = ((finaladdr &~0xf) << 1) | (va34 << 4) | (finaladdr & 0xf); finaladdr = ((finaladdr &~0xf) << 1) | (va34 << 4) | (finaladdr & 0xf);