我正在尝试使用 8086 组件生成具有特定频率的声音。我已经搜索和搜索,发现了很多关于连接到扬声器(不是 PC 扬声器)的代码。然而,它们似乎都不起作用。以下是我的代码:
mov al, 182 ; meaning that we're about to load
out 43h, al ; a new countdown value
mov ax, 2153 ; countdown value is stored in ax. It is calculated by
; dividing 1193180 by the desired frequency (with the
; number being the frequency at which the main system
; oscillator runs
out 42h, al ; Output low byte.
mov al, ah ; Output high byte.
out 42h, al
in al, 61h
; to connect the speaker to timer 2
or al, 00000011b
out 61h, al ; Send the new value
我认为这应该会产生声音,直到我们设法告诉扬声器关闭。尽管如此,还是听不到任何声音。你能告诉我代码有什么问题吗?