Hatari 2.4 regression

A forum about the Hatari ST/STE/Falcon emulator - the current version is v2.5.0

Moderators: simonsunnyboy, npomarede, thothy, Moderator Team

ijor
Hardware Guru
Hardware Guru
Posts: 4639
Joined: Sat May 29, 2004 7:52 pm
Contact:

Re: Hatari 2.4 regression

Post by ijor »

troed wrote: Sun Mar 20, 2022 12:57 pm So, the problem Nicholas is having is that the demo obviously works on real hardware but currently the checks in Hatari believes vblank is never set to false.
Yes, I can see that know.
npomarede wrote: Fri Mar 18, 2022 1:56 pm - switch to 60 Hz on cycle 380 line 15 (from Troed Fullast demo, vblank check is made around cycle 500 at line 14) -> vblank is still on
This doesn't seem to match what I see in your own code:

Code: Select all

        int	VBlank_On_50_CheckLine;		/* 307 */
	int	VBlank_On_60_CheckLine;		/* 257 */
	int	VBlank_Off_50_CheckLine;	/*  25 */
	int	VBlank_Off_60_CheckLine;	/*  16 */
	int	VBlank_CheckPos;		/* 502 same for ON and OFF test */
	

	pVideoTiming1->VBlank_On_50_CheckLine	= 307;
	pVideoTiming1->VBlank_On_60_CheckLine	= 257;
	pVideoTiming1->VBlank_On_Hi_CheckLine	= 501;
	pVideoTiming1->VBlank_Off_50_CheckLine	=  23;
	pVideoTiming1->VBlank_Off_60_CheckLine	=  14;
	pVideoTiming1->VBlank_Off_Hi_CheckLine	=   0;
	pVideoTiming1->VBlank_CheckPos		= 502;	
So are you using line 14 or line 16???
Fx Cast: Atari St cycle accurate fpga core
User avatar
npomarede
Atari God
Atari God
Posts: 1556
Joined: Sat Dec 01, 2007 7:38 pm
Location: France

Re: Hatari 2.4 regression

Post by npomarede »

ijor wrote: Sun Mar 20, 2022 12:33 pm You don't seem to agree one with each other.
It's posssible Troed and I use different line counting number, but in the end Hatari runs Troed's demo, so we have matching values.
In the case of hatari, I count position "cycle @ hbl" where hbl=0 is the very first hbl when the vbl starts.

With this, I have this timing for checking if vblank goes off/on :
- hbl 14 pos 502 : if freq=60, then vblank goes off
- hbl 23 pos 502 : if freq=50, then vblank goes off
- hbl 257 pos 502 : if freq=60, then vblank goes on
- hbl 307 pos 502 : if freq=50, then vblank goes on

With Troed's Fullast Vinner demo that disables blank earlier, I detect this as there's a 60/50 Hz switch at pos 502 hbl 14. So vblank is off starting with hbl 15.
Using these timings, I see that vblank remains on ; I don't see any freq switch that would match the 4 vblank checks above and would turn vblank off. Maybe I'm missing something ?

Nicolas
Last edited by npomarede on Sun Mar 20, 2022 4:31 pm, edited 1 time in total.
User avatar
npomarede
Atari God
Atari God
Posts: 1556
Joined: Sat Dec 01, 2007 7:38 pm
Location: France

Re: Hatari 2.4 regression

Post by npomarede »

ijor wrote: Sun Mar 20, 2022 3:03 pm So are you using line 14 or line 16???
That was an error in the comment, I recently fixed it in devel sources and I use value 14 (pos 502) to check if vblank should go off at 60 Hz.
ijor
Hardware Guru
Hardware Guru
Posts: 4639
Joined: Sat May 29, 2004 7:52 pm
Contact:

Re: Hatari 2.4 regression

Post by ijor »

npomarede wrote: Sun Mar 20, 2022 4:27 pm With this, I have this timing for checking if vblank goes off/on :
- hbl 14 pos 502 : if freq=60, then vblank goes off
- hbl 23 pos 502 : if freq=50, then vblank goes off
- hbl 257 pos 502 : if freq=60, then vblank goes on
- hbl 307 pos 502 : if freq=50, then vblank goes on
This table is wrong. VBL is 242 scan lines at 60 Hz and 283 scan lines at 50 Hz.

