Re: [cc65] ca65 signed byte storage

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2014-04-16 16:15:50
Hi!

On Tue, Apr 15, 2014 at 05:01:36PM -0400, Brad Smith wrote:
>    The addition of a range check on .byte breaks any old code that uses .byte
>    to store signed data.

That is correct. But adding the range check fixed an error. Before the fix,
ca65 accepted stuff like

        lda     #-2334

which is clearly not desirable. So while I admit the behaviour is still not
optimal, it's at least better than before.

>    There are workarounds, prefixing with < or using the force_range .feature,
>    but the < is ugly/verbose and both of these defeat what could be a useful
>    range check.

Well "ugly" is in the eye of the beholder and calling a single char op
"verbose" is a matter of opinion, too:) But you're right in that the "force
byte" op suppresses a range check.

Unfortunately, the old version of ca65 doesn't have a notation for signed /
unsigned internally. Numbers are stored as signeds and then interpreted as
signed or unsigned depending on the context. This is not easily changed and
the reason why the fix is implemented as it is.

Since Oliver is now maintaining the old versions, you may ask him if he's
willing to make the necessary changes. I for my part don't like the suggested
.SBYTE command, since it's just a half way fix. The behaviour is still
unchanged in all other places.

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz@musoftware.de
Encrypted email preferred                          PGP Key-Id: 29D93B10
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Wed Apr 16 16:16:07 2014

This archive was generated by hypermail 2.1.8 : 2014-04-16 16:16:09 CEST