Shop OBEX P1 Docs P2 Docs Learn Events
How to Interpret Custom long -1[C_CHARS] — Parallax Forums

How to Interpret Custom long -1[C_CHARS]

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

  • JonnyMacJonnyMac Posts: 8,929
    edited 2021-02-19 20:13

    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.

  • @JonnyMac said:
    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.

Sign In or Register to comment.