A SID Sound player



By FroST



Hello everybody ! Today, children, we are going to study to use the SID Sound Designer player in your programs. If by misfortune you don't have sources and programs going with the article, please unravel you to find them and use the old versions of the player that were distributed with Sid Sound Designer especially, they are bugged (they turn without problems on ST, but that begins to mess up while going up in the range). The routine that I propose you is the one that should be on the site of DHS, it has was fixed a first time by Defjam in order to make turn it on (nearly) all possible machines (ST /.. /TT/Falcon/FalcCT2) and I brought a last modification there finally so that the internal IDE of certain Falcon doesn't reset themselves once one has stop the player (in short, one can change what doesn't precede by some hard IDE maybe reset themselves on a Falcon, I have a few of them to discuss with Evl, one doesn't know too much where that comes : that makes it on my Falcon, not on his). Good, stop craptalking, here we go...



I - The different functions of the player.


I first go to describe you the different functions that offer the player. The accustomed of Mad-max crispses are not going to be disorientated because it is the same system that is used.


First of all, one recovers the init (offset 0). It is necessary to call him inevitably before making replay the least chip. She/it takes care to initialize some variables interns to the player and makes also some safeguards. This function requires 2 arguments : the address of data of the module chip, and the address of instrument data used by the chip; what corresponds to the files SORTING and TVS respectively. One places the address of the data SORTING in a1 and the address of data TVS in a0. One calls him therefore like this :

     lea     tvs,a0
     lea     tri,a1
     jsr     player
Then, it is necessary to stop the player. It takes place with the help of the function which is to the offset 8 of the player, therefore we call him like this :
     jsr     player+8
This function doesn't require any arguments.


To replay the soundchip, one call to a regular time interval the function being to the offset 4, therefore like this :

     jsr     player+4
To call him to a regular time interval, there are 2 solutions on the whole : the VBL-queue (or VBL simply) or to place the routine in B timer (the printout of example uses the B timer). Attention, because the player uses all the other available timerses, only the B remains active (and cannot serve to make the low overscan because of some problems of synchro).


Well, if you are hurried, you can spend directly to the printout of example, the described functions should be enough for you. But, he/it exists even some functions serving to control a few more again the player.


