Hi Richard,
yes, strings need to be altered before use.
Well, I had about 3K free on 64k (PIC18F4680) and needed to add more code, so I was looking for some tricks to save space and make a diet to the actual code.
I have noted that if I substitute an arraywrite entry (for a string of about 100 char) with the method above, I save around 600 bytes of code. I have about 10 difefrent strings, so the total saved space is several KB.
To be honest I can't understand why there is so much difference between the two methods ....
Also I have noted this: in a blank project like the sample above, the difference between the two methods is about 150 bytes. Inside my 63KB project, the difference is more than 600 bytes.
So it probably depends where the instruction and the buffer are located (bank switching, etc). For thei sreason I wonder also if the method above with the macro is correct or can bring to unexpected behavours in some situations .....
For example: why did you say before "interrupts need to be disabled" ? Context is fully saved and restored in the interrupt routines. Also I use "PBP Instant Interrupt" of that great Darrel that should be bullet-proof.
Marco
Bookmarks