Example #1
0
/***************************************************************************
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 sprint2_read_sync(int offset)
{
    static int ac_line=0x00;

    ac_line=(ac_line+1) % 3;
    if (ac_line==0)
        return ((input_port_3_r(0) & 0x7f) | 0x80);
    else
        return (input_port_3_r(0) & 0x7F);
}
Example #2
0
static READ_HANDLER( fireone_input_r )
{
	static const UINT8 fireone_paddle_map[64] =
	{
		0x00,0x01,0x03,0x02,0x06,0x07,0x05,0x04,
		0x0c,0x0d,0x0f,0x0e,0x0a,0x0b,0x09,0x08,
		0x18,0x19,0x1b,0x1a,0x1e,0x1f,0x1d,0x1c,
		0x14,0x15,0x17,0x16,0x12,0x13,0x11,0x10,
		0x30,0x31,0x33,0x32,0x36,0x37,0x35,0x34,
		0x3c,0x3d,0x3f,0x3e,0x3a,0x3b,0x39,0x38,
		0x28,0x29,0x2b,0x2a,0x2e,0x2f,0x2d,0x2c,
		0x24,0x25,0x27,0x26,0x22,0x23,0x21,0x20
	};
	int temp;

	switch (offset & 15)
	{
		case 0:	return input_port_0_r(0);
		case 1: return input_port_1_r(0);
		case 2:
			temp = fireone_select ? input_port_2_r(0) : input_port_3_r(0);
			temp = (temp & 0xc0) | fireone_paddle_map[temp & 0x3f];
			return temp;
		default: return 0xff;
	}
}
Example #3
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;
	}
}
Example #4
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;
}
Example #5
0
int crbaloon_IN3_r(int offset)
{
	if (val08 & 0x02)
		/* enable coin & start input? Wild guess!!! */
		return input_port_3_r(0);

	/* the following is needed for the game to boot up */
	if (val0a & 0x01)
	{
		return (input_port_3_r(0) & 0x0f) | 0x00;
	}
	else
	{
		return (input_port_3_r(0) & 0x0f) | 0x00;
	}
}
Example #6
0
static WRITE8_HANDLER( b_via_0_pa_w )
{
	if ((data & 0x08) == 0)
		cpunum_set_input_line(1, INPUT_LINE_RESET, ASSERT_LINE);
	else
		cpunum_set_input_line(1, INPUT_LINE_RESET, CLEAR_LINE);

	if ((data & 0x04) == 0)
	{
		switch (data & 0x03)
		{
		case 0:
			pbus = input_port_0_r(0);
			break;
		case 1:
			pbus = input_port_1_r(0) | (input_port_2_r(0) << 4);
			break;
		case 2:
			pbus = input_port_3_r(0);
			break;
		case 3:
			pbus = 0xff;
			break;
		}
	}
}
Example #7
0
static READ8_HANDLER( dsw0_port_r )
{
	// vblank replaces the cabinet dip

	return ( ( input_port_2_r(0) & 0x7F ) |		// dsw0
   			 ( input_port_3_r(0) & 0x80 ) );	// vblank
}
Example #8
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;
}
Example #9
0
static READ8_HANDLER( dsw0_port_r )
{
	/* vblank replaces the cabinet dip */

	return ( ( input_port_2_r(0) & 0x7F ) |		/* dsw0 */
   			 ( input_port_3_r(0) & 0x80 ) );	/* vblank */
}
Example #10
0
/***************************************************************************
Steering

When D7 is high, the steering wheel has moved.
If D6 is high, it moved left.  If D6 is low, it moved right.
Be sure to keep returning a direction until steer_reset is called.
***************************************************************************/
static int subs_steering_1(void)
{
        static int last_val=0;
        int this_val;
        int delta;

        this_val=input_port_3_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_buf1+=(delta/4);

        if (subs_steering_buf1>0)
        {
                subs_steering_buf1--;
                subs_steering_val1=0xC0;
        }
        else if (subs_steering_buf1<0)
        {
                subs_steering_buf1++;
                subs_steering_val1=0x80;
        }

        return subs_steering_val1;
}
Example #11
0
void invaders_vh_flipscreen(int data)
{
    if (input_port_3_r(0) & 0x01)
    {
        if (data != flipped)
        {
            int x,y;
            int x_size = 256, y_size = 224;
            int x_start = 0, y_start = 0;
            int x_last, y_last;
            if (Machine->orientation & ORIENTATION_SWAP_XY)
            {
                int tw = x_size;
                x_size = y_size, y_size = tw;
            }
            if (Machine->orientation & ORIENTATION_FLIP_X)
                x_start = 256-x_size;
            if (Machine->orientation & ORIENTATION_FLIP_Y)
                y_start = 256-y_size;
            x_last = x_start+x_size-1;
            y_last = y_start+y_size-1;
            for (y = 0; y < y_size; y++)
            {
                for (x = 0; x < x_size/2; x++)
                {
                    int col = tmpbitmap->line[y_last-y][x_last-x];
                    Machine->scrbitmap->line[y_last-y][x_last-x] = tmpbitmap->line[y_last-y][x_last-x] = tmpbitmap->line[y_start+y][x_start+x];
                    Machine->scrbitmap->line[y_start+y][x_start+x] = tmpbitmap->line[y_start+y][x_start+x] = col;
                }
            }
            flipped = data;
        }
    }
}
Example #12
0
int nitedrvr_in0_r(int offset)
{
	int gear;

	gear=input_port_2_r(0);
	if (gear & 0x10)				nitedrvr_gear=1;
	else if (gear & 0x20)			nitedrvr_gear=2;
	else if (gear & 0x40)			nitedrvr_gear=3;
	else if (gear & 0x80)			nitedrvr_gear=4;

	switch (offset & 0x03)
	{
		case 0x00:						/* No remapping necessary */
			return input_port_0_r(0);
		case 0x01:						/* No remapping necessary */
			return input_port_1_r(0);
		case 0x02:						/* Remap our gear shift */
			if (nitedrvr_gear==1)		return 0xE0;
			else if (nitedrvr_gear==2)	return 0xD0;
			else if (nitedrvr_gear==3)	return 0xB0;
			else						return 0x70;
		case 0x03:						/* Remap our steering */
			return (input_port_3_r(0) | nitedrvr_steering());
		default:
			return 0xFF;
	}
}
Example #13
0
static READ_HANDLER( sharkatt_8255_r )
{
	switch (offset & 0x03)
	{
		case 1:
			/* SWITCH BANK 1 - B6 */
			if (PA_8255 & 0x01)
				return input_port_0_r(offset);
			/* SWITCH BANK 0 - B5 */
			if (PA_8255 & 0x02)
				return input_port_1_r(offset);
			/* PFPCONN - B8 */
			if (PA_8255 & 0x04)
				return input_port_2_r(offset);
			/* PFDCONN - B7 */
			if (PA_8255 & 0x08)
				return input_port_3_r(offset);

			//logerror("8255: read from port B, PA = %X\n",PA_8255);
			break;
		default:
			//logerror("8255: read from port<>B, offset %d\n",offset);
			break;
	}

	return 0;
}
Example #14
0
static INTERRUPT_GEN( thief_interrupt )
{
	/* SLAM switch causes an NMI if it's pressed */
	if( (input_port_3_r(0) & 0x10) == 0 )
		cpunum_set_input_line(0, INPUT_LINE_NMI, PULSE_LINE);
	else
		cpunum_set_input_line(0, 0, HOLD_LINE);
}
Example #15
0
static WRITE8_HANDLER( track_reset_w )
{
	/* reset the trackball counters */
	last_trackball_val[0] = input_port_2_r(offset);
	last_trackball_val[1] = input_port_3_r(offset);

	watchdog_reset_w(offset,data);
}
Example #16
0
static READ_HANDLER( special_port3_r )
{
	int temp = input_port_3_r(offset);
	if (!(readinputport(0) & 0x8000)) temp ^= 0x80;
	if (atarigen_cpu_to_sound_ready) temp ^= 0x40;
	if (atarigen_sound_to_cpu_ready) temp ^= 0x20;
	return temp;
}
Example #17
0
static int sharkatt_interrupt(void)
{
	/* SLAM switch causes an NMI if it's pressed */
	if ((input_port_3_r(0) & 0x10) == 0)
		return nmi_interrupt();

	return interrupt();
}
Example #18
0
int punchout_input_3_r(int offset)
{
	int data = input_port_3_r(offset);
	/* bit 4 is busy pin level */
	if( VLM5030_BSY() ) data &= ~0x10;
	else data |= 0x10;
	return data;
}
Example #19
0
static WRITE_HANDLER( blockade_videoram_w )
{
	videoram_w(offset, data);
	if (input_port_3_r(0) & 0x80)
	{
		logerror("blockade_videoram_w: scanline %d\n", cpu_getscanline());
		cpu_spinuntil_int();
	}
}
Example #20
0
void invaders_flip_screen_w(int data)
{
	set_vh_global_attribute(&color_map_select, data);

	if (input_port_3_r(0) & 0x01)
	{
		flip_screen_w(0, data);
	}
}
Example #21
0
int arkanoid_input_2_r (int offset)
{
	if (arkanoid_paddle_select)
	{
		return input_port_3_r(offset);
	}
	else
	{
		return input_port_2_r(offset);
	}
}
Example #22
0
static READ8_HANDLER( quasar_IO_r )
{
	unsigned int ans = 0;

	if (IOpage == 8) ans = input_port_0_r(0);
	if (IOpage == 9) ans = input_port_1_r(0);
	if (IOpage == 10) ans = input_port_2_r(0);
	if (IOpage == 11) ans = input_port_3_r(0);

	return ans;
}
Example #23
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;
}
Example #24
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;
	}
}
Example #25
0
int skydiver_input_3_r(int offset)
{
	int data = input_port_3_r(0);

	switch(offset)
	{
		case 0:		return ((data & 0x03) << 6);
		case 1:		return ((data & 0x0C) << 4);
		case 2:		return ((data & 0x30) << 2);
		case 3:		return ((data & 0xC0) << 0);
		default:		return 0;
	}
}
Example #26
0
ADDRESS_MAP_END

/*********************************************************************/

static READ8_HANDLER( cabalbl_snd_r )
{
	switch(offset){
		case 0x06: return input_port_3_r(0);
		case 0x08: return cabal_sound_command2;
		case 0x0a: return cabal_sound_command1;
		default: return(0xff);
	}
}
Example #27
0
static int sym1_riot_b_r(int chip)
{
	int data = 0xff;
	if ( ((riot_0_a_r(0)^0xff)&(input_port_1_r(0)^0xff))&0x3f )
		data&=~1;
	if ( ((riot_0_a_r(0)^0xff)&(input_port_2_r(0)^0xff))&0x3f )
		data&=~2;
	if ( ((riot_0_a_r(0)^0xff)&(input_port_3_r(0)^0xff))&0x3f )
		data&=~4;
	data&=~0x80; // else hangs 8b02

	return data;
}
Example #28
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;
    }
}
Example #29
0
int fireone_input_r(int address)
{
    switch(address & 0xf) {
    case 0:
		return input_port_0_r(0);
    case 1:
		return input_port_1_r(0);
    case 2:
		/* Throttle, should be analog too */
		return fireone_sell ? input_port_2_r(0) : input_port_3_r(0);
    default:
		return 0xff;
    }
}
Example #30
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;
}