I'm working on migrating a textmode game of mine from BP7.0 to FreePascal. In my BP7.0 code I used a unit for detecting whether or not a key is currently down. I originally thought that I could use the FreePascal Keyboard unit to do the same, but it doesn't seem able to put simultaneous keypresses on the event queue. So... I've decided to try out JEDI-SDL instead. For some reason I can't get the event structure to work:

[pascal] IF SDL_INIT(SDL_INIT_AUDIO) < 0 THEN BEGIN
{ quit}
END
ELSE BEGIN
A := False;
B := False;

SDL_EnableUNICODE(1);
REPEAT
ClearScreenBuffer;
WHILE SDL_PollEvent(@Event) > 0 DO BEGIN
CASE Event.Type_ OF
SDL_KeyDown : BEGIN
CASE Event.Key.KeySym.Sym OF
SDLK_a : A := True;
SDLK_q : Stop := True;
END;
END;
SDL_KeyUp : BEGIN
CASE Event.Key.KeySym.Sym OF
SDLK_a : A := False;
END;
END;
END;
END;
IF A THEN WriteFullLineToScreenBuffer(0,0,3,'A DOWN ')
ELSE WriteFullLineToScreenBuffer(0,0,3,'A NOT DOWN');
UpdateTheScreen;
z.delay(25000);
UNTIL Stop;
END;
[/pascal]

I want the above code excerpt to have the two booleans A and B, which both tell me whether or not the A and B keys are currently pressed. However, I always get the 'A NOT DOWN' message and I can't press 'q' to stop the loop from running. What am I doing wrong?

Also, I couldn't find any documentation for GetKeyStates in the JEDI docs only in the SDL for C docs. Can't this function be used in FreePascal?