Agh... I had 4years of Pascal and now I can't remember the precise line of code you want...
I remember it had something to do with keypressed();
It was a library command that would detect when a key was pressed and return the value of true. So, you could develop a loop to play the 500Hz sound while keypressed(var)!=1 ... upon keypress, you would launch into a case statement (or whatever) to perform the requested action and then return to the sound loop. The delay should be short enough to be where your users would only hear a small click...
Aside from that, I remember in HS we would occassionally "forget" the nosound(); command and have gawd-awful sounds coming from our PCs until we recompiled and executed a program *with* nosound();
But, its been a while since I played with Pascal. You've gotten me nostalgic for Turbo Pascal... maybe I'll play with it later.
This guy has it in action:
http://www.bowron.us/FILES/Languages/pascal
Just Ctrl-F for "keypressed"