SOURCE CODE FOR W9GR-1 DIGITAL SIGNAL PROCESSOR

from

September 1992 QST Magazine

Note: this is not the source code used in the DSP-3

Return to Quantics Home Page


	IDT     'CW400'
	TITL    'Mother of All CW Filters, 400 Hz version, 200 Hz BW'

* COPYRIGHT (c) 1992 BY DAVID L. HERSHBERGER, W9GR
* ALL RIGHTS RESERVED

* NONCOMMERCIAL USE BY RADIO AMATEURS AND ELECTRONIC HOBBYISTS IS PERMITTED.
* THIS IS NOT PUBLIC DOMAIN SOFTWARE.
* THIS SOFTWARE MAY NOT BE USED WITHOUT A LICENSE AS THE BASIS
* FOR MANUFACTURE OF COMMERCIAL PRODUCTS.
* COMMERCIAL USE OF THIS SOFTWARE REQUIRES A LICENSE.
* LICENSING INQUIRIES MAY BE DIRECTED TO:
*      QUANTICS
*      P. O. BOX 2163
*      NEVADA CITY, CALIFORNIA  95959-2163

* THIS TMS320C10 ASSEMBLY LANGUAGE PROGRAM IS WRITTEN FOR THE
* W9GR QUANTICS DIGITAL SIGNAL PROCESSOR DESCRIBED ON PAGE 43 OF
* THE SEPTEMBER 1992 ISSUE OF QST MAGAZINE.
* ("LOW COST DIGITAL SIGNAL PROCESSING FOR THE RADIO AMATEUR"
* BY DAVE HERSHBERGER, W9GR)

* THE W9GR / QUANTICS DIGITAL SIGNAL PROCESSOR IS AVAILABLE IN KIT FORM
* (INCLUDING ALL PC BOARD MOUNTED COMPONENTS BUT NO ENCLOSURE OR POWER SUPPLY)
* FROM:
*      QUANTICS
*      P. O. BOX 2163
*      NEVADA CITY, CALIFORNIA  95959

* WITH DITHER
* FS = 12500 HZ, 4X OVERSAMPLING AT INPUT AND OUTPUT
* 400 PROCESSOR CYCLES BETWEEN I/O
* 1600 PROCESSOR CYCLES PER FIR FILTER
* FIR SAMPLING FREQUENCY = 3125 HZ
* CENTER FREQUENCY = 400 HZ
* BANDWIDTH = 150 HZ (APPROXIMATELY 200 HZ @ -3 DB)

* BIO=1 > CW FILTER
* BIO=0 > BYPASS FILTER, INTERPOLATORS/DECIMATORS STILL IN LINE

