home *** CD-ROM | disk | FTP | other *** search
/ Vectronix 2 / VECTRONIX2.iso / FILES_10 / DEVPAC56.ZIP / MATMULT4.S56 < prev    next >
Text File  |  1993-12-20  |  2KB  |  91 lines

  1. ;    MATMULT4.S56 Matrix multiplication for the Atari Falcon
  2. ;    part of the HiSoft DevpacDSP tutorial.
  3. ;    (c) Copyright HiSoft 1993
  4. ;      All rights reserved.
  5.  
  6. HSR    equ    $ffe9
  7. HTX    equ    $ffeb
  8. HRX    equ    $ffeb
  9.  
  10. N    equ     4
  11.  
  12.     org    P:$40
  13. start
  14.  
  15. ; first set the modulo registers corresponding to all the
  16. ; R registers we are going to use to disable modulo addresssing
  17.     move    #-1,M0
  18.     move    #-1,M1
  19.     move    M0,M4
  20.     move    M0,M5
  21.     move    M0,M6
  22.  
  23. ; read in the A array from the host port
  24.     move    #abuffer,R0
  25.     DO    #N*N,firstloop
  26. ; what until a word is ready
  27. get_first
  28.     jclr    #0,X:HSR,get_first
  29.     movep    X:HRX,X0
  30.     move    X0,X:(R0)+
  31. firstloop    
  32.  
  33. ; read in the B array from the host port
  34.     move    #bbuffer,R0
  35.     DO    #N*N,secondloop
  36. get_second
  37.     jclr    #0,X:HSR,get_second    ; if no data jump to the top
  38.     movep    X:HRX,X0
  39.     move    X0,Y:(R0)+
  40. secondloop    
  41.  
  42.  
  43.     move    #bbuffer,R5
  44.     move    #cbuffer,R6
  45.     move    #N,N0    
  46.     move    #N,N5
  47.     do    #N,iloop
  48.     move    #abuffer,R1    
  49.     do    #N,jloop
  50.     move    R5,R4        
  51.     clr    a        R1,R0
  52.     do    #N,kloop
  53.     move    X:(R0)+N0,X0    Y:(R4)+,Y0
  54.     mac    x0,y0,A
  55. kloop
  56.     move    (R1)+
  57. ; Now store A in two DSP words
  58.     move    A2,Y:(R6)+        
  59.     move    A1,Y:(R6)+
  60. jloop
  61.     lua    (R5)+N5,R5
  62. iloop
  63.  
  64.     move    #cbuffer,R6
  65.     DO    #N*N*2,sendloop
  66.     move    Y:(R6)+,Y0
  67. pxmit    jclr    #1,X:HSR,pxmit
  68.     movep    Y0,X:HTX
  69. sendloop    
  70.  
  71. forever    jmp    forever    ;        just hang
  72.  
  73.     org     X:$40
  74. abuffer    dc     .07483626,.184443,.7055502,.1768224 
  75.     dc     .5215743,.6521941,.4704354,.455802 
  76.     dc     .8373808,.519858,.09587825,.379077 
  77.     dc     .371908,.3766014,.202421,.8229417 
  78.  
  79.  
  80.     org    Y:$1000
  81. bbuffer
  82.     dc     .1410046,.1712484,.3422694,.3676988 
  83.     dc     .807768,.6713575,.7668441,.2701154 
  84.     dc     .7455041,.7600289,.6523577,.9965845 
  85.     dc     .9586045,.6935848,.911911,.528457 
  86.  
  87. ; the results
  88. cbuffer    ds    N*N*2
  89.     dc    0        ;for now
  90.     end
  91.