Code: Select all

	pVideoTiming1->VDE_On_Line_60 		= VIDEO_START_HBL_60HZ;				/*  34 */
	...
	pVideoTiming1->VBlank_Off_60_CheckLine	=  14;
This is also is wrong. DE starts 18 scan lines after VBLANK ends, at 60 Hz.
Fx Cast: Atari St cycle accurate fpga core
User avatar
troed
Atari God
Atari God
Posts: 1769
Joined: Mon Apr 30, 2012 6:20 pm
Location: Sweden

Re: Hatari 2.4 regression

Post by troed »

Yeah that looks weird. My count for vblank on is also line 257 and 307 so I can't see why yours for vblank off would be 14 and 23 - mine are 15 and 24.

Full vertical table:

Code: Select all

        if vvid_counter == 15 && 60 then vBLANK = false; 
        if vvid_counter == 24 && 50 then vBLANK = false;
        if vvid_counter == 33 && !50 then vDE = true            // 60Hz and mono
        if vvid_counter == 46/62 && 50 then vDE = true      // 50 Hz
        if vvid_counter == 233 && 60 then vDE = false           // 60Hz
        if vvid_counter == 246/262 && 50 then vDE = false      // 50 Hz
        if vvid_counter == 257 && 60 then vBLANK = true         // 60Hz
        if vvid_counter == 307 && 50 then vBLANK = true         // 50Hz
        if vvid_counter == 433 && 70 then vDE = false            // mono
Ijor is always welcome to post the actual truth in these threads instead of me having to post my current best guesses of course ;)
User avatar
npomarede
Atari God
Atari God
Posts: 1556
Joined: Sat Dec 01, 2007 7:38 pm
Location: France

Re: Hatari 2.4 regression

Post by npomarede »

To be honest, the only "real life example" demo I have that changes vblank is Fullast Vinner, so most of the timings in Hatari are adjusted to match this demo as it's known to work on real HW.
Troed, when you say for example :

Code: Select all

if vvid_counter == 15 && 60 then vBLANK = false;
if vvid_counter == 307 && 50 then vBLANK = true         // 50Hz
Then I understand that the check is made at cycle 502 according to you, so it would be the following code in hatari :

Code: Select all

if vvid_counter == 14 && pos == 502 && 60 then VBLANK=false
or
if vvid_counter == 306 && pos == 502 && 50 then vBLANK = true
Is that so ?

Also for this line (remove top border) :

Code: Select all

if vvid_counter == 33 && !50 then vDE = true            // 60Hz and mono
Do you mean "if vvid_counter==33 and pos==502" or ""if vvid_counter==32 and pos==502" ? Because on my side under Hatari the first line visible will be the one with HBL=34 ; Hatari sets VDE=ON on start of line 34, but your table tells "if vvid_counter == 33". I have the feeling we sometime have a +/- 1 difference in our line counting. Maybe you should add the "&& pos==502" in your table to make sure it's explicit ?

In Fullast Vinner, I see you do a 60/50Hz on every line to have freq = 60 on cycle 502. And this switch is made first on pos 502 hbl 14 (I assumed this turned vblank off at 60 Hz) and last on pos 502 hbl 307 (I assumed this prevented vblank from turning on at 50 Hz)
This is why in Hatari I have VBlank_Off_60_CheckLine=14 and VBlank_On_50_CheckLine=307.

So maybe Fullast Vinner does an extra/unneeded 60/50 Hz switch at 502@14 or 502@307 and this is what mislead me to a wrong value in Hatari ?
User avatar
troed
Atari God
Atari God
Posts: 1769
Joined: Mon Apr 30, 2012 6:20 pm
Location: Sweden

Re: Hatari 2.4 regression

Post by troed »

npomarede wrote: Mon Mar 21, 2022 8:50 am Then I understand that the check is made at cycle 502 according to you, so it would be the following code in hatari :