* **********************************************************************
*
*                FINITE IMPULSE RESPONSE (FIR)
*              LINEAR PHASE DIGITAL FILTER DESIGN
*                  REMEZ EXCHANGE ALGORITHM
*
*                       BANDPASS FILTER
*
*                     FILTER LENGTH =  82
*
*                ***** IMPULSE RESPONSE *****
*
*              H( 1) =   .37162640E-04 = H( 82)
*              H( 2) =   .25900430E-02 = H( 81)
*              H( 3) =   .24461660E-02 = H( 80)
*              H( 4) =   .99753610E-03 = H( 79)
*              H( 5) =  -.19845970E-02 = H( 78)
*              H( 6) =  -.44245310E-02 = H( 77)
*              H( 7) =  -.41751700E-02 = H( 76)
*              H( 8) =  -.10804180E-02 = H( 75)
*              H( 9) =   .25345200E-02 = H( 74)
*              H(10) =   .38176570E-02 = H( 73)
*              H(11) =   .21891970E-02 = H( 72)
*              H(12) =   .10723280E-03 = H( 71)
*              H(13) =   .57555260E-03 = H( 70)
*              H(14) =   .35380560E-02 = H( 69)
*              H(15) =   .50459860E-02 = H( 68)
*              H(16) =   .86920080E-03 = H( 67)
*              H(17) =  -.83625870E-02 = H( 66)
*              H(18) =  -.15834480E-01 = H( 65)
*              H(19) =  -.13593070E-01 = H( 64)
*              H(20) =  -.26289370E-03 = H( 63)
*              H(21) =   .15915450E-01 = H( 62)
*              H(22) =   .22826200E-01 = H( 61)
*              H(23) =   .14911390E-01 = H( 60)
*              H(24) =  -.12416370E-02 = H( 59)
*              H(25) =  -.12328160E-01 = H( 58)
*              H(26) =  -.10754970E-01 = H( 57)
*              H(27) =  -.23483190E-02 = H( 56)
*              H(28) =  -.72955810E-03 = H( 55)
*              H(29) =  -.12292400E-01 = H( 54)
*              H(30) =  -.26270940E-01 = H( 53)
*              H(31) =  -.21828100E-01 = H( 52)
*              H(32) =   .11256600E-01 = H( 51)
*              H(33) =   .56592060E-01 = H( 50)
*              H(34) =   .77628080E-01 = H( 49)
*              H(35) =   .45959540E-01 = H( 48)
*              H(36) =  -.30234670E-01 = H( 47)
*              H(37) =  -.10381250E+00 = H( 46)
*              H(38) =  -.11950950E+00 = H( 45)
*              H(39) =  -.56814100E-01 = H( 44)
*              H(40) =   .49413560E-01 = H( 43)
*              H(41) =   .12988000E+00 = H( 42)
*
*                         BAND  1       BAND  2       BAND  3
*   LOWER BAND EDGE      .0000000      .1040000      .1792000
*   UPPER BAND EDGE      .0768000      .1520000      .5000000
*   DESIRED VALUE        .0000000     1.0000000      .0000000
*   WEIGHTING          10.0000000     1.0000000    10.0000000
*   DEVIATION            .0024971      .0249706      .0024971
*   DEVIATION IN DB   -52.0514100      .2142284   -52.0514100
*
*   EXTREMAL FREQUENCIES--MAXIMA OF THE ERROR CURVE
*       .0000000    .0114329    .0236280    .0350610    .0464939
*       .0571646    .0663109    .0739329    .0768000    .1040000
*       .1093354    .1306768    .1466829    .1520000    .1792000
*       .1822488    .1891085    .1990170    .2096878    .2211207
*       .2333158    .2447487    .2569438    .2691389    .2813340
*       .2942913    .3064865    .3186816    .3308767    .3438340
*       .3560291    .3682242    .3811815    .3933766    .4063339
*       .4185290    .4307241    .4436814    .4558766    .4688339
*       .4810290    .4939863
*
*  **********************************************************************


* FIRST INTERPOLATION/DECIMATION HALF BAND FILTER 12500 HZ <> 6250 HZ
**********************************************************************
*
*                FINITE IMPULSE RESPONSE (FIR)
*              LINEAR PHASE DIGITAL FILTER DESIGN
*                  REMEZ EXCHANGE ALGORITHM
*
*                       BANDPASS FILTER
*
*                     FILTER LENGTH =   9
*
*                ***** IMPULSE RESPONSE *****
*
*
*              H( 1) =  -.17244020E-04 = H(  9)
*              H( 2) =  -.35323790E-01 = H(  8)
*              H( 3) =   .58424450E-04 = H(  7)
*              H( 4) =   .28500050E+00 = H(  6)
*              H( 5) =   .49991770E+00 = H(  5)
*
*                         BAND  1       BAND  2
*   LOWER BAND EDGE      .0000000      .4360000
*   UPPER BAND EDGE      .0640000      .5000000
*   DESIRED VALUE       1.0000000      .0000000
*   WEIGHTING           1.0000000     1.0000000
*   DEVIATION            .0006465      .0006465
*   DEVIATION IN DB      .0056136   -63.7885900
*
*   EXTREMAL FREQUENCIES--MAXIMA OF THE ERROR CURVE
*       .0000000    .0437500    .0640000    .4360000    .4547500
*       .5000000
*
* **********************************************************************

