/***************************************************************************
Sync

When reading from SYNC:
   D4 = ATTRACT
   D5 = VRESET
   D6 = VBLANK*
   D7 = some alternating signal!?!

The only one of these I really understand is the VBLANK...
***************************************************************************/
int dominos_sync_r(int offset)
{
		static int ac_line=0x00;

		ac_line=(ac_line+1) % 3;
		if (ac_line==0)
				return ((input_port_4_r(0) & 0x7F) | dominos_attract | 0x80);
		else
				return ((input_port_4_r(0) & 0x7F) | dominos_attract );
}
Exemple #2
0
static READ16_HANDLER( syvalion_input_bypass_r )
{
	/* Bypass TC0220IOC controller for analog input */

	data8_t	port = TC0220IOC_port_r(0);	/* read port number */

	switch( port )
	{
		case 0x08:				/* trackball y coords bottom 8 bits for 2nd player */
			return input_port_7_r(0);

		case 0x09:				/* trackball y coords top 8 bits for 2nd player */
			if (input_port_7_r(0) & 0x80)	/* y- direction (negative value) */
				return 0xff;
			else							/* y+ direction (positive value) */
				return 0x00;

		case 0x0a:				/* trackball x coords bottom 8 bits for 2nd player */
			return input_port_6_r(0);

		case 0x0b:				/* trackball x coords top 8 bits for 2nd player */
			if (input_port_6_r(0) & 0x80)	/* x- direction (negative value) */
				return 0xff;
			else							/* x+ direction (positive value) */
				return 0x00;

		case 0x0c:				/* trackball y coords bottom 8 bits for 2nd player */
			return input_port_5_r(0);

		case 0x0d:				/* trackball y coords top 8 bits for 1st player */
			if (input_port_5_r(0) & 0x80)	/* y- direction (negative value) */
				return 0xff;
			else							/* y+ direction (positive value) */
				return 0x00;

		case 0x0e:				/* trackball x coords bottom 8 bits for 1st player */
			return input_port_4_r(0);

		case 0x0f:				/* trackball x coords top 8 bits for 1st player */
			if (input_port_4_r(0) & 0x80)	/* x- direction (negative value) */
				return 0xff;
			else							/* x+ direction (positive value) */
				return 0x00;

		default:
			return TC0220IOC_portreg_r( offset );
	}
}
Exemple #3
0
static int subs_steering_2(void)
{
        static int last_val=0;
        int this_val;
        int delta;

        this_val=input_port_4_r(0);

        delta=this_val-last_val;
        last_val=this_val;
        if (delta>128) delta-=256;
        else if (delta<-128) delta+=256;
        /* Divide by four to make our steering less sensitive */
        subs_steering_buf2+=(delta/4);

        if (subs_steering_buf2>0)
        {
                subs_steering_buf2--;
                subs_steering_val2=0xC0;
        }
        else if (subs_steering_buf2<0)
        {
                subs_steering_buf2++;
                subs_steering_val2=0x80;
        }

        return subs_steering_val2;
}
Exemple #4
0
int gsword_port_read(int offset)
{
 	switch(offset)
	{
		case 0:
			return(input_port_4_r(0));
		case 1:
			return(input_port_3_r(0));
		case 2:
			return(input_port_1_r(0));
		case 3:
			return(input_port_0_r(0));
		case 5:
			port_select=5;
 		        data_nr=0;
			return(0);	
		case 8:
			port_select=8;
			return(0);	
		case 10:
			port_select=10;
			return(0);	
		default:
			return 0;
	}
}
static int medlanes_hardware_r(int offset)
{
static int last_offset = 0;
static int last_data = 0;
int data = 0;

	switch (offset)
	{
		case 0: 			   /* player 1 joystick */
			data = input_port_0_r(0);
			break;
		case 1: 			   /* player 2 joystick */
			data = input_port_1_r(0);
			break;
		case 2:				   /* player 1 + 2 buttons */
			data = input_port_4_r(0);
			break;
		case 3:				   /* coin slot + start buttons */
			data = input_port_3_r(0);
			break;
	}
#if VERBOSE
    if (errorlog)
	{
		if (offset != last_offset ||
			data != last_data)
		{
			last_offset = offset;
			last_data = data;
			fprintf(errorlog, "medlanes_hardware_r $1f0%d -> $%02x\n", last_offset, last_data);
		}
	}
#endif
    return data;
}
Exemple #6
0
static READ8_HANDLER(read_a00x)
{
 switch(offset)
 {
	case 0x02: return reg_a002;
	case 0x04: return readinputportbytag("A004");
  case 0x05: return readinputportbytag("A005");
  case 0x0c: return input_port_0_r(0); // stats / reset
	case 0x0e: return readinputportbytag("A00E");// coin/reset
 }


  if(offset==0x00) //muxed with A002?
  {
    switch(reg_a002&0x3f)
    {
      case 0x3b:
        return input_port_2_r(0);//bet10 / pay out
      case 0x3e:
        return input_port_3_r(0);//TODO : trace f564
      case 0x3d:
      	return input_port_4_r(0);
      default:
        logerror("A000 read with mux=0x%02x\n",reg_a002&0x3f);
    }
  }
  return 0xff;
}
Exemple #7
0
int nitedrvr_in1_r(int offset)
{
	static int ac_line=0x00;
	int port;

	ac_line=(ac_line+1) % 3;

	port=input_port_4_r(0);
	if (port & 0x10)				nitedrvr_track=0;
	else if (port & 0x20)			nitedrvr_track=1;
	else if (port & 0x40)			nitedrvr_track=2;

	switch (offset & 0x07)
	{
		case 0x00:
			return ((port & 0x01) << 7);
		case 0x01:
			return ((port & 0x02) << 6);
		case 0x02:
			return ((port & 0x04) << 5);
		case 0x03:
			return ((port & 0x08) << 4);
		case 0x04:
			if (nitedrvr_track == 1) return 0x80; else return 0x00;
		case 0x05:
			if (nitedrvr_track == 0) return 0x80; else return 0x00;
		case 0x06:
			/* TODO: fix alternating signal? */
			if (ac_line==0) return 0x80; else return 0x00;
		case 0x07:
			return 0x00;
		default:
			return 0xFF;
	}
}
Exemple #8
0
int vindictr_6502_switch_r (int offset)
{
	int temp = input_port_4_r (offset);

	if (!(input_port_2_r (offset) & 0x02)) temp ^= 0x80;
	if (atarigen_cpu_to_sound_ready) temp ^= 0x40;
	if (atarigen_sound_to_cpu_ready) temp ^= 0x20;

	return temp;
}
Exemple #9
0
static READ_HANDLER( starfire_input_r )
{
	switch (offset & 15)
	{
		case 0:	return input_port_0_r(0);
		case 1:	return input_port_1_r(0);	/* Note: need to loopback sounds lengths on that one */
		case 5: return input_port_4_r(0);
		case 6:	return input_port_2_r(0);
		case 7:	return input_port_3_r(0);
		default: return 0xff;
	}
}
Exemple #10
0
int toki_read_ports(int offset)
{
    switch(offset)
    {
		case 0:
			return input_port_3_r(0) + (input_port_4_r(0) << 8);
		case 2:
			return input_port_1_r(0) + (input_port_2_r(0) << 8);
		case 4:
			return input_port_0_r(0);
		default:
			return 0;
    }
}
Exemple #11
0
static INTERRUPT_GEN( vblank_int )
{
	int pedal_state = input_port_4_r(0);
	int i;

	/* update the pedals once per frame */
    for (i = 0; i < 2; i++)
	{
		pedal_value[i]--;
		if (pedal_state & (1 << i))
			pedal_value[i]++;
	}

	atarigen_video_int_gen();
}
Exemple #12
0
static int vblank_int(void)
{
	int pedal_state = input_port_4_r(0);
	int i;

	/* update the pedals once per frame */
    for (i = 0; i < 2; i++)
	{
		pedal_value[i]--;
		if (pedal_state & (1 << i))
			pedal_value[i]++;
	}

	return atarigen_video_int_gen();
}
Exemple #13
0
static READ_HANDLER( sichuan2_dsw1_r )
{
	int ret = input_port_3_r(0);

	/* Based on the coin mode fill in the upper bits */
	if (input_port_4_r(0) & 0x04)
	{
		/* Mode 1 */
		ret	|= (input_port_5_r(0) << 4);
	}
	else
	{
		/* Mode 2 */
		ret	|= (input_port_5_r(0) & 0xf0);
	}

	return ret;
}
Exemple #14
0
static READ_HANDLER( rastan_input_r )
{
	switch (offset)
	{
		case 0:
			return input_port_0_r (offset);
		case 2:
			return input_port_1_r (offset);
		case 6:
			return input_port_2_r (offset);
		case 8:
			return input_port_3_r (offset);
		case 10:
			return input_port_4_r (offset);
		default:
			return 0;
	}
}
Exemple #15
0
	AM_RANGE(0xf000, 0xffff) AM_RAM /* work ram */