Is that so ?
Yes. All "vertical" checks, in 50/60Hz, are made at cycle 502. Mono is different (and I believe the actual VSYNC check to be the same "position" for all, using Mono timing - but that's to be confirmed).
Do you mean "if vvid_counter==33 and pos==502" or ""if vvid_counter==32 and pos==502" ? Because on my side under Hatari the first line visible will be the one with HBL=34 ; Hatari sets VDE=ON on start of line 34, but your table tells "if vvid_counter == 33". I have the feeling we sometime have a +/- 1 difference in our line counting. Maybe you should add the "&& pos==502" in your table to make sure it's explicit ?
Correct, it's "late on HBL 33". Since we're counting the same way on known lines (end of vDE, vBLANK on etc) we can solve it in another way ;) End of vBLANK in 50Hz is nine lines before vDE = true. End of vBLANK in 60Hz is nine lines before 50Hz. That's why Fullast Vinner gained an additional nine lines to previously max displayed. _Enabling_ top border is done at the end of HBL 33 so there you get the (end of) line 24 and 15 respectively.
npomarede wrote: So maybe Fullast Vinner does an extra/unneeded 60/50 Hz switch at 502@14 or 502@307 and this is what mislead me to a wrong value in Hatari ?
As to whether my code can have bugs - of course :) It's a bytetro (that failed meeting the intended size limit) so any and all shortcuts might've been taken and if it worked it worked. Sorry that it (it seems) messed up things for you.

/Troed
User avatar
troed
Atari God
Atari God
Posts: 1769
Joined: Mon Apr 30, 2012 6:20 pm
Location: Sweden

Re: Hatari 2.4 regression

Post by troed »

The pre-relase of Expansion of the Universe should be a lot more accurate. Use the two shift keys to enable top extra scanlines and bottom extra scanlines respectively. Keys 1 and 2 switch between "Closure" scanlines and Level 16 ones.

https://sync.wtf/EXPANDED_BETA1.ZIP
User avatar
npomarede
Atari God
Atari God
Posts: 1556
Joined: Sat Dec 01, 2007 7:38 pm
Location: France

Re: Hatari 2.4 regression

Post by npomarede »

troed wrote: Mon Mar 21, 2022 10:50 am Correct, it's "late on HBL 33". Since we're counting the same way on known lines (end of vDE, vBLANK on etc) we can solve it in another way ;) End of vBLANK in 50Hz is nine lines before vDE = true. End of vBLANK in 60Hz is nine lines before 50Hz. That's why Fullast Vinner gained an additional nine lines to previously max displayed. _Enabling_ top border is done at the end of HBL 33 so there you get the (end of) line 24 and 15 respectively.
OK thanks for the clarification. Now that we speak the same "language" I can fix the values in Hatari.

At first I used your post back then on Hatari's mailing list where you told you gained 9 lines, then again 9 lines, but when doing the math, it didn't match the first switch you did in Fullast Vinner (math gave line 15 but 60/50 switch was on line 14 in the demo). So I used 14 anyway, even it it didn't match the 9 lines gain you described.
Hatari will now check :

Code: Select all

if line==15 and pos==502 and 60 then vblank goes off
if line==24 and pos==502 and 50 then vblank goes off
Other values for bottom vblank and DE were already correct.

With these values, the main menu is now visible under Hatari devel version. The whole Hackabonds demo is now working again in Hatari :)

troed wrote:
npomarede wrote: So maybe Fullast Vinner does an extra/unneeded 60/50 Hz switch at 502@14 or 502@307 and this is what mislead me to a wrong value in Hatari ?
As to whether my code can have bugs - of course :) It's a bytetro (that failed meeting the intended size limit) so any and all shortcuts might've been taken and if it worked it worked. Sorry that it (it seems) messed up things for you.

/Troed
I confirm the demo does an extra 60/50 Hz switch on 502@14, which is one line too soon. Quite an irony to code a bytetro that in the end does too much work ;-)

Thanks to you and Ijor for discussing this and helping to fix it.

Nicolas
User avatar
npomarede
Atari God
Atari God
Posts: 1556
Joined: Sat Dec 01, 2007 7:38 pm
Location: France

