home *** CD-ROM | disk | FTP | other *** search
/ Amiga ACS 1998 #4 / amigaacscoverdisc1998-041998.iso / utilities / commercialdemos / warpup-warpos2 / warprace / modsrc / memory / read / longread.s < prev    next >
Text File  |  1997-10-14  |  4KB  |  144 lines

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