Second round of previous commit, needs recompile

This commit is contained in:
Angelo Salese 2013-02-07 05:30:50 +00:00
parent e9e106a25e
commit c00cb4defc
3 changed files with 211 additions and 204 deletions

View File

@ -295,12 +295,73 @@ public:
INT32 u1, INT32 u2, INT32 slu1, INT32 slu2, INT32 *nu1, INT32 *nu2, INT32 u1, INT32 u2, INT32 slu1, INT32 slu2, INT32 *nu1, INT32 *nu2,
INT32 v1, INT32 v2, INT32 slv1, INT32 slv2, INT32 *nv1, INT32 *nv2, INT32 v1, INT32 v2, INT32 slv1, INT32 slv2, INT32 *nv1, INT32 *nv2,
INT32 _y1, INT32 y2); INT32 _y1, INT32 y2);
void stv_vdp1_setup_shading_for_line(INT32 y, INT32 x1, INT32 x2,
INT32 r1, INT32 g1, INT32 b1,
INT32 r2, INT32 g2, INT32 b2);
void stv_vdp1_setup_shading_for_slope(
INT32 x1, INT32 x2, INT32 sl1, INT32 sl2, INT32 *nx1, INT32 *nx2,
INT32 r1, INT32 r2, INT32 slr1, INT32 slr2, INT32 *nr1, INT32 *nr2,
INT32 g1, INT32 g2, INT32 slg1, INT32 slg2, INT32 *ng1, INT32 *ng2,
INT32 b1, INT32 b2, INT32 slb1, INT32 slb2, INT32 *nb1, INT32 *nb2,
INT32 _y1, INT32 y2);
UINT16 stv_vdp1_apply_gouraud_shading( int x, int y, UINT16 pix );
void stv_vdp1_setup_shading(const struct spoint* q, const rectangle &cliprect); void stv_vdp1_setup_shading(const struct spoint* q, const rectangle &cliprect);
UINT8 stv_read_gouraud_table( void ); UINT8 stv_read_gouraud_table( void );
void stv_clear_gouraud_shading(void);
void stv_clear_framebuffer( int which_framebuffer ); void stv_clear_framebuffer( int which_framebuffer );
void stv_vdp1_state_save_postload( void ); void stv_vdp1_state_save_postload( void );
int stv_vdp1_start ( void ); int stv_vdp1_start ( void );
struct stv_vdp1_poly_scanline
{
INT32 x[2];
INT32 b[2];
INT32 g[2];
INT32 r[2];
INT32 db;
INT32 dg;
INT32 dr;
};
struct stv_vdp1_poly_scanline_data
{
INT32 sy, ey;
struct stv_vdp1_poly_scanline scanline[512];
};
struct stv_vdp1_poly_scanline_data* stv_vdp1_shading_data;
struct stv_vdp2_sprite_list
{
int CMDCTRL, CMDLINK, CMDPMOD, CMDCOLR, CMDSRCA, CMDSIZE, CMDGRDA;
int CMDXA, CMDYA;
int CMDXB, CMDYB;
int CMDXC, CMDYC;
int CMDXD, CMDYD;
int ispoly;
} stv2_current_sprite;
/* Gouraud shading */
struct _stv_gouraud_shading
{
/* Gouraud shading table */
UINT16 GA;
UINT16 GB;
UINT16 GC;
UINT16 GD;
} stv_gouraud_shading;
UINT16 m_sprite_colorbank;
/* VDP1 Framebuffer handling */
int stv_sprite_priorities_used[8];
int stv_sprite_priorities_usage_valid;
UINT8 stv_sprite_priorities_in_fb_line[512][8];
/* VDP2 */ /* VDP2 */
@ -333,8 +394,11 @@ public:
void stv_vdp2_copy_roz_bitmap(bitmap_rgb32 &bitmap, bitmap_rgb32 &roz_bitmap, const rectangle &cliprect, int iRP, int planesizex, int planesizey, int planerenderedsizex, int planerenderedsizey); void stv_vdp2_copy_roz_bitmap(bitmap_rgb32 &bitmap, bitmap_rgb32 &roz_bitmap, const rectangle &cliprect, int iRP, int planesizex, int planesizey, int planerenderedsizex, int planerenderedsizey);
void stv_vdp2_fill_rotation_parameter_table( UINT8 rot_parameter ); void stv_vdp2_fill_rotation_parameter_table( UINT8 rot_parameter );
UINT8 stv_vdp2_check_vram_cycle_pattern_registers( UINT8 access_command_pnmdr, UINT8 access_command_cpdr, UINT8 bitmap_enable ); UINT8 stv_vdp2_check_vram_cycle_pattern_registers( UINT8 access_command_pnmdr, UINT8 access_command_cpdr, UINT8 bitmap_enable );
void stv_vdp2_draw_mosaic(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT8 is_roz); UINT8 stv_vdp2_is_rotation_applied(void);
UINT8 stv_vdp2_are_map_registers_equal(void);
void stv_vdp2_get_map_page( int x, int y, int *_map, int *_page );
void stv_vdp2_draw_mosaic(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT8 is_roz);
void stv_vdp2_fade_effects( void ); void stv_vdp2_fade_effects( void );
void stv_vdp2_compute_color_offset( int *r, int *g, int *b, int cor ); void stv_vdp2_compute_color_offset( int *r, int *g, int *b, int cor );
void stv_vdp2_compute_color_offset_UINT32(UINT32 *rgb, int cor); void stv_vdp2_compute_color_offset_UINT32(UINT32 *rgb, int cor);
@ -352,6 +416,106 @@ public:
void stv_vdp2_state_save_postload( void ); void stv_vdp2_state_save_postload( void );
void stv_vdp2_exit ( void ); void stv_vdp2_exit ( void );
int stv_vdp2_start ( void ); int stv_vdp2_start ( void );
UINT8 m_vdpdebug_roz;
struct stv_vdp2_tilemap_capabilities
{
UINT8 enabled;
UINT8 transparency;
UINT8 colour_calculation_enabled;
UINT8 colour_depth;
UINT8 alpha;
UINT8 tile_size;
UINT8 bitmap_enable;
UINT8 bitmap_size;
UINT8 bitmap_palette_number;
UINT8 bitmap_map;
UINT16 map_offset[16];
UINT8 map_count;
UINT8 pattern_data_size;
UINT8 character_number_supplement;
UINT8 special_priority_register;
UINT8 special_colour_control_register;
UINT8 supplementary_palette_bits;
UINT8 supplementary_character_bits;
INT16 scrollx;
INT16 scrolly;
UINT32 incx, incy;
UINT8 linescroll_enable;
UINT8 linescroll_interval;
UINT32 linescroll_table_address;
UINT8 vertical_linescroll_enable;
UINT8 linezoom_enable;
UINT8 plane_size;
UINT8 colour_ram_address_offset;
UINT8 fade_control;
UINT8 window_control;
UINT8 line_screen_enabled;
UINT8 mosaic_screen_enabled;
int layer_name; /* just to keep track */
} stv2_current_tilemap;
struct rotation_table
{
INT32 xst;
INT32 yst;
INT32 zst;
INT32 dxst;
INT32 dyst;
INT32 dx;
INT32 dy;
INT32 A;
INT32 B;
INT32 C;
INT32 D;
INT32 E;
INT32 F;
INT32 px;
INT32 py;
INT32 pz;
INT32 cx;
INT32 cy;
INT32 cz;
INT32 mx;
INT32 my;
INT32 kx;
INT32 ky;
UINT32 kast;
INT32 dkast;
INT32 dkax;
} stv_current_rotation_parameter_table;
struct _stv_vdp2_layer_data_placement
{
UINT32 map_offset_min;
UINT32 map_offset_max;
UINT32 tile_offset_min;
UINT32 tile_offset_max;
} stv_vdp2_layer_data_placement;
struct _stv_rbg_cache_data
{
UINT8 watch_vdp2_vram_writes;
UINT8 is_cache_dirty;
UINT32 map_offset_min[2];
UINT32 map_offset_max[2];
UINT32 tile_offset_min[2];
UINT32 tile_offset_max[2];
struct stv_vdp2_tilemap_capabilities layer_data[2];
} stv_rbg_cache_data;
}; };
#define MASTER_CLOCK_352 57272720 #define MASTER_CLOCK_352 57272720

