**********
* Program SWAP_NIBS (6811)
*
* Fetches toggle switches, interchanges hi and low nibbles
* and echoes back to LEDs
*
* Note use of branch statement instead of jump
* Note use of pseudo operator EQU to enhance understanding.
*
* P. H. Anderson, MSU, 12 Sept 91; Checked 12 Sept 91; 15 Jan 93
**********

PSCT	EQU  $C000
DSCT    EQU  $D000
IDSCT	EQU  $D300

REG_BASE	EQU $1000

PORTB	EQU  $04
PORTC	EQU  $03
DDRC	EQU  $07

	ORG PSCT

	LDY #REG_BASE
	CLR DDRC,Y	* port c configured as 8-bit input

TOP
	LDAA PORTC,Y	* get switches
	STAA TEMP	* copy to temp
	ASLA
	ASLA
	ASLA
	ASLA		* S3 S2 S1 S0 0 0 0 0 in ACCA
	LSR TEMP
	LSR TEMP
	LSR TEMP
	LSR TEMP	* 0 0 0 0 S7 S6 S5 S4 in TEMP
	ORAA TEMP	* S3 S S1 S0 S7 S6 S5 S4 in ACCA
	STAA PORTB,Y	* output to LEDs
	BRA TOP

	ORG DSCT

TEMP RMB 1	


