From e9e106a25e55579eac4ae2cc3413cff8da0a59f0 Mon Sep 17 00:00:00 2001 From: Angelo Salese Date: Thu, 7 Feb 2013 04:55:02 +0000 Subject: [PATCH] State-ized Sega Saturn VDP1 & 2 [Angelo Salese] --- src/mame/drivers/saturn.c | 27 +- src/mame/includes/stv.h | 131 +++- src/mame/machine/smpc.c | 2 +- src/mame/video/stvvdp1.c | 570 +++++++++--------- src/mame/video/stvvdp2.c | 1199 +++++++++++++++---------------------- 5 files changed, 868 insertions(+), 1061 deletions(-) diff --git a/src/mame/drivers/saturn.c b/src/mame/drivers/saturn.c index fbda1a0d124..d1e17e4f5d7 100644 --- a/src/mame/drivers/saturn.c +++ b/src/mame/drivers/saturn.c @@ -786,12 +786,12 @@ static ADDRESS_MAP_START( saturn_mem, AS_PROGRAM, 32, saturn_state ) AM_RANGE(0x05a00000, 0x05a7ffff) AM_READWRITE16(saturn_soundram_r, saturn_soundram_w,0xffffffff) AM_RANGE(0x05b00000, 0x05b00fff) AM_DEVREADWRITE16_LEGACY("scsp", scsp_r, scsp_w, 0xffffffff) /* VDP1 */ - AM_RANGE(0x05c00000, 0x05c7ffff) AM_READWRITE_LEGACY(saturn_vdp1_vram_r, saturn_vdp1_vram_w) - AM_RANGE(0x05c80000, 0x05cbffff) AM_READWRITE_LEGACY(saturn_vdp1_framebuffer0_r, saturn_vdp1_framebuffer0_w) - AM_RANGE(0x05d00000, 0x05d0001f) AM_READWRITE16_LEGACY(saturn_vdp1_regs_r, saturn_vdp1_regs_w,0xffffffff) - AM_RANGE(0x05e00000, 0x05e7ffff) AM_MIRROR(0x80000) AM_READWRITE_LEGACY(saturn_vdp2_vram_r, saturn_vdp2_vram_w) - AM_RANGE(0x05f00000, 0x05f7ffff) AM_READWRITE_LEGACY(saturn_vdp2_cram_r, saturn_vdp2_cram_w) - AM_RANGE(0x05f80000, 0x05fbffff) AM_READWRITE16_LEGACY(saturn_vdp2_regs_r, saturn_vdp2_regs_w,0xffffffff) + AM_RANGE(0x05c00000, 0x05c7ffff) AM_READWRITE(saturn_vdp1_vram_r, saturn_vdp1_vram_w) + AM_RANGE(0x05c80000, 0x05cbffff) AM_READWRITE(saturn_vdp1_framebuffer0_r, saturn_vdp1_framebuffer0_w) + AM_RANGE(0x05d00000, 0x05d0001f) AM_READWRITE16(saturn_vdp1_regs_r, saturn_vdp1_regs_w,0xffffffff) + AM_RANGE(0x05e00000, 0x05e7ffff) AM_MIRROR(0x80000) AM_READWRITE(saturn_vdp2_vram_r, saturn_vdp2_vram_w) + AM_RANGE(0x05f00000, 0x05f7ffff) AM_READWRITE(saturn_vdp2_cram_r, saturn_vdp2_cram_w) + AM_RANGE(0x05f80000, 0x05fbffff) AM_READWRITE16(saturn_vdp2_regs_r, saturn_vdp2_regs_w,0xffffffff) AM_RANGE(0x05fe0000, 0x05fe00cf) AM_READWRITE(saturn_scu_r, saturn_scu_w) AM_RANGE(0x06000000, 0x060fffff) AM_RAM AM_MIRROR(0x21f00000) AM_SHARE("workram_h") AM_RANGE(0x20000000, 0x2007ffff) AM_ROM AM_SHARE("share6") // bios mirror @@ -815,12 +815,12 @@ static ADDRESS_MAP_START( stv_mem, AS_PROGRAM, 32, saturn_state ) AM_RANGE(0x05a00000, 0x05afffff) AM_READWRITE16(saturn_soundram_r, saturn_soundram_w,0xffffffff) AM_RANGE(0x05b00000, 0x05b00fff) AM_DEVREADWRITE16_LEGACY("scsp", scsp_r, scsp_w, 0xffffffff) /* VDP1 */ - AM_RANGE(0x05c00000, 0x05c7ffff) AM_READWRITE_LEGACY(saturn_vdp1_vram_r, saturn_vdp1_vram_w) - AM_RANGE(0x05c80000, 0x05cbffff) AM_READWRITE_LEGACY(saturn_vdp1_framebuffer0_r, saturn_vdp1_framebuffer0_w) - AM_RANGE(0x05d00000, 0x05d0001f) AM_READWRITE16_LEGACY(saturn_vdp1_regs_r, saturn_vdp1_regs_w,0xffffffff) - AM_RANGE(0x05e00000, 0x05e7ffff) AM_MIRROR(0x80000) AM_READWRITE_LEGACY(saturn_vdp2_vram_r, saturn_vdp2_vram_w) - AM_RANGE(0x05f00000, 0x05f7ffff) AM_READWRITE_LEGACY(saturn_vdp2_cram_r, saturn_vdp2_cram_w) - AM_RANGE(0x05f80000, 0x05fbffff) AM_READWRITE16_LEGACY(saturn_vdp2_regs_r, saturn_vdp2_regs_w,0xffffffff) + AM_RANGE(0x05c00000, 0x05c7ffff) AM_READWRITE(saturn_vdp1_vram_r, saturn_vdp1_vram_w) + AM_RANGE(0x05c80000, 0x05cbffff) AM_READWRITE(saturn_vdp1_framebuffer0_r, saturn_vdp1_framebuffer0_w) + AM_RANGE(0x05d00000, 0x05d0001f) AM_READWRITE16(saturn_vdp1_regs_r, saturn_vdp1_regs_w,0xffffffff) + AM_RANGE(0x05e00000, 0x05e7ffff) AM_MIRROR(0x80000) AM_READWRITE(saturn_vdp2_vram_r, saturn_vdp2_vram_w) + AM_RANGE(0x05f00000, 0x05f7ffff) AM_READWRITE(saturn_vdp2_cram_r, saturn_vdp2_cram_w) + AM_RANGE(0x05f80000, 0x05fbffff) AM_READWRITE16(saturn_vdp2_regs_r, saturn_vdp2_regs_w,0xffffffff) AM_RANGE(0x05fe0000, 0x05fe00cf) AM_READWRITE(saturn_scu_r, saturn_scu_w) AM_RANGE(0x06000000, 0x060fffff) AM_RAM AM_MIRROR(0x21f00000) AM_SHARE("workram_h") AM_RANGE(0x20000000, 0x2007ffff) AM_ROM AM_SHARE("share6") // bios mirror @@ -1881,7 +1881,6 @@ TODO: TIMER_DEVICE_CALLBACK_MEMBER(saturn_state::saturn_scanline) { - saturn_state *state = machine().driver_data(); int scanline = param; int max_y = machine().primary_screen->height(); int y_step,vblank_line; @@ -1897,7 +1896,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(saturn_state::saturn_scanline) if(scanline == (0)*y_step) { - video_update_vdp1(machine()); + video_update_vdp1(); if(STV_VDP1_VBE) m_vdp1.framebuffer_clear_on_next_frame = 1; diff --git a/src/mame/includes/stv.h b/src/mame/includes/stv.h index 96d0b8c3098..172acf38b70 100644 --- a/src/mame/includes/stv.h +++ b/src/mame/includes/stv.h @@ -249,15 +249,118 @@ public: DECLARE_DEVICE_IMAGE_LOAD_MEMBER( sat_cart ); DECLARE_DEVICE_IMAGE_LOAD_MEMBER( stv_cart ); + + DECLARE_READ16_MEMBER ( saturn_vdp1_regs_r ); + DECLARE_READ32_MEMBER ( saturn_vdp1_vram_r ); + DECLARE_READ32_MEMBER ( saturn_vdp1_framebuffer0_r ); + + DECLARE_WRITE16_MEMBER ( saturn_vdp1_regs_w ); + DECLARE_WRITE32_MEMBER ( saturn_vdp1_vram_w ); + DECLARE_WRITE32_MEMBER ( saturn_vdp1_framebuffer0_w ); + + DECLARE_READ32_MEMBER ( saturn_vdp2_vram_r ); + DECLARE_READ32_MEMBER ( saturn_vdp2_cram_r ); + DECLARE_READ16_MEMBER ( saturn_vdp2_regs_r ); + + DECLARE_WRITE32_MEMBER ( saturn_vdp2_vram_w ); + DECLARE_WRITE32_MEMBER ( saturn_vdp2_cram_w ); + DECLARE_WRITE16_MEMBER ( saturn_vdp2_regs_w ); + + + /* VDP1 */ + void stv_set_framebuffer_config( void ); + void stv_prepare_framebuffers( void ); + void stv_vdp1_change_framebuffers( void ); + void video_update_vdp1( void ); + void stv_vdp1_process_list( void ); + void stv_vdp1_set_drawpixel( void ); + + void stv_vdp1_draw_normal_sprite(const rectangle &cliprect, int sprite_type); + void stv_vdp1_draw_scaled_sprite(const rectangle &cliprect); + void stv_vdp1_draw_distorted_sprite(const rectangle &cliprect); + void stv_vdp1_draw_poly_line(const rectangle &cliprect); + void stv_vdp1_draw_line(const rectangle &cliprect); + int x2s(int v); + int y2s(int v); + void vdp1_fill_quad(const rectangle &cliprect, int patterndata, int xsize, const struct spoint *q); + void vdp1_fill_line(const rectangle &cliprect, int patterndata, int xsize, INT32 y, INT32 x1, INT32 x2, INT32 u1, INT32 u2, INT32 v1, INT32 v2); +// void (*drawpixel)(int x, int y, int patterndata, int offsetcnt); +// void drawpixel_poly(int x, int y, int patterndata, int offsetcnt); +// void drawpixel_8bpp_trans(int x, int y, int patterndata, int offsetcnt); +// void drawpixel_4bpp_notrans(int x, int y, int patterndata, int offsetcnt); +// void drawpixel_4bpp_trans(int x, int y, int patterndata, int offsetcnt); +// void drawpixel_generic(int x, int y, int patterndata, int offsetcnt); + void vdp1_fill_slope(const rectangle &cliprect, int patterndata, int xsize, + INT32 x1, INT32 x2, INT32 sl1, INT32 sl2, INT32 *nx1, INT32 *nx2, + 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 _y1, INT32 y2); + void stv_vdp1_setup_shading(const struct spoint* q, const rectangle &cliprect); + UINT8 stv_read_gouraud_table( void ); + void stv_clear_framebuffer( int which_framebuffer ); + void stv_vdp1_state_save_postload( void ); + int stv_vdp1_start ( void ); + + + /* VDP2 */ + + UINT8 get_vblank( void ); + UINT8 get_hblank( void ); + int get_vblank_duration( void ); + int get_hblank_duration( void ); + int get_pixel_clock( void ); + UINT8 get_odd_bit( void ); + void stv_vdp2_dynamic_res_change( void ); + + void refresh_palette_data( void ); + int stv_vdp2_window_process(int x,int y); + void stv_vdp2_get_window0_coordinates(UINT16 *s_x, UINT16 *e_x, UINT16 *s_y, UINT16 *e_y); + void stv_vdp2_get_window1_coordinates(UINT16 *s_x, UINT16 *e_x, UINT16 *s_y, UINT16 *e_y); + int get_window_pixel(UINT16 s_x,UINT16 e_x,UINT16 s_y,UINT16 e_y,int x, int y,UINT8 win_num); + int stv_vdp2_apply_window_on_layer(rectangle &cliprect); + + void stv_vdp2_draw_basic_tilemap(bitmap_rgb32 &bitmap, const rectangle &cliprect); + void stv_vdp2_draw_basic_bitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect); + + void stv_vdp2_drawgfxzoom(bitmap_rgb32 &dest_bmp,const rectangle &clip,gfx_element *gfx, UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy,int transparency,int transparent_color,int scalex, int scaley,int sprite_screen_width, int sprite_screen_height, int alpha); + void stv_vdp2_drawgfxzoom_rgb555(bitmap_rgb32 &dest_bmp,const rectangle &clip,UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy,int transparency,int transparent_color,int scalex, int scaley,int sprite_screen_width, int sprite_screen_height, int alpha); + void stv_vdp2_drawgfx_rgb555( bitmap_rgb32 &dest_bmp, const rectangle &clip, UINT32 code, int flipx, int flipy, int sx, int sy, int transparency, int alpha); + void stv_vdp2_drawgfx_rgb888( bitmap_rgb32 &dest_bmp, const rectangle &clip, UINT32 code, int flipx, int flipy, int sx, int sy, int transparency, int alpha); + + void stv_vdp2_draw_rotation_screen(bitmap_rgb32 &bitmap, const rectangle &cliprect, int iRP); + void stv_vdp2_check_tilemap_with_linescroll(bitmap_rgb32 &bitmap, const rectangle &cliprect); + void stv_vdp2_check_tilemap(bitmap_rgb32 &bitmap, const rectangle &cliprect); + 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 ); + 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); + + 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_UINT32(UINT32 *rgb, int cor); + void stv_vdp2_check_fade_control_for_layer( void ); + + void stv_vdp2_draw_line(bitmap_rgb32 &bitmap, const rectangle &cliprect); + void stv_vdp2_draw_back(bitmap_rgb32 &bitmap, const rectangle &cliprect); + void stv_vdp2_draw_NBG0(bitmap_rgb32 &bitmap, const rectangle &cliprect); + void stv_vdp2_draw_NBG1(bitmap_rgb32 &bitmap, const rectangle &cliprect); + void stv_vdp2_draw_NBG2(bitmap_rgb32 &bitmap, const rectangle &cliprect); + void stv_vdp2_draw_NBG3(bitmap_rgb32 &bitmap, const rectangle &cliprect); + void stv_vdp2_draw_RBG0(bitmap_rgb32 &bitmap, const rectangle &cliprect); + void draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT8 pri); + + void stv_vdp2_state_save_postload( void ); + void stv_vdp2_exit ( void ); + int stv_vdp2_start ( void ); }; #define MASTER_CLOCK_352 57272720 #define MASTER_CLOCK_320 53693174 -#define CEF_1 state->m_vdp1_regs[0x010/2]|=0x0002 -#define CEF_0 state->m_vdp1_regs[0x010/2]&=~0x0002 -#define BEF_1 state->m_vdp1_regs[0x010/2]|=0x0001 -#define BEF_0 state->m_vdp1_regs[0x010/2]&=~0x0001 -#define STV_VDP1_TVMR ((state->m_vdp1_regs[0x000/2])&0xffff) +#define CEF_1 m_vdp1_regs[0x010/2]|=0x0002 +#define CEF_0 m_vdp1_regs[0x010/2]&=~0x0002 +#define BEF_1 m_vdp1_regs[0x010/2]|=0x0001 +#define BEF_0 m_vdp1_regs[0x010/2]&=~0x0001 +#define STV_VDP1_TVMR ((m_vdp1_regs[0x000/2])&0xffff) #define STV_VDP1_VBE ((STV_VDP1_TVMR & 0x0008) >> 3) #define STV_VDP1_TVM ((STV_VDP1_TVMR & 0x0007) >> 0) @@ -294,21 +397,3 @@ int stv_vdp1_start ( running_machine &machine ); void video_update_vdp1(running_machine &machine); void stv_vdp2_dynamic_res_change(running_machine &machine); -DECLARE_READ16_HANDLER ( saturn_vdp1_regs_r ); -DECLARE_READ32_HANDLER ( saturn_vdp1_vram_r ); -DECLARE_READ32_HANDLER ( saturn_vdp1_framebuffer0_r ); - -DECLARE_WRITE16_HANDLER ( saturn_vdp1_regs_w ); -DECLARE_WRITE32_HANDLER ( saturn_vdp1_vram_w ); -DECLARE_WRITE32_HANDLER ( saturn_vdp1_framebuffer0_w ); - -/*----------- defined in video/stvvdp2.c -----------*/ - -DECLARE_READ32_HANDLER ( saturn_vdp2_vram_r ); -DECLARE_READ32_HANDLER ( saturn_vdp2_cram_r ); -DECLARE_READ16_HANDLER ( saturn_vdp2_regs_r ); - -DECLARE_WRITE32_HANDLER ( saturn_vdp2_vram_w ); -DECLARE_WRITE32_HANDLER ( saturn_vdp2_cram_w ); -DECLARE_WRITE16_HANDLER ( saturn_vdp2_regs_w ); - diff --git a/src/mame/machine/smpc.c b/src/mame/machine/smpc.c index 4f9aec2b217..c24db743e1b 100644 --- a/src/mame/machine/smpc.c +++ b/src/mame/machine/smpc.c @@ -271,7 +271,7 @@ static TIMER_CALLBACK( smpc_change_clock ) machine.device("slave")->set_unscaled_clock(xtal/2); state->m_vdp2.dotsel = param ^ 1; - stv_vdp2_dynamic_res_change(machine); + state->stv_vdp2_dynamic_res_change(); if(!state->m_NMI_reset) state->m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); diff --git a/src/mame/video/stvvdp1.c b/src/mame/video/stvvdp1.c index c76825d3196..803c4cd1ab8 100644 --- a/src/mame/video/stvvdp1.c +++ b/src/mame/video/stvvdp1.c @@ -100,7 +100,7 @@ struct shaded_point ---- ---- ---- --x- | Frame Buffer Change Trigger (FCM) ---- ---- ---- ---x | Frame Buffer Change Mode (FCT) */ -#define STV_VDP1_FBCR ((state->m_vdp1_regs[0x002/2] >> 0)&0xffff) +#define STV_VDP1_FBCR ((m_vdp1_regs[0x002/2] >> 0)&0xffff) #define STV_VDP1_EOS ((STV_VDP1_FBCR & 0x0010) >> 4) #define STV_VDP1_DIE ((STV_VDP1_FBCR & 0x0008) >> 3) #define STV_VDP1_DIL ((STV_VDP1_FBCR & 0x0004) >> 2) @@ -118,16 +118,16 @@ struct shaded_point 1 VDP1 draw by request 0 VDP1 Idle (no access) */ -#define STV_VDP1_PTMR ((state->m_vdp1_regs[0x004/2])&0xffff) +#define STV_VDP1_PTMR ((m_vdp1_regs[0x004/2])&0xffff) #define STV_VDP1_PTM ((STV_VDP1_PTMR & 0x0003) >> 0) -#define PTM_0 state->m_vdp1_regs[0x004/2]&=~0x0001 +#define PTM_0 m_vdp1_regs[0x004/2]&=~0x0001 /* Erase/Write Data Register 16 bpp = data 8 bpp = erase/write data for even/odd X coordinates */ -#define STV_VDP1_EWDR ((state->m_vdp1_regs[0x006/2])&0xffff) +#define STV_VDP1_EWDR ((m_vdp1_regs[0x006/2])&0xffff) /*Erase/Write Upper-Left register*/ /* @@ -136,7 +136,7 @@ struct shaded_point ---- ---x xxxx xxxx | Y1 register */ -#define STV_VDP1_EWLR ((state->m_vdp1_regs[0x008/2])&0xffff) +#define STV_VDP1_EWLR ((m_vdp1_regs[0x008/2])&0xffff) #define STV_VDP1_EWLR_X1 ((STV_VDP1_EWLR & 0x7e00) >> 9) #define STV_VDP1_EWLR_Y1 ((STV_VDP1_EWLR & 0x01ff) >> 0) /*Erase/Write Lower-Right register*/ @@ -145,7 +145,7 @@ struct shaded_point ---- ---x xxxx xxxx | Y3 register */ -#define STV_VDP1_EWRR ((state->m_vdp1_regs[0x00a/2])&0xffff) +#define STV_VDP1_EWRR ((m_vdp1_regs[0x00a/2])&0xffff) #define STV_VDP1_EWRR_X3 ((STV_VDP1_EWRR & 0xfe00) >> 9) #define STV_VDP1_EWRR_Y3 ((STV_VDP1_EWRR & 0x01ff) >> 0) /*Transfer End Status Register*/ @@ -155,19 +155,15 @@ struct shaded_point ---- ---- ---- ---x | BEF */ -#define STV_VDP1_EDSR ((state->m_vdp1_regs[0x010/2])&0xffff) +#define STV_VDP1_EDSR ((m_vdp1_regs[0x010/2])&0xffff) #define STV_VDP1_CEF (STV_VDP1_EDSR & 2) #define STV_VDP1_BEF (STV_VDP1_EDSR & 1) /**/ -static void stv_vdp1_process_list(running_machine &machine); - -READ16_HANDLER( saturn_vdp1_regs_r ) +READ16_MEMBER( saturn_state::saturn_vdp1_regs_r ) { - saturn_state *state = space.machine().driver_data(); - //logerror ("cpu %s (PC=%08X) VDP1: Read from Registers, Offset %04x\n", space.device().tag(), space.device().safe_pc(), offset); switch(offset) @@ -176,8 +172,8 @@ READ16_HANDLER( saturn_vdp1_regs_r ) return 0; case 0x10/2: break; - case 0x12/2: return state->m_vdp1.lopr; - case 0x14/2: return state->m_vdp1.copr; + case 0x12/2: return m_vdp1.lopr; + case 0x14/2: return m_vdp1.copr; /* MODR register, read register for the other VDP1 regs (Shienryu SS version abuses of this during intro) */ case 0x16/2: @@ -195,125 +191,119 @@ READ16_HANDLER( saturn_vdp1_regs_r ) return modr; default: if(!space.debugger_access()) - printf ("cpu %s (PC=%08X) VDP1: Read from Registers, Offset %04x\n", space.device().tag(), space.device().safe_pc(), offset*2); + printf ("cpu %s (PC=%08X) VDP1: Read from Registers, Offset %04x\n", space.device().tag(), space.device().safe_pc(), offset*2); break; } - return state->m_vdp1_regs[offset]; //TODO: write-only regs should return open bus or zero + return m_vdp1_regs[offset]; //TODO: write-only regs should return open bus or zero } -static void stv_clear_framebuffer( running_machine &machine, int which_framebuffer ) +void saturn_state::stv_clear_framebuffer( int which_framebuffer ) { - saturn_state *state = machine.driver_data(); - - if ( VDP1_LOG ) logerror( "Clearing %d framebuffer\n", state->m_vdp1.framebuffer_current_draw ); - memset( state->m_vdp1.framebuffer[ which_framebuffer ], state->m_vdp1.ewdr, 1024 * 256 * sizeof(UINT16) * 2 ); + if ( VDP1_LOG ) logerror( "Clearing %d framebuffer\n", m_vdp1.framebuffer_current_draw ); + memset( m_vdp1.framebuffer[ which_framebuffer ], m_vdp1.ewdr, 1024 * 256 * sizeof(UINT16) * 2 ); } -static void stv_prepare_framebuffers( running_machine &machine ) +void saturn_state::stv_prepare_framebuffers( void ) { - saturn_state *state = machine.driver_data(); int i,rowsize; - rowsize = state->m_vdp1.framebuffer_width; - if ( state->m_vdp1.framebuffer_current_draw == 0 ) + rowsize = m_vdp1.framebuffer_width; + if ( m_vdp1.framebuffer_current_draw == 0 ) { - for ( i = 0; i < state->m_vdp1.framebuffer_height; i++ ) + for ( i = 0; i < m_vdp1.framebuffer_height; i++ ) { - state->m_vdp1.framebuffer_draw_lines[i] = &state->m_vdp1.framebuffer[0][ i * rowsize ]; - state->m_vdp1.framebuffer_display_lines[i] = &state->m_vdp1.framebuffer[1][ i * rowsize ]; + m_vdp1.framebuffer_draw_lines[i] = &m_vdp1.framebuffer[0][ i * rowsize ]; + m_vdp1.framebuffer_display_lines[i] = &m_vdp1.framebuffer[1][ i * rowsize ]; } for ( ; i < 512; i++ ) { - state->m_vdp1.framebuffer_draw_lines[i] = &state->m_vdp1.framebuffer[0][0]; - state->m_vdp1.framebuffer_display_lines[i] = &state->m_vdp1.framebuffer[1][0]; + m_vdp1.framebuffer_draw_lines[i] = &m_vdp1.framebuffer[0][0]; + m_vdp1.framebuffer_display_lines[i] = &m_vdp1.framebuffer[1][0]; } } else { - for ( i = 0; i < state->m_vdp1.framebuffer_height; i++ ) + for ( i = 0; i < m_vdp1.framebuffer_height; i++ ) { - state->m_vdp1.framebuffer_draw_lines[i] = &state->m_vdp1.framebuffer[1][ i * rowsize ]; - state->m_vdp1.framebuffer_display_lines[i] = &state->m_vdp1.framebuffer[0][ i * rowsize ]; + m_vdp1.framebuffer_draw_lines[i] = &m_vdp1.framebuffer[1][ i * rowsize ]; + m_vdp1.framebuffer_display_lines[i] = &m_vdp1.framebuffer[0][ i * rowsize ]; } for ( ; i < 512; i++ ) { - state->m_vdp1.framebuffer_draw_lines[i] = &state->m_vdp1.framebuffer[1][0]; - state->m_vdp1.framebuffer_display_lines[i] = &state->m_vdp1.framebuffer[0][0]; + m_vdp1.framebuffer_draw_lines[i] = &m_vdp1.framebuffer[1][0]; + m_vdp1.framebuffer_display_lines[i] = &m_vdp1.framebuffer[0][0]; } } for ( ; i < 512; i++ ) { - state->m_vdp1.framebuffer_draw_lines[i] = &state->m_vdp1.framebuffer[0][0]; - state->m_vdp1.framebuffer_display_lines[i] = &state->m_vdp1.framebuffer[1][0]; + m_vdp1.framebuffer_draw_lines[i] = &m_vdp1.framebuffer[0][0]; + m_vdp1.framebuffer_display_lines[i] = &m_vdp1.framebuffer[1][0]; } } -static void stv_vdp1_change_framebuffers( running_machine &machine ) +void saturn_state::stv_vdp1_change_framebuffers( void ) { - saturn_state *state = machine.driver_data(); - state->m_vdp1.framebuffer_current_display ^= 1; - state->m_vdp1.framebuffer_current_draw ^= 1; - if ( VDP1_LOG ) logerror( "Changing framebuffers: %d - draw, %d - display\n", state->m_vdp1.framebuffer_current_draw, state->m_vdp1.framebuffer_current_display ); - stv_prepare_framebuffers(machine); + m_vdp1.framebuffer_current_display ^= 1; + m_vdp1.framebuffer_current_draw ^= 1; + if ( VDP1_LOG ) logerror( "Changing framebuffers: %d - draw, %d - display\n", m_vdp1.framebuffer_current_draw, m_vdp1.framebuffer_current_display ); + stv_prepare_framebuffers(); } -static void stv_set_framebuffer_config( running_machine &machine ) +void saturn_state::stv_set_framebuffer_config( void ) { - saturn_state *state = machine.driver_data(); - if ( state->m_vdp1.framebuffer_mode == STV_VDP1_TVM && - state->m_vdp1.framebuffer_double_interlace == STV_VDP1_DIE ) return; + if ( m_vdp1.framebuffer_mode == STV_VDP1_TVM && + m_vdp1.framebuffer_double_interlace == STV_VDP1_DIE ) return; if ( VDP1_LOG ) logerror( "Setting framebuffer config\n" ); - state->m_vdp1.framebuffer_mode = STV_VDP1_TVM; - state->m_vdp1.framebuffer_double_interlace = STV_VDP1_DIE; - switch( state->m_vdp1.framebuffer_mode ) + m_vdp1.framebuffer_mode = STV_VDP1_TVM; + m_vdp1.framebuffer_double_interlace = STV_VDP1_DIE; + switch( m_vdp1.framebuffer_mode ) { - case 0: state->m_vdp1.framebuffer_width = 512; state->m_vdp1.framebuffer_height = 256; break; - case 1: state->m_vdp1.framebuffer_width = 1024; state->m_vdp1.framebuffer_height = 256; break; - case 2: state->m_vdp1.framebuffer_width = 512; state->m_vdp1.framebuffer_height = 256; break; - case 3: state->m_vdp1.framebuffer_width = 512; state->m_vdp1.framebuffer_height = 512; break; - case 4: state->m_vdp1.framebuffer_width = 512; state->m_vdp1.framebuffer_height = 256; break; - default: logerror( "Invalid framebuffer config %x\n", STV_VDP1_TVM ); state->m_vdp1.framebuffer_width = 512; state->m_vdp1.framebuffer_height = 256; break; + case 0: m_vdp1.framebuffer_width = 512; m_vdp1.framebuffer_height = 256; break; + case 1: m_vdp1.framebuffer_width = 1024; m_vdp1.framebuffer_height = 256; break; + case 2: m_vdp1.framebuffer_width = 512; m_vdp1.framebuffer_height = 256; break; + case 3: m_vdp1.framebuffer_width = 512; m_vdp1.framebuffer_height = 512; break; + case 4: m_vdp1.framebuffer_width = 512; m_vdp1.framebuffer_height = 256; break; + default: logerror( "Invalid framebuffer config %x\n", STV_VDP1_TVM ); m_vdp1.framebuffer_width = 512; m_vdp1.framebuffer_height = 256; break; } - if ( STV_VDP1_DIE ) state->m_vdp1.framebuffer_height *= 2; /* double interlace */ + if ( STV_VDP1_DIE ) m_vdp1.framebuffer_height *= 2; /* double interlace */ - state->m_vdp1.framebuffer_current_draw = 0; - state->m_vdp1.framebuffer_current_display = 1; - stv_prepare_framebuffers(machine); + m_vdp1.framebuffer_current_draw = 0; + m_vdp1.framebuffer_current_display = 1; + stv_prepare_framebuffers(); } -WRITE16_HANDLER( saturn_vdp1_regs_w ) +WRITE16_MEMBER( saturn_state::saturn_vdp1_regs_w ) { - saturn_state *state = space.machine().driver_data(); - COMBINE_DATA(&state->m_vdp1_regs[offset]); + COMBINE_DATA(&m_vdp1_regs[offset]); switch(offset) { case 0x00/2: - stv_set_framebuffer_config(space.machine()); + stv_set_framebuffer_config(); if ( VDP1_LOG ) logerror( "VDP1: Access to register TVMR = %1X\n", STV_VDP1_TVMR ); break; case 0x02/2: - stv_set_framebuffer_config(space.machine()); + stv_set_framebuffer_config(); if ( VDP1_LOG ) logerror( "VDP1: Access to register FBCR = %1X\n", STV_VDP1_FBCR ); - state->m_vdp1.fbcr_accessed = 1; + m_vdp1.fbcr_accessed = 1; break; case 0x04/2: if ( VDP1_LOG ) logerror( "VDP1: Access to register PTMR = %1X\n", STV_VDP1_PTM ); if ( STV_VDP1_PTMR == 1 ) - stv_vdp1_process_list( space.machine() ); + stv_vdp1_process_list(); break; case 0x06/2: if ( VDP1_LOG ) logerror( "VDP1: Erase data set %08X\n", data ); - state->m_vdp1.ewdr = STV_VDP1_EWDR; + m_vdp1.ewdr = STV_VDP1_EWDR; break; case 0x08/2: if ( VDP1_LOG ) logerror( "VDP1: Erase upper-left coord set: %08X\n", data ); @@ -331,26 +321,24 @@ WRITE16_HANDLER( saturn_vdp1_regs_w ) } -READ32_HANDLER ( saturn_vdp1_vram_r ) +READ32_MEMBER ( saturn_state::saturn_vdp1_vram_r ) { - saturn_state *state = space.machine().driver_data(); - return state->m_vdp1_vram[offset]; + return m_vdp1_vram[offset]; } -WRITE32_HANDLER ( saturn_vdp1_vram_w ) +WRITE32_MEMBER ( saturn_state::saturn_vdp1_vram_w ) { - saturn_state *state = space.machine().driver_data(); - UINT8 *vdp1 = state->m_vdp1.gfx_decode; + UINT8 *vdp1 = m_vdp1.gfx_decode; - COMBINE_DATA (&state->m_vdp1_vram[offset]); + COMBINE_DATA (&m_vdp1_vram[offset]); // if (((offset * 4) > 0xdf) && ((offset * 4) < 0x140)) // { // logerror("cpu %s (PC=%08X): VRAM dword write to %08X = %08X & %08X\n", space.device().tag(), space.device().safe_pc(), offset*4, data, mem_mask); // } - data = state->m_vdp1_vram[offset]; + data = m_vdp1_vram[offset]; /* put in gfx region for easy decoding */ vdp1[offset*4+0] = (data & 0xff000000) >> 24; vdp1[offset*4+1] = (data & 0x00ff0000) >> 16; @@ -358,9 +346,8 @@ WRITE32_HANDLER ( saturn_vdp1_vram_w ) vdp1[offset*4+3] = (data & 0x000000ff) >> 0; } -WRITE32_HANDLER ( saturn_vdp1_framebuffer0_w ) +WRITE32_MEMBER ( saturn_state::saturn_vdp1_framebuffer0_w ) { - saturn_state *state = space.machine().driver_data(); //popmessage ("STV VDP1 Framebuffer 0 WRITE offset %08x data %08x",offset, data); if ( STV_VDP1_TVM & 1 ) { @@ -368,23 +355,23 @@ WRITE32_HANDLER ( saturn_vdp1_framebuffer0_w ) //printf("VDP1 8-bit mode %08x %02x\n",offset,data); if ( ACCESSING_BITS_24_31 ) { - state->m_vdp1.framebuffer[state->m_vdp1.framebuffer_current_draw][offset*2] &= 0x00ff; - state->m_vdp1.framebuffer[state->m_vdp1.framebuffer_current_draw][offset*2] |= data & 0xff00; + m_vdp1.framebuffer[m_vdp1.framebuffer_current_draw][offset*2] &= 0x00ff; + m_vdp1.framebuffer[m_vdp1.framebuffer_current_draw][offset*2] |= data & 0xff00; } if ( ACCESSING_BITS_16_23 ) { - state->m_vdp1.framebuffer[state->m_vdp1.framebuffer_current_draw][offset*2] &= 0xff00; - state->m_vdp1.framebuffer[state->m_vdp1.framebuffer_current_draw][offset*2] |= data & 0x00ff; + m_vdp1.framebuffer[m_vdp1.framebuffer_current_draw][offset*2] &= 0xff00; + m_vdp1.framebuffer[m_vdp1.framebuffer_current_draw][offset*2] |= data & 0x00ff; } if ( ACCESSING_BITS_8_15 ) { - state->m_vdp1.framebuffer[state->m_vdp1.framebuffer_current_draw][offset*2+1] &= 0x00ff; - state->m_vdp1.framebuffer[state->m_vdp1.framebuffer_current_draw][offset*2+1] |= data & 0xff00; + m_vdp1.framebuffer[m_vdp1.framebuffer_current_draw][offset*2+1] &= 0x00ff; + m_vdp1.framebuffer[m_vdp1.framebuffer_current_draw][offset*2+1] |= data & 0xff00; } if ( ACCESSING_BITS_0_7 ) { - state->m_vdp1.framebuffer[state->m_vdp1.framebuffer_current_draw][offset*2+1] &= 0xff00; - state->m_vdp1.framebuffer[state->m_vdp1.framebuffer_current_draw][offset*2+1] |= data & 0x00ff; + m_vdp1.framebuffer[m_vdp1.framebuffer_current_draw][offset*2+1] &= 0xff00; + m_vdp1.framebuffer[m_vdp1.framebuffer_current_draw][offset*2+1] |= data & 0x00ff; } } else @@ -392,18 +379,17 @@ WRITE32_HANDLER ( saturn_vdp1_framebuffer0_w ) /* 16-bit mode */ if ( ACCESSING_BITS_16_31 ) { - state->m_vdp1.framebuffer[state->m_vdp1.framebuffer_current_draw][offset*2] = (data >> 16) & 0xffff; + m_vdp1.framebuffer[m_vdp1.framebuffer_current_draw][offset*2] = (data >> 16) & 0xffff; } if ( ACCESSING_BITS_0_15 ) { - state->m_vdp1.framebuffer[state->m_vdp1.framebuffer_current_draw][offset*2+1] = data & 0xffff; + m_vdp1.framebuffer[m_vdp1.framebuffer_current_draw][offset*2+1] = data & 0xffff; } } } -READ32_HANDLER ( saturn_vdp1_framebuffer0_r ) +READ32_MEMBER ( saturn_state::saturn_vdp1_framebuffer0_r ) { - saturn_state *state = space.machine().driver_data(); UINT32 result = 0; //popmessage ("STV VDP1 Framebuffer 0 READ offset %08x",offset); if ( STV_VDP1_TVM & 1 ) @@ -411,24 +397,24 @@ READ32_HANDLER ( saturn_vdp1_framebuffer0_r ) /* 8-bit mode */ //printf("VDP1 8-bit mode %08x\n",offset); if ( ACCESSING_BITS_24_31 ) - result |= ((state->m_vdp1.framebuffer[state->m_vdp1.framebuffer_current_draw][offset*2] & 0xff00) << 16); + result |= ((m_vdp1.framebuffer[m_vdp1.framebuffer_current_draw][offset*2] & 0xff00) << 16); if ( ACCESSING_BITS_16_23 ) - result |= ((state->m_vdp1.framebuffer[state->m_vdp1.framebuffer_current_draw][offset*2] & 0x00ff) << 16); + result |= ((m_vdp1.framebuffer[m_vdp1.framebuffer_current_draw][offset*2] & 0x00ff) << 16); if ( ACCESSING_BITS_8_15 ) - result |= ((state->m_vdp1.framebuffer[state->m_vdp1.framebuffer_current_draw][offset*2+1] & 0xff00)); + result |= ((m_vdp1.framebuffer[m_vdp1.framebuffer_current_draw][offset*2+1] & 0xff00)); if ( ACCESSING_BITS_0_7 ) - result |= ((state->m_vdp1.framebuffer[state->m_vdp1.framebuffer_current_draw][offset*2+1] & 0x00ff)); + result |= ((m_vdp1.framebuffer[m_vdp1.framebuffer_current_draw][offset*2+1] & 0x00ff)); } else { /* 16-bit mode */ if ( ACCESSING_BITS_16_31 ) { - result |= (state->m_vdp1.framebuffer[state->m_vdp1.framebuffer_current_draw][offset*2] << 16); + result |= (m_vdp1.framebuffer[m_vdp1.framebuffer_current_draw][offset*2] << 16); } if ( ACCESSING_BITS_0_15 ) { - result |= (state->m_vdp1.framebuffer[state->m_vdp1.framebuffer_current_draw][offset*2+1]); + result |= (m_vdp1.framebuffer[m_vdp1.framebuffer_current_draw][offset*2+1]); } } @@ -543,18 +529,17 @@ static void stv_clear_gouraud_shading(void) memset( &stv_gouraud_shading, 0, sizeof( stv_gouraud_shading ) ); } -static UINT8 stv_read_gouraud_table(running_machine &machine) +UINT8 saturn_state::stv_read_gouraud_table( void ) { - saturn_state *state = machine.driver_data(); int gaddr; if ( (stv2_current_sprite.CMDPMOD & 0x7) == 4 ) { gaddr = stv2_current_sprite.CMDGRDA * 8; - stv_gouraud_shading.GA = (state->m_vdp1_vram[gaddr/4] >> 16) & 0xffff; - stv_gouraud_shading.GB = (state->m_vdp1_vram[gaddr/4] >> 0) & 0xffff; - stv_gouraud_shading.GC = (state->m_vdp1_vram[gaddr/4 + 1] >> 16) & 0xffff; - stv_gouraud_shading.GD = (state->m_vdp1_vram[gaddr/4 + 1] >> 0) & 0xffff; + stv_gouraud_shading.GA = (m_vdp1_vram[gaddr/4] >> 16) & 0xffff; + stv_gouraud_shading.GB = (m_vdp1_vram[gaddr/4] >> 0) & 0xffff; + stv_gouraud_shading.GC = (m_vdp1_vram[gaddr/4 + 1] >> 16) & 0xffff; + stv_gouraud_shading.GD = (m_vdp1_vram[gaddr/4 + 1] >> 0) & 0xffff; return 1; } else @@ -705,7 +690,7 @@ static void stv_vdp1_setup_shading_for_slope( *ng2 = g2; } -static void stv_vdp1_setup_shading(running_machine &machine,const struct spoint* q, const rectangle &cliprect) +void saturn_state::stv_vdp1_setup_shading(const struct spoint* q, const rectangle &cliprect) { INT32 x1, x2, delta, cury, limy; INT32 r1, g1, b1, r2, g2, b2; @@ -715,7 +700,7 @@ static void stv_vdp1_setup_shading(running_machine &machine,const struct spoint* struct shaded_point p[8]; UINT16 gd[4]; - if ( stv_read_gouraud_table(machine) == 0 ) return; + if ( stv_read_gouraud_table() == 0 ) return; gd[0] = stv_gouraud_shading.GA; gd[1] = stv_gouraud_shading.GB; @@ -1080,16 +1065,15 @@ static void drawpixel_generic(running_machine &machine, int x, int y, int patter } -static void stv_vdp1_set_drawpixel(running_machine &machine) +void saturn_state::stv_vdp1_set_drawpixel( void ) { - saturn_state *state = machine.driver_data(); int sprite_type = stv2_current_sprite.CMDCTRL & 0x000f; int sprite_mode = stv2_current_sprite.CMDPMOD&0x0038; int spd = stv2_current_sprite.CMDPMOD & 0x40; int mesh = stv2_current_sprite.CMDPMOD & 0x100; int ecd = stv2_current_sprite.CMDPMOD & 0x80; - gfxdata = state->m_vdp1.gfx_decode; + gfxdata = m_vdp1.gfx_decode; if ( mesh || !ecd || ((stv2_current_sprite.CMDPMOD & 0x7) != 0) ) { @@ -1123,7 +1107,7 @@ static void stv_vdp1_set_drawpixel(running_machine &machine) } -static void vdp1_fill_slope(running_machine &machine, const rectangle &cliprect, int patterndata, int xsize, +void saturn_state::vdp1_fill_slope(const rectangle &cliprect, int patterndata, int xsize, INT32 x1, INT32 x2, INT32 sl1, INT32 sl2, INT32 *nx1, INT32 *nx2, INT32 u1, INT32 u2, INT32 slu1, INT32 slu2, INT32 *nu1, INT32 *nu2, INT32 v1, INT32 v2, INT32 slv1, INT32 slv2, INT32 *nv1, INT32 *nv2, @@ -1213,7 +1197,7 @@ static void vdp1_fill_slope(running_machine &machine, const rectangle &cliprect, xx2 = cliprect.max_x; while(xx1 <= xx2) { - drawpixel(machine,xx1,_y1, + drawpixel(machine(),xx1,_y1, patterndata, (v>>FRAC_SHIFT)*xsize+(u>>FRAC_SHIFT)); xx1++; @@ -1239,7 +1223,7 @@ static void vdp1_fill_slope(running_machine &machine, const rectangle &cliprect, *nv2 = v2; } -static void vdp1_fill_line(running_machine &machine, const rectangle &cliprect, int patterndata, int xsize, INT32 y, +void saturn_state::vdp1_fill_line(const rectangle &cliprect, int patterndata, int xsize, INT32 y, INT32 x1, INT32 x2, INT32 u1, INT32 u2, INT32 v1, INT32 v2) { int xx1 = x1>>FRAC_SHIFT; @@ -1267,7 +1251,7 @@ static void vdp1_fill_line(running_machine &machine, const rectangle &cliprect, xx2 = cliprect.max_x; while(xx1 <= xx2) { - drawpixel(machine,xx1,y, + drawpixel(machine(), xx1,y, patterndata, (v>>FRAC_SHIFT)*xsize+(u>>FRAC_SHIFT)); xx1++; @@ -1277,7 +1261,7 @@ static void vdp1_fill_line(running_machine &machine, const rectangle &cliprect, } } -static void vdp1_fill_quad(running_machine &machine, const rectangle &cliprect, int patterndata, int xsize, const struct spoint *q) +void saturn_state::vdp1_fill_quad(const rectangle &cliprect, int patterndata, int xsize, const struct spoint *q) { INT32 sl1, sl2, slu1, slu2, slv1, slv2, cury, limy, x1, x2, u1, u2, v1, v2, delta; int pmin, pmax, i, ps1, ps2; @@ -1317,7 +1301,7 @@ static void vdp1_fill_quad(running_machine &machine, const rectangle &cliprect, v2 = p[i].v; } } - vdp1_fill_line(machine, cliprect, patterndata, xsize, cury, x1, x2, u1, u2, v1, v2); + vdp1_fill_line(cliprect, patterndata, xsize, cury, x1, x2, u1, u2, v1, v2); return; } @@ -1336,7 +1320,7 @@ static void vdp1_fill_quad(running_machine &machine, const rectangle &cliprect, for(;;) { if(p[ps1-1].y == p[ps2+1].y) { - vdp1_fill_slope(machine, cliprect, patterndata, xsize, + vdp1_fill_slope(cliprect, patterndata, xsize, x1, x2, sl1, sl2, &x1, &x2, u1, u2, slu1, slu2, &u1, &u2, v1, v2, slv1, slv2, &v1, &v2, @@ -1369,7 +1353,7 @@ static void vdp1_fill_quad(running_machine &machine, const rectangle &cliprect, slu2 = (u2-p[ps2+1].u)/delta; slv2 = (v2-p[ps2+1].v)/delta; } else if(p[ps1-1].y < p[ps2+1].y) { - vdp1_fill_slope(machine, cliprect, patterndata, xsize, + vdp1_fill_slope(cliprect, patterndata, xsize, x1, x2, sl1, sl2, &x1, &x2, u1, u2, slu1, slu2, &u1, &u2, v1, v2, slv1, slv2, &v1, &v2, @@ -1389,7 +1373,7 @@ static void vdp1_fill_quad(running_machine &machine, const rectangle &cliprect, slu1 = (u1-p[ps1-1].u)/delta; slv1 = (v1-p[ps1-1].v)/delta; } else { - vdp1_fill_slope(machine, cliprect, patterndata, xsize, + vdp1_fill_slope(cliprect, patterndata, xsize, x1, x2, sl1, sl2, &x1, &x2, u1, u2, slu1, slu2, &u1, &u2, v1, v2, slv1, slv2, &v1, &v2, @@ -1411,106 +1395,102 @@ static void vdp1_fill_quad(running_machine &machine, const rectangle &cliprect, } } if(cury == limy) - vdp1_fill_line(machine, cliprect, patterndata, xsize, cury, x1, x2, u1, u2, v1, v2); + vdp1_fill_line(cliprect, patterndata, xsize, cury, x1, x2, u1, u2, v1, v2); } -static int x2s(running_machine &machine,int v) +int saturn_state::x2s(int v) { - saturn_state *state = machine.driver_data(); - - return (INT32)(INT16)v + state->m_vdp1.local_x; + return (INT32)(INT16)v + m_vdp1.local_x; } -static int y2s(running_machine &machine, int v) +int saturn_state::y2s(int v) { - saturn_state *state = machine.driver_data(); - - return (INT32)(INT16)v + state->m_vdp1.local_y; + return (INT32)(INT16)v + m_vdp1.local_y; } -static void stv_vdp1_draw_line(running_machine &machine, const rectangle &cliprect) +void saturn_state::stv_vdp1_draw_line(const rectangle &cliprect) { struct spoint q[4]; - q[0].x = x2s(machine, stv2_current_sprite.CMDXA); - q[0].y = y2s(machine, stv2_current_sprite.CMDYA); - q[1].x = x2s(machine, stv2_current_sprite.CMDXB); - q[1].y = y2s(machine, stv2_current_sprite.CMDYB); - q[2].x = x2s(machine, stv2_current_sprite.CMDXA); - q[2].y = y2s(machine, stv2_current_sprite.CMDYA); - q[3].x = x2s(machine, stv2_current_sprite.CMDXB); - q[3].y = y2s(machine, stv2_current_sprite.CMDYB); + q[0].x = x2s(stv2_current_sprite.CMDXA); + q[0].y = y2s(stv2_current_sprite.CMDYA); + q[1].x = x2s(stv2_current_sprite.CMDXB); + q[1].y = y2s(stv2_current_sprite.CMDYB); + q[2].x = x2s(stv2_current_sprite.CMDXA); + q[2].y = y2s(stv2_current_sprite.CMDYA); + q[3].x = x2s(stv2_current_sprite.CMDXB); + q[3].y = y2s(stv2_current_sprite.CMDYB); q[0].u = q[3].u = q[1].u = q[2].u = 0; q[0].v = q[1].v = q[2].v = q[3].v = 0; - vdp1_fill_quad(machine, cliprect, 0, 1, q); + vdp1_fill_quad(cliprect, 0, 1, q); } -static void stv_vdp1_draw_poly_line(running_machine &machine, const rectangle &cliprect) +void saturn_state::stv_vdp1_draw_poly_line(const rectangle &cliprect) { struct spoint q[4]; - q[0].x = x2s(machine, stv2_current_sprite.CMDXA); - q[0].y = y2s(machine, stv2_current_sprite.CMDYA); - q[1].x = x2s(machine, stv2_current_sprite.CMDXB); - q[1].y = y2s(machine, stv2_current_sprite.CMDYB); - q[2].x = x2s(machine, stv2_current_sprite.CMDXA); - q[2].y = y2s(machine, stv2_current_sprite.CMDYA); - q[3].x = x2s(machine, stv2_current_sprite.CMDXB); - q[3].y = y2s(machine, stv2_current_sprite.CMDYB); + q[0].x = x2s(stv2_current_sprite.CMDXA); + q[0].y = y2s(stv2_current_sprite.CMDYA); + q[1].x = x2s(stv2_current_sprite.CMDXB); + q[1].y = y2s(stv2_current_sprite.CMDYB); + q[2].x = x2s(stv2_current_sprite.CMDXA); + q[2].y = y2s(stv2_current_sprite.CMDYA); + q[3].x = x2s(stv2_current_sprite.CMDXB); + q[3].y = y2s(stv2_current_sprite.CMDYB); q[0].u = q[3].u = q[1].u = q[2].u = 0; q[0].v = q[1].v = q[2].v = q[3].v = 0; - vdp1_fill_quad(machine, cliprect, 0, 1, q); + vdp1_fill_quad(cliprect, 0, 1, q); - q[0].x = x2s(machine, stv2_current_sprite.CMDXB); - q[0].y = y2s(machine, stv2_current_sprite.CMDYB); - q[1].x = x2s(machine, stv2_current_sprite.CMDXC); - q[1].y = y2s(machine, stv2_current_sprite.CMDYC); - q[2].x = x2s(machine, stv2_current_sprite.CMDXB); - q[2].y = y2s(machine, stv2_current_sprite.CMDYB); - q[3].x = x2s(machine, stv2_current_sprite.CMDXC); - q[3].y = y2s(machine, stv2_current_sprite.CMDYC); + q[0].x = x2s(stv2_current_sprite.CMDXB); + q[0].y = y2s(stv2_current_sprite.CMDYB); + q[1].x = x2s(stv2_current_sprite.CMDXC); + q[1].y = y2s(stv2_current_sprite.CMDYC); + q[2].x = x2s(stv2_current_sprite.CMDXB); + q[2].y = y2s(stv2_current_sprite.CMDYB); + q[3].x = x2s(stv2_current_sprite.CMDXC); + q[3].y = y2s(stv2_current_sprite.CMDYC); q[0].u = q[3].u = q[1].u = q[2].u = 0; q[0].v = q[1].v = q[2].v = q[3].v = 0; - vdp1_fill_quad(machine, cliprect, 0, 1, q); + vdp1_fill_quad(cliprect, 0, 1, q); - q[0].x = x2s(machine, stv2_current_sprite.CMDXC); - q[0].y = y2s(machine, stv2_current_sprite.CMDYC); - q[1].x = x2s(machine, stv2_current_sprite.CMDXD); - q[1].y = y2s(machine, stv2_current_sprite.CMDYD); - q[2].x = x2s(machine, stv2_current_sprite.CMDXC); - q[2].y = y2s(machine, stv2_current_sprite.CMDYC); - q[3].x = x2s(machine, stv2_current_sprite.CMDXD); - q[3].y = y2s(machine, stv2_current_sprite.CMDYD); + q[0].x = x2s(stv2_current_sprite.CMDXC); + q[0].y = y2s(stv2_current_sprite.CMDYC); + q[1].x = x2s(stv2_current_sprite.CMDXD); + q[1].y = y2s(stv2_current_sprite.CMDYD); + q[2].x = x2s(stv2_current_sprite.CMDXC); + q[2].y = y2s(stv2_current_sprite.CMDYC); + q[3].x = x2s(stv2_current_sprite.CMDXD); + q[3].y = y2s(stv2_current_sprite.CMDYD); q[0].u = q[3].u = q[1].u = q[2].u = 0; q[0].v = q[1].v = q[2].v = q[3].v = 0; - vdp1_fill_quad(machine, cliprect, 0, 1, q); + vdp1_fill_quad(cliprect, 0, 1, q); - q[0].x = x2s(machine, stv2_current_sprite.CMDXD); - q[0].y = y2s(machine, stv2_current_sprite.CMDYD); - q[1].x = x2s(machine, stv2_current_sprite.CMDXA); - q[1].y = y2s(machine, stv2_current_sprite.CMDYA); - q[2].x = x2s(machine, stv2_current_sprite.CMDXD); - q[2].y = y2s(machine, stv2_current_sprite.CMDYD); - q[3].x = x2s(machine, stv2_current_sprite.CMDXA); - q[3].y = y2s(machine, stv2_current_sprite.CMDYA); + q[0].x = x2s(stv2_current_sprite.CMDXD); + q[0].y = y2s(stv2_current_sprite.CMDYD); + q[1].x = x2s(stv2_current_sprite.CMDXA); + q[1].y = y2s(stv2_current_sprite.CMDYA); + q[2].x = x2s(stv2_current_sprite.CMDXD); + q[2].y = y2s(stv2_current_sprite.CMDYD); + q[3].x = x2s(stv2_current_sprite.CMDXA); + q[3].y = y2s(stv2_current_sprite.CMDYA); q[0].u = q[3].u = q[1].u = q[2].u = 0; q[0].v = q[1].v = q[2].v = q[3].v = 0; - stv_vdp1_setup_shading(machine, q, cliprect); - vdp1_fill_quad(machine, cliprect, 0, 1, q); + stv_vdp1_setup_shading(q, cliprect); + vdp1_fill_quad(cliprect, 0, 1, q); } -static void stv_vpd1_draw_distorted_sprite(running_machine &machine, const rectangle &cliprect) +void saturn_state::stv_vdp1_draw_distorted_sprite(const rectangle &cliprect) { struct spoint q[4]; @@ -1540,14 +1520,14 @@ static void stv_vpd1_draw_distorted_sprite(running_machine &machine, const recta } - q[0].x = x2s(machine, stv2_current_sprite.CMDXA); - q[0].y = y2s(machine, stv2_current_sprite.CMDYA); - q[1].x = x2s(machine, stv2_current_sprite.CMDXB); - q[1].y = y2s(machine, stv2_current_sprite.CMDYB); - q[2].x = x2s(machine, stv2_current_sprite.CMDXC); - q[2].y = y2s(machine, stv2_current_sprite.CMDYC); - q[3].x = x2s(machine, stv2_current_sprite.CMDXD); - q[3].y = y2s(machine, stv2_current_sprite.CMDYD); + q[0].x = x2s(stv2_current_sprite.CMDXA); + q[0].y = y2s(stv2_current_sprite.CMDYA); + q[1].x = x2s(stv2_current_sprite.CMDXB); + q[1].y = y2s(stv2_current_sprite.CMDYB); + q[2].x = x2s(stv2_current_sprite.CMDXC); + q[2].y = y2s(stv2_current_sprite.CMDYC); + q[3].x = x2s(stv2_current_sprite.CMDXD); + q[3].y = y2s(stv2_current_sprite.CMDYD); if(direction & 1) { // xflip q[0].u = q[3].u = xsize-1; @@ -1564,11 +1544,11 @@ static void stv_vpd1_draw_distorted_sprite(running_machine &machine, const recta q[2].v = q[3].v = ysize-1; } - stv_vdp1_setup_shading(machine, q, cliprect); - vdp1_fill_quad(machine, cliprect, patterndata, xsize, q); + stv_vdp1_setup_shading(q, cliprect); + vdp1_fill_quad(cliprect, patterndata, xsize, q); } -static void stv_vpd1_draw_scaled_sprite(running_machine &machine, const rectangle &cliprect) +void saturn_state::stv_vdp1_draw_scaled_sprite(const rectangle &cliprect) { struct spoint q[4]; @@ -1666,14 +1646,14 @@ static void stv_vpd1_draw_scaled_sprite(running_machine &machine, const rectangl if (zoompoint) { - q[0].x = x2s(machine, x); - q[0].y = y2s(machine, y); - q[1].x = x2s(machine, x)+screen_width; - q[1].y = y2s(machine, y); - q[2].x = x2s(machine, x)+screen_width; - q[2].y = y2s(machine, y)+screen_height; - q[3].x = x2s(machine, x); - q[3].y = y2s(machine, y)+screen_height; + q[0].x = x2s(x); + q[0].y = y2s(y); + q[1].x = x2s(x)+screen_width; + q[1].y = y2s(y); + q[2].x = x2s(x)+screen_width; + q[2].y = y2s(y)+screen_height; + q[3].x = x2s(x); + q[3].y = y2s(y)+screen_height; if ( screen_height_negative ) { @@ -1685,14 +1665,14 @@ static void stv_vpd1_draw_scaled_sprite(running_machine &machine, const rectangl } else { - q[0].x = x2s(machine, x); - q[0].y = y2s(machine, y); - q[1].x = x2s(machine, x2); - q[1].y = y2s(machine, y); - q[2].x = x2s(machine, x2); - q[2].y = y2s(machine, y2); - q[3].x = x2s(machine, x); - q[3].y = y2s(machine, y2); + q[0].x = x2s(x); + q[0].y = y2s(y); + q[1].x = x2s(x2); + q[1].y = y2s(y); + q[2].x = x2s(x2); + q[2].y = y2s(y2); + q[3].x = x2s(x); + q[3].y = y2s(y2); } @@ -1711,12 +1691,12 @@ static void stv_vpd1_draw_scaled_sprite(running_machine &machine, const rectangl q[2].v = q[3].v = ysize-1; } - stv_vdp1_setup_shading(machine, q, cliprect); - vdp1_fill_quad(machine, cliprect, patterndata, xsize, q); + stv_vdp1_setup_shading(q, cliprect); + vdp1_fill_quad(cliprect, patterndata, xsize, q); } -static void stv_vpd1_draw_normal_sprite(running_machine &machine, const rectangle &cliprect, int sprite_type) +void saturn_state::stv_vdp1_draw_normal_sprite(const rectangle &cliprect, int sprite_type) { //UINT16 *destline; //saturn_state *state = machine.driver_data(); @@ -1728,8 +1708,8 @@ static void stv_vpd1_draw_normal_sprite(running_machine &machine, const rectangl int su, u, dux, duy; int maxdrawypos, maxdrawxpos; - x = x2s(machine, stv2_current_sprite.CMDXA); - y = y2s(machine, stv2_current_sprite.CMDYA); + x = x2s(stv2_current_sprite.CMDXA); + y = y2s(stv2_current_sprite.CMDYA); direction = (stv2_current_sprite.CMDCTRL & 0x0030)>>4; @@ -1746,7 +1726,7 @@ static void stv_vpd1_draw_normal_sprite(running_machine &machine, const rectangl if ( x > cliprect.max_x ) return; if ( y > cliprect.max_y ) return; - shading = stv_read_gouraud_table(machine); + shading = stv_read_gouraud_table(); if ( shading ) { struct spoint q[4]; @@ -1755,7 +1735,7 @@ static void stv_vpd1_draw_normal_sprite(running_machine &machine, const rectangl q[2].x = x + xsize; q[2].y = y + ysize; q[3].x = x; q[3].y = y + ysize; - stv_vdp1_setup_shading( machine, q, cliprect ); + stv_vdp1_setup_shading( q, cliprect ); } u = 0; @@ -1787,20 +1767,19 @@ static void stv_vpd1_draw_normal_sprite(running_machine &machine, const rectangl maxdrawxpos = MIN(x+xsize-1,cliprect.max_x); for (drawypos = y; drawypos <= maxdrawypos; drawypos++ ) { - //destline = state->m_vdp1.framebuffer_draw_lines[drawypos]; + //destline = m_vdp1.framebuffer_draw_lines[drawypos]; su = u; for (drawxpos = x; drawxpos <= maxdrawxpos; drawxpos++ ) { - drawpixel( machine, drawxpos, drawypos, patterndata, u ); + drawpixel( machine(), drawxpos, drawypos, patterndata, u ); u += dux; } u = su + duy; } } -static void stv_vdp1_process_list(running_machine &machine) +void saturn_state::stv_vdp1_process_list( void ) { - saturn_state *state = machine.driver_data(); int position; int spritecount; int vdp1_nest; @@ -1830,7 +1809,7 @@ static void stv_vdp1_process_list(running_machine &machine) // position = 0; // } - stv2_current_sprite.CMDCTRL = (state->m_vdp1_vram[position * (0x20/4)+0] & 0xffff0000) >> 16; + stv2_current_sprite.CMDCTRL = (m_vdp1_vram[position * (0x20/4)+0] & 0xffff0000) >> 16; if (stv2_current_sprite.CMDCTRL == 0x8000) { @@ -1838,21 +1817,21 @@ static void stv_vdp1_process_list(running_machine &machine) goto end; // end of list } - stv2_current_sprite.CMDLINK = (state->m_vdp1_vram[position * (0x20/4)+0] & 0x0000ffff) >> 0; - stv2_current_sprite.CMDPMOD = (state->m_vdp1_vram[position * (0x20/4)+1] & 0xffff0000) >> 16; - stv2_current_sprite.CMDCOLR = (state->m_vdp1_vram[position * (0x20/4)+1] & 0x0000ffff) >> 0; - stv2_current_sprite.CMDSRCA = (state->m_vdp1_vram[position * (0x20/4)+2] & 0xffff0000) >> 16; - stv2_current_sprite.CMDSIZE = (state->m_vdp1_vram[position * (0x20/4)+2] & 0x0000ffff) >> 0; - stv2_current_sprite.CMDXA = (state->m_vdp1_vram[position * (0x20/4)+3] & 0xffff0000) >> 16; - stv2_current_sprite.CMDYA = (state->m_vdp1_vram[position * (0x20/4)+3] & 0x0000ffff) >> 0; - stv2_current_sprite.CMDXB = (state->m_vdp1_vram[position * (0x20/4)+4] & 0xffff0000) >> 16; - stv2_current_sprite.CMDYB = (state->m_vdp1_vram[position * (0x20/4)+4] & 0x0000ffff) >> 0; - stv2_current_sprite.CMDXC = (state->m_vdp1_vram[position * (0x20/4)+5] & 0xffff0000) >> 16; - stv2_current_sprite.CMDYC = (state->m_vdp1_vram[position * (0x20/4)+5] & 0x0000ffff) >> 0; - stv2_current_sprite.CMDXD = (state->m_vdp1_vram[position * (0x20/4)+6] & 0xffff0000) >> 16; - stv2_current_sprite.CMDYD = (state->m_vdp1_vram[position * (0x20/4)+6] & 0x0000ffff) >> 0; - stv2_current_sprite.CMDGRDA = (state->m_vdp1_vram[position * (0x20/4)+7] & 0xffff0000) >> 16; -// stv2_current_sprite.UNUSED = (state->m_vdp1_vram[position * (0x20/4)+7] & 0x0000ffff) >> 0; + stv2_current_sprite.CMDLINK = (m_vdp1_vram[position * (0x20/4)+0] & 0x0000ffff) >> 0; + stv2_current_sprite.CMDPMOD = (m_vdp1_vram[position * (0x20/4)+1] & 0xffff0000) >> 16; + stv2_current_sprite.CMDCOLR = (m_vdp1_vram[position * (0x20/4)+1] & 0x0000ffff) >> 0; + stv2_current_sprite.CMDSRCA = (m_vdp1_vram[position * (0x20/4)+2] & 0xffff0000) >> 16; + stv2_current_sprite.CMDSIZE = (m_vdp1_vram[position * (0x20/4)+2] & 0x0000ffff) >> 0; + stv2_current_sprite.CMDXA = (m_vdp1_vram[position * (0x20/4)+3] & 0xffff0000) >> 16; + stv2_current_sprite.CMDYA = (m_vdp1_vram[position * (0x20/4)+3] & 0x0000ffff) >> 0; + stv2_current_sprite.CMDXB = (m_vdp1_vram[position * (0x20/4)+4] & 0xffff0000) >> 16; + stv2_current_sprite.CMDYB = (m_vdp1_vram[position * (0x20/4)+4] & 0x0000ffff) >> 0; + stv2_current_sprite.CMDXC = (m_vdp1_vram[position * (0x20/4)+5] & 0xffff0000) >> 16; + stv2_current_sprite.CMDYC = (m_vdp1_vram[position * (0x20/4)+5] & 0x0000ffff) >> 0; + stv2_current_sprite.CMDXD = (m_vdp1_vram[position * (0x20/4)+6] & 0xffff0000) >> 16; + stv2_current_sprite.CMDYD = (m_vdp1_vram[position * (0x20/4)+6] & 0x0000ffff) >> 0; + stv2_current_sprite.CMDGRDA = (m_vdp1_vram[position * (0x20/4)+7] & 0xffff0000) >> 16; +// stv2_current_sprite.UNUSED = (m_vdp1_vram[position * (0x20/4)+7] & 0x0000ffff) >> 0; /* proecess jump / skip commands, set position for next sprite */ switch (stv2_current_sprite.CMDCTRL & 0x7000) @@ -1941,29 +1920,29 @@ static void stv_vdp1_process_list(running_machine &machine) if ( stv2_current_sprite.CMDPMOD & 0x0400 ) { //if(stv2_current_sprite.CMDPMOD & 0x0200) /* TODO: Bio Hazard inventory screen uses outside cliprect */ - // cliprect = &state->m_vdp1.system_cliprect; + // cliprect = &m_vdp1.system_cliprect; //else - cliprect = &state->m_vdp1.user_cliprect; + cliprect = &m_vdp1.user_cliprect; } else { - cliprect = &state->m_vdp1.system_cliprect; + cliprect = &m_vdp1.system_cliprect; } - stv_vdp1_set_drawpixel(machine); + stv_vdp1_set_drawpixel(); switch (stv2_current_sprite.CMDCTRL & 0x000f) { case 0x0000: if (VDP1_LOG) logerror ("Sprite List Normal Sprite (%d %d)\n",stv2_current_sprite.CMDXA,stv2_current_sprite.CMDYA); stv2_current_sprite.ispoly = 0; - stv_vpd1_draw_normal_sprite(machine, *cliprect, 0); + stv_vdp1_draw_normal_sprite(*cliprect, 0); break; case 0x0001: if (VDP1_LOG) logerror ("Sprite List Scaled Sprite (%d %d)\n",stv2_current_sprite.CMDXA,stv2_current_sprite.CMDYA); stv2_current_sprite.ispoly = 0; - stv_vpd1_draw_scaled_sprite(machine, *cliprect); + stv_vdp1_draw_scaled_sprite(*cliprect); break; case 0x0002: @@ -1976,49 +1955,49 @@ static void stv_vdp1_process_list(running_machine &machine) if (VDP1_LOG) logerror ("CMDPMOD = %04x\n",stv2_current_sprite.CMDPMOD); stv2_current_sprite.ispoly = 0; - stv_vpd1_draw_distorted_sprite(machine, *cliprect); + stv_vdp1_draw_distorted_sprite(*cliprect); break; case 0x0004: if (VDP1_LOG) logerror ("Sprite List Polygon\n"); stv2_current_sprite.ispoly = 1; - stv_vpd1_draw_distorted_sprite(machine, *cliprect); + stv_vdp1_draw_distorted_sprite(*cliprect); break; case 0x0005: // case 0x0007: // mirror? Baroque uses it, crashes for whatever reason if (VDP1_LOG) logerror ("Sprite List Polyline\n"); stv2_current_sprite.ispoly = 1; - stv_vdp1_draw_poly_line(machine, *cliprect); + stv_vdp1_draw_poly_line(*cliprect); break; case 0x0006: if (VDP1_LOG) logerror ("Sprite List Line\n"); stv2_current_sprite.ispoly = 1; - stv_vdp1_draw_line(machine, *cliprect); + stv_vdp1_draw_line(*cliprect); break; case 0x0008: // case 0x000b: // mirror? Bug 2 if (VDP1_LOG) logerror ("Sprite List Set Command for User Clipping (%d,%d),(%d,%d)\n", stv2_current_sprite.CMDXA, stv2_current_sprite.CMDYA, stv2_current_sprite.CMDXC, stv2_current_sprite.CMDYC); - state->m_vdp1.user_cliprect.set(stv2_current_sprite.CMDXA, stv2_current_sprite.CMDXC, stv2_current_sprite.CMDYA, stv2_current_sprite.CMDYC); + m_vdp1.user_cliprect.set(stv2_current_sprite.CMDXA, stv2_current_sprite.CMDXC, stv2_current_sprite.CMDYA, stv2_current_sprite.CMDYC); break; case 0x0009: if (VDP1_LOG) logerror ("Sprite List Set Command for System Clipping (0,0),(%d,%d)\n", stv2_current_sprite.CMDXC, stv2_current_sprite.CMDYC); - state->m_vdp1.system_cliprect.set(0, stv2_current_sprite.CMDXC, 0, stv2_current_sprite.CMDYC); + m_vdp1.system_cliprect.set(0, stv2_current_sprite.CMDXC, 0, stv2_current_sprite.CMDYC); break; case 0x000a: if (VDP1_LOG) logerror ("Sprite List Local Co-Ordinate Set (%d %d)\n",(INT16)stv2_current_sprite.CMDXA,(INT16)stv2_current_sprite.CMDYA); - state->m_vdp1.local_x = (INT16)stv2_current_sprite.CMDXA; - state->m_vdp1.local_y = (INT16)stv2_current_sprite.CMDYA; + m_vdp1.local_x = (INT16)stv2_current_sprite.CMDXA; + m_vdp1.local_y = (INT16)stv2_current_sprite.CMDYA; break; default: popmessage ("VDP1: Sprite List Illegal %02x, contact MAMEdev",stv2_current_sprite.CMDCTRL & 0xf); - state->m_vdp1.lopr = (position * 0x20) >> 3; - state->m_vdp1.copr = (position * 0x20) >> 3; + m_vdp1.lopr = (position * 0x20) >> 3; + m_vdp1.copr = (position * 0x20) >> 3; return; } } @@ -2031,14 +2010,13 @@ static void stv_vdp1_process_list(running_machine &machine) end: /* set CEF to 1*/ CEF_1; - state->m_vdp1.copr = (position * 0x20) >> 3; + m_vdp1.copr = (position * 0x20) >> 3; if (VDP1_LOG) logerror ("End of list processing!\n"); } -void video_update_vdp1(running_machine &machine) +void saturn_state::video_update_vdp1( void ) { - saturn_state *state = machine.driver_data(); int framebuffer_changed = 0; // int enable; @@ -2057,45 +2035,45 @@ void video_update_vdp1(running_machine &machine) // } // } if (VDP1_LOG) logerror("video_update_vdp1 called\n"); - if (VDP1_LOG) logerror( "FBCR = %0x, accessed = %d\n", STV_VDP1_FBCR, state->m_vdp1.fbcr_accessed ); + if (VDP1_LOG) logerror( "FBCR = %0x, accessed = %d\n", STV_VDP1_FBCR, m_vdp1.fbcr_accessed ); if(STV_VDP1_CEF) BEF_1; else BEF_0; - if ( state->m_vdp1.framebuffer_clear_on_next_frame ) + if ( m_vdp1.framebuffer_clear_on_next_frame ) { if ( ((STV_VDP1_FBCR & 0x3) == 3) && - state->m_vdp1.fbcr_accessed ) + m_vdp1.fbcr_accessed ) { - stv_clear_framebuffer(machine, state->m_vdp1.framebuffer_current_display); - state->m_vdp1.framebuffer_clear_on_next_frame = 0; + stv_clear_framebuffer(m_vdp1.framebuffer_current_display); + m_vdp1.framebuffer_clear_on_next_frame = 0; } } switch( STV_VDP1_FBCR & 0x3 ) { case 0: /* Automatic mode */ - stv_vdp1_change_framebuffers(machine); - stv_clear_framebuffer(machine, state->m_vdp1.framebuffer_current_draw); + stv_vdp1_change_framebuffers(); + stv_clear_framebuffer(m_vdp1.framebuffer_current_draw); framebuffer_changed = 1; break; case 1: /* Setting prohibited */ break; case 2: /* Manual mode - erase */ - if ( state->m_vdp1.fbcr_accessed ) + if ( m_vdp1.fbcr_accessed ) { - state->m_vdp1.framebuffer_clear_on_next_frame = 1; + m_vdp1.framebuffer_clear_on_next_frame = 1; } break; case 3: /* Manual mode - change */ - if ( state->m_vdp1.fbcr_accessed ) + if ( m_vdp1.fbcr_accessed ) { - stv_vdp1_change_framebuffers(machine); + stv_vdp1_change_framebuffers(); if ( STV_VDP1_VBE ) { - stv_clear_framebuffer(machine, state->m_vdp1.framebuffer_current_draw); + stv_clear_framebuffer(m_vdp1.framebuffer_current_draw); } /* TODO: Slam n Jam 96 & Cross Romance doesn't like this, investigate. */ // framebuffer_changed = 1; @@ -2103,7 +2081,7 @@ void video_update_vdp1(running_machine &machine) framebuffer_changed = 1; break; } - state->m_vdp1.fbcr_accessed = 0; + m_vdp1.fbcr_accessed = 0; if (VDP1_LOG) logerror( "PTM = %0x, TVM = %x\n", STV_VDP1_PTM, STV_VDP1_TVM ); switch(STV_VDP1_PTM & 3) @@ -2116,7 +2094,7 @@ void video_update_vdp1(running_machine &machine) if ( framebuffer_changed || VDP1_LOG ) { /*set CEF to 1*/ - stv_vdp1_process_list(machine); + stv_vdp1_process_list(); } break; case 3: /**/ @@ -2126,21 +2104,20 @@ void video_update_vdp1(running_machine &machine) //popmessage("%04x %04x",STV_VDP1_EWRR_X3,STV_VDP1_EWRR_Y3); } -static void stv_vdp1_state_save_postload(running_machine &machine) +void saturn_state::stv_vdp1_state_save_postload( void ) { - saturn_state *state = machine.driver_data(); - UINT8 *vdp1 = state->m_vdp1.gfx_decode; + UINT8 *vdp1 = m_vdp1.gfx_decode; int offset; UINT32 data; - state->m_vdp1.framebuffer_mode = -1; - state->m_vdp1.framebuffer_double_interlace = -1; + m_vdp1.framebuffer_mode = -1; + m_vdp1.framebuffer_double_interlace = -1; - stv_set_framebuffer_config(machine); + stv_set_framebuffer_config(); for (offset = 0; offset < 0x80000/4; offset++ ) { - data = state->m_vdp1_vram[offset]; + data = m_vdp1_vram[offset]; /* put in gfx region for easy decoding */ vdp1[offset*4+0] = (data & 0xff000000) >> 24; vdp1[offset*4+1] = (data & 0x00ff0000) >> 16; @@ -2149,43 +2126,42 @@ static void stv_vdp1_state_save_postload(running_machine &machine) } } -int stv_vdp1_start ( running_machine &machine ) +int saturn_state::stv_vdp1_start ( void ) { - saturn_state *state = machine.driver_data(); - state->m_vdp1_regs = auto_alloc_array_clear(machine, UINT16, 0x020/2 ); - state->m_vdp1_vram = auto_alloc_array_clear(machine, UINT32, 0x100000/4 ); - state->m_vdp1.gfx_decode = auto_alloc_array(machine, UINT8, 0x100000 ); + m_vdp1_regs = auto_alloc_array_clear(machine(), UINT16, 0x020/2 ); + m_vdp1_vram = auto_alloc_array_clear(machine(), UINT32, 0x100000/4 ); + m_vdp1.gfx_decode = auto_alloc_array(machine(), UINT8, 0x100000 ); - stv_vdp1_shading_data = auto_alloc(machine, struct stv_vdp1_poly_scanline_data); + stv_vdp1_shading_data = auto_alloc(machine(), struct stv_vdp1_poly_scanline_data); - state->m_vdp1.framebuffer[0] = auto_alloc_array(machine, UINT16, 1024 * 256 * 2 ); /* *2 is for double interlace */ - state->m_vdp1.framebuffer[1] = auto_alloc_array(machine, UINT16, 1024 * 256 * 2 ); + m_vdp1.framebuffer[0] = auto_alloc_array(machine(), UINT16, 1024 * 256 * 2 ); /* *2 is for double interlace */ + m_vdp1.framebuffer[1] = auto_alloc_array(machine(), UINT16, 1024 * 256 * 2 ); - state->m_vdp1.framebuffer_display_lines = auto_alloc_array(machine, UINT16 *, 512); - state->m_vdp1.framebuffer_draw_lines = auto_alloc_array(machine, UINT16 *, 512); + m_vdp1.framebuffer_display_lines = auto_alloc_array(machine(), UINT16 *, 512); + m_vdp1.framebuffer_draw_lines = auto_alloc_array(machine(), UINT16 *, 512); - state->m_vdp1.framebuffer_width = state->m_vdp1.framebuffer_height = 0; - state->m_vdp1.framebuffer_mode = -1; - state->m_vdp1.framebuffer_double_interlace = -1; - state->m_vdp1.fbcr_accessed = 0; - state->m_vdp1.framebuffer_current_display = 0; - state->m_vdp1.framebuffer_current_draw = 1; - stv_clear_framebuffer(machine, state->m_vdp1.framebuffer_current_draw); - state->m_vdp1.framebuffer_clear_on_next_frame = 0; + m_vdp1.framebuffer_width = m_vdp1.framebuffer_height = 0; + m_vdp1.framebuffer_mode = -1; + m_vdp1.framebuffer_double_interlace = -1; + m_vdp1.fbcr_accessed = 0; + m_vdp1.framebuffer_current_display = 0; + m_vdp1.framebuffer_current_draw = 1; + stv_clear_framebuffer(m_vdp1.framebuffer_current_draw); + m_vdp1.framebuffer_clear_on_next_frame = 0; - state->m_vdp1.system_cliprect.set(0, 0, 0, 0); + m_vdp1.system_cliprect.set(0, 0, 0, 0); /* Kidou Senshi Z Gundam - Zenpen Zeta no Kodou loves to use the user cliprect vars in an undefined state ... */ - state->m_vdp1.user_cliprect.set(0, 512, 0, 256); + m_vdp1.user_cliprect.set(0, 512, 0, 256); // save state - state_save_register_global_pointer(machine, state->m_vdp1_regs, 0x020/2); - state_save_register_global_pointer(machine, state->m_vdp1_vram, 0x100000/4); - state_save_register_global(machine, state->m_vdp1.fbcr_accessed); - state_save_register_global(machine, state->m_vdp1.framebuffer_current_display); - state_save_register_global(machine, state->m_vdp1.framebuffer_current_draw); - state_save_register_global(machine, state->m_vdp1.framebuffer_clear_on_next_frame); - state_save_register_global(machine, state->m_vdp1.local_x); - state_save_register_global(machine, state->m_vdp1.local_y); - machine.save().register_postload(save_prepost_delegate(FUNC(stv_vdp1_state_save_postload), &machine)); + state_save_register_global_pointer(machine(), m_vdp1_regs, 0x020/2); + state_save_register_global_pointer(machine(), m_vdp1_vram, 0x100000/4); + state_save_register_global(machine(), m_vdp1.fbcr_accessed); + state_save_register_global(machine(), m_vdp1.framebuffer_current_display); + state_save_register_global(machine(), m_vdp1.framebuffer_current_draw); + state_save_register_global(machine(), m_vdp1.framebuffer_clear_on_next_frame); + state_save_register_global(machine(), m_vdp1.local_x); + state_save_register_global(machine(), m_vdp1.local_y); + machine().save().register_postload(save_prepost_delegate(FUNC(saturn_state::stv_vdp1_state_save_postload), this)); return 0; } diff --git a/src/mame/video/stvvdp2.c b/src/mame/video/stvvdp2.c index 6836e21f261..33856311a1c 100644 --- a/src/mame/video/stvvdp2.c +++ b/src/mame/video/stvvdp2.c @@ -104,19 +104,6 @@ In other words,the first three types uses the offset and not the color allocated #include "emu.h" #include "includes/stv.h" -static UINT8 get_vblank(running_machine &machine); -static UINT8 get_hblank(running_machine &machine); -static int get_vblank_duration(running_machine &machine); -static int get_hblank_duration(running_machine &machine); -static int get_pixel_clock(running_machine &machine); -static UINT8 get_odd_bit(running_machine &machine); - -static void refresh_palette_data(running_machine &machine); -static int stv_vdp2_window_process(running_machine &machine,int x,int y); -static int stv_vdp2_apply_window_on_layer(running_machine &machine,rectangle &cliprect); -static void stv_vdp2_get_window0_coordinates(running_machine &machine,UINT16 *s_x, UINT16 *e_x, UINT16 *s_y, UINT16 *e_y); -static void stv_vdp2_check_tilemap(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect); - enum { STV_TRANSPARENCY_NONE, @@ -182,7 +169,7 @@ enum | LSMD1 | LSMD0 | VRESO1 | VRESO0 | -- | HRESO2 | HRESO1 | HRESO0 | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_TVMD (state->m_vdp2_regs[0x000/2]) + #define STV_VDP2_TVMD (m_vdp2_regs[0x000/2]) #define STV_VDP2_DISP ((STV_VDP2_TVMD & 0x8000) >> 15) #define STV_VDP2_BDCLMD ((STV_VDP2_TVMD & 0x0100) >> 8) @@ -197,7 +184,7 @@ enum | -- | -- | -- | -- | -- | -- | DASEL | EXBGEN | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_EXTEN (state->m_vdp2_regs[0x002/2]) + #define STV_VDP2_EXTEN (m_vdp2_regs[0x002/2]) #define STV_VDP2_EXLTEN ((STV_VDP2_EXTEN & 0x0200) >> 9) @@ -215,7 +202,7 @@ enum | -- | -- | -- | -- | VER3 | VER2 | VER1 | VER0 | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_VRSIZE (state->m_vdp2_regs[0x006/2]) + #define STV_VDP2_VRSIZE (m_vdp2_regs[0x006/2]) #define STV_VDP2_VRAMSZ ((STV_VDP2_VRSIZE & 0x8000) >> 15) @@ -226,7 +213,7 @@ enum | HCT7 | HCT6 | HCT5 | HCT4 | HCT3 | HCT2 | HCT1 | HCT0 | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_HCNT (state->m_vdp2_regs[0x008/2]) + #define STV_VDP2_HCNT (m_vdp2_regs[0x008/2]) /* 18000A - r/o - VCNT - V-Counter bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\ @@ -235,7 +222,7 @@ enum | VCT7 | VCT6 | VCT5 | VCT4 | VCT3 | VCT2 | VCT1 | VCT0 | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_VCNT (state->m_vdp2_regs[0x00a/2]) + #define STV_VDP2_VCNT (m_vdp2_regs[0x00a/2]) /* 18000C - RESERVED bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\ @@ -251,7 +238,7 @@ enum | RDBSB11 | RDBSB10 | RDBSB01 | RDBSB00 | RDBSA11 | RDBSA10 | RDBSA01 | RDBSA00 | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_RAMCTL (state->m_vdp2_regs[0x00e/2]) + #define STV_VDP2_RAMCTL (m_vdp2_regs[0x00e/2]) #define STV_VDP2_CRKTE ((STV_VDP2_RAMCTL & 0x8000) >> 15) #define STV_VDP2_CRMD ((STV_VDP2_RAMCTL & 0x3000) >> 12) @@ -268,7 +255,7 @@ enum | VCP2A03 | VCP2A02 | VCP2A01 | VCP2A00 | VCP3A03 | VCP3A02 | VCP3A01 | VCP3A00 | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_CYCA0L (state->m_vdp2_regs[0x010/2]) + #define STV_VDP2_CYCA0L (m_vdp2_regs[0x010/2]) /* 180012 - r/w - -CYCA0U - VRAM CYCLE PATTERN (BANK A0) bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\ @@ -277,7 +264,7 @@ enum | VCP6A03 | VCP6A02 | VCP6A01 | VCP6A00 | VCP7A03 | VCP7A02 | VCP7A01 | VCP7A00 | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_CYCA0U (state->m_vdp2_regs[0x012/2]) + #define STV_VDP2_CYCA0U (m_vdp2_regs[0x012/2]) /* 180014 - r/w - -CYCA1L - VRAM CYCLE PATTERN (BANK A1) bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\ @@ -286,7 +273,7 @@ enum | VCP2A13 | VCP2A12 | VCP2A11 | VCP2A10 | VCP3A13 | VCP3A12 | VCP3A11 | VCP3A10 | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_CYCA1L (state->m_vdp2_regs[0x014/2]) + #define STV_VDP2_CYCA1L (m_vdp2_regs[0x014/2]) /* 180016 - r/w - -CYCA1U - VRAM CYCLE PATTERN (BANK A1) bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\ @@ -295,7 +282,7 @@ enum | VCP6A13 | VCP6A12 | VCP6A11 | VCP6A10 | VCP7A13 | VCP7A12 | VCP7A11 | VCP7A10 | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_CYCA1U (state->m_vdp2_regs[0x016/2]) + #define STV_VDP2_CYCA1U (m_vdp2_regs[0x016/2]) /* 180018 - r/w - -CYCB0L - VRAM CYCLE PATTERN (BANK B0) bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\ @@ -304,7 +291,7 @@ enum | VCP2B03 | VCP2B02 | VCP2B01 | VCP2B00 | VCP3B03 | VCP3B02 | VCP3B01 | VCP3B00 | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_CYCA2L (state->m_vdp2_regs[0x018/2]) + #define STV_VDP2_CYCA2L (m_vdp2_regs[0x018/2]) /* 18001A - r/w - -CYCB0U - VRAM CYCLE PATTERN (BANK B0) bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\ @@ -313,7 +300,7 @@ enum | VCP6B03 | VCP6B02 | VCP6B01 | VCP6B00 | VCP7B03 | VCP7B02 | VCP7B01 | VCP7B00 | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_CYCA2U (state->m_vdp2_regs[0x01a/2]) + #define STV_VDP2_CYCA2U (m_vdp2_regs[0x01a/2]) /* 18001C - r/w - -CYCB1L - VRAM CYCLE PATTERN (BANK B1) bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\ @@ -322,7 +309,7 @@ enum | VCP2B13 | VCP2B12 | VCP2B11 | VCP2B10 | VCP3B13 | VCP3B12 | VCP3B11 | VCP3B10 | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_CYCA3L (state->m_vdp2_regs[0x01c/2]) + #define STV_VDP2_CYCA3L (m_vdp2_regs[0x01c/2]) /* 18001E - r/w - -CYCB1U - VRAM CYCLE PATTERN (BANK B1) bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\ @@ -331,7 +318,7 @@ enum | VCP6B13 | VCP6B12 | VCP6B11 | VCP6B10 | VCP7B13 | VCP7B12 | VCP7B11 | VCP7B10 | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_CYCA3U (state->m_vdp2_regs[0x01e/2]) + #define STV_VDP2_CYCA3U (m_vdp2_regs[0x01e/2]) /* 180020 - r/w - BGON - SCREEN DISPLAY ENABLE @@ -343,7 +330,7 @@ enum | -- | -- | R1ON | R0ON | N3ON | N2ON | N1ON | N0ON | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_BGON (state->m_vdp2_regs[0x020/2]) + #define STV_VDP2_BGON (m_vdp2_regs[0x020/2]) // NxOn - Layer Enable Register #define STV_VDP2_xxON ((STV_VDP2_BGON & 0x001f) >> 0) /* to see if anything is enabled */ @@ -370,7 +357,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_MZCTL (state->m_vdp2_regs[0x022/2]) + #define STV_VDP2_MZCTL (m_vdp2_regs[0x022/2]) #define STV_VDP2_MZSZV ((STV_VDP2_MZCTL & 0xf000) >> 12) #define STV_VDP2_MZSZH ((STV_VDP2_MZCTL & 0x0f00) >> 8) @@ -384,13 +371,13 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 */ - #define STV_VDP2_SFSEL (state->m_vdp2_regs[0x024/2]) + #define STV_VDP2_SFSEL (m_vdp2_regs[0x024/2]) /*180026 - Special Function Code */ - #define STV_VDP2_SFCODE (state->m_vdp2_regs[0x026/2]) + #define STV_VDP2_SFCODE (m_vdp2_regs[0x026/2]) /* @@ -401,7 +388,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | N0CHCN2 | N0CHCN1 | N0CHCN0 | N0BMSZ1 | N0BMSZ0 | N0BMEN | N0CHSZ | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_CHCTLA (state->m_vdp2_regs[0x028/2]) + #define STV_VDP2_CHCTLA (m_vdp2_regs[0x028/2]) /* -------------------------- NBG0 Character Control Registers -------------------------- */ @@ -467,7 +454,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | N3CHCN | N3CHSZ | -- | -- | N2CHCN | N2CHSZ | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_CHCTLB (state->m_vdp2_regs[0x02a/2]) + #define STV_VDP2_CHCTLB (m_vdp2_regs[0x02a/2]) /* -------------------------- RBG0 Character Control Registers -------------------------- */ @@ -512,7 +499,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_BMPNA (state->m_vdp2_regs[0x02c/2]) + #define STV_VDP2_BMPNA (m_vdp2_regs[0x02c/2]) #define STV_VDP2_N1BMP ((STV_VDP2_BMPNA & 0x0700) >> 8) #define STV_VDP2_N0BMP ((STV_VDP2_BMPNA & 0x0007) >> 0) @@ -524,7 +511,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_BMPNB (state->m_vdp2_regs[0x02e/2]) + #define STV_VDP2_BMPNB (m_vdp2_regs[0x02e/2]) #define STV_VDP2_R0BMP ((STV_VDP2_BMPNB & 0x0007) >> 0) @@ -535,7 +522,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | N0SPLT6 | N0SPLT5 | N0SPLT4 | N0SPCN4 | N0SPCN3 | N0SPCN2 | N0SPCN1 | N0SPCN0 | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_PNCN0 (state->m_vdp2_regs[0x030/2]) + #define STV_VDP2_PNCN0 (m_vdp2_regs[0x030/2]) /* Pattern Data Size 0 = 2 bytes @@ -566,7 +553,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_PNCN1 (state->m_vdp2_regs[0x032/2]) + #define STV_VDP2_PNCN1 (m_vdp2_regs[0x032/2]) /* Pattern Data Size 0 = 2 bytes @@ -598,7 +585,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_PNCN2 (state->m_vdp2_regs[0x034/2]) + #define STV_VDP2_PNCN2 (m_vdp2_regs[0x034/2]) /* Pattern Data Size 0 = 2 bytes @@ -630,7 +617,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | N3SPLT6 | N3SPLT5 | N3SPLT4 | N3SPCN4 | N3SPCN3 | N3SPCN2 | N3SPCN1 | N3SPCN0 | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_PNCN3 (state->m_vdp2_regs[0x036/2]) + #define STV_VDP2_PNCN3 (m_vdp2_regs[0x036/2]) /* Pattern Data Size 0 = 2 bytes @@ -662,7 +649,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_PNCR (state->m_vdp2_regs[0x038/2]) + #define STV_VDP2_PNCR (m_vdp2_regs[0x038/2]) /* Pattern Data Size 0 = 2 bytes @@ -693,7 +680,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | N3PLSZ1 | N3PLSZ0 | -- | -- | N1PLSZ1 | N1PLSZ0 | N0PLSZ1 | N0PLSZ0 | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_PLSZ (state->m_vdp2_regs[0x03a/2]) + #define STV_VDP2_PLSZ (m_vdp2_regs[0x03a/2]) /* NBG0 Plane Size 00 1H Page x 1V Page @@ -716,7 +703,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | N1MP8 | N1MP7 | N1MP6 | -- | N0MP8 | N0MP7 | N0MP6 | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_MPOFN_ (state->m_vdp2_regs[0x03c/2]) + #define STV_VDP2_MPOFN_ (m_vdp2_regs[0x03c/2]) /* Higher 3 bits of the map offset for each layer */ #define STV_VDP2_N3MP_ ((STV_VDP2_MPOFN_ & 0x3000) >> 12) @@ -734,7 +721,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_MPOFR_ (state->m_vdp2_regs[0x03e/2]) + #define STV_VDP2_MPOFR_ (m_vdp2_regs[0x03e/2]) #define STV_VDP2_RBMP_ ((STV_VDP2_MPOFR_ & 0x0030) >> 4) #define STV_VDP2_RAMP_ ((STV_VDP2_MPOFR_ & 0x0003) >> 0) @@ -746,7 +733,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | N0MPA5 | N0MPA4 | N0MPA3 | N0MPA2 | N0MPA1 | N0MPA0 | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_MPABN0 (state->m_vdp2_regs[0x040/2]) + #define STV_VDP2_MPABN0 (m_vdp2_regs[0x040/2]) /* N0MPB5 = lower 6 bits of Map Address of Plane B of Tilemap NBG0 */ #define STV_VDP2_N0MPB ((STV_VDP2_MPABN0 & 0x3f00) >> 8) @@ -762,7 +749,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | N0MPC5 | N0MPC4 | N0MPC3 | N0MPC2 | N0MPC1 | N0MPC0 | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_MPCDN0 (state->m_vdp2_regs[0x042/2]) + #define STV_VDP2_MPCDN0 (m_vdp2_regs[0x042/2]) /* N0MPB5 = lower 6 bits of Map Address of Plane D of Tilemap NBG0 */ #define STV_VDP2_N0MPD ((STV_VDP2_MPCDN0 & 0x3f00) >> 8) @@ -778,7 +765,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_MPABN1 (state->m_vdp2_regs[0x044/2]) + #define STV_VDP2_MPABN1 (m_vdp2_regs[0x044/2]) /* N0MPB5 = lower 6 bits of Map Address of Plane B of Tilemap NBG1 */ #define STV_VDP2_N1MPB ((STV_VDP2_MPABN1 & 0x3f00) >> 8) @@ -793,7 +780,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_MPCDN1 (state->m_vdp2_regs[0x046/2]) + #define STV_VDP2_MPCDN1 (m_vdp2_regs[0x046/2]) /* N0MPB5 = lower 6 bits of Map Address of Plane D of Tilemap NBG0 */ #define STV_VDP2_N1MPD ((STV_VDP2_MPCDN1 & 0x3f00) >> 8) @@ -809,7 +796,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_MPABN2 (state->m_vdp2_regs[0x048/2]) + #define STV_VDP2_MPABN2 (m_vdp2_regs[0x048/2]) /* N0MPB5 = lower 6 bits of Map Address of Plane B of Tilemap NBG2 */ #define STV_VDP2_N2MPB ((STV_VDP2_MPABN2 & 0x3f00) >> 8) @@ -824,7 +811,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_MPCDN2 (state->m_vdp2_regs[0x04a/2]) + #define STV_VDP2_MPCDN2 (m_vdp2_regs[0x04a/2]) /* N0MPB5 = lower 6 bits of Map Address of Plane D of Tilemap NBG2 */ #define STV_VDP2_N2MPD ((STV_VDP2_MPCDN2 & 0x3f00) >> 8) @@ -839,7 +826,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_MPABN3 (state->m_vdp2_regs[0x04c/2]) + #define STV_VDP2_MPABN3 (m_vdp2_regs[0x04c/2]) /* N0MPB5 = lower 6 bits of Map Address of Plane B of Tilemap NBG1 */ #define STV_VDP2_N3MPB ((STV_VDP2_MPABN3 & 0x3f00) >> 8) @@ -855,7 +842,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_MPCDN3 (state->m_vdp2_regs[0x04e/2]) + #define STV_VDP2_MPCDN3 (m_vdp2_regs[0x04e/2]) /* N0MPB5 = lower 6 bits of Map Address of Plane B of Tilemap NBG0 */ #define STV_VDP2_N3MPD ((STV_VDP2_MPCDN3 & 0x3f00) >> 8) @@ -870,7 +857,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_MPABRA (state->m_vdp2_regs[0x050/2]) + #define STV_VDP2_MPABRA (m_vdp2_regs[0x050/2]) /* R0MPB5 = lower 6 bits of Map Address of Plane B of Tilemap RBG0 */ #define STV_VDP2_RAMPB ((STV_VDP2_MPABRA & 0x3f00) >> 8) @@ -886,7 +873,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 |----07----|----06----|----05----|----04----|----03----|----02----|----01----|----00----| | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_MPCDRA (state->m_vdp2_regs[0x052/2]) + #define STV_VDP2_MPCDRA (m_vdp2_regs[0x052/2]) /* R0MPB5 = lower 6 bits of Map Address of Plane D of Tilemap RBG0 */ #define STV_VDP2_RAMPD ((STV_VDP2_MPCDRA & 0x3f00) >> 8) @@ -900,7 +887,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 |----07----|----06----|----05----|----04----|----03----|----02----|----01----|----00----| | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_MPEFRA (state->m_vdp2_regs[0x054/2]) + #define STV_VDP2_MPEFRA (m_vdp2_regs[0x054/2]) /* R0MPB5 = lower 6 bits of Map Address of Plane F of Tilemap RBG0 */ #define STV_VDP2_RAMPF ((STV_VDP2_MPEFRA & 0x3f00) >> 8) @@ -914,7 +901,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 |----07----|----06----|----05----|----04----|----03----|----02----|----01----|----00----| | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_MPGHRA (state->m_vdp2_regs[0x056/2]) + #define STV_VDP2_MPGHRA (m_vdp2_regs[0x056/2]) /* R0MPB5 = lower 6 bits of Map Address of Plane H of Tilemap RBG0 */ #define STV_VDP2_RAMPH ((STV_VDP2_MPGHRA & 0x3f00) >> 8) @@ -928,7 +915,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 |----07----|----06----|----05----|----04----|----03----|----02----|----01----|----00----| | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_MPIJRA (state->m_vdp2_regs[0x058/2]) + #define STV_VDP2_MPIJRA (m_vdp2_regs[0x058/2]) /* R0MPB5 = lower 6 bits of Map Address of Plane J of Tilemap RBG0 */ #define STV_VDP2_RAMPJ ((STV_VDP2_MPIJRA & 0x3f00) >> 8) @@ -942,7 +929,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 |----07----|----06----|----05----|----04----|----03----|----02----|----01----|----00----| | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_MPKLRA (state->m_vdp2_regs[0x05a/2]) + #define STV_VDP2_MPKLRA (m_vdp2_regs[0x05a/2]) /* R0MPB5 = lower 6 bits of Map Address of Plane L of Tilemap RBG0 */ #define STV_VDP2_RAMPL ((STV_VDP2_MPKLRA & 0x3f00) >> 8) @@ -956,7 +943,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 |----07----|----06----|----05----|----04----|----03----|----02----|----01----|----00----| | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_MPMNRA (state->m_vdp2_regs[0x05c/2]) + #define STV_VDP2_MPMNRA (m_vdp2_regs[0x05c/2]) /* R0MPB5 = lower 6 bits of Map Address of Plane N of Tilemap RBG0 */ #define STV_VDP2_RAMPN ((STV_VDP2_MPMNRA & 0x3f00) >> 8) @@ -970,7 +957,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 |----07----|----06----|----05----|----04----|----03----|----02----|----01----|----00----| | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_MPOPRA (state->m_vdp2_regs[0x05e/2]) + #define STV_VDP2_MPOPRA (m_vdp2_regs[0x05e/2]) /* R0MPB5 = lower 6 bits of Map Address of Plane P of Tilemap RBG0 */ #define STV_VDP2_RAMPP ((STV_VDP2_MPOPRA & 0x3f00) >> 8) @@ -985,7 +972,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_MPABRB (state->m_vdp2_regs[0x060/2]) + #define STV_VDP2_MPABRB (m_vdp2_regs[0x060/2]) /* R0MPB5 = lower 6 bits of Map Address of Plane B of Tilemap RBG0 */ #define STV_VDP2_RBMPB ((STV_VDP2_MPABRB & 0x3f00) >> 8) @@ -1001,7 +988,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_MPCDRB (state->m_vdp2_regs[0x062/2]) + #define STV_VDP2_MPCDRB (m_vdp2_regs[0x062/2]) /* R0MPD5 = lower 6 bits of Map Address of Plane D of Tilemap RBG0 */ #define STV_VDP2_RBMPD ((STV_VDP2_MPCDRB & 0x3f00) >> 8) @@ -1016,7 +1003,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_MPEFRB (state->m_vdp2_regs[0x064/2]) + #define STV_VDP2_MPEFRB (m_vdp2_regs[0x064/2]) /* R0MPF5 = lower 6 bits of Map Address of Plane F of Tilemap RBG0 */ #define STV_VDP2_RBMPF ((STV_VDP2_MPEFRB & 0x3f00) >> 8) @@ -1031,7 +1018,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_MPGHRB (state->m_vdp2_regs[0x066/2]) + #define STV_VDP2_MPGHRB (m_vdp2_regs[0x066/2]) /* R0MPH5 = lower 6 bits of Map Address of Plane H of Tilemap RBG0 */ #define STV_VDP2_RBMPH ((STV_VDP2_MPGHRB & 0x3f00) >> 8) @@ -1046,7 +1033,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_MPIJRB (state->m_vdp2_regs[0x068/2]) + #define STV_VDP2_MPIJRB (m_vdp2_regs[0x068/2]) /* R0MPJ5 = lower 6 bits of Map Address of Plane J of Tilemap RBG0 */ #define STV_VDP2_RBMPJ ((STV_VDP2_MPIJRB & 0x3f00) >> 8) @@ -1061,7 +1048,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_MPKLRB (state->m_vdp2_regs[0x06a/2]) + #define STV_VDP2_MPKLRB (m_vdp2_regs[0x06a/2]) /* R0MPL5 = lower 6 bits of Map Address of Plane L of Tilemap RBG0 */ #define STV_VDP2_RBMPL ((STV_VDP2_MPKLRB & 0x3f00) >> 8) @@ -1076,7 +1063,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_MPMNRB (state->m_vdp2_regs[0x06c/2]) + #define STV_VDP2_MPMNRB (m_vdp2_regs[0x06c/2]) /* R0MPN5 = lower 6 bits of Map Address of Plane N of Tilemap RBG0 */ #define STV_VDP2_RBMPN ((STV_VDP2_MPMNRB & 0x3f00) >> 8) @@ -1091,7 +1078,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_MPOPRB (state->m_vdp2_regs[0x06e/2]) + #define STV_VDP2_MPOPRB (m_vdp2_regs[0x06e/2]) /* R0MPP5 = lower 6 bits of Map Address of Plane P of Tilemap RBG0 */ #define STV_VDP2_RBMPP ((STV_VDP2_MPOPRB & 0x3f00) >> 8) @@ -1106,7 +1093,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_SCXIN0 (state->m_vdp2_regs[0x070/2]) + #define STV_VDP2_SCXIN0 (m_vdp2_regs[0x070/2]) /* 180072 - Screen Scroll (NBG0, Horizontal Fractional Part) @@ -1122,7 +1109,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 |----07----|----06----|----05----|----04----|----03----|----02----|----01----|----00----| | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_SCYIN0 (state->m_vdp2_regs[0x074/2]) + #define STV_VDP2_SCYIN0 (m_vdp2_regs[0x074/2]) /* 180076 - Screen Scroll (NBG0, Vertical Fractional Part) @@ -1139,7 +1126,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_ZMXIN0 (state->m_vdp2_regs[0x078/2]) + #define STV_VDP2_ZMXIN0 (m_vdp2_regs[0x078/2]) #define STV_VDP2_N0ZMXI ((STV_VDP2_ZMXIN0 & 0x0007) >> 0) @@ -1150,7 +1137,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_ZMXDN0 (state->m_vdp2_regs[0x07a/2]) + #define STV_VDP2_ZMXDN0 (m_vdp2_regs[0x07a/2]) #define STV_VDP2_N0ZMXD ((STV_VDP2_ZMXDN0 >> 8)& 0xff) #define STV_VDP2_ZMXN0 (((STV_VDP2_N0ZMXI<<16) | (STV_VDP2_N0ZMXD<<8)) & 0x0007ff00) @@ -1163,7 +1150,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_ZMYIN0 (state->m_vdp2_regs[0x07c/2]) + #define STV_VDP2_ZMYIN0 (m_vdp2_regs[0x07c/2]) #define STV_VDP2_N0ZMYI ((STV_VDP2_ZMYIN0 & 0x0007) >> 0) @@ -1174,7 +1161,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_ZMYDN0 (state->m_vdp2_regs[0x07e/2]) + #define STV_VDP2_ZMYDN0 (m_vdp2_regs[0x07e/2]) #define STV_VDP2_N0ZMYD ((STV_VDP2_ZMYDN0 >> 8)& 0xff) #define STV_VDP2_ZMYN0 (((STV_VDP2_N0ZMYI<<16) | (STV_VDP2_N0ZMYD<<8)) & 0x0007ff00) @@ -1186,7 +1173,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_SCXIN1 (state->m_vdp2_regs[0x080/2]) + #define STV_VDP2_SCXIN1 (m_vdp2_regs[0x080/2]) /* 180082 - Screen Scroll (NBG1, Horizontal Fractional Part) bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\ @@ -1202,7 +1189,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_SCYIN1 (state->m_vdp2_regs[0x084/2]) + #define STV_VDP2_SCYIN1 (m_vdp2_regs[0x084/2]) /* 180086 - Screen Scroll (NBG1, Vertical Fractional Part) bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\ @@ -1218,7 +1205,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_ZMXIN1 (state->m_vdp2_regs[0x088/2]) + #define STV_VDP2_ZMXIN1 (m_vdp2_regs[0x088/2]) #define STV_VDP2_N1ZMXI ((STV_VDP2_ZMXIN1 & 0x0007) >> 0) @@ -1229,7 +1216,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_ZMXDN1 (state->m_vdp2_regs[0x08a/2]) + #define STV_VDP2_ZMXDN1 (m_vdp2_regs[0x08a/2]) #define STV_VDP2_N1ZMXD ((STV_VDP2_ZMXDN1 >> 8)& 0xff) #define STV_VDP2_ZMXN1 (((STV_VDP2_N1ZMXI<<16) | (STV_VDP2_N1ZMXD<<8)) & 0x0007ff00) @@ -1241,7 +1228,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_ZMYIN1 (state->m_vdp2_regs[0x08c/2]) + #define STV_VDP2_ZMYIN1 (m_vdp2_regs[0x08c/2]) #define STV_VDP2_N1ZMYI ((STV_VDP2_ZMYIN1 & 0x0007) >> 0) @@ -1252,7 +1239,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_ZMYDN1 (state->m_vdp2_regs[0x08e/2]) + #define STV_VDP2_ZMYDN1 (m_vdp2_regs[0x08e/2]) #define STV_VDP2_N1ZMYD ((STV_VDP2_ZMYDN1 >> 8)& 0xff) #define STV_VDP2_ZMYN1 (((STV_VDP2_N1ZMYI<<16) | (STV_VDP2_N1ZMYD<<8)) & 0x007ff00) @@ -1264,7 +1251,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_SCXN2 (state->m_vdp2_regs[0x090/2]) + #define STV_VDP2_SCXN2 (m_vdp2_regs[0x090/2]) /* 180092 - SCYN2 - Screen Scroll (NBG2, Vertical) bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\ @@ -1273,7 +1260,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_SCYN2 (state->m_vdp2_regs[0x092/2]) + #define STV_VDP2_SCYN2 (m_vdp2_regs[0x092/2]) /* 180094 - SCXN3 - Screen Scroll (NBG3, Horizontal) bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\ @@ -1282,7 +1269,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_SCXN3 (state->m_vdp2_regs[0x094/2]) + #define STV_VDP2_SCXN3 (m_vdp2_regs[0x094/2]) /* 180096 - SCYN3 - Screen Scroll (NBG3, Vertical) bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\ @@ -1291,7 +1278,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_SCYN3 (state->m_vdp2_regs[0x096/2]) + #define STV_VDP2_SCYN3 (m_vdp2_regs[0x096/2]) /* 180098 - Reduction Enable bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\ @@ -1300,7 +1287,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | N0ZMQT | N0ZMHF | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_ZMCTL (state->m_vdp2_regs[0x098/2]) + #define STV_VDP2_ZMCTL (m_vdp2_regs[0x098/2]) #define STV_VDP2_N1ZMQT ((STV_VDP2_ZMCTL & 0x0200) >> 9) #define STV_VDP2_N1ZMHF ((STV_VDP2_ZMCTL & 0x0100) >> 8) @@ -1314,7 +1301,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_SCRCTL (state->m_vdp2_regs[0x09a/2]) + #define STV_VDP2_SCRCTL (m_vdp2_regs[0x09a/2]) #define STV_VDP2_N1LSS ((STV_VDP2_SCRCTL & 0x3000) >> 12) #define STV_VDP2_N1LZMX ((STV_VDP2_SCRCTL & 0x0800) >> 11) @@ -1334,7 +1321,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_VCSTAU (state->m_vdp2_regs[0x09c/2] & 7) + #define STV_VDP2_VCSTAU (m_vdp2_regs[0x09c/2] & 7) /* 18009e - Vertical Cell Table Address (NBG0, NBG1) @@ -1344,7 +1331,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_VCSTAL (state->m_vdp2_regs[0x09e/2]) + #define STV_VDP2_VCSTAL (m_vdp2_regs[0x09e/2]) /* 1800a0 - LSTA0U - Line Scroll Table Address (NBG0) @@ -1355,7 +1342,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 \----------|----------|----------|----------|----------|----------|----------|---------*/ /*bit 2 unused when VRAM = 4 Mbits*/ - #define STV_VDP2_LSTA0U (state->m_vdp2_regs[0x0a0/2] & 7) + #define STV_VDP2_LSTA0U (m_vdp2_regs[0x0a0/2] & 7) /* 1800a2 - LSTA0L - Line Scroll Table Address (NBG0) bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\ @@ -1364,7 +1351,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_LSTA0L (state->m_vdp2_regs[0x0a2/2]) + #define STV_VDP2_LSTA0L (m_vdp2_regs[0x0a2/2]) /* 1800a4 - LSTA1U - Line Scroll Table Address (NBG1) bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\ @@ -1374,7 +1361,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 \----------|----------|----------|----------|----------|----------|----------|---------*/ /*bit 2 unused when VRAM = 4 Mbits*/ - #define STV_VDP2_LSTA1U (state->m_vdp2_regs[0x0a4/2] & 7) + #define STV_VDP2_LSTA1U (m_vdp2_regs[0x0a4/2] & 7) /* 1800a6 - LSTA1L - Line Scroll Table Address (NBG1) bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\ @@ -1383,7 +1370,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_LSTA1L (state->m_vdp2_regs[0x0a6/2]) + #define STV_VDP2_LSTA1L (m_vdp2_regs[0x0a6/2]) /* 1800a8 - LCTAU - Line Colour Screen Table Address bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\ @@ -1392,7 +1379,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_LCTAU (state->m_vdp2_regs[0x0a8/2]) + #define STV_VDP2_LCTAU (m_vdp2_regs[0x0a8/2]) #define STV_VDP2_LCCLMD ((STV_VDP2_LCTAU & 0x8000) >> 15) /* 1800aa - LCTAL - Line Colour Screen Table Address @@ -1401,7 +1388,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 |----07----|----06----|----05----|----04----|----03----|----02----|----01----|----00----| | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_LCTAL (state->m_vdp2_regs[0x0aa/2]) + #define STV_VDP2_LCTAL (m_vdp2_regs[0x0aa/2]) #define STV_VDP2_LCTA (((STV_VDP2_LCTAU & 0x0007) << 16) | (STV_VDP2_LCTAL & 0xffff)) @@ -1412,7 +1399,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | BKTA18 | BKTA17 | BKTA16 | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_BKTAU (state->m_vdp2_regs[0x0ac/2]) + #define STV_VDP2_BKTAU (m_vdp2_regs[0x0ac/2]) #define STV_VDP2_BKCLMD ((STV_VDP2_BKTAU & 0x8000) >> 15) @@ -1424,7 +1411,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | BKTA7 | BKTA7 | BKTA6 | BKTA5 | BKTA4 | BKTA3 | BKTA2 | BKTA0 | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_BKTAL (state->m_vdp2_regs[0x0ae/2]) + #define STV_VDP2_BKTAL (m_vdp2_regs[0x0ae/2]) #define STV_VDP2_BKTA (((STV_VDP2_BKTAU & 0x0007) << 16) | (STV_VDP2_BKTAL & 0xffff)) @@ -1435,7 +1422,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_RPMD ((state->m_vdp2_regs[0x0b0/2]) & 0x0003) + #define STV_VDP2_RPMD ((m_vdp2_regs[0x0b0/2]) & 0x0003) /* 1800b2 - RPRCTL - Rotation Parameter Read Control bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\ @@ -1444,7 +1431,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | RAKASTRE | RAYSTRE | RBXSTRE | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_RPRCTL (state->m_vdp2_regs[0x0b2/2]) + #define STV_VDP2_RPRCTL (m_vdp2_regs[0x0b2/2]) #define STV_VDP2_RBKASTRE ((STV_VDP2_RPRCTL & 0x0400) >> 10) #define STV_VDP2_RBYSTRE ((STV_VDP2_RPRCTL & 0x0200) >> 9) #define STV_VDP2_RBXSTRE ((STV_VDP2_RPRCTL & 0x0100) >> 8) @@ -1459,7 +1446,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | RAKLCE | RAKMD1 | RAKMD0 | RAKDBS | RAKTE | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_KTCTL (state->m_vdp2_regs[0x0b4/2]) + #define STV_VDP2_KTCTL (m_vdp2_regs[0x0b4/2]) #define STV_VDP2_RBKLCE ((STV_VDP2_KTCTL & 0x1000) >> 12) #define STV_VDP2_RBKMD ((STV_VDP2_KTCTL & 0x0c00) >> 10) #define STV_VDP2_RBKDBS ((STV_VDP2_KTCTL & 0x0200) >> 9) @@ -1476,7 +1463,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | RAKTAOS2 | RAKTAOS1 | RAKTAOS0 | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_KTAOF (state->m_vdp2_regs[0x0b6/2]) + #define STV_VDP2_KTAOF (m_vdp2_regs[0x0b6/2]) #define STV_VDP2_RBKTAOS ((STV_VDP2_KTAOF & 0x0700) >> 8) #define STV_VDP2_RAKTAOS ((STV_VDP2_KTAOF & 0x0007) >> 0) @@ -1487,7 +1474,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_OVPNRA (state->m_vdp2_regs[0x0b8/2]) + #define STV_VDP2_OVPNRA (m_vdp2_regs[0x0b8/2]) /* 1800ba - Screen Over Pattern Name (Rotation Parameter B) bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\ @@ -1496,7 +1483,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_OVPNRB (state->m_vdp2_regs[0x0ba/2]) + #define STV_VDP2_OVPNRB (m_vdp2_regs[0x0ba/2]) /* 1800bc - RPTAU - Rotation Parameter Table Address (Rotation Parameter A,B) bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\ @@ -1504,7 +1491,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 |----07----|----06----|----05----|----04----|----03----|----02----|----01----|----00----| | -- | -- | -- | -- | -- | RPTA18 | RPTA17 | RPTA16 | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_RPTAU (state->m_vdp2_regs[0x0bc/2] & 7) + #define STV_VDP2_RPTAU (m_vdp2_regs[0x0bc/2] & 7) /* 1800be - RPTAL - Rotation Parameter Table Address (Rotation Parameter A,B) bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\ @@ -1513,7 +1500,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | RPTA7 | RPTA6 | RPTA5 | RPTA4 | RPTA3 | RPTA2 | RPTA1 | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_RPTAL (state->m_vdp2_regs[0x0be/2] & 0x0000ffff) + #define STV_VDP2_RPTAL (m_vdp2_regs[0x0be/2] & 0x0000ffff) /* 1800c0 - Window Position (W0, Horizontal Start Point) bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\ @@ -1522,7 +1509,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_WPSX0 (state->m_vdp2_regs[0x0c0/2]) + #define STV_VDP2_WPSX0 (m_vdp2_regs[0x0c0/2]) #define STV_VDP2_W0SX ((STV_VDP2_WPSX0 & 0x03ff) >> 0) @@ -1533,7 +1520,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_WPSY0 (state->m_vdp2_regs[0x0c2/2]) + #define STV_VDP2_WPSY0 (m_vdp2_regs[0x0c2/2]) #define STV_VDP2_W0SY ((STV_VDP2_WPSY0 & 0x03ff) >> 0) @@ -1544,7 +1531,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_WPEX0 (state->m_vdp2_regs[0x0c4/2]) + #define STV_VDP2_WPEX0 (m_vdp2_regs[0x0c4/2]) #define STV_VDP2_W0EX ((STV_VDP2_WPEX0 & 0x03ff) >> 0) @@ -1555,7 +1542,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_WPEY0 (state->m_vdp2_regs[0x0c6/2]) + #define STV_VDP2_WPEY0 (m_vdp2_regs[0x0c6/2]) #define STV_VDP2_W0EY ((STV_VDP2_WPEY0 & 0x03ff) >> 0) @@ -1566,7 +1553,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_WPSX1 (state->m_vdp2_regs[0x0c8/2]) + #define STV_VDP2_WPSX1 (m_vdp2_regs[0x0c8/2]) #define STV_VDP2_W1SX ((STV_VDP2_WPSX1 & 0x03ff) >> 0) @@ -1577,7 +1564,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_WPSY1 (state->m_vdp2_regs[0x0ca/2]) + #define STV_VDP2_WPSY1 (m_vdp2_regs[0x0ca/2]) #define STV_VDP2_W1SY ((STV_VDP2_WPSY1 & 0x03ff) >> 0) @@ -1588,7 +1575,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_WPEX1 (state->m_vdp2_regs[0x0cc/2]) + #define STV_VDP2_WPEX1 (m_vdp2_regs[0x0cc/2]) #define STV_VDP2_W1EX ((STV_VDP2_WPEX1 & 0x03ff) >> 0) @@ -1599,7 +1586,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_WPEY1 (state->m_vdp2_regs[0x0ce/2]) + #define STV_VDP2_WPEY1 (m_vdp2_regs[0x0ce/2]) #define STV_VDP2_W1EY ((STV_VDP2_WPEY1 & 0x03ff) >> 0) @@ -1610,7 +1597,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_WCTLA (state->m_vdp2_regs[0x0d0/2]) + #define STV_VDP2_WCTLA (m_vdp2_regs[0x0d0/2]) #define STV_VDP2_N1LOG ((STV_VDP2_WCTLA & 0x8000) >> 15) #define STV_VDP2_N1SWE ((STV_VDP2_WCTLA & 0x2000) >> 13) #define STV_VDP2_N1SWA ((STV_VDP2_WCTLA & 0x1000) >> 12) @@ -1633,7 +1620,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_WCTLB (state->m_vdp2_regs[0x0d2/2]) + #define STV_VDP2_WCTLB (m_vdp2_regs[0x0d2/2]) #define STV_VDP2_N3LOG ((STV_VDP2_WCTLB & 0x8000) >> 15) #define STV_VDP2_N3SWE ((STV_VDP2_WCTLB & 0x2000) >> 13) #define STV_VDP2_N3SWA ((STV_VDP2_WCTLB & 0x1000) >> 12) @@ -1656,7 +1643,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_WCTLC (state->m_vdp2_regs[0x0d4/2]) + #define STV_VDP2_WCTLC (m_vdp2_regs[0x0d4/2]) #define STV_VDP2_SPLOG ((STV_VDP2_WCTLC & 0x8000) >> 15) #define STV_VDP2_SPSWE ((STV_VDP2_WCTLC & 0x2000) >> 13) #define STV_VDP2_SPSWA ((STV_VDP2_WCTLC & 0x1000) >> 12) @@ -1679,7 +1666,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_WCTLD (state->m_vdp2_regs[0x0d6/2]) + #define STV_VDP2_WCTLD (m_vdp2_regs[0x0d6/2]) #define STV_VDP2_CCLOG ((STV_VDP2_WCTLD & 0x8000) >> 15) #define STV_VDP2_CCSWE ((STV_VDP2_WCTLD & 0x2000) >> 13) #define STV_VDP2_CCSWA ((STV_VDP2_WCTLD & 0x1000) >> 12) @@ -1700,7 +1687,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_LWTA0U (state->m_vdp2_regs[0x0d8/2]) + #define STV_VDP2_LWTA0U (m_vdp2_regs[0x0d8/2]) #define STV_VDP2_W0LWE ((STV_VDP2_LWTA0U & 0x8000) >> 15) @@ -1711,7 +1698,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_LWTA0L (state->m_vdp2_regs[0x0da/2]) + #define STV_VDP2_LWTA0L (m_vdp2_regs[0x0da/2]) /* bit 19 isn't used when VRAM = 4 Mbit */ #define STV_VDP2_W0LWTA (((STV_VDP2_LWTA0U & 0x0007) << 16) | (STV_VDP2_LWTA0L & 0xfffe)) @@ -1724,7 +1711,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_LWTA1U (state->m_vdp2_regs[0x0dc/2]) + #define STV_VDP2_LWTA1U (m_vdp2_regs[0x0dc/2]) #define STV_VDP2_W1LWE ((STV_VDP2_LWTA0U & 0x8000) >> 15) @@ -1736,7 +1723,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_LWTA1L (state->m_vdp2_regs[0x0de/2]) + #define STV_VDP2_LWTA1L (m_vdp2_regs[0x0de/2]) /* bit 19 isn't used when VRAM = 4 Mbit */ #define STV_VDP2_W1LWTA (((STV_VDP2_LWTA1U & 0x0007) << 16) | (STV_VDP2_LWTA1L & 0xfffe)) @@ -1749,7 +1736,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | SPCLMD | SPWINEN | SPTYPE3 | SPTYPE2 | SPTYPE1 | SPTYPE0 | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_SPCTL (state->m_vdp2_regs[0xe0/2]) + #define STV_VDP2_SPCTL (m_vdp2_regs[0xe0/2]) #define STV_VDP2_SPCCCS ((STV_VDP2_SPCTL & 0x3000) >> 12) #define STV_VDP2_SPCCN ((STV_VDP2_SPCTL & 0x700) >> 8) #define STV_VDP2_SPCLMD ((STV_VDP2_SPCTL & 0x20) >> 5) @@ -1763,7 +1750,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_SDCTL (state->m_vdp2_regs[0x0e2/2]) + #define STV_VDP2_SDCTL (m_vdp2_regs[0x0e2/2]) /* 1800e4 - CRAOFA - Colour Ram Address Offset (NBG0 - NBG3) bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\ @@ -1772,7 +1759,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | N1CAOS2 | N1CAOS1 | N1CAOS0 | -- | N0CAOS2 | N0CAOS1 | N0CAOS0 | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_CRAOFA (state->m_vdp2_regs[0x0e4/2]) + #define STV_VDP2_CRAOFA (m_vdp2_regs[0x0e4/2]) /* NxCAOS = */ #define STV_VDP2_N0CAOS ((STV_VDP2_CRAOFA & 0x0007) >> 0) @@ -1787,7 +1774,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 |----07----|----06----|----05----|----04----|----03----|----02----|----01----|----00----| | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_CRAOFB (state->m_vdp2_regs[0x0e6/2]) + #define STV_VDP2_CRAOFB (m_vdp2_regs[0x0e6/2]) #define STV_VDP2_R0CAOS ((STV_VDP2_CRAOFB & 0x0007) >> 0) #define STV_VDP2_SPCAOS ((STV_VDP2_CRAOFB & 0x0070) >> 4) @@ -1798,7 +1785,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | SPLCEN | R0LCEN | N3LCEN | N2LCEN | N1LCEN | N0LCEN | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_LNCLEN (state->m_vdp2_regs[0x0e8/2]) + #define STV_VDP2_LNCLEN (m_vdp2_regs[0x0e8/2]) #define STV_VDP2_SPLCEN ((STV_VDP2_LNCLEN & 0x0020) >> 5) #define STV_VDP2_R0LCEN ((STV_VDP2_LNCLEN & 0x0010) >> 4) #define STV_VDP2_N3LCEN ((STV_VDP2_LNCLEN & 0x0008) >> 3) @@ -1813,7 +1800,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_SFPRMD (state->m_vdp2_regs[0x0ea/2]) + #define STV_VDP2_SFPRMD (m_vdp2_regs[0x0ea/2]) /* 1800ec - Colour Calculation Control @@ -1823,7 +1810,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | SPCCEN | LCCCEN | R0CCEN | N3CCEN | N2CCEN | N1CCEN | N0CCEN | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_CCCR (state->m_vdp2_regs[0x0ec/2]) + #define STV_VDP2_CCCR (m_vdp2_regs[0x0ec/2]) #define STV_VDP2_CCMD ((STV_VDP2_CCCR & 0x100) >> 8) #define STV_VDP2_SPCCEN ((STV_VDP2_CCCR & 0x40) >> 6) #define STV_VDP2_LCCCEN ((STV_VDP2_CCCR & 0x20) >> 5) @@ -1841,7 +1828,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_SFCCMD (state->m_vdp2_regs[0x0ee/2]) + #define STV_VDP2_SFCCMD (m_vdp2_regs[0x0ee/2]) /* 1800f0 - Priority Number (Sprite 0,1) bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\ @@ -1850,7 +1837,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | S0PRIN2 | S0PRIN1 | S0PRIN0 | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_PRISA (state->m_vdp2_regs[0x0f0/2]) + #define STV_VDP2_PRISA (m_vdp2_regs[0x0f0/2]) #define STV_VDP2_S1PRIN ((STV_VDP2_PRISA & 0x0700) >> 8) #define STV_VDP2_S0PRIN ((STV_VDP2_PRISA & 0x0007) >> 0) @@ -1861,7 +1848,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | S2PRIN2 | S2PRIN1 | S2PRIN0 | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_PRISB (state->m_vdp2_regs[0x0f2/2]) + #define STV_VDP2_PRISB (m_vdp2_regs[0x0f2/2]) #define STV_VDP2_S3PRIN ((STV_VDP2_PRISB & 0x0700) >> 8) #define STV_VDP2_S2PRIN ((STV_VDP2_PRISB & 0x0007) >> 0) @@ -1872,7 +1859,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | S4PRIN2 | S4PRIN1 | S4PRIN0 | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_PRISC (state->m_vdp2_regs[0x0f4/2]) + #define STV_VDP2_PRISC (m_vdp2_regs[0x0f4/2]) #define STV_VDP2_S5PRIN ((STV_VDP2_PRISC & 0x0700) >> 8) #define STV_VDP2_S4PRIN ((STV_VDP2_PRISC & 0x0007) >> 0) @@ -1883,7 +1870,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | S6PRIN2 | S6PRIN1 | S6PRIN0 | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_PRISD (state->m_vdp2_regs[0x0f6/2]) + #define STV_VDP2_PRISD (m_vdp2_regs[0x0f6/2]) #define STV_VDP2_S7PRIN ((STV_VDP2_PRISD & 0x0700) >> 8) #define STV_VDP2_S6PRIN ((STV_VDP2_PRISD & 0x0007) >> 0) @@ -1895,7 +1882,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_PRINA (state->m_vdp2_regs[0x0f8/2]) + #define STV_VDP2_PRINA (m_vdp2_regs[0x0f8/2]) #define STV_VDP2_N1PRIN ((STV_VDP2_PRINA & 0x0700) >> 8) #define STV_VDP2_N0PRIN ((STV_VDP2_PRINA & 0x0007) >> 0) @@ -1907,7 +1894,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_PRINB (state->m_vdp2_regs[0x0fa/2]) + #define STV_VDP2_PRINB (m_vdp2_regs[0x0fa/2]) #define STV_VDP2_N3PRIN ((STV_VDP2_PRINB & 0x0700) >> 8) #define STV_VDP2_N2PRIN ((STV_VDP2_PRINB & 0x0007) >> 0) @@ -1918,7 +1905,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 |----07----|----06----|----05----|----04----|----03----|----02----|----01----|----00----| | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_PRIR (state->m_vdp2_regs[0x0fc/2]) + #define STV_VDP2_PRIR (m_vdp2_regs[0x0fc/2]) #define STV_VDP2_R0PRIN ((STV_VDP2_PRIR & 0x0007) >> 0) @@ -1936,7 +1923,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | S0CCRT4 | S0CCRT3 | S0CCRT2 | S0CCRT1 | S0CCRT0 | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_CCRSA (state->m_vdp2_regs[0x100/2]) + #define STV_VDP2_CCRSA (m_vdp2_regs[0x100/2]) #define STV_VDP2_S1CCRT ((STV_VDP2_CCRSA & 0x1f00) >> 8) #define STV_VDP2_S0CCRT ((STV_VDP2_CCRSA & 0x001f) >> 0) @@ -1947,7 +1934,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | S2CCRT4 | S2CCRT3 | S2CCRT2 | S2CCRT1 | S2CCRT0 | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_CCRSB (state->m_vdp2_regs[0x102/2]) + #define STV_VDP2_CCRSB (m_vdp2_regs[0x102/2]) #define STV_VDP2_S3CCRT ((STV_VDP2_CCRSB & 0x1f00) >> 8) #define STV_VDP2_S2CCRT ((STV_VDP2_CCRSB & 0x001f) >> 0) @@ -1958,7 +1945,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | S4CCRT4 | S4CCRT3 | S4CCRT2 | S4CCRT1 | S4CCRT0 | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_CCRSC (state->m_vdp2_regs[0x104/2]) + #define STV_VDP2_CCRSC (m_vdp2_regs[0x104/2]) #define STV_VDP2_S5CCRT ((STV_VDP2_CCRSC & 0x1f00) >> 8) #define STV_VDP2_S4CCRT ((STV_VDP2_CCRSC & 0x001f) >> 0) @@ -1969,7 +1956,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | S6CCRT4 | S6CCRT3 | S6CCRT2 | S6CCRT1 | S6CCRT0 | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_CCRSD (state->m_vdp2_regs[0x106/2]) + #define STV_VDP2_CCRSD (m_vdp2_regs[0x106/2]) #define STV_VDP2_S7CCRT ((STV_VDP2_CCRSD & 0x1f00) >> 8) #define STV_VDP2_S6CCRT ((STV_VDP2_CCRSD & 0x001f) >> 0) @@ -1980,7 +1967,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | N0CCRT4 | N0CCRT3 | N0CCRT2 | N0CCRT1 | N0CCRT0 | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_CCRNA (state->m_vdp2_regs[0x108/2]) + #define STV_VDP2_CCRNA (m_vdp2_regs[0x108/2]) #define STV_VDP2_N1CCRT ((STV_VDP2_CCRNA & 0x1f00) >> 8) #define STV_VDP2_N0CCRT (STV_VDP2_CCRNA & 0x1f) @@ -1991,7 +1978,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | N2CCRT4 | N2CCRT3 | N2CCRT2 | N2CCRT1 | N2CCRT0 | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_CCRNB (state->m_vdp2_regs[0x10a/2]) + #define STV_VDP2_CCRNB (m_vdp2_regs[0x10a/2]) #define STV_VDP2_N3CCRT ((STV_VDP2_CCRNB & 0x1f00) >> 8) #define STV_VDP2_N2CCRT (STV_VDP2_CCRNB & 0x1f) @@ -2002,7 +1989,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_CCRR (state->m_vdp2_regs[0x10c/2]) + #define STV_VDP2_CCRR (m_vdp2_regs[0x10c/2]) #define STV_VDP2_R0CCRT (STV_VDP2_CCRR & 0x1f) /* 18010e - Colour Calculation Ratio (Line Colour Screen, Back Colour Screen) @@ -2019,7 +2006,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_CLOFEN (state->m_vdp2_regs[0x110/2]) + #define STV_VDP2_CLOFEN (m_vdp2_regs[0x110/2]) #define STV_VDP2_N0COEN ((STV_VDP2_CLOFEN & 0x01) >> 0) #define STV_VDP2_N1COEN ((STV_VDP2_CLOFEN & 0x02) >> 1) #define STV_VDP2_N2COEN ((STV_VDP2_CLOFEN & 0x04) >> 2) @@ -2035,7 +2022,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_CLOFSL (state->m_vdp2_regs[0x112/2]) + #define STV_VDP2_CLOFSL (m_vdp2_regs[0x112/2]) #define STV_VDP2_N0COSL ((STV_VDP2_CLOFSL & 0x01) >> 0) #define STV_VDP2_N1COSL ((STV_VDP2_CLOFSL & 0x02) >> 1) #define STV_VDP2_N2COSL ((STV_VDP2_CLOFSL & 0x04) >> 2) @@ -2051,7 +2038,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_COAR (state->m_vdp2_regs[0x114/2]) + #define STV_VDP2_COAR (m_vdp2_regs[0x114/2]) /* 180116 - Colour Offset A (Green) bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\ @@ -2059,7 +2046,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 |----07----|----06----|----05----|----04----|----03----|----02----|----01----|----00----| | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_COAG (state->m_vdp2_regs[0x116/2]) + #define STV_VDP2_COAG (m_vdp2_regs[0x116/2]) /* 180118 - Colour Offset A (Blue) bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\ @@ -2068,7 +2055,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_COAB (state->m_vdp2_regs[0x118/2]) + #define STV_VDP2_COAB (m_vdp2_regs[0x118/2]) /* 18011a - Colour Offset B (Red) bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\ @@ -2076,7 +2063,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 |----07----|----06----|----05----|----04----|----03----|----02----|----01----|----00----| | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_COBR (state->m_vdp2_regs[0x11a/2]) + #define STV_VDP2_COBR (m_vdp2_regs[0x11a/2]) /* 18011c - Colour Offset B (Green) bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\ @@ -2084,7 +2071,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 |----07----|----06----|----05----|----04----|----03----|----02----|----01----|----00----| | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_COBG (state->m_vdp2_regs[0x11c/2]) + #define STV_VDP2_COBG (m_vdp2_regs[0x11c/2]) /* 18011e - Colour Offset B (Blue) bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\ @@ -2092,7 +2079,7 @@ bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09 |----07----|----06----|----05----|----04----|----03----|----02----|----01----|----00----| | -- | -- | -- | -- | -- | -- | -- | -- | \----------|----------|----------|----------|----------|----------|----------|---------*/ - #define STV_VDP2_COBB (state->m_vdp2_regs[0x11e/2]) + #define STV_VDP2_COBB (m_vdp2_regs[0x11e/2]) /*For Debug purposes only*/ static struct stv_vdp2_debugging @@ -2207,9 +2194,8 @@ static struct _stv_rbg_cache_data #define mul_fixed32( a, b ) mul_32x32_shift( a, b, 16 ) -static void stv_vdp2_fill_rotation_parameter_table( running_machine &machine, UINT8 rot_parameter ) +void saturn_state::stv_vdp2_fill_rotation_parameter_table( UINT8 rot_parameter ) { - saturn_state *state = machine.driver_data(); UINT32 address = 0; address = (((STV_VDP2_RPTAU << 16) | STV_VDP2_RPTAL) << 1); @@ -2222,34 +2208,34 @@ static void stv_vdp2_fill_rotation_parameter_table( running_machine &machine, UI address |= 0x00000080; } - stv_current_rotation_parameter_table.xst = (state->m_vdp2_vram[address/4] & 0x1fffffc0) | ((state->m_vdp2_vram[address/4] & 0x10000000) ? 0xe0000000 : 0x00000000 ); - stv_current_rotation_parameter_table.yst = (state->m_vdp2_vram[address/4 + 1] & 0x1fffffc0) | ((state->m_vdp2_vram[address/4 + 1] & 0x10000000) ? 0xe0000000 : 0x00000000 ); - stv_current_rotation_parameter_table.zst = (state->m_vdp2_vram[address/4 + 2] & 0x1fffffc0) | ((state->m_vdp2_vram[address/4 + 2] & 0x10000000) ? 0xe0000000 : 0x00000000 ); - stv_current_rotation_parameter_table.dxst = (state->m_vdp2_vram[address/4 + 3] & 0x0007ffc0) | ((state->m_vdp2_vram[address/4 + 3] & 0x00040000) ? 0xfff80000 : 0x00000000 ); - stv_current_rotation_parameter_table.dyst = (state->m_vdp2_vram[address/4 + 4] & 0x0007ffc0) | ((state->m_vdp2_vram[address/4 + 4] & 0x00040000) ? 0xfff80000 : 0x00000000 ); - stv_current_rotation_parameter_table.dx = (state->m_vdp2_vram[address/4 + 5] & 0x0007ffc0) | ((state->m_vdp2_vram[address/4 + 5] & 0x00040000) ? 0xfff80000 : 0x00000000 ); - stv_current_rotation_parameter_table.dy = (state->m_vdp2_vram[address/4 + 6] & 0x0007ffc0) | ((state->m_vdp2_vram[address/4 + 6] & 0x00040000) ? 0xfff80000 : 0x00000000 ); - stv_current_rotation_parameter_table.A = (state->m_vdp2_vram[address/4 + 7] & 0x000fffc0) | ((state->m_vdp2_vram[address/4 + 7] & 0x00080000) ? 0xfff00000 : 0x00000000 ); - stv_current_rotation_parameter_table.B = (state->m_vdp2_vram[address/4 + 8] & 0x000fffc0) | ((state->m_vdp2_vram[address/4 + 8] & 0x00080000) ? 0xfff00000 : 0x00000000 ); - stv_current_rotation_parameter_table.C = (state->m_vdp2_vram[address/4 + 9] & 0x000fffc0) | ((state->m_vdp2_vram[address/4 + 9] & 0x00080000) ? 0xfff00000 : 0x00000000 ); - stv_current_rotation_parameter_table.D = (state->m_vdp2_vram[address/4 + 10] & 0x000fffc0) | ((state->m_vdp2_vram[address/4 + 10] & 0x00080000) ? 0xfff00000 : 0x00000000 ); - stv_current_rotation_parameter_table.E = (state->m_vdp2_vram[address/4 + 11] & 0x000fffc0) | ((state->m_vdp2_vram[address/4 + 11] & 0x00080000) ? 0xfff00000 : 0x00000000 ); - stv_current_rotation_parameter_table.F = (state->m_vdp2_vram[address/4 + 12] & 0x000fffc0) | ((state->m_vdp2_vram[address/4 + 12] & 0x00080000) ? 0xfff00000 : 0x00000000 ); - stv_current_rotation_parameter_table.px = (state->m_vdp2_vram[address/4 + 13] & 0x3fff0000) | ((state->m_vdp2_vram[address/4 + 13] & 0x30000000) ? 0xc0000000 : 0x00000000 ); - stv_current_rotation_parameter_table.py = (state->m_vdp2_vram[address/4 + 13] & 0x00003fff) << 16; + stv_current_rotation_parameter_table.xst = (m_vdp2_vram[address/4] & 0x1fffffc0) | ((m_vdp2_vram[address/4] & 0x10000000) ? 0xe0000000 : 0x00000000 ); + stv_current_rotation_parameter_table.yst = (m_vdp2_vram[address/4 + 1] & 0x1fffffc0) | ((m_vdp2_vram[address/4 + 1] & 0x10000000) ? 0xe0000000 : 0x00000000 ); + stv_current_rotation_parameter_table.zst = (m_vdp2_vram[address/4 + 2] & 0x1fffffc0) | ((m_vdp2_vram[address/4 + 2] & 0x10000000) ? 0xe0000000 : 0x00000000 ); + stv_current_rotation_parameter_table.dxst = (m_vdp2_vram[address/4 + 3] & 0x0007ffc0) | ((m_vdp2_vram[address/4 + 3] & 0x00040000) ? 0xfff80000 : 0x00000000 ); + stv_current_rotation_parameter_table.dyst = (m_vdp2_vram[address/4 + 4] & 0x0007ffc0) | ((m_vdp2_vram[address/4 + 4] & 0x00040000) ? 0xfff80000 : 0x00000000 ); + stv_current_rotation_parameter_table.dx = (m_vdp2_vram[address/4 + 5] & 0x0007ffc0) | ((m_vdp2_vram[address/4 + 5] & 0x00040000) ? 0xfff80000 : 0x00000000 ); + stv_current_rotation_parameter_table.dy = (m_vdp2_vram[address/4 + 6] & 0x0007ffc0) | ((m_vdp2_vram[address/4 + 6] & 0x00040000) ? 0xfff80000 : 0x00000000 ); + stv_current_rotation_parameter_table.A = (m_vdp2_vram[address/4 + 7] & 0x000fffc0) | ((m_vdp2_vram[address/4 + 7] & 0x00080000) ? 0xfff00000 : 0x00000000 ); + stv_current_rotation_parameter_table.B = (m_vdp2_vram[address/4 + 8] & 0x000fffc0) | ((m_vdp2_vram[address/4 + 8] & 0x00080000) ? 0xfff00000 : 0x00000000 ); + stv_current_rotation_parameter_table.C = (m_vdp2_vram[address/4 + 9] & 0x000fffc0) | ((m_vdp2_vram[address/4 + 9] & 0x00080000) ? 0xfff00000 : 0x00000000 ); + stv_current_rotation_parameter_table.D = (m_vdp2_vram[address/4 + 10] & 0x000fffc0) | ((m_vdp2_vram[address/4 + 10] & 0x00080000) ? 0xfff00000 : 0x00000000 ); + stv_current_rotation_parameter_table.E = (m_vdp2_vram[address/4 + 11] & 0x000fffc0) | ((m_vdp2_vram[address/4 + 11] & 0x00080000) ? 0xfff00000 : 0x00000000 ); + stv_current_rotation_parameter_table.F = (m_vdp2_vram[address/4 + 12] & 0x000fffc0) | ((m_vdp2_vram[address/4 + 12] & 0x00080000) ? 0xfff00000 : 0x00000000 ); + stv_current_rotation_parameter_table.px = (m_vdp2_vram[address/4 + 13] & 0x3fff0000) | ((m_vdp2_vram[address/4 + 13] & 0x30000000) ? 0xc0000000 : 0x00000000 ); + stv_current_rotation_parameter_table.py = (m_vdp2_vram[address/4 + 13] & 0x00003fff) << 16; if ( stv_current_rotation_parameter_table.py & 0x20000000 ) stv_current_rotation_parameter_table.py |= 0xc0000000; - stv_current_rotation_parameter_table.pz = (state->m_vdp2_vram[address/4 + 14] & 0x3fff0000) | ((state->m_vdp2_vram[address/4 + 14] & 0x20000000) ? 0xc0000000 : 0x00000000 ); - stv_current_rotation_parameter_table.cx = (state->m_vdp2_vram[address/4 + 15] & 0x3fff0000) | ((state->m_vdp2_vram[address/4 + 15] & 0x20000000) ? 0xc0000000 : 0x00000000 ); - stv_current_rotation_parameter_table.cy = (state->m_vdp2_vram[address/4 + 15] & 0x00003fff) << 16; + stv_current_rotation_parameter_table.pz = (m_vdp2_vram[address/4 + 14] & 0x3fff0000) | ((m_vdp2_vram[address/4 + 14] & 0x20000000) ? 0xc0000000 : 0x00000000 ); + stv_current_rotation_parameter_table.cx = (m_vdp2_vram[address/4 + 15] & 0x3fff0000) | ((m_vdp2_vram[address/4 + 15] & 0x20000000) ? 0xc0000000 : 0x00000000 ); + stv_current_rotation_parameter_table.cy = (m_vdp2_vram[address/4 + 15] & 0x00003fff) << 16; if ( stv_current_rotation_parameter_table.cy & 0x20000000 ) stv_current_rotation_parameter_table.cy |= 0xc0000000; - stv_current_rotation_parameter_table.cz = (state->m_vdp2_vram[address/4 + 16] & 0x3fff0000) | ((state->m_vdp2_vram[address/4 + 16] & 0x20000000) ? 0xc0000000 : 0x00000000 ); - stv_current_rotation_parameter_table.mx = (state->m_vdp2_vram[address/4 + 17] & 0x3fffffc0) | ((state->m_vdp2_vram[address/4 + 17] & 0x20000000) ? 0xc0000000 : 0x00000000 ); - stv_current_rotation_parameter_table.my = (state->m_vdp2_vram[address/4 + 18] & 0x3fffffc0) | ((state->m_vdp2_vram[address/4 + 18] & 0x20000000) ? 0xc0000000 : 0x00000000 ); - stv_current_rotation_parameter_table.kx = (state->m_vdp2_vram[address/4 + 19] & 0x00ffffff) | ((state->m_vdp2_vram[address/4 + 19] & 0x00800000) ? 0xff000000 : 0x00000000 ); - stv_current_rotation_parameter_table.ky = (state->m_vdp2_vram[address/4 + 20] & 0x00ffffff) | ((state->m_vdp2_vram[address/4 + 20] & 0x00800000) ? 0xff000000 : 0x00000000 ); - stv_current_rotation_parameter_table.kast = (state->m_vdp2_vram[address/4 + 21] & 0xffffffc0); - stv_current_rotation_parameter_table.dkast= (state->m_vdp2_vram[address/4 + 22] & 0x03ffffc0) | ((state->m_vdp2_vram[address/4 + 22] & 0x02000000) ? 0xfc000000 : 0x00000000 ); - stv_current_rotation_parameter_table.dkax = (state->m_vdp2_vram[address/4 + 23] & 0x03ffffc0) | ((state->m_vdp2_vram[address/4 + 23] & 0x02000000) ? 0xfc000000 : 0x00000000 ); + stv_current_rotation_parameter_table.cz = (m_vdp2_vram[address/4 + 16] & 0x3fff0000) | ((m_vdp2_vram[address/4 + 16] & 0x20000000) ? 0xc0000000 : 0x00000000 ); + stv_current_rotation_parameter_table.mx = (m_vdp2_vram[address/4 + 17] & 0x3fffffc0) | ((m_vdp2_vram[address/4 + 17] & 0x20000000) ? 0xc0000000 : 0x00000000 ); + stv_current_rotation_parameter_table.my = (m_vdp2_vram[address/4 + 18] & 0x3fffffc0) | ((m_vdp2_vram[address/4 + 18] & 0x20000000) ? 0xc0000000 : 0x00000000 ); + stv_current_rotation_parameter_table.kx = (m_vdp2_vram[address/4 + 19] & 0x00ffffff) | ((m_vdp2_vram[address/4 + 19] & 0x00800000) ? 0xff000000 : 0x00000000 ); + stv_current_rotation_parameter_table.ky = (m_vdp2_vram[address/4 + 20] & 0x00ffffff) | ((m_vdp2_vram[address/4 + 20] & 0x00800000) ? 0xff000000 : 0x00000000 ); + stv_current_rotation_parameter_table.kast = (m_vdp2_vram[address/4 + 21] & 0xffffffc0); + stv_current_rotation_parameter_table.dkast= (m_vdp2_vram[address/4 + 22] & 0x03ffffc0) | ((m_vdp2_vram[address/4 + 22] & 0x02000000) ? 0xfc000000 : 0x00000000 ); + stv_current_rotation_parameter_table.dkax = (m_vdp2_vram[address/4 + 23] & 0x03ffffc0) | ((m_vdp2_vram[address/4 + 23] & 0x02000000) ? 0xfc000000 : 0x00000000 ); #define RP stv_current_rotation_parameter_table @@ -2267,10 +2253,10 @@ static void stv_vdp2_fill_rotation_parameter_table( running_machine &machine, UI /*Attempt to show on screen the rotation table*/ 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++; - if(machine.input().code_pressed_once(JOYCODE_Y_DOWN_SWITCH)) + if(machine().input().code_pressed_once(JOYCODE_Y_DOWN_SWITCH)) vdpdebug.roz--; if(vdpdebug.roz > 10) @@ -2334,9 +2320,8 @@ static UINT8 stv_vdp2_are_map_registers_equal(void) return 1; } -static void stv_vdp2_check_fade_control_for_layer(running_machine &machine) +void saturn_state::stv_vdp2_check_fade_control_for_layer( void ) { - saturn_state *state = machine.driver_data(); if ( stv2_current_tilemap.fade_control & 1 ) { if ( stv2_current_tilemap.fade_control & 2 ) @@ -2369,13 +2354,8 @@ static void stv_vdp2_check_fade_control_for_layer(running_machine &machine) #define STV_VDP2_CP_NBG2_CPDR 0x6 #define STV_VDP2_CP_NBG3_CPDR 0x7 -static UINT8 stv_vdp2_check_vram_cycle_pattern_registers( - running_machine &machine, - UINT8 access_command_pnmdr, - UINT8 access_command_cpdr, - UINT8 bitmap_enable ) +UINT8 saturn_state::stv_vdp2_check_vram_cycle_pattern_registers( UINT8 access_command_pnmdr, UINT8 access_command_cpdr, UINT8 bitmap_enable ) { - saturn_state *state = machine.driver_data(); int i; UINT8 access_command_ok = 0; UINT16 cp_regs[8]; @@ -2439,9 +2419,8 @@ INLINE UINT32 stv_add_blend(UINT32 a, UINT32 b) } -static void stv_vdp2_compute_color_offset( running_machine &machine,int *r, int *g, int *b, int cor ) +void saturn_state::stv_vdp2_compute_color_offset( int *r, int *g, int *b, int cor ) { - saturn_state *state = machine.driver_data(); if ( cor == 0 ) { *r = (STV_VDP2_COAR & 0x100) ? (*r - (0x100 - (STV_VDP2_COAR & 0xff))) : ((STV_VDP2_COAR & 0xff) + *r); @@ -2462,9 +2441,8 @@ static void stv_vdp2_compute_color_offset( running_machine &machine,int *r, int if(*b > 0xff) { *b = 0xff; } } -static void stv_vdp2_compute_color_offset_UINT32(running_machine &machine,UINT32 *rgb, int cor) +void saturn_state::stv_vdp2_compute_color_offset_UINT32(UINT32 *rgb, int cor) { - saturn_state *state = machine.driver_data(); int _r = RGB_RED(*rgb); int _g = RGB_GREEN(*rgb); int _b = RGB_BLUE(*rgb); @@ -2490,7 +2468,7 @@ static void stv_vdp2_compute_color_offset_UINT32(running_machine &machine,UINT32 *rgb = MAKE_RGB(_r, _g, _b); } -static void stv_vdp2_drawgfxzoom( +void saturn_state::stv_vdp2_drawgfxzoom( bitmap_rgb32 &dest_bmp,const rectangle &clip,gfx_element *gfx, UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy, int transparency,int transparent_color,int scalex, int scaley, @@ -2681,17 +2659,16 @@ static void stv_vdp2_drawgfxzoom( } -static void stv_vdp2_drawgfxzoom_rgb555( - bitmap_rgb32 &dest_bmp,const rectangle &clip,running_machine &machine, +void saturn_state::stv_vdp2_drawgfxzoom_rgb555( + bitmap_rgb32 &dest_bmp,const rectangle &clip, UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy, int transparency,int transparent_color,int scalex, int scaley, int sprite_screen_width, int sprite_screen_height, int alpha) { - saturn_state *state = machine.driver_data(); rectangle myclip; UINT8* gfxdata; - gfxdata = state->m_vdp2.gfx_decode + code * 0x20; + gfxdata = m_vdp2.gfx_decode + code * 0x20; if (!scalex || !scaley) return; @@ -2809,7 +2786,7 @@ static void stv_vdp2_drawgfxzoom_rgb555( g = pal5bit((data & 0x03e0) >> 5); r = pal5bit( data & 0x001f); if(stv2_current_tilemap.fade_control & 1) - stv_vdp2_compute_color_offset(machine,&r,&g,&b,stv2_current_tilemap.fade_control & 2); + stv_vdp2_compute_color_offset(&r,&g,&b,stv2_current_tilemap.fade_control & 2); dest[x] = MAKE_RGB(r, g, b); x_index += dx; @@ -2836,7 +2813,7 @@ static void stv_vdp2_drawgfxzoom_rgb555( g = pal5bit((data & 0x03e0) >> 5); r = pal5bit( data & 0x001f); if(stv2_current_tilemap.fade_control & 1) - stv_vdp2_compute_color_offset(machine,&r,&g,&b,stv2_current_tilemap.fade_control & 2); + stv_vdp2_compute_color_offset(&r,&g,&b,stv2_current_tilemap.fade_control & 2); if( data ) dest[x] = MAKE_RGB(r, g, b); x_index += dx; @@ -2863,7 +2840,7 @@ static void stv_vdp2_drawgfxzoom_rgb555( g = pal5bit((data & 0x03e0) >> 5); r = pal5bit( data & 0x001f); if(stv2_current_tilemap.fade_control & 1) - stv_vdp2_compute_color_offset(machine,&r,&g,&b,stv2_current_tilemap.fade_control & 2); + stv_vdp2_compute_color_offset(&r,&g,&b,stv2_current_tilemap.fade_control & 2); if( data ) dest[x] = alpha_blend_r32(dest[x], MAKE_RGB(r, g, b), alpha); x_index += dx; @@ -2890,7 +2867,7 @@ static void stv_vdp2_drawgfxzoom_rgb555( g = pal5bit((data & 0x03e0) >> 5); r = pal5bit( data & 0x001f); if(stv2_current_tilemap.fade_control & 1) - stv_vdp2_compute_color_offset(machine,&r,&g,&b,stv2_current_tilemap.fade_control & 2); + stv_vdp2_compute_color_offset(&r,&g,&b,stv2_current_tilemap.fade_control & 2); if( data ) dest[x] = stv_add_blend(dest[x], MAKE_RGB(r, g, b)); x_index += dx; @@ -2907,15 +2884,13 @@ static void stv_vdp2_drawgfxzoom_rgb555( } -static void stv_vdp2_drawgfx_rgb555( bitmap_rgb32 &dest_bmp, const rectangle &clip, running_machine &machine, UINT32 code, int flipx, int flipy, - int sx, int sy, int transparency, int alpha) +void saturn_state::stv_vdp2_drawgfx_rgb555( bitmap_rgb32 &dest_bmp, const rectangle &clip, UINT32 code, int flipx, int flipy, int sx, int sy, int transparency, int alpha) { - saturn_state *state = machine.driver_data(); rectangle myclip; UINT8* gfxdata; int sprite_screen_width, sprite_screen_height; - gfxdata = state->m_vdp2.gfx_decode + code * 0x20; + gfxdata = m_vdp2.gfx_decode + code * 0x20; sprite_screen_width = sprite_screen_height = 8; /* KW 991012 -- Added code to force clip to bitmap boundary */ @@ -2998,7 +2973,7 @@ static void stv_vdp2_drawgfx_rgb555( bitmap_rgb32 &dest_bmp, const rectangle &cl g = pal5bit((data & 0x03e0) >> 5); r = pal5bit( data & 0x001f); if(stv2_current_tilemap.fade_control & 1) - stv_vdp2_compute_color_offset(machine,&r,&g,&b,stv2_current_tilemap.fade_control & 2); + stv_vdp2_compute_color_offset(&r,&g,&b,stv2_current_tilemap.fade_control & 2); if ( transparency == STV_TRANSPARENCY_ALPHA ) dest[x] = alpha_blend_r32( dest[x], MAKE_RGB(r, g, b), alpha ); @@ -3018,15 +2993,14 @@ static void stv_vdp2_drawgfx_rgb555( bitmap_rgb32 &dest_bmp, const rectangle &cl } -static void stv_vdp2_drawgfx_rgb888( bitmap_rgb32 &dest_bmp, const rectangle &clip, running_machine &machine, UINT32 code, int flipx, int flipy, +void saturn_state::stv_vdp2_drawgfx_rgb888( bitmap_rgb32 &dest_bmp, const rectangle &clip, UINT32 code, int flipx, int flipy, int sx, int sy, int transparency, int alpha) { - saturn_state *state = machine.driver_data(); rectangle myclip; UINT8* gfxdata; int sprite_screen_width, sprite_screen_height; - gfxdata = state->m_vdp2.gfx_decode + code * 0x20; + gfxdata = m_vdp2.gfx_decode + code * 0x20; sprite_screen_width = sprite_screen_height = 8; /* KW 991012 -- Added code to force clip to bitmap boundary */ @@ -3110,7 +3084,7 @@ static void stv_vdp2_drawgfx_rgb888( bitmap_rgb32 &dest_bmp, const rectangle &cl r = (data & 0x0000ff); if(stv2_current_tilemap.fade_control & 1) - stv_vdp2_compute_color_offset(machine,&r,&g,&b,stv2_current_tilemap.fade_control & 2); + stv_vdp2_compute_color_offset(&r,&g,&b,stv2_current_tilemap.fade_control & 2); if ( transparency == STV_TRANSPARENCY_ALPHA ) dest[x] = alpha_blend_r32( dest[x], MAKE_RGB(r, g, b), alpha ); @@ -3129,10 +3103,8 @@ static void stv_vdp2_drawgfx_rgb888( bitmap_rgb32 &dest_bmp, const rectangle &cl } -static void stv_vdp2_draw_basic_bitmap(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect) +void saturn_state::stv_vdp2_draw_basic_bitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - saturn_state *state = machine.driver_data(); - // if(LOG_VDP2) logerror ("bitmap enable %02x size %08x depth %08x\n", stv2_current_tilemap.layer_name, stv2_current_tilemap.bitmap_size, stv2_current_tilemap.colour_depth); // popmessage ("bitmap enable %02x size %08x depth %08x number %02x", stv2_current_tilemap.layer_name, stv2_current_tilemap.bitmap_size, stv2_current_tilemap.colour_depth,stv2_current_tilemap.bitmap_palette_number); //popmessage("%04x",STV_VDP2_SCRCTL); @@ -3141,7 +3113,7 @@ static void stv_vdp2_draw_basic_bitmap(running_machine &machine, bitmap_rgb32 &b int ysize = 0/*, ysizemask = 0*/; int xlinesize = 0/*, xpixelsize = 0*/; int xcnt,ycnt; - UINT8* gfxdata = state->m_vdp2.gfx_decode; + UINT8* gfxdata = m_vdp2.gfx_decode; UINT32 *destline; UINT16 pal_color_offset = 0; UINT8* gfxdatalow, *gfxdatahigh; @@ -3195,8 +3167,8 @@ static void stv_vdp2_draw_basic_bitmap(running_machine &machine, bitmap_rgb32 &b stv2_current_tilemap.bitmap_palette_number+=stv2_current_tilemap.colour_ram_address_offset; stv2_current_tilemap.bitmap_palette_number&=7;//safety check - screen_x = machine.primary_screen->visible_area().max_x; - screen_y = machine.primary_screen->visible_area().max_y; + screen_x = machine().primary_screen->visible_area().max_x; + screen_y = machine().primary_screen->visible_area().max_y; switch(stv2_current_tilemap.colour_depth) { @@ -3206,29 +3178,29 @@ static void stv_vdp2_draw_basic_bitmap(running_machine &machine, bitmap_rgb32 &b { for (xcnt = 0; xcnt > 0) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset]; + bitmap.pix32(ycnt, xcnt+1) = machine().pens[((gfxdata[0] & 0x0f) >> 0) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset]; else - bitmap.pix32(ycnt, xcnt+1) = alpha_blend_r32(bitmap.pix32(ycnt, xcnt+1), machine.pens[((gfxdata[0] & 0x0f) >> 0) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset], stv2_current_tilemap.alpha); + bitmap.pix32(ycnt, xcnt+1) = alpha_blend_r32(bitmap.pix32(ycnt, xcnt+1), machine().pens[((gfxdata[0] & 0x0f) >> 0) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset], stv2_current_tilemap.alpha); } } } - if (!stv_vdp2_window_process(machine,xcnt,ycnt)) + if (!stv_vdp2_window_process(xcnt,ycnt)) { if ((gfxdata[0] & 0xf0) || (stv2_current_tilemap.transparency == STV_TRANSPARENCY_NONE)) { if (((xcnt + 0) <= screen_x) && (ycnt <= screen_y)) { if ( stv2_current_tilemap.colour_calculation_enabled == 0 ) - bitmap.pix32(ycnt, xcnt) = machine.pens[((gfxdata[0] & 0xf0) >> 4) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset]; + bitmap.pix32(ycnt, xcnt) = machine().pens[((gfxdata[0] & 0xf0) >> 4) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset]; else - bitmap.pix32(ycnt, xcnt) = alpha_blend_r32(bitmap.pix32(ycnt, xcnt), machine.pens[((gfxdata[0] & 0xf0) >> 4) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset], stv2_current_tilemap.alpha); + bitmap.pix32(ycnt, xcnt) = alpha_blend_r32(bitmap.pix32(ycnt, xcnt), machine().pens[((gfxdata[0] & 0xf0) >> 4) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset], stv2_current_tilemap.alpha); } } } @@ -3250,7 +3222,7 @@ static void stv_vdp2_draw_basic_bitmap(running_machine &machine, bitmap_rgb32 &b { int xs = xcnt & xsizemask; - if (!stv_vdp2_window_process(machine,xcnt,ycnt)) + if (!stv_vdp2_window_process(xcnt,ycnt)) { //60aee2c = $0013 at @605d838 if ((gfxdata[xs] & 0xff) || (stv2_current_tilemap.transparency == STV_TRANSPARENCY_NONE)) @@ -3258,9 +3230,9 @@ static void stv_vdp2_draw_basic_bitmap(running_machine &machine, bitmap_rgb32 &b if (((xcnt + 0) <= screen_x) && (ycnt <= screen_y)) { if ( stv2_current_tilemap.colour_calculation_enabled == 0 ) - bitmap.pix32(ycnt, xcnt) = machine.pens[(gfxdata[xs] & 0xff) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset]; + bitmap.pix32(ycnt, xcnt) = machine().pens[(gfxdata[xs] & 0xff) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset]; else - bitmap.pix32(ycnt, xcnt) = alpha_blend_r32(bitmap.pix32(ycnt, xcnt), machine.pens[(gfxdata[xs] & 0xff) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset], stv2_current_tilemap.alpha); + bitmap.pix32(ycnt, xcnt) = alpha_blend_r32(bitmap.pix32(ycnt, xcnt), machine().pens[(gfxdata[xs] & 0xff) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset], stv2_current_tilemap.alpha); } } } @@ -3293,16 +3265,16 @@ static void stv_vdp2_draw_basic_bitmap(running_machine &machine, bitmap_rgb32 &b for (xcnt = cliprect.min_x; xcnt <= cliprect.max_x; xx+=stv2_current_tilemap.incx, xcnt++) { xs = xx >> 16; - if (!stv_vdp2_window_process(machine,xcnt,ycnt)) + if (!stv_vdp2_window_process(xcnt,ycnt)) { if ((gfxdata[xs] & 0xff) || (stv2_current_tilemap.transparency == STV_TRANSPARENCY_NONE)) { if (((xcnt + 0) <= screen_x) && (ycnt <= screen_y)) { if ( stv2_current_tilemap.colour_calculation_enabled == 0 ) - bitmap.pix32(ycnt, xcnt) = machine.pens[(gfxdata[xs] & 0xff) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset]; + bitmap.pix32(ycnt, xcnt) = machine().pens[(gfxdata[xs] & 0xff) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset]; else - bitmap.pix32(ycnt, xcnt) = alpha_blend_r32(bitmap.pix32(ycnt, xcnt), machine.pens[(gfxdata[xs] & 0xff) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset], stv2_current_tilemap.alpha); + bitmap.pix32(ycnt, xcnt) = alpha_blend_r32(bitmap.pix32(ycnt, xcnt), machine().pens[(gfxdata[xs] & 0xff) | (stv2_current_tilemap.bitmap_palette_number * 0x100) | pal_color_offset], stv2_current_tilemap.alpha); } } } @@ -3318,16 +3290,16 @@ static void stv_vdp2_draw_basic_bitmap(running_machine &machine, bitmap_rgb32 &b { for (xcnt = 0; xcnt > 5)); r = pal5bit(gfxdata[2*xs+1] & 0x1f); if(stv2_current_tilemap.fade_control & 1) - stv_vdp2_compute_color_offset(machine,&r,&g,&b,stv2_current_tilemap.fade_control & 2); + stv_vdp2_compute_color_offset(&r,&g,&b,stv2_current_tilemap.fade_control & 2); - if (!stv_vdp2_window_process(machine,xcnt,ycnt)) + if (!stv_vdp2_window_process(xcnt,ycnt)) { if (((xcnt + 0) <= screen_x) && (ycnt <= screen_y)) { @@ -3407,9 +3379,9 @@ static void stv_vdp2_draw_basic_bitmap(running_machine &machine, bitmap_rgb32 &b g = pal5bit(((gfxdata[2*xs] & 0x03) << 3) | ((gfxdata[2*xs+1] & 0xe0) >> 5)); r = pal5bit(gfxdata[2*xs+1] & 0x1f); if(stv2_current_tilemap.fade_control & 1) - stv_vdp2_compute_color_offset(machine, &r,&g,&b,stv2_current_tilemap.fade_control & 2); + stv_vdp2_compute_color_offset( &r,&g,&b,stv2_current_tilemap.fade_control & 2); - if (!stv_vdp2_window_process(machine,xcnt,ycnt)) + if (!stv_vdp2_window_process(xcnt,ycnt)) { if ((gfxdata[2*xs] & 0x80) || (stv2_current_tilemap.transparency == STV_TRANSPARENCY_NONE)) { @@ -3460,9 +3432,9 @@ static void stv_vdp2_draw_basic_bitmap(running_machine &machine, bitmap_rgb32 &b r = ((dot_data & 0x000000ff) >> 0); if(stv2_current_tilemap.fade_control & 1) - stv_vdp2_compute_color_offset(machine,&r,&g,&b,stv2_current_tilemap.fade_control & 2); + stv_vdp2_compute_color_offset(&r,&g,&b,stv2_current_tilemap.fade_control & 2); - if (!stv_vdp2_window_process(machine,xcnt,ycnt)) + if (!stv_vdp2_window_process(xcnt,ycnt)) { if (((xcnt + 0) <= screen_x) && (ycnt <= screen_y)) { @@ -3653,9 +3625,8 @@ static void stv_vdp2_get_map_page( int x, int y, int *_map, int *_page ) *_map = map; } -static void stv_vdp2_draw_basic_tilemap(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect) +void saturn_state::stv_vdp2_draw_basic_tilemap(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - saturn_state *state = machine.driver_data(); /* hopefully this is easier to follow than it is efficient .. */ /* I call character patterns tiles .. even if they represent up to 4 tiles */ @@ -3934,7 +3905,7 @@ static void stv_vdp2_draw_basic_tilemap(running_machine &machine, bitmap_rgb32 & /* 1 word per tile mode with supplement bits */ if (stv2_current_tilemap.pattern_data_size ==1) { - data = state->m_vdp2_vram[newbase + offs/2]; + data = m_vdp2_vram[newbase + offs/2]; data = (offs&1) ? (data & 0x0000ffff) : ((data & 0xffff0000) >> 16); /* Supplement Mode 12 bits, no flip */ @@ -3959,7 +3930,7 @@ static void stv_vdp2_draw_basic_tilemap(running_machine &machine, bitmap_rgb32 & /* 2 words per tile, no supplement bits */ else { - data = state->m_vdp2_vram[newbase + offs]; + data = m_vdp2_vram[newbase + offs]; tilecode = (data & 0x00007fff); pal = (data & 0x007f0000)>>16; // specialc = (data & 0x10000000)>>28; @@ -4018,18 +3989,18 @@ static void stv_vdp2_draw_basic_tilemap(running_machine &machine, bitmap_rgb32 & else if ( stv2_current_tilemap.colour_depth == 3 ) { /* RGB555 */ - stv_vdp2_drawgfxzoom_rgb555(bitmap,cliprect,machine,tilecode+(0+(flipyx&1)+(flipyx&2))*tilecodespacing,pal,flipyx&1,flipyx&2,drawxpos >> 16, drawypos >> 16,stv2_current_tilemap.transparency,0,scalex,scaley,SCR_TILESIZE_X, SCR_TILESIZE_Y,stv2_current_tilemap.alpha); - stv_vdp2_drawgfxzoom_rgb555(bitmap,cliprect,machine,tilecode+(1-(flipyx&1)+(flipyx&2))*tilecodespacing,pal,flipyx&1,flipyx&2,(drawxpos+tilesizex) >> 16,drawypos >> 16,stv2_current_tilemap.transparency,0,scalex,scaley,SCR_TILESIZE_X1(tilesizex), SCR_TILESIZE_Y,stv2_current_tilemap.alpha); - stv_vdp2_drawgfxzoom_rgb555(bitmap,cliprect,machine,tilecode+(2+(flipyx&1)-(flipyx&2))*tilecodespacing,pal,flipyx&1,flipyx&2,drawxpos >> 16,(drawypos+tilesizey) >> 16,stv2_current_tilemap.transparency,0,scalex,scaley,SCR_TILESIZE_X, SCR_TILESIZE_Y1(tilesizey),stv2_current_tilemap.alpha); - stv_vdp2_drawgfxzoom_rgb555(bitmap,cliprect,machine,tilecode+(3-(flipyx&1)-(flipyx&2))*tilecodespacing,pal,flipyx&1,flipyx&2,(drawxpos+tilesizex)>> 16,(drawypos+tilesizey) >> 16,stv2_current_tilemap.transparency,0,scalex,scaley,SCR_TILESIZE_X1(tilesizex), SCR_TILESIZE_Y1(tilesizey),stv2_current_tilemap.alpha); + stv_vdp2_drawgfxzoom_rgb555(bitmap,cliprect,tilecode+(0+(flipyx&1)+(flipyx&2))*tilecodespacing,pal,flipyx&1,flipyx&2,drawxpos >> 16, drawypos >> 16,stv2_current_tilemap.transparency,0,scalex,scaley,SCR_TILESIZE_X, SCR_TILESIZE_Y,stv2_current_tilemap.alpha); + stv_vdp2_drawgfxzoom_rgb555(bitmap,cliprect,tilecode+(1-(flipyx&1)+(flipyx&2))*tilecodespacing,pal,flipyx&1,flipyx&2,(drawxpos+tilesizex) >> 16,drawypos >> 16,stv2_current_tilemap.transparency,0,scalex,scaley,SCR_TILESIZE_X1(tilesizex), SCR_TILESIZE_Y,stv2_current_tilemap.alpha); + stv_vdp2_drawgfxzoom_rgb555(bitmap,cliprect,tilecode+(2+(flipyx&1)-(flipyx&2))*tilecodespacing,pal,flipyx&1,flipyx&2,drawxpos >> 16,(drawypos+tilesizey) >> 16,stv2_current_tilemap.transparency,0,scalex,scaley,SCR_TILESIZE_X, SCR_TILESIZE_Y1(tilesizey),stv2_current_tilemap.alpha); + stv_vdp2_drawgfxzoom_rgb555(bitmap,cliprect,tilecode+(3-(flipyx&1)-(flipyx&2))*tilecodespacing,pal,flipyx&1,flipyx&2,(drawxpos+tilesizex)>> 16,(drawypos+tilesizey) >> 16,stv2_current_tilemap.transparency,0,scalex,scaley,SCR_TILESIZE_X1(tilesizex), SCR_TILESIZE_Y1(tilesizey),stv2_current_tilemap.alpha); } else { /* normal */ - stv_vdp2_drawgfxzoom(bitmap,cliprect,machine.gfx[gfx],tilecode+(0+(flipyx&1)+(flipyx&2))*tilecodespacing,pal,flipyx&1,flipyx&2,drawxpos >> 16, drawypos >> 16,stv2_current_tilemap.transparency,0,scalex,scaley,SCR_TILESIZE_X, SCR_TILESIZE_Y,stv2_current_tilemap.alpha); - stv_vdp2_drawgfxzoom(bitmap,cliprect,machine.gfx[gfx],tilecode+(1-(flipyx&1)+(flipyx&2))*tilecodespacing,pal,flipyx&1,flipyx&2,(drawxpos+tilesizex) >> 16,drawypos >> 16,stv2_current_tilemap.transparency,0,scalex,scaley,SCR_TILESIZE_X1(tilesizex), SCR_TILESIZE_Y,stv2_current_tilemap.alpha); - stv_vdp2_drawgfxzoom(bitmap,cliprect,machine.gfx[gfx],tilecode+(2+(flipyx&1)-(flipyx&2))*tilecodespacing,pal,flipyx&1,flipyx&2,drawxpos >> 16,(drawypos+tilesizey) >> 16,stv2_current_tilemap.transparency,0,scalex,scaley,SCR_TILESIZE_X, SCR_TILESIZE_Y1(tilesizey),stv2_current_tilemap.alpha); - stv_vdp2_drawgfxzoom(bitmap,cliprect,machine.gfx[gfx],tilecode+(3-(flipyx&1)-(flipyx&2))*tilecodespacing,pal,flipyx&1,flipyx&2,(drawxpos+tilesizex)>> 16,(drawypos+tilesizey) >> 16,stv2_current_tilemap.transparency,0,scalex,scaley,SCR_TILESIZE_X1(tilesizex), SCR_TILESIZE_Y1(tilesizey),stv2_current_tilemap.alpha); + stv_vdp2_drawgfxzoom(bitmap,cliprect,machine().gfx[gfx],tilecode+(0+(flipyx&1)+(flipyx&2))*tilecodespacing,pal,flipyx&1,flipyx&2,drawxpos >> 16, drawypos >> 16,stv2_current_tilemap.transparency,0,scalex,scaley,SCR_TILESIZE_X, SCR_TILESIZE_Y,stv2_current_tilemap.alpha); + stv_vdp2_drawgfxzoom(bitmap,cliprect,machine().gfx[gfx],tilecode+(1-(flipyx&1)+(flipyx&2))*tilecodespacing,pal,flipyx&1,flipyx&2,(drawxpos+tilesizex) >> 16,drawypos >> 16,stv2_current_tilemap.transparency,0,scalex,scaley,SCR_TILESIZE_X1(tilesizex), SCR_TILESIZE_Y,stv2_current_tilemap.alpha); + stv_vdp2_drawgfxzoom(bitmap,cliprect,machine().gfx[gfx],tilecode+(2+(flipyx&1)-(flipyx&2))*tilecodespacing,pal,flipyx&1,flipyx&2,drawxpos >> 16,(drawypos+tilesizey) >> 16,stv2_current_tilemap.transparency,0,scalex,scaley,SCR_TILESIZE_X, SCR_TILESIZE_Y1(tilesizey),stv2_current_tilemap.alpha); + stv_vdp2_drawgfxzoom(bitmap,cliprect,machine().gfx[gfx],tilecode+(3-(flipyx&1)-(flipyx&2))*tilecodespacing,pal,flipyx&1,flipyx&2,(drawxpos+tilesizex)>> 16,(drawypos+tilesizey) >> 16,stv2_current_tilemap.transparency,0,scalex,scaley,SCR_TILESIZE_X1(tilesizex), SCR_TILESIZE_Y1(tilesizey),stv2_current_tilemap.alpha); } } else @@ -4038,10 +4009,10 @@ static void stv_vdp2_draw_basic_tilemap(running_machine &machine, bitmap_rgb32 & popmessage("Unsupported tilemap gfx zoom color depth = 4, tile size = 0, contact MAMEdev"); else if ( stv2_current_tilemap.colour_depth == 3) { - stv_vdp2_drawgfxzoom_rgb555(bitmap,cliprect,machine,tilecode,pal,flipyx&1,flipyx&2, drawxpos >> 16, drawypos >> 16,stv2_current_tilemap.transparency,0,scalex,scaley,SCR_TILESIZE_X,SCR_TILESIZE_Y,stv2_current_tilemap.alpha); + stv_vdp2_drawgfxzoom_rgb555(bitmap,cliprect,tilecode,pal,flipyx&1,flipyx&2, drawxpos >> 16, drawypos >> 16,stv2_current_tilemap.transparency,0,scalex,scaley,SCR_TILESIZE_X,SCR_TILESIZE_Y,stv2_current_tilemap.alpha); } else - stv_vdp2_drawgfxzoom(bitmap,cliprect,machine.gfx[gfx],tilecode,pal,flipyx&1,flipyx&2, drawxpos >> 16, drawypos >> 16,stv2_current_tilemap.transparency,0,scalex,scaley,SCR_TILESIZE_X,SCR_TILESIZE_Y,stv2_current_tilemap.alpha); + stv_vdp2_drawgfxzoom(bitmap,cliprect,machine().gfx[gfx],tilecode,pal,flipyx&1,flipyx&2, drawxpos >> 16, drawypos >> 16,stv2_current_tilemap.transparency,0,scalex,scaley,SCR_TILESIZE_X,SCR_TILESIZE_Y,stv2_current_tilemap.alpha); } } else @@ -4054,52 +4025,52 @@ static void stv_vdp2_draw_basic_tilemap(running_machine &machine, bitmap_rgb32 & if ( stv2_current_tilemap.colour_depth == 4 ) { /* normal */ - stv_vdp2_drawgfx_rgb888(bitmap,cliprect,machine,tilecode+(0+(flipyx&1)+(flipyx&2))*4,flipyx&1,flipyx&2,drawxpos, drawypos,stv2_current_tilemap.transparency,stv2_current_tilemap.alpha); - stv_vdp2_drawgfx_rgb888(bitmap,cliprect,machine,tilecode+(1-(flipyx&1)+(flipyx&2))*4,flipyx&1,flipyx&2,drawxpos+8,drawypos,stv2_current_tilemap.transparency,stv2_current_tilemap.alpha); - stv_vdp2_drawgfx_rgb888(bitmap,cliprect,machine,tilecode+(2+(flipyx&1)-(flipyx&2))*4,flipyx&1,flipyx&2,drawxpos,drawypos+8,stv2_current_tilemap.transparency,stv2_current_tilemap.alpha); - stv_vdp2_drawgfx_rgb888(bitmap,cliprect,machine,tilecode+(3-(flipyx&1)-(flipyx&2))*4,flipyx&1,flipyx&2,drawxpos+8,drawypos+8,stv2_current_tilemap.transparency,stv2_current_tilemap.alpha); + stv_vdp2_drawgfx_rgb888(bitmap,cliprect,tilecode+(0+(flipyx&1)+(flipyx&2))*4,flipyx&1,flipyx&2,drawxpos, drawypos,stv2_current_tilemap.transparency,stv2_current_tilemap.alpha); + stv_vdp2_drawgfx_rgb888(bitmap,cliprect,tilecode+(1-(flipyx&1)+(flipyx&2))*4,flipyx&1,flipyx&2,drawxpos+8,drawypos,stv2_current_tilemap.transparency,stv2_current_tilemap.alpha); + stv_vdp2_drawgfx_rgb888(bitmap,cliprect,tilecode+(2+(flipyx&1)-(flipyx&2))*4,flipyx&1,flipyx&2,drawxpos,drawypos+8,stv2_current_tilemap.transparency,stv2_current_tilemap.alpha); + stv_vdp2_drawgfx_rgb888(bitmap,cliprect,tilecode+(3-(flipyx&1)-(flipyx&2))*4,flipyx&1,flipyx&2,drawxpos+8,drawypos+8,stv2_current_tilemap.transparency,stv2_current_tilemap.alpha); } else if ( stv2_current_tilemap.colour_depth == 3 ) { /* normal */ - stv_vdp2_drawgfx_rgb555(bitmap,cliprect,machine,tilecode+(0+(flipyx&1)+(flipyx&2))*4,flipyx&1,flipyx&2,drawxpos, drawypos,stv2_current_tilemap.transparency,stv2_current_tilemap.alpha); - stv_vdp2_drawgfx_rgb555(bitmap,cliprect,machine,tilecode+(1-(flipyx&1)+(flipyx&2))*4,flipyx&1,flipyx&2,drawxpos+8,drawypos,stv2_current_tilemap.transparency,stv2_current_tilemap.alpha); - stv_vdp2_drawgfx_rgb555(bitmap,cliprect,machine,tilecode+(2+(flipyx&1)-(flipyx&2))*4,flipyx&1,flipyx&2,drawxpos,drawypos+8,stv2_current_tilemap.transparency,stv2_current_tilemap.alpha); - stv_vdp2_drawgfx_rgb555(bitmap,cliprect,machine,tilecode+(3-(flipyx&1)-(flipyx&2))*4,flipyx&1,flipyx&2,drawxpos+8,drawypos+8,stv2_current_tilemap.transparency,stv2_current_tilemap.alpha); + stv_vdp2_drawgfx_rgb555(bitmap,cliprect,tilecode+(0+(flipyx&1)+(flipyx&2))*4,flipyx&1,flipyx&2,drawxpos, drawypos,stv2_current_tilemap.transparency,stv2_current_tilemap.alpha); + stv_vdp2_drawgfx_rgb555(bitmap,cliprect,tilecode+(1-(flipyx&1)+(flipyx&2))*4,flipyx&1,flipyx&2,drawxpos+8,drawypos,stv2_current_tilemap.transparency,stv2_current_tilemap.alpha); + stv_vdp2_drawgfx_rgb555(bitmap,cliprect,tilecode+(2+(flipyx&1)-(flipyx&2))*4,flipyx&1,flipyx&2,drawxpos,drawypos+8,stv2_current_tilemap.transparency,stv2_current_tilemap.alpha); + stv_vdp2_drawgfx_rgb555(bitmap,cliprect,tilecode+(3-(flipyx&1)-(flipyx&2))*4,flipyx&1,flipyx&2,drawxpos+8,drawypos+8,stv2_current_tilemap.transparency,stv2_current_tilemap.alpha); } else if (stv2_current_tilemap.transparency == STV_TRANSPARENCY_ALPHA) { /* alpha */ - drawgfx_alpha(bitmap,cliprect,machine.gfx[gfx],tilecode+(0+(flipyx&1)+(flipyx&2))*tilecodespacing,pal,flipyx&1,flipyx&2,drawxpos, drawypos,0,stv2_current_tilemap.alpha); - drawgfx_alpha(bitmap,cliprect,machine.gfx[gfx],tilecode+(1-(flipyx&1)+(flipyx&2))*tilecodespacing,pal,flipyx&1,flipyx&2,drawxpos+8,drawypos,0,stv2_current_tilemap.alpha); - drawgfx_alpha(bitmap,cliprect,machine.gfx[gfx],tilecode+(2+(flipyx&1)-(flipyx&2))*tilecodespacing,pal,flipyx&1,flipyx&2,drawxpos,drawypos+8,0,stv2_current_tilemap.alpha); - drawgfx_alpha(bitmap,cliprect,machine.gfx[gfx],tilecode+(3-(flipyx&1)-(flipyx&2))*tilecodespacing,pal,flipyx&1,flipyx&2,drawxpos+8,drawypos+8,0,stv2_current_tilemap.alpha); + drawgfx_alpha(bitmap,cliprect,machine().gfx[gfx],tilecode+(0+(flipyx&1)+(flipyx&2))*tilecodespacing,pal,flipyx&1,flipyx&2,drawxpos, drawypos,0,stv2_current_tilemap.alpha); + drawgfx_alpha(bitmap,cliprect,machine().gfx[gfx],tilecode+(1-(flipyx&1)+(flipyx&2))*tilecodespacing,pal,flipyx&1,flipyx&2,drawxpos+8,drawypos,0,stv2_current_tilemap.alpha); + drawgfx_alpha(bitmap,cliprect,machine().gfx[gfx],tilecode+(2+(flipyx&1)-(flipyx&2))*tilecodespacing,pal,flipyx&1,flipyx&2,drawxpos,drawypos+8,0,stv2_current_tilemap.alpha); + drawgfx_alpha(bitmap,cliprect,machine().gfx[gfx],tilecode+(3-(flipyx&1)-(flipyx&2))*tilecodespacing,pal,flipyx&1,flipyx&2,drawxpos+8,drawypos+8,0,stv2_current_tilemap.alpha); } else { /* normal */ - drawgfx_transpen(bitmap,cliprect,machine.gfx[gfx],tilecode+(0+(flipyx&1)+(flipyx&2))*tilecodespacing,pal,flipyx&1,flipyx&2,drawxpos, drawypos,(stv2_current_tilemap.transparency==STV_TRANSPARENCY_PEN)?0:-1); - drawgfx_transpen(bitmap,cliprect,machine.gfx[gfx],tilecode+(1-(flipyx&1)+(flipyx&2))*tilecodespacing,pal,flipyx&1,flipyx&2,drawxpos+8,drawypos,(stv2_current_tilemap.transparency==STV_TRANSPARENCY_PEN)?0:-1); - drawgfx_transpen(bitmap,cliprect,machine.gfx[gfx],tilecode+(2+(flipyx&1)-(flipyx&2))*tilecodespacing,pal,flipyx&1,flipyx&2,drawxpos,drawypos+8,(stv2_current_tilemap.transparency==STV_TRANSPARENCY_PEN)?0:-1); - drawgfx_transpen(bitmap,cliprect,machine.gfx[gfx],tilecode+(3-(flipyx&1)-(flipyx&2))*tilecodespacing,pal,flipyx&1,flipyx&2,drawxpos+8,drawypos+8,(stv2_current_tilemap.transparency==STV_TRANSPARENCY_PEN)?0:-1); + drawgfx_transpen(bitmap,cliprect,machine().gfx[gfx],tilecode+(0+(flipyx&1)+(flipyx&2))*tilecodespacing,pal,flipyx&1,flipyx&2,drawxpos, drawypos,(stv2_current_tilemap.transparency==STV_TRANSPARENCY_PEN)?0:-1); + drawgfx_transpen(bitmap,cliprect,machine().gfx[gfx],tilecode+(1-(flipyx&1)+(flipyx&2))*tilecodespacing,pal,flipyx&1,flipyx&2,drawxpos+8,drawypos,(stv2_current_tilemap.transparency==STV_TRANSPARENCY_PEN)?0:-1); + drawgfx_transpen(bitmap,cliprect,machine().gfx[gfx],tilecode+(2+(flipyx&1)-(flipyx&2))*tilecodespacing,pal,flipyx&1,flipyx&2,drawxpos,drawypos+8,(stv2_current_tilemap.transparency==STV_TRANSPARENCY_PEN)?0:-1); + drawgfx_transpen(bitmap,cliprect,machine().gfx[gfx],tilecode+(3-(flipyx&1)-(flipyx&2))*tilecodespacing,pal,flipyx&1,flipyx&2,drawxpos+8,drawypos+8,(stv2_current_tilemap.transparency==STV_TRANSPARENCY_PEN)?0:-1); } } else { if ( stv2_current_tilemap.colour_depth == 4) { - stv_vdp2_drawgfx_rgb888(bitmap,cliprect,machine,tilecode,flipyx&1,flipyx&2,drawxpos,drawypos,stv2_current_tilemap.transparency,stv2_current_tilemap.alpha); + stv_vdp2_drawgfx_rgb888(bitmap,cliprect,tilecode,flipyx&1,flipyx&2,drawxpos,drawypos,stv2_current_tilemap.transparency,stv2_current_tilemap.alpha); } else if ( stv2_current_tilemap.colour_depth == 3) { - stv_vdp2_drawgfx_rgb555(bitmap,cliprect,machine,tilecode,flipyx&1,flipyx&2,drawxpos,drawypos,stv2_current_tilemap.transparency,stv2_current_tilemap.alpha); + stv_vdp2_drawgfx_rgb555(bitmap,cliprect,tilecode,flipyx&1,flipyx&2,drawxpos,drawypos,stv2_current_tilemap.transparency,stv2_current_tilemap.alpha); } else { if (stv2_current_tilemap.transparency == STV_TRANSPARENCY_ALPHA) - drawgfx_alpha(bitmap,cliprect,machine.gfx[gfx],tilecode,pal,flipyx&1,flipyx&2, drawxpos, drawypos,0,stv2_current_tilemap.alpha); + drawgfx_alpha(bitmap,cliprect,machine().gfx[gfx],tilecode,pal,flipyx&1,flipyx&2, drawxpos, drawypos,0,stv2_current_tilemap.alpha); else - drawgfx_transpen(bitmap,cliprect,machine.gfx[gfx],tilecode,pal,flipyx&1,flipyx&2, drawxpos, drawypos,(stv2_current_tilemap.transparency==STV_TRANSPARENCY_PEN)?0:-1); + drawgfx_transpen(bitmap,cliprect,machine().gfx[gfx],tilecode,pal,flipyx&1,flipyx&2, drawxpos, drawypos,(stv2_current_tilemap.transparency==STV_TRANSPARENCY_PEN)?0:-1); } } drawxpos = olddrawxpos; @@ -4154,15 +4125,14 @@ static void stv_vdp2_draw_basic_tilemap(running_machine &machine, bitmap_rgb32 & #define STV_VDP2_READ_VERTICAL_LINESCROLL( _val, _address ) \ { \ - _val = state->m_vdp2_vram[ _address ]; \ + _val = m_vdp2_vram[ _address ]; \ _val &= 0x07ffff00; \ if ( _val & 0x04000000 ) _val |= 0xf8000000; \ } -static void stv_vdp2_check_tilemap_with_linescroll(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect) +void saturn_state::stv_vdp2_check_tilemap_with_linescroll(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - saturn_state *state = machine.driver_data(); rectangle mycliprect; int cur_line = cliprect.min_y; int address; @@ -4214,7 +4184,7 @@ static void stv_vdp2_check_tilemap_with_linescroll(running_machine &machine, bit } else { - prev_scroll_values[i] = state->m_vdp2_vram[ (address / 4) + i ]; + prev_scroll_values[i] = m_vdp2_vram[ (address / 4) + i ]; } } @@ -4239,7 +4209,7 @@ static void stv_vdp2_check_tilemap_with_linescroll(running_machine &machine, bit } else { - scroll_values[i] = state->m_vdp2_vram[ (address / 4) + i ]; + scroll_values[i] = m_vdp2_vram[ (address / 4) + i ]; } } @@ -4284,7 +4254,7 @@ static void stv_vdp2_check_tilemap_with_linescroll(running_machine &machine, bit // if ( LOG_VDP2 ) logerror( "Linescroll: y < %d, %d >, scrollx = %d, scrolly = %d, incx = %f\n", mycliprect.min_y, mycliprect.max_y, stv2_current_tilemap.scrollx, stv2_current_tilemap.scrolly, (float)stv2_current_tilemap.incx/65536.0 ); // render current tilemap portion - stv_vdp2_apply_window_on_layer(machine,mycliprect); + stv_vdp2_apply_window_on_layer(mycliprect); if (stv2_current_tilemap.bitmap_enable) // this layer is a bitmap { @@ -4292,11 +4262,11 @@ static void stv_vdp2_check_tilemap_with_linescroll(running_machine &machine, bit //if ( window_applied && stv2_current_tilemap.colour_depth != 4) // stv2_current_tilemap.window_control = 0; - stv_vdp2_draw_basic_bitmap(machine, bitmap, mycliprect); + stv_vdp2_draw_basic_bitmap(bitmap, mycliprect); } else { - stv_vdp2_draw_basic_tilemap(machine, bitmap, mycliprect); + stv_vdp2_draw_basic_tilemap(bitmap, mycliprect); } // update parameters for next iteration @@ -4305,11 +4275,10 @@ static void stv_vdp2_check_tilemap_with_linescroll(running_machine &machine, bit } } -static void stv_vdp2_draw_line(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect) +void saturn_state::stv_vdp2_draw_line(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - saturn_state *state = machine.driver_data(); int x,y; - UINT8* gfxdata = state->m_vdp2.gfx_decode; + UINT8* gfxdata = m_vdp2.gfx_decode; UINT32 base_offs,base_mask; UINT32 pix; UINT8 interlace; @@ -4333,15 +4302,14 @@ static void stv_vdp2_draw_line(running_machine &machine, bitmap_rgb32 &bitmap, c pen = (gfxdata[base_offs+0]<<8)|gfxdata[base_offs+1]; pix = bitmap.pix32(y, x); - bitmap.pix32(y, x) = stv_add_blend(machine.pens[pen & 0x7ff],pix); + bitmap.pix32(y, x) = stv_add_blend(machine().pens[pen & 0x7ff],pix); } } } } -static void stv_vdp2_draw_mosaic(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT8 is_roz) +void saturn_state::stv_vdp2_draw_mosaic(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT8 is_roz) { - saturn_state *state = machine.driver_data(); int x,y,xi,yi; UINT8 h_size,v_size; UINT32 pix; @@ -4371,12 +4339,10 @@ static void stv_vdp2_draw_mosaic(running_machine &machine, bitmap_rgb32 &bitmap, } } -static void stv_vdp2_check_tilemap(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect) +void saturn_state::stv_vdp2_check_tilemap(bitmap_rgb32 &bitmap, const rectangle &cliprect) { /* the idea is here we check the tilemap capabilities / whats enabled and call an appropriate tilemap drawing routine, or at the very list throw up a few errors if the tilemaps want to do something we don't support yet */ - saturn_state *state = machine.driver_data(); - // int window_applied = 0; rectangle mycliprect = cliprect; @@ -4384,12 +4350,12 @@ static void stv_vdp2_check_tilemap(running_machine &machine, bitmap_rgb32 &bitma stv2_current_tilemap.vertical_linescroll_enable || stv2_current_tilemap.linezoom_enable ) { - stv_vdp2_check_tilemap_with_linescroll(machine, bitmap, cliprect); + stv_vdp2_check_tilemap_with_linescroll(bitmap, cliprect); return; } // window_applied = - stv_vdp2_apply_window_on_layer(machine,mycliprect); + stv_vdp2_apply_window_on_layer(mycliprect); if (stv2_current_tilemap.bitmap_enable) // this layer is a bitmap { @@ -4397,19 +4363,19 @@ static void stv_vdp2_check_tilemap(running_machine &machine, bitmap_rgb32 &bitma //if ( window_applied && stv2_current_tilemap.colour_depth != 4) // stv2_current_tilemap.window_control = 0; - stv_vdp2_draw_basic_bitmap(machine, bitmap, mycliprect); + stv_vdp2_draw_basic_bitmap(bitmap, mycliprect); } else { - stv_vdp2_draw_basic_tilemap(machine, bitmap, mycliprect); + stv_vdp2_draw_basic_tilemap(bitmap, mycliprect); } /* post-processing functions (TODO: needs layer bitmaps to be individual planes to work correctly) */ if(stv2_current_tilemap.line_screen_enabled && TEST_FUNCTIONS) - stv_vdp2_draw_line(machine,bitmap,cliprect); + stv_vdp2_draw_line(bitmap,cliprect); if(stv2_current_tilemap.mosaic_screen_enabled && TEST_FUNCTIONS) - stv_vdp2_draw_mosaic(machine,bitmap,cliprect,stv2_current_tilemap.layer_name & 0x80); + stv_vdp2_draw_mosaic(bitmap,cliprect,stv2_current_tilemap.layer_name & 0x80); { @@ -4483,11 +4449,8 @@ static void stv_vdp2_check_tilemap(running_machine &machine, bitmap_rgb32 &bitma } } -static void stv_vdp2_draw_rotation_screen(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int iRP); - -static void stv_vdp2_copy_roz_bitmap(bitmap_rgb32 &bitmap, - running_machine &machine, +void saturn_state::stv_vdp2_copy_roz_bitmap(bitmap_rgb32 &bitmap, bitmap_rgb32 &roz_bitmap, const rectangle &cliprect, int iRP, @@ -4496,7 +4459,6 @@ static void stv_vdp2_copy_roz_bitmap(bitmap_rgb32 &bitmap, int planerenderedsizex, int planerenderedsizey) { - saturn_state *state = machine.driver_data(); INT32 xsp, ysp, xp, yp, dx, dy, x, y, xs, ys, dxs, dys; INT32 vcnt, hcnt; INT32 kx, ky; @@ -4561,11 +4523,11 @@ static void stv_vdp2_copy_roz_bitmap(bitmap_rgb32 &bitmap, { if ( STV_VDP2_CRKTE == 0 ) { - coeff_table_base = state->m_vdp2_vram; + coeff_table_base = m_vdp2_vram; } else { - coeff_table_base = state->m_vdp2_cram; + coeff_table_base = m_vdp2_cram; } if ( coeff_table_size == 0 ) { @@ -4728,14 +4690,14 @@ static void stv_vdp2_copy_roz_bitmap(bitmap_rgb32 &bitmap, if (pix & 0xffffff) { if(stv2_current_tilemap.fade_control & 1) - stv_vdp2_compute_color_offset_UINT32(machine,&pix,stv2_current_tilemap.fade_control & 2); + stv_vdp2_compute_color_offset_UINT32(&pix,stv2_current_tilemap.fade_control & 2); line[hcnt] = pix; } break; case STV_TRANSPARENCY_NONE: if(stv2_current_tilemap.fade_control & 1) - stv_vdp2_compute_color_offset_UINT32(machine,&pix,stv2_current_tilemap.fade_control & 2); + stv_vdp2_compute_color_offset_UINT32(&pix,stv2_current_tilemap.fade_control & 2); line[hcnt] = pix; break; @@ -4743,7 +4705,7 @@ static void stv_vdp2_copy_roz_bitmap(bitmap_rgb32 &bitmap, if (pix & 0xffffff) { if(stv2_current_tilemap.fade_control & 1) - stv_vdp2_compute_color_offset_UINT32(machine,&pix,stv2_current_tilemap.fade_control & 2); + stv_vdp2_compute_color_offset_UINT32(&pix,stv2_current_tilemap.fade_control & 2); line[hcnt] = alpha_blend_r32( line[hcnt], pix, stv2_current_tilemap.alpha ); } @@ -4752,7 +4714,7 @@ static void stv_vdp2_copy_roz_bitmap(bitmap_rgb32 &bitmap, if (pix & 0xffffff) { if(stv2_current_tilemap.fade_control & 1) - stv_vdp2_compute_color_offset_UINT32(machine,&pix,stv2_current_tilemap.fade_control & 2); + stv_vdp2_compute_color_offset_UINT32(&pix,stv2_current_tilemap.fade_control & 2); line[hcnt] = stv_add_blend( line[hcnt], pix ); } @@ -4839,14 +4801,14 @@ static void stv_vdp2_copy_roz_bitmap(bitmap_rgb32 &bitmap, if (pix & 0xffffff) { if(stv2_current_tilemap.fade_control & 1) - stv_vdp2_compute_color_offset_UINT32(machine,&pix,stv2_current_tilemap.fade_control & 2); + stv_vdp2_compute_color_offset_UINT32(&pix,stv2_current_tilemap.fade_control & 2); line[hcnt] = pix; } break; case STV_TRANSPARENCY_NONE: if(stv2_current_tilemap.fade_control & 1) - stv_vdp2_compute_color_offset_UINT32(machine,&pix,stv2_current_tilemap.fade_control & 2); + stv_vdp2_compute_color_offset_UINT32(&pix,stv2_current_tilemap.fade_control & 2); line[hcnt] = pix; break; @@ -4854,7 +4816,7 @@ static void stv_vdp2_copy_roz_bitmap(bitmap_rgb32 &bitmap, if (pix & 0xffffff) { if(stv2_current_tilemap.fade_control & 1) - stv_vdp2_compute_color_offset_UINT32(machine,&pix,stv2_current_tilemap.fade_control & 2); + stv_vdp2_compute_color_offset_UINT32(&pix,stv2_current_tilemap.fade_control & 2); line[hcnt] = alpha_blend_r32( line[hcnt], pix, stv2_current_tilemap.alpha ); } @@ -4863,7 +4825,7 @@ static void stv_vdp2_copy_roz_bitmap(bitmap_rgb32 &bitmap, if (pix & 0xffffff) { if(stv2_current_tilemap.fade_control & 1) - stv_vdp2_compute_color_offset_UINT32(machine,&pix,stv2_current_tilemap.fade_control & 2); + stv_vdp2_compute_color_offset_UINT32(&pix,stv2_current_tilemap.fade_control & 2); line[hcnt] = stv_add_blend( line[hcnt], pix ); } @@ -4874,9 +4836,8 @@ static void stv_vdp2_copy_roz_bitmap(bitmap_rgb32 &bitmap, } } -static void stv_vdp2_draw_NBG0(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect) +void saturn_state::stv_vdp2_draw_NBG0(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - saturn_state *state = machine.driver_data(); UINT32 base_mask; base_mask = STV_VDP2_VRAMSZ ? 0x7ffff : 0x3ffff; @@ -4951,7 +4912,7 @@ static void stv_vdp2_draw_NBG0(running_machine &machine, bitmap_rgb32 &bitmap, c stv2_current_tilemap.plane_size = (STV_VDP2_R1ON) ? STV_VDP2_RBPLSZ : STV_VDP2_N0PLSZ; stv2_current_tilemap.colour_ram_address_offset = STV_VDP2_N0CAOS; stv2_current_tilemap.fade_control = (STV_VDP2_N0COEN * 1) | (STV_VDP2_N0COSL * 2); - stv_vdp2_check_fade_control_for_layer(machine); + stv_vdp2_check_fade_control_for_layer(); stv2_current_tilemap.window_control = (STV_VDP2_N0LOG << 0) | (STV_VDP2_N0W0E << 1) | (STV_VDP2_N0W1E << 2) | @@ -4967,18 +4928,17 @@ static void stv_vdp2_draw_NBG0(running_machine &machine, bitmap_rgb32 &bitmap, c if ( stv2_current_tilemap.enabled && (!(STV_VDP2_R1ON))) /* TODO: check cycle pattern for RBG1 */ { - stv2_current_tilemap.enabled = stv_vdp2_check_vram_cycle_pattern_registers( machine, STV_VDP2_CP_NBG0_PNMDR, STV_VDP2_CP_NBG0_CPDR, stv2_current_tilemap.bitmap_enable ); + stv2_current_tilemap.enabled = stv_vdp2_check_vram_cycle_pattern_registers( STV_VDP2_CP_NBG0_PNMDR, STV_VDP2_CP_NBG0_CPDR, stv2_current_tilemap.bitmap_enable ); } if(STV_VDP2_R1ON) - stv_vdp2_draw_rotation_screen(machine, bitmap, cliprect, 2 ); + stv_vdp2_draw_rotation_screen(bitmap, cliprect, 2 ); else - stv_vdp2_check_tilemap(machine, bitmap, cliprect); + stv_vdp2_check_tilemap(bitmap, cliprect); } -static void stv_vdp2_draw_NBG1(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect) +void saturn_state::stv_vdp2_draw_NBG1(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - saturn_state *state = machine.driver_data(); UINT32 base_mask; base_mask = STV_VDP2_VRAMSZ ? 0x7ffff : 0x3ffff; @@ -5052,7 +5012,7 @@ static void stv_vdp2_draw_NBG1(running_machine &machine, bitmap_rgb32 &bitmap, c stv2_current_tilemap.plane_size = STV_VDP2_N1PLSZ; stv2_current_tilemap.colour_ram_address_offset = STV_VDP2_N1CAOS; stv2_current_tilemap.fade_control = (STV_VDP2_N1COEN * 1) | (STV_VDP2_N1COSL * 2); - stv_vdp2_check_fade_control_for_layer(machine); + stv_vdp2_check_fade_control_for_layer(); stv2_current_tilemap.window_control = (STV_VDP2_N1LOG << 0) | (STV_VDP2_N1W0E << 1) | (STV_VDP2_N1W1E << 2) | @@ -5068,16 +5028,14 @@ static void stv_vdp2_draw_NBG1(running_machine &machine, bitmap_rgb32 &bitmap, c if ( stv2_current_tilemap.enabled ) { - stv2_current_tilemap.enabled = stv_vdp2_check_vram_cycle_pattern_registers( machine, STV_VDP2_CP_NBG1_PNMDR, STV_VDP2_CP_NBG1_CPDR, stv2_current_tilemap.bitmap_enable ); + stv2_current_tilemap.enabled = stv_vdp2_check_vram_cycle_pattern_registers( STV_VDP2_CP_NBG1_PNMDR, STV_VDP2_CP_NBG1_CPDR, stv2_current_tilemap.bitmap_enable ); } - stv_vdp2_check_tilemap(machine, bitmap, cliprect); + stv_vdp2_check_tilemap(bitmap, cliprect); } -static void stv_vdp2_draw_NBG2(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect) +void saturn_state::stv_vdp2_draw_NBG2(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - saturn_state *state = machine.driver_data(); - /* NBG2 is the first of the 2 more basic tilemaps, it has exactly the same capabilities as NBG3 @@ -5155,7 +5113,7 @@ static void stv_vdp2_draw_NBG2(running_machine &machine, bitmap_rgb32 &bitmap, c stv2_current_tilemap.colour_ram_address_offset = STV_VDP2_N2CAOS; stv2_current_tilemap.fade_control = (STV_VDP2_N2COEN * 1) | (STV_VDP2_N2COSL * 2); - stv_vdp2_check_fade_control_for_layer(machine); + stv_vdp2_check_fade_control_for_layer(); stv2_current_tilemap.window_control = (STV_VDP2_N2LOG << 0) | (STV_VDP2_N2W0E << 1) | (STV_VDP2_N2W1E << 2) | @@ -5173,15 +5131,14 @@ static void stv_vdp2_draw_NBG2(running_machine &machine, bitmap_rgb32 &bitmap, c if ( stv2_current_tilemap.enabled ) { - stv2_current_tilemap.enabled = stv_vdp2_check_vram_cycle_pattern_registers( machine, STV_VDP2_CP_NBG2_PNMDR, STV_VDP2_CP_NBG2_CPDR, stv2_current_tilemap.bitmap_enable ); + stv2_current_tilemap.enabled = stv_vdp2_check_vram_cycle_pattern_registers( STV_VDP2_CP_NBG2_PNMDR, STV_VDP2_CP_NBG2_CPDR, stv2_current_tilemap.bitmap_enable ); } - stv_vdp2_check_tilemap(machine, bitmap, cliprect); + stv_vdp2_check_tilemap(bitmap, cliprect); } -static void stv_vdp2_draw_NBG3(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect) +void saturn_state::stv_vdp2_draw_NBG3(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - saturn_state *state = machine.driver_data(); /* NBG3 is the second of the 2 more basic tilemaps, it has exactly the same capabilities as NBG2 @@ -5259,7 +5216,7 @@ static void stv_vdp2_draw_NBG3(running_machine &machine, bitmap_rgb32 &bitmap, c stv2_current_tilemap.colour_ram_address_offset = STV_VDP2_N3CAOS; stv2_current_tilemap.fade_control = (STV_VDP2_N3COEN * 1) | (STV_VDP2_N3COSL * 2); - stv_vdp2_check_fade_control_for_layer(machine); + stv_vdp2_check_fade_control_for_layer(); stv2_current_tilemap.window_control = (STV_VDP2_N3LOG << 0) | (STV_VDP2_N3W0E << 1) | (STV_VDP2_N3W1E << 2) | @@ -5277,16 +5234,15 @@ static void stv_vdp2_draw_NBG3(running_machine &machine, bitmap_rgb32 &bitmap, c if ( stv2_current_tilemap.enabled ) { - stv2_current_tilemap.enabled = stv_vdp2_check_vram_cycle_pattern_registers( machine, STV_VDP2_CP_NBG3_PNMDR, STV_VDP2_CP_NBG3_CPDR, stv2_current_tilemap.bitmap_enable ); + stv2_current_tilemap.enabled = stv_vdp2_check_vram_cycle_pattern_registers( STV_VDP2_CP_NBG3_PNMDR, STV_VDP2_CP_NBG3_CPDR, stv2_current_tilemap.bitmap_enable ); } - stv_vdp2_check_tilemap(machine, bitmap, cliprect); + stv_vdp2_check_tilemap(bitmap, cliprect); } -static void stv_vdp2_draw_rotation_screen(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int iRP) +void saturn_state::stv_vdp2_draw_rotation_screen(bitmap_rgb32 &bitmap, const rectangle &cliprect, int iRP) { - saturn_state *state = machine.driver_data(); rectangle roz_clip_rect, mycliprect; int planesizex = 0, planesizey = 0; int planerenderedsizex, planerenderedsizey; @@ -5337,7 +5293,7 @@ static void stv_vdp2_draw_rotation_screen(running_machine &machine, bitmap_rgb32 stv2_current_tilemap.map_count = 16; } - stv_vdp2_fill_rotation_parameter_table(machine, iRP); + stv_vdp2_fill_rotation_parameter_table(iRP); if ( iRP == 1 ) { @@ -5384,12 +5340,12 @@ static void stv_vdp2_draw_rotation_screen(running_machine &machine, bitmap_rgb32 stv2_current_tilemap.scrollx = stv_current_rotation_parameter_table.mx >> 16; stv2_current_tilemap.scrolly = stv_current_rotation_parameter_table.my >> 16; - stv_vdp2_check_tilemap(machine, bitmap,cliprect); + stv_vdp2_check_tilemap(bitmap,cliprect); } else { - if ( !state->m_vdp2.roz_bitmap[iRP-1].valid() ) - state->m_vdp2.roz_bitmap[iRP-1].allocate(4096, 4096); + if ( !m_vdp2.roz_bitmap[iRP-1].valid() ) + m_vdp2.roz_bitmap[iRP-1].allocate(4096, 4096); roz_clip_rect.min_x = roz_clip_rect.min_y = 0; if ( (iRP == 1 && STV_VDP2_RAOVR == 3) || @@ -5426,8 +5382,8 @@ static void stv_vdp2_draw_rotation_screen(running_machine &machine, bitmap_rgb32 if ( (stv_rbg_cache_data.is_cache_dirty & iRP) || memcmp(&stv_rbg_cache_data.layer_data[iRP-1],&stv2_current_tilemap,sizeof(stv2_current_tilemap)) != 0 ) { - state->m_vdp2.roz_bitmap[iRP-1].fill(get_black_pen(machine), roz_clip_rect ); - stv_vdp2_check_tilemap(machine, state->m_vdp2.roz_bitmap[iRP-1], roz_clip_rect); + m_vdp2.roz_bitmap[iRP-1].fill(get_black_pen(machine()), roz_clip_rect ); + stv_vdp2_check_tilemap(m_vdp2.roz_bitmap[iRP-1], roz_clip_rect); // prepare cache data stv_rbg_cache_data.watch_vdp2_vram_writes |= iRP; stv_rbg_cache_data.is_cache_dirty &= ~iRP; @@ -5453,21 +5409,20 @@ static void stv_vdp2_draw_rotation_screen(running_machine &machine, bitmap_rgb32 if ( window_control ) { stv2_current_tilemap.window_control = window_control; - stv_vdp2_apply_window_on_layer(machine,mycliprect); + stv_vdp2_apply_window_on_layer(mycliprect); } stv2_current_tilemap.fade_control = fade_control; g_profiler.start(PROFILER_USER2); - stv_vdp2_copy_roz_bitmap(bitmap, machine, state->m_vdp2.roz_bitmap[iRP-1], mycliprect, iRP, planesizex, planesizey, planerenderedsizex, planerenderedsizey ); + stv_vdp2_copy_roz_bitmap(bitmap, m_vdp2.roz_bitmap[iRP-1], mycliprect, iRP, planesizex, planesizey, planerenderedsizex, planerenderedsizey ); g_profiler.stop(); } } -static void stv_vdp2_draw_RBG0(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect) +void saturn_state::stv_vdp2_draw_RBG0(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - saturn_state *state = machine.driver_data(); /* Colours : 16, 256, 2048, 32768, 16770000 Char Size : 1x1 cells, 2x2 cells @@ -5520,7 +5475,7 @@ static void stv_vdp2_draw_RBG0(running_machine &machine, bitmap_rgb32 &bitmap, c stv2_current_tilemap.colour_ram_address_offset = STV_VDP2_R0CAOS; stv2_current_tilemap.fade_control = (STV_VDP2_R0COEN * 1) | (STV_VDP2_R0COSL * 2); - stv_vdp2_check_fade_control_for_layer(machine); + stv_vdp2_check_fade_control_for_layer(); stv2_current_tilemap.window_control = (STV_VDP2_R0LOG << 0) | (STV_VDP2_R0W0E << 1) | (STV_VDP2_R0W1E << 2) | @@ -5551,28 +5506,27 @@ static void stv_vdp2_draw_RBG0(running_machine &machine, bitmap_rgb32 &bitmap, c switch(STV_VDP2_RPMD) { case 0://Rotation Parameter A - stv_vdp2_draw_rotation_screen(machine, bitmap, cliprect, 1 ); + stv_vdp2_draw_rotation_screen(bitmap, cliprect, 1 ); break; case 1://Rotation Parameter B //case 2: - stv_vdp2_draw_rotation_screen(machine, bitmap, cliprect, 2 ); + stv_vdp2_draw_rotation_screen(bitmap, cliprect, 2 ); break; case 2://Rotation Parameter A & B CKTE - stv_vdp2_draw_rotation_screen(machine, bitmap, cliprect, 2 ); - stv_vdp2_draw_rotation_screen(machine, bitmap, cliprect, 1 ); + stv_vdp2_draw_rotation_screen(bitmap, cliprect, 2 ); + stv_vdp2_draw_rotation_screen(bitmap, cliprect, 1 ); break; case 3://Rotation Parameter A & B Window (wrong) - stv_vdp2_draw_rotation_screen(machine, bitmap, cliprect, 1 ); + stv_vdp2_draw_rotation_screen(bitmap, cliprect, 1 ); break; } } -static void stv_vdp2_draw_back(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect) +void saturn_state::stv_vdp2_draw_back(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - saturn_state *state = machine.driver_data(); int x,y; - UINT8* gfxdata = state->m_vdp2.gfx_decode; + UINT8* gfxdata = m_vdp2.gfx_decode; UINT32 base_offs,base_mask; UINT8 interlace; @@ -5582,7 +5536,7 @@ static void stv_vdp2_draw_back(running_machine &machine, bitmap_rgb32 &bitmap, c /* draw black if BDCLMD and DISP are cleared */ if(!(STV_VDP2_BDCLMD) && !(STV_VDP2_DISP)) - bitmap.fill(get_black_pen(machine), cliprect); + bitmap.fill(get_black_pen(machine()), cliprect); else { base_mask = STV_VDP2_VRAMSZ ? 0x7ffff : 0x3ffff; @@ -5603,7 +5557,7 @@ static void stv_vdp2_draw_back(running_machine &machine, bitmap_rgb32 &bitmap, c g = pal5bit((dot & 0x03e0) >> 5); r = pal5bit( dot & 0x001f); if(STV_VDP2_BKCOEN) - stv_vdp2_compute_color_offset( machine, &r, &g, &b, STV_VDP2_BKCOSL ); + stv_vdp2_compute_color_offset( &r, &g, &b, STV_VDP2_BKCOSL ); bitmap.pix32(y, x) = MAKE_RGB(r, g, b); } @@ -5611,21 +5565,18 @@ static void stv_vdp2_draw_back(running_machine &machine, bitmap_rgb32 &bitmap, c } } -READ32_HANDLER ( saturn_vdp2_vram_r ) +READ32_MEMBER ( saturn_state::saturn_vdp2_vram_r ) { - saturn_state *state = space.machine().driver_data(); - - return state->m_vdp2_vram[offset]; + return m_vdp2_vram[offset]; } -WRITE32_HANDLER ( saturn_vdp2_vram_w ) +WRITE32_MEMBER ( saturn_state::saturn_vdp2_vram_w ) { - saturn_state *state = space.machine().driver_data(); - UINT8* gfxdata = state->m_vdp2.gfx_decode; + UINT8* gfxdata = m_vdp2.gfx_decode; - COMBINE_DATA(&state->m_vdp2_vram[offset]); + COMBINE_DATA(&m_vdp2_vram[offset]); - data = state->m_vdp2_vram[offset]; + data = m_vdp2_vram[offset]; /* put in gfx region for easy decoding */ gfxdata[offset*4+0] = (data & 0xff000000) >> 24; gfxdata[offset*4+1] = (data & 0x00ff0000) >> 16; @@ -5675,10 +5626,8 @@ WRITE32_HANDLER ( saturn_vdp2_vram_w ) } -READ16_HANDLER ( saturn_vdp2_regs_r ) +READ16_MEMBER ( saturn_state::saturn_vdp2_regs_r ) { - saturn_state *state = space.machine().driver_data(); - switch(offset) { case 0x002/2: @@ -5689,10 +5638,10 @@ READ16_HANDLER ( saturn_vdp2_regs_r ) /* TODO: handle various h/v settings. */ if(!space.debugger_access()) { - state->m_vdp2.h_count = space.machine().primary_screen->hpos() & 0x3ff; - state->m_vdp2.v_count = space.machine().primary_screen->vpos() & (STV_VDP2_LSMD == 3 ? 0x7ff : 0x3ff); + m_vdp2.h_count = space.machine().primary_screen->hpos() & 0x3ff; + m_vdp2.v_count = space.machine().primary_screen->vpos() & (STV_VDP2_LSMD == 3 ? 0x7ff : 0x3ff); /* latch flag */ - state->m_vdp2.exltfg |= 1; + m_vdp2.exltfg |= 1; } } @@ -5702,28 +5651,28 @@ READ16_HANDLER ( saturn_vdp2_regs_r ) { /*Screen Status Register*/ /*VBLANK HBLANK ODD PAL */ - state->m_vdp2_regs[offset] = (state->m_vdp2.exltfg<<9) | - (state->m_vdp2.exsyfg<<8) | - (get_vblank(space.machine()) << 3) | - (get_hblank(space.machine()) << 2) | - (get_odd_bit(space.machine()) << 1) | - (state->m_vdp2.pal << 0); + m_vdp2_regs[offset] = (m_vdp2.exltfg<<9) | + (m_vdp2.exsyfg<<8) | + (get_vblank() << 3) | + (get_hblank() << 2) | + (get_odd_bit() << 1) | + (m_vdp2.pal << 0); /* vblank bit is always 1 if DISP bit is disabled */ if(!STV_VDP2_DISP) - state->m_vdp2_regs[offset] |= 1 << 3; + m_vdp2_regs[offset] |= 1 << 3; /* HV latches clears if this register is read */ if(!space.debugger_access()) { - state->m_vdp2.exltfg &= ~1; - state->m_vdp2.exsyfg &= ~1; + m_vdp2.exltfg &= ~1; + m_vdp2.exsyfg &= ~1; } break; } case 0x006/2: { - state->m_vdp2_regs[offset] = (STV_VDP2_VRAMSZ << 15) | + m_vdp2_regs[offset] = (STV_VDP2_VRAMSZ << 15) | ((0 << 0) & 0xf); // VDP2 version if(!space.debugger_access()) @@ -5734,14 +5683,14 @@ READ16_HANDLER ( saturn_vdp2_regs_r ) /* HCNT */ case 0x008/2: { - state->m_vdp2_regs[offset] = (state->m_vdp2.h_count); + m_vdp2_regs[offset] = (m_vdp2.h_count); break; } /* VCNT */ case 0x00a/2: { - state->m_vdp2_regs[offset] = (state->m_vdp2.v_count); + m_vdp2_regs[offset] = (m_vdp2.v_count); break; } @@ -5751,31 +5700,27 @@ READ16_HANDLER ( saturn_vdp2_regs_r ) break; } - return state->m_vdp2_regs[offset]; + return m_vdp2_regs[offset]; } -READ32_HANDLER ( saturn_vdp2_cram_r ) +READ32_MEMBER ( saturn_state::saturn_vdp2_cram_r ) { - saturn_state *state = space.machine().driver_data(); - offset &= (0xfff) >> (2); - - return state->m_vdp2_cram[offset]; + return m_vdp2_cram[offset]; } -WRITE32_HANDLER ( saturn_vdp2_cram_w ) +WRITE32_MEMBER ( saturn_state::saturn_vdp2_cram_w ) { - saturn_state *state = space.machine().driver_data(); int r,g,b; UINT8 cmode0; cmode0 = (STV_VDP2_CRMD & 3) == 0; offset &= (0xfff) >> (2); - COMBINE_DATA(&state->m_vdp2_cram[offset]); + COMBINE_DATA(&m_vdp2_cram[offset]); switch( STV_VDP2_CRMD ) { @@ -5785,9 +5730,9 @@ WRITE32_HANDLER ( saturn_vdp2_cram_w ) { //offset &= (0xfff) >> 2; - b = ((state->m_vdp2_cram[offset] & 0x00ff0000) >> 16); - g = ((state->m_vdp2_cram[offset] & 0x0000ff00) >> 8); - r = ((state->m_vdp2_cram[offset] & 0x000000ff) >> 0); + b = ((m_vdp2_cram[offset] & 0x00ff0000) >> 16); + g = ((m_vdp2_cram[offset] & 0x0000ff00) >> 8); + r = ((m_vdp2_cram[offset] & 0x000000ff) >> 0); palette_set_color(space.machine(),offset,MAKE_RGB(r,g,b)); palette_set_color(space.machine(),offset^0x400,MAKE_RGB(r,g,b)); } @@ -5798,16 +5743,16 @@ WRITE32_HANDLER ( saturn_vdp2_cram_w ) { offset &= (0xfff) >> (cmode0+2); - b = ((state->m_vdp2_cram[offset] & 0x00007c00) >> 10); - g = ((state->m_vdp2_cram[offset] & 0x000003e0) >> 5); - r = ((state->m_vdp2_cram[offset] & 0x0000001f) >> 0); + b = ((m_vdp2_cram[offset] & 0x00007c00) >> 10); + g = ((m_vdp2_cram[offset] & 0x000003e0) >> 5); + r = ((m_vdp2_cram[offset] & 0x0000001f) >> 0); palette_set_color_rgb(space.machine(),(offset*2)+1,pal5bit(r),pal5bit(g),pal5bit(b)); if(cmode0) palette_set_color_rgb(space.machine(),((offset*2)+1)^0x400,pal5bit(r),pal5bit(g),pal5bit(b)); - b = ((state->m_vdp2_cram[offset] & 0x7c000000) >> 26); - g = ((state->m_vdp2_cram[offset] & 0x03e00000) >> 21); - r = ((state->m_vdp2_cram[offset] & 0x001f0000) >> 16); + b = ((m_vdp2_cram[offset] & 0x7c000000) >> 26); + g = ((m_vdp2_cram[offset] & 0x03e00000) >> 21); + r = ((m_vdp2_cram[offset] & 0x001f0000) >> 16); palette_set_color_rgb(space.machine(),offset*2,pal5bit(r),pal5bit(g),pal5bit(b)); if(cmode0) palette_set_color_rgb(space.machine(),(offset*2)^0x400,pal5bit(r),pal5bit(g),pal5bit(b)); @@ -5816,9 +5761,8 @@ WRITE32_HANDLER ( saturn_vdp2_cram_w ) } } -static void refresh_palette_data(running_machine &machine) +void saturn_state::refresh_palette_data( void ) { - saturn_state *state = machine.driver_data(); int r,g,b; int c_i; UINT8 bank; @@ -5830,11 +5774,11 @@ static void refresh_palette_data(running_machine &machine) { for(c_i=0;c_i<0x400;c_i++) { - b = ((state->m_vdp2_cram[c_i] & 0x00ff0000) >> 16); - g = ((state->m_vdp2_cram[c_i] & 0x0000ff00) >> 8); - r = ((state->m_vdp2_cram[c_i] & 0x000000ff) >> 0); - palette_set_color(machine,c_i,MAKE_RGB(r,g,b)); - palette_set_color(machine,c_i+0x400,MAKE_RGB(r,g,b)); + b = ((m_vdp2_cram[c_i] & 0x00ff0000) >> 16); + g = ((m_vdp2_cram[c_i] & 0x0000ff00) >> 8); + r = ((m_vdp2_cram[c_i] & 0x000000ff) >> 0); + palette_set_color(machine(),c_i,MAKE_RGB(r,g,b)); + palette_set_color(machine(),c_i+0x400,MAKE_RGB(r,g,b)); } } break; @@ -5844,14 +5788,14 @@ static void refresh_palette_data(running_machine &machine) { for(c_i=0;c_i<0x400;c_i++) { - b = ((state->m_vdp2_cram[c_i] & 0x00007c00) >> 10); - g = ((state->m_vdp2_cram[c_i] & 0x000003e0) >> 5); - r = ((state->m_vdp2_cram[c_i] & 0x0000001f) >> 0); - palette_set_color_rgb(machine,(c_i*2)+1+bank*0x400,pal5bit(r),pal5bit(g),pal5bit(b)); - b = ((state->m_vdp2_cram[c_i] & 0x7c000000) >> 26); - g = ((state->m_vdp2_cram[c_i] & 0x03e00000) >> 21); - r = ((state->m_vdp2_cram[c_i] & 0x001f0000) >> 16); - palette_set_color_rgb(machine,c_i*2+bank*0x400,pal5bit(r),pal5bit(g),pal5bit(b)); + b = ((m_vdp2_cram[c_i] & 0x00007c00) >> 10); + g = ((m_vdp2_cram[c_i] & 0x000003e0) >> 5); + r = ((m_vdp2_cram[c_i] & 0x0000001f) >> 0); + palette_set_color_rgb(machine(),(c_i*2)+1+bank*0x400,pal5bit(r),pal5bit(g),pal5bit(b)); + b = ((m_vdp2_cram[c_i] & 0x7c000000) >> 26); + g = ((m_vdp2_cram[c_i] & 0x03e00000) >> 21); + r = ((m_vdp2_cram[c_i] & 0x001f0000) >> 16); + palette_set_color_rgb(machine(),c_i*2+bank*0x400,pal5bit(r),pal5bit(g),pal5bit(b)); } } } @@ -5860,43 +5804,41 @@ static void refresh_palette_data(running_machine &machine) { for(c_i=0;c_i<0x800;c_i++) { - b = ((state->m_vdp2_cram[c_i] & 0x00007c00) >> 10); - g = ((state->m_vdp2_cram[c_i] & 0x000003e0) >> 5); - r = ((state->m_vdp2_cram[c_i] & 0x0000001f) >> 0); - palette_set_color_rgb(machine,(c_i*2)+1,pal5bit(r),pal5bit(g),pal5bit(b)); - b = ((state->m_vdp2_cram[c_i] & 0x7c000000) >> 26); - g = ((state->m_vdp2_cram[c_i] & 0x03e00000) >> 21); - r = ((state->m_vdp2_cram[c_i] & 0x001f0000) >> 16); - palette_set_color_rgb(machine,c_i*2,pal5bit(r),pal5bit(g),pal5bit(b)); + b = ((m_vdp2_cram[c_i] & 0x00007c00) >> 10); + g = ((m_vdp2_cram[c_i] & 0x000003e0) >> 5); + r = ((m_vdp2_cram[c_i] & 0x0000001f) >> 0); + palette_set_color_rgb(machine(),(c_i*2)+1,pal5bit(r),pal5bit(g),pal5bit(b)); + b = ((m_vdp2_cram[c_i] & 0x7c000000) >> 26); + g = ((m_vdp2_cram[c_i] & 0x03e00000) >> 21); + r = ((m_vdp2_cram[c_i] & 0x001f0000) >> 16); + palette_set_color_rgb(machine(),c_i*2,pal5bit(r),pal5bit(g),pal5bit(b)); } } break; } } -WRITE16_HANDLER ( saturn_vdp2_regs_w ) +WRITE16_MEMBER ( saturn_state::saturn_vdp2_regs_w ) { - saturn_state *state = space.machine().driver_data(); - COMBINE_DATA(&state->m_vdp2_regs[offset]); + COMBINE_DATA(&m_vdp2_regs[offset]); - if(state->m_vdp2.old_crmd != STV_VDP2_CRMD) + if(m_vdp2.old_crmd != STV_VDP2_CRMD) { - state->m_vdp2.old_crmd = STV_VDP2_CRMD; - refresh_palette_data(space.machine()); + m_vdp2.old_crmd = STV_VDP2_CRMD; + refresh_palette_data(); } - if(state->m_vdp2.old_tvmd != STV_VDP2_TVMD) + if(m_vdp2.old_tvmd != STV_VDP2_TVMD) { - state->m_vdp2.old_tvmd = STV_VDP2_TVMD; - stv_vdp2_dynamic_res_change(space.machine()); + m_vdp2.old_tvmd = STV_VDP2_TVMD; + stv_vdp2_dynamic_res_change(); } if(STV_VDP2_VRAMSZ) printf("VDP2 sets up 8 Mbit VRAM!\n"); } -static int get_hblank_duration(running_machine &machine) +int saturn_state::get_hblank_duration( void ) { - saturn_state *state = machine.driver_data(); int res; res = (STV_VDP2_HRES & 1) ? 455 : 427; @@ -5910,12 +5852,11 @@ static int get_hblank_duration(running_machine &machine) /*some vblank lines measurements (according to Charles MacDonald)*/ /* TODO: interlace mode "eats" one line, should be 262.5 */ -static int get_vblank_duration(running_machine &machine) +int saturn_state::get_vblank_duration( void ) { - saturn_state *state = machine.driver_data(); int res; - res = (state->m_vdp2.pal) ? 313 : 263; + res = (m_vdp2.pal) ? 313 : 263; /* compensate for interlacing */ if((STV_VDP2_LSMD & 3) == 3) @@ -5927,12 +5868,11 @@ static int get_vblank_duration(running_machine &machine) return res; } -static int get_pixel_clock(running_machine &machine) +int saturn_state::get_pixel_clock( void ) { - saturn_state *state = machine.driver_data(); int res,divider; - res = state->m_vdp2.dotsel ? MASTER_CLOCK_352 : MASTER_CLOCK_320; + res = m_vdp2.dotsel ? MASTER_CLOCK_352 : MASTER_CLOCK_320; /* TODO: divider is ALWAYS 8, this thing is just to over-compensate for MAME framework faults ... */ divider = 8; @@ -5948,10 +5888,10 @@ static int get_pixel_clock(running_machine &machine) return res/divider; } -static UINT8 get_hblank(running_machine &machine) +UINT8 saturn_state::get_hblank( void ) { - const rectangle &visarea = machine.primary_screen->visible_area(); - int cur_h = machine.primary_screen->hpos(); + const rectangle &visarea = machine().primary_screen->visible_area(); + int cur_h = machine().primary_screen->hpos(); if (cur_h > visarea.max_x) //TODO return 1; @@ -5959,13 +5899,12 @@ static UINT8 get_hblank(running_machine &machine) return 0; } -UINT8 get_vblank(running_machine &machine) +UINT8 saturn_state::get_vblank( void ) { - saturn_state *state = machine.driver_data(); int cur_v,vblank; - cur_v = machine.primary_screen->vpos(); + cur_v = machine().primary_screen->vpos(); - vblank = (state->m_vdp2.pal) ? 288 : 240; + vblank = (m_vdp2.pal) ? 288 : 240; if((STV_VDP2_LSMD & 3) == 3) vblank<<=1; @@ -5976,11 +5915,10 @@ UINT8 get_vblank(running_machine &machine) return 0; } -static UINT8 get_odd_bit(running_machine &machine) +UINT8 saturn_state::get_odd_bit( void ) { - saturn_state *state = machine.driver_data(); int cur_v; - cur_v = machine.primary_screen->vpos(); + cur_v = machine().primary_screen->vpos(); if(STV_VDP2_HRES & 4) //exclusive monitor mode makes this bit to be always 1 return 1; @@ -5994,32 +5932,31 @@ static UINT8 get_odd_bit(running_machine &machine) return 0; } -static void stv_vdp2_state_save_postload(running_machine &machine) +void saturn_state::stv_vdp2_state_save_postload( void ) { - saturn_state *state = machine.driver_data(); - UINT8 *gfxdata = state->m_vdp2.gfx_decode; + UINT8 *gfxdata = m_vdp2.gfx_decode; int offset; UINT32 data; for ( offset = 0; offset < 0x100000/4; offset++ ) { - data = state->m_vdp2_vram[offset]; + data = m_vdp2_vram[offset]; /* put in gfx region for easy decoding */ gfxdata[offset*4+0] = (data & 0xff000000) >> 24; gfxdata[offset*4+1] = (data & 0x00ff0000) >> 16; gfxdata[offset*4+2] = (data & 0x0000ff00) >> 8; gfxdata[offset*4+3] = (data & 0x000000ff) >> 0; - machine.gfx[0]->mark_dirty(offset/8); - machine.gfx[1]->mark_dirty(offset/8); - machine.gfx[2]->mark_dirty(offset/8); - machine.gfx[3]->mark_dirty(offset/8); + machine().gfx[0]->mark_dirty(offset/8); + machine().gfx[1]->mark_dirty(offset/8); + machine().gfx[2]->mark_dirty(offset/8); + machine().gfx[3]->mark_dirty(offset/8); /* 8-bit tiles overlap, so this affects the previous one as well */ if (offset/8 != 0) { - machine.gfx[2]->mark_dirty(offset/8 - 1); - machine.gfx[3]->mark_dirty(offset/8 - 1); + machine().gfx[2]->mark_dirty(offset/8 - 1); + machine().gfx[3]->mark_dirty(offset/8 - 1); } } @@ -6028,37 +5965,35 @@ static void stv_vdp2_state_save_postload(running_machine &machine) stv_rbg_cache_data.is_cache_dirty = 3; memset( &stv_vdp2_layer_data_placement, 0, sizeof(stv_vdp2_layer_data_placement)); - refresh_palette_data(machine); + refresh_palette_data(); } -static void stv_vdp2_exit (running_machine &machine) +void saturn_state::stv_vdp2_exit ( void ) { - saturn_state *state = machine.driver_data(); - state->m_vdp2.roz_bitmap[0].reset(); - state->m_vdp2.roz_bitmap[1].reset(); + m_vdp2.roz_bitmap[0].reset(); + m_vdp2.roz_bitmap[1].reset(); } -static int stv_vdp2_start (running_machine &machine) +int saturn_state::stv_vdp2_start ( void ) { - saturn_state *state = machine.driver_data(); - machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(stv_vdp2_exit), &machine)); + machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(saturn_state::stv_vdp2_exit), this)); - state->m_vdp2_regs = auto_alloc_array_clear(machine, UINT16, 0x040000/2 ); - state->m_vdp2_vram = auto_alloc_array_clear(machine, UINT32, 0x100000/4 ); - state->m_vdp2_cram = auto_alloc_array_clear(machine, UINT32, 0x080000/4 ); - state->m_vdp2.gfx_decode = auto_alloc_array(machine, UINT8, 0x100000 ); + m_vdp2_regs = auto_alloc_array_clear(machine(), UINT16, 0x040000/2 ); + m_vdp2_vram = auto_alloc_array_clear(machine(), UINT32, 0x100000/4 ); + m_vdp2_cram = auto_alloc_array_clear(machine(), UINT32, 0x080000/4 ); + m_vdp2.gfx_decode = auto_alloc_array(machine(), UINT8, 0x100000 ); -// machine.gfx[0]->granularity()=4; -// machine.gfx[1]->granularity()=4; +// machine().gfx[0]->granularity()=4; +// machine().gfx[1]->granularity()=4; memset( &stv_rbg_cache_data, 0, sizeof(stv_rbg_cache_data)); stv_rbg_cache_data.is_cache_dirty = 3; memset( &stv_vdp2_layer_data_placement, 0, sizeof(stv_vdp2_layer_data_placement)); - state_save_register_global_pointer(machine, state->m_vdp2_regs, 0x040000/2); - state_save_register_global_pointer(machine, state->m_vdp2_vram, 0x100000/4); - state_save_register_global_pointer(machine, state->m_vdp2_cram, 0x080000/4); - machine.save().register_postload(save_prepost_delegate(FUNC(stv_vdp2_state_save_postload), &machine)); + state_save_register_global_pointer(machine(), m_vdp2_regs, 0x040000/2); + state_save_register_global_pointer(machine(), m_vdp2_vram, 0x100000/4); + state_save_register_global_pointer(machine(), m_vdp2_cram, 0x080000/4); + machine().save().register_postload(save_prepost_delegate(FUNC(saturn_state::stv_vdp2_state_save_postload), this)); return 0; } @@ -6067,8 +6002,8 @@ static int stv_vdp2_start (running_machine &machine) VIDEO_START_MEMBER(saturn_state,stv_vdp2) { machine().primary_screen->register_screen_bitmap(m_tmpbitmap); - stv_vdp2_start(machine()); - stv_vdp1_start(machine()); + stv_vdp2_start(); + stv_vdp1_start(); vdpdebug.l_en = 0xff; vdpdebug.error = 0xffffffff; vdpdebug.roz = 0; @@ -6082,15 +6017,14 @@ VIDEO_START_MEMBER(saturn_state,stv_vdp2) machine().gfx[7]->set_source(m_vdp1.gfx_decode); } -void stv_vdp2_dynamic_res_change(running_machine &machine) +void saturn_state::stv_vdp2_dynamic_res_change( void ) { - saturn_state *state = machine.driver_data(); const int d_vres[4] = { 224, 240, 256, 256 }; const int d_hres[4] = { 320, 352, 640, 704 }; int horz_res,vert_res; int vres_mask; - vres_mask = (state->m_vdp2.pal << 1)|1; //PAL uses mask 3, NTSC uses mask 1 + vres_mask = (m_vdp2.pal << 1)|1; //PAL uses mask 3, NTSC uses mask 1 vert_res = d_vres[STV_VDP2_VRES & vres_mask]; if((STV_VDP2_VRES & 3) == 3) @@ -6110,22 +6044,20 @@ void stv_vdp2_dynamic_res_change(running_machine &machine) attoseconds_t refresh;; rectangle visarea(0, horz_res-1, 0, vert_res-1); - vblank_period = get_vblank_duration(machine); - hblank_period = get_hblank_duration(machine); - refresh = HZ_TO_ATTOSECONDS(get_pixel_clock(machine)) * (hblank_period) * vblank_period; + vblank_period = get_vblank_duration(); + hblank_period = get_hblank_duration(); + refresh = HZ_TO_ATTOSECONDS(get_pixel_clock()) * (hblank_period) * vblank_period; //printf("%d %d %d %d\n",horz_res,vert_res,horz_res+hblank_period,vblank_period); - machine.primary_screen->configure((hblank_period), (vblank_period), visarea, refresh ); + machine().primary_screen->configure((hblank_period), (vblank_period), visarea, refresh ); } -// machine.primary_screen->set_visible_area(0*8, horz_res-1,0*8, vert_res-1); - //if(LOG_VDP2) popmessage("%04d %04d",horz_res-1,vert-1); +// machine().primary_screen->set_visible_area(0*8, horz_res-1,0*8, vert_res-1); } /*This is for calculating the rgb brightness*/ /*TODO: Optimize this...*/ -static void stv_vdp2_fade_effects(running_machine &machine) +void saturn_state::stv_vdp2_fade_effects( void ) { - saturn_state *state = machine.driver_data(); /* Note:We have to use temporary storages because palette_get_color must use variables setted with unsigned int8 @@ -6138,7 +6070,7 @@ static void stv_vdp2_fade_effects(running_machine &machine) for(i=0;i<2048;i++) { /*Fade A*/ - color = palette_get_color(machine, i); + color = palette_get_color(machine(), i); t_r = (STV_VDP2_COAR & 0x100) ? (RGB_RED(color) - (0x100 - (STV_VDP2_COAR & 0xff))) : ((STV_VDP2_COAR & 0xff) + RGB_RED(color)); t_g = (STV_VDP2_COAG & 0x100) ? (RGB_GREEN(color) - (0x100 - (STV_VDP2_COAG & 0xff))) : ((STV_VDP2_COAG & 0xff) + RGB_GREEN(color)); t_b = (STV_VDP2_COAB & 0x100) ? (RGB_BLUE(color) - (0x100 - (STV_VDP2_COAB & 0xff))) : ((STV_VDP2_COAB & 0xff) + RGB_BLUE(color)); @@ -6151,10 +6083,10 @@ static void stv_vdp2_fade_effects(running_machine &machine) r = t_r; g = t_g; b = t_b; - palette_set_color(machine,i+(2048*1),MAKE_RGB(r,g,b)); + palette_set_color(machine(),i+(2048*1),MAKE_RGB(r,g,b)); /*Fade B*/ - color = palette_get_color(machine, i); + color = palette_get_color(machine(), i); t_r = (STV_VDP2_COBR & 0x100) ? (RGB_RED(color) - (0xff - (STV_VDP2_COBR & 0xff))) : ((STV_VDP2_COBR & 0xff) + RGB_RED(color)); t_g = (STV_VDP2_COBG & 0x100) ? (RGB_GREEN(color) - (0xff - (STV_VDP2_COBG & 0xff))) : ((STV_VDP2_COBG & 0xff) + RGB_GREEN(color)); t_b = (STV_VDP2_COBB & 0x100) ? (RGB_BLUE(color) - (0xff - (STV_VDP2_COBB & 0xff))) : ((STV_VDP2_COBB & 0xff) + RGB_BLUE(color)); @@ -6167,7 +6099,7 @@ static void stv_vdp2_fade_effects(running_machine &machine) r = t_r; g = t_g; b = t_b; - palette_set_color(machine,i+(2048*2),MAKE_RGB(r,g,b)); + palette_set_color(machine(),i+(2048*2),MAKE_RGB(r,g,b)); } //popmessage("%04x %04x %04x %04x %04x %04x",STV_VDP2_COAR,STV_VDP2_COAG,STV_VDP2_COAB,STV_VDP2_COBR,STV_VDP2_COBG,STV_VDP2_COBB); } @@ -6205,10 +6137,8 @@ Window Registers are hooked up like this ATM: (0 = OR,1 = AND) ******************************************************************************************/ -static void stv_vdp2_get_window0_coordinates(running_machine &machine,UINT16 *s_x, UINT16 *e_x, UINT16 *s_y, UINT16 *e_y) +void saturn_state::stv_vdp2_get_window0_coordinates(UINT16 *s_x, UINT16 *e_x, UINT16 *s_y, UINT16 *e_y) { - saturn_state *state = machine.driver_data(); - /*W0*/ switch(STV_VDP2_LSMD & 3) { @@ -6252,10 +6182,8 @@ static void stv_vdp2_get_window0_coordinates(running_machine &machine,UINT16 *s_ } } -static void stv_vdp2_get_window1_coordinates(running_machine &machine,UINT16 *s_x, UINT16 *e_x, UINT16 *s_y, UINT16 *e_y) +void saturn_state::stv_vdp2_get_window1_coordinates(UINT16 *s_x, UINT16 *e_x, UINT16 *s_y, UINT16 *e_y) { - saturn_state *state = machine.driver_data(); - /*W1*/ switch(STV_VDP2_LSMD & 3) { @@ -6300,7 +6228,7 @@ static void stv_vdp2_get_window1_coordinates(running_machine &machine,UINT16 *s_ } -static int get_window_pixel(UINT16 s_x,UINT16 e_x,UINT16 s_y,UINT16 e_y,int x, int y,UINT8 win_num) +int saturn_state::get_window_pixel(UINT16 s_x,UINT16 e_x,UINT16 s_y,UINT16 e_y,int x, int y,UINT8 win_num) { if(stv2_current_tilemap.window_control & (2 << win_num)) { @@ -6333,7 +6261,7 @@ static int get_window_pixel(UINT16 s_x,UINT16 e_x,UINT16 s_y,UINT16 e_y,int x, i return 0; } -static int stv_vdp2_window_process(running_machine &machine,int x,int y) +int saturn_state::stv_vdp2_window_process(int x,int y) { UINT16 s_x=0,e_x=0,s_y=0,e_y=0; UINT8 w0_pix, w1_pix; @@ -6341,24 +6269,23 @@ static int stv_vdp2_window_process(running_machine &machine,int x,int y) if ((stv2_current_tilemap.window_control & 6) == 0) return 0; - stv_vdp2_get_window0_coordinates(machine,&s_x, &e_x, &s_y, &e_y); + stv_vdp2_get_window0_coordinates(&s_x, &e_x, &s_y, &e_y); w0_pix = get_window_pixel(s_x,e_x,s_y,e_y,x,y,0); - stv_vdp2_get_window1_coordinates(machine,&s_x, &e_x, &s_y, &e_y); + stv_vdp2_get_window1_coordinates(&s_x, &e_x, &s_y, &e_y); w1_pix = get_window_pixel(s_x,e_x,s_y,e_y,x,y,1); return stv2_current_tilemap.window_control & 1 ? (w0_pix & w1_pix) : (w0_pix | w1_pix); } -static int stv_vdp2_apply_window_on_layer(running_machine &machine,rectangle &cliprect) +int saturn_state::stv_vdp2_apply_window_on_layer(rectangle &cliprect) { - //saturn_state *state = machine.driver_data(); UINT16 s_x=0,e_x=0,s_y=0,e_y=0; if ( stv2_current_tilemap.window_control == 0x12 ) { /* w0, transparent outside supported */ - stv_vdp2_get_window0_coordinates(machine,&s_x, &e_x, &s_y, &e_y); + stv_vdp2_get_window0_coordinates(&s_x, &e_x, &s_y, &e_y); if ( s_x > cliprect.min_x ) cliprect.min_x = s_x; if ( e_x < cliprect.max_x ) cliprect.max_x = e_x; @@ -6370,7 +6297,7 @@ static int stv_vdp2_apply_window_on_layer(running_machine &machine,rectangle &cl else if ( stv2_current_tilemap.window_control == 0x24 ) { /* w1, transparent outside supported */ - stv_vdp2_get_window1_coordinates(machine,&s_x, &e_x, &s_y, &e_y); + stv_vdp2_get_window1_coordinates(&s_x, &e_x, &s_y, &e_y); if ( s_x > cliprect.min_x ) cliprect.min_x = s_x; if ( e_x < cliprect.max_x ) cliprect.max_x = e_x; @@ -6390,9 +6317,8 @@ static int stv_sprite_priorities_used[8]; static int stv_sprite_priorities_usage_valid; static UINT8 stv_sprite_priorities_in_fb_line[512][8]; -static void draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT8 pri) +void saturn_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT8 pri) { - saturn_state *state = machine.driver_data(); int x,y,r,g,b; int i; UINT16 pix; @@ -6483,7 +6409,7 @@ static void draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, const r } /* framebuffer interlace */ - if ( (STV_VDP2_LSMD == 3) && state->m_vdp1.framebuffer_double_interlace == 0 ) + if ( (STV_VDP2_LSMD == 3) && m_vdp1.framebuffer_double_interlace == 0 ) interlace_framebuffer = 1; else interlace_framebuffer = 0; @@ -6505,7 +6431,7 @@ static void draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, const r (STV_VDP2_SPSWA * 0x40); mycliprect = cliprect; - stv_vdp2_apply_window_on_layer(machine,mycliprect); + stv_vdp2_apply_window_on_layer(mycliprect); if (interlace_framebuffer == 0 && double_x == 0 ) { @@ -6517,7 +6443,7 @@ static void draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, const r if (stv_sprite_priorities_in_fb_line[y][pri] == 0) continue; - framebuffer_line = state->m_vdp1.framebuffer_display_lines[y]; + framebuffer_line = m_vdp1.framebuffer_display_lines[y]; bitmap_line = &bitmap.pix32(y); for ( x = mycliprect.min_x; x <= mycliprect.max_x; x++ ) @@ -6540,7 +6466,7 @@ static void draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, const r r = pal5bit( pix & 0x001f); if ( color_offset_pal ) { - stv_vdp2_compute_color_offset( machine, &r, &g, &b, STV_VDP2_SPCOSL ); + stv_vdp2_compute_color_offset( &r, &g, &b, STV_VDP2_SPCOSL ); } bitmap_line[x] = MAKE_RGB(r, g, b); @@ -6572,7 +6498,7 @@ static void draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, const r pix += (STV_VDP2_SPCAOS << 8); pix &= 0x7ff; pix += color_offset_pal; - bitmap_line[x] = machine.pens[ pix ]; + bitmap_line[x] = machine().pens[ pix ]; } } @@ -6597,7 +6523,7 @@ static void draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, const r if (stv_sprite_priorities_in_fb_line[y][pri] == 0) continue; - framebuffer_line = state->m_vdp1.framebuffer_display_lines[y]; + framebuffer_line = m_vdp1.framebuffer_display_lines[y]; bitmap_line = &bitmap.pix32(y); for ( x = mycliprect.min_x; x <= mycliprect.max_x; x++ ) @@ -6617,7 +6543,7 @@ static void draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, const r r = pal5bit( pix & 0x001f); if ( color_offset_pal ) { - stv_vdp2_compute_color_offset( machine, &r, &g, &b, STV_VDP2_SPCOSL ); + stv_vdp2_compute_color_offset( &r, &g, &b, STV_VDP2_SPCOSL ); } ccr = sprite_ccr[0]; if ( STV_VDP2_CCMD ) @@ -6669,15 +6595,15 @@ static void draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, const r { if ( STV_VDP2_CCMD ) { - bitmap_line[x] = stv_add_blend( bitmap_line[x], machine.pens[pix] ); + bitmap_line[x] = stv_add_blend( bitmap_line[x], machine().pens[pix] ); } else { - bitmap_line[x] = alpha_blend_r32( bitmap_line[x], machine.pens[pix], ((UINT16)(0x1f-ccr)*0xff)/0x1f ); + bitmap_line[x] = alpha_blend_r32( bitmap_line[x], machine().pens[pix], ((UINT16)(0x1f-ccr)*0xff)/0x1f ); } } else - bitmap_line[x] = machine.pens[pix]; + bitmap_line[x] = machine().pens[pix]; } } @@ -6703,7 +6629,7 @@ static void draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, const r if (stv_sprite_priorities_in_fb_line[y][pri] == 0) continue; - framebuffer_line = state->m_vdp1.framebuffer_display_lines[y]; + framebuffer_line = m_vdp1.framebuffer_display_lines[y]; if ( interlace_framebuffer == 0 ) { bitmap_line = &bitmap.pix32(y); @@ -6731,7 +6657,7 @@ static void draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, const r r = pal5bit( pix & 0x001f); if ( color_offset_pal ) { - stv_vdp2_compute_color_offset( machine, &r, &g, &b, STV_VDP2_SPCOSL ); + stv_vdp2_compute_color_offset( &r, &g, &b, STV_VDP2_SPCOSL ); } if ( alpha_enabled == 0 ) { @@ -6833,15 +6759,15 @@ static void draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, const r { if(double_x) { - bitmap_line[x*2] = machine.pens[ pix ]; - if ( interlace_framebuffer == 1 ) bitmap_line2[x*2] = machine.pens[ pix ]; - bitmap_line[x*2+1] = machine.pens[ pix ]; - if ( interlace_framebuffer == 1 ) bitmap_line2[x*2+1] = machine.pens[ pix ]; + bitmap_line[x*2] = machine().pens[ pix ]; + if ( interlace_framebuffer == 1 ) bitmap_line2[x*2] = machine().pens[ pix ]; + bitmap_line[x*2+1] = machine().pens[ pix ]; + if ( interlace_framebuffer == 1 ) bitmap_line2[x*2+1] = machine().pens[ pix ]; } else { - bitmap_line[x] = machine.pens[ pix ]; - if ( interlace_framebuffer == 1 ) bitmap_line2[x] = machine.pens[ pix ]; + bitmap_line[x] = machine().pens[ pix ]; + if ( interlace_framebuffer == 1 ) bitmap_line2[x] = machine().pens[ pix ]; } } else // alpha_blend == 1 @@ -6850,30 +6776,30 @@ static void draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, const r { if(double_x) { - bitmap_line[x*2] = stv_add_blend( bitmap_line[x*2], machine.pens[pix] ); - if ( interlace_framebuffer == 1 ) bitmap_line2[x*2] = stv_add_blend( bitmap_line2[x], machine.pens[pix] ); - bitmap_line[x*2+1] = stv_add_blend( bitmap_line[x*2+1], machine.pens[pix] ); - if ( interlace_framebuffer == 1 ) bitmap_line2[x*2+1] = stv_add_blend( bitmap_line2[x], machine.pens[pix] ); + bitmap_line[x*2] = stv_add_blend( bitmap_line[x*2], machine().pens[pix] ); + if ( interlace_framebuffer == 1 ) bitmap_line2[x*2] = stv_add_blend( bitmap_line2[x], machine().pens[pix] ); + bitmap_line[x*2+1] = stv_add_blend( bitmap_line[x*2+1], machine().pens[pix] ); + if ( interlace_framebuffer == 1 ) bitmap_line2[x*2+1] = stv_add_blend( bitmap_line2[x], machine().pens[pix] ); } else { - bitmap_line[x] = stv_add_blend( bitmap_line[x], machine.pens[pix] ); - if ( interlace_framebuffer == 1 ) bitmap_line2[x] = stv_add_blend( bitmap_line2[x], machine.pens[pix] ); + bitmap_line[x] = stv_add_blend( bitmap_line[x], machine().pens[pix] ); + if ( interlace_framebuffer == 1 ) bitmap_line2[x] = stv_add_blend( bitmap_line2[x], machine().pens[pix] ); } } else { if(double_x) { - bitmap_line[x*2] = alpha_blend_r32( bitmap_line[x*2], machine.pens[pix], ((UINT16)(0x1f-ccr)*0xff)/0x1f ); - if ( interlace_framebuffer == 1 ) bitmap_line2[x*2] = alpha_blend_r32( bitmap_line2[x], machine.pens[pix], ((UINT16)(0x1f-ccr)*0xff)/0x1f ); - bitmap_line[x*2+1] = alpha_blend_r32( bitmap_line[x*2+1], machine.pens[pix], ((UINT16)(0x1f-ccr)*0xff)/0x1f ); - if ( interlace_framebuffer == 1 ) bitmap_line2[x*2+1] = alpha_blend_r32( bitmap_line2[x], machine.pens[pix], ((UINT16)(0x1f-ccr)*0xff)/0x1f ); + bitmap_line[x*2] = alpha_blend_r32( bitmap_line[x*2], machine().pens[pix], ((UINT16)(0x1f-ccr)*0xff)/0x1f ); + if ( interlace_framebuffer == 1 ) bitmap_line2[x*2] = alpha_blend_r32( bitmap_line2[x], machine().pens[pix], ((UINT16)(0x1f-ccr)*0xff)/0x1f ); + bitmap_line[x*2+1] = alpha_blend_r32( bitmap_line[x*2+1], machine().pens[pix], ((UINT16)(0x1f-ccr)*0xff)/0x1f ); + if ( interlace_framebuffer == 1 ) bitmap_line2[x*2+1] = alpha_blend_r32( bitmap_line2[x], machine().pens[pix], ((UINT16)(0x1f-ccr)*0xff)/0x1f ); } else { - bitmap_line[x] = alpha_blend_r32( bitmap_line[x], machine.pens[pix], ((UINT16)(0x1f-ccr)*0xff)/0x1f ); - if ( interlace_framebuffer == 1 ) bitmap_line2[x] = alpha_blend_r32( bitmap_line2[x], machine.pens[pix], ((UINT16)(0x1f-ccr)*0xff)/0x1f ); + bitmap_line[x] = alpha_blend_r32( bitmap_line[x], machine().pens[pix], ((UINT16)(0x1f-ccr)*0xff)/0x1f ); + if ( interlace_framebuffer == 1 ) bitmap_line2[x] = alpha_blend_r32( bitmap_line2[x], machine().pens[pix], ((UINT16)(0x1f-ccr)*0xff)/0x1f ); } } } @@ -6907,44 +6833,9 @@ static void draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, const r UINT32 saturn_state::screen_update_stv_vdp2(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - saturn_state *state = machine().driver_data(); + stv_vdp2_fade_effects(); - stv_vdp2_fade_effects(machine()); - - stv_vdp2_draw_back(machine(), m_tmpbitmap,cliprect); - - #if DEBUG_MODE - if(machine().input().code_pressed_once(KEYCODE_T)) - { - vdpdebug.l_en^=1; - popmessage("NBG3 %sabled",vdpdebug.l_en & 1 ? "en" : "dis"); - } - if(machine().input().code_pressed_once(KEYCODE_Y)) - { - vdpdebug.l_en^=2; - popmessage("NBG2 %sabled",vdpdebug.l_en & 2 ? "en" : "dis"); - } - if(machine().input().code_pressed_once(KEYCODE_U)) - { - vdpdebug.l_en^=4; - popmessage("NBG1 %sabled",vdpdebug.l_en & 4 ? "en" : "dis"); - } - if(machine().input().code_pressed_once(KEYCODE_I)) - { - vdpdebug.l_en^=8; - popmessage("NBG0 %sabled",vdpdebug.l_en & 8 ? "en" : "dis"); - } - if(machine().input().code_pressed_once(KEYCODE_K)) - { - vdpdebug.l_en^=0x10; - popmessage("RBG0 %sabled",vdpdebug.l_en & 0x10 ? "en" : "dis"); - } - if(machine().input().code_pressed_once(KEYCODE_O)) - { - vdpdebug.l_en^=0x20; - popmessage("SPRITE %sabled",vdpdebug.l_en & 0x20 ? "en" : "dis"); - } - #endif + stv_vdp2_draw_back(m_tmpbitmap,cliprect); if(STV_VDP2_DISP) { @@ -6957,161 +6848,17 @@ UINT32 saturn_state::screen_update_stv_vdp2(screen_device &screen, bitmap_rgb32 /*If a plane has a priority value of zero it isn't shown at all.*/ for(pri=1;pri<8;pri++) { - if (vdpdebug.l_en & 1) { if(pri==STV_VDP2_N3PRIN) stv_vdp2_draw_NBG3(machine(), m_tmpbitmap,cliprect); } - if (vdpdebug.l_en & 2) { if(pri==STV_VDP2_N2PRIN) stv_vdp2_draw_NBG2(machine(), m_tmpbitmap,cliprect); } - if (vdpdebug.l_en & 4) { if(pri==STV_VDP2_N1PRIN) stv_vdp2_draw_NBG1(machine(), m_tmpbitmap,cliprect); } - if (vdpdebug.l_en & 8) { if(pri==STV_VDP2_N0PRIN) stv_vdp2_draw_NBG0(machine(), m_tmpbitmap,cliprect); } - if (vdpdebug.l_en & 0x10) { if(pri==STV_VDP2_R0PRIN) stv_vdp2_draw_RBG0(machine(), m_tmpbitmap,cliprect); } - if (vdpdebug.l_en & 0x20) { draw_sprites(machine(),m_tmpbitmap,cliprect,pri); } + if(pri==STV_VDP2_N3PRIN) { stv_vdp2_draw_NBG3(m_tmpbitmap,cliprect); } + if(pri==STV_VDP2_N2PRIN) { stv_vdp2_draw_NBG2(m_tmpbitmap,cliprect); } + if(pri==STV_VDP2_N1PRIN) { stv_vdp2_draw_NBG1(m_tmpbitmap,cliprect); } + if(pri==STV_VDP2_N0PRIN) { stv_vdp2_draw_NBG0(m_tmpbitmap,cliprect); } + if(pri==STV_VDP2_R0PRIN) { stv_vdp2_draw_RBG0(m_tmpbitmap,cliprect); } + { draw_sprites(m_tmpbitmap,cliprect,pri); } } } -#if DEBUG_MODE - /*popmessage("N0 %02x %04x %02x %04x N1 %02x %04x %02x %04x" - ,STV_VDP2_N0ZMXI,STV_VDP2_N0ZMXD - ,STV_VDP2_N0ZMYI,STV_VDP2_N0ZMYD - ,STV_VDP2_N1ZMXI,STV_VDP2_N1ZMXD - ,STV_VDP2_N1ZMYI,STV_VDP2_N1ZMYD);*/ - - if ( machine().input().code_pressed_once(KEYCODE_W) ) - { - int tilecode; - - for (tilecode = 0;tilecode<0x8000;tilecode++) - { - machine().gfx[0]->mark_dirty(tilecode); - } - - for (tilecode = 0;tilecode<0x2000;tilecode++) - { - machine().gfx[1]->mark_dirty(tilecode); - } - - for (tilecode = 0;tilecode<0x4000;tilecode++) - { - machine().gfx[2]->mark_dirty(tilecode); - } - - for (tilecode = 0;tilecode<0x1000;tilecode++) - { - machine().gfx[3]->mark_dirty(tilecode); - } - - /* vdp 1 ... doesn't have to be tile based */ - - for (tilecode = 0;tilecode<0x8000;tilecode++) - { - machine().gfx[4]->mark_dirty(tilecode); - } - for (tilecode = 0;tilecode<0x2000;tilecode++) - { - machine().gfx[5]->mark_dirty(tilecode); - } - for (tilecode = 0;tilecode<0x4000;tilecode++) - { - machine().gfx[6]->mark_dirty(tilecode); - } - for (tilecode = 0;tilecode<0x1000;tilecode++) - { - machine().gfx[7]->mark_dirty(tilecode); - } - } - - if ( machine().input().code_pressed_once(KEYCODE_N) ) - { - FILE *fp; - - fp=fopen("mamevdp1", "w+b"); - if (fp) - { - fwrite(m_vdp1_vram, 0x80000, 1, fp); - fclose(fp); - } - } - - if ( machine().input().code_pressed_once(KEYCODE_M) ) - { - FILE *fp; - - fp=fopen("vdp1_vram.bin", "r+b"); - if (fp) - { - fread(m_vdp1_vram, 0x80000, 1, fp); - fclose(fp); - } - } - -#endif - copybitmap(bitmap, m_tmpbitmap, 0, 0, 0, 0, cliprect); - return 0; } -/* below is some old code we might use .. */ - -#if 0 - -static void stv_dump_ram() -{ - FILE *fp; - - fp=fopen("workraml.dmp", "w+b"); - if (fp) - { - fwrite(stv_workram_l, 0x00100000, 1, fp); - fclose(fp); - } - fp=fopen("workramh.dmp", "w+b"); - if (fp) - { - fwrite(stv_workram_h, 0x00100000, 1, fp); - fclose(fp); - } - fp=fopen("scu.dmp", "w+b"); - if (fp) - { - fwrite(stv_scu, 0xd0, 1, fp); - fclose(fp); - } - fp=fopen("stv_a0_vram.dmp", "w+b"); - if (fp) - { - fwrite(stv_a0_vram, 0x00020000, 1, fp); - fclose(fp); - } - fp=fopen("stv_a1_vram.dmp", "w+b"); - if (fp) - { - fwrite(stv_a1_vram, 0x00020000, 1, fp); - fclose(fp); - } - fp=fopen("stv_b0_vram.dmp", "w+b"); - if (fp) - { - fwrite(stv_b0_vram, 0x00020000, 1, fp); - fclose(fp); - } - fp=fopen("stv_b1_vram.dmp", "w+b"); - if (fp) - { - fwrite(stv_b1_vram, 0x00020000, 1, fp); - fclose(fp); - } - fp=fopen("cram.dmp", "w+b"); - if (fp) - { - fwrite(stv_cram, 0x00080000, 1, fp); - fclose(fp); - } - fp=fopen("68k.dmp", "w+b"); - if (fp) - { - fwrite(machine.root_device().memregion(REGION_CPU3)->base(), 0x100000, 1, fp); - fclose(fp); - } -} - - -#endif