Re: [cc65] Optimized tgi line functions for horizontal and vertical lines

From: Andreas Rückert <>
Date: 2011-11-07 15:34:35

Thanks für your quick reply!

-------- Original-Nachricht --------
> Datum: Mon, 7 Nov 2011 15:11:04 +0100
> Von: Ullrich von Bassewitz <>
> An:
> Betreff: Re: [cc65] Optimized tgi line functions for horizontal and vertical lines

> So yes, lines aren't as fast as they could be. But TGI isn't made for
> really
> fast lines anyway. Especially line clipping adds a noticeable overhead.

If you don't want a public interface to those methods, something like
lineto(x,y,x2,y2) {

if( x == x2) { vertical_line( x, y, y2); 
} else if( y1 == y2) { horizontal_line( ...

might work, although I think those functions could be of good use in
some apps (think of fast grid drawing, or so).

> > Is there a quicker way to set the background color before drawing?
> Setting the background color in high resolution mode means filling the
> color
> ram with the color value. So what actually happens here is that the 6510
> does
> a 1K memory write. The loop is unrolled but still needs 25 cycles per
> iteration, which means 25 * 256 ~= 6.5 ms.

I used the bar function, which was a lot slower, but a forum64 user 
already posted a better solution:

  char rvs[]={COLOR_WHITE, COLOR_BLACK};


Problem is, that the tgi_setcolor() calls are not inverted. 
tgi_setcolor(COLOR_WHITE) draws black now and vice versa.


NEU: FreePhone - 0ct/min Handyspartarif mit Geld-zurück-Garantie!		
Jetzt informieren:
To unsubscribe from the list send mail to with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Mon Nov 7 15:34:54 2011

This archive was generated by hypermail 2.1.8 : 2011-11-07 15:34:57 CET