>> Am 31.03.2018 um 10:42 schrieb Erik Petrich: >>> >>> I have enabled the assembler to emit 24-bit addresses in the relocation >>> records for stm8 like it does for ds390 and mcs51 (even though mcs51 is >>> only using 16-bit addresses). So this should allow you to reference the >>> individual bytes of the 24-bit address. However, I think additional >>> work >>> will still be needed to reference the upper 16 bits of a 24-bit >>> address. >>> >>> Erik > > I noticed you only changed outrxb() in asout.c and not outrw() which has a > similar exception. > >> Thanks. That makes function pointers already quite useful for the large >> memory model, and I have made the corresponding changes in the compiler >> to enable that use. In particular, calls via function pointers work now, >> as do const global function pointers (initialized by the address of a >> function). >> >> The only thing that doesn't work is assigning the address of a function >> to a function pointer. For that we'd need the upper 16 bits of a 24-bit >> symbol: Code generation wants to load them into 16-bit register x using >> ldw. I have tried to just use #(sym >> 16) where 16 bits would be >> expected. However, that results in broken code: The linker seems to >> write 24 bits into the binary, overwriting the first byte of the >> following instruction. >> >> Philipp > > In the generated code I see that the lower 16 bits are loaded into x, not > the upper. And the most significant byte is loaded into a by using #<sym, > but that seems to fail. If you instead use #(sym>>16) it seems alright to > me. > > Maarten
Correction: The least significant byte is loaded into a by using #<sym. Maybe > was intended? But the documentation states in AT.2.6 that this will take bit 15 down to 8. The documentation there also mentions a .msb directive for the DS80C390 only which configures to use another byte as high byte for >. Funnily enough there is no special assembler source for the ds390 as it uses the as8051. And on top of that the asstm8/stm8pst.c has it, but commented out. 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