;**************************************************************************
;***                                                                    ***
;*** Everyday Electronics Micro-Lab                                     ***
;***                                                                    ***
;***    Name:           Demonstration 5                                 ***
;***    Version:        1.0                                             ***
;***    Author:         Geoff MacDonald                                 ***
;***    Date:           13/01/1993                                      ***
;***    Last Update:                                                    ***
;***                                                                    ***
;**************************************************************************

                ;Read sixty values from the analogue input at one second
                ;intervals and store them in a table in RAM between
                ;$0200 and $023C.

D_DEMO5:        LDA     #0              ;Point to start of table
                STA     $90
DEMO5A:         LDX     #0              ;Position cursor to left side
                LDY     #1              ;of bottom row,
                LDA     #0              ;with cursor off
                JSR     CURSOR
                LDA     $90             ;Display sample number
                JSR     HEXOUT
                LDA     #$20            ;Display a space
                JSR     OPCHAR
                STA     $FFFF           ;Initiate A/D conversion
                LDY     #10             ;Delay
DEMO5B:         DEY
                BNE     DEMO5B
                LDA     AIN             ;Read analogue input
                LDX     $90             ;Store it in the table
                STA     $0200,X
                JSR     HEXOUT          ;Display it on the LCD
                LDA     #100            ;Delay for one second
                JSR     DELAY
                INC     $90             ;Point to next position in the table
                CPX     #59
                BNE     DEMO5A          ;Repeat for sixty values
                BRK                     ;Terminate
