> 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
I see in the stm8-large regression that you fixed it by loading the least significant word into x and the most significant byte into a and write those to the function pointer location as you need them. Is this an OK solution or would you still prefer the most significant word in x and the least significant byte in a? I think the problem comes from the fact that Erik only patched outrxb() in asout.c and not outrw(). I've been looking at the .msb keyword, but that got introduced in asxxxx v4 to which we have not synchronized yet. That means that we can only use the right-shift operator and only for targets that use the sdas exception in asout.c. I don't really know a good reason not to use the exception for all targets, though. Maarten ------------------------------------------------------------------------------ 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