home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Amiga 15 / MA_Cover_15.iso / source / winquake / amiga_timer.p < prev    next >
Encoding:
Text File  |  1999-08-19  |  722 b   |  49 lines

  1. ;        .section    ".text"
  2. ;        .globl    _ppctimer
  3. ;        .globl    _ppcaddtimer
  4. ;        .globl    _ppcsubtimer
  5. ;        .type    _ppctimer,@function
  6. ;        .type    _ppcaddtimer,@function
  7. ;        .type    _ppcsubtimer,@function
  8. ;
  9. ;# return the timebase registers in the structure passed in
  10. ;
  11. ;        .align    4
  12.  
  13.         noexe
  14.         xdef    _ppctimer
  15.         xdef    _ppcaddtimer
  16.         xdef    _ppcsubtimer
  17.  
  18.         vea
  19.  
  20. _ppctimer:    mftbu    r4
  21.         mftbl    r5
  22.         mftbu    r6
  23.         cmpw    r4,r6
  24.         bne-    _ppctimer
  25.  
  26.         stw    r4,0(r3)
  27.         stw    r5,4(r3)
  28.         blr
  29.  
  30. _ppcaddtimer:    lwz    r0,4(r3)
  31.         lwz    r9,4(r4)
  32.         addo    r0,r0,r9
  33.         stw    r0,4(r3)
  34.         lwz    r0,0(r3)
  35.         lwz    r9,0(r4)
  36.         adde    r0,r0,r9
  37.         stw    r0,0(r3)
  38.         blr
  39.  
  40. _ppcsubtimer:    lwz    r0,4(r3)
  41.         lwz    r9,4(r4)
  42.         subfo    r0,r9,r0
  43.         stw    r0,4(r3)
  44.         lwz    r0,0(r3)
  45.         lwz    r9,0(r4)
  46.         subfe    r0,r9,r0
  47.         stw    r0,0(r3)
  48.         blr
  49.