⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nes.c

📁 这个是延伸mame的在wince平台下的游戏模拟器的代码
💻 C
字号:
/***************************************************************************

  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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -