well i know all the ascii key codes but how to use them?

if i for example want to move imgBall 500 twips left if i press "d" , what should i write then? It just can't figure it out