Dr. Kylstein
-
Content Count
15 -
Joined
-
Last visited
Blog Comments posted by Dr. Kylstein
-
-
The fractional bits are discarded. I excelled at college math, but it was so long ago that when I read the modular inverse page I didn't follow it enough to be able to code it.
For unsigned 32-bit numbers, I believe the answer is to multiply by 0xCCCCCCCD. (It looks pretty similar to your fixed-point constant...) Modulo arithmetic is the mathematician's way of simulating a fixed number of bits in an integer representation, so in this case I solved for for x*5 = 1 mod 2^32 (uisng Wolfram Alpha). For 8-bit ints it would be mod 2^8, and I think you're probably familar with how large numbers behave in that case. It's a neat bit of mathemagic, if you care to use it.
-
Are you using those fractional bits at all? If not, I think you could use a modular inverse for that divide by 5. It would only save one operation though.
-
I think it'll be less of an issue for digital TVs. The reason Atari games only used 192 scanlines back in the day was due to overscan.
Quote
Overscan is extra image area around the four edges of a video image that may not be seen reliably by the viewer. It exists because television sets in the 1930s through 1970s were highly variable in how the video image was framed within the cathode ray tube (CRT).
Newer digital TVs don't have this problem, so they show more of the picture than the old TVs did. Specifically they're designed to show 480 scanlines, or 240 from a progressive source like the Atari. The image I'm generating is around 203 scanlines.
Thanks for the correction! That statement started to smell wrong as soon as I posted it.
-
Works for me on a modded 4-switch over composite to a 10-year old 20" Magnavox CRT. I expect digital TVs to be where problems occur, but I don't have one handy.

Homing in on you
in SpiceWare's Blog
A blog by SpiceWare
Posted
Well, I'm stumped. I'll have to bug a professor about that.
Edit: oh, it's (probably) because there is no "correct" answer for integer division in those cases. Darned mathematicians... Sorry for wasting your time.