It is currently Fri Oct 20, 2017 11:14 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 53 posts ]  Go to page Previous  1, 2, 3, 4
Author Message
PostPosted: Sun Feb 05, 2017 5:36 pm 
Offline
User avatar

Joined: Mon Dec 29, 2014 1:46 pm
Posts: 710
Location: New York, NY
Regarding Cvetnye Linii (Color Lines), Nintendulator appears to fully reset the APU on reset. In the snippet below, the power on code is identical to the reset code, including clearing the IRQ request flags:

Code:
void   PowerOn  (void)
{
#ifndef   NSFPLAYER
   ZeroMemory(Regs, 0x18);
#endif   /* !NSFPLAYER */
   Frame::PowerOn();
   Square0::PowerOn();
   Square1::PowerOn();
   Triangle::PowerOn();
   Noise::PowerOn();
   DPCM::PowerOn();
   Race::PowerOn();
   Cycles = 1;
   CPU::WantIRQ &= ~(IRQ_FRAME | IRQ_DPCM);
   InternalClock = 0;
}
void   Reset  (void)
{
#ifndef   NSFPLAYER
   ZeroMemory(Regs, 0x18);
#endif   /* !NSFPLAYER */
   Frame::Reset();
   Square0::Reset();
   Square1::Reset();
   Triangle::Reset();
   Noise::Reset();
   DPCM::Reset();
   Race::Reset();
   Cycles = 1;
   CPU::WantIRQ &= ~(IRQ_FRAME | IRQ_DPCM);
   InternalClock = 0;
}


This may not reflect actual hardware behavior. Per the discussion above, I suspect that Cvetnye Linii (Color Lines) won't reset properly on a real system.

In any case, should emulators fully reset the APU on reset?


Top
 Profile  
 
PostPosted: Sun Feb 05, 2017 6:51 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5725
Location: Canada
Reset at least silences the APU (like writing 0 to $4015). Reset doesn't affect any expansion audio that I know of, though.

I'm not sure about the rest of it. Silence via $4015 requires at least the high byte of frequency to be reloaded before they can produce sound again, but I haven't really tested if the other registers have surviving information.

I think lidnariq determined that the noise LFSR was reset to 0 as well?

Mega Man seems to rely on sweep being disabled at least at power-on (i.e. the "game genie" sound problem), not sure if it's affected by reset.

$4017 is not reset, as discussed early.


Top
 Profile  
 
PostPosted: Sun Feb 05, 2017 7:02 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6287
Location: Seattle
No, the noise LFSR is left as-is. It just comes out of a cold boot all 0, like most other things in the CPU. (due to how NMOS works, I suspect.)

As far as what things are cleared on warm boot? I've been meaning to sit down with Visual2A03 and find every stupid place that _res winds through, but there's an awful lot of them: 312.


Top
 Profile  
 
PostPosted: Sun Feb 05, 2017 7:04 pm 
Offline
User avatar

Joined: Mon Dec 29, 2014 1:46 pm
Posts: 710
Location: New York, NY
rainwarrior wrote:
$4017 is not reset, as discussed early.


Agreed. But, there might be many poorly tested games out there that fail on reset, not just this Dendy ROM. Are there any side effects to fully resetting the APU on reset? Will any games actually break? Since Cvetnye Linii (Color Lines) resets properly in most emulators, I suspect all of them are already resetting the APU on reset.


Top
 Profile  
 
PostPosted: Sun Feb 05, 2017 7:21 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6287
Location: Seattle
To briefly summarize: Of the 312283 (I forgot to deduplicate) nodes that are cleared during reset, (at least) 161159 are given names in Visual2A03:
* frame_irq (acknowledging the IRQ but not disabling it)
* frm_c
* snd_halt
* spr_addrX (to cleanly abort an in-progress DMA, I assume)
* sq0_cX, sq0_envcX, sq0_envtX, sq0_lenX, sq0_on, sq0_swptX, sq0_tX
* sq1_cX, sq1_envcX, sq1_envtX, sq1_lenX, sq1_on, sq1_swptX, sq1_tX
* tri_cX, tri_lcX, tri_lenX, tri_on, tri_tX
* noi_envcX, noi_envtX, noi_lenX
* pcm_aXX, pcm_bitsX, pcm_en, pcm_irq, pcm_lcXX, pcm_on


