X16Community / x16-rom

Other
43 stars 27 forks source link

[GRAPH/BASIC] implement GRAPH_draw_oval and BASIC "OVAL" and "RING" commands #356

Closed mooinglemur closed 1 week ago

mooinglemur commented 2 weeks ago

This is a fast implementation of an extended Bresenham circle algorithm to draw ellipses, based on http://members.chello.at/~easyfilter/bresenham.html

It adds a fast 8x8 multiply routine, fast 16 bit squaring, and a traditional 16x32 shift and add multiply routine.

Fulgen301 commented 2 weeks ago

As of R47, the KERNAL requires a VERA version with FX features; could we use the VERA's FMA functionality to speed up the non-8-bit multiplications?

mooinglemur commented 2 weeks ago

We certainly can. I think it might we worth some design discussion about which routines can use it, and what part of VRAM would be used as scratch. I'd like to cut a new release here within a week, so there'll be plenty of time to work that out rather than rushing it now.

irmen commented 1 week ago

Nice that it is implemented!

However, the algorithm used creates a small artefact when drawing a circle (width=height):

image

Maybe it's related to this routine being more general (it can draw ovals) but the circle algorithm I have been using so far produces "flat" edges on the left and right sides, reflecting the same edges as on the top and bottom:

image