home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 109 / EnigmaAmiga109CD.iso / software / testi / corsoasm / sorgenti8 / lezione14-10e.s < prev    next >
Text File  |  1995-09-29  |  6KB  |  196 lines

  1.  
  2. ;  Lezione14-10e.s - Uso della routine player6.1a per un modulo non compresso
  3.  
  4. ; Routine P61_Music chiamata da interrupt VERTB ($6c) livello3
  5.  
  6. ; Inoltre e' abilitato il controllo del master volume: opzione fade=1
  7.  
  8.     SECTION    Usoplay61a,CODE
  9.  
  10. ;    Include    "DaWorkBench.s"    ; togliere il ; prima di salvare con "WO"
  11.  
  12. *****************************************************************************
  13.     include    "startup2.s" ; Salva Copperlist Etc.
  14. *****************************************************************************
  15.  
  16.         ;5432109876543210
  17. DMASET    EQU    %1000001111000000    ; solo copper DMA
  18.  
  19. WaitDisk    EQU    30    ; 50-150 al salvataggio (secondo i casi)
  20.  
  21. START:
  22.  
  23. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  24. ;­ Call P61_Init to initialize the playroutine    ­
  25. ;­ D0 --> Timer detection (for CIA-version)    ­
  26. ;­ A0 --> Address to the module            ­
  27. ;­ A1 --> Address to samples/0            ­
  28. ;­ A2 --> Address to sample buffer        ­
  29. ;­ D0 <-- 0 if succeeded            ­
  30. ;­ A6 <-- $DFF000                ­
  31. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  32.  
  33.     movem.l    d0-d7/a0-a6,-(SP)
  34.     lea    P61_data,a0    ; Indirizzo del modulo in a0
  35.     lea    $dff000,a6    ; Ricordiamoci il $dff000 in a6!
  36.     sub.l    a1,a1        ; I samples non sono a parte, mettiamo zero
  37.     sub.l    a2,a2        ; no samples -> modulo non compattato
  38.     bsr.w    P61_Init
  39.     movem.l    (SP)+,d0-d7/a0-a6
  40.  
  41.     lea    $dff000,a5
  42.     MOVE.W    #DMASET,$96(a5)        ; DMACON - abilita bitplane, copper
  43.                     ; e sprites.
  44.  
  45.     move.l    BaseVBR(PC),a0
  46.     move.l    #Myint6c,$6c(a0)    ; metto la mia routine interrupt
  47.  
  48.     move.w    #$e020,$9a(a5)        ; INTENA - Abilito Master and lev6
  49.                     ; e VERTB (lev3).
  50.  
  51.     move.l    #COPPERLIST,$80(a5)    ; Puntiamo la nostra COP
  52.     move.w    d0,$88(a5)        ; Facciamo partire la COP
  53.     move.w    #0,$1fc(a5)        ; Disattiva l'AGA
  54.     move.w    #$c00,$106(a5)        ; Disattiva l'AGA
  55.     move.w    #$11,$10c(a5)        ; Disattiva l'AGA
  56.  
  57.     clr.w    P61_Master    ; volume=0
  58.  
  59. mouse:
  60.     bsr.s    SpettaBlank
  61.     bsr.s    AlzaVolume
  62.     btst    #6,$bfe001    ; mouse premuto?
  63.     bne.s    mouse
  64.  
  65. mouse2:
  66.     bsr.s    SpettaBlank
  67.     bsr.s    AbbassaVolume
  68.     btst    #2,$dff016    ; mouse premuto?
  69.     bne.s    mouse2
  70.  
  71. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  72. ;­ Call P61_End to stop the music        ­
  73. ;­   A6 --> Customchip baseaddress ($DFF000)    ­
  74. ;­        Uses D0/D1/A0/A1/A3        ­
  75. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  76.  
  77.     lea    $dff000,a6    ; Ricordiamoci il $dff000 in a6!
  78.     bsr.w    P61_End
  79.  
  80.     rts
  81.  
  82. *****************************************************************************
  83. ; Routine che aspetta il Vblank
  84. *****************************************************************************
  85.  
  86.  
  87. SpettaBlank:
  88.     MOVE.L    #$1ff00,d1    ; bit per la selezione tramite AND
  89.     MOVE.L    #$10000,d2    ; linea da aspettare = $100
  90. Waity1:
  91.     MOVE.L    4(A5),D0    ; VPOSR e VHPOSR - $dff004/$dff006
  92.     ANDI.L    D1,D0        ; Seleziona solo i bit della pos. verticale
  93.     CMPI.L    D2,D0        ; aspetta la linea $100
  94.     BNE.S    Waity1
  95. Aspetta:
  96.     MOVE.L    4(A5),D0    ; VPOSR e VHPOSR - $dff004/$dff006
  97.     ANDI.L    D1,D0        ; Seleziona solo i bit della pos. verticale
  98.     CMPI.L    D2,D0        ; aspetta la linea $12c
  99.     BEQ.S    Aspetta
  100.     rts
  101.  
  102. *****************************************************************************
  103. ; Semplici routines che controllano la label P61_Master                *
  104. *****************************************************************************
  105.  
  106. AbbassaVolume:
  107.     tst.w    P61_Master    ; Minimo volume raggiunto?
  108.     beq.s    NonAbbassare
  109.     subq.w    #1,P61_Master
  110. NonAbbassare:
  111.     rts
  112.  
  113. AlzaVolume:
  114.     cmp.w    #64,P61_Master    ; Massimo volume raggiunto?
  115.     beq.s    NonAlzare
  116.     addq.w    #1,P61_Master
  117. NonAlzare:
  118.     rts
  119.  
  120. *****************************************************************************
  121. *        Routine in interrupt livello 3 ($6c)                *
  122. *****************************************************************************
  123.  
  124. MyInt6c:
  125.     btst    #5,$dff01f    ; INTREQR - int VERTB?
  126.     beq.s    noint        ; se no, esci!
  127.  
  128.     movem.l    d0-d7/a0-a6,-(SP)
  129.     lea    $dff000,a6    ; Ricordiamoci il $dff000 in a6!
  130.     bsr.w    P61_Music
  131.     movem.l    (SP)+,d0-d7/a0-a6
  132.  
  133. noint:    
  134.     move.w    #$70,$dff09c    ; INTENAR
  135.     rte
  136.  
  137. *****************************************************************************
  138. *         The Player 6.1A for Asm-One 1.09 and later             *
  139. *****************************************************************************
  140.  
  141. fade  = 1    ;0 = Normal, NO master volume control possible
  142.         ;1 = Use master volume (P61_Master)
  143.  
  144. jump = 0    ;0 = do NOT include position jump code (P61_SetPosition)
  145.         ;1 = Include
  146.  
  147. system = 0    ;0 = killer
  148.         ;1 = friendly
  149.  
  150. CIA = 0        ;0 = CIA disabled
  151.         ;1 = CIA enabled
  152.  
  153. exec = 1    ;0 = ExecBase destroyed
  154.         ;1 = ExecBase valid
  155.  
  156. opt020 = 0    ;0 = MC680x0 code
  157.         ;1 = MC68020+ or better
  158.  
  159. use = $2009559    ; Usecode (mettete il valore dato dal p61con al salvataggio
  160.         ; diverso per ogni modulo!)
  161.  
  162. *****************************************************************************
  163.     include    "play.s"    ; La routine vera e propria!
  164. *****************************************************************************
  165.  
  166.  
  167. *****************************************************************************
  168. ;    Copperlist
  169. *****************************************************************************
  170.  
  171.     SECTION    COP,DATA_C
  172.  
  173. COPPERLIST:
  174.     dc.w    $100,$200    ; bplcon0 - no bitplanes
  175.     DC.W    $180,$003    ; color0 nero
  176.     dc.W    $FFFF,$FFFE    ; fine della copperlist
  177.  
  178. *****************************************************************************
  179. ;    Modulo musicale convertito in formato P61, non compresso
  180. *****************************************************************************
  181.  
  182.     Section    modulozzo,data_C
  183.  
  184. ; Il modulo e' di DreamFish. Originale 42684, convertito 31628 (non packed!)
  185.  
  186. P61_data:
  187.     incbin    "P61.technochild"    ; non compresso, solo convertito.
  188.  
  189.     end
  190.  
  191. L'utilita' del "fade" audio e' evidente... alla fine di un livello del vostro
  192. gioco, o all'uscita della demo, eccetera.
  193. Basta attivare l'equate "fade", e agire sulla label "P61_Master".
  194. Giusto per variare, qua la routine viene eseguita in interrupt VERTB ($6c).
  195.  
  196.