;**************************************************************************
;***                                                                    ***
;*** Everyday Electronics Micro-Lab                                     ***
;***                                                                    ***
;***    Name:           Demonstration 9                                 ***
;***    Version:        1.0                                             ***
;***    Author:         Geoff MacDonald                                 ***
;***    Date:           18/01/1993                                      ***
;***    Last Update:                                                    ***
;***                                                                    ***
;**************************************************************************

                        ;Reads data from RAM, beginning at address $0200,
                        ;and sends each byte to the analogue output at a
                        ;rate of 8.0645kHz (4 seconds of data)

D_DEMO9:                LDA     #$00            ;Set up table start address
                        STA     $90
                        LDA     #$02
                        STA     $91
                        LDY     #$00
DEMO9A:                 LDX     #24     ;2uS    ;92uS Delay
DEMO9B:                 DEX
                        BNE     DEMO9B  ;98uS
                        LDA     ($90),Y ;104uS  ;Get analogue input
                        STA     AOUT    ;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     DEMO9A  ;124uS
                        LDA     #$00            ;Set output voltage to 0V
                        STA     AOUT
                        BRK

