Re: Hy!

Date view Thread view Subject view

From: Ullrich von Bassewitz (
Date: 1999-06-19 10:52:07

> Hy! I'm a new CC65 user, and have just subscribed to this mailing list.


> I tried to use scanf in my source code, but it's not supported by the compiler:
> how can I replace it? Thanks, bye.

It depends what you're trying to do. If you want to convert a string to an
integer, you may try atoi or atol.

> I've noticed that if I don't press "enter" after the last "}", the compiler won't find
> the "}": I've lost half an hour to understand that!! ;-)

You're right, this is a compiler bug. When reading a new line, the last
character gets removed because for all lines with the exception of the last
one, this is always the linefeed character. If the last line does not have a
linefeed character, some other character gets removed, and in your case this
was the curly brace. I will fix that. Thanks for the hint.

> Should it be hard to add the scanf function? (Sorry, but I still don't know how
> CC65 works!)

The scanf family of functions is rather complex, even more complex than the
printf familiy. This does not mean that there is a problem implementing scanf,
the real problem is the memory footprint: The printf function alone adds about
4k of code, since it references in all sorts of support functions, even if you
don't use them. For a scanf implementation in C the memory footprint would be
even larger.

So the solution would be to (re-)write these functions in assembler, to save
some code. But writing stuff in assember is much more time consuming than
using C.



Ullrich von Bassewitz                        
To unsubscribe from the list send mail to with
the string "unsubscribe cc65" in the body(!) of the mail.

Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2001-12-14 22:05:44 CET