home *** CD-ROM | disk | FTP | other *** search
/ Amiga ACS 1998 #4 / amigaacscoverdisc1998-041998.iso / utilities / commercialdemos / warpup-warpos2 / warprace / modsrc / memory / read / byteread.s < prev    next >
Text File  |  1997-09-24  |  4KB  |  147 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+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,a0
  63.                 bsr     ByteRead
  64.                 move.l  WRI_STARTTIMER_68K(a2),a1
  65.                 jsr     (a1)
  66.                 move    #MEMLOOP-1,d4
  67. .loop
  68.                 move.l  d6,a0
  69.                 bsr     ByteRead
  70.                 dbra    d4,.loop
  71.                 move.l  WRI_STOPTIMER_68K(a2),a1
  72.                 jsr     (a1)
  73. .done
  74.                 move.l  #MEMSIZE*MEMLOOP,d2
  75.                 mulu.l  #1000000,d1:d2
  76.                 divu.l  d0,d1:d2
  77.                 move.l  d2,Result
  78.                 move.l  d2,d1
  79.                 moveq   #20,d0
  80.                 asr.l   d0,d2
  81.                 move.l  d2,ResultParams
  82.                 and.l   #$fffff,d1
  83.                 mulu    #100,d1
  84.                 asr.l   d0,d1
  85.                 move.l  d1,ResultParams+4
  86.                 move.l  #STATUS_SUCCESS,Status
  87.                 move.l  _Memory,a1
  88.                 CALLEXEC        FreeVec
  89.                 bra.b   .end
  90. .error
  91.                 move.l  a5,ErrStr
  92.                 move.l  #STATUS_ERROR,Status
  93. .end
  94.                 move.l  #WRO,d0
  95.                 movem.l (sp)+,d1-a6
  96.                 rts
  97.  
  98. ByteRead
  99.                 move.l  #(MEMSIZE>>4)-1,d3
  100. .copy
  101.                 rept    16
  102.                 move.b  (a0)+,d0
  103.                 endr
  104.                 dbra    d3,.copy
  105.                 rts
  106.  
  107.  
  108.                 section "",data
  109. WRO
  110.                 dc.l    ModName
  111.                 dc.l    Short
  112.                 dc.l    Description
  113.                 dc.l    Author
  114.                 dc.l    VERSION
  115.                 dc.l    REVISION
  116.                 dc.l    REVISIONCOUNT
  117.                 dc.l    0
  118. Result
  119.                 dc.l    0
  120.                 dc.l    RES_BYTESPERSEC
  121.                 dc.l    ResultString
  122.                 dc.l    ResultParams
  123. Status
  124.                 dc.l    0
  125. ErrStr
  126.                 dc.l    0
  127.                 dc.l    ErrParams
  128.                 dc.l    0
  129.  
  130. ModName         dc.b    "ByteRead",0
  131. Short           dc.b    "Memory test: Byte read operation (FAST -> register)",0
  132. Description     dc.b    "This program reads a large block of memory from FAST-RAM\n"
  133.                 dc.b    "into a data register using byte read statements",0
  134. Author          dc.b    "Sam Jordan",0
  135. ResultString    dc.b    "Memory performance: %ld.%02ld MB/s",0
  136.  
  137. Err_Mem         dc.b    "Failed to allocate %ld bytes of memory",0
  138.  
  139.                 section "",bss
  140.                 ds.b    32
  141. _SysBase        ds.l    1
  142. _PowerPCBase    ds.l    1
  143. _Memory         ds.l    1
  144. ResultParams    ds.l    2
  145. ErrParams       ds.l    1
  146.                 ds.b    32
  147.