Re: Hatari 2.4 regression

Post by npomarede »

troed wrote: Mon Mar 21, 2022 11:52 am The pre-relase of Expansion of the Universe should be a lot more accurate. Use the two shift keys to enable top extra scanlines and bottom extra scanlines respectively. Keys 1 and 2 switch between "Closure" scanlines and Level 16 ones.

https://sync.wtf/EXPANDED_BETA1.ZIP
Good idea, waiting for the final version. Maybe then you can add some png/screenshot with the program to show what the result should be on real HW in order to compare ?
ijor
Hardware Guru
Hardware Guru
Posts: 4639
Joined: Sat May 29, 2004 7:52 pm
Contact:

Re: Hatari 2.4 regression

Post by ijor »

troed wrote: Sun Mar 20, 2022 10:58 pm Ijor is always welcome to post the actual truth in these threads instead of me having to post my current best guesses of course ;)
I need to find the time for this, because it requires some work to build and post an accurate description. The vertical processing is not as simple as the horizontal one. The relation with the horizontal process, and also the relation between color and mono modes, makes it not fully linear.
Fx Cast: Atari St cycle accurate fpga core
User avatar
npomarede
Atari God
Atari God
Posts: 1556
Joined: Sat Dec 01, 2007 7:38 pm
Location: France

Re: Hatari 2.4 regression

Post by npomarede »

tin wrote: Tue Feb 08, 2022 5:09 pm I noticed some regressions in the current Hatari development version. All of these regressions aren't present in the 2.31 release version or on real hardware. Tested with self-compiled master version yesterday, as well as CHS' nightly build today, both windows. Had the same regressions under Emscripten.

-Closure does not boot anymore
-Closure 1.1 does not open borders correctly
-Cuddly demos loader scroller flickers
-Cuddly demos fullscreen screen crashes
-Hackabonds fullscreen intro crashes

Here's a small set of batch files+mentioned demos+config+tos that should help to reproduce the problem https://absencehq.de/atari/tmp/hatari_2 ... ession.zip.
Hi
back to the original post, all those demos should now be fixed with latest Hatari dev from 2022/03/25.