* SECOND INTERPOLATOR/DECIMATOR HALF BAND FILTER 6250 HZ <> 3125 HZ
**********************************************************************
*
*                FINITE IMPULSE RESPONSE (FIR)
*              LINEAR PHASE DIGITAL FILTER DESIGN
*                  REMEZ EXCHANGE ALGORITHM
*
*                       BANDPASS FILTER
*
*                     FILTER LENGTH =  13
*
*                ***** IMPULSE RESPONSE *****
*
*
*              H( 1) =   .66367920E-05 = H( 13)
*              H( 2) =   .13592210E-01 = H( 12)
*              H( 3) =  -.16377250E-04 = H( 11)
*              H( 4) =  -.64672420E-01 = H( 10)
*              H( 5) =   .25843950E-04 = H(  9)
*              H( 6) =   .30201130E+00 = H(  8)
*              H( 7) =   .49996780E+00 = H(  7)
*
*                         BAND  1       BAND  2
*   LOWER BAND EDGE      .0000000      .3720000
*   UPPER BAND EDGE      .1280000      .5000000
*   DESIRED VALUE       1.0000000      .0000000
*   WEIGHTING           1.0000000     1.0000000
*   DEVIATION            .0018621      .0018621
*   DEVIATION IN DB      .0161592   -54.5997800
*
*   EXTREMAL FREQUENCIES--MAXIMA OF THE ERROR CURVE
*       .0000000    .0625000    .1071428    .1280000    .3720000
*       .3898572    .4389645    .5000000
*
*  **********************************************************************

	DSEG

	DORG    >00     PAGE 0

LSBMAX  BSS     1       8 BIT MASK
MASK    BSS     1       2'S COMPLEMENT CONVERSION MASK
ONES    BSS     1       ALL ONES FOR EX-OR

* END OF TABLE PAGE 0 READ VARIABLES

SIGIN   BSS     4       INPUT SAMPLES
SIGOUT  BSS     4       OUTPUT SAMPLES
LPFI1   BSS     7       INPUT INTERPOLATOR 1
LPFI2   BSS     11      INPUT INTERPOLATOR 2
BPF     BSS     82      BANDPASS FILTER DELAY
BPFOUT  BSS     1       BANDPASS FILTER OUTPUT
ONE     BSS     1       CONSTANT 1
SQUARE  BSS     1       INPUT SQUARED
LED     BSS     1       LED DISPLAY
TEMP    BSS     1       TEMPORARY STORAGE
LPFO1   BSS     6       OUTPUT INTERPOLATOR 1
LPFO2   BSS     4       OUTPUT INTERPOLATOR 2
DITHER  BSS     1       DITHER PSEUDORANDOM SEQUENCE

	DORG    >80     PAGE 1

HPF     BSS     5       HPF COEFFICIENTS

* END OF PAGE 1 TABLE READ VARIABLES

INP     BSS     3       INPUT DELAY, USED FOR HPF
DENOM   BSS     2       INPUT HPF DENOMINATOR DELAY
ONE1    BSS     1       CONSTANT 1

TOP     EQU     >8F

	DEND

	PSEG

	B       START
INTRPT  B       START
START   DINT
	SOVM
	LDPK    0
	LARP    AR0

* ZERO ALL DATA MEMORY LOCATIONS

	ZAC
	LARK    AR0,TOP
CLEAR   SACL    *,0
	BANZ    CLEAR

* STORE AWAY "1" VALUE

	LACK    1
	SACL    ONE
	SACL    DITHER       ALSO INITIALIZE DITHER WORD
	LDPK    1
	SACL    ONE1
	LDPK    0

* GET READY FOR TABLE READ, PAGE 0

	LARK    AR0,ONES     ONES: LAST TABLE ENTRY
	LT      ONE
	MPYK    TBLEND
	PAC
	LARP    AR0

* MOVE CONSTANTS TO DATA MEMORY, PAGE 0

MOVTBL  TBLR    *
	SUB     ONE
	BANZ    MOVTBL

* GET READY FOR TABLE READ, PAGE 1

	LARK    AR1,HPF+4     HPF+4: LAST TABLE ENTRY
	LARK    AR0,TBLEND1-TABLE1
	LT      ONE
	MPYK    TBLEND1
	PAC

* MOVE CONSTANTS TO DATA MEMORY, PAGE 1

	LARP    AR1
MOVTBL1 LDPK    1
	LARP    AR1
	TBLR    *-,AR0
	LDPK    0
	SUB     ONE
	BANZ    MOVTBL1

	LARP    AR0
	LDPK    0

* INPUT INTERPOLATOR 2

