It is currently Fri Sep 21, 2018 3:02 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 14 posts ] 
Author Message
PostPosted: Thu Jul 12, 2018 11:18 am 
Offline
User avatar

Joined: Thu May 31, 2018 11:12 am
Posts: 153
Location: Bristol, England
The Wikipedia page on the chip (en.m.wikipedia.org/wiki/CIC_(Nintendo))
says that the chip resets every cycle, but the NesDev Wiki (http://wiki.nesdev.com/w/index.php/CIC_lockout_chip) implies it resets every second (1Hz square wave). Which is true? If it resets every second, could a game with no CIC be created by using RAM persistence over resets to hold state information?
By the way, this is my first post


Top
 Profile  
 
PostPosted: Thu Jul 12, 2018 11:28 am 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 7532
Location: Seattle
orlaisadog wrote:
If it resets every second, could a game with no CIC be created by using RAM persistence over resets to hold state information?
Yes.

I made a trivial proof-of-concept of something like this that plays a simple song: viewtopic.php?t=14899&p=184247#p184247


Top
 Profile  
 
PostPosted: Thu Jul 12, 2018 11:29 am 
Offline
User avatar

Joined: Thu May 31, 2018 11:12 am
Posts: 153
Location: Bristol, England
So this could help make one of those 1 chip cartridges?


Top
 Profile  
 
PostPosted: Thu Jul 12, 2018 11:34 am 
Offline
User avatar

Joined: Thu May 31, 2018 11:12 am
Posts: 153
Location: Bristol, England
Also, would this cause a flashing screen because of PPU resets?


Top
 Profile  
 
PostPosted: Thu Jul 12, 2018 12:06 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 6809
Location: Canada
Yes, a reset can cause a TV to lose signal. On a CRT they come back up really quick, but a lot of modern TVs take a few seconds, so the continual reset might make them unable to display any picture or sound at all. (Depends on the TV.)


Top
 Profile  
 
PostPosted: Thu Jul 12, 2018 12:28 pm 
Offline
User avatar

Joined: Thu May 31, 2018 11:12 am
Posts: 153
Location: Bristol, England
Which colour would the flashes be and how long? 2 frames for PPU initialization? On a CRT, could it be disguised as a lightning strike if the game has a rain effect or would that be too annoying? Anything else I'd need to know if I did this?


Top
 Profile  
 
PostPosted: Thu Jul 12, 2018 12:51 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 9:28 pm
Posts: 3600
Location: Mountain View, CA
The colours vary per PPU (read: per NES console). Really. It's been discussed before. (see Quietust's response). Grey is the most common, but I think every single person here has seen variance (some shade of green, peach, or red).

As for the duration: on the NES side, it's consistent (I believe every 1 second), but the real-world results (on screen) are going to vary because of what rainwarrior said. CRTs tend to handle video signal being dropped (line held low) quickly, so visually you see the screen flashing every 1 second. LCDs and other present-day TVs don't tend to do this, they tend to "screw around" a lot (often for several seconds) when the video signal is lost and restored; it usually has to do with logic relating to determining signal "type" (ex. 240p vs. 480p vs. 480i). So you might not see anything on Model X of a Samsung LCD, while Model Y of a Samsung LCD might show something, and Model B of a Sony might behave similarly to a CRT. There is tremendous variance that you have no control over, sadly.

If you're developing something that requires you to have specific timing or are concerned about this for a good reason, I would suggest using an actual CRT for testing/development, rather than fighting with the idiocies of LCD behaviour. Another possibility I suppose would be to use an oscilloscope instead of a TV; I imagine lidnariq could talk about that (I sure can't).

Maybe it would help us if you explained why you're asking the question. It's a good first time post and legitimate question, but your follow-up questions are perplexing -- one of those "why does this person care about that" scenarios. If we understand better the "why", maybe we can help you better. :-)


Top
 Profile  
 
PostPosted: Thu Jul 12, 2018 12:58 pm 
Offline
User avatar

