Am 06.04.2018 um 14:12 schrieb Eric Rullens:
> Dear Philipp,
> 
> Apologies for bumping into this conversation (and thank you very much for
> all the work!), but I think the assembler does what it should do.
> 
> Please consider the following:
> 
> […]
> 
>                               124 ;   Load high and mid.
> 00804E AE 33 22         [ 2]  125     ldw     x, #(pattern>>8)

This one is the problem.

void main(void)
{
__asm
        nop
        ldw     x, #(_main >> 8)
        nop
__endasm;
}

results in this listing (comments removed):

_main:
      000000 9D               [ 1]   87         nop
      000001 AEr00r00         [ 2]   88         ldw     x, #(_main >> 8)
      000004 9D               [ 1]   89         nop
      000005 87               [ 5]   94         retf

And this binary:

:04F000008200F00892
:1DF00800AE00002707724F00005A26F9AE00002709D6F02AD700005A26F7CCF004F9
:04F00400AC00F02547
:06F025009DAE00F0C28761
:00000001FF

As you can see, the second nop got overwritten by 0xc2. Whenever I use
#(sym >> 8) where a 16-bit value is expected, I see the following
instruction being overwritten.

Philipp

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to