Re: [cc65] CBM units

From: Mark J. Reed <>
Date: 2010-02-21 14:45:33
On Sun, Feb 21, 2010 at 7:44 AM, Ullrich von Bassewitz <> wrote:
> While thinking about it: I doubt that $ba could contain zero, because the cc65
> compiled program has to be loaded from somewhere, so $ba would in any case
> contain the drive from which the program was loaded.

That's assuming there's no calls to whatever sets that in between
loading and running the program.

> Ok, good point. But this means, just checking for zero is wrong. The code
> would have to check if $ba is less than eight and substitute 8 in this case.
> Right?

If the value is below 8 (or above the maximum?  Is there a ceiling on
the serial device number range for disk drives?), all you know is that
the last operation wasn't to disk.  You don't have any way of knowing
what unit the last disk operation targeted - someone could have loaded
the program from 9 and then printed on 4 or 5 before running it.   8
is still a reasonable default, of course.

But comparing against the high and low ends of a range is a few more
bytes and cycles compared to something relatively straightforward

           LDA $BA
           BEQ GOTIT
           LDA #8

Mark J. Reed <>
To unsubscribe from the list send mail to with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Sun Feb 21 14:45:43 2010

This archive was generated by hypermail 2.1.8 : 2010-02-21 14:45:45 CET