            TITLE PREPROCESSOR ROUTINES

* this module is executed once every TD*100ms

            CODE

            TST     T100MS0
            BNE     END_DERIV
* reload timer - if TD=0, make TD=1
            LDAA    TD
            BEQ     D10
            STAA    T100MS0
            BRA     D20
D10         LDAA    #$01
            STAA    T100MS0
* compute the derivative DERIV=ERR-PREVERR
D20         LDD     ERR
            SUBD    PREVERR
            STD     DERIV
            LDD     ERR
            STD     PREVERR
END_DERIV   EQU     *

            END


        