home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 #1 / Ham Radio 2000.iso / ham2000 / hf / dsp / source / macros.asm < prev    next >
Encoding:
Assembly Source File  |  1992-09-30  |  3.1 KB  |  130 lines

  1. ;***************************************************************
  2. ;* MACROS.ASM -- General Purpose Macros                *
  3. ;*                                   *
  4. ;* Copyright (C) 1990-1992  by Alef Null. All rights reserved. *
  5. ;* Author(s): Jarkko Vuori, OH2LNS                   *
  6. ;* Modification(s):                           *
  7. ;***************************************************************
  8.  
  9. ;********************
  10. ;*    DSP CARD 3    *
  11. ;*     equates        *
  12. ;********************
  13.  
  14. ; DCD light handling
  15. dcdon    macro
  16.     bset    #$2,x:m_pcd
  17.     endm
  18. dcdoff    macro
  19.     bclr    #$2,x:m_pcd
  20.     endm
  21.  
  22. ; PTT handling
  23. ptton    macro
  24.     bset    #$4,x:m_pcd
  25.     endm
  26. pttoff    macro
  27.     bclr    #$4,x:m_pcd
  28.     endm
  29.  
  30.  
  31. ;********************
  32. ;*  Useful macros   *
  33. ;********************
  34.  
  35. ; macro for immediate move
  36. movi    macro    data,dest
  37.     move            #data,a1
  38.     move            a1,dest
  39.     endm
  40. movib    macro    data,dest
  41.     move            #data,b1
  42.     move            b1,dest
  43.     endm
  44.  
  45.  
  46. ;********************
  47. ;*  Contex swapping *
  48. ;*     macros        *
  49. ;********************
  50.  
  51. ; macro for entering interrupt service routine
  52. enter    macro    contex
  53.     move            x,l:<contex+0
  54.     move            y,l:<contex+1
  55.     move            a10,l:<contex+2
  56.     move            b10,l:<contex+3
  57.     move            a2,x:<contex+4
  58.     move            b2,y:<contex+4
  59.     endm
  60.  
  61.  
  62. ; macro for leaving interrupt service routine
  63. leave    macro    contex
  64.     move            l:<contex+0,x
  65.     move            l:<contex+1,y
  66.     move            l:<contex+2,a10
  67.     move            l:<contex+3,b10
  68.     move            x:<contex+4,a2
  69.     move            y:<contex+4,b2
  70.     rti
  71.     endm
  72.  
  73.  
  74. ; macro for  ALU contex space reserving
  75. roomab    macro
  76.     ds    5
  77.     endm
  78.  
  79.  
  80. ;********************
  81. ;*     TLC32044     *
  82. ;********************
  83.  
  84. ; primary communication controls
  85. noadj    equ    %00<<8
  86. retard    equ    %01<<8
  87. advance equ    %10<<8
  88.  
  89.  
  90. ; output to ssi
  91. outssi    macro    data
  92.     jclr    #m_tde,x:m_sr,*
  93.     movep            #data,x:m_tx
  94.     endm
  95.  
  96.  
  97. ; program the Texas A/D & D/A converter chip
  98. pgmtlc    macro    ctrl,tra,tra2,trb
  99.     outssi    $000000                 ; flush any garbage out
  100.     outssi    $000300                 ; begin secondary communication
  101.     outssi    ((ctrl<<2)|%11)<<8            ; set control word
  102.     outssi    $000300                 ; begin secondary communication
  103.     outssi    ((tra<<9)|(tra<<2)|%00)<<8        ; set TA and RA registers
  104.     outssi    $000300                 ; begin secondary communication
  105.     outssi    ((tra2<<9)|(tra2<<2)|%01)<<8        ; set TA' and RA' registers
  106.     outssi    $000300                 ; begin secondary communication
  107.     outssi    ((trb<<9)|(trb<<2)|%10)<<8        ; set TB and RB registers
  108.     endm
  109.  
  110.  
  111. ;********************
  112. ;*    Global LPC    *
  113. ;* codec parameters *
  114. ;********************
  115.  
  116. N    equ    240                    ; window size
  117. M    equ    160                    ; frame size
  118. P    equ    10                    ; number of LPC coefficients
  119. voiced    equ    6                    ; confidence threshold for voicing
  120. boost    equ    3                    ; gain boosting for unvoiced sounds
  121. monopit equ    70                    ; constant pitch in monotonic mode
  122. filter    equ    79                    ; filter lenght for Gold-Rabiner low-pass
  123. poly    equ    $10800                    ; random number generator polynomial (x^17 + x^12 + 1)
  124.  
  125. whisper equ    0                    ; whisper mode flag bit
  126. silence equ    1                    ; silence flag bit
  127. loopb    equ    2                    ; loopback mode flag bit
  128. monot    equ    3                    ; monotone mode flag bit
  129. ipolate equ    8                    ; interpolate flag (for synthesis part only)
  130.