AGAIN   ZAC
	LT      LPFI2+10
	MPYK    56
	DMOV    LPFI2+9
	LTD     LPFI2+8
	MPYK    -265
	DMOV    LPFI2+7
	LTD     LPFI2+6
	MPYK    1237
	LTD     LPFI2+5
	MPYK    2048
	LTD     LPFI2+4
	MPYK    1237
	DMOV    LPFI2+3
	LTD     LPFI2+2
	MPYK    -265
	DMOV    LPFI2+1
	LTD     LPFI2
	MPYK    56
	APAC
	ADD     ONE,11  ADD 0.5 TO ROUND
	LDPK    1
	SACH    INP,4   SAVE TO HPF W/ SHIFT
	LDPK    0

* INPUT INTERPOLATOR 1 PASS 1

	ZAC
	LT      LPFI1+6
	MPYK    -145
	DMOV    LPFI1+5
	LTD     LPFI1+4
	MPYK    1167
	LTD     LPFI1+3
	MPYK    2048
	LTD     LPFI1+2
	MPYK    1167
	DMOV    LPFI1+1
	LTD     LPFI1
	MPYK    -145
	APAC
	ADD     ONE,11  ADD 0.5 TO ROUND
	SACH    LPFI2,4 SAVE TO 2ND INTERP W/ SHIFT

* PUT FIRST INPUT SAMPLE INTO FIRST INPUT INTERPOLATOR

	ZALS    SIGIN   PUT SAMPLE INTO ACC-L
	XOR     MASK    A/D OFFSET BINARY=>2'S COMP
	AND     LSBMAX  CLEAR ALL LOW ORDER BITS (NOISE)
	SACL    LPFI1   PUT INTO FIRST INTERPOLATOR

* FIRST INTERPOLATOR DATA MOVE PASS 1

	DMOV    LPFI1+5
	DMOV    LPFI1+4
	DMOV    LPFI1+3
	DMOV    LPFI1+2
	DMOV    LPFI1+1
	DMOV    LPFI1

* PUT SECOND INPUT SAMPLE INTO FIRST INPUT INTERPOLATOR

	ZALS    SIGIN+1 PUT SAMPLE INTO ACC-L
	XOR     MASK    A/D OFFSET BINARY=>2'S COMP
	AND     LSBMAX  CLEAR ALL LOW ORDER BITS (NOISE)
	SACL    LPFI1   PUT INTO FIRST INTERPOLATOR

* SECOND INTERPOLATOR DATA MOVE

	DMOV    LPFI2+9
	DMOV    LPFI2+8
	DMOV    LPFI2+7
	DMOV    LPFI2+6
	DMOV    LPFI2+5
	DMOV    LPFI2+4
	DMOV    LPFI2+3
	DMOV    LPFI2+2
	DMOV    LPFI2+1
	DMOV    LPFI2

* INPUT INTERPOLATOR 1 PASS 2

	ZAC
	LT      LPFI1+6
	MPYK    -145
	DMOV    LPFI1+5
	LTD     LPFI1+4
	MPYK    1167
	LTD     LPFI1+3
	MPYK    2048
	LTD     LPFI1+2
	MPYK    1167
	DMOV    LPFI1+1
	LTD     LPFI1
	MPYK    -145
	APAC
	ADD     ONE,11  ADD 0.5 TO ROUND
	SACH    LPFI2,4 SAVE TO 2ND INTERP W/ SHIFT

* PUT THIRD INPUT SAMPLE INTO FIRST INPUT INTERPOLATOR

	ZALS    SIGIN+2 PUT SAMPLE INTO ACC-L
	XOR     MASK    A/D OFFSET BINARY=>2'S COMP
	AND     LSBMAX  CLEAR ALL LOW ORDER BITS (NOISE)
	SACL    LPFI1   PUT INTO FIRST INTERPOLATOR

* FIRST INTERPOLATOR DATA MOVE PASS 2

	DMOV    LPFI1+5
	DMOV    LPFI1+4
	DMOV    LPFI1+3
	DMOV    LPFI1+2
	DMOV    LPFI1+1
	DMOV    LPFI1

* PUT FOURTH INPUT SAMPLE INTO FIRST INPUT INTERPOLATOR

	ZALS    SIGIN+3 PUT SAMPLE INTO ACC-L
	XOR     MASK    A/D OFFSET BINARY=>2'S COMP
	AND     LSBMAX  CLEAR ALL LOW ORDER BITS (NOISE)
	SACL    LPFI1   PUT INTO FIRST INTERPOLATOR

