	PARTNO		ARB;
	NAME		ARB;
	DATE		April 20, 1993;
	REV		1;
	DESIGNER	Dave Haynie;
	COMPANY		Commodore;
	ASSEMBLY	Buster;
	LOCATION	West Chester;
	DEVICE		g22v10;

/************************************************************************/
/*									*/
/*	Buster		Model of the Buster Zorro III Arbiter		*/
/*									*/
/************************************************************************/
/*									*/
/* REVISION HISTORY:							*/
/*									*/
/*	DBH Apr 20:	Original Version				*/
/*									*/
/************************************************************************/

/**  INPUTS:  **/

PIN 1		=  CPUCLK	; /* The Clock */
PIN 2		=  EGRANT	; /* Grant from primary arbiter for Zorro III. */
PIN 3		= !EGOT		; /* A real Zorro III grant is active. */
PIN 4		= !MNEXT	; /* Reschedule request from cycle counter. */
PIN 5		= !dmaBUSY	; /* Is there a Zorro III cycle going? */

/**  OUTPUTS:  **/

PIN 14		= !OWN		; /* Expansion OWN, same as EBGACK. */
PIN 15		= !DOARB	; /* Arbiter output, time to arbitrate. */
PIN 16		= !MSCLR	; /* Clears out mastership counter. */

/**  STATE:  **/

PIN 21		=  sr0		; /* State variables. */
PIN 22		=  sr1		;

field	states	= [sr1..0];

/* The state names */

$DEFINE		IDLE	0
$DEFINE		ARBIT	2
$DEFINE		RUN	3
$DEFINE		RESCHED 1

SEQUENCE states {
	/* This is the IDLE state.  The arbiter rests here when there is no
	   Zorro III bus ownership.  A Zorro III grant kicks it into action. */
	PRESENT IDLE
		IF !EGRANT NEXT IDLE;
		IF  EGRANT NEXT ARBIT;

	/* This is the ARBIT state.  Arbitration is signaled active here, the
	   individual grant selectors decide on the next bus master at this 
	   point. */
	PRESENT ARBIT
		OUT OWN	OUT MSCLR OUT DOARB;
		IF !EGRANT         NEXT IDLE;
		IF  EGRANT & !EGOT NEXT ARBIT;
		IF  EGRANT &  EGOT NEXT RUN;

	/* This is the RUN state.  Most of a bus master's activity on the bus 
	   is during this state. */
	PRESENT RUN
		OUT OWN;
		IF !MNEXT &  EGOT NEXT RUN;		/* DMA continues. */
		IF          !EGOT NEXT ARBIT;		/* Master reqlinquished. */
		IF  MNEXT         NEXT RESCHED;		/* Timer reschedule. */

	/* This is the RESCHEDULE state.  At this point, the timer has kicked
	   the master off the bus, and we wait for a relinquish.  The negation of
	   the EGOT signal in this state by the grant selectors could make this
	   more efficient, but we'll not worry about it just now. */
	PRESENT RESCHED
		OUT OWN;
		IF  dmaBUSY #  EGOT NEXT RESCHED;
		IF !dmaBUSY & !EGOT NEXT ARBIT;
}

