;**************************************************************************
;***                                                                    ***
;*** Everyday Electronics Micro-Lab                                     ***
;***                                                                    ***
;***    Name:           Demonstration 6                                 ***
;***    Version:        1.0                                             ***
;***    Author:         Geoff MacDonald                                 ***
;***    Date:           13/01/1993                                      ***
;***    Last Update:                                                    ***
;***                                                                    ***
;**************************************************************************

                ;Read the analogue input and use the result to set the
                ;frequency of pulses output by the 65C22.

D_DEMO6:        LDA     #1              ;Initialise the 65C22 for sound
                JSR     SOUND
DEMO6A:         STA     $FFFF           ;Initiate A/D conversion
                LDY     #10             ;Delay
DEMO6B:         DEY
                BNE     DEMO6B
                LDA     AIN             ;Read analogue input
                TAY                     ;Set sound output frequency
                LDX     #1
                LDA     #0
                JSR     SOUND
                LDA     #10
                JSR     DELAY
                LDA     KBSIZE          ;Key pressed?
                BEQ     DEMO6A          ;No - repeat
                JSR     KBCLR           ;Clear keyboard buffer
                LDA     #0              ;Sound off
                TAX
                TAY
                JSR     SOUND
                BRK                     ;Terminate
