********** * Program IO_4 (6811) * * Fetches toggle switches and echoes back to LEDs * * Note use of branch statement instead of jump * Note use of pseudo operator EQU to enhance understanding. * Note use of indexed addressing in reading and writing to the I/O * box. * * Note that indexed addressing will be used for addressing 1000 - 10FF * in all future programs. * * P. H. Anderson, MSU, 12 Sept 91; Checked 12 Sept 91; 19 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 * load reg_base CLR DDRC,Y * port c configured as 8-bit input TOP LDAA PORTC,Y * get switches STAA PORTB,Y * output to LEDs BRA TOP