; ..............................................................................
;    File   BandpassRed.s
; ..............................................................................

		.equ BandpassRedNumTaps, 513

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

		.section .xdata, data, xmemory
		.align 2048

BandpassRedTaps:
.hword 	0xFFFD,	0xFFFC,	0xFFFC,	0xFFFC,	0xFFFC,	0xFFFB,	0xFFFB,	0xFFFB,	0xFFFB
.hword 	0xFFFA,	0xFFFA,	0xFFFA,	0xFFFA,	0xFFFA,	0xFFFA,	0xFFFA,	0xFFFA,	0xFFFA
.hword 	0xFFFA,	0xFFFA,	0xFFFA,	0xFFFA,	0xFFFA,	0xFFFA,	0xFFFA,	0xFFFA,	0xFFFB
.hword 	0xFFFB,	0xFFFB,	0xFFFB,	0xFFFC,	0xFFFC,	0xFFFC,	0xFFFD,	0xFFFD,	0xFFFD
.hword 	0xFFFE,	0xFFFE,	0xFFFE,	0xFFFF,	0xFFFF,	0xFFFF,	0x0000,	0x0000,	0x0000
.hword 	0x0000,	0x0000,	0x0000,	0x0000,	0x0000,	0x0000,	0x0000,	0x0000,	0x0000
.hword 	0x0000,	0x0000,	0x0000,	0x0000,	0x0000,	0xFFFF,	0xFFFF,	0xFFFE,	0xFFFD
.hword 	0xFFFD,	0xFFFC,	0xFFFB,	0xFFFA,	0xFFF9,	0xFFF8,	0xFFF6,	0xFFF5,	0xFFF4
.hword 	0xFFF2,	0xFFF1,	0xFFEF,	0xFFEE,	0xFFEC,	0xFFEA,	0xFFE9,	0xFFE7,	0xFFE5
.hword 	0xFFE3,	0xFFE2,	0xFFE0,	0xFFDE,	0xFFDC,	0xFFDB,	0xFFD9,	0xFFD7,	0xFFD6
.hword 	0xFFD4,	0xFFD3,	0xFFD2,	0xFFD0,	0xFFCF,	0xFFCE,	0xFFCD,	0xFFCC,	0xFFCC
.hword 	0xFFCB,	0xFFCB,	0xFFCA,	0xFFCA,	0xFFCA,	0xFFCB,	0xFFCB,	0xFFCB,	0xFFCC
.hword 	0xFFCD,	0xFFCE,	0xFFCF,	0xFFD1,	0xFFD2,	0xFFD4,	0xFFD5,	0xFFD7,	0xFFD9
.hword 	0xFFDC,	0xFFDE,	0xFFE0,	0xFFE3,	0xFFE6,	0xFFE8,	0xFFEB,	0xFFEE,	0xFFF1
.hword 	0xFFF3,	0xFFF6,	0xFFF9,	0xFFFC,	0xFFFE,	0x0000,	0x0003,	0x0005,	0x0007
.hword 	0x0009,	0x000B,	0x000D,	0x000F,	0x0010,	0x0012,	0x0012,	0x0013,	0x0014
.hword 	0x0014,	0x0014,	0x0013,	0x0012,	0x0011,	0x0010,	0x000E,	0x000C,	0x0009
.hword 	0x0007,	0x0003,	0x0000,	0xFFFD,	0xFFF9,	0xFFF4,	0xFFF0,	0xFFEB,	0xFFE5
.hword 	0xFFDF,	0xFFDA,	0xFFD3,	0xFFCD,	0xFFC6,	0xFFC0,	0xFFB9,	0xFFB2,	0xFFAB
.hword 	0xFFA4,	0xFF9C,	0xFF95,	0xFF8E,	0xFF87,	0xFF80,	0xFF79,	0xFF73,	0xFF6C
.hword 	0xFF66,	0xFF60,	0xFF5B,	0xFF55,	0xFF51,	0xFF4C,	0xFF49,	0xFF45,	0xFF42
.hword 	0xFF40,	0xFF3F,	0xFF3E,	0xFF3D,	0xFF3E,	0xFF3F,	0xFF41,	0xFF43,	0xFF47
.hword 	0xFF4B,	0xFF50,	0xFF55,	0xFF5C,	0xFF64,	0xFF6C,	0xFF75,	0xFF7F,	0xFF8A
.hword 	0xFF95,	0xFFA2,	0xFFAF,	0xFFBD,	0xFFCB,	0xFFDB,	0xFFEB,	0xFFFB,	0x000C
.hword 	0x001E,	0x0030,	0x0043,	0x0056,	0x006A,	0x007E,	0x0093,	0x00A8,	0x00BD
.hword 	0x00D2,	0x00E7,	0x00FD,	0x0112,	0x0127,	0x013D,	0x0152,	0x0166,	0x017B
.hword 	0x018F,	0x01A2,	0x01B6,	0x01C8,	0x01DA,	0x01EC,	0x01FD,	0x020C,	0x021C
.hword 	0x022A,	0x0238,	0x0244,	0x0250,	0x025A,	0x0264,	0x026C,	0x0274,	0x027A
.hword 	0x027F,	0x0283,	0x0286,	0x0288,	0x0289,	0x0288,	0x0286,	0x0283,	0x027F
.hword 	0x027A,	0x0274,	0x026C,	0x0264,	0x025A,	0x0250,	0x0244,	0x0238,	0x022A
.hword 	0x021C,	0x020C,	0x01FD,	0x01EC,	0x01DA,	0x01C8,	0x01B6,	0x01A2,	0x018F
.hword 	0x017B,	0x0166,	0x0152,	0x013D,	0x0127,	0x0112,	0x00FD,	0x00E7,	0x00D2
.hword 	0x00BD,	0x00A8,	0x0093,	0x007E,	0x006A,	0x0056,	0x0043,	0x0030,	0x001E
.hword 	0x000C,	0xFFFB,	0xFFEB,	0xFFDB,	0xFFCB,	0xFFBD,	0xFFAF,	0xFFA2,	0xFF95
.hword 	0xFF8A,	0xFF7F,	0xFF75,	0xFF6C,	0xFF64,	0xFF5C,	0xFF55,	0xFF50,	0xFF4B
.hword 	0xFF47,	0xFF43,	0xFF41,	0xFF3F,	0xFF3E,	0xFF3D,	0xFF3E,	0xFF3F,	0xFF40
.hword 	0xFF42,	0xFF45,	0xFF49,	0xFF4C,	0xFF51,	0xFF55,	0xFF5B,	0xFF60,	0xFF66
.hword 	0xFF6C,	0xFF73,	0xFF79,	0xFF80,	0xFF87,	0xFF8E,	0xFF95,	0xFF9C,	0xFFA4
.hword 	0xFFAB,	0xFFB2,	0xFFB9,	0xFFC0,	0xFFC6,	0xFFCD,	0xFFD3,	0xFFDA,	0xFFDF
.hword 	0xFFE5,	0xFFEB,	0xFFF0,	0xFFF4,	0xFFF9,	0xFFFD,	0x0000,	0x0003,	0x0007
.hword 	0x0009,	0x000C,	0x000E,	0x0010,	0x0011,	0x0012,	0x0013,	0x0014,	0x0014
.hword 	0x0014,	0x0013,	0x0012,	0x0012,	0x0010,	0x000F,	0x000D,	0x000B,	0x0009
.hword 	0x0007,	0x0005,	0x0003,	0x0000,	0xFFFE,	0xFFFC,	0xFFF9,	0xFFF6,	0xFFF3
.hword 	0xFFF1,	0xFFEE,	0xFFEB,	0xFFE8,	0xFFE6,	0xFFE3,	0xFFE0,	0xFFDE,	0xFFDC
.hword 	0xFFD9,	0xFFD7,	0xFFD5,	0xFFD4,	0xFFD2,	0xFFD1,	0xFFCF,	0xFFCE,	0xFFCD
.hword 	0xFFCC,	0xFFCB,	0xFFCB,	0xFFCB,	0xFFCA,	0xFFCA,	0xFFCA,	0xFFCB,	0xFFCB
.hword 	0xFFCC,	0xFFCC,	0xFFCD,	0xFFCE,	0xFFCF,	0xFFD0,	0xFFD2,	0xFFD3,	0xFFD4
.hword 	0xFFD6,	0xFFD7,	0xFFD9,	0xFFDB,	0xFFDC,	0xFFDE,	0xFFE0,	0xFFE2,	0xFFE3
.hword 	0xFFE5,	0xFFE7,	0xFFE9,	0xFFEA,	0xFFEC,	0xFFEE,	0xFFEF,	0xFFF1,	0xFFF2
.hword 	0xFFF4,	0xFFF5,	0xFFF6,	0xFFF8,	0xFFF9,	0xFFFA,	0xFFFB,	0xFFFC,	0xFFFD
.hword 	0xFFFD,	0xFFFE,	0xFFFF,	0xFFFF,	0x0000,	0x0000,	0x0000,	0x0000,	0x0000
.hword 	0x0000,	0x0000,	0x0000,	0x0000,	0x0000,	0x0000,	0x0000,	0x0000,	0x0000
.hword 	0x0000,	0x0000,	0x0000,	0xFFFF,	0xFFFF,	0xFFFF,	0xFFFE,	0xFFFE,	0xFFFE
.hword 	0xFFFD,	0xFFFD,	0xFFFD,	0xFFFC,	0xFFFC,	0xFFFC,	0xFFFB,	0xFFFB,	0xFFFB
.hword 	0xFFFB,	0xFFFA,	0xFFFA,	0xFFFA,	0xFFFA,	0xFFFA,	0xFFFA,	0xFFFA,	0xFFFA
.hword 	0xFFFA,	0xFFFA,	0xFFFA,	0xFFFA,	0xFFFA,	0xFFFA,	0xFFFA,	0xFFFA,	0xFFFA
.hword 	0xFFFB,	0xFFFB,	0xFFFB,	0xFFFB,	0xFFFC,	0xFFFC,	0xFFFC,	0xFFFC,	0xFFFD

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

		.section .ybss, bss, ymemory
		.align 2048

BandpassRedDelay:
		.space BandpassRedNumTaps*2

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

		.section .data
		.global _BandpassRedFilter

_BandpassRedFilter:
.hword BandpassRedNumTaps
.hword BandpassRedTaps
.hword BandpassRedTaps+BandpassRedNumTaps*2-1
.hword 0xff00
.hword BandpassRedDelay
.hword BandpassRedDelay+BandpassRedNumTaps*2-1
.hword BandpassRedDelay

; ..............................................................................
; ..............................................................................
; Sample assembly language calling program
;  The following declarations can be cut and pasted as needed into a program
;		.extern	_FIRFilterInit
;		.extern	_FIR
;		.extern	_BandpassRedFilter
;
;		.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	#_BandpassRedFilter, 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	#_BandpassRedFilter, 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
