home *** CD-ROM | disk | FTP | other *** search
/ Amiga ACS 1998 #4 / amigaacscoverdisc1998-041998.iso / utilities / commercialdemos / warpup-warpos2 / warprace / modsrc / memory / copy / turbocopy.s < prev    next >
Text File  |  1997-09-24  |  6KB  |  188 lines

  1.                 incdir  include:
  2.                 incdir  lvo:
  3.                 incdir  powerasm:source/powerpc_lib/warprace/
  4.  
  5. **      '(C) Copyright 1997 Haage & Partner Computer GmbH'
  6. **           All Rights Reserved
  7.  
  8.                 include exec/memory.i
  9.                 include exec/execbase.i
  10.                 include powerpc/powerpc.i
  11.                 include warprace.i
  12.  
  13.                 include exec_lib.i
  14.  
  15.                 xref    PPCCopy
  16.                 xref    _LinkerDB
  17.  
  18.                 xdef    _PowerPCBase
  19.                 xdef    ErrParams
  20.  
  21. VERSION         =       1
  22. REVISION        =       0
  23. REVISIONCOUNT   =       1
  24.  
  25. MEMSIZE         =       256*1024
  26. MEMLOOP         =       256
  27.  
  28.                 mc68020
  29.  
  30.                 section "",code
  31. start
  32.                 movem.l d1-a6,-(sp)
  33.                 lea     _LinkerDB,a4
  34.                 cmp.l   #WR_ID,d0
  35.                 beq.b   .go
  36.                 movem.l (sp)+,d1-a6
  37.                 moveq   #0,d0
  38.                 rts
  39. .go
  40.                 move.l  a0,a2
  41.                 move.l  WRI_POWERPCBASE(a2),_PowerPCBase
  42.                 move.l  $4.w,a6
  43.                 move.l  a6,_SysBase
  44.                 move    AttnFlags(a6),d0
  45.                 moveq   #-1,d7
  46.                 btst    #AFB_68040,d0
  47.                 beq.b   .slow
  48.                 moveq   #0,d7
  49. .slow
  50.                 tst     WRI_68K(a2)
  51.                 bne     .notPPC
  52.                 move.l  a2,a0
  53.                 RUNPOWERPC      PPCCopy
  54.                 lea     Err_Mem,a5
  55.                 tst.l   d0
  56.                 beq.w   .error
  57.                 bra.w   .done
  58. .notPPC
  59.                 move.l  #MEMSIZE*2+32,d0
  60.                 move.l  d0,ErrParams
  61.                 move.l  #MEMF_PUBLIC,d1
  62.                 CALLEXEC        AllocVec
  63.                 lea     Err_Mem,a5
  64.                 move.l  d0,_Memory
  65.                 add.l   #31,d0
  66.                 and.l   #$ffffffe0,d0
  67.                 move.l  d0,d6
  68.                 tst.l   d0
  69.                 beq.w   .error
  70.                 move.l  d6,d5
  71.                 add.l   #MEMSIZE,d6
  72.                 tst     d7
  73.                 bne.b   .slowcopy
  74.                 move.l  d5,a0
  75.                 move.l  d6,a1
  76.                 bsr     TurboCopy
  77.                 move.l  WRI_STARTTIMER_68K(a2),a1
  78.                 jsr     (a1)
  79.                 move    #MEMLOOP-1,d4
  80. .slowloop
  81.                 move.l  d5,a0
  82.                 move.l  d6,a1
  83.                 bsr     TurboCopy
  84.                 dbra    d4,.slowloop
  85.                 move.l  WRI_STOPTIMER_68K(a2),a1
  86.                 jsr     (a1)
  87.                 bra.b   .done
  88. .slowcopy
  89.                 move.l  d5,a0
  90.                 move.l  d6,a1
  91.                 bsr     SlowCopy
  92.                 move.l  WRI_STARTTIMER_68K(a2),a1
  93.                 jsr     (a1)
  94.                 move    #MEMLOOP-1,d4
  95. .turboloop
  96.                 move.l  d5,a0
  97.                 move.l  d6,a1
  98.                 bsr     SlowCopy
  99.                 dbra    d4,.turboloop
  100.                 move.l  WRI_STOPTIMER_68K(a2),a1
  101.                 jsr     (a1)
  102. .done
  103.                 move.l  #MEMSIZE*MEMLOOP,d2
  104.                 mulu.l  #1000000,d1:d2
  105.                 divu.l  d0,d1:d2
  106.                 move.l  d2,Result
  107.                 move.l  d2,d1
  108.                 moveq   #20,d0
  109.                 asr.l   d0,d2
  110.                 move.l  d2,ResultParams
  111.                 and.l   #$fffff,d1
  112.                 mulu    #100,d1
  113.                 asr.l   d0,d1
  114.                 move.l  d1,ResultParams+4
  115.                 move.l  #STATUS_SUCCESS,Status
  116.                 move.l  _Memory,a1
  117.                 CALLEXEC        FreeVec
  118.                 bra.b   .end
  119. .error
  120.                 move.l  a5,ErrStr
  121.                 move.l  #STATUS_ERROR,Status
  122. .end
  123.                 move.l  #WRO,d0
  124.                 movem.l (sp)+,d1-a6
  125.                 rts
  126.  
  127. SlowCopy
  128.                 move.l  #(MEMSIZE>>6)-1,d3
  129. .copy
  130.                 rept    16
  131.                 move.l  (a0)+,(a1)+
  132.                 endr
  133.                 dbra    d3,.copy
  134.                 rts
  135.  
  136.                 mc68040
  137. TurboCopy
  138.                 move.l  #(MEMSIZE>>8)-1,d3
  139. .copy
  140.                 rept    16
  141.                 move16  (a0)+,(a1)+
  142.                 endr
  143.                 dbra    d3,.copy
  144.                 rts
  145.  
  146.  
  147.                 section "",data
  148. WRO
  149.                 dc.l    ModName
  150.                 dc.l    Short
  151.                 dc.l    Description
  152.                 dc.l    Author
  153.                 dc.l    VERSION
  154.                 dc.l    REVISION
  155.                 dc.l    REVISIONCOUNT
  156.                 dc.l    0
  157. Result
  158.                 dc.l    0
  159.                 dc.l    RES_BYTESPERSEC
  160.                 dc.l    ResultString
  161.                 dc.l    ResultParams
  162. Status
  163.                 dc.l    0
  164. ErrStr
  165.                 dc.l    0
  166.                 dc.l    ErrParams
  167.                 dc.l    0
  168.  
  169. ModName         dc.b    "TurboCopy",0
  170. Short           dc.b    "Memory test: Fastest copy operation (FAST -> FAST)",0
  171. Description     dc.b    "This program copies a large block of memory from FAST-RAM\n"
  172.                 dc.b    "to FAST-RAM using the fastest possible algorithm. The PPC-\n"
  173.                 dc.b    "version uses LFDU/STFDU, the 68K-version MOVE16 (on 68040/\n"
  174.                 dc.b    "68060) or MOVE.L on other 68K processors",0
  175. Author          dc.b    "Sam Jordan",0
  176. ResultString    dc.b    "Memory performance: %ld.%02ld MB/s",0
  177.  
  178. Err_Mem         dc.b    "Failed to allocate %ld bytes of memory",0
  179.  
  180.                 section "",bss
  181.                 ds.b    32
  182. _SysBase        ds.l    1
  183. _PowerPCBase    ds.l    1
  184. _Memory         ds.l    1
  185. ResultParams    ds.l    2
  186. ErrParams       ds.l    1
  187.                 ds.b    32
  188.