* FIRST OUTPUT SIGNAL TO DAC

	OUT     SIGOUT,PA1      TO D/A CONV
	IN      SIGIN,PA1       INPUT FIRST SAMPLE
	OUT     ONE,PA0         START CONVERSION
	CALL    WASTE

* SECOND OUTPUT SIGNAL TO DAC

	OUT     SIGOUT+1,PA1    TO D/A CONV
	IN      SIGIN+1,PA1     INPUT SECOND SAMPLE
	OUT     ONE,PA0         START CONVERSION
	CALL    WASTE

* THIRD OUTPUT SIGNAL TO DAC

	OUT     SIGOUT+2,PA1    TO D/A CONV
	IN      SIGIN+2,PA1     INPUT THIRD SAMPLE
	OUT     ONE,PA0         START CONVERSION
	CALL    WASTE2

* FORM DITHER WORD
* 15 BITS EXTENDED TO 16
* BIT0 = BIT13 XOR BIT14

	LAC     DITHER,2        SHIFT BIT14 TO MSB-HI
	SACH    TEMP            STORE TEMPORARILY
	LAC     DITHER,3        SHIFT BIT13 TO MSB-HI
	SACH    LED             STORE TEMPORARILY IN LED
	LAC     TEMP
	XOR     LED             FORM XOR
	AND     ONE             IGNORE ALL BUT LSB
	ADD     DITHER,1        SHIFT UP ONE BIT
	SACL    DITHER          STORE NEW DITHER WORD

* CW BANDPASS FILTER

	LAC     DITHER,4        LOAD ACCUM WITH SHIFTED DITHER
	LT      BPF+81
	MPYK     0
	LTD     BPF+80
	MPYK     11
	LTD     BPF+79
	MPYK     10
	LTD     BPF+78
	MPYK     4
	LTD     BPF+77
	MPYK    -8

* FOURTH OUTPUT SIGNAL TO DAC

	OUT     SIGOUT+3,PA1    TO D/A CONV
	IN      SIGIN+3,PA1     INPUT FOURTH SAMPLE
	OUT     ONE,PA0         START CONVERSION

	LTD     BPF+76
	MPYK    -19
	LTD     BPF+75
	MPYK    -18
	LTD     BPF+74
	MPYK    -5
	LTD     BPF+73
	MPYK     11
	LTD     BPF+72
	MPYK     16
	LTD     BPF+71
	MPYK     9
	LTD     BPF+70
	MPYK     0
	LTD     BPF+69
	MPYK     2
	LTD     BPF+68
	MPYK     15
	LTD     BPF+67
	MPYK     21
	LTD     BPF+66
	MPYK     4
	LTD     BPF+65
	MPYK    -35
	LTD     BPF+64
	MPYK    -66
	LTD     BPF+63
	MPYK    -57
	LTD     BPF+62
	MPYK    -1
	LTD     BPF+61
	MPYK     67
	LTD     BPF+60
	MPYK     96
	LTD     BPF+59
	MPYK     63
	LTD     BPF+58
	MPYK    -5
	LTD     BPF+57
	MPYK    -52
	LTD     BPF+56
	MPYK    -45
	LTD     BPF+55
	MPYK    -10
	LTD     BPF+54
	MPYK    -3
	LTD     BPF+53
	MPYK    -52
	LTD     BPF+52
	MPYK    -110
	LTD     BPF+51
	MPYK    -92
	LTD     BPF+50
	MPYK     47
	LTD     BPF+49
	MPYK     238
	LTD     BPF+48
	MPYK     326
	LTD     BPF+47
	MPYK     193
	LTD     BPF+46
	MPYK    -127
	LTD     BPF+45
	MPYK    -436
	LTD     BPF+44
	MPYK    -502
	LTD     BPF+43
	MPYK    -239
	LTD     BPF+42
	MPYK     207
	LTD     BPF+41
	MPYK     545
	LTD     BPF+40
	MPYK     545
	LTD     BPF+39
	MPYK     207
	LTD     BPF+38
	MPYK    -239
	LTD     BPF+37
	MPYK    -502
	LTD     BPF+36
	MPYK    -436
	LTD     BPF+35
	MPYK    -127
	LTD     BPF+34
	MPYK     193
	LTD     BPF+33
	MPYK     326
	LTD     BPF+32
	MPYK     238
	LTD     BPF+31
	MPYK     47
	LTD     BPF+30
	MPYK    -92
	LTD     BPF+29
	MPYK    -110
	LTD     BPF+28
	MPYK    -52
	LTD     BPF+27
	MPYK    -3
	LTD     BPF+26
	MPYK    -10
	LTD     BPF+25
	MPYK    -45
	LTD     BPF+24
	MPYK    -52
	LTD     BPF+23
	MPYK    -5
	LTD     BPF+22
	MPYK     63
	LTD     BPF+21
	MPYK     96
	LTD     BPF+20
	MPYK     67
	LTD     BPF+19
	MPYK    -1
	LTD     BPF+18
	MPYK    -57
	LTD     BPF+17
	MPYK    -66
	LTD     BPF+16
	MPYK    -35
	LTD     BPF+15
	MPYK     4
	LTD     BPF+14
	MPYK     21
	LTD     BPF+13
	MPYK     15
	LTD     BPF+12
	MPYK     2
	LTD     BPF+11
	MPYK     0
	LTD     BPF+10
	MPYK     9
	LTD     BPF+9
	MPYK     16
	LTD     BPF+8
	MPYK     11
	LTD     BPF+7	MPYK    -5
	LTD     BPF+6
	MPYK    -18
	LTD     BPF+5
	MPYK    -19
	LTD     BPF+4
	MPYK    -8
	LTD     BPF+3
	MPYK     4
	LTD     BPF+2
	MPYK     10
	LTD     BPF+1
	MPYK     11
	LTD     BPF
	MPYK     0

	APAC
	ADD     ONE,11          ADD 0.5 TO ROUND
	SACH    BPFOUT,4        BPF OUTPUT

