Try the following

[pascal]
if (keystate^[SDLK_q] <> 0) then
[/pascal]

You need to dereference the pointer in freepascal unless you use -MDelphi in which case you don't need the ^ (but it doesn't hurt)