home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 #1 / Ham Radio 2000.iso / ham2000 / hf / dsp / source / tst.asm < prev    next >
Encoding:
Assembly Source File  |  1991-08-31  |  5.5 KB  |  286 lines

  1.     page    132,63,3,3
  2.     opt    rc
  3. ;
  4. ;  TST.ASM -- General diagnostic program for the DSP CARD 3
  5. ;
  6. ;  Copyright (C) 1990, 1991 by Alef Null. All rights reserved.
  7. ;  Author(s): Jarkko Vuori, OH2LNS
  8. ;  Modification(s):
  9. ;
  10.  
  11. ; program parameters
  12. ;        X               Y          P
  13. ; 0000 +----------+  0000 +----------+    0000 +----------+
  14. ;      | Internal |      | Internal |         |        |
  15. ; 0100 +----------+  0100 +----------+         | Internal |
  16. ;      | LOG ROM  |      | SIN ROM  |         |        |
  17. ; 0200 +----------+  0200 +----------+    0200 +----------+
  18. ;      | External |      | External |         |        |
  19. ;      |      |      |         |         | External |
  20. ; 0A00 +----------+  0A00 +----------+         |        |
  21. ;                         |        |
  22. ;                    1200 +----------+
  23. ;
  24. ;
  25. ;
  26. begdblk equ    $0200
  27. enddblk equ    $09ff
  28. begpblk equ    $0200
  29. endpblk equ    $11ff
  30.  
  31.     nolist
  32.     include 'intequlc.asm'
  33.     include 'ioequlc.asm'
  34.     list
  35.  
  36. outssi    macro    data
  37.     jclr    #m_tde,x:m_sr,*
  38.     movep            #data,x:m_tx
  39.     endm
  40.  
  41. ; Reset vector
  42.     org    p:i_reset
  43.     jmp    start
  44.  
  45. ; SSI xmit vector
  46.     org    p:i_ssitd
  47.     jsr    ssixmit
  48.  
  49. ; SCI receiving vector
  50.     org    p:i_scird
  51.     jsr    scirec
  52.  
  53. ; SCI receiving with execption status
  54.     org    p:i_scirde
  55.     jsr    scirece
  56.  
  57. ; SCI xmit vector (fast interrupt)
  58.     org    p:i_scitd
  59.     movep            x:(r6)+,x:m_stxl
  60.     nop
  61.  
  62. ;
  63. ; Program Start
  64. ;
  65.     org    p:$40
  66.  
  67. ; no wait states on external memory
  68. start    movep            #$0000,x:m_bcr        ; no wait states
  69.  
  70. ; initialize SCI
  71.     movep            #$1b02,x:m_scr        ; 8,n,1
  72.     movep            #$0022,x:m_sccr        ; 9600 bit/s
  73.  
  74. ; initialize SSI
  75.     movep            #$4000,x:m_cra        ; 16 bit word
  76.     movep            #$7200,x:m_crb        ; syncronous,word frame,ext clk
  77.  
  78. ; initialize port C
  79.     movep            #$01eb,x:m_pcc        ; TXD,RXD,SC0,SC2,SCK,SRD,STD
  80.     movep            #$0014,x:m_pcddr        ; SCLK,SC1 as output
  81.     movep            #$0000,x:m_pcd
  82.  
  83. ; program the A/D & D/A converter chip (TLC32044)
  84. ; insert A/D high-pass filter, disable loopback, disable AUX IN,
  85. ; select syncronous mode, Gain as +-3V, insert sinx/x correction
  86. ; cutoff frequency at    2356Hz -> TXA = 14 (SCF = 179kHz)
  87. ; sampling frequency is 4826Hz -> TXB = 37
  88.     outssi    $000000                 ; flush any garbage out
  89.     outssi    $000300                 ; begin secondary communication
  90.     outssi    ((%10011001<<2)|%11)<<8         ; d9=1,d7=0,d6=1,d5=1,d4=0,d3=0,d2=1
  91.     outssi    $000300                 ; begin secondary communication
  92.     outssi    ((14<<9)|%00)<<8            ; TA=14
  93.     outssi    $000300                 ; begin secondary communication
  94.     outssi    ((37<<9)|%10)<<8            ; TB=37
  95.  
  96. ; initialize sinewave generator
  97.     ori    #$4,omr                 ; enable internal ROMs
  98.     move            #$0100,r7
  99.     move            #256-1,m7
  100.     move            #117,n7              ; frequency
  101.  
  102. ; initialize banner writer
  103.     move            #banner,r6
  104.     move            #banlen-1,m6
  105.     nop
  106.     movep            x:(r6)+,x:m_stxl        ; kick SCI xmitter up
  107.  
  108. ; start interrupts
  109.     movep            #$b000,x:m_ipr        ; SSI=IPL2,SCI=IPL1
  110.     andi    #$fc,mr                 ; unmask interrupts
  111.  
  112. ; initialize pattern pointers
  113.     move            #<pat,r1
  114.     move            #<patlen-1,m1
  115.     move            m1,m2
  116.  
  117. ; set memory
  118. loop    move            r1,r2
  119. ; X
  120.     move            #begdblk,r0
  121.     do    #enddblk-begdblk,setxloop
  122.     move                y:(r2)+,x0
  123.     move            x0,x:(r0)+
  124. setxloop
  125. ; Y
  126.     move            #begdblk,r0
  127.     do    #enddblk-begdblk,setyloop
  128.     move                y:(r2)+,y0
  129.     move            y0,y:(r0)+
  130. setyloop
  131. ; P
  132.     move            #begpblk,r0
  133.     do    #endpblk-begpblk,setploop
  134.     move                y:(r2)+,x0
  135.     move            x0,p:(r0)+
  136. setploop
  137.  
  138. ; check memory
  139.     move            r1,r2
  140.     move            #-1,x0
  141.     clr    b
  142. ; X
  143.     move            #begdblk,r0
  144.     do    #enddblk-begdblk,chkxloop
  145.     move                y:(r2)+,y0
  146.     move            x:(r0)+,a
  147.     cmp    y0,a
  148.     tne            x0,b
  149. chkxloop
  150. ; Y
  151.     move            #begdblk,r0
  152.     do    #enddblk-begdblk,chkyloop
  153.     move                y:(r2)+,y0
  154.     move            y:(r0)+,a
  155.     cmp    y0,a
  156.     tne            x0,b
  157. chkyloop
  158. ; P
  159.     move            #begpblk,r0
  160.     do    #endpblk-begpblk,chkploop
  161.     move                y:(r2)+,y0
  162.     move            p:(r0)+,a
  163.     cmp    y0,a
  164.     tne            x0,b
  165. chkploop
  166.  
  167. ; reset error bit (SC1) and stop the system if errors detected
  168.     tst    b
  169.     jeq    ok
  170.     bset    #$2,x:m_pcd
  171.     stop
  172.  
  173. ; change test patterns cyclically
  174. ok    move            #<pat,x0
  175.     move            (r1)+
  176.     move            r1,b
  177.     cmp    x0,b
  178.     jne    loop
  179.  
  180. ; toggle indicator bit CTS (SC1) when one test run is complete
  181.     bchg    #$2,x:m_pcd
  182.  
  183.     jmp    loop
  184.  
  185.  
  186. ; *** SSI xmit interrupt ***
  187. ssixmit
  188. ; store contex
  189.     move            y,l:<contexa
  190.     move            a10,l:<contexa+1
  191.     move            a2,x:<contexa+2
  192.  
  193.     move            y:(r7)+n7,a
  194.     move            #$fffc00,y0
  195.     and    y0,a
  196.     movep            a,x:m_tx
  197.  
  198. ; restore contex
  199.     move            l:<contexa,y
  200.     move            l:<contexa+1,a10
  201.     move            x:<contexa+2,a2
  202.  
  203.     rti
  204.  
  205.  
  206. ; *** SCI receiving interrupt ***
  207. scirec
  208. ; store contex
  209.     move            y,l:<contexb
  210.     move            a10,l:<contexb+1
  211.     move            a2,x:<contexb+2
  212.  
  213.     move            n7,r3
  214.     movep            x:m_srxl,a
  215.     move            #>'+',y0
  216.     cmp    y0,a        #>'-',y0
  217.     jeq    <inc
  218.     cmp    y0,a
  219.     jne    <endsci
  220. ; decrement frequency
  221.     move            (r3)-
  222.     move            r3,n7
  223.     jmp    <endsci
  224. ; increment frequency
  225. inc    move            (r3)+
  226.     move            r3,n7
  227.  
  228. ; restore contex
  229. endsci    move            l:<contexb,y
  230.     move            l:<contexb+1,a10
  231.     move            x:<contexb+2,a2
  232.  
  233.     rti
  234.  
  235.  
  236. ; *** SCI receiving with errors interrupt ***
  237. scirece
  238. ; store contex
  239.     move            a10,l:<contexb+1
  240.  
  241.     movep            x:m_ssr,a1
  242.     movep            x:m_srxl,a1
  243.  
  244. ; restore contex
  245.     move            l:<contexb+1,a10
  246.  
  247.     rti
  248.  
  249.  
  250. ;
  251. ; Y:mem
  252. ;
  253.     org    y:$0
  254. ; test patterns
  255. pat
  256.     dc    $ffffff
  257.     dc    $aaaaaa
  258.     dc    $555555
  259.     dc    $0ffff0
  260.     dc    $ff00ff
  261.     dc    $00ff00
  262.     dc    $f0f0f0
  263.     dc    $0f0f0f
  264.     dc    $101010
  265.     dc    $ffffff
  266.     dc    $000000
  267. patlen    equ    *-pat
  268.  
  269.  
  270. ;
  271. ; X mem
  272. ;
  273.     org    x:$0
  274. banner    dc    'H','e','l','l','o',' ','W','o','r','l','d','!',10,13
  275. banlen    equ    *-banner
  276.  
  277.  
  278. ;
  279. ; L:mem
  280. ;
  281.     org    l:banlen
  282. contexa ds    3
  283. contexb ds    2
  284.  
  285.     end
  286.