Hi,

this basically the same issue as in my previous unanswered mail but
I've now dug deeper and think
that this realy is a compiler/linker issue.

I'm using versio
> SDCC :
mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08 2.7.4
#4988 (Jan  9 2008) (Mac OS X i386)

This C-fragment:

      char* p="Hello\n";
  
Gets compiled to this fragment (from the .lst file)

   0013 A6s00               150         lda     #>__str_0
   0015 B7*00               151         sta     *_main_sloc0_1_0
   0017 A6r00               152         lda     #__str_0
   0019 B7*01               153         sta     *(_main_sloc0_1_0 + 1)
 
Fine but suspicious as both 'sta' instructions use the direct
addressing mode
Disassembling the final the S-record file confirms:

E034:   A6 E0        LDA     #$E0               ; 224 
E036:   B7 00        STA     $00                ; 0 
E038:   A6 98        LDA     #$98               ; 152 
E03A:   B7 01        STA     $01                ; 1 

this was compiled with the '--data-loc 0x100' command line switch which
lead me to 
the wrong conclusion the internal compiler generated variables were
stored
on top internal registers. 

Compiling with '--data-loc 0x40' and '--data-loc 0x140', which both
result
in identical code, confirms that the real problem is the addressing
mode which 
should be 'extended', or the compiler should give a warning that the
data-loc
is out of range.

br Kusti


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to