* INPUT HIGHPASS FILTER, FS=3125, PASS 300 REJ 20.5 0.5/50 DB N=2

*       NUMERATOR:

	LDPK    1
	ZAC
	LT      INP+2
	MPY     HPF
	LTD     INP+1
	MPY     HPF+1
	LTD     INP
	MPY     HPF+2

*       DENOMINATOR:

	LTA     DENOM+1
	MPY     HPF+4
	LTD     DENOM
	MPY     HPF+3
	APAC

	ADD     ONE1,11         ADD 0.5 TO ROUND
	SACH    DENOM,4         SAVE WITH SHIFT
	LDPK    0
	SACH    BPF,4           ALSO SAVE IN BPF INPUT

* SQUARE INPUT

	SACH    TEMP,4
	LT      TEMP
	MPY     TEMP
	PAC
	SACH    TEMP
	SUBH    SQUARE
	BGZ     PEAK
	ZALS    SQUARE
	SUB     ONE,2
	ABS
	SACL    SQUARE
	B       DISPLAY

PEAK    ZALH    TEMP
	SACH    SQUARE
	NOP
	NOP
	NOP
	NOP

* CONVERT TO DISPLAY

DISPLAY LAC     SQUARE,12
	SACH    LED

	LAC     SQUARE,11
	SACH    TEMP
	ZALS    TEMP
	OR      LED
	SACL    LED

	LAC     SQUARE,10
	SACH    TEMP
	ZALS    TEMP
	OR      LED
	SACL    LED

	LAC     SQUARE,9
	SACH    TEMP
	ZALS    TEMP
	OR      LED
	SACL    LED

	LAC     SQUARE,8
	SACH    TEMP
	ZALS    TEMP
	OR      LED
	SACL    LED

	LAC     SQUARE,7
	SACH    TEMP
	ZALS    TEMP
	OR      LED
	SACL    LED

	LAC     SQUARE,6
	SACH    TEMP
	ZALS    TEMP
	OR      LED
	SACL    LED

	LAC     SQUARE,5
	SACH    TEMP
	ZALS    TEMP
	OR      LED
	SACL    LED

	LAC     SQUARE,4
	SACH    TEMP
	ZALS    TEMP
	OR      LED
	SACL    LED

	LAC     SQUARE,3
	SACH    TEMP
	ZALS    TEMP
	OR      LED

	XOR     ONES
	SACL    LED

	OUT     LED,PA2

