Re: [cc65] ca65 bug? "Range Error" and scopes problem

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2013-01-05 18:20:05
Hi!

On Sat, Jan 05, 2013 at 11:14:15AM -0500, Jeremy Turner wrote:
>    .autoimport + 
>    .proc foo
>        bcc label            ; any branch instruction
>    .endproc
>    .proc bar
>        .export label
>        label:
>    .endproc
>    Replacing the branch instruction with a jmp results in the problem going
>    away. Is the linker able to figure out addresses but not branches? (This
>    seems to be failing at assembly.) Is there a correct way to do this?

The problem lies in ".autoimport +", whose use is not recommended. If you
remove it, the assembler will tell you that "label" is actually undefined.
Which is true, since the symbol with this name is in scope "bar".

So what happens is that "label" is undefined, but because of ".autoimport",
the assembler will make it an import. An import has absolute addressing by
default, so the assembler assumes that the symbol is not reachable by a short
branch.

>    Thanks for any insight.(I'm using the most recent snapshot.)

No solution (depends on your code), but I hope this clarifies things.

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz@musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Sat Jan 5 18:20:18 2013

This archive was generated by hypermail 2.1.8 : 2013-01-05 18:20:21 CET