; ..............................................................................
;    File   ADC_Filter.s
; ..............................................................................

		.equ ADC_NumTaps, 32

; ..............................................................................
; Allocate and initialize filter taps

		.section .xdata, data, xmemory
		.align 64

ADC_Taps:
.hword 	0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400,0x0400
.hword 	0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400,0x0400
.hword 	0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400,0x0400
.hword 	0x0400, 0x0400, 0x0400, 0x0400, 0x0400
;.hword 	0xFD81,	0xFD90,	0xFDDB,	0xFE65,	0xFF2D,	0x002F,	0x0163,	0x02BE,	0x0431
;.hword 	0x05AC,	0x071C,	0x0871,	0x0998,	0x0A84,	0x0B29,	0x0B7D,	0x0B7D,	0x0B29
;.hword 	0x0A84,	0x0998,	0x0871,	0x071C,	0x05AC,	0x0431,	0x02BE,	0x0163,	0x002F
;.hword 	0xFF2D,	0xFE65,	0xFDDB,	0xFD90,	0xFD81

; ..............................................................................
; Allocate delay line in (uninitialized) Y data space

		.section .ybss, bss, ymemory
		.align 64

ADC_Delay:
		.space ADC_NumTaps*2

; ..............................................................................
; Allocate and intialize filter structure

		.section .data
		.global _ADC_Filter

_ADC_Filter:
.hword ADC_NumTaps
.hword ADC_Taps
.hword ADC_Taps+ADC_NumTaps*2-1
.hword 0xff00
.hword ADC_Delay
.hword ADC_Delay+ADC_NumTaps*2-1
.hword ADC_Delay

; ..............................................................................
; ..............................................................................
; Sample assembly language calling program
;  The following declarations can be cut and pasted as needed into a program
;		.extern	_FIRFilterInit
;		.extern	_FIR
;		.extern	_ADC_Filter
;
;		.section	.bss
;
;	 The input and output buffers can be made any desired size
;	   the value 40 is just an example - however, one must ensure
;	   that the output buffer is at least as long as the number of samples
;	   to be filtered (parameter 1)
;input:		.space	40
;output:	.space	40
;		.text
;
;
;  This code can be copied and pasted as needed into a program
;
;
; Set up pointers to access input samples, filter taps, delay line and
; output samples.
;		mov	#_ADC_Filter, W0	; Initalize W0 to filter structure
;		call	_FIRDelayInit	; call this function once
;
; The next 4 instructions are required prior to each subroutine call
; to _FIR
;		mov	#_ADC_Filter, W3	; Initalize W3 to filter structure
;		mov	#input, W2	; Initalize W2 to input buffer
;		mov	#output, W1	; Initalize W1 to output buffer
;		mov	#20, W0	; Initialize W0 with number of required output samples
;		call	_FIR	; call as many times as needed






