********** * Program WINK (6811) * * Displays LED_PATT on discrete LEDs the number of times set on toggle * switches. Timing is set by TIME_DELAY. * * Note use of pseudo op FCB (Force Character Byte) * * Used to illustrate use of subroutines. * * P. H. Anderson, MSU, 15 Feb 93 ********** PSCT EQU $C000 DSCT EQU $D000 IDSCT EQU $D300 REG_BASE EQU $1000 STACKTP EQU $0045 PORTB EQU $04 PORTC EQU $03 DDRC EQU $07 ORG PSCT LDS #STACKTP LDY #REG_BASE * load reg_base CLR DDRC,Y * port c configured as 8-bit input LDAA PORTC,Y * get switches STAA NUM_TIMES TOP TST NUM_TIMES BEQ DONE LDAA LED_PATT LDAB TIME_DELAY BSR WINK_1 DEC NUM_TIMES BRA TOP DONE SWI * Subroutine WINK_1. Turns all LEDs off and waits for a period of * time. Outputs LED_PATT and waits period of time. * LED pattern is passed in A. Time delay is passed in B. Nothing is * returned. WINK_1 CLR PORTB,Y BSR DELAY STAA PORTB,Y BSR DELAY RTS * Subroutine DELAY. Delays for a time. Time delay is passed in B. * Nothing is returned. DELAY PSHA PSHB PSHX LDAA #255 MUL * 255 times B now in D XGDX * transfer to X L1 DEX BNE L1 PULX PULB PULA RTS ORG DSCT NUM_TIMES RMB 1 ORG IDSCT LED_PATT FCB %10101010 TIME_DELAY FCB $10