Fixing timing, and new features

The Uzebox now have a fully functional emulator! Download and discuss it here.
User avatar
Jubatian
Posts: 1561
Joined: Thu Oct 01, 2015 9:44 pm
Location: Hungary
Contact:

Re: Fixing timing, and new features

Post by Jubatian »

uze6666 wrote:But a console way is good too if you found a good way to display it. May I suggest you then add your code in your branch and enable it via the 'z' switch? Me and CunningFellow also need such functionality when working
on video modes.
It is nothing very fancy, I just checked the currentCycles variable on the line renderer, and spit it out along with the line number by scanline_count (just from memory, something like that) when it didn't match 1820. Of course the graphical way is in general more useful once you are actually devving a game, just working on the video mode with test codes doesn't seem to need it to be graphical that much. It may also be quite a CPU hog (flooding the console) when every line mismatches (say, you got consistent 1821 cycles since you were fooled by an rjmp after and sbrs in your counting somewhere).

It should wait a bit though. My current big performance bump needed a change again in the way that part works, so when integrating that, the count of cycles the line took will need to be calculated differently.

Doing it proper the other edge of HSYNC may also be interesting as an optional feature. In graphics modes it is not so much since it is governed by the audio code, but if you want to touch that part (the inline mixer), it could be handy.
CunningFellow
Posts: 1445
Joined: Mon Feb 11, 2013 8:08 am
Location: Brisbane, Australia

Re: Fixing timing, and new features

Post by CunningFellow »

My next video mode is something a bit insane.

It will have no clear path through the render_line routines.

So I do need something to tell me if I am getting the right number of clock cycles.
User avatar
Jubatian
Posts: 1561
Joined: Thu Oct 01, 2015 9:44 pm
Location: Hungary
Contact:

Re: Fixing timing, and new features

Post by Jubatian »

For now the hack is merely something like this:

Code: Select all

if (current_cycle != 1820U)
{
    printf("Line %3u: cycles %4u\n", scanline_count, current_cycle);
}
This is placed in the write_io_x function, in the PORTB output code somewhere around the render of the line. At least I use this for my mode devving. With my performance tweaks, "current_cycle" has to be replaced to "cycleCounter - left_edge_cycle".
Post Reply