oh thank you please take your time
Why are you not trying this yourself?
Just asking for code and solutions isn't going to make you learn to code, I can assure you.
Just try it really simple.
You want to have a buffer. A buffer is just an array. Let's say an array of 5 words (5 keys maximum).
You want to do the FIFO method. (First in, First out)
So you are going to put, lets say 3 words in the array from the beginning.
All the steps:
0 0 0 0 0
Then you put 1 in
1 0 0 0 0
Then you put 2 in
2 1 0 0 0
Then put 3 in
3 2 1 0 0
Now when you want to take out a number you just go from the end and traverse back to the beginning until you have a word <> 0. You change the direction but that's for later concern.
Could you code the first step... putting those 3 numbers in the array? As you can see for the second number you need to push the whole array to the right 1 place. Remember we did this for you highscore ranking procedure. Just try to program this first (trust me, otherwise you'll never learn).
Framework:
Program test;
var
Buffer: array[1..5] of Word;
begin
// go ahead. first set all the buffer to 0
// and then put 1, 2 and 3 in, shifting the numbers on each step.
end.