Re: [cc65] bitwise not broken in ca65?

From: Ullrich von Bassewitz <>
Date: 2011-12-29 19:06:00
On Thu, Dec 29, 2011 at 01:32:00PM +0100, Spiro Trikaliotis wrote:
> BTW: Uz, was this expected behaviour ever documented? Somehow, I do not
> like the new one (obviously).
> The term "old code *exploiting* the behaviour" is something that hints
> that people writing that code would have had at least the possibility to
> know that it was not meant this way.

It hasn't been documented but has worked in all other places correctly (I

Do you expect a range error if a short branch is out of reach? Or do you want
the assembler to truncate the distance silently so that it is in the matching
range? Do you expect the assembler to complain when a byte value is out of
byte range, or do you want it to silently mask it? Do you want an error
message when loading a constant like #300 into A, or do you want the assembler
to automatically use the low byte? All these cases are in my eyes coding
errors that should result in a diagnostic by the assembler because of a the
range problem.

The range error check in older versions of the assembler did miss all cases
where the number was negative, which is why some constructs worked when they
shouldn't have worked. To see why the old assembler version was wrong, just

        lda     #-300

It is silently truncated to "$A9 $D4". This has now been fixed, which results
in a diagnostic for old code that exploits the behaviour.

> I expect an option to force the old behaviour is out of reach? (For me,
> not only OpenCBM is affected, but also other code.)

I can of course add a "truncate any number until it fits" flag to the
assembler, but I'm pretty sure most people won't be happy with that.

Of course I can see your problem, and I'm very sorry for introducing the error
in the first place. I know that fixing it now causes trouble, but I'm sure
it's better this way than accepting and silently truncating numbers that are
out of range.



Ullrich von Bassewitz                        
To unsubscribe from the list send mail to with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Thu Dec 29 19:06:10 2011

This archive was generated by hypermail 2.1.8 : 2011-12-29 19:06:14 CET