**********
* Program LOGIC_1 (6811)
*
* Simulates Quad 2-input NAND Gate.  Fetches switches and
* outputs result on 4 most sig LEDs.
*
*
*
*
*
*
*
*
*
*
* P. H. Anderson, MSU, 11 Oct 90; 15 Jan 93; 23 Jan 95
**********

PSCT	EQU  $C000
DSCT	EQU  $D000
IDSCT	EQU  $D300

STACKTP 	EQU  $0045
REG_BASE	EQU  $1000

PORTB	EQU  $04	* output
PORTC	EQU  $03	* input
DDRC	EQU  $07

	ORG PSCT

	LDS #STACKTP
	LDY #REG_BASE

	CLR DDRC,Y	* port c configured as 8-bit input
TOP
	LDAA PORTC,Y	* get input vector
	STAA TEMP	* D7 D6 D5 D4  D3 D2 D1 D0 in TEMP
	ASLA
	ASLA
	ASLA
	ASLA		* D7 D6 D5 D4 0 0 0 0 in A
	ANDA TEMP	* NAND function performed
	COMA		* result in upper nibble
	ANDA #$F0	* zero garbage in low nibble
	STAA PORTB,Y	* output the result
	BRA TOP 	* repeat

	ORG DSCT

TEMP	RMB 1
