;**************************************************************************
;***                                                                    ***
;*** Everyday Electronics Micro-Lab                                     ***
;***                                                                    ***
;***    Name:           Demonstration 0                                 ***
;***    Version:        1.0                                             ***
;***    Author:         Geoff MacDonald                                 ***
;***    Date:           13/01/1993                                      ***
;***    Last Update:                                                    ***
;***                                                                    ***
;**************************************************************************

                ;Read a sequence beginning at address $0200, of length
                ;stored at $0300 and send the sequence to the LEDs, with
                ;a delay stored in $0301 (in 1/100 sec) between each output.

D_DEMO0:        LDA     #$00            ;Set up start address of table
                STA     $90
                LDA     #$02
                STA     $91
DEMO0A:         LDY     #$00            ;Get byte to send to LEDs
DEMO0B:         LDA     KBSIZE          ;Key pressed?
                BNE     DEMO0C          ;Yes - terminate demonstration
                CPY     $0300           ;End of table?
                BEQ     DEMO0A          ;Yes - restart sequence
                LDA     ($90),Y
                STA     LED             ;Set up LEDs
                LDA     $0301           ;Delay for specified time
                JSR     DELAY
                INY                     ;Point to next value
                JMP     DEMO0B
DEMO0C:         JSR     KBCLR           ;Clear keyboard buffer
                LDA     #$FF            ;Switch LEDs off
                STA     LED
                BRK