View File

@ -18,24 +18,6 @@ Framebuffer todo:
#define VDP1_LOG 0 #define VDP1_LOG 0
struct stv_vdp1_poly_scanline
{
INT32 x[2];
INT32 b[2];
INT32 g[2];
INT32 r[2];
INT32 db;
INT32 dg;
INT32 dr;
};
struct stv_vdp1_poly_scanline_data
{
INT32 sy, ey;
struct stv_vdp1_poly_scanline scanline[512];
};
static struct stv_vdp1_poly_scanline_data* stv_vdp1_shading_data;
enum { FRAC_SHIFT = 16 }; enum { FRAC_SHIFT = 16 };
@ -501,30 +483,7 @@ the rest are data used by it
*/ */
static struct stv_vdp2_sprite_list void saturn_state::stv_clear_gouraud_shading(void)
{
int CMDCTRL, CMDLINK, CMDPMOD, CMDCOLR, CMDSRCA, CMDSIZE, CMDGRDA;
int CMDXA, CMDYA;
int CMDXB, CMDYB;
int CMDXC, CMDYC;
int CMDXD, CMDYD;
int ispoly;
} stv2_current_sprite;
/* Gouraud shading */
static struct _stv_gouraud_shading
{
/* Gouraud shading table */
UINT16 GA;
UINT16 GB;
UINT16 GC;
UINT16 GD;
} stv_gouraud_shading;
static void stv_clear_gouraud_shading(void)
{ {
memset( &stv_gouraud_shading, 0, sizeof( stv_gouraud_shading ) ); memset( &stv_gouraud_shading, 0, sizeof( stv_gouraud_shading ) );
} }
@ -559,7 +518,7 @@ INLINE INT32 _shading( INT32 color, INT32 correction )
return color; return color;
} }
static UINT16 stv_vdp1_apply_gouraud_shading( int x, int y, UINT16 pix ) UINT16 saturn_state::stv_vdp1_apply_gouraud_shading( int x, int y, UINT16 pix )
{ {
INT32 r,g,b, msb; INT32 r,g,b, msb;
@ -589,7 +548,7 @@ static UINT16 stv_vdp1_apply_gouraud_shading( int x, int y, UINT16 pix )
return msb | b << 10 | g << 5 | r; return msb | b << 10 | g << 5 | r;
} }
static void stv_vdp1_setup_shading_for_line(INT32 y, INT32 x1, INT32 x2, void saturn_state::stv_vdp1_setup_shading_for_line(INT32 y, INT32 x1, INT32 x2,
INT32 r1, INT32 g1, INT32 b1, INT32 r1, INT32 g1, INT32 b1,
INT32 r2, INT32 g2, INT32 b2) INT32 r2, INT32 g2, INT32 b2)
{ {
@ -643,7 +602,7 @@ static void stv_vdp1_setup_shading_for_line(INT32 y, INT32 x1, INT32 x2,
} }
} }
static void stv_vdp1_setup_shading_for_slope( void saturn_state::stv_vdp1_setup_shading_for_slope(
INT32 x1, INT32 x2, INT32 sl1, INT32 sl2, INT32 *nx1, INT32 *nx2, INT32 x1, INT32 x2, INT32 sl1, INT32 sl2, INT32 *nx1, INT32 *nx2,
INT32 r1, INT32 r2, INT32 slr1, INT32 slr2, INT32 *nr1, INT32 *nr2, INT32 r1, INT32 r2, INT32 slr1, INT32 slr2, INT32 *nr1, INT32 *nr2,
INT32 g1, INT32 g2, INT32 slg1, INT32 slg2, INT32 *ng1, INT32 *ng2, INT32 g1, INT32 g2, INT32 slg1, INT32 slg2, INT32 *ng1, INT32 *ng2,
@ -866,9 +825,6 @@ to the framebuffer we CAN'T frameskip the vdp1 drawing as the hardware can READ
and if we skip the drawing the content could be incorrect when it reads it, although i have no idea and if we skip the drawing the content could be incorrect when it reads it, although i have no idea
why they would want to */ why they would want to */
static UINT8* gfxdata;
static UINT16 sprite_colorbank;
static void (*drawpixel)(running_machine &machine, int x, int y, int patterndata, int offsetcnt); static void (*drawpixel)(running_machine &machine, int x, int y, int patterndata, int offsetcnt);
@ -880,7 +836,7 @@ static void drawpixel_poly(running_machine &machine, int x, int y, int patternda
if(x >= 1024 || y >= 512) if(x >= 1024 || y >= 512)
return; return;
state->m_vdp1.framebuffer_draw_lines[y][x] = stv2_current_sprite.CMDCOLR; state->m_vdp1.framebuffer_draw_lines[y][x] = state->stv2_current_sprite.CMDCOLR;
} }
static void drawpixel_8bpp_trans(running_machine &machine, int x, int y, int patterndata, int offsetcnt) static void drawpixel_8bpp_trans(running_machine &machine, int x, int y, int patterndata, int offsetcnt)
@ -888,10 +844,10 @@ static void drawpixel_8bpp_trans(running_machine &machine, int x, int y, int pat
saturn_state *state = machine.driver_data<saturn_state>(); saturn_state *state = machine.driver_data<saturn_state>();
UINT16 pix; UINT16 pix;
pix = gfxdata[patterndata+offsetcnt]; pix = state->m_vdp1.gfx_decode[patterndata+offsetcnt];
if ( pix & 0xff ) if ( pix & 0xff )
{ {
state->m_vdp1.framebuffer_draw_lines[y][x] = pix | sprite_colorbank; state->m_vdp1.framebuffer_draw_lines[y][x] = pix | state->m_sprite_colorbank;
} }
} }
@ -900,9 +856,9 @@ static void drawpixel_4bpp_notrans(running_machine &machine, int x, int y, int p
saturn_state *state = machine.driver_data<saturn_state>(); saturn_state *state = machine.driver_data<saturn_state>();
UINT16 pix; UINT16 pix;
pix = gfxdata[patterndata+offsetcnt/2]; pix = state->m_vdp1.gfx_decode[patterndata+offsetcnt/2];
pix = offsetcnt&1 ? (pix & 0x0f):((pix & 0xf0)>>4) ; pix = offsetcnt&1 ? (pix & 0x0f):((pix & 0xf0)>>4) ;
state->m_vdp1.framebuffer_draw_lines[y][x] = pix | sprite_colorbank; state->m_vdp1.framebuffer_draw_lines[y][x] = pix | state->m_sprite_colorbank;
} }
static void drawpixel_4bpp_trans(running_machine &machine, int x, int y, int patterndata, int offsetcnt) static void drawpixel_4bpp_trans(running_machine &machine, int x, int y, int patterndata, int offsetcnt)
@ -910,17 +866,17 @@ static void drawpixel_4bpp_trans(running_machine &machine, int x, int y, int pat
saturn_state *state = machine.driver_data<saturn_state>(); saturn_state *state = machine.driver_data<saturn_state>();
UINT16 pix; UINT16 pix;
pix = gfxdata[patterndata+offsetcnt/2]; pix = state->m_vdp1.gfx_decode[patterndata+offsetcnt/2];
pix = offsetcnt&1 ? (pix & 0x0f):((pix & 0xf0)>>4) ; pix = offsetcnt&1 ? (pix & 0x0f):((pix & 0xf0)>>4) ;
if ( pix ) if ( pix )
state->m_vdp1.framebuffer_draw_lines[y][x] = pix | sprite_colorbank; state->m_vdp1.framebuffer_draw_lines[y][x] = pix | state->m_sprite_colorbank;
} }
static void drawpixel_generic(running_machine &machine, int x, int y, int patterndata, int offsetcnt) static void drawpixel_generic(running_machine &machine, int x, int y, int patterndata, int offsetcnt)
{ {
saturn_state *state = machine.driver_data<saturn_state>(); saturn_state *state = machine.driver_data<saturn_state>();
int pix,mode,transmask, spd = stv2_current_sprite.CMDPMOD & 0x40; int pix,mode,transmask, spd = state->stv2_current_sprite.CMDPMOD & 0x40;
int mesh = stv2_current_sprite.CMDPMOD & 0x100; int mesh = state->stv2_current_sprite.CMDPMOD & 0x100;
int pix2; int pix2;
if ( mesh && !((x ^ y) & 1) ) if ( mesh && !((x ^ y) & 1) )
@ -928,9 +884,9 @@ static void drawpixel_generic(running_machine &machine, int x, int y, int patter
return; return;
} }
if ( stv2_current_sprite.ispoly ) if ( state->stv2_current_sprite.ispoly )
{ {
pix = stv2_current_sprite.CMDCOLR&0xffff; pix = state->stv2_current_sprite.CMDCOLR&0xffff;
transmask = 0xffff; transmask = 0xffff;
if ( pix & 0x8000 ) if ( pix & 0x8000 )
@ -944,23 +900,23 @@ static void drawpixel_generic(running_machine &machine, int x, int y, int patter
} }
else else
{ {
switch (stv2_current_sprite.CMDPMOD&0x0038) switch (state->stv2_current_sprite.CMDPMOD&0x0038)
{ {
case 0x0000: // mode 0 16 colour bank mode (4bits) (hanagumi blocks) case 0x0000: // mode 0 16 colour bank mode (4bits) (hanagumi blocks)
// most of the shienryu sprites use this mode // most of the shienryu sprites use this mode
pix = gfxdata[(patterndata+offsetcnt/2) & 0xfffff]; pix = state->m_vdp1.gfx_decode[(patterndata+offsetcnt/2) & 0xfffff];
pix = offsetcnt&1 ? (pix & 0x0f):((pix & 0xf0)>>4) ; pix = offsetcnt&1 ? (pix & 0x0f):((pix & 0xf0)>>4) ;
pix = pix+((stv2_current_sprite.CMDCOLR&0xfff0)); pix = pix+((state->stv2_current_sprite.CMDCOLR&0xfff0));
mode = 0; mode = 0;
transmask = 0xf; transmask = 0xf;
break; break;
case 0x0008: // mode 1 16 colour lookup table mode (4bits) case 0x0008: // mode 1 16 colour lookup table mode (4bits)
// shienryu explosisons (and some enemies) use this mode // shienryu explosisons (and some enemies) use this mode
pix2 = gfxdata[(patterndata+offsetcnt/2) & 0xfffff]; pix2 = state->m_vdp1.gfx_decode[(patterndata+offsetcnt/2) & 0xfffff];
pix2 = offsetcnt&1 ? (pix2 & 0x0f):((pix2 & 0xf0)>>4); pix2 = offsetcnt&1 ? (pix2 & 0x0f):((pix2 & 0xf0)>>4);
pix = pix2&1 ? pix = pix2&1 ?
((((state->m_vdp1_vram[(((stv2_current_sprite.CMDCOLR&0xffff)*8)>>2)+((pix2&0xfffe)/2)])) & 0x0000ffff) >> 0): ((((state->m_vdp1_vram[(((state->stv2_current_sprite.CMDCOLR&0xffff)*8)>>2)+((pix2&0xfffe)/2)])) & 0x0000ffff) >> 0):
((((state->m_vdp1_vram[(((stv2_current_sprite.CMDCOLR&0xffff)*8)>>2)+((pix2&0xfffe)/2)])) & 0xffff0000) >> 16); ((((state->m_vdp1_vram[(((state->stv2_current_sprite.CMDCOLR&0xffff)*8)>>2)+((pix2&0xfffe)/2)])) & 0xffff0000) >> 16);
mode = 5; mode = 5;
transmask = 0xffff; transmask = 0xffff;
@ -978,25 +934,25 @@ static void drawpixel_generic(running_machine &machine, int x, int y, int patter
} }
break; break;
case 0x0010: // mode 2 64 colour bank mode (8bits) (character select portraits on hanagumi) case 0x0010: // mode 2 64 colour bank mode (8bits) (character select portraits on hanagumi)
pix = gfxdata[(patterndata+offsetcnt) & 0xfffff]; pix = state->m_vdp1.gfx_decode[(patterndata+offsetcnt) & 0xfffff];
mode = 2; mode = 2;
pix = pix+(stv2_current_sprite.CMDCOLR&0xffc0); pix = pix+(state->stv2_current_sprite.CMDCOLR&0xffc0);
transmask = 0x3f; transmask = 0x3f;
break; break;
case 0x0018: // mode 3 128 colour bank mode (8bits) (little characters on hanagumi use this mode) case 0x0018: // mode 3 128 colour bank mode (8bits) (little characters on hanagumi use this mode)
pix = gfxdata[(patterndata+offsetcnt) & 0xfffff]; pix = state->m_vdp1.gfx_decode[(patterndata+offsetcnt) & 0xfffff];
pix = pix+(stv2_current_sprite.CMDCOLR&0xff80); pix = pix+(state->stv2_current_sprite.CMDCOLR&0xff80);
transmask = 0x7f; transmask = 0x7f;
mode = 3; mode = 3;
break; break;
case 0x0020: // mode 4 256 colour bank mode (8bits) (hanagumi title) case 0x0020: // mode 4 256 colour bank mode (8bits) (hanagumi title)
pix = gfxdata[(patterndata+offsetcnt) & 0xfffff]; pix = state->m_vdp1.gfx_decode[(patterndata+offsetcnt) & 0xfffff];
pix = pix+(stv2_current_sprite.CMDCOLR&0xff00); pix = pix+(state->stv2_current_sprite.CMDCOLR&0xff00);
transmask = 0xff; transmask = 0xff;
mode = 4; mode = 4;
break; break;
case 0x0028: // mode 5 32,768 colour RGB mode (16bits) case 0x0028: // mode 5 32,768 colour RGB mode (16bits)
pix = gfxdata[(patterndata+offsetcnt*2+1) & 0xfffff] | (gfxdata[(patterndata+offsetcnt*2) & 0xfffff]<<8) ; pix = state->m_vdp1.gfx_decode[(patterndata+offsetcnt*2+1) & 0xfffff] | (state->m_vdp1.gfx_decode[(patterndata+offsetcnt*2) & 0xfffff]<<8) ;
mode = 5; mode = 5;
transmask = -1; /* TODO: check me */ transmask = -1; /* TODO: check me */
break; break;
@ -1009,7 +965,7 @@ static void drawpixel_generic(running_machine &machine, int x, int y, int patter
// preliminary end code disable support // preliminary end code disable support
if ( ((stv2_current_sprite.CMDPMOD & 0x80) == 0) && if ( ((state->stv2_current_sprite.CMDPMOD & 0x80) == 0) &&
((pix & transmask) == transmask) ) ((pix & transmask) == transmask) )
{ {
return; return;
@ -1017,7 +973,7 @@ static void drawpixel_generic(running_machine &machine, int x, int y, int patter
} }
/* MSBON */ /* MSBON */
pix |= stv2_current_sprite.CMDPMOD & 0x8000; pix |= state->stv2_current_sprite.CMDPMOD & 0x8000;
if ( mode != 5 ) if ( mode != 5 )
{ {
if ( (pix & transmask) || spd ) if ( (pix & transmask) || spd )
@ -1029,7 +985,7 @@ static void drawpixel_generic(running_machine &machine, int x, int y, int patter
{ {
if ( (pix & transmask) || spd ) if ( (pix & transmask) || spd )
{ {
switch( stv2_current_sprite.CMDPMOD & 0x7 ) switch( state->stv2_current_sprite.CMDPMOD & 0x7 )
{ {
case 0: /* replace */ case 0: /* replace */
state->m_vdp1.framebuffer_draw_lines[y][x] = pix; state->m_vdp1.framebuffer_draw_lines[y][x] = pix;
@ -1054,7 +1010,7 @@ static void drawpixel_generic(running_machine &machine, int x, int y, int patter
} }
break; break;
case 4: /* Gouraud shading */ case 4: /* Gouraud shading */
state->m_vdp1.framebuffer_draw_lines[y][x] = stv_vdp1_apply_gouraud_shading( x, y, pix ); state->m_vdp1.framebuffer_draw_lines[y][x] = state->stv_vdp1_apply_gouraud_shading( x, y, pix );
break; break;
default: default:
state->m_vdp1.framebuffer_draw_lines[y][x] = pix; state->m_vdp1.framebuffer_draw_lines[y][x] = pix;
@ -1073,8 +1029,6 @@ void saturn_state::stv_vdp1_set_drawpixel( void )
int mesh = stv2_current_sprite.CMDPMOD & 0x100; int mesh = stv2_current_sprite.CMDPMOD & 0x100;
int ecd = stv2_current_sprite.CMDPMOD & 0x80; int ecd = stv2_current_sprite.CMDPMOD & 0x80;
gfxdata = m_vdp1.gfx_decode;
if ( mesh || !ecd || ((stv2_current_sprite.CMDPMOD & 0x7) != 0) ) if ( mesh || !ecd || ((stv2_current_sprite.CMDPMOD & 0x7) != 0) )
{ {
drawpixel = drawpixel_generic; drawpixel = drawpixel_generic;
@ -1087,17 +1041,17 @@ void saturn_state::stv_vdp1_set_drawpixel( void )
} }
else if ( (sprite_mode == 0x20) && !spd ) else if ( (sprite_mode == 0x20) && !spd )
{ {
sprite_colorbank = (stv2_current_sprite.CMDCOLR&0xff00); m_sprite_colorbank = (stv2_current_sprite.CMDCOLR&0xff00);
drawpixel = drawpixel_8bpp_trans; drawpixel = drawpixel_8bpp_trans;
} }
else if ((sprite_mode == 0x00) && spd) else if ((sprite_mode == 0x00) && spd)
{ {
sprite_colorbank = (stv2_current_sprite.CMDCOLR&0xfff0); m_sprite_colorbank = (stv2_current_sprite.CMDCOLR&0xfff0);
drawpixel = drawpixel_4bpp_notrans; drawpixel = drawpixel_4bpp_notrans;
} }
else if (sprite_mode == 0x00 && !spd ) else if (sprite_mode == 0x00 && !spd )
{ {
sprite_colorbank = (stv2_current_sprite.CMDCOLR&0xfff0); m_sprite_colorbank = (stv2_current_sprite.CMDCOLR&0xfff0);
drawpixel = drawpixel_4bpp_trans; drawpixel = drawpixel_4bpp_trans;
} }
else else

View File

@ -2081,116 +2081,10 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09
\----------|----------|----------|----------|----------|----------|----------|---------*/ \----------|----------|----------|----------|----------|----------|----------|---------*/
#define STV_VDP2_COBB (m_vdp2_regs[0x11e/2]) #define STV_VDP2_COBB (m_vdp2_regs[0x11e/2])
/*For Debug purposes only*/
static struct stv_vdp2_debugging
{
UINT8 l_en; /*For Layer enable/disable*/
UINT8 win; /*Enters into Window effect debug menu*/
UINT32 error; /*bits for VDP2 error logging*/
UINT8 roz; /*Debug roz on screen*/
} vdpdebug;
/* Not sure if to use this for the rotating tilemaps as well or just use different draw functions, might add too much bloat */
static struct stv_vdp2_tilemap_capabilities
{
UINT8 enabled;
UINT8 transparency;
UINT8 colour_calculation_enabled;
UINT8 colour_depth;
UINT8 alpha;
UINT8 tile_size;
UINT8 bitmap_enable;
UINT8 bitmap_size;
UINT8 bitmap_palette_number;
UINT8 bitmap_map;
UINT16 map_offset[16];
UINT8 map_count;
UINT8 pattern_data_size;
UINT8 character_number_supplement;
UINT8 special_priority_register;
UINT8 special_colour_control_register;
UINT8 supplementary_palette_bits;
UINT8 supplementary_character_bits;
INT16 scrollx;
INT16 scrolly;
UINT32 incx, incy;
UINT8 linescroll_enable;
UINT8 linescroll_interval;
UINT32 linescroll_table_address;
UINT8 vertical_linescroll_enable;
UINT8 linezoom_enable;
UINT8 plane_size;
UINT8 colour_ram_address_offset;
UINT8 fade_control;
UINT8 window_control;
UINT8 line_screen_enabled;
UINT8 mosaic_screen_enabled;
// UINT8 real_map_offset[16];
int layer_name; /* just to keep track */
} stv2_current_tilemap;
#define STV_VDP2_RBG_ROTATION_PARAMETER_A 1 #define STV_VDP2_RBG_ROTATION_PARAMETER_A 1
#define STV_VDP2_RBG_ROTATION_PARAMETER_B 2 #define STV_VDP2_RBG_ROTATION_PARAMETER_B 2
static struct rotation_table
{
INT32 xst;
INT32 yst;
INT32 zst;
INT32 dxst;
INT32 dyst;
INT32 dx;
INT32 dy;
INT32 A;
INT32 B;
INT32 C;
INT32 D;
INT32 E;
INT32 F;
INT32 px;
INT32 py;
INT32 pz;
INT32 cx;
INT32 cy;
INT32 cz;
INT32 mx;
INT32 my;
INT32 kx;
INT32 ky;
UINT32 kast;
INT32 dkast;
INT32 dkax;
} stv_current_rotation_parameter_table;
static struct _stv_vdp2_layer_data_placement
{
UINT32 map_offset_min;
UINT32 map_offset_max;
UINT32 tile_offset_min;
UINT32 tile_offset_max;
} stv_vdp2_layer_data_placement;
static struct _stv_rbg_cache_data
{
UINT8 watch_vdp2_vram_writes;
UINT8 is_cache_dirty;
UINT32 map_offset_min[2];
UINT32 map_offset_max[2];
UINT32 tile_offset_min[2];
UINT32 tile_offset_max[2];
struct stv_vdp2_tilemap_capabilities layer_data[2];
} stv_rbg_cache_data;
#define mul_fixed32( a, b ) mul_32x32_shift( a, b, 16 ) #define mul_fixed32( a, b ) mul_32x32_shift( a, b, 16 )
@ -2251,18 +2145,19 @@ void saturn_state::stv_vdp2_fill_rotation_parameter_table( UINT8 rot_parameter )
if(LOG_ROZ == 1) logerror( "kast = %x, dkast = %x, dkax = %x\n", RP.kast, RP.dkast, RP.dkax ); if(LOG_ROZ == 1) logerror( "kast = %x, dkast = %x, dkax = %x\n", RP.kast, RP.dkast, RP.dkax );
/*Attempt to show on screen the rotation table*/ /*Attempt to show on screen the rotation table*/
#if 0
if(LOG_ROZ == 2) if(LOG_ROZ == 2)
{ {
if(machine().input().code_pressed_once(JOYCODE_Y_UP_SWITCH)) if(machine().input().code_pressed_once(JOYCODE_Y_UP_SWITCH))
vdpdebug.roz++; m_vdpdebug_roz++;
if(machine().input().code_pressed_once(JOYCODE_Y_DOWN_SWITCH)) if(machine().input().code_pressed_once(JOYCODE_Y_DOWN_SWITCH))
vdpdebug.roz--; m_vdpdebug_roz--;
if(vdpdebug.roz > 10) if(m_vdpdebug_roz > 10)
vdpdebug.roz = 10; m_vdpdebug_roz = 10;
switch(vdpdebug.roz) switch(m_vdpdebug_roz)
{ {
case 0: popmessage( "Rotation parameter Table (%d)", rot_parameter ); break; case 0: popmessage( "Rotation parameter Table (%d)", rot_parameter ); break;
case 1: popmessage( "xst = %x, yst = %x, zst = %x", RP.xst, RP.yst, RP.zst ); break; case 1: popmessage( "xst = %x, yst = %x, zst = %x", RP.xst, RP.yst, RP.zst ); break;
@ -2277,10 +2172,11 @@ void saturn_state::stv_vdp2_fill_rotation_parameter_table( UINT8 rot_parameter )
case 10: break; case 10: break;
} }
} }
#endif
} }
/* check if RGB layer has rotation applied */ /* check if RGB layer has rotation applied */
static UINT8 stv_vdp2_is_rotation_applied(void) UINT8 saturn_state::stv_vdp2_is_rotation_applied(void)
{ {
#define _FIXED_1 (0x00010000) #define _FIXED_1 (0x00010000)
#define _FIXED_0 (0x00000000) #define _FIXED_0 (0x00000000)
@ -2306,7 +2202,7 @@ static UINT8 stv_vdp2_is_rotation_applied(void)
} }
} }
static UINT8 stv_vdp2_are_map_registers_equal(void) UINT8 saturn_state::stv_vdp2_are_map_registers_equal(void)
{ {
int i; int i;
@ -3522,7 +3418,7 @@ map is always enabled?
*/ */
static void stv_vdp2_get_map_page( int x, int y, int *_map, int *_page ) void saturn_state::stv_vdp2_get_map_page( int x, int y, int *_map, int *_page )
{ {
int page = 0; int page = 0;
int map = 0; int map = 0;
@ -6004,9 +5900,7 @@ VIDEO_START_MEMBER(saturn_state,stv_vdp2)
machine().primary_screen->register_screen_bitmap(m_tmpbitmap); machine().primary_screen->register_screen_bitmap(m_tmpbitmap);
stv_vdp2_start(); stv_vdp2_start();
stv_vdp1_start(); stv_vdp1_start();
vdpdebug.l_en = 0xff; m_vdpdebug_roz = 0;
vdpdebug.error = 0xffffffff;
vdpdebug.roz = 0;
machine().gfx[0]->set_source(m_vdp2.gfx_decode); machine().gfx[0]->set_source(m_vdp2.gfx_decode);
machine().gfx[1]->set_source(m_vdp2.gfx_decode); machine().gfx[1]->set_source(m_vdp2.gfx_decode);
machine().gfx[2]->set_source(m_vdp2.gfx_decode); machine().gfx[2]->set_source(m_vdp2.gfx_decode);
@ -6312,11 +6206,6 @@ int saturn_state::stv_vdp2_apply_window_on_layer(rectangle &cliprect)
} }
} }
/* VDP1 Framebuffer handling */
static int stv_sprite_priorities_used[8];
static int stv_sprite_priorities_usage_valid;
static UINT8 stv_sprite_priorities_in_fb_line[512][8];
void saturn_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT8 pri) void saturn_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT8 pri)
{ {
int x,y,r,g,b; int x,y,r,g,b;