Joined: Thu May 31, 2018 11:12 am
Posts: 153
Location: Bristol, England
I'm doing it for:
A: Fun
and
B: viewtopic.php?f=2&t=9342&start=90
If there was a competition I think I have an idea for a Mario game with 1 chip


Top
 Profile  
 
PostPosted: Thu Jul 12, 2018 1:11 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 9:28 pm
Posts: 3600
Location: Mountain View, CA
Oh I see... the focus being that the cartridge have basically a single chip for PRG and no other IC-based discrete logic.

I don't know how you'd deal with bypassing the CIC in that situation. Might have to be a compo that is guaranteed to run on a modded (CIC disabled) NES.

The CIC page on the Wiki describes some bypassing methods used by unlicensed game developers at the time, but as noted there later versions of the console added diodes to ensure that method of bypass can't be used (I'm not sure why it says "but not on the reset pins" in the Wiki, almost like that's implying bypass is still possible in some way through that). More a question for hardware guys than me, that's for sure.


Top
 Profile  
 
PostPosted: Thu Jul 12, 2018 1:24 pm 
Offline
User avatar

Joined: Thu May 31, 2018 11:12 am
Posts: 153
Location: Bristol, England
Yes but we can do what I just said. Also, by the length, I meant how long the flash itself would last. "2 frames for PPU initialization?" Also, could it be disguised as lightning as I said earlier?


Top
 Profile  
 
PostPosted: Thu Jul 12, 2018 2:40 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 7532
Location: Seattle
orlaisadog wrote:
Which colour would the flashes be and how long?
The PPU's palette is not changed during /RESET, but the PPU itself is forced stopped. (No video is generated at all). On an old CRT, that means the screen will probably be black? But on some it might be blue.

Quote:
2 frames for PPU initialization?
Exactly 262 scanlines (312 on PAL NES). The PPU exits reset drawing the very first line of the visible field (but video is disabled), and you can start accessing the registers after the first vblank finishes. Usually you don't care about this, but in this specific case it might be worth optimizing things to start drawing sooner.

Quote:
On a CRT, could it be disguised as a lightning strike if the game has a rain effect or would that be too annoying?
The PPU is held in reset, and allowed to draw, for an equal amount of time. I think it'd be too uniform to plausibly be lightning.

Yes, during that first one or two fields after the PPU were released from reset, the PPU would display whatever color you'd left in palette memory at $3F00 before the CIC asserted /RESET.
Quote:
Anything else I'd need to know if I did this?
https://wiki.nesdev.com/w/index.php/PPU_power_up_state and to a lesser extent https://wiki.nesdev.com/w/index.php/CPU_power_up_state


Top
 Profile  
 
PostPosted: Thu Jul 12, 2018 11:54 pm 
Offline
User avatar

Joined: Thu May 31, 2018 11:12 am
Posts: 153
Location: Bristol, England
So why do we normally wait 2 frames?


Top
 Profile  
 
PostPosted: Fri Jul 13, 2018 12:07 am 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 7532
Location: Seattle
Because vblanks are the simplest and there aren't very many other external clock sources.

The point at which we can change the PPU is 20(2C02)/70(2C07) scanlines after the first NMI. But we can't set up any kind of timer from the PPU to let us know when that happens.

I think I've seen timed code init loops once or twice (guaranteed to take at least 312×341×5÷16 CPU instructions)


Top
 Profile  
 
PostPosted: Fri Jul 13, 2018 12:36 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 20562
Location: NE Indiana, USA (NTSC)
That and you can detect the TV system during the vblank wait loop, as seen in paldetect.s:

1. wait for one vblank to start (by spinning on $2002)
2. wait for enough cycles to pass second vblank on NTSC (341*262/3) but not PAL NES (341*312/3.2) and check $2002
3. wait for enough cycles to pass second vblank on PAL NES but not PAL famiclone (341*312/3) and check $2002


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 14 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 6 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