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

  1.  
  2. ;  Lezione14-10d.s - Uso della routine player6.1a per un modulo compresso
  3.  
  4. ; VERSIONE CIA! La routine P61_Music non va mai chiamata!
  5.  
  6.     SECTION    Usoplay61a,CODE
  7.  
  8. ;    Include    "DaWorkBench.s"    ; togliere il ; prima di salvare con "WO"
  9.  
  10. *****************************************************************************
  11.     include    "startup2.s" ; Salva Copperlist Etc.
  12. *****************************************************************************
  13.  
  14.         ;5432109876543210
  15. DMASET    EQU    %1000001111000000    ; solo copper DMA
  16.  
  17. WaitDisk    EQU    30    ; 50-150 al salvataggio (secondo i casi)
  18.  
  19. START:
  20.  
  21. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  22. ;­ Call P61_Init to initialize the playroutine    ­
  23. ;­ D0 --> Timer detection (for CIA-version)    ­
  24. ;­ A0 --> Address to the module            ­
  25. ;­ A1 --> Address to samples/0            ­
  26. ;­ A2 --> Address to sample buffer        ­
  27. ;­ D0 <-- 0 if succeeded            ­
  28. ;­ A6 <-- $DFF000                ­
  29. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  30.  
  31.     movem.l    d0-d7/a0-a6,-(SP)
  32.     moveq    #0,d0        ; Timer Detection: Autodetect
  33. ;    moveq    #1,d0        ; Timer Detection: PAL
  34. ;    moveq    #2,d0        ; Timer Detection: NTSC
  35.     lea    P61_data,a0    ; Indirizzo del modulo in a0
  36.     lea    $dff000,a6    ; Ricordiamoci il $dff000 in a6!
  37.     sub.l    a1,a1        ; I samples non sono a parte, mettiamo zero
  38.     lea    samples,a2    ; modulo compattato! Buffer destinazione per
  39.                 ; i samples (in chip ram) da indicare!
  40.     bsr.w    P61_Init    ; Nota: impiega alcuni secondi per decompress!
  41.     movem.l    (SP)+,d0-d7/a0-a6
  42.  
  43.     lea    $dff000,a5
  44.     MOVE.W    #DMASET,$96(a5)        ; DMACON - abilita bitplane, copper
  45.                     ; e sprites.
  46.  
  47.     move.w    #$e000,$9a(a5)        ; INTENA - Abilito Master and lev6
  48.     move.l    #COPPERLIST,$80(a5)    ; Puntiamo la nostra COP
  49.     move.w    d0,$88(a5)        ; Facciamo partire la COP
  50.     move.w    #0,$1fc(a5)        ; Disattiva l'AGA
  51.     move.w    #$c00,$106(a5)        ; Disattiva l'AGA
  52.     move.w    #$11,$10c(a5)        ; Disattiva l'AGA
  53.  
  54. mouse:
  55.     MOVE.L    #$1ff00,d1    ; bit per la selezione tramite AND
  56.     MOVE.L    #$08000,d2    ; linea da aspettare = $80
  57. Waity1:
  58.     MOVE.L    4(A5),D0    ; VPOSR e VHPOSR - $dff004/$dff006
  59.     ANDI.L    D1,D0        ; Seleziona solo i bit della pos. verticale
  60.     CMPI.L    D2,D0        ; aspetta la linea $12c
  61.     BNE.S    Waity1
  62. Aspetta:
  63.     MOVE.L    4(A5),D0    ; VPOSR e VHPOSR - $dff004/$dff006
  64.     ANDI.L    D1,D0        ; Seleziona solo i bit della pos. verticale
  65.     CMPI.L    D2,D0        ; aspetta la linea $12c
  66.     BEQ.S    Aspetta
  67.  
  68. ; versione CIA, non occorre chiamare P61_music...
  69.  
  70.     btst    #6,$bfe001    ; mouse premuto?
  71.     bne.s    mouse
  72.  
  73.  
  74.     lea    $dff000,a6    ; Ricordiamoci il $dff000 in a6!
  75.     bsr.w    P61_End
  76.  
  77.     rts
  78.  
  79.  
  80. *****************************************************************************
  81. *         The Player 6.1A for Asm-One 1.09 and later             *
  82. *****************************************************************************
  83.  
  84. fade  = 0    ;0 = Normal, NO master volume control possible
  85.         ;1 = Use master volume (P61_Master)
  86.  
  87. jump = 0    ;0 = do NOT include position jump code (P61_SetPosition)
  88.         ;1 = Include
  89.  
  90. system = 0    ;0 = killer
  91.         ;1 = friendly
  92.  
  93. CIA = 1        ;0 = CIA disabled
  94.         ;1 = CIA enabled
  95.  
  96. exec = 1    ;0 = ExecBase destroyed
  97.         ;1 = ExecBase valid
  98.  
  99. opt020 = 0    ;0 = MC680x0 code
  100.         ;1 = MC68020+ or better
  101.  
  102. use = $b55a    ; Usecode (mettete il valore dato dal p61con al salvataggio
  103.         ; diverso per ogni modulo!)
  104.  
  105. *****************************************************************************
  106.     include    "play.s"    ; La routine vera e propria!
  107. *****************************************************************************
  108.  
  109.  
  110. *****************************************************************************
  111. ;    Copperlist
  112. *****************************************************************************
  113.  
  114.     SECTION    COP,DATA_C
  115.  
  116. COPPERLIST:
  117.     dc.w    $100,$200    ; bplcon0 - no bitplanes
  118.     DC.W    $180,$003    ; color0 nero
  119.     dc.W    $FFFF,$FFFE    ; fine della copperlist
  120.  
  121. *****************************************************************************
  122. ;    Modulo musicale convertito in formato P61, COMPRESSO! (opzione pack!)
  123. *****************************************************************************
  124.  
  125.     Section    modulozzo,data    ; Non occorre sia in chip ram, perche' e'
  126.                 ; compresso e sara' scompattato altrove!
  127.  
  128. ; Il modulo e' di Jester/Sanity. Originale 153676, packed 71950
  129.  
  130. P61_data:
  131.     incbin    "P61.stardust"    ; Compresso, (opzione PACK SAMPLES), per cui
  132.                 ; si puo' mettere anche in fast ram: sara'
  133.                 ; usato per scompattare i samples nel buffer
  134.                 ; samples, e non sara' "suonato" direttamente,
  135.                 ; quindi non dovra' passare per i canali DMA
  136.                 ; audio, ma solo dalla routine di depack del
  137.                 ; processore. Quindi, basta un DATA (non _C!)
  138.  
  139.  
  140. *****************************************************************************
  141. ;    Dove saranno scompattati i samples (section bss in chip ram!)
  142. *****************************************************************************
  143.  
  144.     section    smp,bss_c
  145.  
  146. samples:
  147.     ds.b    132112    ; lunghezza riportata dal p61con
  148.  
  149.     end
  150.  
  151. Uso della routine CIA version con un modulo compattato... giusto per amore
  152. degli esempi.
  153.  
  154.