memcmp for far pointers

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

memcmp for far pointers

Jump to solution
1,313 Views
michaelsarafidi
Contributor II

Hi there,

 

i am using Codewarrior IDE 5.9.0 build 5294 and i am trying to compare 2 tables with memcmp.

if both tables are in near memory then there is no problem. if one of them is in far memory then memcmp does not get the correct address.

it gets a 16bit address. I know that in standard c there is also _fmemcmp for far pointers. I am including ansib.lib that does not include _fmemcmp.

Should i include a different library or there is another workarround?

 

Thanks in advance.

Labels (1)
1 Solution
996 Views
kef
Specialist I

Hi

I think it's easiest to take some known memcmp implementation, rename it, and just add missing far keywords.

c/c++ memcmp: c++ - Implementing memcmp - Stack Overflow

View solution in original post

3 Replies
996 Views
michaelsarafidi
Contributor II


Thank you both.

I have created my own memcmp for far pointers as Edward proposed.

0 Kudos
Reply
996 Views
CrasyCat
Specialist III

Hello

ANSI libraries delivered with CodeWarrior for HCS12 are configured to handle near pointers if you are building in banked memory model.

This post provides you with some hint son how you can get memcpy or memcmp to handle far pointer as well.

CrasyCat

997 Views
kef
Specialist I

Hi

I think it's easiest to take some known memcmp implementation, rename it, and just add missing far keywords.

c/c++ memcmp: c++ - Implementing memcmp - Stack Overflow