Resetting H/V counters?

Discussion of developmental aspects of the MiSTer Project.
ExCyber
Posts: 217
Joined: Sun May 24, 2020 3:33 pm
Has thanked: 11 times
Been thanked: 66 times

Resetting H/V counters?

Unread post by ExCyber »

I always assumed that H and V counters in a CRTC should be reset, but the more I think about it the less sure I am that this actually makes sense. Does anyone know what any original hardware does? Basically, I'm not sure there are any upsides sufficient enough to offset the downside of disrupting the sync timings to the display.
dshadoff
Core Developer
Posts: 534
Joined: Sun May 24, 2020 9:30 pm
Has thanked: 19 times
Been thanked: 141 times

Re: Resetting H/V counters?

Unread post by dshadoff »

Hmm.. several pieces of your question are unclear to me.
What is "CRTC" ? It seems related to a CRT; are you talking about the rasterizer section of a core ? (this is what I am inferring)
What "disrupting the sync timings" are you talking about ?

Original equipment held registers which counted the H and V positions of the rasterizer at any given time. Comparing these to preset limits/values is basically an atomic action which does not affect timing.
robinsonb5
Posts: 129
Joined: Fri Jun 19, 2020 8:54 pm
Has thanked: 13 times
Been thanked: 57 times

Re: Resetting H/V counters?

Unread post by robinsonb5 »

ExCyber wrote: Sat Aug 14, 2021 4:33 pm I always assumed that H and V counters in a CRTC should be reset, but the more I think about it the less sure I am that this actually makes sense. Does anyone know what any original hardware does? Basically, I'm not sure there are any upsides sufficient enough to offset the downside of disrupting the sync timings to the display.
That's a really interesting question - so interesting that I had to try it!

I have an Amiga 500 (Kick 1.3) here - and the screen doesn't lose sync immediately when I do the Ctrl-Amiga-Amiga reset - but what's interesting is that it *does* lose sync momentarily after the darkest grey is displayed, before the disk-hand screen comes up.

dshadoff wrote: Sat Aug 14, 2021 5:16 pm Hmm.. several pieces of your question are unclear to me.
What is "CRTC" ? It seems related to a CRT; are you talking about the rasterizer section of a core ? (this is what I am inferring)
What "disrupting the sync timings" are you talking about ?
CRTC = CRT controller - i.e. the circuitry which counts pixel clocks to generate HSync, and counts rows to generate VSync.
The question is whether or not these get reset with the rest of the system - because doing so will, of course, mean that the screen will lose sync.
ExCyber
Posts: 217
Joined: Sun May 24, 2020 3:33 pm
Has thanked: 11 times
Been thanked: 66 times

Re: Resetting H/V counters?

Unread post by ExCyber »

robinsonb5 wrote: Sat Aug 14, 2021 7:05 pmCRTC = CRT controller - i.e. the circuitry which counts pixel clocks to generate HSync, and counts rows to generate VSync.
The question is whether or not these get reset with the rest of the system - because doing so will, of course, mean that the screen will lose sync.
Yes, what I'm asking about is the behavior of the H/V counters with respect to a reset signal. From a general digital logic perspective, it seems obvious that this is state that needs to be reset. But looking at how they function in the system, it seems like resetting them doesn't have much benefit other than perhaps guaranteeing some initial phase relationship between the counter and the CPU. Apart from the issue of the display losing sync on reset, one reason I'm asking the question is that some games seem to use this to seed their RNG (as discussed in this thread about the Genesis port of Street Fighter 2), which would suggest that it's actually not expected to be deterministic. That could be due to the reset timing itself being nondeterministic, but it could also be that the counters aren't actually reset at all (or e.g. are reset solely by an internal power-on reset circuit).
robinsonb5 wrote: Sat Aug 14, 2021 7:05 pm I have an Amiga 500 (Kick 1.3) here - and the screen doesn't lose sync immediately when I do the Ctrl-Amiga-Amiga reset - but what's interesting is that it *does* lose sync momentarily after the darkest grey is displayed, before the disk-hand screen comes up.
That's interesting. It almost seems like the hard reset doesn't reset the counters, but there might be some form of software-controlled reset or other initialization that does. I know Amiga can do split-screen with different resolutions, so I don't think it's just a question of changing video modes in general.
Post Reply