ADDRESS_MAP_END

static READ8_HANDLER(mux_r)
{
/*
    76543210
        xxxx - input port #2
    xxxx     - dip switches (2x8 bits) (multiplexed)
*/
	int retval=input_port_2_r(0)&0x0f;
	switch(mux_port&0x30)
	{
		case 0x00: retval|=((input_port_4_r(0)&1)<<4)|((input_port_4_r(0)&0x10)<<1)|((input_port_5_r(0)&1)<<6)|((input_port_5_r(0)&0x10)<<3);break;
		case 0x10: retval|=((input_port_4_r(0)&2)<<3)|((input_port_4_r(0)&0x20)   )|((input_port_5_r(0)&2)<<5)|((input_port_5_r(0)&0x20)<<2);break;
		case 0x20: retval|=((input_port_4_r(0)&4)<<2)|((input_port_4_r(0)&0x40)>>1)|((input_port_5_r(0)&4)<<4)|((input_port_5_r(0)&0x40)<<1);break;
		case 0x30: retval|=((input_port_4_r(0)&8)<<1)|((input_port_4_r(0)&0x80)>>2)|((input_port_5_r(0)&8)<<3)|((input_port_5_r(0)&0x80)   );break;
	}
	return retval;
}
Exemple #16
0
static READ_HANDLER( snowbros_input_r )
{
	int ans = 0xff;

	switch (offset)
	{
		case 0:
			ans = (input_port_0_r (offset) << 8) + (input_port_3_r (offset));
            break;
		case 2:
			ans = (input_port_1_r (offset) << 8) + (input_port_4_r (offset));
            break;
		case 4:
			ans = input_port_2_r (offset) << 8;
            break;
	}

    return ans;
}
Exemple #17
0
int starfire_input_r(int address)
{
    switch(address & 0xf) {
    case 0:
		return input_port_0_r(0);
    case 1:
		/* Note : need to loopback sounds lengths on that one */
		return input_port_1_r(0);
    case 5:
		/* Throttle, should be analog too */
		return input_port_4_r(0);
    case 6:
		return input_port_2_r(0);
    case 7:
		return input_port_3_r(0);
    default:
		return 0xff;
    }
}
Exemple #18
0
static READ8_HANDLER( leprechn_input_port_r )
{
    switch (input_port_select)
    {
    case 0x01:
        return input_port_0_r(0);
    case 0x02:
        return input_port_2_r(0);
    case 0x04:
        return input_port_3_r(0);
    case 0x08:
        return input_port_1_r(0);
    case 0x40:
        return input_port_5_r(0);
    case 0x80:
        return input_port_4_r(0);
    }

    return 0xff;
}
Exemple #19
0
static READ8_HANDLER(data_408_r)
{
	/* 
		Hot Smash
		select_408=1 && bit 7==1 -> protection related ?
 		Setting this bit to high cause win/lose/game over etc
 		(see below)
  */		
	
	switch(select_408)
	{
		case    0: return 0; //pb?
		case    1: return is_pbillian?input_port_3_r(0):((spriteram[0x20]&1)?0x8c:input_port_3_r(0));
	
							/* 
								written by mcu ? (bit 7=1) (should be sequence of writes , 0x88+0x8c for example)
										
								0x82 = no ball
								0x83 = time over		
								0x84 = P1 score++
								0x86 = 0-1
								0x87 = 1-0
								0x88 = P1 WIN
								0x89 = Game Over
								0x8a = restart P1 side
								0x8b = restart P2 side
								0x8c = next level + restart
								
							*/
							 
		case    2: return input_port_4_r(0);	
		case    4: return input_port_0_r(0);
		case    8: return input_port_1_r(0);
		case 0x20: return 0; //pb ? 
		case 0x80: return 0; //pb?
		case 0xf0: return 0; //hs? 
		
	}
	logerror("408[%x] r at %x\n",select_408,activecpu_get_previouspc());
	return 0;
}
Exemple #20
0
static READ_HANDLER( liberatr_input_port_0_r )
{
	int	res ;
	int xdelta, ydelta;


	/* CTRLD selects whether we're reading the stick or the coins,
	   see memory map */

	if(*liberatr_ctrld)
	{
		/* 	mouse support */
		xdelta = input_port_4_r(0);
		ydelta = input_port_5_r(0);
		res = ( ((ydelta << 4) & 0xf0)  |  (xdelta & 0x0f) );
	}
	else
	{
		res = input_port_0_r(offset);
	}

	return res;
}
static int redalert_interrupt(void)
{
    static int lastcoin = 0;
    int newcoin;

    newcoin = input_port_4_r(0);

    if (newcoin)
    {
        if ((newcoin & 0x01) && !(lastcoin & 0x01))
        {
            lastcoin = newcoin;
            return nmi_interrupt();
        }
        if ((newcoin & 0x02) && !(lastcoin & 0x02))
        {
            lastcoin = newcoin;
            return nmi_interrupt();
        }
    }

    lastcoin = newcoin;
    return interrupt();
}
static void josvolly_8741_w(int num,int offset,int data,int log)
{
	JV8741 *mcu = &i8741[num];

	if(offset==1)
	{
#if __log__
if(log)
		logerror("PC=%04X 8741[%d] CW %02X\n",activecpu_get_pc(),num,data);
#endif

		/* read pointer */
		mcu->cmd = data;
		/* CMD */
		switch(data)
		{
		case 0:
			mcu->txd = data ^ 0x40;
			mcu->sts |= 0x02;
			break;
		case 1:
			mcu->txd = data ^ 0x40;
			mcu->sts |= 0x02;
#if 1
			/* ?? */
			mcu->rxd = 0;  /* SBSTS ( DIAG ) , killed */
			mcu->sts |= 0x01; /* RD ready */
#endif
			break;
		case 2:
#if 1
			mcu->rxd = input_port_4_r(0);  /* DSW2 */
			mcu->sts |= 0x01; /* RD ready */
#endif
			break;
		case 3: /* normal mode ? */
			break;

		case 0xf0: /* clear main sts ? */
			mcu->txd = data ^ 0x40;
			mcu->sts |= 0x02;
			break;
		}
	}
	else
	{
		/* data */
#if __log__
if(log)
		logerror("PC=%04X 8741[%d] DW %02X\n",activecpu_get_pc(),num,data);
#endif

		mcu->txd  = data^0x40; /* parity reverce ? */
		mcu->sts  |= 0x02;     /* TXD busy         */
#if 1
		/* interrupt ? */
		if(num==0)
		{
			if(josvolly_nmi_enable)
			{
				cpunum_set_input_line(1, INPUT_LINE_NMI, PULSE_LINE);
				josvolly_nmi_enable = 0;
			}
		}
#endif
	}
	josvolly_8741_do(num);
}
Exemple #23
0
/***************************************************************************
Coin inputs - Nothing special here.
***************************************************************************/
int sprint2_coins(int offset)
{
    return (input_port_4_r(0));
}