* OUTPUT INTERPOLATOR 4 PASS 1

	ZAC
	LT      LPFO2+3
	MPYK    -289
	LTD     LPFO2+2
	MPYK    2335
	LTD     LPFO2+1
	MPYK    2335
	LTD     LPFO2
	MPYK    -289
	APAC
	ADD     ONE,11          ADD 0.5 TO ROUND
	SACH    SIGOUT,4        SAVE 1ST OUTPUT SIGNAL
	ZALS    SIGOUT
	XOR     MASK            2'S COMP=>OFFSET BINARY
	SACL    SIGOUT          SAVE 1ST OUTPUT SIGNAL

* SECOND OUTPUT SIGNAL

	ZALS    LPFO2+2
	XOR     MASK            2'S COMP=>OFFSET BINARY
	SACL    SIGOUT+1        SAVE 2ND OUTPUT SIGNAL

* OUTPUT INTERPOLATOR 3

	ZAC
	LT      LPFO1+5
	MPYK    111
	LTD     LPFO1+4
	MPYK    -530
	LTD     LPFO1+3
	MPYK    2474
	LTD     LPFO1+2
	MPYK    2474
	LTD     LPFO1+1
	MPYK    -530
	LTD     LPFO1
	MPYK    111
	APAC
	ADD     ONE,11          ADD 0.5 TO ROUND
	SACH    LPFO2,4         SAVE TO INTERP 4 W/SHIFT

* PUT BANDPASS FILTER OUTPUT INTO THIRD INTERPOLATOR IF BIOZ IS LOW
* OTHERWISE USE BPF INPUT (DELAYED HALFWAY)

	BIOZ    GETBPF
	ZALH    BPFOUT
	B       PUTOUT
GETBPF  ZALH    BPF+40
	NOP
	NOP
PUTOUT  SACH    LPFO1

* OUTPUT INTERPOLATOR 4 PASS 2

	ZAC
	LT      LPFO2+3
	MPYK    -289
	LTD     LPFO2+2
	MPYK    2335
	LTD     LPFO2+1
	MPYK    2335
	LTD     LPFO2
	MPYK    -289
	APAC
	ADD     ONE,11          ADD 0.5 TO ROUND
	SACH    SIGOUT+2,4      SAVE 3RD OUTPUT SIGNAL
	ZALS    SIGOUT+2
	XOR     MASK            2'S COMP=>OFFSET BINARY
	SACL    SIGOUT+2        SAVE 1ST OUTPUT SIGNAL

* FOURTH OUTPUT SIGNAL

	ZALS    LPFO2+2
	XOR     MASK            2'S COMP=>OFFSET BINARY
	SACL    SIGOUT+3        SAVE 4TH OUTPUT SIGNAL

* LOAD OUTPUT INTERPOLATOR

	ZALH    LPFO1+3
	SACH    LPFO2

	B AGAIN

* TIME WASTING ROUTINE
* NUMBER OF CYCLES WASTED (INCLUDING "CALL WASTE")
* IS: 2 (CALL) + 3 (LARK+2 NOP)
* + 3*N (LOOP) + 2 (RET) = 7 + 3*(N+1)

* WASTE 394

WASTE   LARK    AR0,128
	NOP
	NOP
WASTEB  LARP    AR0
	BANZ    WASTEB
	RET

* WASTE 394-20=374

* 5 + 3*(N+1)

WASTE2  LARK    AR0,122
WASTE2B LARP    AR0
	BANZ    WASTE2B
	RET

TABLE   DATA    ?1111111100000000   A/D 8 BIT MASK
	DATA    ?1000000000000000   2'S COMPLEMENT MASK
TBLEND  DATA    ?1111111111111111   ONES

* ELLIPTIC IIR HPF DATA:
* N=2 PASS 300 HZ REJ 20 HZ 0.5 DB/50 DB
* FS = 3125 HZ
* HPF COEFFICIENTS:

TABLE1  DATA    2853,-5704,2853,5658
TBLEND1 DATA    -2333

* Copyright notice
* ONLY ROOM FOR 9 BYTES!
* ASCII DATA STRING EMBEDDED IN THE FOLLOWING DATA STATEMENTS:
* (c)92W9GR
	DATA    >2828,>6363,>2929,>3939,>3232,>5757,>3939,>4747
	DATA    >5252

	DEND
	END


Return to Quantics Home Page