home *** CD-ROM | disk | FTP | other *** search
/ No Fragments Archive 4: The Falcon Archive / nf_archive_four_v1.0.iso / ARCHIVE / WORK / MSX / MEGPL116.ZIP / MGPL-116 / AMIGA / USEDSPIT.S < prev    next >
Text File  |  1995-08-25  |  6KB  |  230 lines

  1. ***********************************************************************
  2. ***********                                        ***********
  3. ***********                                        ***********
  4. ***********            DSP Julia Fractal Set            ***********
  5. ***********        under DSP interrupt SoundTrack        ***********
  6. ***********                                        ***********
  7. ***********                                        ***********
  8. ***********          By Simplet / FATAL DESIGN            ***********
  9. ***********                                        ***********
  10. ***********************************************************************
  11.  
  12. Dep_X    equ        -4194304            ; -2/4 * 2^23
  13. Dep_Y    equ        -2621440            ; -1.25/4 * 2^23
  14. Incr        equ        26214            ; 2.5/200/4 * 2^23
  15. C_Re        equ        -1310720            ; -0.625/4 * 2^23
  16. C_Im        equ        -1310720            ; -0.625/4 * 2^23
  17.  
  18.             OutPut    USEDSPIT.TOS
  19.             OPT        O+,OW-
  20.  
  21. ***********************************************************************
  22. ***********                Inits TOS                    ***********
  23. ***********************************************************************
  24.  
  25.         Section    TEXT
  26.  
  27. Start_Up    movea.l    4(sp),a5                ; BasePage Adress - Prg
  28.         lea.l    Stack,sp                ; Nouvelle Pile
  29.         movea.l    12(a5),a0                ; Text
  30.         adda.l    20(a5),a0                ; + Data
  31.         adda.l    28(a5),a0                ; + BSS
  32.         adda.w    #256,a0                ; + BasePage
  33.         pea.l    (a0)                    ; Length
  34.         pea.l    (a5)                    ; Adress
  35.         pea.l    $4a0000                ; 0 + Mshrink
  36.         trap        #1                    ; Gemdos
  37.         lea.l    12(sp),sp
  38.  
  39. ***********************************************************************
  40. ***********                It begins here                ***********
  41. ***********************************************************************
  42.  
  43.         lea.l    Module(pc),a0
  44.         lea.l    WorkSpace,a1
  45.         bsr        MGTK_Init_Module_Samples    ; Initialise tout le bordel
  46.  
  47.         lea.l    Error_Memory(pc),a0
  48.         tst.w    d0
  49.         bmi        Error
  50.  
  51.         lea.l    Error_DSP(pc),a0
  52.         bsr        MGTK_Init_DSP
  53.         tst.w    d0
  54.         bmi        Error
  55.  
  56.         bsr        MGTK_Save_Sound
  57.         bsr        MGTK_Init_Sound
  58.  
  59.         moveq.l    #2,d0                ; 32.78 KHz
  60.         bsr        MGTK_Set_Replay_Frequency
  61.         
  62.         st        MGTK_Restart_Loop        ; Loop On
  63.         bsr        MGTK_Play_Music
  64.  
  65.         lea.l    Msg_Rout(pc),a0
  66.         bsr        Print
  67.  
  68.         move.w    #7,-(sp)                ; Crawin
  69.         trap        #1                    ; Gemdos
  70.         addq.l    #2,sp
  71.  
  72.  
  73.         clr.l    -(sp)                ; Swap into Supervisor Mode
  74.         move.w    #$20,-(sp)            ; SUPER
  75.         trap        #1                    ; Gemdos
  76.         addq.l     #6,sp
  77.  
  78.         bsr        Save_Video
  79.         bsr        Init_Falcon_Palette
  80.  
  81.         lea.l    Videl_320_200_True,a0
  82.         lea.l    Adr_Screen1,a1
  83.         lea.l    Screens,a2
  84.         moveq.l    #2-1,d0
  85.         bsr        Init_Video
  86.  
  87.         lea.l    DSP_Code(pc),a0
  88.         moveq.l    #DSP_Size,d0
  89.         bsr        MGTK_P56_Loader
  90.  
  91. ***********************************************************************
  92. ***********    Calcule et Affiche l'Ensemble de Julia        ***********
  93. ***********************************************************************
  94.  
  95. Julia_Loop
  96.         move.l    Adr_Screen1,d0                ; Flipping
  97.         move.l    Adr_Screen2,Adr_Screen1        ; Ecrans
  98.         move.l    d0,Adr_Screen2                ; Physique
  99.         lsr.w    #8,d0                    ; /
  100.         move.l    d0,$ffff8200.w                ; Logique
  101.  
  102.         lea.l    $ffffa204.w,a6
  103.         lea.l    $ffffa206.w,a5
  104.         lea.l    $ffffa202.w,a4
  105.  
  106.         sub.l    #3000,Cst_Re
  107.         add.l    #10500,Cst_Im
  108.  
  109. Wait_Loop    btst.b    #1,(a4)
  110.         beq.s    Wait_Loop
  111.  
  112.         move.l    #Dep_X,(a6)
  113.         move.l    #Dep_Y,(a6)
  114.         move.l    #Incr,(a6)
  115.         move.l    Cst_Re(pc),(a6)
  116.         move.l    Cst_Im(pc),(a6)
  117.  
  118.         movea.l    Adr_Screen1,a0
  119.         move.w    #100-1,d7
  120. Line_Loop    move.w    #320-1,d6
  121. Pixel_Loop
  122.         btst.b    #0,(a4)
  123.         beq.s    Pixel_Loop
  124.         move.w    (a5),(a0)+
  125.         dbra        d6,Pixel_Loop
  126.         dbra        d7,Line_Loop
  127.  
  128.         movea.l    a0,a1
  129.         move.w    #320*100/16-1,d7
  130. Copy_Loop
  131.         Rept        16
  132.             move.w    -(a0),(a1)+
  133.         EndR
  134.         dbra        d7,Copy_Loop
  135.  
  136.         move.w    #11,-(sp)                ; Cconis
  137.         trap        #1                    ; Gemdos
  138.         addq.l    #2,sp
  139.         tst.b    d0
  140.         beq        Julia_Loop
  141.  
  142.         move.w    #7,-(sp)                ; Crawin
  143.         trap        #1                    ; Gemdos
  144.         addq.l    #2,sp
  145.  
  146. ***********************************************************************
  147. ***********        It's Finished, Restore All            ***********
  148. ***********************************************************************
  149.  
  150.         bsr        Restore_Video
  151.  
  152.         bsr        MGTK_Stop_Music
  153.         bsr        MGTK_Restore_Sound
  154.  
  155. Exit        clr.w     -(sp)                    ; PTerm
  156.         trap     #1                        ; Gemdos
  157.  
  158. Error    bsr.s    Print
  159.  
  160.         move.w    #7,-(sp)
  161.         trap        #1
  162.         addq.l    #2,sp
  163.  
  164.         clr.w     -(sp)                    ; PTerm
  165.         trap     #1                        ; Gemdos
  166.  
  167. ***********************************************************************
  168. ***********                Sub-Routines                ***********
  169. ***********************************************************************
  170.  
  171. Print    pea.l    (a0)
  172.         move.w    #9,-(sp)            ; Cconws
  173.         trap        #1                ; GemDos
  174.         addq.l    #6,sp
  175.         rts
  176.  
  177.         Section    BSS
  178.  
  179.         ds.l        20832/4                ; WorkSpace, Maxi 20832 octets
  180. WorkSpace    ds.l        1                    ; first of the BSS section
  181.  
  182.         Include    'AMGDSPIT.S'
  183.         Include    'VIDEO.S'
  184.  
  185. ***********************************************************************
  186. ***********                The Module                ***********
  187. ***********************************************************************
  188.  
  189.         Section    DATA
  190.  
  191. Cst_Re    dc.l        C_Re
  192. Cst_Im    dc.l        C_Im
  193.  
  194. Msg_Rout    dc.b        27,'E'
  195.         dc.b        "This is just a little example",13,10
  196.         dc.b        "of DSP Program with a soundtrack",13,10
  197.         dc.b        "replayed under DSP interrupt..",13,10,10
  198.         dc.b        "Simplet / FATAL Design 1995",13,10,10
  199.         dc.b        "Press any key...",13,10,0
  200.  
  201. Error_DSP    dc.b        7,27,'E'
  202.         dc.b        "Error, the DSP program couldn't be loaded.",13,10
  203.         dc.b        "Press any key...",0
  204. Error_Memory
  205.         dc.b        7,27,'E'
  206.         dc.b        "Error, the workspace isn't big enough.",13,10
  207.         dc.b        "Press any key...",0
  208.  
  209. DSP_Code    IncBin    'JULMORPH.P56'
  210. DSP_Size    equ        (*-DSP_Code)/3
  211.  
  212.         Even
  213.         IncDir    'E:\SNDTRACK\DEPACK\'
  214. Module    IncBin    'ELEKFUNK.MOD'        ; last of the DATA section
  215.  
  216. ***********************************************************************
  217. ***********                BSS Section                ***********
  218. ***********************************************************************
  219.  
  220.         Section    BSS
  221.  
  222. ; Adresses Ecrans
  223. Adr_Screen1    ds.l        1
  224. Adr_Screen2    ds.l        1
  225. ; Place pour Ecrans
  226. Screens        ds.b        2*((320*200*2)+256)
  227. ; La Pile
  228. End_Stack    ds.l        64
  229. Stack    ds.l        1
  230.