Exemplo n.º 1
0
void Stepper_reset_position(int id)
{
	steppers[id].step_pos    = 0;
	steppers[id].pattern     = 0x00;
	steppers[id].old_pattern = 0x00;

	update_optic(id);
}
Exemplo n.º 2
0
void stepper_reset_position(int which)
{
	step[which].step_pos    = 0;
	step[which].pattern     = 0x00;
	step[which].old_pattern = 0x00;

	update_optic(which);
}
Exemplo n.º 3
0
void stepper_device::device_reset()
{
	m_step_pos     = 0x00;
	m_abs_step_pos = 0x00;
	m_pattern      = 0x00;
	m_old_pattern  = 0x00;
	m_phase        = m_initphase;
	m_old_phase    = m_initphase;
	update_optic();
}
Exemplo n.º 4
0
int stepper_update(int which, UINT8 pattern)
{
	int changed = 0;

	pattern &= 0x0F;

	if ( step[which].pattern != pattern )
	{ /* pattern changed */
		int index,
			steps,
			pos;

		if ( step[which].pattern )
		{
			step[which].old_pattern = step[which].pattern;
		}
		step[which].pattern = pattern;

		index = (step[which].old_pattern << 4) | pattern;
		switch ( step[which].type )
		{
			default:
			case STARPOINT_48STEP_REEL :	/* STARPOINT RMxxx */
			case STARPOINT_144STEPS_DICE :  /* STARPOINT 1DCU DICE mechanism */
			steps = StarpointStepTab[ index ];
			break;
			case BARCREST_48STEP_REEL :	    /* Barcrest reel units have different windings */
			steps = BarcrestStepTab[ index ];
			break;
		}
		#if 0 /* Assists with new index generation */
		if ( which ==0 )logerror("which %d Index %d Steps %d Pattern Old %02X New %02X\n",which,index,steps,step[which].old_pattern,step[which].pattern);
		#endif

		if ( steps )
		{
			pos = step[which].step_pos + steps;

			if ( pos > step[which].max_steps ) pos -= step[which].max_steps;
			else if ( pos < 0 )                 pos += step[which].max_steps;

			step[which].step_pos = pos;
			update_optic(which);

			changed++;
		}
	}
	return changed;
}
Exemplo n.º 5
0
int Stepper_update(int id, UINT8 pattern)
{
	int changed = 0;

	pattern &= 0x0F;

	if ( steppers[id].pattern != pattern )
	{ // pattern changed
		int index,
			steps,
			pos;

		if ( steppers[id].pattern )
		{
			steppers[id].old_pattern = steppers[id].pattern;
		}
		steppers[id].pattern = pattern;

		index = (steppers[id].old_pattern << 4) | pattern;
		switch ( steppers[id].type )
		{
			default:
			case STEPPER_48STEP_REEL :	  // STARPOINT RMxxx
			case STEPPER_144STEPS_DICE :  // STARPOINT 1DCU DICE mechanism
			steps = StarpointStepTab[ index ];
			break;
			case BARCREST_48STEP_REEL :	  // Barcrest reel units have different optics
			steps = BarcrestStepTab[ index ];
			break;
		}
//      if ( id ==0 )logerror("Id %d Index %d Steps %d Pattern Old %02X New %02X\n",id,index,steps,steppers[id].old_pattern,steppers[id].pattern);

		if ( steps )
		{
			pos = steppers[id].step_pos + steps;

			if ( pos > steppers[id].max_steps ) pos -= steppers[id].max_steps;
			else if ( pos < 0 )                 pos += steppers[id].max_steps;

			steppers[id].step_pos = pos;
			update_optic(id);

			changed++;
		}
	}
	return changed;
}
Exemplo n.º 6
0
int stepper_update(int which, UINT8 pattern)
{
	int changed = 0;

	/* This code probably makes more sense if you visualise what is being emulated, namely
	a spinning drum with two electromagnets inside. Essentially, the CPU
	activates a pair of windings on these magnets leads as necessary to attract and repel the drum to pull it round and
	display as appropriate. To attempt to visualise the rotation effect, take a look at the compass rose below, representing a side on view of the reel,
	the numbers indicate the phase information as used

	    7
	    N
	1 W   E 5
	    S
	    3

	For sake of accuracy, we're representing all possible phases of the motor, effectively moving the motor one half step at a time, so a 48 step motor becomes
	96 half steps. This is necessary because of some programs running the wiring in series with a distinct delay between the pair being completed. This causes
	a small movement that may trigger the optic tab.
	*/

	int pos,steps=0;
	step[which].pattern = pattern;
	switch ( step[which].type )
	{
		default:
		logerror("No reel type specified for %x!\n",which);
		break;
		case STARPOINT_48STEP_REEL : /* STARPOINT RMxxx */
		case GAMESMAN_200STEP_REEL : /* Gamesman GMxxxx */
		case STARPOINT_144STEP_DICE :/* STARPOINT 1DCU DICE mechanism */
		case STARPOINT_200STEP_REEL :/* STARPOINT 1DCU DICE mechanism */
		//Standard drive table is 2,6,4,5,1,9,8,a
		//NOTE: This runs through the stator patterns in such a way as to drive the reel forward (downwards from the player's view, clockwise on our rose)
		//The Heber 'Pluto' controller runs this in reverse
		switch (pattern)
		{             //Black  Blue  Red  Yellow
			case 0x02://  0     0     1     0
			step[which].phase = 7;
			break;
			case 0x06://  0     1     1     0
			step[which].phase = 6;
			break;
			case 0x04://  0     1     0     0
			step[which].phase = 5;
			break;
			case 0x05://  0     1     0     1
			step[which].phase = 4;
			break;
			case 0x01://  0     0     0     1
			step[which].phase = 3;
			break;
			case 0x09://  1     0     0     1
			step[which].phase = 2;
			break;
			case 0x08://  1     0     0     0
			step[which].phase = 1;
			break;
			case 0x0A://  1     0     1     0
			step[which].phase = 0;
			break;
			//          Black  Blue  Red  Yellow
			case 0x03://  0     0     1     1
			{
				if ((step[which].old_phase ==6)||(step[which].old_phase == 0)) // if the previous pattern had the drum in the northern quadrant, it will point north now
				{
					step[which].phase = 7;
				}
				else //otherwise it will line up due south
				{
					step[which].phase = 3;
				}
			}
			break;
			case 0x0C://  1     1     0     0
			{
				if ((step[which].old_phase ==6)||(step[which].old_phase == 4)) // if the previous pattern had the drum in the eastern quadrant, it will point east now
				{
					step[which].phase = 5;
				}
				else //otherwise it will line up due west
				{
					step[which].phase = 1;
				}
			}
			break;
		}
		break;

		case BARCREST_48STEP_REEL :
		case GAMESMAN_48STEP_REEL :
		case GAMESMAN_100STEP_REEL :
		//Standard drive table is 1,3,2,6,4,C,8,9
		//Gamesman 48 step uses this pattern shifted one place forward, though this shouldn't matter
		switch (pattern)
		{
			//             Yellow   Brown  Orange Black
			case 0x01://  0        0      0      1
			step[which].phase = 7;
			break;
			case 0x03://  0        0      1      1
			step[which].phase = 6;
			break;
			case 0x02://  0        0      1      0
			step[which].phase = 5;
			break;
			case 0x06://  0        1      1      0
			step[which].phase = 4;
			break;
			case 0x04://  0        1      0      0
			step[which].phase = 3;
			break;
			case 0x0C://  1        1      0      0
			step[which].phase = 2;
			break;
			case 0x08://  1        0      0      0
			step[which].phase = 1;
			break;//YOLB
			case 0x09://  1        0      0      1
			step[which].phase = 0;
			break;

			// The below values should not be used by anything sane, as they effectively ignore one stator side entirely
			//          Yellow   Brown  Orange Black
			case 0x05://   0       1       0     1
			{
				if ((step[which].old_phase ==6)||(step[which].old_phase == 0)) // if the previous pattern had the drum in the northern quadrant, it will point north now
				{
					step[which].phase = 7;
				}
				else //otherwise it will line up due south
				{
					step[which].phase = 3;
				}
			}
			break;

			case 0x0A://   1       0       1     0
			{
				if ((step[which].old_phase ==6)||(step[which].old_phase == 4)) // if the previous pattern had the drum in the eastern quadrant, it will point east now
				{
					step[which].phase = 5;
				}
				else //otherwise it will line up due west
				{
					step[which].phase = 1;
				}
			}
			break;
		}
		break;

		case MPU3_48STEP_REEL :
		/* The MPU3 interface is actually the same as the MPU4 setup, but with two active lines instead of four
		   Inverters are used so if a pin is low, the higher bit of the pair is activated, and if high the lower bit is activated.
		   TODO:Check this, 2 and 1 could be switched over.
		 */
		switch (pattern)
		{
		//             Yellow(2)   Brown(1)  Orange(!2) Black(!1)
			case 0x00 :// 0          0          1         1
			step[which].phase = 6;
			break;
			case 0x01 :// 0          1          1         0
			step[which].phase = 4;
			break;
			case 0x03 :// 1          1          0         0
			step[which].phase = 2;
			break;
			case 0x02 :// 1          0          0         1
			step[which].phase = 0;
			break;
		}
		break;

		case ECOIN_200STEP_REEL :
		//While the 48 and 100 step models appear to be reverse driven Starpoint reels, the 200 step model seems bespoke, certainly in terms of wiring.
		//On a Proconn machine this same pattern is seen but running in reverse
		//Standard drive table is 8,c,4,6,2,3,1,9
		switch (pattern)
		{
			case 0x08://  0     0     1     0
			step[which].phase = 7;
			break;
			case 0x0c://  0     1     1     0
			step[which].phase = 6;
			break;
			case 0x04://  0     1     0     0
			step[which].phase = 5;
			break;
			case 0x06://  0     1     0     1
			step[which].phase = 4;
			break;
			case 0x02://  0     0     0     1
			step[which].phase = 3;
			break;
			case 0x03://  1     0     0     1
			step[which].phase = 2;
			break;
			case 0x01://  1     0     0     0
			step[which].phase = 1;
			break;
			case 0x09://  1     0     1     0
			step[which].phase = 0;
			break;
			case 0x0a://  0     0     1     1
			{
				if ((step[which].old_phase ==6)||(step[which].old_phase == 0)) // if the previous pattern had the drum in the northern quadrant, it will point north now
				{
					step[which].phase = 7;
				}
				else //otherwise it will line up due south
				{
					step[which].phase = 3;
				}
			}
			break;
			case 0x07://  1     1     0     0
			{
				if ((step[which].old_phase ==6)||(step[which].old_phase == 4)) // if the previous pattern had the drum in the eastern quadrant, it will point east now
				{
					step[which].phase = 5;
				}
				else //otherwise it will line up due west
				{
					step[which].phase = 1;
				}
			}
			break;
		}
		break;

		case PROJECT_48STEP_REEL :
		//Standard drive table is 8,c,4,5,1,3,2,a
		//This appears to be basically a rewired Gamesman (the reel PCB looks like it does some shuffling)
		//TODO: Not sure if this should be represented as a type here, or by defining it as a Gamesman in the driver and bitswapping.
		switch (pattern)
		{
			case 0x08://  0     0     1     0
			step[which].phase = 7;
			break;
			case 0x0c://  0     1     1     0
			step[which].phase = 6;
			break;
			case 0x04://  0     1     0     0
			step[which].phase = 5;
			break;
			case 0x05://  0     1     0     1
			step[which].phase = 4;
			break;
			case 0x01://  0     0     0     1
			step[which].phase = 3;
			break;
			case 0x03://  1     0     0     1
			step[which].phase = 2;
			break;
			case 0x02://  1     0     0     0
			step[which].phase = 1;
			break;
			case 0x0a://  1     0     1     0
			step[which].phase = 0;
			break;
			case 0x09://  0     0     1     1
			{
				if ((step[which].old_phase ==6)||(step[which].old_phase == 0)) // if the previous pattern had the drum in the northern quadrant, it will point north now
				{
					step[which].phase = 7;
				}
				else //otherwise it will line up due south
				{
					step[which].phase = 3;
				}
			}
			break;
			case 0x06://  1     1     0     0
			{
				if ((step[which].old_phase ==6)||(step[which].old_phase == 4)) // if the previous pattern had the drum in the eastern quadrant, it will point east now
				{
					step[which].phase = 5;
				}
				else //otherwise it will line up due west
				{
					step[which].phase = 1;
				}
			}
			break;
		}
		break;



	}

	steps = step[which].old_phase - step[which].phase;

	if (steps < -4)
	{
		steps = steps +8;
	}
	if (steps > 4)
	{
		steps = steps -8;
	}

	step[which].old_phase = step[which].phase;
	step[which].old_pattern = step[which].pattern;

	int max = step[which].max_steps;
	pos = 0;

	if (max!=0)
	{
		pos = (step[which].step_pos + steps + max) % max;
	}
	else
	{
		logerror("step[%x].max_steps == 0\n",which);
	}

	if (pos != step[which].step_pos)
	{
		changed++;
	}

	step[which].step_pos = pos;
	update_optic(which);

	return changed;
}
Exemplo n.º 7
0
int stepper_update(int which, UINT8 pattern)
{
	int changed = 0;

	if ( step[which].pattern != pattern )
	{ /* pattern changed */
		int steps,
			pos;
		if ( step[which].pattern )
		{
			step[which].old_pattern = step[which].pattern;
		}
		step[which].phase =	(step[which].step_pos % 8);
		step[which].pattern = pattern;

		switch ( step[which].type )
		{
			default:
			case STARPOINT_48STEP_REEL :	/* STARPOINT RMxxx */
			case STARPOINT_144STEPS_DICE :  /* STARPOINT 1DCU DICE mechanism */
			steps = StarpointStepTab[step[which].phase][pattern];//[(step[which].old_pattern << 4) | pattern];//
			break;
			case BARCREST_48STEP_REEL :	    /* Barcrest reel units have different windings */
			steps = BarcrestStepTab[step[which].phase][pattern];
			break;
			case MPU3_48STEP_REEL :	    /* Same unit as above, but different interface (2 active lines, not 4)*/
			steps = MPU3StepTab[step[which].phase][pattern];
		}
		#if 0 /* Assists with new index generation */
		if ( which ==1 )logerror("which %d Steps %d Phase %d Pattern Old %02X New %02X\n",which,steps,(step[which].phase),step[which].old_pattern,step[which].pattern);
		#endif

		int max = step[which].max_steps;
		pos = 0;

		if (max!=0)
		{
			if (step[which].reverse)
			{
				pos = (step[which].step_pos - steps + max) % max;
			}
			else
			{
				pos = (step[which].step_pos + steps + max) % max;
			}
		}
		else
		{
			logerror("step[which].max_steps == 0\n");
		}

		if (pos != step[which].step_pos)
		{
			changed++;
		}

		step[which].step_pos = pos;
		update_optic(which);
	}
	return changed;
}