******
** SCROLL.ASM
**
** If least significant switch at 0 scrolls LEDs to right
**
**		0000 0100
**		0000 0110
**		0000 0111
**		0000 0000
**
** Else scrolls LEDs to left
**
**		0010 0000
**		0110 0000
**		1110 0000
**		0000 0000
**
** Continuous loop.
**
** P. H. Anderson, MSU, 1 Feb, '94
*******

PSCT 	EQU $C000

DDRC		EQU $1007
PORTC   	EQU $1003
PORTB	EQU $1004

	ORG PSCT

	CLR DDRC
TOP
	LDAA PORTC
	ANDA #$01
	BNE AROUND
	BSR RIGHT_SCROLL
	BRA TOP
AROUND
	BSR LEFT_SCROLL
	BRA TOP

RIGHT_SCROLL
* successively outputs patterns 0x04, 0x06, 0x07, 0x00
	LDAA #$04
	STAA PORTB
	BSR TIME_DELAY
	LDAA #$06
	STAA PORTB
	BSR TIME_DELAY
	LDAA #$07
	STAA PORTB
	BSR TIME_DELAY
	LDAA #$00
	STAA PORTB
	BSR TIME_DELAY
	RTS


LEFT_SCROLL

* successively outputs patterns 0x20, 0x60, 0xe0, 0x00
	LDAA #$20
	STAA PORTB
	BSR TIME_DELAY
	LDAA #$60
	STAA PORTB
	BSR TIME_DELAY
	LDAA #$E0
	STAA PORTB
	BSR TIME_DELAY
	LDAA #$00
	STAA PORTB
	BSR TIME_DELAY
	RTS

TIME_DELAY

	LDX #$FFFF
T_L1
	DEX
	BNE T_L1
	RTS

