Re: [cc65] Performance of Swiftlink routines

From: Greg King <>
Date: 2010-01-12 19:07:05
From: "Daniel Serpell"; on Thurs., Dec. 31, 2009; at 6:37 AM -0500
> On Thu, Dec 31, 2009 at 12:41 AM, Tom Watt <> wrote:
> >
> > I've been working on a test terminal program to see if cc65 will work
> > for me. I think the terminal I wrote has "acceptable" speed, but I
> > chose C because I honestly believed that C would be a faster
> > alternative then a BASIC/ML combination approach.
> [...]
> > if (status==SER_ERR_OK) printf("%c",key);
> Printf() is slow; you should use putchar(key) directly; or, use the conio
> function "cputc"; that should be faster still, as it uses direct screen 
> I/O.

Conio doesn't scroll the screen; you would need to implement the kind of 
scroll-routine that Groepaz said fast terminal programs use.

CC65's stdio functions are slower than their BASIC/ML-combination 
equivalents because they go through several layers in the function library. 
The equivalents go almost directly to the Kernal ROM.  You can get the same 
effect by calling the lower-level functions that are declared in <cbm.h>. 
(By the way, you don't need to include <c64.h>; <cbm.h> does it for you.)

> >
> > /* call term function repeatedly until exit */
> > while (term()) {};

You should avoid the function-call overhead by moving that loop into term().

To unsubscribe from the list send mail to with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Wed Jan 13 11:30:57 2010

This archive was generated by hypermail 2.1.8 : 2010-01-13 11:31:00 CET