Re: [cc65] cc65 and $ba again, sorry

Date view Thread view Subject view

From: Ullrich von Bassewitz (uz_at_musoftware.de)
Date: 2003-10-17 18:47:41


Hi!

On Fri, Oct 17, 2003 at 04:57:38PM +0200, carlos wrote:
> You see, that something goes wrong there.

Sorry, but no, I cannot see what is wrong. Yes, I have run the program, but
since you didn't tell what you expect/not expect to happen, it is rather
difficult for me to find out what the problem might be.

$ba is the current device used for input and/or output. Any file open (and
that includes stdout and stderr) will change this variable. It is clear that
this happens and why it happens, and I cannot see any problem with it.

In general, it's a bad idea to work with different level of APIs. If you use C
file I/O, you should not use POSIX file I/O or CBM file I/O or mess with any
low level kernal variables and hope the upper layers won't notice. What that
means is that if you're using variables like $ba directly, then your program
should not use any file I/O in C (and this includes printf/fprintf!), because
this won't work in many cases. Or it may work in one compiler version and stop
working after an update. This is not only true for file I/O, but for any API
provided by the cc65 libraries. Using conio, and writing to the ROM cursor
position stored in the zero page is not supposed to work (not even reading the
cursor position from the kernal variables is supposed to work!). This is true
for almost every API and is not limited to cc65 and the 6502 platforms it
supports.

Regards


	Uz


-- 
Ullrich von Bassewitz                                  uz_at_musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de 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 : 2003-10-17 18:48:06 CEST