I was just browsing the FAQ at the Free Pascal site a few minutes ago, and they recommend looking at the source code for a simple little game,

http://thesheepkiller.sourceforge.net/

I haven't looked at it myself, but I believe they're reliable enough to pass this on as second hand info.