home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 113 / EnigmaAmiga113CD.iso / software / sviluppo / quakeworld_src / client / common68k.s < prev    next >
Encoding:
Text File  |  2000-06-17  |  2.9 KB  |  139 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. ** Quake for AMIGA
  16. ** common.c assembler implementations by Frank Wille <frank@phoenix.owl.de>
  17. **
  18. ** NOTE: Define __STORM__ when using this module with a StormC compiler
  19. **
  20.  
  21.         XDEF    _Q_memcpy
  22.         XDEF    _ShortSwap
  23.         XDEF    _LongSwap
  24.         XDEF    _FloatSwap
  25.         XDEF    _FloatSwap__r
  26.  
  27.  
  28. ******************************************************************************
  29. *
  30. *       void _Q_memcpy (void *dest, void *src, int count)
  31. *
  32. *       fast memcopy operation
  33. *
  34. ******************************************************************************
  35.  
  36.         cnop    0,4
  37. _Q_memcpy
  38.  
  39.         rsreset
  40.         rs.l    1
  41. .dest           rs.l    1
  42. .source         rs.l    1
  43. .count          rs.l    1
  44.  
  45.         move.l  .dest(sp),a1
  46.         move.l  .source(sp),a0
  47.         move.l  a0,d1
  48.         move.l  a1,d0
  49.         or.b    d0,d1
  50.         move.l  .count(sp),d0
  51.         beq.b   .exit
  52.         or.b    d0,d1
  53.         and.b   #$3,d1
  54.         bne.b   .loop2
  55. .loop
  56.         move.l  (a0)+,(a1)+
  57.         subq.l  #4,d0
  58.         bne.b   .loop
  59. .exit
  60.         rts
  61. .loop2
  62.         move.b  (a0)+,(a1)+
  63.         subq.l  #1,d0
  64.         bne.b   .loop2
  65.         rts
  66.  
  67. ******************************************************************************
  68. *
  69. *       short _ShortSwap (short l)
  70. *
  71. *       swap word (LE->BE)
  72. *
  73. ******************************************************************************
  74.  
  75.         cnop    0,4
  76. _ShortSwap
  77.  
  78.         rsreset
  79.         rs.l    1
  80.         IFND    __STORMC__
  81.         rs.w    1
  82.         ENDC
  83. .data           rs.w    1
  84.  
  85.         move    .data(sp),d0
  86.         ror     #8,d0
  87.         rts
  88.  
  89. ******************************************************************************
  90. *
  91. *       int _LongSwap (int l)
  92. *
  93. *       swap longword (LE->BE)
  94. *
  95. ******************************************************************************
  96.  
  97.         cnop    0,4
  98. _LongSwap
  99.  
  100.         rsreset
  101.         rs.l    1
  102. .data           rs.l    1
  103.  
  104.         move.l  .data(sp),d0
  105.         ror     #8,d0
  106.         swap    d0
  107.         ror     #8,d0
  108.         rts
  109.  
  110. ******************************************************************************
  111. *
  112. *       float _FloatSwap (float f)
  113. *
  114. *       swap float (LE->BE)
  115. *
  116. ******************************************************************************
  117.  
  118.         cnop    0,4
  119. _FloatSwap
  120. _FloatSwap__r
  121.  
  122.         rsreset
  123.         rs.l    1
  124. .data           rs.s    1
  125.  
  126.         move.l  .data(sp),d0
  127.         ror     #8,d0
  128.         swap    d0
  129.         ror     #8,d0
  130.         fmove.s d0,fp0
  131.         rts
  132.  
  133.