********* * Program PARITY_2 (6811) * * Reads switchs. Ouput char O or E depending on parity of * switch settings. * * Equipment configuration: * Theory: Uses Exclusive OR * * P. H. Anderson, 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 * portc configured as input TOP LDAA PORTC,Y * get the switches STAA TEMP * copy to temp LSRA LSRA LSRA LSRA * 0 0 0 0 S7 S6 S5 S4 in A * * S7 S6 S5 S4 S3 S2 S1 S0 in TEMP EORA TEMP ANDA #$0F * 0 0 0 0 R3 R2 R1 R0 IN A STAA TEMP LSRA LSRA * 0 0 0 0 0 0 R3 R2 in A * * 0 0 0 0 R3 R2 R1 R0 in TEMP EORA TEMP ANDA #$03 * 0 0 0 0 0 0 T1 T0 in A STAA TEMP LSRA * 0 0 0 0 0 0 0 T1 in A * * 0 0 0 0 0 0 T1 T0 in TEMP EORA TEMP ANDA #$01 * if even parity 0000 0000 in A * * else odd parity 0000 0001 in A BEQ EVEN_PAR BNE ODD_PAR EVEN_PAR LDAA EVEN STAA PORTB,Y BRA TOP ODD_PAR LDAA ODD STAA PORTB,Y BRA TOP ORG DSCT TEMP RMB 1 ORG IDSCT EVEN FCB $18 * to display an 'E' ODD FCB $02 * an 'O'