;**************************************************************************
;***                                                                    ***
;*** Everyday Electronics Micro-Lab                                     ***
;***                                                                    ***
;***    Name:           Demonstration 8                                 ***
;***    Version:        1.0                                             ***
;***    Author:         Geoff MacDonald                                 ***
;***    Date:           18/01/1993                                      ***
;***    Last Update:                                                    ***
;***                                                                    ***
;**************************************************************************

                        ;Fills the RAM, beginning at address $0200, with
                        ;samples taken from the analogue input at a rate
                        ;of 8.0645kHz (4 seconds of data)

D_DEMO8:                LDA     #$00            ;Set up table start address
                        STA     $90
                        LDA     #$02
                        STA     $91
                        LDY     #$00
DEMO8A:                 STA     $FFFF   ;4uS    ;Initiate analogue conversion
                        LDX     #23     ;6uS    ;92uS Delay
DEMO8B:                 DEX
                        BNE     DEMO8B  ;98uS
                        LDA     AIN     ;102uS  ;Get analogue input
                        STA     ($90),Y ;108uS  ;Store it in the table
                        CLC             ;110uS
                        LDA     $90     ;112uS
                        ADC     #$01    ;114uS
                        STA     $90     ;116uS
                        LDA     $91     ;118uS
                        ADC     #$00    ;120uS
                        STA     $91     ;122uS
                        BPL     DEMO8A  ;124uS
                        BRK
