;**************************************************************************
;***                                                                    ***
;*** Everyday Electronics Micro-Lab                                     ***
;***                                                                    ***
;***    Name:           Demonstration 2                                 ***
;***    Version:        1.0                                             ***
;***    Author:         Geoff MacDonald                                 ***
;***    Date:           13/01/1993                                      ***
;***    Last Update:                                                    ***
;***                                                                    ***
;**************************************************************************

                ;This demonstration reads the settings on the DIP-switches
                ;and displays the states on the LCD

D_DEMO2:        LDX     #0              ;Position cursor at left side
                LDY     #1              ;of bottom row
                LDA     #0              ;Turn cursor off
                JSR     CURSOR
                LDA     DIPSW           ;Read the DIP switch states
                LDX     #8              ;Set up number of switches
DEMO2A:         LSR     A               ;Get state of single switch
                PHA
                BCC     DEMO2B
                LDA     #$4F            ;Switch is on - display "O"
                BNE     DEMO2C
DEMO2B:         LDA     #$2D            ;Switch is off - display "-"
DEMO2C:         JSR     OPCHAR
                PLA
                DEX                     ;Decrement number of swiches left
                BNE     DEMO2A          ;Repeat if not finished
                LDA     #10             ;Delay for 1/10 sec.
                JSR     DELAY
                LDA     KBSIZE          ;Key pressed?
                BEQ     D_DEMO2         ;No - start again
                JSR     KBCLR           ;Empty keyboard buffer
                BRK