Last edited by lidnariq on Mon Feb 06, 2017 1:56 pm, edited 2 times in total.

Top
 Profile  
 
PostPosted: Sun Feb 05, 2017 7:28 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5725
Location: Canada
zeroone wrote:
Are there any side effects to fully resetting the APU on reset? Will any games actually break?

Except for $4017 the registers are write only. I think the only way it can affect anything but sound is through an IRQ? (DPCM and/or Frame Counter.)

So... the consequences of an incorrectly initialized APU are quite low, especially since it's silenced by the reset.

lidnariq wrote:
No, the noise LFSR is left as-is. It just comes out of a cold boot all 0, like most other things in the CPU. (due to how NMOS works, I suspect.)

Ah, thanks for the clarification.

lidnariq wrote:
To briefly summarize: Of the 312 nodes that are cleared during reset, (at least) 161 are given names in Visual2A03:
* frame_irq (acknowledging the IRQ but not disabling it)
* frm_c
* snd_halt
* spr_addrX (to cleanly abort an in-process DMA, I assume)
* sq0_cX, sq0_envcX, sq0_envtX, sq0_lenX, sq0_on, sq0_swptX, sq0_tX
* sq1_cX, sq1_envcX, sq1_envtX, sq1_lenX, sq1_on, sq1_swptX, sq1_tX
* tri_cX, tri_lcX, tri_lenX, tri_on, tri_tX
* noi_envcX, noi_envtX, noi_lenX
* pcm_aXX, pcm_bitsX, pcm_en, pcm_irq, pcm_lcXX, pcm_on

Interesting!


Top
 Profile  
 
PostPosted: Mon Feb 06, 2017 1:56 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6287
Location: Seattle
Ok, I made an effort to trace down the remaining nodes.

Of the 283 unique nodes that are grounded during +RESET, 159 are as above.
Another 22×4=88 nodes keep the address bus, OUTn, /JOYn, and R/W pins Hi-Z during +RESET.
(You'll notice M2 is not in the list. reset goes through several extra inverters before eventually disabling the drivers for M2, so they're not counted in the 283)

6: The upper six bits of the delta channel DAC (W4011) are cleared (but not the LSB)
8: The DPCM shift register is cleared.
4: The lower four bits of noise frequency register (W400E) are cleared (but not the noise/tonal bit)
4: The lower four bits of the channel enable register (W4015) are cleared (but not the DPCM in-progress flag)
1: glue node for connecting the outer 2A03 hardware to the 6502

The remaining 13 nodes I kinda gave up on; they are mostly related to DPCM and DPCM DMA.
(they are : somethings pertaining to [apu_clk2 ; the frame sequencer ; -reset ; 2x pcm_doadjust ; 2x rdy ; use_spr_ab ; 2x noi_t ; pcm_t ; dpcm ; dpcm dma] )

The attached text file are my added set of node names for Visual2A03. You'll want to remove or improve the "something_XXX" node names rather than using my terrible halfassed names.


Attachments:
new_nodenames_for_reset.txt [2.79 KiB]
Downloaded 23 times
Top
 Profile  
 
PostPosted: Thu Feb 16, 2017 8:05 pm 
Offline

Joined: Tue Nov 23, 2004 9:35 pm
Posts: 615
The Aladdin Deck Enhancer ROM of Micro Machines does not hang on the menu screens when I press the reset button on my Famicom and AV Famicom. It only mutes the sound until the screen changes. Sometimes the graphics may appear garbled for a second, but they will appear normally thereafter. The European ROM of Micro Machines always does a proper reset on my Famicom and AV Famicom regardless of the screen you are on. The European ROM does not adjust the speed in any way for PAL machines, it runs perfectly on an NTSC console.

_________________
Nerdly Pleasures - My Vintage Video Game & Computing Blog


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 53 posts ]  Go to page Previous  1, 2, 3, 4

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group