home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 113 / EnigmaAmiga113CD.iso / software / sviluppo / quakeworld_src / client / commonppc.s < prev    next >
Encoding:
Text File  |  2000-06-17  |  1.5 KB  |  81 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. ## commonPPC.s
  16. ##
  17. ## PPC assembler implementations of several functions in common.c
  18. ##
  19.  
  20. .ifdef    WOS
  21.     .macro    funcdef
  22.     .text
  23.     .globl    _\1
  24.     .align    3
  25. _\1:
  26.     .endm
  27.  
  28. .else
  29.     .macro    funcdef
  30.     .text
  31.     .globl    \1
  32.     .align    4
  33. \1:
  34.     .endm
  35. .endif
  36.  
  37.  
  38. # short ShortSwap (short l)
  39. #       swap word (LE->BE)
  40.  
  41.     funcdef    ShortSwap
  42.  
  43.     extrwi    r0,r3,8,16
  44.     insrwi    r0,r3,8,16
  45.     extsh    r3,r0
  46.     blr
  47.  
  48.  
  49. # int LongSwap (int l)
  50. #     swap longword (LE->BE)
  51.  
  52.     funcdef    LongSwap
  53.  
  54.     extrwi    r0,r3,8,0
  55.     rlwimi    r0,r3,24,16,23
  56.     rlwimi    r0,r3,8,8,15
  57.     insrwi    r0,r3,8,0
  58.     mr    r3,r0
  59.     blr
  60.  
  61.  
  62. # float FloatSwap (float f)
  63. #       swap float (LE->BE)
  64.  
  65.     funcdef    FloatSwap
  66.  
  67.     stwu    r1,-32(r1)
  68.     stfs    f1,24(r1)
  69.     lwz    r3,24(r1)
  70.     li    r0,24
  71.     stwbrx    r3,r1,r0
  72.     lfs    f1,24(r1)
  73.     addi    r1,r1,32
  74.     blr
  75.