home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / files / music / songdump / ppause.s next >
Text File  |  1987-05-23  |  1KB  |  60 lines

  1. *
  2. *
  3. *    p_pause( (long)timeout ); - uses RTX if there, otherwises uses
  4. *        200Hz system timer to emulate it
  5. *
  6. *
  7.     .text
  8.  
  9.     .globl _p_pause
  10. _p_pause:
  11.     pea    0            * go into supervisor mode
  12.     move.w    #$20,-(sp)        * Super(0)
  13.     trap    #1            * enter GEMDOS
  14.     addq.l     #6,sp            * restore stack
  15.     tst.b    $94            * check RTX vector
  16.     bne    no_rtx            * no, emulate
  17.     move.l    d0,-(sp)        * set SSP back
  18.     move.w    #$20,-(sp)        * Super(savessp)
  19.     trap     #1            * enter GEMDOS
  20.     addq.l     #6,sp            * restore stack
  21. *
  22. * OK, now do RTX call
  23. *
  24.     move.l    4(sp),-(sp)        * timeout
  25.     move.w    #$c,-(sp)        * p_pause
  26.     trap    #5            * enter RTX
  27.     addq.l    #6,sp
  28.     cmp.l    #-1,d0            in system but not installed
  29.     beq    sup_no
  30.     rts
  31.  
  32. sup_no:                * reenter supervisor
  33.     pea    0            * go into supervisor mode
  34.     move.w    #$20,-(sp)        * Super(0)
  35.     trap    #1            * enter GEMDOS
  36.     addq.l     #6,sp            * restore stack
  37.  
  38. *
  39. * emulate
  40. *
  41. no_rtx:
  42.     move.l    4(sp),d1    millisecond delay
  43.     addq.l    #3,d1        round
  44.     divu    #5,d1        change into tic count
  45.     ext.l    d1        extend result
  46.     add.l    $4ba,d1        raw timer tic
  47.  
  48. wait1    cmp.l    $4ba,d1        wait until timer catches up
  49.     bhi    wait1
  50.  
  51.     move.l d0,-(sp)            * set SSP back
  52.     move.w #$20,-(sp)        * Super(savessp)
  53.     trap #1                * enter GEMDOS
  54.     addq.l #6,sp            * restore stack
  55.  
  56.     clr.l    d0
  57.     rts
  58.  
  59.     .end
  60.