Point of terminology: Namco 106 vs. Namco 163

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
Point of terminology: Namco 106 vs. Namco 163
by on (#71470)
A regular on another wiki, who might not qualify for trusted on wiki.nesdev.com because he isn't active on the BBS, sent me a message on my talk page at that wiki explaining why Namco 106 audio might need a rename.

by on (#71471)
Just like "FME-7" audio needs a rename?

by on (#71486)
Well did someone ever encounter a Namco "106" chip ?
There SHOULD be a reason why it was initially called like that.

by on (#71582)
List of Namcot 163 carts > http://bootgod.dyndns.org:7777/search.p ... wtype=chip

Of those Namcot 163 chip games, those that use expansion audio:

Dokuganryuu Masamune
Erika to Satoru no Yume Bouken
Final Lap
King of Kings
Mappy Kids
Megami Tensei II: Digital Devil Story
Rolling Thunder
Sangokushi II: Haou no Tairiku


Hydlide 3: Yami Kara no Houmonsha -- Expansion chip flag is set in NSF, but no expansion audio is used on any track.
Namcot Classic 2 -- Ditto.
Sangokushi: Chuugen no Hasha -- Ditto.

Wagyan Land 2 NSF says that it uses "N106" but does not actually have expansion sound and uses Namcot 175.

I don't seem to see any Namcot 106 games in BootGod's database either.

Namcot games documented in BootGod's database: http://bootgod.dyndns.org:7777/search.p ... &order=asc

The Namcot games mostly look like they use epoxy blobs and the mapper chip is assigned the position of "U3".

I'm wondering what games do use Namcot 106 and why they were initially classified as N106. This would take prodding through older NES emulators and going through the old NESdev BBS...

by on (#73693)
B00daW wrote:
Hydlide 3: Yami Kara no Houmonsha -- Expansion chip flag is set in NSF, but no expansion audio is used on any track.
Namcot Classic 2 -- Ditto.
Sangokushi: Chuugen no Hasha -- Ditto.

Oh, so I should remove those from this list, then?
http://nesdev.com/bbs/viewtopic.php?p=25189
(edit, already did)

And what's the deal with FME-7 again? I recall seeing something about this. Does it have a more appropriate name?

by on (#74462)
http://bootgod.dyndns.org:7777/imagegen ... &width=600 < Gimmick! cart.

The only difference between Sunsoft 5B and FME-7 (which is used by Dynamite Batman) is the full AY chip is found in the Sunsoft 5B.

Quoting Disch:

Code:
Sound:
---------------------------

Sunsoft 5B appears to be identical to the AY 3-8910 (or a similar chip -- possibly a different AY 3-891x or a
YM2149).  The only game to use the sound, Gimmick!, does not use the envelope or noise functionality that
exists on the AY 3-891x, however, through testing it has been shown that such functionality does in fact
exist.

The sound info below is a simplified version of the behavior.  Envelope and Noise are not covered (aside from
the noise shift formula), and registers relating to those areas are not mentioned.  However the information
below is enough to satisfy Gimmick!  If you want further information and full register descriptions, consult
an AY 3-8910 datasheet or doc.

Sunsoft 5B has 3 Square channels (no configurable duty cycle -- always play at 50% duty).  Each operate
similarly to the native NES sound channels.  They output sound at 1 octave lower than what may be expected,
though (see below).


Sound Regs:
---------------------------

  $C000:  [.... AAAA]   Address for use with $E000

  $E000:  [DDDD DDDD]   Data port:

      R:0 ->   [FFFF FFFF]   Chan 0, Low 8 bits of Freq
      R:1 ->   [.... FFFF]   Chan 0, High 4 bits of Freq
      R:2 ->   [FFFF FFFF]   Chan 1, Low 8 bits of Freq
      R:3 ->   [.... FFFF]   Chan 1, High 4 bits of Freq
      R:4 ->   [FFFF FFFF]   Chan 2, Low 8 bits of Freq
      R:5 ->   [.... FFFF]   Chan 2, High 4 bits of Freq

      R:7 ->   [.... .CBA]   Channel disable flags (0=enabled, 1=disabled)
           C = Disable Chan 2
           B = Disable Chan 1
           A = Disable Chan 0

      R:8 ->   [.... VVVV]   Chan 0, Volume
      R:9 ->   [.... VVVV]   Chan 1, Volume
      R:A ->   [.... VVVV]   Chan 2, Volume


Operation:
---------------------------

For tone generation, a counter is counted up each CPU cycle.  When it reaches the given 'F' value, it resets
to zero, and another step through the duty cycle is taken.  These squares' duty cycles are fixed at 50%
(AY 3-8910 docs say 8/16, but see below).

Emulating in this fashion, with a 16-step duty, these channels play 1 octave higher than they should!
Therefore, either channels are only clocked every other CPU cycle... or (what I find to be easiest to
emulate) the duty is actually 16/32 instead of 8/16, or something else is going on.  I do not know which is
actually happening.

The generated tone in Hz can be calculated with the following:

       CPU_CLOCK
Hz = -------------
      (F+1) * 32


When the duty cycle outputs high, 'V' is output, otherwise 0 is output.  When the channel is disabled (see
R:7), 0 is forced as output for the channel.


Non-linear volume:
---------------------------

Output volume is non-linear... increasing in steps of 3 dB.

Output can be calculated with the following pseudo-code:

  vol = 1.0;
  for(i = 0; i < 0x10; ++i)
  {
    sunsoft_out[i] = vol * base;
    vol *= step;
  }

Where 'base' can be adjusted to match your native NES sound channel levels, and 'step' is "10^(dB/20)".

For 3 dB, 'step' would be ~1.4125


Noise Formula:
---------------------------

      >>             >>
+-->[nnnn nnnn nnnn nnnn]->output
|                   |  |
|                   | ++
|                   | |
|                   v v
+-------------------XOR
   

- 16-bit right-shift reg
- bits 0,3 (before shift) XOR to create new input bit
- bit 0 is shifted to output
- initial feed is 1


http://www.ym2149.com/ay8910.pdf < AY datasheet.

So from what we can determine from Disch's notes is the envelope and noise generator registers are missing from most emulators because Gimmick! does not use them.

If we were to program for the Sunsoft 5B, we would set the AY register with $C000, let's say #$06 for noise (or #$0B, #$0C, or #$0D for envelope), and then write data to those registers through $E000.

The AY is capable of interchanging pulse to noise for all three of its channels with its mixer register and the envelope register is capable of producing an additional "buzzer" channel by quick modulation; making the AY generally a 3 +1 virtual channel sound chip.

For chip music, it2nsf (http://mukunda.com/projects.html) currently supports limited Sunsoft 5B support; meaning only the three channels as pulses.

If the full AY were emulated on PowerPak, Nintendulator, Nestopia, player plugins, etc... there would be more chances for original 2a0x+AY chip music. :) We're already partially there... ;D