Well, I know isn't trivial That's why I didn't do it myself .

Anyway, maybe you should look into official allegro docs to see what functions are there? So we can avoid such things in future.