2 IIR4
         Name: IIR4.ASM
         Type: Assembler Macro
      Version: 1.0
 Date Entered:  15-Jul-87
  Last Change:  15-Jul-87

  Description: Second Order Direct Canonic Filter

  This macro implements a second order filter with a minimum of
  delay elements.  The difference equation relating the output
  to the input is:

      y(n) = a(1)y(n-1) + a(2)y(n-2) + x(n) + b(1)x(n-1) + b(2)x(n-2)

   with z transform:

                          -1       -2    
        Y(z)     1 + b(1)z  + b(2)z
      ------- = ----------------------
        X(z)              -1       -2
                 1 - a(1)z  - a(2)z

  where:
    x(n)  = input sample at time nT
    y(n)  = output of the filter at time nT
    a(n)  = filter coefficient n (magnitude less than one)
    b(n)  = filter coefficient n (magnitude less than one)
      T   = sample period


  In this example, it is  assumed  that  b(0)=1.   A  network  to
  implement this filter is shown below.

     Input                w(n)
 x(n) >----(+)--------------------------(+)-----> y(n)
            ^              |             ^      Output
            |     a(1)    1/z    b(1)    |
           (+)<-- 0.8 -----|---- 0.4 -->(+)
            ^              v             ^
            |     a(2)    1/z    b(2)    |
           (+)<-- -0.3 ----|--- -0.6 -->(+)


  For the above filter, the memory map  for  the  filter
  states and the coefficients is shown below.

           r0
           |
           v
       -------------------
  X:   |        |        |
       | w(n-1) | w(n-2) | Filter States
       -------------------

       -------------------------------------
  Y:   |  a(1)  |  a(2)  |  b(1)  |  b(2)  |
       |  .8    |  -.3   |  .4    |  -.6   | Filter Coefficients
       -------------------------------------
           ^
           |
           r4        m0=3 (mod 4)

               Memory Map for the Biquad Filter

  The address register r0 is initialized pointing to  the  first
  filter  state  and  r4  is  initialized pointing to the filter
  coefficients.  Modulo register m0 is  set  to  -1  to  provide
  linear  arithmetic.   Modulo register m4 is set to 3 providing
  modulo 4 arithmetic.

  For an example of how to use this filter see the test program IIR4T.ASM

