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

Locating code at a certain address

How can one locate a table of constants at a certain address in C ?

Parents
  • Well,
    Andrew Neil asked a good question - why do you need with fixed address?
    For simple example, you have 4 tables of coefficients, each one contains 8 bytes. So then do something like (put your values here):

    unsigned char code tables[4][8] =
    {
    {1,2,3,4,5,6,7,8},
    {11,12,13,14,15,16,17,18},
    {31,32,33,34,35,36,37,38},
    {71,72,73,74,75,76,77,78},
    };
    And redefine pointer when it needs:
    unsigned char *current_table;
    switch (redefine_condition)
    {
    case condition_1: current_table=tables[0]; break;
    case condition_2: current_table=tables[1]; break;
    case condition_3: current_table=tables[2]; break;
    case condition_4: current_table=tables[3]; break;
    }
    Good days!

Reply
  • Well,
    Andrew Neil asked a good question - why do you need with fixed address?
    For simple example, you have 4 tables of coefficients, each one contains 8 bytes. So then do something like (put your values here):

    unsigned char code tables[4][8] =
    {
    {1,2,3,4,5,6,7,8},
    {11,12,13,14,15,16,17,18},
    {31,32,33,34,35,36,37,38},
    {71,72,73,74,75,76,77,78},
    };
    And redefine pointer when it needs:
    unsigned char *current_table;
    switch (redefine_condition)
    {
    case condition_1: current_table=tables[0]; break;
    case condition_2: current_table=tables[1]; break;
    case condition_3: current_table=tables[2]; break;
    case condition_4: current_table=tables[3]; break;
    }
    Good days!

Children
No data