This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to determine a pointer type?

If I have declare a generic pointer [char *test] in C;

How do I determine the pointer type in runtime? By checking the first byte of the pointer or is there any other functions doing this?

Thanks in advance

  • Yes, you can pick apart the pointer to determine to which memory space it points. The first byte is a tag byte, or extra address bits for far pointers; the other two are offsets into the memory space. Details are in the manual in the "Generic and Far Pointers" section, or you might check the "THEORY OF OPERATION" section about a page down into XBANKING.A51 in the library.

    You might also take a look at the macros in absacc.h. It has some predefined values that might be useful for comparison.