I currently have a code in Assembly that allows me to write a sound and play it. I need to test it on a Windows DualCore 2007 with XP-32 and wired speakers connected to the tower, but the sound comes out of the tower and I can't find a solution to how to make the speakers play the sound. mon code est le suivant, dans le fichier sound.inc :
section .data
clock dw 0
time dw 119
tour dw 0
frequence dw 0
Cg dw 9121
C#g dw 8609
Dg dw 8126
D#g dw 7670
Eg dw 7239
Fg dw 6833
F#g dw 6449
Gg dw 6087
G#g dw 5746
Ag dw 5423
A#g dw 5119
Bg dw 4831
C dw 4560
C# dw 4304
D dw 4063
D# dw 3834
E dw 3619
F dw 3416
F# dw 3224
G dw 3043
G# dw 2873
A dw 2711
A# dw 2559
B dw 2415
section .text
Cg_note:
mov ax, [Cg]
mov [frequence], ax
ret
C#g_note:
mov ax, [C#g]
mov [frequence], ax
ret
Dg_note:
mov ax, [Dg]
mov [frequence], ax
ret
D#g_note:
mov ax, [D#g]
mov [frequence], ax
ret
Eg_note:
mov ax, [Eg]
mov [frequence], ax
ret
Fg_note:
mov ax, [Fg]
mov [frequence], ax
ret
F#g_note:
mov ax, [F#g]
mov [frequence], ax
ret
Gg_note:
mov ax, [Gg]
mov [frequence], ax
call play_note
ret
G#g_note:
mov ax, [G#g]
mov [frequence], ax
ret
Ag_note:
mov ax, [Ag]
mov [frequence], ax
ret
A#g_note:
mov ax, [A#g]
mov [frequence], ax
ret
Bg_note:
mov ax, [Bg]
mov [frequence], ax
ret
C_note:
mov ax, [C]
mov [frequence], ax
call play_note
ret
C#_note:
mov ax, [C#]
mov [frequence], ax
ret
D_note:
mov ax, [D]
mov [frequence], ax
call play_note
ret
D#_note:
mov ax, [D#]
mov [frequence], ax
ret
E_note:
mov ax, [E]
mov [frequence], ax
call play_note
ret
F_note:
mov ax, [F]
mov [frequence], ax
ret
F#_note:
mov ax, [F#]
mov [frequence], ax
ret
G_note:
mov ax, [G]
mov [frequence], ax
ret
G#_note:
mov ax, [G#]
mov [frequence], ax
ret
A_note:
mov ax, [A]
mov [frequence], ax
ret
A#_note:
mov ax, [A#]
mov [frequence], ax
ret
B_note:
mov ax, [B]
mov [frequence], ax
ret
play_note:
mov al, 182 ; Prepare the speaker for the note.
out 43h, al ; Send the value to port 43h.
mov ax, [frequence]
out 42h, al ; Output low byte.
mov al, ah ; Output high byte.
out 42h, al
in al, 61h
or al, 00000011b ; Set bits 1 and 0.
out 61h, al ; Send new value.
call extendNote
inc bx
ret
extendNote:
push bx
mov cx, 9121
mov bx, 20
.pause1:
mov cx, 2500
.pause2:
dec cx
jne .pause2
dec bx
jne .pause1
in al, 0x61. ; stop the note
and al, 11111100b
out 0x61, al
pop bx
ret
movMelody:
add word [time], 1
cmp word [time], 120
jne .skipChangeNote
mov word [time], 0
mov bx, [tour]
cmp bx, 0
call Gg_note ; call the sound procedure
cmp bx, 2
call C_note
cmp bx, 4
call D_note
cmp bx, 6
call E_note
cmp bx, 8
call Gg_note
.skipChangeNote:
call play_note
ret