From 3d124fec64b97c522efb4e8aa2942f9b894c0a25 Mon Sep 17 00:00:00 2001 From: Angelo Salese Date: Sat, 6 Aug 2011 14:43:21 +0000 Subject: [PATCH] Port from MESS, nw --- src/mame/drivers/saturn.c | 6 +++++- src/mame/includes/stv.h | 1 - src/mame/machine/smpc.c | 3 ++- src/mame/video/stvvdp1.c | 34 ++++++++++++++++++++++++++++++---- src/mame/video/stvvdp2.c | 9 ++++++--- 5 files changed, 43 insertions(+), 10 deletions(-) diff --git a/src/mame/drivers/saturn.c b/src/mame/drivers/saturn.c index 2eddbae0f36..95fb03b6365 100644 --- a/src/mame/drivers/saturn.c +++ b/src/mame/drivers/saturn.c @@ -1793,6 +1793,9 @@ static TIMER_DEVICE_CALLBACK( saturn_scanline ) state->m_scu.ist |= (IRQ_HBLANK_IN); } + if(scanline == (vblank_line+1)*y_step && STV_VDP1_VBE) + state->m_vdp1.framebuffer_clear_on_next_frame = 1; + if(scanline == (state->m_scu_regs[36] & 0x3ff)*y_step) { if(!(state->m_scu.ism & IRQ_TIMER_0)) @@ -1820,7 +1823,7 @@ static TIMER_DEVICE_CALLBACK( saturn_scanline ) } } - if(scanline == vblank_line*y_step) + if(scanline == (vblank_line)*y_step) { video_update_vdp1(timer.machine()); @@ -2037,6 +2040,7 @@ static MACHINE_CONFIG_START( stv, saturn_state ) MCFG_CPU_ADD("slave", SH2, MASTER_CLOCK_352/2) // 28.6364 MHz MCFG_CPU_PROGRAM_MAP(stv_mem) MCFG_CPU_CONFIG(sh2_conf_slave) + MCFG_TIMER_ADD_SCANLINE("slave_scantimer", saturn_slave_scanline, "screen", 0, 1) MCFG_CPU_ADD("audiocpu", M68000, 11289600) //11.2896 MHz MCFG_CPU_PROGRAM_MAP(sound_mem) diff --git a/src/mame/includes/stv.h b/src/mame/includes/stv.h index f3abffe7777..942324ae779 100644 --- a/src/mame/includes/stv.h +++ b/src/mame/includes/stv.h @@ -137,7 +137,6 @@ DRIVER_INIT ( stv ); /*----------- defined in drivers/stvinit.c -----------*/ -UINT8 get_vblank(running_machine &machine); void install_stvbios_speedups(running_machine &machine); DRIVER_INIT(mausuke); DRIVER_INIT(puyosun); diff --git a/src/mame/machine/smpc.c b/src/mame/machine/smpc.c index 821a12c9b10..04b4da93c2c 100644 --- a/src/mame/machine/smpc.c +++ b/src/mame/machine/smpc.c @@ -599,7 +599,8 @@ WRITE8_HANDLER( stv_SMPC_w ) // we've processed the command, clear status flag state->m_smpc_ram[0x5f] = data; //read-back command - state->m_smpc_ram[0x63] = 0x00; + if(data != 0x10) + state->m_smpc_ram[0x63] = 0x00; /*TODO:emulate the timing of each command...*/ } } diff --git a/src/mame/video/stvvdp1.c b/src/mame/video/stvvdp1.c index 8822789038d..37089a9a719 100644 --- a/src/mame/video/stvvdp1.c +++ b/src/mame/video/stvvdp1.c @@ -294,8 +294,6 @@ WRITE16_HANDLER( saturn_vdp1_regs_w ) case 0x00/2: stv_set_framebuffer_config(space->machine()); if ( VDP1_LOG ) logerror( "VDP1: Access to register TVMR = %1X\n", STV_VDP1_TVMR ); - if ( STV_VDP1_VBE && get_vblank(space->machine()) ) - state->m_vdp1.framebuffer_clear_on_next_frame = 1; break; case 0x02/2: @@ -364,7 +362,27 @@ WRITE32_HANDLER ( saturn_vdp1_framebuffer0_w ) if ( STV_VDP1_TVM & 1 ) { /* 8-bit mode */ - printf("VDP1 8-bit mode %08x %02x\n",offset,data); + //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; + } + 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; + } + 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; + } + 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; + } } else { @@ -388,7 +406,15 @@ READ32_HANDLER ( saturn_vdp1_framebuffer0_r ) if ( STV_VDP1_TVM & 1 ) { /* 8-bit mode */ - printf("VDP1 8-bit mode %08x\n",offset); + //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); + if ( ACCESSING_BITS_16_23 ) + result |= ((state->m_vdp1.framebuffer[state->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)); + if ( ACCESSING_BITS_0_7 ) + result |= ((state->m_vdp1.framebuffer[state->m_vdp1.framebuffer_current_draw][offset*2+1] & 0x00ff)); } else { diff --git a/src/mame/video/stvvdp2.c b/src/mame/video/stvvdp2.c index 6345203e52e..285fcb95d04 100644 --- a/src/mame/video/stvvdp2.c +++ b/src/mame/video/stvvdp2.c @@ -105,6 +105,7 @@ In other words,the first three types uses the offset and not the color allocated #include "profiler.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); @@ -4357,12 +4358,14 @@ static void stv_vdp2_check_tilemap(running_machine &machine, bitmap_t *bitmap, c /* Magical Drop III 0x200 -> color calculation window */ /* Ide Yousuke Meijin No Shin Jissen Mahjong 0x0303 */ - if(STV_VDP2_WCTLD & 0x2008) + /* Decathlete 0x088 */ + if(STV_VDP2_WCTLD & 0x2000) popmessage("Special window enabled %04x, contact MAMEdev",STV_VDP2_WCTLD); /* Shining Force III, After Burner 2 (doesn't make a proper use tho?) */ - if(STV_VDP2_W0LWE || STV_VDP2_W1LWE) - popmessage("Line Window %s %08x enabled, contact MAMEdev",STV_VDP2_W0LWE ? "0" : "1",STV_VDP2_W0LWTA); + /* Layer Section */ + //if(STV_VDP2_W0LWE || STV_VDP2_W1LWE) + // popmessage("Line Window %s %08x enabled, contact MAMEdev",STV_VDP2_W0LWE ? "0" : "1",STV_VDP2_W0LWTA); /* Akumajou Dracula, bits 2-4 */ /* Arcana Strikes bit 5*/