Function Name: SPIN SPOUT

Purpose: Setup fast serial ports for IO
Call address: $FF47 (hex) 65351 (decimal)

	Registers:	none
	Memory:		system map
	Flags:		.C = 0 -> select SPINP
			.C = 1 -> select SPOUT
	Calls:		none
	Registers:	.A used
	Memory:		CIA-1, MMU
	Flags:		none

Description: The C128/1571 fast serial protocol utilizes CIA 1 (6526 at $DC00) and a special driver circuit controlled in part by the MMU (at $D500). SPINP and SPOUT are routines used by the system to set up the CIA and fast serial driver circuit for input or output. SPINP sets up CRA (CIA 1 register 14) and clears the FSDIR bit (MMU register 5) for input. SPOUT sets up CRA, ICR (CIA 1 register 13), timer A (CIA 1 registers 4 and 5), and sets the FSDIR bit for output. Note the state of the TODIN bit of CRA is always preserved, but the state of the GAME, EXROM and SENSE40 outputs of the MMU are not (reading these ports return the state of the port and not the register values—consequently they cannot be preserved). These routines are required only by applications driving the fast serial bus themselves from the lowest level.


	JSR	$FF47	;setup for fast serial input