First of all, a very interesting function that permits to synchronize the player on (nearly) doesn't import what frequency (50 Hz, 60 Hz, 71 Hz for example if it told you something). It is very useful if you use the player in VBL interruption, you can use the frequency of cooling that you want therefore, besides this system permits the change of frequency to the flight, that is to say when the player is already replaying a chip. But I advise you against using the player in VBL-tail (or VBL simply, hello the synchro), but rather in B timer as in the printout of example, it will have at least the merit to turn on all machines (except the Milan that doesn't possess a YM :(. Whatever he/it is some, I indicate how you can call this function :

        moveq   #50,d0      * 50 Hz, on met 60 pour 60 Hz, ...
        jsr     player+28   * Set_Screen_Freq
One can also cut the whistle to the player when one wants while using function set_music_off, as this :
        jsr     player+16   * Set_music_off
One can of course to make replay like that him the zik :
        jsr     player+12   * Set_music_on
Last thing again, the player uses timers A, C and D what only lets the B of free (and again, if one doesn't use him to call the routine of replay), therefore for screens making the overscan (low and more), it is worth to avoid to use this player better.



II - The assembly listing


I thank Evl / DHS of me to have permitted to use his/her/its source in my article. I have bring any modifications there.


; anders eriksson (evil) / dhs
; december 5, 1998
; ae@atari.org / dhs.atari.org

; easy to use sidsound designer replay shell.

; tested on st, ste, mste, pak030, tt030,
; falcon030, centurbo2,

; sidsound desinger original routines by
; synergy and animal mine. patched and updated
; by defjam/checkpoint.

; Patch Falcon by FroST (cf. explanations)

; Timers A, C and D are used for the emulation of the SID.
; On the whole, you can use this emulation on the three
; voices.

; The B timer is used to call the player 50 times by
; second, therefore to a frequency of 50 Hz.


    section    text

begin:

    clr.l      -(sp)                  ; into super
    move.w     #32,-(sp)
    trap       #1
    addq.l     #6,sp
    move.l     d0,save_stack          ;save old stack

    lea.l      voice,a0               ;address to sounddata (TRI)
    lea.l      song,a1                ;address to songdata (TVS)
    jsr        player+0               ;init player

    move.w      sr,d0                 ;save sr
    move.w      #$2700,sr             ;all ints off

    lea.l       save_mfp,a0           ;save needed mfp regs
    move.b      $fffffa07,(a0)+
    move.b      $fffffa13,(a0)+
    move.b      $fffffa1b,(a0)+
    move.b      $fffffa21,(a0)+
    bset        #0,$fffffa07          ;timer-b inits
    bset        #0,$fffffa13
    move.b      #246,$fffffa21      ;2457600/200/246 approx 50 Hz
    or.b        #%111,$fffffa1b       ;%111 = divide by 200
    bclr        #3,$fffffa1b          ;tos 2.05 fix

    move.l      $120,save_timer_b     ;save old timer_b
    move.l      #timer_b,$120         ;install new timer_b

    move.w      d0,sr                 ;restore sr

.loop:
    cmpi.b      #$39,$fffffc02.w      ;wait for space
    bne.s       .loop

exit:
    move.w      sr,d0                 ;save sr
    move.w      #$2700,sr             ;all ints off

    lea.l       save_mfp,a0           ;restore mfp regs
    move.b      (a0)+,$fffffa07
    move.b      (a0)+,$fffffa13
    move.b      (a0)+,$fffffa1b
    move.b      (a0)+,$fffffa21

    move.l      save_timer_b,$120.w   ;restore timer_b

    move.w      d0,sr                 ;restore sr

    jsr         player+8              ;stop player

    move.l      save_stack,-(sp)      ;exit super
    move.w      #32,-(sp)
    trap        #1
    addq.l      #6,sp

    clr.w       -(sp)                 ;pterm()
    trap        #1

timer_b:
    jsr         player+4              ;call player
    bclr        #0,$fffffa0f          ;clear timer_b busyflag
    rte

    section     data

    even
player: incbin  'amsid.dat'           ;replay routines
    even
song:   incbin  'song.tri'            ;songdata
    even
voice:  incbin  'song.tvs'            ;sounddata
    even

    section     bss

    even
save_stack:     ds.l    1             ;save stack
save_mfp:       ds.l    1             ;save mfp (timer_b)
save_timer_b:   ds.l    1             ;save timer_b



III - Note to amateurs of GFA


I am distressed not to have spoken of the manner to use the player with this fabulous language, I had promised The Beast to make it, but I don't simply have the time. But to intend on me to come back over as soon as possible. At most, you can still to send me an email to recall it to me like that I would send you directly the player for the GFA and the printout of example who goes with.



IV - This is the end, beautiful friend, the end.


Normally you will find on the disk the listing of Evl, as well as the player modified by my cares.


OK, you should be able to unravel you with this player, of as much more that the sound is excellent quality and musicians using Sid Sound Designer make marvels, to give you account of it, in general be going to listen to chips of 505 and Dma SC in the last Undercover mag (14).


Bye friends.


Contact : th.reiss@wanadoo.fr (nooo ! no tomatoes !).
You can let me a message on RTEL in FroSTmailbox too.


I am not able to impeach myself to add that :
Greetings goes to : ST Survivor, Thyrex, Exyl, Moondog, MC Laser, 505, Evl, Razaac, The Beast, EdO, ST Ghost, Hello, DMA SC, QueST, CKJ, Creature XL and all those that I forget...




Edito Rubriques habituelles Planè Atari Internet Techniques et programmation Interviews Jeux Vidéo Humour Musique Chroniques, etc. Divers