Page 2 of 2

Re: Bomberman hangs on opening title

Posted: Sat Jan 10, 2015 10:29 am
by WedNESday
Anes wrote:The thing is that you have reached as experienced developer emu author and/or .rom author.
Anes wrote:And no offense to you, but everybody was a begginer at first and needed help (like you) to work around a problem.
Yep, they are correct.
Anes wrote:I remember when you were a beginner and made question such as "is there not a technical doc othat NES 2C02 reference??" Making note that it was too difficult to you. (i don't wan't to search the link for your old post, but you remember it don't you?)
Sorry, but you'll have to find the original post.
Anes wrote:So, if you think the question or issue somebody expose here is too "noob" remember your old days when you had the Signature "Wednesday, the best emulator in the net.... well according to the author" and don't reply the noob question if you think so.
For crying out loud. The signature was a joke. And I think people knew that. More importantly, I never called anyone a 'noob'. In fact, if you scroll back up you'll see that I made couple of posts that actually helped the guy.

I make a fair point that people need to be more descriptive about what they have and haven't implemented part A of the CPU of part D of the PPU. That way we can help diagnose the problem sooner.

Re: Bomberman hangs on opening title

Posted: Sat Jan 10, 2015 4:59 pm
by tepples
WedNESday wrote:it annoys me so much that people come to this forum with problems like this before they have even implemented even the most basic of CPU accuracy and then ask us why game A or B doesn't work properly.
Perhaps austere thought it was like DOSBox, where games don't care exactly how many cycles they're given so long as it's roughly comparable to the MIPS of the actual CPU.
austere wrote: I was actually surprised that most things I've thrown at it worked fairly well, even Shatterhand which has faux parallax scrolling.
MMC3 games tend to handle parallax scrolling acceptably even with inaccurate cycle counts because the PIT (programmable interrupt timer) frees the engine from having to count cycles or spin on sprite 0.

Re: Bomberman hangs on opening title

Posted: Sat Jan 10, 2015 11:34 pm
by austere
tepples wrote:Perhaps austere thought it was like DOSBox, where games don't care exactly how many cycles they're given so long as it's roughly comparable to the MIPS of the actual CPU.
I know what you mean but no, I'm *not being ignorant of the timing model of the NES. I'm currently finishing a PhD in electronic engineering (microelectronics) so I do appreciate the importance of timing which is I was quite surprised it worked fine for the most part as my prior post shows:
austere wrote:I never really expected many games to run given that I didn't account for page crossing and branch adjustment cycles
The current version uses scanline emulation of the PPU so it wouldn't make too big a difference if it was sprite 0 collision detection at fault. More likely something to do with the vertical blanking.

I'll improve instruction timing and report if it made any difference. If it didn't, it's probably something else Bomberman is expected that the other games are not... might be a really silly bug I'm missing.

* Oops typo.

Re: Bomberman hangs on opening title

Posted: Sun Jan 11, 2015 5:26 am
by WedNESday
austere how good is your CPU emulation in terms of opcode accuracy? Have you run nestest.nes? If so, what are the results?

Re: Bomberman hangs on opening title

Posted: Sun Jan 11, 2015 6:07 am
by austere
The core passes kevtris's test and the more thorough one for all official opcodes.

I just upgraded the core so that it accounted for the extra cycle because of the carry calculation for page crossing. That got it passing blargg's VBL test and sprite hit bottom test. Still no dice on bomberman, will investigate it further tomorrow.

Re: Bomberman hangs on opening title

Posted: Sun Jan 11, 2015 8:44 am
by tokumaru
Fixing random things is not the best way to solve a problem like this. The best thing to do would be to compare execution logs against an emulator where the game works, so you know exactly when things go to shit.

Re: Bomberman hangs on opening title

Posted: Sun Jan 11, 2015 9:49 am
by WedNESday
tokumaru wrote:Fixing random things is not the best way to solve a problem like this. The best thing to do would be to compare execution logs against an emulator where the game works, so you know exactly when things go to shit.
How is he fixing random things? Its obviously the CPU and he is going the correct way about it.

Any chance that you could post the CPU source? When we have had the chance previously to directly view others we've been able to help out so much quicker.

Re: Bomberman hangs on opening title

Posted: Sun Jan 11, 2015 11:46 am
by austere
WedNESday wrote:Any chance that you could post the CPU source? When we have had the chance previously to directly view others we've been able to help out so much quicker.
Sure thing!

https://bitbucket.org/austere/finalnes/ ... ?at=master

That's the latest committed version. In that directory you'll also find nes.h and cpu6502_info.cpp which contains the table it uses to decode the instructions/get the base timing, but most of what you'll be interested in is under the Cpu:: section. When I wrote the core (mostly over weekend 4 years ago) I planned to use templates for the addressing modes, but at least this way it makes it easier to follow and debug. When it's stable, performance can be improved.

... And don't mind the apu/ppu code, it's quite a mess at the moment. :P

Re: Bomberman hangs on opening title

Posted: Fri Jan 16, 2015 8:48 am
by x0000
Make sure you pass CLI latency tests

Re: Bomberman hangs on opening title

Posted: Fri Jan 16, 2015 12:34 pm
by WedNESday
x0000 wrote:Make sure you pass CLI latency tests
That has nothing to do with his problem. Old versions of WedNESday ran Bomberman no problem and that was before I emulated CLI/SEI/PLP latency.

Re: Bomberman hangs on opening title

Posted: Fri Jan 16, 2015 6:20 pm
by x0000
WedNESday wrote: That has nothing to do with his problem.
Not sure about that. If I recall correctly there is a typical problem that Bomberman has an active VBlank waiting via reading ppu status with NMI enabled at the same time, and it is clearing VBlank flag in NMI routine. So it could lead to infinte wait for VBlank flag if it was not read before NMI had vectorised.

Re: Bomberman hangs on opening title

Posted: Sat Jan 17, 2015 4:56 am
by WedNESday
x0000 wrote:Not sure about that. If I recall correctly there is a typical problem that Bomberman has an active VBlank waiting via reading ppu status with NMI enabled at the same time, and it is clearing VBlank flag in NMI routine. So it could lead to infinte wait for VBlank flag if it was not read before NMI had vectorised.
And what does that have to do with CLI latency?

Regardless, that would cause it to freeze on real both emulators + real hardware let alone 1 person's emulator.

Re: Bomberman hangs on opening title

Posted: Sat Jan 17, 2015 8:12 am
by x0000
WedNESday wrote:And what does that have to do with CLI latency?
Regardless, that would cause it to freeze on real both emulators + real hardware let alone 1 person's emulator.
It is not freezing on a real hardware because ppu status is read just before NMI being invoked. Therefore you need a correct logic to handle interrupt triggering flags for NMI and IRQ, cli latency tests would help with that. NMI rising timing can also be an issue here, but it is harder to get it wrong I think.