Hacker News new | ask | show | jobs
by markrages 2518 days ago
Were you using a CORDIC algorithm? Bit shifts and adds, no multiplies required.
3 comments

You don't need CORDIC to draw a circle. BTW, I implemented a CORDIC routine in 6502. It would really benefit from a barrel shifter which the 6502 does not have. https://atariage.com/forums/blogs/entry/3385-atan2-in-6502/

In gist form https://gist.github.com/djmips/29a8fa9099bf92b31a7259da65915...

Using a CORDIC algorithm would mean having many iterations to compute trigonometric functions for each drawn point (well, for each 8 points considering the symmetries). A variant of the Bresenham line algorithm for circles lets you draw a circle using only a few operations per 8 points (and the operations are also limited to add and shift):

https://en.wikipedia.org/wiki/Midpoint_circle_algorithm

no, I had hardcoded lookup tables. I was a teen with no real way to find out information about anything and just applied my high school math to the problem :)