Hi all,
I'm using this code to load an array with a certain text string
I have many different string in variuos parts of the program and this code consumes a lot of space, so I would like to optimize it using macros .Code:inbuff VAR BYTE(100) arraywrite inbuff,["Sample test string"]
It's easy to store the string in code space and then with a macro retrieve the address and read it:
Now I have some difficulties to continue: instead of print the string, I need to store it in RAM, the same things that does ArrayWrite.Code:ROM_String1: PokeCode "Sample test string",0 ; macro to retrieve the address @getaddr macro Text, Addr @ movlw low Text @ movwf Addr @ movlw High Text @ movwf Addr + 1 @ endm ; code @ getaddr _ROM_String1, _w0 repeat peekcode w0, x if x then debug x w0=w0+2 endif until x=0 ' print till end of string '0' Sb00: .....
So the macro should be modified to accept as parameters, the source ROM string and the destination address in RAM
Something like
So calling the macro I can specify any string stored in ROM and any RAM destination where to put it.Code:@ LoadStr _ROM_CfgString, _inbuff
Could anybody help me to complete the macro ?
Thanks
Marco




Bookmarks