APU need your hand

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
APU need your hand
by on (#131201)
Hello everyone :) , I implemented my emulator's APU in 21st April. But there were some problems with it.
Today, sound effect is still very strange and I can't find the reason.

for example
SMB1:
As we all know, when mario jump and drag the flag and the game time is end with 1, 3 or 6, there will be 1, 3 or 6 boom(s) sound.
But my emulator doesn't generate that sound. If you just want the emulator to generate that sound, you must press START button,
then press START button again(i.e. unpaused game).
Battle City:
when my tank distances the wall a little bit far, bullets shotting the wall has no sound.
Castlevania:
The game's bgm volume is low, when I acquiring a tool(i.e. red heart, knife, watch, and so on) the volume is noraml, when I acquired
the volume is low again.

Do you enconter something like that? Could you like to give me some advice to fix my emulator's probelms?
Re: APU need your hand
by on (#131203)
If you have to pause and unpause to get a sound to happen, maybe it has something to do with how you emulate the enable bits in $4015?

Writing to $4015 will alter a channel's enable bit.
Reading from $4015 doesn't return the state of the enable bit for a channel, but instead: (enable bit) && (length counter > 0)

This means to reactivate sound on a channel that has gone silent due to the length counter, you do not have to write $4015 again. You only need to reload its length counter (e.g. $4003/4007).

Are you having the length counter turning off the enable by mistake? When the length counter is 0, reading $4015 should also return 0 for that channel, but the enable value written to $4015 should stay the same.



Not sure what to suggest for your Castlevania volume problems. Maybe you are accidentally applying one channel's volume to all channels? I don't know.
Re: APU need your hand
by on (#131266)
Thank you all the same.
Re: APU need your hand
by on (#131356)
Boolean wrote:
Hello everyone :) , I implemented my emulator's APU in 21st April. But there were some problems with it.
Today, sound effect is still very strange and I can't find the reason.

for example
SMB1:
As we all know, when mario jump and drag the flag and the game time is end with 1, 3 or 6, there will be 1, 3 or 6 boom(s) sound.
But my emulator doesn't generate that sound. If you just want the emulator to generate that sound, you must press START button,
then press START button again(i.e. unpaused game).
Battle City:
when my tank distances the wall a little bit far, bullets shotting the wall has no sound.
Castlevania:
The game's bgm volume is low, when I acquiring a tool(i.e. red heart, knife, watch, and so on) the volume is noraml, when I acquired
the volume is low again.

Do you enconter something like that? Could you like to give me some advice to fix my emulator's probelms?

兄弟是中国人?
Re: APU need your hand
by on (#131369)
是啊,真巧。 :D
在这里遇到中国人不容易。
你也在开发模拟器吗? 遇到过我出现的问题吗?

(下面的翻译只是方便外国人观看,别介意)

Translate to English:
Yes, I am.:D
It's hard to find a Chinese.
Are you developing an emulator? Did you encounter some problems like mine?
Re: APU need your hand
by on (#131377)
Boolean wrote:
是啊,真巧。 :D
在这里遇到中国人不容易。
你也在开发模拟器吗? 遇到过我出现的问题吗?

(下面的翻译只是方便外国人观看,别介意)

Translate to English:
Yes, I am.:D
It's hard to find a Chinese.
Are you developing an emulator? Did you encounter some problems like mine?


我本来是在更新nestopia,现在放弃了,等有时间重新写一个吧,要不GPL什么的,弄得我烦
不过FC快到头了,我已没有什么可以DUMP的ROM,除了FDS转NES的恶魔城完全版,还没搞这模拟
Re: APU need your hand
by on (#131391)
zxbdragon wrote:
我本来是在更新nestopia,现在放弃了,等有时间重新写一个吧,要不GPL什么的,弄得我烦
不过FC快到头了,我已没有什么可以DUMP的ROM,除了FDS转NES的恶魔城完全版,还没搞这模拟

你付出了努力,放弃了多可惜啊。只要继续开源的话应该没什么问题,而且可以让nestopia更强大。
其实,我认为研究FC也没什么到头不到头的,我研究它主要就是出于怀旧之情,也许你有其他原因。
我最近发现淘宝上有400-in-1的卡,据说不重复,你可以尝试dump一下。
Re: APU need your hand
by on (#131395)
Boolean wrote:
zxbdragon wrote:
我本来是在更新nestopia,现在放弃了,等有时间重新写一个吧,要不GPL什么的,弄得我烦
不过FC快到头了,我已没有什么可以DUMP的ROM,除了FDS转NES的恶魔城完全版,还没搞这模拟

你付出了努力,放弃了多可惜啊。只要继续开源的话应该没什么问题,而且可以让nestopia更强大。
其实,我认为研究FC也没什么到头不到头的,我研究它主要就是出于怀旧之情,也许你有其他原因。
我最近发现淘宝上有400-in-1的卡,据说不重复,你可以尝试dump一下。


没有购,我就是为了怀旧,同时也为了我怀旧站www.nesbbs.com
400-in-1,mapper是FK23C,重复的游戏一堆
nestopia的架构有一些问题,所以我暂时放弃,等我不加班了,自己写一个,
开源不开源,我不想管,但nestopia plus!,已重构,基本上和原版区别很大,所以我准备重新写.
不过我暂时没有什么可以DUMP的卡了,我DUMP一个合卡,就几分钟的事.
低于9合一的卡,模拟也就是几分钟的事
Re: APU need your hand
by on (#131398)
zxbdragon wrote:
不过我暂时没有什么可以DUMP的卡了,我DUMP一个合卡,就几分钟的事.

我没dump过卡带,不过你看我的思路对不对?下面是把卡带外壳扣掉的芯片。
-------
GND |01 31| +5V
PRG A11 |02 32| M2
PRG A10 |03 33| PRG A12
PRG A9 |04 34| PRG A13
PRG A8 |05 35| PRG A14
PRG A7 |06 36| PRG D7
PRG A6 |07 37| PRG D6
PRG A5 |08 38| PRG D5
PRG A4 |09 39| PRG D4
PRG A3 |10 40| PRG D3
PRG A2 |11 41| PRG D2
PRG A1 |12 42| PRG D1
PRG A0 |13 43| PRG D0
PRG R/W |14 44| PRG /CE (/A15 + /M2)
/IRQ |15 45| Audio from 2A03
GND |16 46| Audio to RF
CHR /RD |17 47| CHR /WR
CIRAM A10 |18 48| CIRAM /CE
CHR A6 |19 49| CHR /A13
CHR A5 |20 50| CHR A7
CHR A4 |21 51| CHR A8
CHR A3 |22 52| CHR A9
CHR A2 |23 53| CHR A10
CHR A1 |24 54| CHR A11
CHR A0 |25 55| CHR A12
CHR D0 |26 56| CHR A13
CHR D1 |27 57| CHR D7
CHR D2 |28 58| CHR D6
CHR D3 |29 59| CHR D5
+5V |30 60| CHR D4
-------
dump设备要
1.设置CHR A0-A13的值从$0000~$1FFF, 每设置一个值从CHR D0-D7读取一次。
2.设置PRG A0-A15的值从$8000~$FFFF, 每设置一个值从PRG D0-D7读取一次。
这样的话Mapper0的全部内容就dump出来了。
Re: APU need your hand
by on (#136801)
rainwarrior wrote:
If you have to pause and unpause to get a sound to happen, maybe it has something to do with how you emulate the enable bits in $4015?

Writing to $4015 will alter a channel's enable bit.
Reading from $4015 doesn't return the state of the enable bit for a channel, but instead: (enable bit) && (length counter > 0)

This means to reactivate sound on a channel that has gone silent due to the length counter, you do not have to write $4015 again. You only need to reload its length counter (e.g. $4003/4007).

Are you having the length counter turning off the enable by mistake? When the length counter is 0, reading $4015 should also return 0 for that channel, but the enable value written to $4015 should stay the same.



Not sure what to suggest for your Castlevania volume problems. Maybe you are accidentally applying one channel's volume to all channels? I don't know.


I figure it out.
It's the Envelope Generator problem.
I rewrite it. The audio is better than before.