From 42abf3b0ccaea61ca04c60b582ae9a6a5fd1b13b Mon Sep 17 00:00:00 2001 From: Angelo Salese Date: Sat, 23 May 2009 11:47:02 +0000 Subject: [PATCH] Some ST-V fixes... --- src/mame/drivers/stv.c | 83 ++++++++++++++++++++++++++++------------ src/mame/mamedriv.c | 4 +- src/mame/video/stvvdp2.c | 29 +++++++++----- 3 files changed, 79 insertions(+), 37 deletions(-) diff --git a/src/mame/drivers/stv.c b/src/mame/drivers/stv.c index 64999300682..0fb8185563c 100644 --- a/src/mame/drivers/stv.c +++ b/src/mame/drivers/stv.c @@ -790,11 +790,13 @@ static int port_i; static READ32_HANDLER ( stv_io_r32 ) { // if(LOG_IOGA) logerror("(PC=%08X): I/O r %08X & %08X\n", cpu_get_pc(space->cpu), offset*4, mem_mask); -// popmessage("SEL: %02x MUX: %02x %02x %02x %02x %02x",port_sel,mux_data,ioga[1],ioga[2],ioga[3],ioga[5]); +// popmessage("SEL: %02x MUX: %02x OFF: %02x",port_sel,mux_data,offset*4); + +// printf("(PC=%08X): I/O r %08X & %08X\n", cpu_get_pc(space->cpu), offset*4, mem_mask); switch(offset) { - case 0: + case 0x00/4: switch(port_sel) { case 0x77: return 0xff000000|(input_port_read(space->machine, "P1") << 16) |0x0000ff00|(input_port_read(space->machine, "P2")); @@ -832,17 +834,18 @@ static READ32_HANDLER ( stv_io_r32 ) } } //default: + //case 0x40: return mame_rand(space->machine); default: //popmessage("%02x PORT SEL",port_sel); return (input_port_read(space->machine, "P1") << 16) | (input_port_read(space->machine, "P2")); } - case 1: + case 0x04/4: if ( strcmp(space->machine->gamedrv->name,"critcrsh") == 0 ) return ((input_port_read(space->machine, "SYSTEM") << 16) & ((input_port_read(space->machine, "P1") & 1) ? 0xffef0000 : 0xffff0000)) | (ioga[1]); else return (input_port_read(space->machine, "SYSTEM") << 16) | (ioga[1]); - case 2: + case 0x08/4: switch(port_sel) { case 0x77: return (input_port_read(space->machine, "UNUSED") << 16) | (input_port_read(space->machine, "EXTRA")); @@ -853,8 +856,7 @@ static READ32_HANDLER ( stv_io_r32 ) default: return 0xffffffff; } - break; - case 3: + case 0x0c/4: switch(port_sel) { case 0x60: return ((ioga[2] & 0xffff) << 16) | 0xffff; @@ -862,8 +864,8 @@ static READ32_HANDLER ( stv_io_r32 ) //popmessage("offs: 3 %02x",port_sel); return 0xffffffff; } - break; - case 5: + //case 0x10/4: + case 0x14/4: switch(port_sel) { case 0x77: @@ -877,8 +879,7 @@ static READ32_HANDLER ( stv_io_r32 ) } default: return 0xffffffff; } - break; - case 6: + case 0x18/4: switch(port_sel) { case 0x60: return ioga[5]; @@ -892,8 +893,7 @@ static READ32_HANDLER ( stv_io_r32 ) //popmessage("offs: 6 %02x",port_sel); return 0xffffffff; } - break; - case 7: + case 0x1c/4: if(LOG_IOGA) logerror("(PC %s=%06x) Warning: READ from PORT_AD\n", space->cpu->tag, cpu_get_pc(space->cpu)); popmessage("Read from PORT_AD"); port_i++; @@ -907,12 +907,14 @@ static WRITE32_HANDLER ( stv_io_w32 ) { // if(LOG_IOGA) logerror("(PC=%08X): I/O w %08X = %08X & %08X\n", cpu_get_pc(space->cpu), offset*4, data, mem_mask); +// printf("(PC=%08X): I/O w %08X = %08X & %08X\n", cpu_get_pc(space->cpu), offset*4, data, mem_mask); + switch(offset) { - case 1: + case 0x04/4: if(ACCESSING_BITS_0_7) { - /*Why does the BIOS tests these as ACTIVE HIGH?A program bug?*/ + /*Why does the BIOS tests these as ACTIVE HIGH? A program bug?*/ ioga[1] = (data) & 0xff; coin_counter_w(0,~data & 0x01); coin_counter_w(1,~data & 0x02); @@ -922,8 +924,8 @@ static WRITE32_HANDLER ( stv_io_w32 ) other bits reserved */ } - break; - case 2: + break; + case 0x08/4: if(ACCESSING_BITS_16_23) { ioga[2] = data >> 16; @@ -931,19 +933,26 @@ static WRITE32_HANDLER ( stv_io_w32 ) } else if(ACCESSING_BITS_0_7) ioga[2] = data; - break; - case 3: + break; + case 0x0c/4: if(ACCESSING_BITS_16_23) ioga[3] = data; - break; - case 4: + break; + case 0x10/4: if(ACCESSING_BITS_16_23) port_sel = (data & 0xffff0000) >> 16; - break; - case 5: + break; + case 0x14/4: if(ACCESSING_BITS_16_23) ioga[5] = data; - break; + break; + //case 0x18/4: + case 0x1c/4: + //technical bowling tests here + if(ACCESSING_BITS_16_23) + ioga[7] = data; + break; + } } @@ -2100,7 +2109,7 @@ static INPUT_PORTS_START( stv ) PORT_START("UNUSED") PORT_BIT ( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - /* Extra button layout, used by Power Instinct 3, Suikoenbu, Elan Doree, Golden Axe Duel & Astra SuperStar */ + /* Extra button layout, used by Power Instinct 3, Suikoenbu, Elan Doree, Golden Axe Duel & Astra SuperStars */ PORT_START("EXTRA") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(1) @@ -2141,6 +2150,32 @@ static INPUT_PORTS_START( stv ) PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("X") PORT_CODE(KEYCODE_E) PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("R trig") PORT_CODE(KEYCODE_S) #endif + + PORT_START("UNKNOWN") + PORT_DIPNAME( 0x01, 0x01, "UNK" ) + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) INPUT_PORTS_END static INPUT_PORTS_START( critcrsh ) diff --git a/src/mame/mamedriv.c b/src/mame/mamedriv.c index fc538c978ed..54d6c285316 100644 --- a/src/mame/mamedriv.c +++ b/src/mame/mamedriv.c @@ -4006,14 +4006,12 @@ DokiDoki Penguin Land *not confirmed DRIVER( stress ) /* 1998.10 Stress Busters */ DRIVER( elandore ) /* 1998.11 Touryuu Densetsu Elandore (Sai-Mate) */ DRIVER( sss ) /* 1998.12 Steep Slope Sliders (Capcom / Cave / Victor) */ + DRIVER( micrombc ) /* 1999.03 Microman Battle Charge */ DRIVER( sanjeon ) /* 1999.04 Sanjun Sujun (Sega / Deniam) */ DRIVER( danchih ) /* 1999.06 Danchi de Hanafuda Okusan Komeya Desuyo! (Altron (Tecmo License)) */ DRIVER( ffreveng ) /* 1999.09 Final Fight Revenge (Capcom) */ /* 2000.12 Danchi de Quiz Okusan Yontaku Desuyo! (Altron) */ - - DRIVER( micrombc ) - /* Sega Model 2 Games */ /* Model 2 (TGPs, Model 1 sound board) */ diff --git a/src/mame/video/stvvdp2.c b/src/mame/video/stvvdp2.c index a990937b229..78591c18896 100644 --- a/src/mame/video/stvvdp2.c +++ b/src/mame/video/stvvdp2.c @@ -5302,21 +5302,26 @@ UINT8 stv_get_vblank(running_machine *machine) /*some vblank lines measurements (according to Charles MacDonald)*/ static int get_vblank_duration(running_machine *machine) { + /* TODO: +64 is probably due of missing pixel clock/screen raw params hook-up. + Problem is, I don't know if it's possible to handle that in MAME with + all this dynamic resolution babblecrap... + */ + if(STV_VDP2_HRES & 4) { switch(STV_VDP2_HRES & 1) { - case 0: return 45; //31kHz Monitor - case 1: return 82; //Hi-Vision Monitor + case 0: return 45+64; //31kHz Monitor + case 1: return 82+64; //Hi-Vision Monitor } } switch(STV_VDP2_VRES & 3) { - case 0: return 39; //263-224 - case 1: return 23; //263-240 - case 2: return 7; //263-256 - case 3: return 7; //263-256 + case 0: return 39+64; //263-224 + case 1: return 23+64; //263-240 + case 2: return 7+64; //263-256 + case 3: return 7+64; //263-256 } return 0; @@ -5355,11 +5360,15 @@ READ32_HANDLER ( stv_vdp2_regs_r ) } case 0x8/4: /*H/V Counter Register*/ - /*H-Counter V-Counter */ - stv_vdp2_regs[offset] = (((video_screen_get_visible_area(space->machine->primary_screen)->max_x - 1)<<16)&0x3ff0000)|(((video_screen_get_visible_area(space->machine->primary_screen)->max_y - 1)<<0)& ((STV_VDP2_LSMD == 3) ? 0x7ff : 0x3ff)); + { + static UINT16 h_count,v_count; + /* TODO: handle various h/v settings. */ + h_count = video_screen_get_hpos(space->machine->primary_screen) & 0x3ff; + v_count = video_screen_get_vpos(space->machine->primary_screen) & (STV_VDP2_LSMD == 3 ? 0x7ff : 0x3ff); + stv_vdp2_regs[offset] = (h_count<<16)|(v_count); if(LOG_VDP2) logerror("CPU %s PC(%08x) = VDP2: H/V counter read : %08x\n", space->cpu->tag, cpu_get_pc(space->cpu),stv_vdp2_regs[offset]); - stv_vdp2_regs[offset] = 0; - break; + break; + } } return stv_vdp2_regs[offset]; }