home *** CD-ROM | disk | FTP | other *** search
/ Amiga ACS 1998 #4 / amigaacscoverdisc1998-041998.iso / utilities / commercialdemos / warpup-warpos2 / warprace / modsrc / memory / copy / longcopy.s < prev    next >
Text File  |  1997-09-24  |  4KB  |  151 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 powerpc/powerpc.i
  10.                 include warprace.i
  11.  
  12.                 include exec_lib.i
  13.  
  14.                 xref    PPCCopy
  15.                 xref    _LinkerDB
  16.  
  17.                 xdef    _PowerPCBase
  18.                 xdef    ErrParams
  19.  
  20. VERSION         =       1
  21. REVISION        =       0
  22. REVISIONCOUNT   =       1
  23.  
  24. MEMSIZE         =       256*1024
  25. MEMLOOP         =       256
  26.  
  27.                 mc68020
  28.  
  29.                 section "",code
  30. start
  31.                 movem.l d1-a6,-(sp)
  32.                 lea     _LinkerDB,a4
  33.                 cmp.l   #WR_ID,d0
  34.                 beq.b   .go
  35.                 movem.l (sp)+,d1-a6
  36.                 moveq   #0,d0
  37.                 rts
  38. .go
  39.                 move.l  a0,a2
  40.                 move.l  WRI_POWERPCBASE(a2),_PowerPCBase
  41.                 move.l  $4.w,_SysBase
  42.                 tst     WRI_68K(a2)
  43.                 bne     .notPPC
  44.                 move.l  a2,a0
  45.                 RUNPOWERPC      PPCCopy
  46.                 lea     Err_Mem,a5
  47.                 tst.l   d0
  48.                 beq.w   .error
  49.                 bra.w   .done
  50. .notPPC
  51.                 move.l  #MEMSIZE*2+32,d0
  52.                 move.l  d0,ErrParams
  53.                 move.l  #MEMF_PUBLIC,d1
  54.                 CALLEXEC        AllocVec
  55.                 lea     Err_Mem,a5
  56.                 move.l  d0,_Memory
  57.                 add.l   #31,d0
  58.                 and.l   #$ffffffe0,d0
  59.                 move.l  d0,d6
  60.                 tst.l   d0
  61.                 beq.w   .error
  62.                 move.l  d6,d5
  63.                 add.l   #MEMSIZE,d6
  64.                 move.l  d5,a0
  65.                 move.l  d6,a1
  66.                 bsr     LongCopy
  67.                 move.l  WRI_STARTTIMER_68K(a2),a1
  68.                 jsr     (a1)
  69.                 move    #MEMLOOP-1,d4
  70. .loop
  71.                 move.l  d5,a0
  72.                 move.l  d6,a1
  73.                 bsr     LongCopy
  74.                 dbra    d4,.loop
  75.                 move.l  WRI_STOPTIMER_68K(a2),a1
  76.                 jsr     (a1)
  77. .done
  78.                 move.l  #MEMSIZE*MEMLOOP,d2
  79.                 mulu.l  #1000000,d1:d2
  80.                 divu.l  d0,d1:d2
  81.                 move.l  d2,Result
  82.                 move.l  d2,d1
  83.                 moveq   #20,d0
  84.                 asr.l   d0,d2
  85.                 move.l  d2,ResultParams
  86.                 and.l   #$fffff,d1
  87.                 mulu    #100,d1
  88.                 asr.l   d0,d1
  89.                 move.l  d1,ResultParams+4
  90.                 move.l  #STATUS_SUCCESS,Status
  91.                 move.l  _Memory,a1
  92.                 CALLEXEC        FreeVec
  93.                 bra.b   .end
  94. .error
  95.                 move.l  a5,ErrStr
  96.                 move.l  #STATUS_ERROR,Status
  97. .end
  98.                 move.l  #WRO,d0
  99.                 movem.l (sp)+,d1-a6
  100.                 rts
  101.  
  102. LongCopy
  103.                 move.l  #(MEMSIZE>>6)-1,d3
  104. .copy
  105.                 rept    16
  106.                 move.l  (a0)+,(a1)+
  107.                 endr
  108.                 dbra    d3,.copy
  109.                 rts
  110.  
  111.  
  112.                 section "",data
  113. WRO
  114.                 dc.l    ModName
  115.                 dc.l    Short
  116.                 dc.l    Description
  117.                 dc.l    Author
  118.                 dc.l    VERSION
  119.                 dc.l    REVISION
  120.                 dc.l    REVISIONCOUNT
  121.                 dc.l    0
  122. Result
  123.                 dc.l    0
  124.                 dc.l    RES_BYTESPERSEC
  125.                 dc.l    ResultString
  126.                 dc.l    ResultParams
  127. Status
  128.                 dc.l    0
  129. ErrStr
  130.                 dc.l    0
  131.                 dc.l    ErrParams
  132.                 dc.l    0
  133.  
  134. ModName         dc.b    "LongCopy",0
  135. Short           dc.b    "Memory test: Longword copy operation (FAST -> FAST)",0
  136. Description     dc.b    "This program copies a large block of memory from FAST-RAM\n"
  137.                 dc.b    "to FAST-RAM using longword copy statements",0
  138. Author          dc.b    "Sam Jordan",0
  139. ResultString    dc.b    "Memory performance: %ld.%02ld MB/s",0
  140.  
  141. Err_Mem         dc.b    "Failed to allocate %ld bytes of memory",0
  142.  
  143.                 section "",bss
  144.                 ds.b    32
  145. _SysBase        ds.l    1
  146. _PowerPCBase    ds.l    1
  147. _Memory         ds.l    1
  148. ResultParams    ds.l    2
  149. ErrParams       ds.l    1
  150.                 ds.b    32
  151.