stella-emu / stella

A multi-platform Atari 2600 Emulator
https://stella-emu.github.io
GNU General Public License v2.0
624 stars 111 forks source link

New TIA code comments missing #186

Open thrust26 opened 7 years ago

thrust26 commented 7 years ago

While trying to get a grip on the new TIA code, I am really missing code comments.

I know this is tedious work, but IMO classes, members and methods should be commented. Plus additional code comments where necessary. Else code maintenance and collaboration will become really difficulty.

BTW: IMO the other code could use some more comments too. 😉

sa666666 commented 7 years ago

@DirtyHairy mentioned coming back to this and commenting, etc. I would prefer to follow his lead on this, since he wrote most of the code.

Also, what 'other' code is it you speak of?

thrust26 commented 7 years ago

I only looked into emucore and a bit into some other directories. They are definitely much better commented than the tia sub directory.

And meanwhile I realized that the class comments are all in the header files. So you can ignore my BTW from above.

sa666666 commented 7 years ago

Commenting in the header files is the way I learned it in school, way back many moons ago. There are several justifications for this:

So at least for the code I wrote, most of the commenting is in the header files. Of course, if there is something complicated in the cxx file, it is commented there too. But the overall 'big picture' commenting happens in the header files mostly.

thrust26 commented 7 years ago

All valid arguments, looks like I have done too much Java in between.

DirtyHairy commented 7 years ago

Full ACK. I usually prefer clear code with sensible names for entities over verbose documentation. However, I wouldn't claim that the TIA implementation necessarily meets these criteria, and even less in its C++ incarnation :smirk: I'll try to improve this over time.

Other than that, there are mainly two reasons why documentation is currently so sparse:

thrust26 commented 7 years ago

Welcome back from mud!

Sure, take the time you need. I just tried to understand the code and (where it makes sense) to optimize some parts and there I struggled. Maybe you can ask some questions:

Or you could just comment it. 😆

DirtyHairy commented 7 years ago

Or I could do my promised git writeup and you could add comments yourself where you find them appropiate :stuck_out_tongue: Just kidding, although this might actually improve the quality of any new comments a lot.

As for your questions:

thrust26 commented 7 years ago

Thanks for the explanations.

What happens if myTimeStamp overflows (several years now 😃 )? I found it only used in paddle code, correct? And why double, why not a 64 bit integer instead?

DirtyHairy commented 7 years ago

Long before it actually overflows, the paddle will start getting jumpy as the relative accuracy will become smaller than one clock. Considering the 52 bits of fraction precision in double, this will happen in about 40.8 years (not considering leap years). Depending on the game, I would think there are some more three to four powers of two headroom, so there won't be any epic, 640 year (with hotswapped hardware) breakout highscores with Stella :smile:

As for why it is a double:

thrust26 commented 7 years ago

Too many valid reasons to disagree. 😄

thrust26 commented 6 years ago

@DirtyHairy

Happy birthday to you, Happy birthday to you, Happy birthday dear issue 186, Happy birthday to you. 🎂

😈

sa666666 commented 6 years ago

I didn't want to be pushy, so I pushed the deadline to 6.1. Of course, whatever is added from now to the 6.0 release would be appreciated too. (hint-hint)

thrust26 commented 5 years ago

Missed the 2nd birthday by a few days. 😈

@DirtyHairy Where are we with this? What is done and what not?

DirtyHairy commented 5 years ago

About 50% done iirc. More to come anytime soon 😛