home *** CD-ROM | disk | FTP | other *** search
/ No Fragments Archive 4: The Falcon Archive / nf_archive_four_v1.0.iso / ARCHIVE / WORK / MSX / GTK08777.ZIP / GTK.DEV / PLAYDSP.ASM < prev    next >
Assembly Source File  |  1996-12-12  |  25KB  |  1,018 lines

  1. ;*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*
  2. ;*≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈*
  3. ;*                            *
  4. ;*                DSP-replay routine            *
  5. ;*        for Graoumf Tracker modules (.GT2)        *
  6. ;*             Falcon 030            *
  7. ;*                  Code DSP 56001            *
  8. ;*                            *
  9. ;*≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈*
  10. ;* Version        : 4/11/1996, v0.87                *
  11. ;* Tab setting    : 11                    *
  12. ;* Fichier généré : PLAYDSP (à convertir en .LOD puis en .P56)        *
  13. ;*≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈(C)oderight L. de Soras 1994-96*
  14. ;*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*
  15.  
  16. ; Ne jamais mettre de e accent grave sous peine d'erreur de compilation
  17.  
  18.  
  19.  
  20. ;*~~~ Constantes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*
  21.  
  22. PLAYDSP:    Ident    $0,$8700    ; Graoumf Tracker - by Laurent de SORAS (Dumbo/BiG NoZ) 94-96
  23.  
  24.     Opt    il        ; Supprime l'affichage du listing
  25.  
  26. PBC    Equ    $ffe0
  27. PCC    Equ    $ffe1
  28. ; Host
  29. HSR    Equ    $ffe9
  30. HRX    Equ    $ffeb
  31. HTX    Equ    $ffeb
  32. ; SSI
  33. CRA    Equ    $ffec
  34. CRB    Equ    $ffed
  35. SSISR    Equ    $ffee
  36. RX    Equ    $ffef
  37. TX    Equ    $ffef
  38. ; Interruptions
  39. BCR    Equ    $fffe
  40. IPR    Equ    $ffff
  41.  
  42. YMEM_ORG:    Equ    $400
  43.  
  44.  
  45.  
  46. ;*~~~ Macros ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*
  47.  
  48. readhost:    Macro    param
  49.     jclr    #0,x:<<HSR,*
  50.     movep    x:<<HRX,param
  51.     EndM
  52.  
  53. writhost:    Macro    param
  54.     jclr    #1,x:<<HSR,*
  55.     movep    param,x:<<HTX
  56.     EndM
  57.  
  58.  
  59.  
  60. ;*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*
  61.  
  62.     Org    x:0
  63.  
  64. numsam:        Dc    0    ; Numéro du sample
  65. frequence:        Ds    2    ; Fréquence du sample à mixer
  66. finepos:        Ds    1    ; 1/65536 de position
  67. balance:        Ds    1    ; Balance
  68. volume_g:        Ds    1    ; Volume (général ou gauche)
  69. volume_d:        Ds    1    ; Volume droit
  70. flag_interpol:    Dc    0    ; 0 = pas d'interpolation au mixage
  71. adrbuf:        Ds    1    ; Adresse du buffer courant
  72. taille_b1:        Dc    983    ; Taille du buffer en cours de mixage
  73. taille_b2:        Dc    983    ; Taille du buffer en cours de replay
  74. cst_left:        Dc    0    ; Valeur à additionner à gauche à la fin du mixage
  75. cst_right:        Dc    0    ; Valeur à droite
  76. realtime_flag:    Dc    1    ; 1 = temps réel, 0 sinon
  77. cpu_pourcent:    Dc    0    ; Pourcentage (0-100 ou +) de temps machine utilisé.
  78.                 ; 255 = surcharge des voies (dégradation du son)
  79. cpu_overflow:    Dc    0    ; 1 = Surcharge du CPU
  80. save_reg:        Ds    6    ; Sauvegarde des registres
  81.  
  82. tmp_buffer:    ; On entrepose ici diverses données temporaires
  83. adr_parity:
  84. adr_buffer:
  85.         Ds    1
  86. amplification:
  87.         Ds    1
  88.  
  89. sambuf:        Ds    8000    ; Buffer de réception des samples
  90.  
  91.  
  92.  
  93. ;*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*
  94.  
  95.     Org    y:YMEM_ORG    ; On commence ici car il faut de la place si la longueur
  96.             ; du programme est > $200 (pour xxxx>$200, p:xxxx = y:xxxx)
  97.  
  98. mixbuf1:    Ds    1200*2    ; Buffers stereo de mixage
  99. mixbuf2:    Ds    1200*2
  100. mixbuf3:    Ds    1
  101.  
  102.  
  103.  
  104. ;*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*
  105.  
  106.     Org    p:$0
  107.     jmp    debut
  108.  
  109.     Org    p:$10
  110.     movep    y:(r4)+,x:<<TX    ; Emission SSI
  111.     nop
  112.  
  113.     Org    p:$12
  114.     movep    y:(r4)+,x:<<TX    ; Emission SSI avec erreur d'underrun
  115.     nop
  116.  
  117.     Org    p:$40        ; Début du programme
  118.  
  119.  
  120.  
  121. ;*≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈*
  122. ;*    Initialisation                    *
  123. ;*≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈*
  124. debut:
  125.     move    #>$ffff,m0
  126.     move    m0,m1
  127.     move    m0,m4
  128.     move    m0,m5
  129.     clr    a    #>mixbuf1,r4
  130.     rep    #mixbuf2-mixbuf1
  131.     move    a,y:(r4)+
  132.     rep    #mixbuf3-mixbuf2
  133.     move    a,y:(r4)+
  134.     move    #save_reg,r0    ; Sauve les registres d'interruptions et de communication
  135.     movep    x:<<CRA,x0
  136.     move    x0,x:(r0)+
  137.     movep    x:<<PCC,x0
  138.     move    x0,x:(r0)+
  139.     movep    x:<<PBC,x0
  140.     move    x0,x:(r0)+
  141.     movep    x:<<BCR,x0
  142.     move    x0,x:(r0)+
  143.     movep    x:<<IPR,x0
  144.     move    x0,x:(r0)+
  145.     movep    x:<<CRB,x0
  146.     move    x0,x:(r0)+
  147.     movep    #>$4100,x:<<CRA    ; Configuration SSI
  148.     movep    #>$1f8,x:<<PCC
  149.     btst    #4,x:<<SSISR
  150.     movep    #>$1,x:<<PBC
  151.     movep    #>$0,x:<<BCR
  152.     movep    #>$3800,x:<<IPR    ; IPL 3 pour l'interruption SSI
  153.     move    #>mixbuf2,x0
  154.     move    x0,x:adrbuf    ; Buffer courant de mixage
  155.  
  156.     readhost    a1        ; attend le signal de départ...
  157.     move    #>mixbuf1,r4
  158.     movep    #>$5800,x:<<CRB    ; Autorise l'envoi de données sous interruptions
  159.     andi    #<$FC,mr        ; Toutes les interruptions sont autorisées
  160.  
  161.  
  162.  
  163. ;*≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈*
  164. ;*    Routine de soundtracking                *
  165. ;*≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈*
  166.  
  167. ; Attente d'une commande
  168. receive_loop:
  169.     move    x:taille_b1,a
  170.     clr    a    a,x:taille_b2
  171.     move    a,x:numsam        ; Sample 0
  172.     move    a,x:cst_left
  173.     move    a,x:cst_right    ; Réinitialise les constantes de mixage
  174. wait_cmd:
  175.     move    x:cpu_pourcent,x0    ; Signale au 030 qu'on attend une commande
  176.     writhost    x0        ; en renvoyant du même coup le pourcentage de temps machine
  177. wait_cmd2:
  178.     readhost    a0        ; a0 = Numéro de fonction
  179.  
  180.     jset    #0,a0,receive    ; Bit 0: Recevoir un sample
  181.     jset    #1,a0,rec_end    ; Bit 1: Fin des samples
  182.     jset    #2,a0,eff_gadr    ; Bit 2: Fin des samples et efface les deux voies
  183.     jset    #3,a0,coupe_son    ; Bit 3: C'est fini, on s'en va
  184.     jset    #4,a0,receive_cst    ; Bit 4: Recevoir un sample constant
  185.     jset    #5,a0,tick_length    ; Bit 5: Indiquer la longueur d'un tick
  186.  
  187.     jset    #6,a0,no_realtime_rec    ; Bit 6: Simple mixage et export des données
  188.     jset    #7,a0,bck_to_realtime    ; Bit 7: Retour à la normale
  189.  
  190.     jmp    wait_cmd
  191.  
  192.  
  193.  
  194. ;--- Indication de la longueur d'un tick -------------------------------------
  195.  
  196. tick_length:
  197.     readhost    x:taille_b1    ; Nombre d'échantillons ds la VBL
  198.     jmp    wait_cmd2        ; Une autre commande ?
  199.  
  200.  
  201.  
  202. ;*≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈*
  203. ;*    Réception des samples                    *
  204. ;*≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈*
  205. receive:
  206.     readhost    x:volume_g        ; Volume
  207.     readhost    x:amplification    ; Amplification
  208.     readhost    x:balance        ; Balance
  209.     readhost    a0        ; Reçoit la fréquence, mot fort
  210.     jset    #23,a0,resampling030
  211.     move    a0,x:frequence
  212.     readhost    x:frequence+1    ; Fréquence, mot faible
  213.     readhost    x:finepos        ; Position précise
  214.     readhost    x:flag_interpol    ; Interpolation ?
  215.     readhost    a        ; Résolution des samples
  216.     move    #>$2,x0
  217.     cmp    x0,a
  218.     jeq    rec_16bits
  219.  
  220. rec_8bits:                ; Samples 8 bits
  221.     readhost    n7        ; n7 = Nombre de mots (2 samples) -1 à recevoir
  222.     readhost    x:adr_parity    ; Adresse paire ou impaire ?
  223.     move    #>sambuf,r0    ; r0 pointe le buffer de réception
  224.     move    #>sambuf+1,r1
  225.     move    #2,n0
  226.     move    n0,n1
  227.  
  228.     move    #>$8000,x1        ; Pour recalibrer de 8 en 24 bits
  229.                 ; Ici on ne fait pas d'amplification parceque
  230.                 ; 1) Ca ne peut pas être utile sur du 8 bits
  231.                 ; 2) C'est pas du tout pratique à faire
  232.  
  233.     move    x:adr_parity,a
  234.     tst    a
  235.     jeq    r8_paire
  236.     readhost    x0        ; Adresse 030 impaire, on prend une
  237.     mpy    x0,x1,a    (r1)+    ; donnée supplémentaire
  238.     move    a0,x:(r0)+
  239. r8_paire:                ; Là on va vraiment transférer...
  240.     readhost    x0            ; Les 2 premiers samples
  241.     mpy    x0,x1,a            ; a0 contient le sample 2 en 24 bits
  242.     move    a1,x0            ; a1 sample 1 en 8 bits
  243.     mpy    x0,x1,b    a0,x:(r1)+n1    ; b0 sample 1 en 24 bits
  244.     do    n7,r8_transloop        ; Les autres samples
  245.     readhost    x0            ; 2 samples dans x0
  246.     mpy    x0,x1,a    b0,x:(r0)+n0
  247.     move    a1,x0
  248.     mpy    x0,x1,b    a0,x:(r1)+n1
  249. r8_transloop:
  250.     move    b0,x:(r0)+n0    ; Mémorise le dernier sample...
  251.     jmp    mixer
  252.  
  253. rec_16bits:            ; Réception de samples 16 bits
  254.     readhost    n7        ; n7 = Nombre de mots (1 sample) -1 à recevoir
  255.     move    #>sambuf,r0    ; r0 pointe le buffer de réception
  256.  
  257.     move    #>$80,a        ; Réajusteur de 16 en 24 bits
  258.     move    x:amplification,b    ; Doit-on faire une amplification du sample?
  259.     tst    b        ; Si le sample est trop faible, on peut le suramplifier
  260.     jeq    _no_amp
  261.     rep    b        ; *** Ne peut pas être interrompu
  262.     asl    a
  263. _no_amp:    move    a,x1
  264.  
  265.     readhost    x0        ; Le premier sample...
  266.     mpy    x0,x1,a
  267.     do    n7,r16_transloop
  268.     readhost    x0        ; ... Les autres...
  269.     mpy    x0,x1,a    a0,x:(r0)+
  270. r16_transloop:
  271.     move    a0,x:(r0)+        ; ... Et hop, le dernier sample
  272.     jmp    mixer
  273.  
  274. receive_cst:            ; Réception d'un sample constant
  275.     readhost    y0        ; y0 = volume
  276.     readhost    b        ; b = balance
  277.     move    #>cst_left,r1
  278.     move    b,x0
  279.     mpy    x0,y0,a
  280.     move    a,y1        ; y1 = volume droit
  281.     move    #$7fffff,a
  282.     sub    b,a
  283.     move    a,x0
  284.     mpy    x0,y0,a
  285.     move    a1,x1        ; x1 = volume gauche
  286.     readhost    y0        ; Le sample
  287.     mpy    y0,x1,a    x:(r1)+,b    ; Mixe les constantes
  288.     add    b,a    x:(r1)-,b
  289.     mac    y0,y1,b    a,x:(r1)+
  290.     move    b,x:(r1)
  291.     jmp    wait_cmd2        ; C'était tout, et ça comptait même pas pour
  292.                 ; un sample. Donc pas de nouvelle interruption
  293.                 ; puisqu'on ne sort pas de la routine 030.
  294.  
  295.  
  296.  
  297. ;*≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈*
  298. ;*    Mixage                        *
  299. ;*≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈*
  300. mixer:
  301.  
  302. ;--- Regarde d'abord si on est en overflow -----------------------------------
  303.  
  304. ; Vérifie qu'on n'a pas pris trop de temps (débordement du pointeur replay au
  305. ; delà du buffer). Si c'est le cas, on le repositionne au début du buffer
  306. ; qu'il était normalement en train de jouer.
  307.  
  308.     move    x:realtime_flag,a0    ; Si on n'est pas en temps réel,
  309.     jclr    #0,a0,_ok        ; pas besoin de vérifier
  310.  
  311.     move    x:taille_b2,b
  312.     lsl    b    x:adrbuf,a
  313.     move    #>mixbuf1,x0
  314.     cmp    x0,a
  315.     jne    _buf2
  316.     move    #>mixbuf2,a    ; Premier buffer
  317.     jmp    _tst
  318. _buf2:    move    #>mixbuf1,a    ; Deuxieme buffer
  319. _tst:    move    a,x:adr_buffer
  320.     add    b,a    r4,b
  321.     cmp    a,b        ; On a dépassé ?
  322.     jmi    _ok
  323.     move    x:adr_buffer,r4    ; Oui, corrige
  324.     bset    #0,x:cpu_overflow    ; On va le dire à la maîtresse
  325. _ok:
  326.  
  327. ;--- Mixage ------------------------------------------------------------------
  328.  
  329.     move    #>volume_g,r1
  330.     move    x:adrbuf,r5
  331.     move    #>2,n5
  332.     move    x:(r1),y0
  333.     move    x:taille_b1,n7
  334.     move    #>sambuf,a
  335.     move    x:finepos,a0
  336.     move    a1,r0
  337.     move    x:flag_interpol,b
  338.     tst    b
  339.     jne    mix_interpolate
  340.     move    x:numsam,b
  341.     tst    b
  342.     jeq    premier        ; C'est le premier sample?
  343.     move    x:balance,b    ; La balance, svp
  344.     move    #>0,x0
  345.     cmp    x0,b
  346.     jeq    mix_gauche
  347.     move    #>$7ff800,x0
  348.     cmp    x0,b
  349.     jeq    mix_droite
  350.     move    #>$400000,x0
  351.     cmp    x0,b
  352.     jeq    mix_milieu
  353.  
  354. mix_quelconque:
  355.     move    b,x0
  356.     mpy    x0,y0,a    (r1)+
  357.     move    a,x:(r1)-        ; Volume droit
  358.     move    #$7fffff,a
  359.     sub    b,a
  360.     move    a,x0
  361.     mpy    x0,y0,a
  362.     move    a1,x:(r1)        ; Volume gauche
  363.  
  364.     move    #>frequence+1,r3    ; r3 pointe sur la frequence
  365.     move    x:(r1)+,x1
  366.     move    x:(r3)-,x0
  367.     move    #>sambuf,a
  368.     move    x:finepos,a0
  369.     move    a1,r0
  370.  
  371.     do    n7,m_q_loop
  372.     move    x:(r0),y0
  373.     mpy    y0,x1,b    x:(r1)-,x1    y:(r5),y0
  374.     add    y0,b    x:(r0),y0
  375.     move    b1,y:(r5)+
  376.     mpy    y0,x1,b    x:(r3),x1    y:(r5),y0
  377.     add    x,a    x:(r1)+,x1
  378.     add    y0,b    a1,r0
  379.     move    b1,y:(r5)+
  380. m_q_loop:
  381.     jmp    mix_fin
  382.  
  383. mix_milieu:            ; Balance au milieu
  384.     move    y0,b
  385.     asr    b
  386.     move    b,y0    x:frequence,x1
  387.     move    x:frequence+1,x0
  388.     do    n7,m_m_loop
  389.     add    x,a    x:(r0),y1    ; Position suivante
  390.     mpy    y0,y1,b    y:(r5),y1    ; volume
  391.     add    y1,b    x:(r0),y1    ; mixe et reprend le sample
  392.     move    b1,y:(r5)+        ; Sur la voie gauche
  393.     mpy    y0,y1,b    y:(r5),y1    ; On refait le volume, pour la droite cette fois
  394.     add    y1,b    a1,r0    ; et le mixage, sans oublier d'ajourner r0
  395.     move    b1,y:(r5)+        ; Hop sur la voie droite
  396. m_m_loop:
  397.     jmp    mix_fin
  398.  
  399. mix_gauche:            ; Balance à gauche
  400.     move    x:frequence,x1
  401.     move    x:frequence+1,x0
  402.     do    n7,m_g_loop
  403.     add    x,a    x:(r0),y1    ; Position suivante
  404.     mpy    y0,y1,b    y:(r5),y1    ; volume
  405.     add    y1,b    a1,r0    ; mixe
  406.     move    b1,y:(r5)+n5    ; Sur la voie gauche
  407. m_g_loop:
  408.     jmp    mix_fin
  409.  
  410. mix_droite:            ; Balance à droite
  411.     move    x:frequence,x1
  412.     move    x:frequence+1,x0
  413.     lua    (r5)+,r5
  414.     do    n7,m_d_loop
  415.     add    x,a    x:(r0),y1    ; Position suivante
  416.     mpy    y0,y1,b    y:(r5),y1    ; volume
  417.     add    y1,b    a1,r0    ; mixe
  418.     move    b1,y:(r5)+n5    ; Sur la voie droite
  419. m_d_loop:
  420.     jmp    mix_fin
  421.  
  422.  
  423.  
  424. ;*≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈*
  425. ;*    Mixage - premiere voie                *
  426. ;*≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈*
  427. premier:
  428.     move    x:balance,b    ; La balance
  429.     move    #>0,x0
  430.     cmp    x0,b
  431.     jeq    put_gauche
  432.     move    #>$7ff800,x0
  433.     cmp    x0,b
  434.     jeq    put_droite
  435.     move    #>$400000,x0
  436.     cmp    x0,b
  437.     jeq    put_milieu
  438.  
  439. put_quelconque:
  440.     move    b,x0
  441.     mpy    x0,y0,a    (r1)+
  442.     move    a,x:(r1)-        ; Volume droit
  443.     move    #$7fffff,a
  444.     sub    b,a
  445.     move    a,x0
  446.     mpy    x0,y0,a
  447.     move    a1,x:(r1)        ; Volume gauche
  448.  
  449.     move    #>frequence+1,r3    ; r3 pointe sur la frequence
  450.     move    #>sambuf,a
  451.     move    x:finepos,a0
  452.     move    x:(r3)-,x0
  453.     move    x:(r3),x1
  454.     move    a1,r0        ; On fixe r0 maintenant car
  455.     add    x,a        ; on est obligé d'incrémenter A à l'avance
  456.     move    x:(r1)+,x1
  457.  
  458.     do    n7,p_q_loop
  459.     move    x:(r0),y0
  460.     mpy    y0,x1,b    x:(r1)-,x1
  461.     move    x:(r0),y0
  462.     move    b1,y:(r5)+
  463.     mpy    y0,x1,b    x:(r3),x1
  464.     add    x,a    a1,r0
  465.     move    x:(r1)+,x1
  466.     move    b1,y:(r5)+
  467. p_q_loop:
  468.     jmp    mix_fin
  469.  
  470. put_milieu:            ; Balance au milieu
  471.     move    y0,b
  472.     asr    b
  473.     move    b,y0    x:frequence,x1
  474.     move    x:frequence+1,x0
  475.     do    n7,p_m_loop
  476.     add    x,a    x:(r0),y1    ; Position suivante
  477.     mpy    y0,y1,b    a1,r0    ; volume
  478.     move    b1,y:(r5)+        ; Sur la voie gauche
  479.     move    b1,y:(r5)+        ; ...et la droite
  480. p_m_loop:
  481.     jmp    mix_fin
  482.  
  483. put_gauche:            ; Balance à gauche
  484.     move    x:frequence,x1
  485.     move    x:frequence+1,x0
  486.     do    n7,p_g_loop
  487.     add    x,a    x:(r0),y1    ; Position suivante
  488.     mpy    y0,y1,b    a1,r0    ; volume
  489.     move    b1,y:(r5)+n5    ; Sur la voie gauche
  490. p_g_loop:
  491.     move    x:adrbuf,r5    ; Comme on n'a écrit qu'à gauche,
  492.     clr    a        ; on efface la voie de droite
  493.     lua    (r5)+,r5
  494.     do    n7,p_g_loop2
  495.     move    a1,y:(r5)+n5
  496. p_g_loop2:
  497.     jmp    mix_fin
  498.  
  499. put_droite:            ; Balance à droite
  500.     move    x:frequence,x1
  501.     move    x:frequence+1,x0
  502.     lua    (r5)+,r5
  503.     do    n7,p_d_loop
  504.     add    x,a    x:(r0),y1    ; Position suivante
  505.     mpy    y0,y1,b    a1,r0    ; volume
  506.     move    b1,y:(r5)+n5    ; Sur la voie droite
  507. p_d_loop:
  508.     clr    a    x:adrbuf,r5    ; De même, comme on n'a écrit qu'à droite,
  509.     do    n7,p_d_loop2        ; on efface la voie gauche
  510.     move    a1,y:(r5)+n5
  511. p_d_loop2:
  512.     jmp    mix_fin
  513.  
  514.  
  515.  
  516. ;*≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈*
  517. ;*    Mixage avec interpolation                *
  518. ;*≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈*
  519. mix_interpolate:
  520.     move    x:numsam,b
  521.     tst    b
  522.     jeq    premier_i        ; C'est le premier sample?
  523.     move    x:balance,b    ; La balance, svp
  524.  
  525. mix_i_quelconque:
  526.     move    b,x0
  527.     mpy    x0,y0,a    (r1)+    ; r1 pointe sur le volume droit
  528.     move    a,x:(r1)-        ; Volume droit
  529.     move    #$7fffff,a
  530.     sub    b,a
  531.     move    a,x0
  532.     mpy    x0,y0,a
  533.     move    a1,x:(r1)        ; Volume gauche
  534.  
  535. ;--- 1ere passe: interpolation avec les samples à gauche des points ----------
  536.  
  537.     move    #>frequence+1,r3    ; r3 pointe sur la frequence
  538.     move    x:(r1)+,x1
  539.     move    x:(r3)-,x0
  540.     move    #>sambuf,a
  541.     move    x:finepos,a0
  542.     move    a1,r0
  543.  
  544.     do    n7,m_i_q_loopa
  545.       move    a0,b1        ; Coef d'interpolation
  546.       not    b        ; 0.99999999 - coef
  547.       lsr    b    x:(r0),y1    ; Passe en 47 bits - prend le sample
  548.       move    b1,y0
  549.       mpy    y0,y1,b        ; Interpolation
  550.       move    b,y1        ; y1 contient le sample interpolé mais non "volumé"
  551.       mpy    y1,x1,b    x:(r1)-,x1    y:(r5),y0
  552.       add    y0,b
  553.       move    b1,y:(r5)+
  554.       mpy    y1,x1,b    x:(r3),x1    y:(r5),y0
  555.       add    x,a    x:(r1)+,x1
  556.       add    y0,b    a1,r0
  557.       move    b1,y:(r5)+
  558. m_i_q_loopa:
  559.  
  560. ;--- 2eme passe: interpolation avec les samples à droite des points ----------
  561.  
  562. m_i_q_droite:
  563.     move    #>sambuf+1,a
  564.     move    x:finepos,a0
  565.     move    a1,r0
  566.     move    x:adrbuf,r5
  567.     move    x:taille_b1,n7
  568.  
  569.     do    n7,m_i_q_loopb
  570.       move    a0,b1        ; Coef d'interpolation
  571.       lsr    b    x:(r0),y1    ; Passe en 47 bits - prend le sample
  572.       move    b1,y0
  573.       mpy    y0,y1,b        ; Interpolation
  574.       move    b,y1        ; y1 contient le sample interpolé mais non "volumé"
  575.       mpy    y1,x1,b    x:(r1)-,x1    y:(r5),y0
  576.       add    y0,b
  577.       move    b1,y:(r5)+
  578.       mpy    y1,x1,b    x:(r3),x1    y:(r5),y0
  579.       add    x,a    x:(r1)+,x1
  580.       add    y0,b    a1,r0
  581.       move    b1,y:(r5)+
  582. m_i_q_loopb:
  583.     jmp    mix_fin
  584.  
  585.  
  586.  
  587. ;*≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈*
  588. ;*    Mixage avec interpolation - premiere voie            *
  589. ;*≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈*
  590. premier_i:
  591.     move    x:balance,b    ; La balance
  592.  
  593. put_i_quelconque:
  594.     move    b,x0
  595.     mpy    x0,y0,a    (r1)+
  596.     move    a,x:(r1)-        ; Volume droit
  597.     move    #$7fffff,a
  598.     sub    b,a
  599.     move    a,x0
  600.     mpy    x0,y0,a
  601.     move    a1,x:(r1)        ; Volume gauche
  602.  
  603. ;--- 1ere passe: interpolation avec les samples à gauche des points ----------
  604.  
  605.     move    #>frequence+1,r3    ; r3 pointe sur la frequence
  606.     move    #>sambuf,a
  607.     move    x:finepos,a0
  608.     move    x:(r3)-,x0
  609.  
  610.     do    n7,p_i_q_loopa
  611.     move    a0,b1        ; Coef d'interpolation: fraq(a)
  612.     not    b    a1,r0    ; (0.99999999 - coef) en 48 bits (pas de signe)
  613.     move    x:(r1)+,x1        ; Prend le volume gauche
  614.     lsr    b    x:(r0),y1    ; Passe en 47 bits (car mpy est signé) - Prend le sample
  615.     move    b1,y0
  616.     mpy    y0,y1,b        ; Interpolation
  617.     move    b1,y1        ; y1 contient le sample interpolé mais non "volumé"
  618.     mpy    y1,x1,b    x:(r1)-,x1    ; Volume le sample gauche - prend le volume droit
  619.     move    b1,y:(r5)+        ; Place le sample gauche
  620.     mpy    y1,x1,b    x:(r3),x1    ; Volume le sample droit - reprend la fréquence mot fort
  621.     add    x,a    a1,r0    ; Incrémente le pas
  622.     move    b1,y:(r5)+        ; Place le sample droit
  623. p_i_q_loopa:
  624.  
  625. ;--- 2eme passe: interpolation avec les samples à droite des points ----------
  626.  
  627.     move    x:(r1)+,x1
  628.     jmp    m_i_q_droite
  629.  
  630.  
  631.  
  632. ;*≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈*
  633. ;*    Mixage sans resampling                *
  634. ;*≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈*
  635. resampling030:
  636.     move    x:adrbuf,r5
  637.     move    #>2,n5
  638.     move    #>tmp_buffer,r0
  639.     move    x:taille_b1,n7
  640.     move    x:volume_g,y0
  641.  
  642.     readhost    a        ; a = multiplicateur 8 ou 16 -> 24 bits
  643.     move    x:amplification,b    ; Doit-on faire une amplification du sample?
  644.     tst    b
  645.     jeq    _no_amp
  646.     rep    b        ; *** Ne peut pas être interrompu
  647.     asl    a
  648. _no_amp:    move    a,x0        ; x0 devient le multiplicateur -> 24 bits
  649.  
  650.     move    x:numsam,b
  651.     tst    b
  652.     jeq    premier030        ; C'est le premier sample?
  653.     move    x:balance,b    ; La balance, svp
  654.     move    #>0,x1
  655.     cmp    x1,b
  656.     jeq    mix_gauche030
  657.     move    #>$7ff800,x1
  658.     cmp    x1,b
  659.     jeq    mix_droite030
  660.     move    #>$400000,x1
  661.     cmp    x1,b
  662.     jeq    mix_milieu030
  663.  
  664. mix_quelconque030:
  665.     move    #>volume_d,r1
  666.     move    b,x1
  667.     mpy    x1,y0,a
  668.     move    a,x:(r1)-        ; Volume droit
  669.     move    #$7fffff,a
  670.     sub    b,a
  671.     move    a,x1
  672.     mpy    x1,y0,a
  673.     move    a1,x:(r1)        ; Volume gauche
  674.     move    x:(r1)+,x1
  675.  
  676.     do    n7,m_q_loop030
  677.     readhost    y0
  678.     mpy    x0,y0,a
  679.     move    a0,y0
  680.     move    y0,x:(r0)
  681.     mpy    y0,x1,b    x:(r1)-,x1    y:(r5),y0
  682.     add    y0,b    x:(r0),y0
  683.     move    b1,y:(r5)+
  684.     mpy    y0,x1,b        y:(r5),y0
  685.     add    y0,b    x:(r1)+,x1
  686.     move    b1,y:(r5)+
  687. m_q_loop030:
  688.     jmp    mix_fin
  689.  
  690. mix_milieu030:            ; Balance au milieu
  691.     move    y0,b
  692.     asr    b
  693.     move    b,y0
  694.     do    n7,m_m_loop030
  695.     readhost    y1
  696.     mpy    x0,y1,a
  697.     move    a0,y1
  698.     move    y1,x:(r0)
  699.     mpy    y0,y1,b    y:(r5),y1    ; volume
  700.     add    y1,b    x:(r0),y1    ; mixe et reprend le sample
  701.     move    b1,y:(r5)+        ; Sur la voie gauche
  702.     mpy    y0,y1,b    y:(r5),y1    ; On refait le volume, pour la droite cette fois
  703.     add    y1,b        ; et le mixage
  704.     move    b1,y:(r5)+        ; Hop sur la voie droite
  705. m_m_loop030:
  706.     jmp    mix_fin
  707.  
  708. mix_gauche030:            ; Balance à gauche
  709.     do    n7,m_g_loop030
  710.     readhost    y1
  711.     mpy    x0,y1,a
  712.     move    a0,y1
  713.     mpy    y0,y1,b    y:(r5),y1    ; volume
  714.     add    y1,b        ; mixe
  715.     move    b1,y:(r5)+n5    ; Sur la voie gauche
  716. m_g_loop030:
  717.     jmp    mix_fin
  718.  
  719. mix_droite030:            ; Balance à droite
  720.     lua    (r5)+,r5
  721.     do    n7,m_d_loop030
  722.     readhost    y1
  723.     mpy    x0,y1,a
  724.     move    a0,y1
  725.     mpy    y0,y1,b    y:(r5),y1    ; volume
  726.     add    y1,b        ; mixe
  727.     move    b1,y:(r5)+n5    ; Sur la voie droite
  728. m_d_loop030:
  729.     jmp    mix_fin
  730.  
  731. premier030:
  732.     move    x:balance,b    ; La balance
  733.     move    #>0,x1
  734.     cmp    x1,b
  735.     jeq    put_gauche030
  736.     move    #>$7ff800,x1
  737.     cmp    x1,b
  738.     jeq    put_droite030
  739.     move    #>$400000,x1
  740.     cmp    x1,b
  741.     jeq    put_milieu030
  742.  
  743. put_quelconque030:
  744.     move    #>volume_d,r1
  745.     move    b,x1
  746.     mpy    x1,y0,a
  747.     move    a,x:(r1)-        ; Volume droit
  748.     move    #$7fffff,a
  749.     sub    b,a
  750.     move    a,x1
  751.     mpy    x1,y0,a
  752.     move    a1,x:(r1)        ; Volume gauche
  753.     move    x:(r1)+,x1
  754.  
  755.     do    n7,p_q_loop030
  756.     readhost    y0
  757.     mpy    x0,y0,a
  758.     move    a0,y0
  759.     move    y0,x:(r0)
  760.     mpy    y0,x1,b    x:(r1)-,x1
  761.     move    x:(r0),y0
  762.     move    b1,y:(r5)+
  763.     mpy    y0,x1,b    x:(r1)+,x1
  764.     move    b1,y:(r5)+
  765. p_q_loop030:
  766.     jmp    mix_fin
  767.  
  768. put_milieu030:            ; Balance au milieu
  769.     move    y0,b
  770.     asr    b
  771.     move    b,y0
  772.     do    n7,p_m_loop030
  773.     readhost    y1
  774.     mpy    x0,y1,a
  775.     move    a0,y1
  776.     mpy    y0,y1,b        ; volume
  777.     move    b1,y:(r5)+        ; Sur la voie gauche
  778.     move    b1,y:(r5)+        ; ...et la droite
  779. p_m_loop030:
  780.     jmp    mix_fin
  781.  
  782. put_gauche030:            ; Balance à gauche
  783.     do    n7,p_g_loop030
  784.     readhost    y1
  785.     mpy    x0,y1,a
  786.     move    a0,y1
  787.     mpy    y0,y1,b        ; volume
  788.     move    b1,y:(r5)+n5    ; Sur la voie gauche
  789. p_g_loop030:
  790.     move    x:adrbuf,r5    ; Comme on n'a écrit qu'à gauche,
  791.     clr    a        ; on efface la voie de droite
  792.     lua    (r5)+,r5
  793.     do    n7,p_g_loop2030
  794.     move    a1,y:(r5)+n5
  795. p_g_loop2030:
  796.     jmp    mix_fin
  797.  
  798. put_droite030:            ; Balance à droite
  799.     lua    (r5)+,r5
  800.     do    n7,p_d_loop030
  801.     readhost    y1
  802.     mpy    x0,y1,a
  803.     move    a0,y1
  804.     mpy    y0,y1,b    a1,r0    ; volume
  805.     move    b1,y:(r5)+n5    ; Sur la voie droite
  806. p_d_loop030:
  807.     clr    a    x:adrbuf,r5    ; De même, comme on n'a écrit qu'à droite,
  808.     do    n7,p_d_loop2030        ; on efface la voie gauche
  809.     move    a1,y:(r5)+n5
  810. p_d_loop2030:
  811.  
  812. mix_fin:
  813.     move    x:numsam,a1    ; Sample suivant
  814.     move    #>$1,x0
  815.     add    x0,a
  816.     move    a1,x:numsam
  817.     jmp    wait_cmd
  818.  
  819.  
  820.  
  821. ;*≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈*
  822. ;*    Fin : mixage des constantes avec fade vers 0        *
  823. ;*≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈*
  824. rec_end:
  825.     move    x:taille_b1,n7
  826.     move    x:adrbuf,r5
  827.     move    x:cst_left,x0
  828.     move    x:cst_right,x1
  829.     move    #0.995,y0
  830.     do    n7,addcst_loop
  831.       mpy    x0,y0,b    y:(r5)+,a
  832.       mpy    x1,y0,b    b,x0
  833.       move    b,x1
  834.       add    x0,a    y:(r5)-,b
  835.       add    x1,b    a,y:(r5)+
  836.       move    b,y:(r5)+
  837. addcst_loop:
  838.  
  839.  
  840.  
  841. ;*≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈*
  842. ;*    Attend le moment de recuperer le prochain bloc de samples    *
  843. ;*≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈*
  844. wait_next_frame:
  845.     move    x:realtime_flag,a0
  846.     jclr    #0,a0,no_realtime_send
  847.  
  848.     move    x:taille_b2,b
  849.     lsl    b    x:adrbuf,a
  850.     move    b,x1
  851.     move    r4,b
  852.     move    #>mixbuf1,x0
  853.     cmp    x0,a
  854.     jne    wait_buf2
  855.  
  856. ;--- Attend le début du premier buffer ---------------------------------------
  857.  
  858.     move    #>mixbuf2,a
  859.     sub    a,b
  860.     move    b,x:cpu_pourcent
  861.     add    x1,a    r4,b
  862.     cmp    a,b    r4,b
  863.     jpl    _overflow
  864. _loop:
  865.     cmp    a,b    r4,b
  866.     jmi    _loop
  867. _loop_end:    move    #>mixbuf1,r4
  868.     move    #>mixbuf2,x0
  869.     move    x0,x:adrbuf
  870.     jmp    calc_cpu_pourcent
  871.  
  872. _overflow:
  873.     bset    #0,x:cpu_overflow
  874.     jmp    _loop_end
  875.  
  876. ;--- Attend le début du deuxieme buffer --------------------------------------
  877.  
  878. wait_buf2:
  879.     move    #>mixbuf1,a
  880.     sub    a,b
  881.     move    b,x:cpu_pourcent
  882.     add    x1,a    r4,b
  883.     cmp    a,b    r4,b
  884.     jpl    _overflow
  885. _loop:
  886.     cmp    a,b    r4,b
  887.     jmi    _loop
  888. _loop_end:    move    #>mixbuf2,r4
  889.     move    #>mixbuf1,x0
  890.     move    x0,x:adrbuf
  891.     jmp    calc_cpu_pourcent
  892.  
  893. _overflow:
  894.     bset    #0,x:cpu_overflow
  895.     jmp    _loop_end
  896.  
  897. ;--- Calcul du temps machine utilisé -----------------------------------------
  898.  
  899. calc_cpu_pourcent:
  900.     jset    #0,x:cpu_overflow,_overflow
  901.     move    x:taille_b1,b
  902.     asl    b        ; * 2 pour convertir en stereo
  903.     asl    b        ; * 2 encore au cas où cpu_pourcent >= taille_b1
  904.     move    x:cpu_pourcent,a
  905.     move    b,x0
  906.     and    #$FE,ccr
  907.     do    #24,_loop
  908.     div    x0,a
  909. _loop:
  910.     move    #>100*2,x0        ; * 2 pour corriger le 2eme asl b
  911.     move    a0,x1
  912.     mpy    x0,x1,a        ; Conversion en pourcentage
  913.     move    a,x:cpu_pourcent
  914.     jmp    receive_loop
  915.  
  916. _overflow:
  917.     clr    a
  918.     move    a,x:cpu_overflow
  919.     move    #>255,a
  920.     move    a,x:cpu_pourcent
  921.     jmp    receive_loop
  922.  
  923.  
  924.  
  925. ;--- Efface les voies (met les constantes) -----------------------------------
  926.  
  927. eff_gadr:
  928.     move    x:adrbuf,r5
  929.     move    x:cst_left,a
  930.     move    x:cst_right,b
  931.     do    #(mixbuf2-mixbuf1)/2,_loop
  932.     move    a,y:(r5)+
  933.     move    b,y:(r5)+
  934. _loop:
  935.     jmp    wait_next_frame
  936.  
  937. coupe_son:                ; Là c'est quand on se tire
  938.     move    #save_reg,r0    ; Remet la valeur d'origine des registres E/S
  939.     nop
  940.     move    x:(r0)+,x0
  941.     movep    x0,x:<<CRA
  942.     move    x:(r0)+,x0
  943.     movep    x0,x:<<PCC
  944.     move    x:(r0)+,x0
  945.     movep    x0,x:<<PBC
  946.     move    x:(r0)+,x0
  947.     movep    x0,x:<<BCR
  948.     move    x:(r0)+,x0
  949.     movep    x0,x:<<IPR
  950.     move    x:(r0)+,x0
  951.     movep    x0,x:<<CRB
  952.     jmp    *        ; On attend que ça se passe...
  953.  
  954.  
  955.  
  956. ;*≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈*
  957. ;*    Enregistrement de la musique sans ecoute            *
  958. ;*≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈*
  959. no_realtime_rec:
  960.     clr    a
  961.     move    a,x:realtime_flag    ; On n'est plus en temps reel
  962.     movep    #>$0800,x:<<CRB    ; Cloue le bec à la SSI
  963.     jmp    wait_cmd
  964.  
  965. no_realtime_send:
  966.  
  967. ;--- Positionne r4 sur le début du buffer QU'ON VIENT DE MIXER ---------------
  968.  
  969.     move    x:adrbuf,a
  970.     move    a,r4
  971.  
  972. ;--- Envoie le résultat du mixage au 030 -------------------------------------
  973.  
  974.     move    x:taille_b1,a    ; Nombre de paquets de 2 samples: stereo
  975.     writhost    a
  976.     do    a,_sendloop
  977.     move    y:(r4)+,x0        ; Gauche
  978.     writhost    x0
  979.     move    y:(r4)+,x0        ; Droit
  980.     writhost    x0
  981. _sendloop:
  982.  
  983.     readhost    a        ; Attend que le 030 donne l'autorisation de repartir
  984.  
  985. ;--- Change de buffer pour la prochaine fois ---------------------------------
  986.  
  987.     move    x:adrbuf,a
  988.     move    #>mixbuf1,x0
  989.     cmp    x0,a
  990.     jne    _nextbuf1
  991. _nextbuf2:
  992.     move    #>mixbuf1,r4
  993.     move    #>mixbuf2,x0
  994.     move    x0,x:adrbuf
  995.     jmp    receive_loop
  996. _nextbuf1:
  997.     move    #>mixbuf2,r4
  998.     move    #>mixbuf1,x0
  999.     move    x0,x:adrbuf
  1000.     jmp    receive_loop
  1001.  
  1002.  
  1003.  
  1004. ;*≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈*
  1005. ;*    Repasse le DSP en mode temps réel            *
  1006. ;*≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈*
  1007. bck_to_realtime:
  1008.     move    #>1,a
  1009.     move    a,x:realtime_flag    ; On n'est plus en temps reel
  1010.     movep    #>$5800,x:<<CRB    ; Réautorise l'envoi de données sous interruptions
  1011.     jmp    wait_cmd
  1012.  
  1013.  
  1014.  
  1015. code_end:
  1016.  
  1017. ;*~~~ FIN ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*
  1018.