Open thrust26 opened 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?
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.
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.
All valid arguments, looks like I have done too much Java in between.
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:
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. 😆
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:
DelayQueue::execute
after the specified number of clocks has passed --- that's what happens in delayedWrite
. As an additional twist, there is a similar delay when the contents of the "old" and "new" GRPx registers are swapped; this is also handled by the queue with "writes" to registers that are unused on a real TIA (those are enumerated in the DummyRegisters
enum).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?
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:
Too many valid reasons to disagree. 😄
@DirtyHairy
Happy birthday to you, Happy birthday to you, Happy birthday dear issue 186, Happy birthday to you. 🎂
😈
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)
Missed the 2nd birthday by a few days. 😈
@DirtyHairy Where are we with this? What is done and what not?
About 50% done iirc. More to come anytime soon 😛
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. 😉