Re: [cc65] CBM units

From: Greg King <>
Date: 2010-02-04 03:13:14
From: "Ullrich von Bassewitz"; on Wed., Feb. 03, 2010; at 12:29 PM -0500
> On Wed, Feb 03, 2010 at 05:56:22PM +0100, Oliver Schmidt wrote:
> >
> > Is there a way that a C64 user can leverage "a current unit"?
> The kernal has no such thing. You must specify a unit each time, a file is
> loaded. On the C64, there is just a variable where the kernal remembers
> the unit from the last LOAD. It is not used for anything else
> (CBM hackers:  please correct me if that is wrong).

The "FA" (First Address) variable is used for all file "switching".  It is
changed by four Kernal functions:  SETLFS, CHKIN, CHKOUT, and CLOSE
(LOAD calls SETLFS).

From: "Oliver Schmidt"; on Wed., Feb. 03, 2010; at 05:36 PM -0500
> Things obviously are more complicated. :-( When a cc65 main() is
> enterred, the zero-page location $BA doesn't contain the number of the
> unit the program was loaded from (anymore). This is, BTW, the code I
> added:
>   _curunit = *(unsigned char *)0xBA;

It's changed by the stdin, stdout, and stderr constructors.

To unsubscribe from the list send mail to with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Thu Feb 4 03:13:37 2010

This archive was generated by hypermail 2.1.8 : 2010-02-04 03:13:40 CET