nanogui: Microwindows for Hercules
Subject:
Re: Microwindows for Hercules
From:
Alan Cox ####@####.####
Date:
19 Jul 1999 18:10:53 -0000
Message-Id: <E116Hix-0007sI-00@the-village.bc.nu>
> 1. AFAICT it would require at least one division operation,
> whereas standard Bresenham doesn't need any. This
> wouldn't be a problem for long diagonal lines, just for
> short ones. Division is expensive.
No. You can do it by using Besenham and still speed it up
> fits, just barely, but it looks like an ``extended''
> algorithm that keeps track of spans would need to use
> memory as well. This is a big loss on the 8086 IIRC.
Its not a big deal
Firstly:
if(x2-x1 > y2-y2)
horizonal_optimised();
else
vertical_optimised();
Next for Bresenham you drop the plot_pixel call and instead when you
bump x (or y in vertical mode) you do plot_line(oldx,oldy, x,y); bump it
oldx=x oldy=y
Saves you function calls costs you four memory accesses per line - thats
a win on everything.
> Can anyone inform me how long DIV r/m16 takes on an 8086? I seem to
"weeks" 8)