From 0c2f30fd450c19fdb43addec6413f45db31675c5 Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Tue, 23 Nov 2021 21:51:18 +0100 Subject: [PATCH] links to 6502 bresenham line algorithms --- compiler/res/prog8lib/c64/graphics.p8 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/compiler/res/prog8lib/c64/graphics.p8 b/compiler/res/prog8lib/c64/graphics.p8 index c41e3d6f4..4065d1b0f 100644 --- a/compiler/res/prog8lib/c64/graphics.p8 +++ b/compiler/res/prog8lib/c64/graphics.p8 @@ -33,6 +33,9 @@ graphics { sub line(uword @zp x1, ubyte @zp y1, uword @zp x2, ubyte @zp y2) { ; Bresenham algorithm. ; This code special-cases various quadrant loops to allow simple ++ and -- operations. + ; TODO implement this as optimized assembly, for instance https://github.com/EgonOlsen71/bresenham/blob/main/src/asm/graphics.asm ?? + ; or from here https://retro64.altervista.org/blog/an-introduction-to-vector-based-graphics-the-commodore-64-rotating-simple-3d-objects/ + if y1>y2 { ; make sure dy is always positive to have only 4 instead of 8 special cases swap(x1, x2)