home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 113 / EnigmaAmiga113CD.iso / software / sviluppo / quake_src / snd_mixamigappc.s < prev    next >
Encoding:
Text File  |  2000-06-17  |  2.2 KB  |  112 lines

  1. # Copyright (C) 1996-1997 Id Software, Inc. 
  2. # This program is free software; you can redistribute it and/or 
  3. # modify it under the terms of the GNU General Public License 
  4. # as published by the Free Software Foundation; either version 2 
  5. # of the License, or (at your option) any later version. 
  6. # This program is distributed in the hope that it will be useful, 
  7. # but WITHOUT ANY WARRANTY; without even the implied warranty of 
  8. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.   
  9. # See the GNU General Public License for more details. 
  10. # You should have received a copy of the GNU General Public License 
  11. # along with this program; if not, write to the Free Software 
  12. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. 
  13.  
  14. ##
  15. ##  Sound mixing routines for Amiga PPC
  16. ##
  17.  
  18. .include        "macrosPPC.i"
  19.  
  20. # dma_t (sound.h)
  21. .set    dma_gamealive,0
  22. .set    dma_soundalive,4
  23. .set    dma_splitbuffer,8
  24. .set    dma_channels,12
  25. .set    dma_samples,16
  26. .set    dma_submission_chunk,20
  27. .set    dma_samplepos,24
  28. .set    dma_samplebits,28
  29. .set    dma_speed,32
  30. .set    dma_buffer,36
  31.  
  32.  
  33.     .text
  34.  
  35.  
  36. # external references
  37.     xrefv    shm
  38.         xrefv    paintedtime
  39.         xrefa    paintbuffer
  40.         xrefa    volume
  41.  
  42.  
  43.     funcdef    S_TransferPaintBuffer
  44.  
  45. # The Amiga PPC version only supports 8 bit samples
  46.     stwu    r1,-32(r1)
  47.     lw    r4,shm            # r4 shm (struct dma_t)
  48.     lxa    r5,paintbuffer        # r5 paintbuffer (int left,int right)
  49.     lxa    r6,volume
  50.     lfs    f1,16(r6)        # volume.value * 256
  51.     ls    f2,c256
  52.     fmuls    f1,f1,f2
  53.     lw    r7,paintedtime
  54.     subf.    r8,r7,r3        # r8 count
  55.     beq    exit
  56.     lwz    r9,dma_buffer(r4)    # r9 dma buffer start address
  57.     fctiwz    f1,f1
  58.     stfd    f1,24(r1)
  59.     lwz    r10,28(r1)        # r10 = snd_vol
  60.     lwz    r11,dma_samples(r4)
  61.     add    r12,r9,r11
  62.     subi    r11,r11,1
  63.     and    r7,r7,r11
  64.     add    r3,r7,r9        # r3 out
  65.     lis    r4,0x7fffff@h        # r4 max val
  66.     ori    r4,r4,0x7fffff@l
  67.     not    r6,r4            # r6 min val
  68. loop:
  69.     lwz    r0,0(r5)
  70.     mullw    r0,r0,r10
  71.     addi    r5,r5,8
  72.     cmpw    r0,r4
  73.     ble    .1
  74.     mr    r0,r4
  75.     b    .2
  76. .1:    cmpw    r0,r6
  77.     bge    .2
  78.     mr    r0,r6
  79. .2:    srawi    r0,r0,16
  80.     stb    r0,0(r3)
  81.     addi    r3,r3,1
  82.     cmpw    r3,r12
  83.     bge    .3
  84.     subic.    r8,r8,1
  85.     bne    loop
  86.     b    exit
  87. .3:    mr    r3,r9
  88.     subic.    r8,r8,1
  89.     bne    loop
  90. exit:
  91.     addi    r1,r1,32
  92.     blr
  93.  
  94.     funcend    S_TransferPaintBuffer
  95.  
  96.  
  97.  
  98. .ifdef    WOS
  99.     .tocd
  100. .else
  101.         .data
  102. .endif
  103.     .align    2
  104. lab c256
  105.     .float    256.0
  106.