home *** CD-ROM | disk | FTP | other *** search
/ No Fragments Archive 10: Diskmags / nf_archive_10.iso / MAGS / TOXIC / TOXIC17.MSA / SDPLAYER_AMSID.S < prev    next >
Encoding:
Text File  |  1999-01-22  |  2.2 KB  |  117 lines

  1. ; anders eriksson (evil) / dhs
  2. ; december 5, 1998
  3. ; ae@atari.org / dhs.atari.org
  4.  
  5. ; easy to use sidsound designer replay shell.
  6.  
  7.  
  8. ; tested with st, ste, mste, pak030, tt030,
  9. ; falcon030, centurbo2
  10.  
  11. ; sidsound desinger original routines by 
  12. ; synergy and animal mine. patched and updated
  13. ; by defjam/checkpoint.
  14.  
  15. ; timer a, c & d are used for the sid-emulation.
  16. ; this means you can use sid-emulation on all
  17. ; three voices.
  18.  
  19. ; timer b is used for calling the player at 50Hz
  20. ; interval.
  21.  
  22.  
  23.     section    text
  24.  
  25. begin:
  26.  
  27.     clr.l    -(sp)            ;into super
  28.     move.w    #32,-(sp)        ;
  29.     trap    #1            ;
  30.     addq.l    #6,sp            ;
  31.     move.l    d0,save_stack        ;save old stack
  32.  
  33.     lea.l    voice,a0        ;address to sounddata
  34.     lea.l    song,a1            ;address to songdata
  35.     jsr    player+0        ;init player
  36.  
  37.     move.w    sr,d0            ;save sr
  38.     move.w    #$2700,sr        ;all ints off
  39.  
  40.     lea.l    save_mfp,a0        ;save needed mfp regs
  41.     move.b    $fffffa07,(a0)+        ;
  42.     move.b    $fffffa13,(a0)+        ;
  43.     move.b    $fffffa1b,(a0)+        ;
  44.     move.b    $fffffa21,(a0)+        ;
  45.     bset    #0,$fffffa07        ;timer-b inits
  46.     bset    #0,$fffffa13        ;
  47.     move.b    #246,$fffffa21        ;2457600/200/246 approx 50 Hz
  48.     or.b    #%111,$fffffa1b        ;%111 = divide by 200
  49.     bclr    #3,$fffffa1b        ;tos 2.05 fix
  50.  
  51.     move.l    $120,save_timer_b    ;save old timer_b
  52.     move.l    #timer_b,$120        ;install new timer_b
  53.  
  54.     move.w    d0,sr            ;restore sr
  55.  
  56.  
  57.  
  58.  
  59. .loop:    cmpi.b    #$39,$fffffc02.w    ;wait for space
  60.     bne.s    .loop            ;
  61.  
  62.  
  63.  
  64.  
  65. exit:
  66.     move.w    sr,d0            ;save sr
  67.     move.w    #$2700,sr        ;all ints off
  68.  
  69.     lea.l    save_mfp,a0        ;restore mfp regs
  70.     move.b    (a0)+,$fffffa07        ;
  71.     move.b    (a0)+,$fffffa13        ;
  72.     move.b    (a0)+,$fffffa1b        ;
  73.     move.b    (a0)+,$fffffa21        ;
  74.  
  75.     move.l    save_timer_b,$120.w    ;restore timer_b
  76.  
  77.     move.w    d0,sr            ;restore sr
  78.  
  79.     jsr    player+8        ;deinit player
  80.  
  81.     move.l    save_stack,-(sp)    ;exit super
  82.     move.w    #32,-(sp)        ;
  83.     trap    #1            ;
  84.     addq.l    #6,sp            ;
  85.  
  86.     clr.w    -(sp)            ;pterm()
  87.     trap    #1
  88.  
  89.  
  90.  
  91.  
  92.  
  93. timer_b:
  94.     jsr    player+4        ;call player
  95.     bclr    #0,$fffffa0f        ;clear timer_b busyflag
  96.     rte
  97.  
  98.  
  99.     section    data
  100.  
  101.     even
  102. player:    incbin    'amsid.dat'        ;replay routines
  103.     even
  104. song:    incbin    'song.tri'        ;songdata
  105.     even
  106. voice:    incbin    'song.tvs'        ;sounddata
  107.     even
  108.  
  109.  
  110.  
  111.     section    bss
  112.  
  113.     even
  114. save_stack:    ds.l    1        ;save stack
  115. save_mfp:    ds.l    1        ;save mfp (timer_b)
  116. save_timer_b:    ds.l    1        ;save timer_b
  117.