> What I really want is > > sprintf (str,"%x", sys_rstack); > > which is the contents of Data 10h. However the above gets 4000 on the LCD > because its a pointer. > > 01B1 12 48 50 706 lcall _lcd_print > 707 ; main.c:107: sprintf (str,"%x", > sys_rstac > k); > 01B4 AD 10 708 mov r5,_sys_rstack > 01B6 7E 00 709 mov r6,#0x00 > 01B8 7F 40 710 mov r7,#0x40 > 01BA C0 05 711 push ar5 > 01BC C0 06 712 push ar6 > 01BE C0 07 713 push ar7
If you want to print a pointer, wouldn't it be wise to use the pointer format specifier (%p)? > however > > sprintf (str,"%x", (int) sys_rstack); > > does what I wish and displays the (truncated) pointer value correctly. As I > expected my problem was an incorrect understanding of what I wanted :-) > By the way > > sprintf (str,"%hx", *sys_rstack); > > displays Hx on the lcd not the now expected 61. In any case thanks for the > help! Since int and short int are identical in SDCC the 'h' modifier is not needed. And apparently printf_large.c does not support it. Maarten ------------------------------------------------------------------------------ All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2dcopy2 _______________________________________________ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user