mirror of
https://github.com/holub/mame
synced 2025-05-22 13:48:55 +03:00
Fixed basic controls in 2 Minutes Drill & added preliminary shutter/defender sensors.
Still need proper ball hit/run sensors to get this working however.
This commit is contained in:
parent
3a068d3dfb
commit
a46691cd90
@ -9,8 +9,10 @@
|
||||
Tomasz Slanina
|
||||
|
||||
TODO:
|
||||
- simulate the sensors (and remove rom hack)
|
||||
- controls/dips
|
||||
- understand the ball hit sensor
|
||||
- simulate the sensors (there are still some shutter errors/defender errors that pops up)
|
||||
- Hook-up timers for shutter/defender sensors (check service mode)
|
||||
- Dip-Switches
|
||||
- find video control regs (layer enable, scroll)
|
||||
|
||||
BG scroll:
|
||||
@ -116,11 +118,107 @@ static VIDEO_START( drill )
|
||||
machine->gfx[0]->color_granularity=16;
|
||||
}
|
||||
|
||||
static READ16_HANDLER( drill_unk_r )
|
||||
static UINT16 *iodata;
|
||||
static UINT16 defender_sensor,shutter_sensor;
|
||||
|
||||
static READ16_HANDLER( drill_io_r )
|
||||
{
|
||||
// if(offset*2 == 0x4)
|
||||
// popmessage("PC=%08x %04x %04x %04x %04x %04x %04x %04x %04x",cpu_get_pc(space->cpu),iodata[0/2],iodata[2/2],iodata[4/2],iodata[6/2],iodata[8/2],iodata[0xa/2],iodata[0xc/2],iodata[0xe/2]);
|
||||
|
||||
switch(offset)
|
||||
{
|
||||
case 0x0/2: return input_port_read(space->machine, "DSW");
|
||||
case 0x2/2:
|
||||
{
|
||||
int arm_pwr = input_port_read(space->machine, "IN0");//throw
|
||||
//popmessage("PC=%08x %02x",cpu_get_pc(space->cpu),arm_pwr);
|
||||
|
||||
if(arm_pwr > 0xe0) return ~0x1800;
|
||||
if(arm_pwr > 0xc0) return ~0x1400;
|
||||
if(arm_pwr > 0x80) return ~0x1200;
|
||||
if(arm_pwr > 0x40) return ~0x1000;
|
||||
else return ~0x0000;
|
||||
}
|
||||
case 0x4/2: return (defender_sensor) | (shutter_sensor);
|
||||
case 0xe/2: return input_port_read(space->machine, "IN2");//coins
|
||||
// default: printf("PC=%08x [%04x] -> %04x R\n",cpu_get_pc(space->cpu),offset*2,iodata[offset]);
|
||||
}
|
||||
|
||||
return 0xffff;
|
||||
}
|
||||
|
||||
static WRITE16_HANDLER( drill_io_w )
|
||||
{
|
||||
COMBINE_DATA(&iodata[offset]);
|
||||
|
||||
switch(offset)
|
||||
{
|
||||
case 0x8/2:
|
||||
coin_counter_w(0,iodata[offset] & 0x0400);
|
||||
coin_counter_w(1,iodata[offset] & 0x0800);
|
||||
coin_lockout_w(0,~iodata[offset] & 0x0100);
|
||||
coin_lockout_w(1,~iodata[offset] & 0x0200);
|
||||
break;
|
||||
}
|
||||
|
||||
// if(data != 0 && offset != 8)
|
||||
// printf("PC=%08x [%04x] <- %04x W\n",cpu_get_pc(space->cpu),offset*2,data);
|
||||
}
|
||||
|
||||
/*
|
||||
PORT_DIPNAME( 0x0100, 0x0000, DEF_STR( Unknown ) )//up sensor <- shutter
|
||||
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x0100, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x0200, 0x0000, DEF_STR( Unknown ) )//down sensor
|
||||
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x0200, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x0400, 0x0000, DEF_STR( Unknown ) )//left sensor <-defender
|
||||
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x0400, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x0800, 0x0000, DEF_STR( Unknown ) )//right sensor
|
||||
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x0800, DEF_STR( On ) )
|
||||
*/
|
||||
#ifdef UNUSED_FUNCTION
|
||||
static TIMER_CALLBACK( shutter_req )
|
||||
{
|
||||
shutter_sensor = param;
|
||||
}
|
||||
|
||||
static TIMER_CALLBACK( defender_req )
|
||||
{
|
||||
defender_sensor = param;
|
||||
}
|
||||
#endif
|
||||
|
||||
static WRITE16_HANDLER( sensors_w )
|
||||
{
|
||||
/*---- xxxx ---- ---- select "lamps" (guess)*/
|
||||
/*---- ---- ---- -x-- lamp*/
|
||||
if(data & 1)
|
||||
{
|
||||
//timer_set( ATTOTIME_IN_SEC(2), NULL, 0x100, shutter_req );
|
||||
shutter_sensor = 0x100;
|
||||
}
|
||||
else if(data & 2)
|
||||
{
|
||||
//timer_set( ATTOTIME_IN_SEC(2), NULL, 0x200, shutter_req );
|
||||
shutter_sensor = 0x200;
|
||||
}
|
||||
|
||||
if(data & 0x1000 || data & 0x4000)
|
||||
{
|
||||
//timer_set( ATTOTIME_IN_SEC(2), NULL, 0x800, defender_req );
|
||||
defender_sensor = 0x800;
|
||||
}
|
||||
else if(data & 0x2000 || data & 0x8000)
|
||||
{
|
||||
//timer_set( ATTOTIME_IN_SEC(2), NULL, 0x400, defender_req );
|
||||
defender_sensor = 0x400;
|
||||
}
|
||||
}
|
||||
|
||||
static ADDRESS_MAP_START( drill_map, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
AM_RANGE(0x000000, 0x07ffff) AM_ROM
|
||||
AM_RANGE(0x200000, 0x20ffff) AM_RAM
|
||||
@ -134,16 +232,130 @@ static ADDRESS_MAP_START( drill_map, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
AM_RANGE(0x400000, 0x4fffff) AM_RAM AM_BASE(&unkram)// video stuff, 460000 - video regs ?
|
||||
AM_RANGE(0x500000, 0x501fff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_BASE(&paletteram16)
|
||||
AM_RANGE(0x502000, 0x503fff) AM_RAM
|
||||
AM_RANGE(0x700000, 0x70000f) AM_READ(drill_unk_r) AM_WRITE(SMH_NOP) // i/o
|
||||
AM_RANGE(0x600000, 0x600001) AM_READ(ym2610_status_port_0_a_lsb_r) AM_WRITE(ym2610_control_port_0_a_lsb_w)
|
||||
AM_RANGE(0x600002, 0x600003) AM_READ(ym2610_read_port_0_lsb_r) AM_WRITE(ym2610_data_port_0_a_lsb_w)
|
||||
AM_RANGE(0x600004, 0x600005) AM_READ(ym2610_status_port_0_b_lsb_r) AM_WRITE(ym2610_control_port_0_b_lsb_w)
|
||||
AM_RANGE(0x600006, 0x600007) AM_WRITE(ym2610_data_port_0_b_lsb_w)
|
||||
AM_RANGE(0x60000c, 0x60000d) AM_READ(SMH_NOP) AM_WRITE(SMH_NOP)
|
||||
AM_RANGE(0x60000e, 0x60000f) AM_READ(SMH_NOP) AM_WRITE(SMH_NOP)
|
||||
AM_RANGE(0x60000c, 0x60000d) AM_RAM
|
||||
AM_RANGE(0x60000e, 0x60000f) AM_RAM
|
||||
AM_RANGE(0x700000, 0x70000f) AM_READWRITE(drill_io_r,drill_io_w) AM_BASE(&iodata) // i/o
|
||||
AM_RANGE(0x800000, 0x800001) AM_WRITE(sensors_w)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static INPUT_PORTS_START( drill )
|
||||
PORT_START("DSW")//Dip-Switches
|
||||
PORT_DIPNAME( 0x0001, 0x0001, "DSW" )
|
||||
PORT_DIPSETTING( 0x0001, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unknown ) )
|
||||
PORT_DIPSETTING( 0x0002, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) )
|
||||
PORT_DIPSETTING( 0x0004, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) )
|
||||
PORT_DIPSETTING( 0x0008, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unknown ) )
|
||||
PORT_DIPSETTING( 0x0010, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) )
|
||||
PORT_DIPSETTING( 0x0020, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) )
|
||||
PORT_DIPSETTING( 0x0040, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) )
|
||||
PORT_DIPSETTING( 0x0080, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Unknown ) )
|
||||
PORT_DIPSETTING( 0x0100, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) )
|
||||
PORT_DIPSETTING( 0x0200, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unknown ) )
|
||||
PORT_DIPSETTING( 0x0400, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x0800, 0x0800, DEF_STR( Unknown ) )
|
||||
PORT_DIPSETTING( 0x0800, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Unknown ) )
|
||||
PORT_DIPSETTING( 0x1000, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Unknown ) )
|
||||
PORT_DIPSETTING( 0x2000, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Unknown ) )
|
||||
PORT_DIPSETTING( 0x4000, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Unknown ) )
|
||||
PORT_DIPSETTING( 0x8000, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
|
||||
|
||||
PORT_START("IN0")//sensors
|
||||
PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(20)
|
||||
|
||||
PORT_START("IN1")
|
||||
PORT_DIPNAME( 0x0001, 0x0000, "IN1" )
|
||||
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x0001, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x0002, 0x0000, DEF_STR( Unknown ) )
|
||||
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x0002, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x0004, 0x0000, DEF_STR( Unknown ) )
|
||||
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x0004, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) )
|
||||
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x0008, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x0010, 0x0000, DEF_STR( Unknown ) )
|
||||
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x0010, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x0020, 0x0000, DEF_STR( Unknown ) )
|
||||
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x0020, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x0040, 0x0000, DEF_STR( Unknown ) )
|
||||
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x0040, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x0080, 0x0000, DEF_STR( Unknown ) )
|
||||
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x0080, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x0100, 0x0000, DEF_STR( Unknown ) )//up sensor
|
||||
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x0100, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x0200, 0x0000, DEF_STR( Unknown ) )//down sensor
|
||||
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x0200, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x0400, 0x0000, DEF_STR( Unknown ) )//left sensor
|
||||
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x0400, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x0800, 0x0000, DEF_STR( Unknown ) )//right sensor
|
||||
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x0800, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x1000, 0x0000, DEF_STR( Unknown ) )
|
||||
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x1000, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x2000, 0x0000, DEF_STR( Unknown ) )
|
||||
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x2000, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x4000, 0x0000, DEF_STR( Unknown ) )
|
||||
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x4000, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x8000, 0x0000, DEF_STR( Unknown ) )
|
||||
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x8000, DEF_STR( On ) )
|
||||
|
||||
PORT_START("IN2")//coins
|
||||
PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_SERVICE )
|
||||
PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_SERVICE1 )
|
||||
PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_COIN1 )
|
||||
PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_UNUSED )
|
||||
PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Select SW-1")
|
||||
PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Select SW-2")
|
||||
PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Select SW-3")
|
||||
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Select SW-4")
|
||||
INPUT_PORTS_END
|
||||
|
||||
static const gfx_layout drill_layout =
|
||||
@ -170,7 +382,7 @@ static const gfx_layout vramlayout=
|
||||
|
||||
static GFXDECODE_START( 2mindril )
|
||||
GFXDECODE_ENTRY( "gfx1", 0, drill_layout, 0, 256 )
|
||||
GFXDECODE_ENTRY( NULL, 0, vramlayout, 0, 256 )
|
||||
GFXDECODE_ENTRY( NULL, 0, vramlayout, 0, 256 )
|
||||
GFXDECODE_END
|
||||
|
||||
|
||||
@ -238,7 +450,7 @@ static DRIVER_INIT( drill )
|
||||
// rearrange gfx roms to something we can decode, two of the roms form 4bpp of the graphics, the third forms another 2bpp but is in a different format
|
||||
UINT32 *src = (UINT32*)memory_region( machine, "gfx2" );
|
||||
UINT32 *dst = (UINT32*)memory_region( machine, "gfx1" );// + 0x400000;
|
||||
UINT8 *rom = memory_region( machine, "main" );
|
||||
// UINT8 *rom = memory_region( machine, "main" );
|
||||
int i;
|
||||
|
||||
for (i=0; i< 0x400000/4; i++)
|
||||
@ -249,10 +461,10 @@ static DRIVER_INIT( drill )
|
||||
}
|
||||
|
||||
//enable some kind of debug mode (ignore errors)
|
||||
rom[0x7fffb]=0;
|
||||
rom[0x7fffc]=0;
|
||||
rom[0x7fffd]=0;
|
||||
rom[0x7fffe]=0;
|
||||
// rom[0x7fffb]=0;
|
||||
// rom[0x7fffc]=0;
|
||||
// rom[0x7fffd]=0;
|
||||
// rom[0x7fffe]=0;
|
||||
}
|
||||
|
||||
GAME( 1993, 2mindril, 0, drill, drill, drill, ROT0, "Taito", "Two Minute Drill", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS )
|
||||
|
Loading…
Reference in New Issue
Block a user