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

huge to far

Hello,

I think I finally found a Problem which caused me Trouble over the past Days, and now I'm trying to find a satisfying solution.

I'm using an Infineon XC161CJ with a grapical Display.
I use a struct which defines a variable width font:

typedef struct
{
...
// Font Bitmap Array
const ubyte huge *ubElement;
// Element Width
const ubyte *ubElementWidth;
} LCD_sFont;

const LCD_sFont cgsFont24x23 = {...};


The font array exceeds 16K so it must be declared as huge.

The Function which prints out the single characters expects a far pointer.

Obviously it causes trouble when accessing the character of the huge-array crossing the 16k page boundary by simply passing the adress of the huge-array + offset.


I would be glad to know if there is a posibility to get out of this without changing the Parameter of the Display-Function or making a temporary copy of the actual character.
A simple cast would be perfect but I'm afraid the solution will not be that easy ...


Thx and Best Regards,
Marcus

Parents
  • Sounds like you cannot easily rewrite the function that prints single characters to use huge pointers. The problem is, if that function is compiled to accept far pointers, it will use the EXTP instruction to access data with that pointer, and the EXTP instruction causes the affected instructions to ignore bits 14 and 15 of the page offset argument, if I am not mistaken. This leads to problems if a far object crosses a 16K boundary.
    Basically, a far pointer cannot point to an object crossing a 16K boundary. Maybe you should try splitting the font into smaller subfonts, so they can fit into far objects.

    Regards,
    - mike

Reply
  • Sounds like you cannot easily rewrite the function that prints single characters to use huge pointers. The problem is, if that function is compiled to accept far pointers, it will use the EXTP instruction to access data with that pointer, and the EXTP instruction causes the affected instructions to ignore bits 14 and 15 of the page offset argument, if I am not mistaken. This leads to problems if a far object crosses a 16K boundary.
    Basically, a far pointer cannot point to an object crossing a 16K boundary. Maybe you should try splitting the font into smaller subfonts, so they can fit into far objects.

    Regards,
    - mike

Children