How to Interpret Custom long -1[C_CHARS]
Bob Drury
Posts: 236
in Propeller 2
Given C_CHARS is a constant with a value of 8 what does " Custom long -1[C_CHARS] " mean. Where can I find this type of definition of this for DAT blocks.
Thanks
Bob Drury
Comments
That is the equivalent of defining eight discrete longs with the value of -1 in the DAT block -- it's creating a DAT array with all values initialized to -1. You can address each long individully using Custom[idx] where idx is 0 to 7. If you need the address of the array you can get it with @Custom. If you later need 10 longs, you only have to change the definition of C_CHARS.
I have been looking for an explanation for DAT entries like 0[xxx] in the documentation. This was just perfect for adding another knowledge item, especially knowing this sets an array up with a default value. I got excited when I read this! Thank you again Jon!
Thanks Jon
Regards
Bob Drury
Glad to help guys. It's easy to miss, but the concept of repeated values in a DAT block is in the P1 manual.
Thanks for pointing that out, didn’t even think about looking in the P1 manual for that.