In SX Microcontrollers, SX/B Compiler and SX-Key Tool, peterverkaik wrote: The use of const char * parameters in functions, makes cc1b insert small pieces of runtimecode. I think there is one piece per const * parameter. _const1 MOV ci,W MOV W,ci AND W,#1 ADD PCL,W RETW 0 RETW 0 _const2 My library cstring.h has 9 functions, each of which has 1 const char * parameter, and then 9 pieces of runtime code are inserted. To overcome this I wrote a library dstring.h (the d in dstring stands for data - from cdata) that uses long instead of const char *. #pragma cdata must then be used to store strings in rom. Example: //area for storage of constant data (at end of program code) #define CDATA_START (_CHIP_CODESIZE_ - 0x0100) #pragma cdata[CDATA_START] #pragma cdata.LabelName = "Hello world\0" #pragma cdata.AnotherLabel = "Direct storage\0" #pragma cdata.Numbers = 0xF00,0xABC,0x0F #pragma cdata.LabelTable = LabelName,AnotherLabel,Numbers #pragma cdata.CDATA_END The define _CHIP_CODESIZE_ has been added to the chip header files. To get the length of a string in rom you can use long p = dstrlen(LabelName); I added 2 functions to memory.h long RomWord(long addr); //get word (12bits) from rom address char RomChar(long addr); //get char (8bits) from rom address I have put the const char * functions now in their own cstring.h library. (the c in cstring stands for const - from const *) The file memory_test.c shows a general program layout, including cdata. regards peter ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=204491#m205429 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2007 (http://www.dotNetBB.com)