home *** CD-ROM | disk | FTP | other *** search
/ PC Interdit / pc-interdit.iso / sound / gusmod / gusasm.asm < prev    next >
Assembly Source File  |  1994-10-12  |  21KB  |  770 lines

  1. .286
  2.  
  3. segment data
  4. w equ word ptr
  5. b equ byte ptr
  6. num_voices equ 14
  7.  
  8. ;**************************************************************************
  9. ;***                S E G M E N T  D E  D O N N E E S                   ***
  10. ;**************************************************************************
  11.  
  12.   trouve      db ?
  13.  
  14. ;**************************************************************************
  15. ;***              D E C L A R T I O N   D E S  V A R I A B L E S        ***
  16. ;**************************************************************************
  17.  
  18.   Play_Voice equ 0
  19.   Stop_Voice equ 3
  20.   Bit8       equ 0
  21.   Bit16      equ 4
  22.   No_Loop    equ 0
  23.   Mit_Loop   equ 8
  24.   Unidirect  equ 0
  25.   Bidirect   equ 16
  26.   Go_forw    equ 0
  27.   Go_Back    equ 64
  28. data ends
  29.  
  30. ;**************************************************************************
  31. ;***                      S E G M E N T  D E  C O D E                   ***
  32. ;**************************************************************************
  33.  
  34. segment code
  35.   assume cs:code, ds:data
  36.  
  37. ;**************************************************************************
  38. ;***             D E C L A R A T I O N  D E S  R O U T I N E S          ***
  39. ;**************************************************************************
  40.  
  41.  
  42.   u_base     dw 240h
  43.   u_status   dw u_base+006h
  44.   u_voice    dw u_base+102h
  45.   u_command  dw u_base+103h
  46.   u_Datalo   dw u_base+104h
  47.   u_Datahi   dw u_base+105h
  48.   u_DramIO   dw u_base+107h
  49.  
  50.  
  51.  
  52. oldUVolumes dw 01000h,0B000h,0B100h,0B200h,0B300h,0B400h,0B500h,0B600h,0B700h
  53.          dw 0B800h,0B900h,0BA00h,0BB00h,0BC00h,0BD00h,0BE00h,0BF00h
  54.          dw 0C000h,0C100h,0C200h,0C300h,0C400h,0C500h,0C600h,0C700h
  55.          dw 0C800h,0C900h,0CA00h,0CB00h,0CC00h,0CD00h,0CE00h,0CF00h
  56.          dw 0D000h,0D100h,0D200h,0D300h,0D400h,0D500h,0D600h,0D700h
  57.          dw 0D800h,0D900h,0DA00h,0DB00h,0DC00h,0DD00h,0DE00h,0DF00h
  58.          dw 0E000h,0E100h,0E200h,0E300h,0E400h,0E500h,0E600h,0E700h
  59.          dw 0E800h,0E900h,0EA00h,0EB00h,0EC00h,0ED00h,0EE00h,0EF00h
  60.  
  61.  
  62. UVolumes  DW 1500h
  63.         DW 40004,42600,44752,45648,46544,47624,48448,49232
  64.         DW 50048,50584,51112,51656,52184,52584,52976,53376
  65.         DW 53752,54016,54280,54520,54768,55024,55280,55544
  66.         DW 55776,56048,56288,56536,56784,56992,57184,57384
  67.         DW 57616,57752,57888,58000,58112,58248,58368,58480
  68.         DW 58600,58720,58840,58960,59088,59208,59336,59464
  69.         DW 59584,59720,59816,59944,60072,60176,60312,60408
  70.         DW 60544,60648,60784,60888,60992,61064,61176,61248
  71.  
  72.  
  73. Voice_Divisor db 43,40,37,35,33,31,30,28,27,26,25,24,23,22,21,20,20,19,18
  74.  
  75. FFtable dw   66,   70,   74,   78,   83,   88,   93,   99,  104,  111
  76.         dw  117,  124,  132,  139,  148,  156,  166,  176,  186,  197
  77.         dw  209,  221,  234,  248,  263,  279,  295,  313,  331,  351
  78.         dw  372,  394,  418,  442,  469,  497,  526,  557,  591,  626
  79.         dw  663,  702,  744,  788,  835,  885,  938,  993, 1052, 1115
  80.         dw 1181, 1251, 1326, 1405, 1488, 1577, 1671, 1770, 1875, 1987
  81.         dw 2105, 2230, 2362, 2503, 2652, 2809, 2977, 3154, 3341, 3540
  82.  
  83.  
  84. Modoctave  dw 1712,1616,1525,1440,1359,1283,1211
  85.            dw 1143,1078,961,907,856,808,763,720
  86.            dw 679,641,605,571,539,509,480,453,428
  87.            dw 404,381,360,340,321,303,286,270,254
  88.            dw 240,227,214,202,191,180,170,160,151
  89.            dw 143,135, 127,120,113,107,101,95,90
  90.            dw 85,80,76,71,67,64,60,57,54,50,47,45
  91.            dw 42,40,38,36,34,32,30
  92.  
  93. public U_StartVoice
  94. public u_VoiceBalance
  95. public u_VoiceVolume
  96. public u_delay
  97. public u_Initialize
  98. public u_Voicefreq
  99. public Ultra_Mem2Gus
  100. public u_Voicedata
  101. public ffacteur
  102. public Note
  103. public dos_getmem
  104. public dos_freemem
  105. public detect_gus
  106. public init_gus_base
  107. public GusSound_deb
  108. public GusSound_fin
  109. public voice_rampin
  110. public voice_slide
  111.  
  112.  
  113. u_delay proc pascal
  114. ; **************************************************************************
  115. ; ***           Attendre le temps qu'il faut pour un Double-write        ***
  116. ; **************************************************************************
  117.   mov dx,300h
  118.   in al,dx
  119.   in al,dx
  120.   in al,dx
  121.   in al,dx
  122.   in al,dx
  123.   in al,dx
  124.   in al,dx
  125.   ret
  126. u_delay endp
  127.  
  128. U_StartVoice proc pascal Nr,Mode : byte
  129. ; **************************************************************************
  130. ; ***        Lance la sortie sur un canal GUS                            ***
  131. ; **************************************************************************
  132.   mov dx,w u_voice                ; Choisir la voix
  133.   mov al,byte ptr Nr
  134.   out dx,al
  135.   mov dx,w u_command
  136.   mov al,0                        ; Mode de la voix
  137.   out dx,al
  138.   mov dx,w u_DataHi
  139.   mov al,Mode                    ; Poser l'octet MODE 
  140.   out dx,al
  141.   ret
  142. U_StartVoice endp
  143.  
  144. u_VoiceBalance proc pascal Nr,balance : byte
  145. ; **************************************************************************
  146. ; ***         Règle la position Pan pour un canal (0 - 15)               ***
  147. ; **************************************************************************
  148.   mov dx,w u_Voice                ; Choisir la voix
  149.   mov al,byte ptr Nr
  150.   out dx,al
  151.   mov dx,w u_Command              ; Commande Set Pan-Position
  152.   mov al,0Ch
  153.   out dx,al
  154.   mov dx,w u_dataHi               ; Ecrire la position
  155.   mov al,balance
  156.   out dx,al
  157.   ret
  158. u_VoiceBalance endp
  159.  
  160. u_VoiceVolume proc pascal Nr:byte,Vol:word
  161. ; **************************************************************************
  162. ; ***              Règle le volume pour un canal (0 - 63)                ***
  163. ; **************************************************************************
  164.     mov dx,w u_Voice              ; Choisir la voix
  165.     mov al,Nr
  166.     out dx,al
  167.     mov dx,w u_Command            ; Commande de définition du volume
  168.     mov al,9
  169.     out dx,al
  170.     mov dx,w u_DataLo             ; Charge le volume GUS dans la table
  171.     mov di,vol                    ; et le définit
  172.     shl di,1
  173.     mov ax,word ptr [offset uVolumes + di]
  174.     out dx,ax
  175.     ret
  176. u_VoiceVolume  endp
  177.  
  178. u_Initialize proc near
  179. ; **************************************************************************
  180. ; *** Initialise la carte Ultrasound                                     ***
  181. ; **************************************************************************
  182.   mov bx,w u_Command
  183.   mov cx,w u_datahi
  184.   mov dx,bx
  185.   mov al,4ch                    ; Choisir le registre d'initialisation
  186.   out dx,al
  187.   mov dx,cx
  188.   mov al,0                      ; Exécuter l'initialisation
  189.   out dx,al
  190.   call u_delay                  ; Attendre
  191.   call u_delay
  192.   mov dx,bx
  193.   mov al,4ch
  194.   out dx,al
  195.   mov dx,cx
  196.   mov al,1                      ; Terminer l'initialisation
  197.   out dx,al
  198.   call u_delay
  199.   call u_delay
  200.   mov dx,bx                     ; Reset du DMA Control Register 
  201.   mov al,41h
  202.   out dx,al
  203.   mov dx,cx
  204.   mov al,0
  205.   out dx,al
  206.   mov dx,bx                     ; Reset du Timer Control Register 
  207.   mov al,45h
  208.   out dx,al
  209.   mov dx,cx
  210.   mov al,0
  211.   out dx,al
  212.   mov dx,bx                     ; Reset du Sampling Control Register 
  213.   mov al,49h
  214.   out dx,al
  215.   mov dx,cx
  216.   mov al,0
  217.   out dx,al
  218.   mov dx,bx                     ; Poser le nombre de voix
  219.   mov al,0Eh
  220.   out dx,al
  221.   add dx,2
  222.   mov al,Num_Voices
  223.   or  al,0C0h
  224.   out dx,al
  225.   mov dx,w u_status             ; Vider éventuellement les interrupts DMA
  226.   in al,dx
  227.   mov dx,bx
  228.   mov al,41h
  229.   out dx,al
  230.   mov dx,cx
  231.   in al,dx
  232.   mov dx,bx                 ; Vider éventuellement les interrupts de sampling 
  233.   mov al,49h
  234.   out dx,al
  235.   mov dx,cx
  236.   in al,dx
  237.   mov dx,bx                       ; Lire le registre d'état de l'IRQ
  238.   mov al,8Fh                      ; ==> Il n'y a plus d'interruptions
  239.   out dx,al                       ;     non traitées
  240.   mov dx,cx
  241.   in al,dx
  242.   push bx                         ; Désactive les voix dans la boucle
  243.   push cx
  244.   mov cx,0
  245. @VoiceClearLoop:
  246.   mov dx,w u_Voice                ; Choisir les voix
  247.   mov al,cl
  248.   out dx,al
  249.   inc dx
  250.   mov al,0                        ; Poser le mode Voice
  251.   out dx,al
  252.   add dx,2
  253.   mov al,3                        ; Arrêter les voix
  254.   out dx,al
  255.   sub dx,2                        ; Poser le volume sur 0
  256.   mov al,0dh
  257.   out dx,al
  258.   add dx,2
  259.   mov al,3
  260.   out dx,al
  261.   inc cx
  262.   cmp cx,32                     ; Répéter pour toutes les voix
  263.   jnz @VoiceClearLoop
  264.   pop cx
  265.   pop bx
  266.   mov dx,bx                     ; Traiter les interruptions
  267.   mov al,41h                    ; éventuelles
  268.   out dx,al
  269.   mov dx,cx
  270.   in al,dx
  271.   mov dx,bx
  272.   mov al,49h
  273.   out dx,al
  274.   mov dx,cx
  275.   in al,dx
  276.   mov dx,bx
  277.   mov al,8fh
  278.   out dx,al
  279.   mov dx,cx
  280.   in al,dx
  281.   mov dx,bx                       ; Exécuter un reset
  282.   mov al,4ch
  283.   out dx,al
  284.   mov dx,cx                   ; Activer l'IRQ master GF1 
  285.   mov al,7
  286.   out dx,al
  287.   ret
  288. u_Initialize endp
  289.  
  290. u_Voicefreq proc pascal Nr:byte,Freq:word
  291. ; **************************************************************************
  292. ; ***            Règle la fréquence à laquelle le canal sera exécuté     ***
  293. ; **************************************************************************
  294.   mov dx,w u_Voice                ; Adresser la voix
  295.   mov al,Nr
  296.   out dx,al
  297.   mov dx,w u_Command              ; Ecrire la commande pour la fréquence
  298.   mov al,1
  299.   out dx,al                       ; Freq := Fréquence DIV
  300.   xor bx,bx                       ;         Voice_Divisor[num_voices-13]
  301.   mov bl,num_voices
  302.   mov ax,Freq
  303.   mov di,bx
  304.   sub di,14
  305.   xor bx,bx
  306.   xor dx,dx
  307.   mov bl,byte ptr [voice_Divisor+di]
  308.   div bx
  309.   mov dx,w u_DataLo
  310.   out dx,ax
  311.   ret
  312. u_Voicefreq endp
  313.  
  314. Ultra_Mem2Gus proc pascal sampp:dword,start:dword,long:word
  315. ; **************************************************************************
  316. ; ***           Copie un secteur de RAM dans la RAM de la carte          ***
  317. ; **************************************************************************
  318.     push ds
  319.     push si
  320.     mov si,[bp+12]                ; Segment
  321.     mov ds,si
  322.     mov si,[bp+10]                ; Offset
  323.     mov dx,w u_Command            ; Poser l'octet Hi de l'adresse de GUS-DRAM
  324.     mov al,44h
  325.     out dx,al
  326.     mov dx,w u_DataHi
  327.     mov ax,[bp+08]                ; hstart
  328.     out dx,al
  329.     mov cx,[bp+4]                 ; Charger la longueur
  330. @Copy_loop:
  331.     mov dx,w u_Command            ; Poser l'octet Lo de l'adresse de GUS-DRAM
  332.     mov al,43h
  333.     out dx,al
  334.     mov dx,w u_DataLo
  335.     mov ax,[bp+06]                ; lstart
  336.     out dx,ax
  337.     mov dx,w u_DramIo             ; Charger et envoyer l'octet
  338.     lodsb
  339.     out dx,al
  340.     cmp word ptr [bp+06],0ffffh   ; lstart = 0ffffh ?
  341.     je @depassement
  342.     inc word ptr [bp+06]          ; lstart++
  343.     jmp @continuer
  344. @depassement:
  345.     inc word ptr [bp+08]          ; hstart ++
  346.     mov word ptr [bp+06],0        ; lstart sur 0
  347.     mov dx,w u_Command            ; Poser l'adresse hi de l'adresse de la RAM GUS
  348.     mov al,44h
  349.     out dx,al
  350.     mov dx,w u_DataHi
  351.     mov ax,[bp+08]                ; hstart
  352.     out dx,al
  353. @continuer:
  354.     loop @copy_loop
  355.     pop si
  356.     pop ds
  357.     ret
  358. Ultra_Mem2Gus endp
  359.  
  360. u_Voicedata proc pascal start,lsta,llong:dword,Nr:word
  361. ; **************************************************************************
  362. ; ***               Définit les paramètre pour un canal                  ***
  363. ; **************************************************************************
  364.     mov dx,w u_Voice              ; Choisir la voix
  365.     mov ax,Nr
  366.     out dx,al
  367.     mov dx,w u_command            ; Définir le début de la voix
  368.     mov al,0ah
  369.     out dx,al
  370.     mov ax, word ptr [start+2]
  371.     mov cx, word ptr [start]
  372.     mov bx,cx
  373.     shr ax,7
  374.     shr cx,7
  375.     shl bx,9
  376.     or  ax,bx
  377.     mov dx,w u_DataLo
  378.     out dx,ax
  379.     mov dx,w u_Command
  380.     mov al,0bh
  381.     out dx,al
  382.     mov dx,w u_datalo
  383.     mov ax,word ptr [start]
  384.     shl ax,9
  385.     out dx,ax
  386.     mov dx,w u_command            ; Définir le début d'une boucle
  387.     mov al,2
  388.     out dx,al
  389.     mov ax, word ptr [lsta]
  390.     mov cx, word ptr [lsta+2]
  391.     mov bx,cx
  392.     shr ax,7
  393.     shr cx,7
  394.     shl bx,9
  395.     or  ax,bx
  396.     mov dx,w u_DataLo
  397.     out dx,ax
  398.     mov dx,w u_Command
  399.     mov al,3
  400.     out dx,al
  401.     mov dx,w u_datalo
  402.     mov ax,word ptr [lsta]
  403.     shl ax,9
  404.     out dx,ax
  405.     mov dx,w u_command            ; Définir la fin de la boucle
  406.     mov al,4
  407.     out dx,al
  408.     mov ax, word ptr [llong]
  409.     mov cx, word ptr [llong+2]
  410.     mov bx,cx
  411.     shr ax,7
  412.     shr cx,7
  413.     shl bx,9
  414.     or  ax,bx
  415.     mov dx,w u_DataLo
  416.     out dx,ax
  417.     mov dx,w u_Command
  418.     mov al,5
  419.     out dx,al
  420.     mov dx,w u_datalo
  421.     mov ax,word ptr [llong]
  422.     shl ax,9
  423.     out dx,ax
  424.    ret
  425. u_Voicedata endp
  426.  
  427. ffacteur proc pascal t:word
  428. ; **************************************************************************
  429. ; ***           Renvoie la fréquence pour une tonalité en "t"            ***
  430. ; **************************************************************************
  431.  mov di,t
  432.  sub di,5
  433.  shl di,1
  434.  mov ax,word ptr [offset fftable+di]
  435.  ret
  436. ffacteur endp
  437.  
  438. Note proc pascal hauteur:word
  439. ; **************************************************************************
  440. ; ***   Détermine le numéro pour une tonalité donnée d'un fichier MOD    ***
  441. ; **************************************************************************
  442.   mov trouve,1
  443.   xor di,di
  444. @boucle:
  445.   mov ax,word ptr Modoctave[di]
  446.   cmp hauteur,ax
  447.   ja note_trouve
  448.   add di,2
  449. ;  cmp di,128
  450.   cmp di,140
  451.   jae @continuer_recherche
  452.   jmp @boucle
  453. note_trouve:
  454.   mov trouve,0
  455. @continuer_recherche:
  456.   mov ax,255
  457.   cmp trouve,0
  458.   jne fin_Note
  459.   mov ax,di
  460.   shr ax,1
  461.   inc ax
  462. fin_Note:
  463.   ret
  464. Note endp
  465.  
  466. dos_getmem proc pascal pointeur:dword,ensemble:word
  467. ; **************************************************************************
  468. ; ***      Alloue un secteur (max. 64 Ko) dans la mémoire RAM de DOS     ***
  469. ; **************************************************************************
  470.   push ds
  471.   mov bx,ensemble
  472.   shr bx,4
  473.   inc bx
  474.   mov ah,48h
  475.   int 21h
  476.   mov bx,w [pointeur+2]
  477.   mov ds,bx
  478.   mov bx,w [pointeur]
  479.   mov w [bx],0
  480.   mov w [bx+2],ax
  481.   pop ds
  482.   ret
  483. dos_getmem endp
  484.  
  485. dos_freemem proc pascal pointeur:dword
  486. ; **************************************************************************
  487. ; ***           Libère un secteur alloué par dos_getmem                  ***
  488. ; **************************************************************************
  489.   mov ax,word ptr [pointeur+2]
  490.   mov es,ax
  491.   mov ah,49h
  492.   int 21h
  493.   ret
  494. dos_freemem endp
  495.  
  496. detect_gus proc near
  497. ; ***************************************************************************
  498. ; *** La routine sert à reconnaître la Gravis Ultrasound. Le port de base ***
  499. ; *** est reconnu. La procédure retourne 0 quand la carte a été trouvée,  ***
  500. ; *** sinon la valeur 1.                                                  ***
  501. ; ***************************************************************************
  502.   mov di,1F0h
  503. @detect_loop:                     ; Test des ports possibles dans une boucle
  504.   add di,10h
  505.   mov dx,di
  506.   add dx,103h                     ; Tente d'initialiser
  507.   mov al,4Ch
  508.   out dx,al
  509.   mov dx,di
  510.   add dx,105h
  511.   mov al,0
  512.   call u_delay
  513.   call u_delay
  514.   mov dx,di
  515.   add dx,103h
  516.   mov al,4Ch
  517.   out dx,al
  518.   mov dx,di
  519.   add dx,105h
  520.   mov al,0
  521.   mov dx,di                       ; Tentative d'écrire des données
  522.   add dx,103h                     ; dans la RAM de la carte
  523.   mov al,43h
  524.   out dx,al
  525.   mov dx,di
  526.   add dx,105h
  527.   mov al,0h
  528.   out dx,al
  529.   mov dx,di
  530.   add dx,103h
  531.   mov al,44h
  532.   out dx,al
  533.   mov dx,di
  534.   add dx,105h
  535.   mov al,0h
  536.   out dx,al
  537.   mov dx,di
  538.   add dx,107h
  539.   mov al,0AAh
  540.   out dx,al
  541.   call u_delay                    ; Attente, pour que la GF1
  542.   call u_delay                    ; ne puisse pas nous échapper
  543.   call u_delay
  544.   call u_delay
  545.   call u_delay
  546.   call u_delay
  547.   xor ax,ax                       ; Lecture en retour dans la RAM de la carte
  548.   mov dx,di
  549.   add dx,107h
  550.   in  al,dx
  551.   cmp al,0AAh                     ; Valeur écrite = Valeur lue ?
  552.   je  @Carte_trouvee           ; Carte trouvée !
  553.   cmp di,280h
  554.   jae @Carte_non_trouvee       ; Pas de carte à ce port :
  555.   jmp @detect_loop             ; Tentative avec un nouveau port
  556. @Carte_trouvee:
  557.   mov w u_base,di              ; Initialiser le registre de base de la carte
  558.   mov ax,di
  559.   add ax,6
  560.   mov w u_status,ax
  561.   mov ax,di
  562.   add ax,102h
  563.   mov w u_voice,ax
  564.   mov ax,di
  565.   add ax,103h
  566.   mov w u_command,ax
  567.   mov ax,di
  568.   add ax,104h
  569.   mov w u_Datalo,ax
  570.   mov ax,di
  571.   add ax,105h
  572.   mov w u_Datahi,ax
  573.   mov ax,di
  574.   add ax,107h
  575.   mov w u_DramIO,ax
  576.   mov ax,0
  577.   jmp @Fin_Recherche
  578. @Carte_non_trouvee:
  579.   mov ax,1
  580. @Fin_Recherche:
  581.   ret
  582. detect_gus endp
  583.  
  584. init_gus_base proc pascal gbase : word;
  585.   mov di,gbase
  586.   mov dx,di
  587.   add dx,103h                     ; Initialisiation de la recherche
  588.   mov al,4Ch
  589.   out dx,al
  590.   mov dx,di
  591.   add dx,105h
  592.   mov al,0
  593.   out dx,al ;?????
  594.   call u_delay
  595.   call u_delay
  596.   mov dx,di
  597.   add dx,103h
  598.   mov al,4Ch
  599.   out dx,al
  600.   mov dx,di
  601.   add dx,105h
  602.   mov al,1
  603.   out dx,al ;????
  604.  
  605.   mov w u_base,di                 ; initialisation du registre de base de la carte
  606.   mov ax,di
  607.   add ax,6
  608.   mov w u_status,ax
  609.   mov ax,di
  610.   add ax,102h
  611.   mov w u_voice,ax
  612.   mov ax,di
  613.   add ax,103h
  614.   mov w u_command,ax
  615.   mov ax,di
  616.   add ax,104h
  617.   mov w u_Datalo,ax
  618.   mov ax,di
  619.   add ax,105h
  620.   mov w u_Datahi,ax
  621.   mov ax,di
  622.   add ax,107h
  623.   mov w u_DramIO,ax
  624.   mov ax,0
  625.   ret
  626. init_gus_base endp
  627.  
  628.  
  629. GusSound_fin proc near
  630. ; **************************************************************************
  631. ; ***           Arrête l'emission de son de la GUS                       ***
  632. ; **************************************************************************
  633.   mov dx,w u_base
  634.   in  al,dx
  635.   or  al,2
  636.   out dx,al
  637.   ret
  638. GusSound_fin endp
  639.  
  640. GusSound_deb proc near
  641. ; **************************************************************************
  642. ; ***        Début de l'émission de son (Wavetable) de la GUS            ***
  643. ; **************************************************************************
  644.   mov dx,w u_base
  645.   in  al,dx
  646.   and al,0FDh
  647.   out dx,al
  648.   ret
  649. GusSound_deb endp
  650.  
  651. voice_rampin proc pascal voix:byte,vol : word;
  652. ; **************************************************************************
  653. ; ***          Un moyen de définir directement le volume d'une voix.     ***
  654. ; ***            Le player perd un peu de son agressivité, mais          ***
  655. ; ***              on réduit ainsi les craquements éventuels.            ***
  656. ; **************************************************************************
  657.   mov dx,w u_voice                ; Choisir la voix 
  658.   mov al,byte ptr voix
  659.   out dx,al
  660.   mov dx,w u_command              ; Définit le facteur de Ramping
  661.   mov al,6
  662.   out dx,al
  663.   mov dx,w u_datahi
  664.   mov al,00111111b
  665.   out dx,al
  666.   mov dx,w u_Command              ; Modifie le volume actuel
  667.   mov al,9
  668.   out dx,al
  669.   mov dx,w u_datahi
  670.   mov al,00010010b
  671.   out dx,al
  672.   mov dx,w u_command              ; Définit le volume de départ du ramping
  673.   mov al,7
  674.   out dx,al
  675.   mov dx,w u_datahi
  676.   mov al,00010010b
  677.   out dx,al
  678.   mov dx,w u_command              ; Définit le volume final du Ramping 
  679.   mov al,8
  680.   out dx,al
  681.   mov dx,w u_datahi
  682.   mov di,word ptr vol
  683.   shl di,1
  684.   mov ax,word ptr [offset uVolumes + di]
  685.   shr ax,8
  686.   out dx,al
  687.   mov dx,w u_command              ; Direction du ramping dans le contrôle du volume 
  688.   mov al,0dh                      ; Définit le registre
  689.   out dx,al
  690.   mov dx,w u_datahi
  691.   mov al,0
  692.   out dx,al
  693.   ret
  694. voice_rampin endp
  695.  
  696. voice_slide proc pascal nr,speed : byte,vol : word;
  697.   mov dx,w u_voice                ; choisir la voix
  698.   mov al,byte ptr nr
  699.   out dx,al
  700.   mov dx,w u_command              ; définir le facteur de ramping
  701.   mov al,6
  702.   out dx,al
  703.   mov dx,w u_datahi
  704.   mov al,byte ptr speed
  705.   out dx,al
  706.   mov dx,w u_Command              ; modifie le volume actuel
  707.   mov al,9
  708.   out dx,al
  709.   mov dx,w u_datahi
  710.   mov al,00010010b
  711.   out dx,al
  712.   mov dx,w u_command              ; définit le volume du départ du ramping
  713.   mov al,7
  714.   out dx,al
  715.   mov dx,w u_datahi
  716.   mov al,00010010b
  717.   out dx,al
  718.   mov dx,w u_command              ; définit le volume de fin du ramping
  719.   mov al,8
  720.   out dx,al
  721.   mov dx,w u_datahi
  722.   mov di,word ptr vol
  723.   shl di,1
  724.   mov ax,word ptr [offset uVolumes + di]
  725.   shr ax,8
  726.   out dx,al
  727.   mov dx,w u_command              ; direction du ramping dans le contrôle du volume 
  728.   mov al,0dh                      ; définit le registre
  729.   out dx,al
  730.   mov dx,w u_datahi
  731.   mov al,0
  732.   out dx,al
  733.   ret
  734. voice_slide endp
  735.  
  736. public gus_speaker_on
  737. gus_speaker_on proc pascal
  738.   mov dx,u_base
  739.   mov al,4
  740.   out dx,al
  741.   ret
  742. gus_speaker_on endp
  743.  
  744. public position_voix
  745. position_voix proc pascal voix : word
  746.   mov dx,w u_command
  747.   mov al,4
  748.   out dx,al
  749.   mov dx,w u_datahi
  750.   in  ax,dx
  751.   mov cx,ax
  752.  
  753.   ret
  754. position_voix endp
  755.  
  756. public get_detected_base
  757. get_detected_base proc pascal
  758.   mov ax,u_base
  759.   ret
  760. get_detected_base endp
  761.  
  762. code ends
  763. end
  764.  
  765.  
  766.  
  767.  
  768.  
  769.  
  770.