nes.c
来自「这个是延伸mame的在wince平台下的游戏模拟器的代码」· C语言 代码 · 共 45 行
C
45 行
/***************************************************************************
nes.c
Emulation of the sound chip used on the NES and in some Nintendo arcade
games (Donkey Kong 3, Punch Out).
Hardware info by Jeremy Chadwick and Hedley Rainne.
Based on psg.c.
As of this moment, everything in here is totally wrong and largely
incomplete, but it is enough to hear some recognizable tunes.
***************************************************************************/
/***************************************************************************
NES sound hardware info by Jeremy Chadwick and Hedley Rainne
For the Square Wave and Triangle Wave channels, a formulae can be used
to provide accurate playback of the NES's sound:
P = 111860.78 / (CHx + 1)
Where "P" is the actual played data, and CHx is the channel played.
The channel formulaes are the following:
CH1 = $4002 + ($4003 & 7) * 256 (Square Wave #1)
CH2 = $4006 + ($4007 & 7) * 256 (Square Wave #2)
CH3 = $400A + ($400B & 7) * 256 (Triangle Wave)
Where the $400x values are actual values written to that register.
For the PCM channel, there are two methods of implementation: via DMA,
and via the PCM Volume Port ($4011).
Samples are sent byte-by-byte into $4011, the result being quite
audible. However, only a few games seem to use this method, while most
use the DMA transfer approach.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?