Last remaining issue was with Closure where the 2 hi color pics were sometimes completely wrong, due to STOP timings being wrong. Took me a lot of time to debug/fix, because the cause was in something that should have been completely unrelated (FDC's DMA timings).

Don't hesitate to test your favorite demos and report any regression, hopefully Hatari should be as stable as before the big internal changes that were made during the latest weeks.

Nicolas
User avatar
troed
Atari God
Atari God
Posts: 1769
Joined: Mon Apr 30, 2012 6:20 pm
Location: Sweden

Re: Hatari 2.4 regression

Post by troed »

npomarede wrote: Fri Mar 25, 2022 3:09 pm Last remaining issue was with Closure where the 2 hi color pics were sometimes completely wrong, due to STOP timings being wrong. Took me a lot of time to debug/fix, because the cause was in something that should have been completely unrelated (FDC's DMA timings).
o_O

That sounds like a story.

(Also, those two screens don't do anything different with regards to overscan compared to any of the other screens - making it even more a mystery!)
User avatar
npomarede
Atari God
Atari God
Posts: 1556
Joined: Sat Dec 01, 2007 7:38 pm
Location: France

Re: Hatari 2.4 regression

Post by npomarede »

troed wrote: Fri Mar 25, 2022 3:42 pm o_O

That sounds like a story.

(Also, those two screens don't do anything different with regards to overscan compared to any of the other screens - making it even more a mystery!)
Yes I know it has completely nothing to do with overscan code itself, but it took me some time to come to this conclusion.Before that I had to check the whole code for STOP, for E-clock sync and so on, tracing GB of cpu dumps to compare side by side and cycle by cycle the different version (and trying to find why I had this random behaviour only in these 2 screens).

the boring story : that's because during the 2 text writers some FDC access are completing to read the last sectors of each image. The code I added to stall the CPU during 32 cycles each time the DMA FIFO was filled was in fact buggy and did nothing, except in one case that was triggered by the new internal timers code :( So from time to time, it would add 32 cycles to internal timers, but not to global cpu clock, hence some "de-sync" and stop / e clock pattern became completely wrong. I think that during the text writer there must be a very rare case where an mfp timer triggers at the same time the DMA fifo add its 32 cycles and this is what caused the bug (nothing to blame on Closure :) )

Nicolas
User avatar
troed
Atari God
Atari God
Posts: 1769
Joined: Mon Apr 30, 2012 6:20 pm
Location: Sweden

Re: Hatari 2.4 regression

Post by troed »

Ahhhh! Yeah - they are different in one aspect. Closure doesn't background load usually (being a 1MB demo) - but for those screens, the biggest ones in the demo, it does load in the background during the text writer.

Thanks for your persistence in tracking all these edge cases down :D
User avatar
Cyprian
10 GOTO 10
10 GOTO 10
Posts: 3258
Joined: Fri Oct 04, 2002 11:23 am
Location: Warsaw, Poland

Re: Hatari 2.4 regression

Post by Cyprian »

troed wrote: Sun Mar 20, 2022 10:58 pm Yeah that looks weird. My count for vblank on is also line 257 and 307 so I can't see why yours for vblank off would be 14 and 23 - mine are 15 and 24.

Full vertical table:

Code: Select all

        if vvid_counter == 15 && 60 then vBLANK = false; 
        if vvid_counter == 24 && 50 then vBLANK = false;
        if vvid_counter == 33 && !50 then vDE = true            // 60Hz and mono
        if vvid_counter == 46/62 && 50 then vDE = true      // 50 Hz
        if vvid_counter == 233 && 60 then vDE = false           // 60Hz
        if vvid_counter == 246/262 && 50 then vDE = false      // 50 Hz
        if vvid_counter == 257 && 60 then vBLANK = true         // 60Hz
        if vvid_counter == 307 && 50 then vBLANK = true         // 50Hz
        if vvid_counter == 433 && 70 then vDE = false            // mono
Ijor is always welcome to post the actual truth in these threads instead of me having to post my current best guesses of course ;)
I see there https://www.atari-wiki.com/index.php?ti ... te_machine a bit different figures. Does it mean Wiki is out-of-date?
Lynx I / Mega ST 1 / 7800 / Portfolio / Lynx II / Jaguar / TT030 / Mega STe / 800 XL / 1040 STe / Falcon030 / 65 XE / 520 STm / SM124 / SC1435
DDD HDD / AT Speed C16 / TF536 / SDrive / PAK68/3 / Lynx Multi Card / LDW Super 2000 / XCA12 / SkunkBoard / CosmosEx / SatanDisk / UltraSatan / USB Floppy Drive Emulator / Eiffel / SIO2PC / Crazy Dots / PAM Net
Hatari / Steem SSE / Aranym / Saint
http://260ste.atari.org
stormy
Atari God
Atari God
Posts: 1687
Joined: Tue Jan 26, 2016 12:39 pm

Re: Hatari 2.4 regression

Post by stormy »

Cyprian you do realise you're replying to a thread 2 years old?
User avatar
Cyprian
10 GOTO 10
10 GOTO 10
Posts: 3258
Joined: Fri Oct 04, 2002 11:23 am
Location: Warsaw, Poland

Re: Hatari 2.4 regression

Post by Cyprian »

Yes, I know.
I just think that it would be a nice to have wiki up to date
Lynx I / Mega ST 1 / 7800 / Portfolio / Lynx II / Jaguar / TT030 / Mega STe / 800 XL / 1040 STe / Falcon030 / 65 XE / 520 STm / SM124 / SC1435
DDD HDD / AT Speed C16 / TF536 / SDrive / PAK68/3 / Lynx Multi Card / LDW Super 2000 / XCA12 / SkunkBoard / CosmosEx / SatanDisk / UltraSatan / USB Floppy Drive Emulator / Eiffel / SIO2PC / Crazy Dots / PAM Net
Hatari / Steem SSE / Aranym / Saint
http://260ste.atari.org
Post Reply

Return to “Hatari”